pkgsrc/mk/wrapper/cmd-sink-hpux-cc
tnn c7d09b8f3c Back out previous. The packages that incorrectly assume that ld
--version-script works are few enough to warrant fixing each one of them
instead. Silenty dropping the flag makes it impossible to detect whether or
not --version-script is supported. Pointed out by joerg@
2007-05-06 10:05:38 +00:00

64 lines
2.1 KiB
Text

# $NetBSD $
# 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"
case $arg in
##############################################################
# HP-UX ld doesn't support multiple rpath parameters, accumulate
# them into a single -Wl,+b,/path1:/path2:...:pathn
##############################################################
+b|-Wl,+b|-rpath)
pop_queue cmdbuf dir
dir="${dir#-Wl,}"
hprunpathdirs="$hprunpathdirs $dir"
case $hprunpath in
"") hprunpath="$dir" ;;
*) hprunpath="$hprunpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-hpux-cc) drop: $dir [adding to hprunpath]"
;;
-Wl,+b,*|-R*|-Wl,-R*|-Wl,-rpath,*|-Wl,-rpath-link,*|-Wl,--rpath,*)
case $arg in
-Wl,+b,*) R="-Wl,+b," ;;
-R*) R="-R" ;;
-Wl,-R*) R="-Wl,-R" ;;
-Wl,-rpath,*) R="-Wl,-rpath," ;;
-Wl,-rpath-link,*) R="-Wl,-rpath-link," ;;
-Wl,--rpath,*) R="-Wl,--rpath," ;;
esac
dir="${arg#$R}"
hprunpathdirs="$hprunpathdirs $dir"
case $hprunpath in
"") hprunpath="$dir" ;;
*) hprunpath="$hprunpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-hpux-cc) drop: $dir [adding to hprunpath]"
;;
*)
. $buildcmd
;;
esac
done
if $test -n "$hprunpath"; then
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