1From 9000ee4d8bb5c5e0bcc588e9bec86eb56f4285e1 Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Fri, 19 Jun 2015 16:45:54 +0900
4Subject: [PATCH] Fix makedefs
5
61)remove RANLIB, SYSLIBS, AR and get them from env.
72)reference sysroot when searching header files
83)include sysroot path instead of absolute include path
9for Linux2 and Linux3 systems.
104)for non-native build, search STAGING_BASELIBDIR/LIBDIR
11  native build, search host library path for nsl and resolv library
12  which comes from libc
13
14Upstream-Status: Inappropriate [embedded specific]
15
16Signed-off-by: Yao Zhao <yao.zhao@windriver.com>
17---
18 makedefs | 27 +++++++++++----------------
19 1 file changed, 11 insertions(+), 16 deletions(-)
20
21diff --git a/makedefs b/makedefs
22index 3448c1e..78e0717 100644
23--- a/makedefs
24+++ b/makedefs
25@@ -197,9 +197,6 @@ echo "# pie=$pie"
26
27 # Defaults for most sane systems
28
29-RANLIB=ranlib
30-SYSLIBS=
31-AR=ar
32 ARFL=rv
33
34 # Ugly function to make our error message more visible among the
35@@ -492,12 +489,12 @@ case "$SYSTEM.$RELEASE" in
36 		case "$CCARGS" in
37 		 *-DNO_DB*) ;;
38 		 *-DHAS_DB*) ;;
39-		 *) if [ -f /usr/include/db.h ]
40+		 *) if [ -f "$BUILD_SYSROOT"/usr/include/db.h ]
41 		    then
42 			: we are all set
43-		    elif [ -f /usr/include/db/db.h ]
44+		    elif [ -f "$BUILD_SYSROOT"/usr/include/db/db.h ]
45 		    then
46-			CCARGS="$CCARGS -I/usr/include/db"
47+			CCARGS="$CCARGS -I"$BUILD_SYSROOT"/usr/include/db"
48 		    else
49 			# No, we're not going to try db1 db2 db3 etc.
50 			# On a properly installed system, Postfix builds
51@@ -506,12 +503,12 @@ case "$SYSTEM.$RELEASE" in
52 			echo "Install the appropriate db*-devel package first." 1>&2
53 			exit 1
54 		    fi
55-		    SYSLIBS="-ldb"
56+		    SYSLIBS="$SYSLIBS -ldb"
57 		    ;;
58 		esac
59 		for name in nsl resolv $GDBM_LIBS
60 		do
61-		    for lib in /usr/lib64 /lib64 /usr/lib /lib
62+		    for lib in $BUILD_SYSROOT_NSL_PATH
63 		    do
64 			test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
65 			    SYSLIBS="$SYSLIBS -l$name"
66@@ -531,7 +528,7 @@ case "$SYSTEM.$RELEASE" in
67 		       if [ `expr "X$CCARGS" : "X.*-DNO_EPOLL"` -gt 0 ]
68 		       then
69 			   :
70-		       elif [ ! -e /usr/include/sys/epoll.h ]
71+		       elif [ ! -e "$BUILD_SYSROOT"/usr/include/sys/epoll.h ]
72 		       then
73 			   echo CCARGS="$CCARGS -DNO_EPOLL"
74 		       else
75@@ -555,8 +552,6 @@ int     main(int argc, char **argv)
76 }
77 EOF
78 			   ${CC-gcc} -o makedefs.test makedefs.test.c || exit 1
79-			   ./makedefs.test 2>/dev/null ||
80-				CCARGS="$CCARGS -DNO_EPOLL"
81 			   rm -f makedefs.test makedefs.test.[co]
82 		       fi;;
83 		esac
84@@ -572,12 +567,12 @@ EOF
85 		case "$CCARGS" in
86 		 *-DNO_DB*) ;;
87 		 *-DHAS_DB*) ;;
88-		 *) if [ -f /usr/include/db.h ]
89+		 *) if [ -f "$BUILD_SYSROOT"/usr/include/db.h ]
90 		    then
91 			: we are all set
92-		    elif [ -f /usr/include/db/db.h ]
93+		    elif [ -f "$BUILD_SYSROOT"/usr/include/db/db.h ]
94 		    then
95-			CCARGS="$CCARGS -I/usr/include/db"
96+			CCARGS="$CCARGS -I"$BUILD_SYSROOT"/usr/include/db"
97 		    else
98 			# On a properly installed system, Postfix builds
99 			# by including <db.h> and by linking with -ldb
100@@ -585,12 +580,12 @@ EOF
101 			echo "Install the appropriate db*-devel package first." 1>&2
102 			exit 1
103 		    fi
104-		    SYSLIBS="-ldb"
105+		    SYSLIBS="$SYSLIBS -ldb"
106 		    ;;
107 		esac
108 		for name in nsl resolv
109 		do
110-		    for lib in /usr/lib64 /lib64 /usr/lib /usr/lib/* /lib /lib/*
111+		    for lib in $BUILD_SYSROOT_NSL_PATH
112 		    do
113 			test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
114 			    SYSLIBS="$SYSLIBS -l$name"
115--
1162.17.1
117
118