# packages/gnuplot/auxbuild
#

# download and unpack tarball
TARVERSION="4.2.6"
TARDIR="${BUILD_PACKAGE}-${TARVERSION}"
TARBALL="${TARDIR}.tar.gz"
build_download "http://kent.dl.sourceforge.net/project/gnuplot/gnuplot/4.2.6/${TARBALL}"
build_unpack "${TARBALL}"
PKGDIR="${TARDIR}"

# apply patches matching pattern (repository, patch prefix)
build_patch "${PKGDIR}" "${BUILD_PACKAGE}-ALL-"
build_patch "${PKGDIR}" "${BUILD_PACKAGE}-${TARVERSION}-"

# invoke configure (directory, prefix, extra arguments)
build_autoconf "${PKGDIR}" "" "--without-x --without-pdf --disable-wxwidgets --with-readline=gnu --without-lisp-files --without-tutorial --with-gd=${CROSSLIB} --disable-thin-splines"

# don't build certain things
sed -i "Distn/${PKGDIR}/Makefile" \
    -e "s/^SUBDIRS *= *\(.*\) demo  *\(.*\)$/SUBDIRS = \1 \2/" \
    -e "s/^SUBDIRS *= *\(.*\) tutorial  *\(.*\)$/SUBDIRS = \1 \2/" \
    -e "s/^SUBDIRS *= *\(.*\) man  *\(.*\)$/SUBDIRS = \1 \2/"

# run make, make install (directory, extra arguments)
build_make "${PKGDIR}"
build_make "${PKGDIR}" "install"

# clean up
rm -rf "${BUILDROOT}/usr/share/texmf" "${BUILDROOT}/usr/libexec" "${BUILDROOT}/usr/lib"
strip_files

true
# vim: ts=4:sw=4:expandtab:syntax=sh
