From 51e29c0a1d98948118e5135bb817a96811105d39 Mon Sep 17 00:00:00 2001 From: Li xin Date: Fri, 19 Jun 2015 16:45:54 +0900 Subject: [PATCH] Fix makedefs 1)remove RANLIB, SYSLIBS, AR and get them from env. 2)reference sysroot when searching header files 3)include sysroot path instead of absolute include path for Linux2 and Linux3 systems. 4)for non-native build, search STAGING_BASELIBDIR/LIBDIR native build, search host library path for nsl and resolv library which comes from libc Upstream-Status: Inappropriate [embedded specific] Signed-off-by: Yao Zhao --- makedefs | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/makedefs b/makedefs index d5103ce..9713327 100644 --- a/makedefs +++ b/makedefs @@ -232,9 +232,6 @@ echo "# pie=$pie" # Defaults for most sane systems -RANLIB=ranlib -SYSLIBS= -AR=ar ARFL=rv # Ugly function to make our error message more visible among the @@ -608,12 +605,12 @@ case "$SYSTEM.$RELEASE" in case "$CCARGS" in *-DNO_DB*) ;; *-DHAS_DB*) ;; - *) if [ -f /usr/include/db.h ] + *) if [ -f "$BUILD_SYSROOT"/usr/include/db.h ] then : we are all set - elif [ -f /usr/include/db/db.h ] + elif [ -f "$BUILD_SYSROOT"/usr/include/db/db.h ] then - CCARGS="$CCARGS -I/usr/include/db" + CCARGS="$CCARGS -I"$BUILD_SYSROOT"/usr/include/db" else # No, we're not going to try db1 db2 db3 etc. # On a properly installed system, Postfix builds @@ -623,12 +620,12 @@ case "$SYSTEM.$RELEASE" in echo "Alternatively, build with CCARGS=\"-NO_DB ...\"" 1>&2 exit 1 fi - SYSLIBS="-ldb" + SYSLIBS="$SYSLIBS -ldb" ;; esac for name in nsl resolv $GDBM_LIBS do - for lib in /usr/lib64 /lib64 /usr/lib /lib + for lib in $BUILD_SYSROOT_NSL_PATH do test -e $lib/lib$name.a -o -e $lib/lib$name.so && { SYSLIBS="$SYSLIBS -l$name" @@ -648,7 +645,7 @@ case "$SYSTEM.$RELEASE" in if [ `expr "X$CCARGS" : "X.*-DNO_EPOLL"` -gt 0 ] then : - elif [ ! -e /usr/include/sys/epoll.h ] + elif [ ! -e "$BUILD_SYSROOT"/usr/include/sys/epoll.h ] then echo CCARGS="$CCARGS -DNO_EPOLL" else @@ -672,8 +669,6 @@ int main(int argc, char **argv) } EOF ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1 - ./makedefs.test 2>/dev/null || - CCARGS="$CCARGS -DNO_EPOLL" rm -f makedefs.test makedefs.test.[co] fi;; esac @@ -690,12 +685,12 @@ EOF case "$CCARGS" in *-DNO_DB*) ;; *-DHAS_DB*) ;; - *) if [ -f /usr/include/db.h ] + *) if [ -f "$BUILD_SYSROOT"/usr/include/db.h ] then : we are all set - elif [ -f /usr/include/db/db.h ] + elif [ -f "$BUILD_SYSROOT"/usr/include/db/db.h ] then - CCARGS="$CCARGS -I/usr/include/db" + CCARGS="$CCARGS -I"$BUILD_SYSROOT"/usr/include/db" else # On a properly installed system, Postfix builds # by including and by linking with -ldb @@ -705,12 +700,12 @@ EOF echo "See: https://www.postfix.org/NON_BERKELEYDB_README.html#build-conf" 1>&2 exit 1 fi - SYSLIBS="-ldb" + SYSLIBS="$SYSLIBS -ldb" ;; esac for name in nsl resolv do - for lib in /usr/lib64 /lib64 /usr/lib /usr/lib/* /lib /lib/* + for lib in $BUILD_SYSROOT_NSL_PATH do test -e $lib/lib$name.a -o -e $lib/lib$name.so && { SYSLIBS="$SYSLIBS -l$name"