preconfig() {
    CFLAGS='-D__GNU_LIBRARY__ -O2 -g'; export CFLAGS
    CXXFLAGS='-D__GNU_LIBRARY__ -O2 -g'; export CXXFLAGS
    export PACKAGE=groff
    :
}
postconfig() {
    # automode=`${build_cc} --print-file-name=automode.o`
    # sedit 's%^\(LIBS *= *.*\)$%\1 '"$automode"'%' Makefile 4
    opt='-D__GETOPT_H__ -O2 -g'
}

preinstall() {
    useDESTDIR=1
}

postinstall() {
    rm -f $inst/usr/bin/groff
}

prebuild() {
    mkdir -p $inst/usr src/roff/groff
    (cd src/roff/groff; ln -s /usr/bin/groff .)
    mkdir -p $build/src/libs/gnulib
    (cd $build/src/libs/gnulib; src=$src/src/libs/gnulib; doconfig)
}

prepackage() {
     addpkg perl 'usr/.*/(afmtodit|chem|devpdf|groffer|grog|gropdf|mmroff|pdfmom|roff2|pdf\.tmac)'
}
