postfix: add -lnsl and -lresolv to SYSLIBS by default

When building native package, the do_compile function tries to check
libnsl.so and libresolv.so on host machine and add -lnsl and -lresolv to
SYSLIBS if they exist. But finally it will link the libnsl.so from
${STAGING_LIBDIR_NATIVE}. Actually there is no need to check them since
the libnsl2 is specified in DEPENDS and libresolv.so is from c libarary.
So add -lnsl and -lresolv to SYSLIBS directly.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Yi Zhao 2018-10-12 16:22:34 +08:00 committed by Khem Raj
parent 69e5fa1485
commit 47a9cc6c53
3 changed files with 59 additions and 18 deletions

View File

@ -0,0 +1,58 @@
From 4caa18feb70f8f3d133657c1250a53f4e292bb42 Mon Sep 17 00:00:00 2001
From: Yi Zhao <yi.zhao@windriver.com>
Date: Fri, 12 Oct 2018 12:38:02 +0800
Subject: [PATCH] makedefs: add -lnsl and -lresolv to SYSLIBS by default
We don't need to check libnsl.so and libresolv.so since the libnsl2 is
specified in DEPENDS and libresolv.so is from c libarary.
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
makedefs | 22 ++--------------------
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/makedefs b/makedefs
index 2683bce..8f1b3f4 100644
--- a/makedefs
+++ b/makedefs
@@ -484,16 +484,7 @@ case "$SYSTEM.$RELEASE" in
SYSLIBS="$SYSLIBS -ldb"
;;
esac
- for name in nsl resolv $GDBM_LIBS
- do
- for lib in $BUILD_SYSROOT_NSL_PATH
- do
- test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
- SYSLIBS="$SYSLIBS -l$name"
- break
- }
- done
- done
+ SYSLIBS="$SYSLIBS -lnsl -lresolv"
# Kernel 2.4 added IPv6
case "$RELEASE" in
2.[0-3].*) CCARGS="$CCARGS -DNO_IPV6";;
@@ -561,16 +552,7 @@ EOF
SYSLIBS="$SYSLIBS -ldb"
;;
esac
- for name in nsl resolv
- do
- for lib in $BUILD_SYSROOT_NSL_PATH
- do
- test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
- SYSLIBS="$SYSLIBS -l$name"
- break
- }
- done
- done
+ SYSLIBS="$SYSLIBS -lnsl -lresolv"
SYSLIBS="$SYSLIBS -ldl"
: ${SHLIB_SUFFIX=.so}
: ${SHLIB_CFLAGS=-fPIC}
--
2.7.4

View File

@ -97,27 +97,9 @@ do_compile () {
"s:\$(SHELL) makedefs):\$(SHELL) makedefs $SYSTEM $RELEASE):" \
${S}/Makefile.in
export BUILD_SYSROOT="${STAGING_DIR_HOST}"
export BUILD_SYSROOT_NSL_PATH="${STAGING_BASELIBDIR} \
${STAGING_LIBDIR}"
else
# native build
export BUILD_SYSROOT="${STAGING_DIR_NATIVE}"
# ubuntu x86 host: /lib/x86_64-linux-gnu(64) /lib/i386-linux-gnu (32)
# on 64 bits, 32 libs in i386-linux-gnu
# let makedefs finds nsl and resolv libs, host CC will link
# the correct libraries
BUILD_SYSROOT_NSL_PATH="$(${CC} -print-search-dirs 2>/dev/null | \
sed -n '/^libraries: =/s/libraries: =//p' | \
sed -e 's/:/\n/g' | xargs -n1 readlink -f | \
grep -v 'gcc\|/[0-9.]\+$' | sort -u)"
if [ -z "$BUILD_SYSROOT_NSL_PATH" ]; then
BUILD_SYSROOT_NSL_PATH="/usr/lib64 /lib64 \
/lib/x86_64-linux-gnu \
/usr/lib /lib \
/lib/i386-linux-gnu"
fi
export BUILD_SYSROOT_NSL_PATH
fi
oe_runmake makefiles

View File

@ -3,6 +3,7 @@ require postfix.inc
SRC_URI += "file://0001-makedefs-Use-native-compiler-to-build-makedefs.test.patch \
file://postfix-install.patch \
file://icu-config.patch \
file://0001-makedefs-add-lnsl-and-lresolv-to-SYSLIBS-by-default.patch \
"
SRC_URI[md5sum] = "4381c6492f415e4a69cf5099d4acea76"