#!/bin/env beesh

# BEE_VERSION xpdf-3.04-0

BEE_CONFIGURE=compat

SRCURL[0]="ftp://ftp.foolabs.com/pub/xpdf/xpdf-${PKGVERSION}.tar.gz"

# PATCHURL+=()

# EXCLUDE+=()

# build_in_sourcedir

# sourcesubdir_append src

#mee_extract() {
#    bee_extract "${@}"
#}

#mee_patch() {
#    bee_patch "${@}"
#}

mee_configure() {
    bee_configure \
        --with-freetype2-includes=/usr/include/freetype2 \
        --enable-opi \
        --enable-multithreaded \
        --enable-wordlist \
        --enable-a4-paper
}

#mee_build() {
#    bee_build
#}

#mee_install() {
#    bee_install
#}

mee_install_post() {
# avoid conflicts with poppler. prefix all xpdf files with 'x'
    for b in pdfdetach pdffonts pdfimages pdfinfo pdftoppm pdftops pdftotext; do
        mv -v ${D}${BINDIR}/${b} ${D}${BINDIR}/x${b}
        mv -v ${D}${MANDIR}/man1/${b}.1 ${D}${MANDIR}/man1/x${b}.1
        perl -pi -e 's/(pdfdetach|pdffonts|pdfimages|pdfinfo|pdftoppm|pdftops|pdftotext)/x$1/g' ${D}${MANDIR}/man1/x${b}.1
    done
}