# packages/gnutls/auxbuild
#

# download and unpack tarball
TARVERSION="2.8.5"
TARDIR="${BUILD_PACKAGE}-${TARVERSION}"
TARBALL="${TARDIR}.tar.bz2"
build_download "ftp://ftp.gnupg.org/gcrypt/gnutls/${TARBALL}"
build_unpack "${TARBALL}"
PKGDIR="${TARDIR}"

# invoke configure (directory, prefix, extra arguments)
export LIBS="-lgpg-error -lgcrypt -lz -llzo2"
build_autoconf "${PKGDIR}" "" "--disable-dependency-tracking --disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf --disable-cxx --disable-nls --disable-rpath --disable-guile --disable-openssl-compatibility --with-included-libtasn1 --with-included-libcfg --with-libreadline-prefix=${CROSSLIB} --with-libgcrypt-prefix=${CROSSLIB} --with-zlib --with-libz-prefix=${CROSSLIB} --disable-static --with-lzo"

# clobber any badly added -L/usr/lib directives
find "Distn/${PKGDIR}" -type f -name 'Makefile' -exec \
	sed -i {} -e "s, -L/usr/lib , ," \;

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

# stop libtool adding -L/usr/lib; see http://www.metastatic.org/text/libtool.html
find "Distn/${PKGDIR}" -type f -name '*.la' -exec \
    sed -i {} -e "s,^libdir=.*\$,libdir=${BUILDROOT}/usr/lib," \;

build_make "${PKGDIR}" "install"

# remove M4 macros
rm -rf "${BUILDROOT}/usr/share/aclocal"

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