summaryrefslogtreecommitdiff
path: root/mk/wrapper/logic
diff options
context:
space:
mode:
authorjlam <jlam>2005-01-18 17:25:13 +0000
committerjlam <jlam>2005-01-18 17:25:13 +0000
commit5bf47c8e524507d3eda65e97c734007b6dc49335 (patch)
treeb6c271637ab4764fb1a765319d1152c53eda7910 /mk/wrapper/logic
parent33d644ca7de28b12372c0ced6cf6871607cd2f88 (diff)
downloadpkgsrc-5bf47c8e524507d3eda65e97c734007b6dc49335.tar.gz
Split out the argument pre-processing logic into its own script
arg-pp-main, and allow for wrapper-specific hooks to extend the pre-processing through _WRAP_ARG_PP.<wrappee>. Move the Darwin GCC-related preprocessing into arg-pp-darwin-gcc, and create a arg-pp-mipspro-cc that understands -LANG:<feature> and -LIST:<feature> so that they're not confused with the usual -Ldir options.
Diffstat (limited to 'mk/wrapper/logic')
-rw-r--r--mk/wrapper/logic154
1 files changed, 11 insertions, 143 deletions
diff --git a/mk/wrapper/logic b/mk/wrapper/logic
index f8d9e7dab46..2154f374067 100644
--- a/mk/wrapper/logic
+++ b/mk/wrapper/logic
@@ -1,4 +1,4 @@
-# $NetBSD: logic,v 1.9 2005/01/18 05:24:47 jlam Exp $
+# $NetBSD: logic,v 1.10 2005/01/18 17:25:13 jlam Exp $
#
# Copyright (c) 2004 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -61,150 +61,18 @@ while ! queue_is_empty argbuf; do
argok=yes
continue
fi
-
- case $arg in
- ######################################################
- # Split direct paths to shared libraries into the
- # "-Ldir -llib" equivalent
- ######################################################
- /*/lib*.so|/*/lib*.so.[0-9]*)
- dir="${arg%/lib*}"
- lib="${arg#$dir/lib}"
- case $lib in
- */*) argok=yes; continue ;;
- *.so) lib="${lib%.so}" ;;
- *.so.[0-9]*) lib="${lib%.so.[0-9]*}" ;;
- esac
- prepend_queue argbuf "-l$lib"
- $debug_log $wrapperlog " (logic) pre: -l$lib"
- prepend_queue argbuf "-L$dir"
- $debug_log $wrapperlog " (logic) pre: -L$dir"
- ;;
- /*/lib*.sl|/*/lib*.sl.[0-9]*) # HP-UX
- dir="${arg%/lib*}"
- lib="${arg#$dir/lib}"
- case $lib in
- */*) argok=yes; continue ;;
- *.sl) lib="${lib%.sl}" ;;
- *.sl.[0-9]*) lib="${lib%.sl.[0-9]*}" ;;
- esac
- prepend_queue argbuf "-l$lib"
- $debug_log $wrapperlog " (logic) pre: -l$lib"
- prepend_queue argbuf "-L$dir"
- $debug_log $wrapperlog " (logic) pre: -L$dir"
- ;;
- /*/lib*.dylib) # Darwin
- dir="${arg%/lib*.dylib}"
- lib="${arg#$dir/lib}"
- case $lib in
- */*) argok=yes; continue ;;
- *.dylib) lib="${lib%.dylib}" ;;
- esac
- prepend_queue argbuf "-l$lib"
- $debug_log $wrapperlog " (logic) pre: -l$lib"
- prepend_queue argbuf "-L$dir"
- $debug_log $wrapperlog " (logic) pre: -L$dir"
- ;;
- ######################################################
- # Remove extraneous comma in "-Wl,-R,/dir" and in
- # "-Wl,-L,/dir".
- ######################################################
- -Wl,-L,*)
- arg="-Wl,-L${arg#-Wl,-L,}"
- $debug_log $wrapperlog " (logic) pre: $arg"
- prepend_queue argbuf "$arg"
- ;;
- -Wl,-R,*)
- arg="-Wl,-R${arg#-Wl,-R,}"
- $debug_log $wrapperlog " (logic) pre: $arg"
- prepend_queue argbuf "$arg"
- ;;
- ######################################################
- # Merge "-Wl,-R -Wl,/dir" into a single "-Wl,-R/dir".
- # Same for -Wl,-L, -Wl,-rpath and -Wl,-rpath-link.
- ######################################################
- -Wl,-[LR])
- pop_queue argbuf nextarg
- $debug_log $wrapperlog " (logic) pop: $nextarg"
- shquote "${nextarg#-Wl,}"; nextarg="$shquoted"
- $debug_log $wrapperlog " (logic) pre: $arg$nextarg"
- prepend_queue argbuf "$arg$nextarg"
- ;;
- -Wl,-rpath|-Wl,-rpath-link|-Wl,--rpath)
- pop_queue argbuf nextarg
- $debug_log $wrapperlog " (logic) pop: $nextarg"
- shquote "${nextarg#-Wl,}"; nextarg="$shquoted"
- $debug_log $wrapperlog " (logic) pre: $arg,$nextarg"
- prepend_queue argbuf "$arg,$nextarg"
- ;;
- ######################################################
- # Remove rpath options that try to add relative paths
- # to the runtime library search path. This basically
- # cleans up after lazy programmers who can't write
- # Makefiles.
- ######################################################
- -R[!/]*|-Wl,-R[!/]*|\
- -Wl,-rpath,[!/]*|-Wl,-rpath-link,[!/]*|-Wl,--rpath,[!/]*)
- $debug_log $wrapperlog " (logic) drop: $arg"
- ;;
- ######################################################
- # Remove consecutive, repeated library options.
- ######################################################
- -l*)
- head_queue argbuf nextarg
- while $test "$nextarg" = "$arg"; do
- pop_queue argbuf nextarg
- $debug_log $wrapperlog " (logic) drop: $nextarg"
- if queue_is_empty argbuf; then
- break
- else
- head_queue argbuf nextarg
- fi
- done
- argok=yes
- ;;
- ######################################################
- # The -o option takes an extra argument that should
- # be passed unmodified.
- #######################################################
- -o)
- skipargs=1
- argok=yes
- ;;
- ######################################################
- # GNU ld uses "--dynamic-linker /path/to/shared/object"
- # to set the dynamic linker code for ELF executables.
- ######################################################
- --dynamic-linker)
- skipargs=1
- argok=yes
- ;;
- ######################################################
- # Darwin's linker uses:
- #
- # -dylib_file /path/shlib:/path2/shlib
- # -dylib_install_name /path/shlib
- # -install_name /path/shlib
- #
- # to pass the installed locations for the shared
- # libraries to the linker, and we need to pass the extra
- # argument unmodified. The purpose of
- # -seg_addr_table_filename is more obscure, but Darwin's
- # imake rules use it.
- ######################################################
- -dylib_file|-dylib_install_name|-install_name|\
- -seg_addr_table_filename)
- skipargs=1
- argok=yes
- ;;
- ######################################################
- # Leave all else untouched.
- ######################################################
- *)
- argok=yes
+ argmatch=no
+ . $arg_pp_main
+ case $argmatch in
+ yes) continue ;;
+ esac
+ . $arg_pp
+ case $argmatch in
+ yes) continue ;;
esac
+ argok=yes
done
-
+ #
# Try to look up the transformed $arg in the cache, but if
# not there, then apply the transformations and save the result
# in the cache.