# packages/stunnel/auxbuild
#

# download and unpack tarball
TARVERSION="4.25"
TARDIR="${BUILD_PACKAGE}-${TARVERSION}"
TARBALL="${TARDIR}.tar.gz"
build_download "http://www.stunnel.org/download/stunnel/src/${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}-"


sed -i -e "s/^install-data-local:/do-not-run-this:/" \
        Distn/${TARDIR}/tools/Makefile.in || (echo "sed failed" && false)


# invoke configure (directory, prefix, extra arguments)
build_autoconf "${PKGDIR}" "/usr" "--with-random=/dev/urandom --with-ssl=${CROSSLIB}"

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

# copy static content
cp -a static/* "${BUILDROOT}"

# clean up
rm -f "${BUILDROOT}/etc/stunnel/stunnel.conf-sample"
rm -f "${BUILDROOT}/usr/bin/stunnel3"

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