pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/wrapper add workaround for ld(1) run path problems ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7b3e33f40e2e
branches:  trunk
changeset: 528097:7b3e33f40e2e
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Sat Apr 21 01:29:25 2007 +0000

description:
add workaround for ld(1) run path problems and document those

diffstat:

 mk/wrapper/cmd-sink-hpux-cc |  16 ++++++++++++++++
 mk/wrapper/cmd-sink-hpux-ld |  18 +++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletions(-)

diffs (92 lines):

diff -r 77b171823824 -r 7b3e33f40e2e mk/wrapper/cmd-sink-hpux-cc
--- a/mk/wrapper/cmd-sink-hpux-cc       Sat Apr 21 01:27:44 2007 +0000
+++ b/mk/wrapper/cmd-sink-hpux-cc       Sat Apr 21 01:29:25 2007 +0000
@@ -2,6 +2,7 @@
 
 # Empty out the command buffer and build up the command line in $cmd.
 hprunpath=
+hprunpathdirs=
 while ! queue_is_empty cmdbuf; do
        pop_queue cmdbuf arg
        $debug_log $wrapperlog "    (cmd-sink-hpux-cc) pop:  $arg"
@@ -13,6 +14,7 @@
        +b|-Wl,+b|-rpath)
                pop_queue cmdbuf dir
                dir="${dir#-Wl,}"
+               hprunpathdirs="$hprunpathdirs $dir"
                case $hprunpath in
                "")     hprunpath="$dir" ;;
                *)      hprunpath="$hprunpath:$dir" ;;
@@ -29,6 +31,7 @@
                -Wl,--rpath,*)          R="-Wl,--rpath," ;;
                esac
                dir="${arg#$R}"
+               hprunpathdirs="$hprunpathdirs $dir"
                case $hprunpath in
                "")     hprunpath="$dir" ;;
                *)      hprunpath="$hprunpath:$dir" ;;
@@ -45,4 +48,17 @@
        arg="-Wl,+b,$hprunpath"
        $debug_log $wrapperlog "    (cmd-sink-hpux-cc) pop: $arg [aggregate]"
        . $buildcmd
+##############################################################################
+# Turn paths from the run path into additional -L arguments. This works around
+# the braindead HP-UX ld(1) which needs to relink binaries against libraries
+# in ${PREFIX} to get run paths correct.
+# NB: This is not optimal because it exposes the package to possibly unwanted
+# libraries. (Ideally this should be done only in the installation phase.)
+##############################################################################
+       for dir in $hprunpathdirs
+       do
+               arg="-L$dir"
+               $debug_log $wrapperlog "    (cmd-sink-hpux-cc) pop: $arg [from run path]"
+               . $buildcmd
+       done
 fi
diff -r 77b171823824 -r 7b3e33f40e2e mk/wrapper/cmd-sink-hpux-ld
--- a/mk/wrapper/cmd-sink-hpux-ld       Sat Apr 21 01:27:44 2007 +0000
+++ b/mk/wrapper/cmd-sink-hpux-ld       Sat Apr 21 01:29:25 2007 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: cmd-sink-hpux-ld,v 1.1 2007/04/14 14:17:50 tnn Exp $
+# $NetBSD: cmd-sink-hpux-ld,v 1.2 2007/04/21 01:29:25 tnn Exp $
 
 # Empty out the command buffer and build up the command line in $cmd.
 hprunpath=
+hprunpathdirs=
 while ! queue_is_empty cmdbuf; do
        pop_queue cmdbuf arg
        $debug_log $wrapperlog "    (cmd-sink-hpux-ld) pop:  $arg"
@@ -13,6 +14,7 @@
        +b|-Wl,+b|-rpath)
                pop_queue cmdbuf dir
                dir="${dir#-Wl,}"
+               hprunpathdirs="$hprunpathdirs $dir"
                case $hprunpath in
                "")     hprunpath="$dir" ;;
                *)      hprunpath="$hprunpath:$dir" ;;
@@ -29,6 +31,7 @@
                -Wl,--rpath,*)          R="-Wl,--rpath," ;;
                esac
                dir="${arg#$R}"
+               hprunpathdirs="$hprunpathdirs $dir"
                case $hprunpath in
                "")     hprunpath="$dir" ;;
                *)      hprunpath="$hprunpath:$dir" ;;
@@ -48,4 +51,17 @@
        arg=$hprunpath
        $debug_log $wrapperlog "    (cmd-sink-hpux-ld) pop: $arg [aggregate]"
        . $buildcmd
+##############################################################################
+# Turn paths from the run path into additional -L arguments. This works around
+# the braindead HP-UX ld(1) which needs to relink binaries against libraries
+# in ${PREFIX} to get run paths correct.
+# NB: This is not optimal because it exposes the package to possibly unwanted
+# libraries. (Ideally this should be done only in the installation phase.)   
+##############################################################################
+       for dir in $hprunpathdirs
+       do
+               arg="-L$dir"
+               $debug_log $wrapperlog "    (cmd-sink-hpux-ld) pop: $arg [from run path]"
+               . $buildcmd
+       done
 fi



Home | Main Index | Thread Index | Old Index