pkgsrc/mk/wrapper/cmd-sink-hpux-ld

73 lines
2.3 KiB
Text
Raw Normal View History

2007-05-28 13:07:00 +02:00
# $NetBSD: cmd-sink-hpux-ld,v 1.6 2007/05/28 11:07:00 martti Exp $
2007-04-14 16:17:49 +02:00
# Empty out the command buffer and build up the command line in $cmd.
hprunpath=
hprunpathdirs=
2007-04-14 16:17:49 +02:00
while ! queue_is_empty cmdbuf; do
pop_queue cmdbuf arg
$debug_log $wrapperlog " (cmd-sink-hpux-ld) pop: $arg"
case $arg in
##############################################################
# HP-UX ld doesn't support multiple rpath parameters, accumulate
# them into a single +b /path1:/path2:...:pathn
##############################################################
+b|-Wl,+b|-rpath)
pop_queue cmdbuf dir
dir="${dir#-Wl,}"
hprunpathdirs="$hprunpathdirs $dir"
2007-04-14 16:17:49 +02:00
case $hprunpath in
"") hprunpath="$dir" ;;
*) hprunpath="$hprunpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-hpux-ld) 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"
2007-04-14 16:17:49 +02:00
case $hprunpath in
"") hprunpath="$dir" ;;
*) hprunpath="$hprunpath:$dir" ;;
esac
$debug_log $wrapperlog " (cmd-sink-hpux-ld) drop: $dir [adding to hprunpath]"
;;
2007-04-22 20:56:22 +02:00
# Handle linker optimization flag.
-O*|+O|+O?)
arg=-O
. $buildcmd
;;
2007-04-14 16:17:49 +02:00
*)
. $buildcmd
;;
esac
done
if $test -n "$hprunpath"; then
arg=+b
$debug_log $wrapperlog " (cmd-sink-hpux-ld) pop: $arg"
. $buildcmd
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
2007-05-28 13:07:00 +02:00
# 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
2007-04-14 16:17:49 +02:00
fi