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