williamh    14/04/20 23:21:05

  Added:                dhcpcd-6.3.2-gettime-dlopen.patch
                        dhcpcd-6.3.2-fix-cc-setting.patch
                        dhcpcd-6.3.2-fix-host.patch
  Log:
  Add a patch to fix handling of the CC variable and a patch to fix handling of 
--host, both for bug#505508. Also add a patch to make configure script test for 
dlopen.
  
  (Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key 
0x8568F528)

Revision  Changes    Path
1.1                  net-misc/dhcpcd/files/dhcpcd-6.3.2-gettime-dlopen.patch

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/dhcpcd/files/dhcpcd-6.3.2-gettime-dlopen.patch?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/dhcpcd/files/dhcpcd-6.3.2-gettime-dlopen.patch?rev=1.1&content-type=text/plain

Index: dhcpcd-6.3.2-gettime-dlopen.patch
===================================================================
Index: configure
==================================================================
--- configure
+++ configure
@@ -338,20 +338,18 @@
        if [ -z "$INET" -o "$INET" = yes ]; then
                echo "DHCPCD_SRCS+=     lpf.c" >>$CONFIG_MK
        fi
        echo "DHCPCD_SRCS+=     if-linux.c if-linux-wireless.c" >>$CONFIG_MK
        echo "DHCPCD_SRCS+=     platform-linux.c" >>$CONFIG_MK
-       echo "LDADD+=           -lrt -ldl" >>$CONFIG_MK
        ;;
 kfreebsd*)
        echo "CPPFLAGS+=        -D_GNU_SOURCE" >>$CONFIG_MK
        if [ -z "$INET" -o "$INET" = yes ]; then
                echo "DHCPCD_SRCS+=     bpf.c" >>$CONFIG_MK
        fi
        echo "DHCPCD_SRCS+=     if-bsd.c platform-bsd.c" >>$CONFIG_MK
        echo "COMPAT_SRCS+=     compat/linkaddr.c" >>$CONFIG_MK
-       echo "LDADD+=           -lrt -ldl" >>$CONFIG_MK
        ;;
 *)
        if [ -z "$INET" -o "$INET" = yes ]; then
                echo "DHCPCD_SRCS+=     bpf.c" >>$CONFIG_MK
        fi
@@ -398,10 +396,31 @@
        echo "libc support for getifaddrs is required - aborting" >&2
        abort=true
 fi
 rm -f _getifaddrs.c _getifaddrs
 $abort && exit 1
+
+printf "Testing for clock_gettime ... "
+cat <<EOF >_clock_gettime.c
+#include <time.h>
+int main(void) {
+       struct timespec ts;
+       return clock_gettime(CLOCK_MONOTONIC, &ts);
+}
+EOF
+if $XCC _clock_gettime.c -o _clock_gettime 2>/dev/null; then
+       echo "yes"
+elif $XCC _clock_gettime.c -lrt -o _clock_gettime 2>/dev/null; then
+       echo "yes (-lrt)"
+       echo "LDADD+=           -lrt" >>$CONFIG_MK
+else
+       echo "no"
+       echo "libc support for clock_getttime is required - aborting" >&2
+       abort=true
+fi
+rm -f _clock_gettime.c _clockgettime
+$abort && exit 1
 
 if [ -z "$ARC4RANDOM" ]; then
        printf "Testing for arc4random ... "
        cat <<EOF >_arc4random.c
 #include <stdlib.h>
@@ -749,10 +768,31 @@
 
 if [ "$DEV" = yes ]; then
        echo "DHCPCD_SRCS+=     dev.c" >>$CONFIG_MK
        echo "CPPFLAGS+=        -DPLUGIN_DEV" >>$CONFIG_MK
        echo "MKDIRS+=  dev" >>$CONFIG_MK
+
+       printf "Testing for dlopen ... "
+       cat <<EOF >_dlopen.c
+#include <dlfcn.h>
+#include <stdlib.h>
+int main(void) {
+       dlopen(NULL, 0);
+       return 0;
+}
+EOF
+       if $XCC _dlopen.c -o _dlopen 2>/dev/null; then
+               echo "yes"
+       elif $XCC _dlopen.c -ldl -o _dlopen 2>/dev/null; then
+               echo "yes (-ldl)"
+               echo "LDADD+=           -ldl" >>$CONFIG_MK
+       else
+               echo "no"
+               echo "libc for dlopen is required - aborting"
+       fi
+       rm -f _dlopen.c _dlopen
+       $abort && exit 1
 fi
 
 # Transform for a make file
 SERVICEEXISTS=$(echo "$SERVICEEXISTS" | $SED \
        -e 's:\\:\\\\:g' \




1.1                  net-misc/dhcpcd/files/dhcpcd-6.3.2-fix-cc-setting.patch

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/dhcpcd/files/dhcpcd-6.3.2-fix-cc-setting.patch?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/dhcpcd/files/dhcpcd-6.3.2-fix-cc-setting.patch?rev=1.1&content-type=text/plain

Index: dhcpcd-6.3.2-fix-cc-setting.patch
===================================================================
Index: configure
==================================================================
--- configure
+++ configure
@@ -14,10 +14,11 @@
 UDEV=
 OS=
 BUILD=
 HOST=
 TARGET=
+TARGETCC=
 DEBUG=
 FORK=
 STATIC=
 INCLUDEDIR=
 DEVS=
@@ -49,10 +50,11 @@
        --statedir|--localstatedir) STATEDIR=$var;;
        --dbdir) DBDIR=$var;;
        --rundir) RUNDIR=$var;;
        --mandir) MANDIR=$var;;
        --with-ccopts|CFLAGS) CFLAGS=$var;;
+       CC) CC=$var;;
        CPPFLAGS) CPPFLAGS=$var;;
        --with-hook) HOOKSCRIPTS="$HOOKSCRIPTS${HOOKSCRIPTS:+ }$var";;
        --with-hooks|HOOKSCRIPTS) HOOKSCRIPTS=$var; HOOKSET=true;;
        --build) BUILD=$var;;
        --host) HOST=$var;;
@@ -186,17 +188,19 @@
 CONFIG_MK=config.mk
 
 if [ -z "$BUILD" ]; then
        # autoconf target triplet: cpu-vendor-os
        BUILD=$(uname -m)-unknown-$(uname -s | tr '[:upper:]' '[:lower:]')
+else
+       TARGETCC=$BUILD-
 fi
-if [ -z "$HOST" ]; then
-       [ -z "$TARGET" ] && TARGET=$BUILD
-       HOST=$TARGET
-fi
-if [ -z "$TARGET" ]; then
-       [ -z "$HOST" ] && HOST=$BUILD
+if [ -n "$TARGET" ]; then
+       TARGETCC=$TARGET-
+elif [ -n "$HOST" ]; then
+       TARGET=$HOST
+else
+       HOST=$BUILD
        TARGET=$HOST
 fi
 
 if [ -z "$OS" ]; then
        echo "Deriving operating system from ... $TARGET"
@@ -243,20 +247,37 @@
        echo "#define $x$t      \"$v\"" >>$CONFIG_H
 done
 echo "LIBDIR=          $LIBDIR" >>$CONFIG_MK
 echo "MANDIR=          $MANDIR" >>$CONFIG_MK
 
-: ${CC:=cc}
+# Always obey CC.
+# However, if CC is not specified and we are given GNU style
+# --host or --build targets the expectation is we try and match that
+# to a compiler.
+if [ -n "$CC" ]; then
+       TARGETCC=
+else
+       CC=cc
+       _COMPILERS="cc clang gcc pcc icc"
+fi
+if [ -n "$TARGETCC" ]; then
+       for _CC in $_COMPILERS; do
+               _CC=$(_which "$TARGETCC$_CC")
+               if [ -x "$_CC" ]; then
+                       CC=$_CC
+                       break
+               fi
+       done
+fi
 if ! type "$CC" >/dev/null 2>&1; then
-       for _CC in clang gcc pcc icc; do
+       for _CC in $_COMPILERS; do
                _CC=$(_which "$_CC")
                if [ -x "$_CC" ]; then
                        CC=$_CC
                        break
                fi
        done
-       
 fi
 
 echo "Using compiler .. $CC"
 if ! type "$CC" >/dev/null 2>&1; then
        echo "$CC is not an executable"
@@ -415,11 +436,11 @@
 else
        echo "no"
        echo "libc support for clock_getttime is required - aborting" >&2
        abort=true
 fi
-rm -f _clock_gettime.c _clockgettime
+rm -f _clock_gettime.c _clock_gettime
 $abort && exit 1
 
 if [ -z "$ARC4RANDOM" ]; then
        printf "Testing for arc4random ... "
        cat <<EOF >_arc4random.c




1.1                  net-misc/dhcpcd/files/dhcpcd-6.3.2-fix-host.patch

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/dhcpcd/files/dhcpcd-6.3.2-fix-host.patch?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/dhcpcd/files/dhcpcd-6.3.2-fix-host.patch?rev=1.1&content-type=text/plain

Index: dhcpcd-6.3.2-fix-host.patch
===================================================================
Index: configure
==================================================================
--- configure
+++ configure
@@ -11,14 +11,13 @@
 CLOSEFROM=
 GETLINE=
 STRLCPY=
 UDEV=
 OS=
-BUILD=
+BUILDCC=
 HOST=
 TARGET=
-TARGETCC=
 DEBUG=
 FORK=
 STATIC=
 INCLUDEDIR=
 DEVS=
@@ -55,11 +54,11 @@
        CC) CC=$var;;
        CPPFLAGS) CPPFLAGS=$var;;
        --with-hook) HOOKSCRIPTS="$HOOKSCRIPTS${HOOKSCRIPTS:+ }$var";;
        --with-hooks|HOOKSCRIPTS) HOOKSCRIPTS=$var; HOOKSET=true;;
        --build) BUILD=$var;;
-       --host) HOST=$var;;
+       --host) HOST=$var; HOSTCC=$var-;;
        --target) TARGET=$var;;
        --libdir) LIBDIR=$var;;
        --without-arc4random) ARC4RANDOM=no;;
        --without-closefrom) CLOSEFROM=no;;
        --without-getline) GETLINE=no;;
@@ -188,27 +187,18 @@
 CONFIG_MK=config.mk
 
 if [ -z "$BUILD" ]; then
        # autoconf target triplet: cpu-vendor-os
        BUILD=$(uname -m)-unknown-$(uname -s | tr '[:upper:]' '[:lower:]')
-else
-       TARGETCC=$BUILD-
 fi
-if [ -n "$TARGET" ]; then
-       TARGETCC=$TARGET-
-elif [ -n "$HOST" ]; then
-       TARGET=$HOST
-else
-       HOST=$BUILD
-       TARGET=$HOST
-fi
+: ${HOST:=$BUILD}
 
 if [ -z "$OS" ]; then
-       echo "Deriving operating system from ... $TARGET"
+       echo "Deriving operating system from ... $HOST"
        # Derive OS from cpu-vendor-[kernel-]os
-       CPU=${TARGET%%-*}
-       REST=${TARGET#*-}
+       CPU=${HOST%%-*}
+       REST=${HOST#*-}
        if [ "$CPU" != "$REST" ]; then
                VENDOR=${REST%%-*}
                REST=${REST#*-}
                if [ "$VENDOR" != "$REST" ]; then
                        # Use kernel if given, otherwise os
@@ -252,18 +242,18 @@
 # Always obey CC.
 # However, if CC is not specified and we are given GNU style
 # --host or --build targets the expectation is we try and match that
 # to a compiler.
 if [ -n "$CC" ]; then
-       TARGETCC=
+       HOSTCC=
 else
        CC=cc
        _COMPILERS="cc clang gcc pcc icc"
 fi
-if [ -n "$TARGETCC" ]; then
+if [ -n "$HOSTCC" ]; then
        for _CC in $_COMPILERS; do
-               _CC=$(_which "$TARGETCC$_CC")
+               _CC=$(_which "$HOSTCC$_CC")
                if [ -x "$_CC" ]; then
                        CC=$_CC
                        break
                fi
        done





Reply via email to