Try harder to sanitize the environment before running configure.

Remove a workaround for older Unbound versions that used sbrk.

Approved by:	re (gjb)
This commit is contained in:
Dag-Erling Smørgrav 2018-10-10 22:29:06 +00:00
parent dbffe0f105
commit b319ead8be
3 changed files with 37 additions and 26 deletions

View File

@ -5,15 +5,26 @@
set -e set -e
error() {
echo "$@" >&2
exit 1
}
ldns=$(dirname $(realpath $0)) ldns=$(dirname $(realpath $0))
cd $ldns cd $ldns
libtoolize --copy # Run autotools before we drop LOCALBASE out of PATH
autoheader (cd $ldns && libtoolize --copy && autoheader && autoconf)
autoconf (cd $ldns/drill && aclocal && autoheader && autoconf)
# Ensure we use the correct toolchain and clean our environment
export CC=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCC)
export CPP=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCPP)
unset CFLAGS CPPFLAGS LDFLAGS LD_LIBRARY_PATH LIBS
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
cd $ldns
./configure --prefix= --exec-prefix=/usr --disable-dane-ta-usage ./configure --prefix= --exec-prefix=/usr --disable-dane-ta-usage
cd $ldns/drill cd $ldns/drill
autoheader
autoconf
./configure --prefix= --exec-prefix=/usr ./configure --prefix= --exec-prefix=/usr

View File

@ -13,6 +13,15 @@ error() {
unbound=$(dirname $(realpath $0)) unbound=$(dirname $(realpath $0))
cd $unbound cd $unbound
# Run autotools before we drop LOCALBASE out of PATH
(cd $unbound && libtoolize --copy && autoheader && autoconf)
# Ensure we use the correct toolchain and clean our environment
export CC=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCC)
export CPP=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCPP)
unset CFLAGS CPPFLAGS LDFLAGS LD_LIBRARY_PATH LIBS
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
ldnssrc=$(realpath $unbound/../ldns) ldnssrc=$(realpath $unbound/../ldns)
[ -f $ldnssrc/ldns/ldns.h ] || error "can't find LDNS sources" [ -f $ldnssrc/ldns/ldns.h ] || error "can't find LDNS sources"
export CFLAGS="-I$ldnssrc" export CFLAGS="-I$ldnssrc"
@ -24,17 +33,9 @@ ldnsobj=$(realpath $(make -C$ldnsbld -V.OBJDIR))
[ -f $ldnsobj/libprivateldns.a ] || error "can't find LDNS object directory" [ -f $ldnsobj/libprivateldns.a ] || error "can't find LDNS object directory"
export LDFLAGS="-L$ldnsobj" export LDFLAGS="-L$ldnsobj"
export CC=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCC) cd $unbound
export CPP=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCPP)
autoconf
autoheader
./configure \ ./configure \
--prefix= --exec-prefix=/usr \ --prefix= --exec-prefix=/usr \
--with-conf-file=/var/unbound/unbound.conf \ --with-conf-file=/var/unbound/unbound.conf \
--with-run-dir=/var/unbound \ --with-run-dir=/var/unbound \
--with-username=unbound --with-username=unbound
# Don't try to provide bogus memory usage statistics based on sbrk(2).
sed -n -i.orig -e '/HAVE_SBRK/!p' config.status
./config.status config.h

View File

@ -16,28 +16,27 @@ configure_args="
set -e set -e
# make sure configure uses the correct compiler openssh=$(dirname $(realpath $0))
cd $openssh
# Run autotools before we drop LOCALBASE out of PATH
(cd $openssh && libtoolize --copy && autoheader && autoconf)
# Ensure we use the correct toolchain and clean our environment
export CC=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCC) export CC=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCC)
export CPP=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCPP) export CPP=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCPP)
unset CFLAGS CPPFLAGS LDFLAGS LIBS unset CFLAGS CPPFLAGS LDFLAGS LD_LIBRARY_PATH LIBS
# regenerate configure and config.h.in
autoheader
autoconf
# reset PATH to avoid picking up the wrong libraries
export PATH=/bin:/sbin:/usr/bin:/usr/sbin export PATH=/bin:/sbin:/usr/bin:/usr/sbin
unset LD_LIBRARY_PATH
# generate config.h with krb5 and stash it # Generate config.h with krb5 and stash it
sh configure $configure_args --with-kerberos5=/usr sh configure $configure_args --with-kerberos5=/usr
mv config.log config.log.orig mv config.log config.log.orig
mv config.h config.h.orig mv config.h config.h.orig
# generate config.h without krb5 # Generate config.h without krb5
sh configure $configure_args --without-kerberos5 sh configure $configure_args --without-kerberos5
# extract the difference # Extract the difference
echo '/* $Free''BSD$ */' > krb5_config.h echo '/* $Free''BSD$ */' > krb5_config.h
diff -u config.h.orig config.h | diff -u config.h.orig config.h |
sed -n '/^-#define/s/^-//p' | sed -n '/^-#define/s/^-//p' |