head 1.32; access; symbols pkgsrc-2013Q2:1.32.0.48 pkgsrc-2013Q2-base:1.32 pkgsrc-2012Q4:1.32.0.46 pkgsrc-2012Q4-base:1.32 pkgsrc-2011Q4:1.32.0.44 pkgsrc-2011Q4-base:1.32 pkgsrc-2011Q2:1.32.0.42 pkgsrc-2011Q2-base:1.32 pkgsrc-2009Q4:1.32.0.40 pkgsrc-2009Q4-base:1.32 pkgsrc-2008Q4:1.32.0.38 pkgsrc-2008Q4-base:1.32 pkgsrc-2008Q3:1.32.0.36 pkgsrc-2008Q3-base:1.32 cube-native-xorg:1.32.0.34 cube-native-xorg-base:1.32 pkgsrc-2008Q2:1.32.0.32 pkgsrc-2008Q2-base:1.32 pkgsrc-2008Q1:1.32.0.30 pkgsrc-2008Q1-base:1.32 pkgsrc-2007Q4:1.32.0.28 pkgsrc-2007Q4-base:1.32 pkgsrc-2007Q3:1.32.0.26 pkgsrc-2007Q3-base:1.32 pkgsrc-2007Q2:1.32.0.24 pkgsrc-2007Q2-base:1.32 pkgsrc-2007Q1:1.32.0.22 pkgsrc-2007Q1-base:1.32 jlam-pkgviews:1.32.0.20 jlam-pkgviews-base:1.32 pkgsrc-2006Q4:1.32.0.18 pkgsrc-2006Q4-base:1.32 pkgsrc-2006Q3:1.32.0.16 pkgsrc-2006Q3-base:1.32 pkgsrc-2006Q2:1.32.0.14 pkgsrc-2006Q2-base:1.32 pkgsrc-2006Q1:1.32.0.12 pkgsrc-2006Q1-base:1.32 pkgsrc-2005Q4:1.32.0.10 pkgsrc-2005Q4-base:1.32 pkgsrc-2005Q3:1.32.0.8 pkgsrc-2005Q3-base:1.32 pkgsrc-2005Q2:1.32.0.6 pkgsrc-2005Q2-base:1.32 pkgsrc-2005Q1:1.32.0.4 pkgsrc-2005Q1-base:1.32 pkgsrc-2004Q4:1.32.0.2 pkgsrc-2004Q4-base:1.32 pkgsrc-2004Q3:1.31.0.2 pkgsrc-2004Q3-base:1.31 pkgsrc-2004Q2:1.27.0.2 pkgsrc-2004Q2-base:1.27 pkgsrc-2004Q1:1.26.0.2 pkgsrc-2004Q1-base:1.26 pkgsrc-2003Q4:1.3.0.2 pkgsrc-2003Q4-base:1.3 pkgviews-mk-base:1.1 pkgviews-mk:1.1.0.2; locks; strict; comment @# @; 1.32 date 2004.09.21.15.01.40; author jlam; state dead; branches; next 1.31; 1.31 date 2004.08.28.06.02.21; author jlam; state Exp; branches; next 1.30; 1.30 date 2004.08.28.05.51.30; author jlam; state Exp; branches; next 1.29; 1.29 date 2004.08.27.06.29.09; author jlam; state Exp; branches; next 1.28; 1.28 date 2004.08.10.15.13.25; author jlam; state Exp; branches; next 1.27; 1.27 date 2004.06.04.19.21.23; author tv; state Exp; branches; next 1.26; 1.26 date 2004.03.13.03.41.13; author uebayasi; state Exp; branches; next 1.25; 1.25 date 2004.03.12.15.45.43; author jlam; state Exp; branches; next 1.24; 1.24 date 2004.02.19.18.39.27; author jlam; state Exp; branches; next 1.23; 1.23 date 2004.02.12.20.29.34; author jlam; state Exp; branches; next 1.22; 1.22 date 2004.02.12.20.20.35; author jlam; state Exp; branches; next 1.21; 1.21 date 2004.02.12.08.28.58; author jlam; state Exp; branches; next 1.20; 1.20 date 2004.02.01.00.41.25; author jlam; state Exp; branches; next 1.19; 1.19 date 2004.01.30.11.29.56; author jlam; state Exp; branches; next 1.18; 1.18 date 2004.01.30.10.56.11; author jlam; state Exp; branches; next 1.17; 1.17 date 2004.01.21.08.04.29; author jlam; state Exp; branches; next 1.16; 1.16 date 2004.01.21.07.54.50; author jlam; state Exp; branches; next 1.15; 1.15 date 2004.01.19.10.09.36; author jlam; state Exp; branches; next 1.14; 1.14 date 2004.01.19.05.11.44; author jlam; state Exp; branches; next 1.13; 1.13 date 2004.01.17.22.16.12; author jlam; state Exp; branches; next 1.12; 1.12 date 2004.01.17.17.33.49; author jlam; state Exp; branches; next 1.11; 1.11 date 2004.01.13.07.52.37; author jlam; state Exp; branches; next 1.10; 1.10 date 2004.01.11.03.30.20; author grant; state Exp; branches; next 1.9; 1.9 date 2004.01.07.07.10.05; author jlam; state Exp; branches; next 1.8; 1.8 date 2004.01.06.21.39.07; author jlam; state Exp; branches; next 1.7; 1.7 date 2004.01.06.19.08.59; author jlam; state Exp; branches; next 1.6; 1.6 date 2004.01.06.18.43.10; author jlam; state Exp; branches; next 1.5; 1.5 date 2004.01.06.18.10.06; author jlam; state Exp; branches; next 1.4; 1.4 date 2004.01.03.20.23.51; author jlam; state Exp; branches; next 1.3; 1.3 date 2003.09.03.16.35.01; author jlam; state Exp; branches; next 1.2; 1.2 date 2003.09.02.06.59.54; author jlam; state Exp; branches; next 1.1; 1.1 date 2003.08.14.13.16.48; author jlam; state dead; branches 1.1.2.1; next ; 1.1.2.1 date 2003.08.14.13.16.48; author jlam; state Exp; branches; next 1.1.2.2; 1.1.2.2 date 2003.08.27.06.09.01; author jlam; state Exp; branches; next 1.1.2.3; 1.1.2.3 date 2003.08.28.09.48.20; author jlam; state Exp; branches; next 1.1.2.4; 1.1.2.4 date 2003.08.28.10.21.52; author jlam; state Exp; branches; next 1.1.2.5; 1.1.2.5 date 2003.08.28.10.29.09; author jlam; state Exp; branches; next 1.1.2.6; 1.1.2.6 date 2003.08.28.19.12.55; author jlam; state Exp; branches; next 1.1.2.7; 1.1.2.7 date 2003.08.30.07.48.53; author jlam; state Exp; branches; next 1.1.2.8; 1.1.2.8 date 2003.08.30.10.02.34; author jlam; state Exp; branches; next ; desc @@ 1.32 log @Initial commit of a new wrapper script framework that encapsulates the non-buildlink-related code and moves it out of mk/buildlink3 into mk/wrapper. The buildlink3 code is modified to simply hook its transformations into the wrapper script framework. The wrapper script framework has some new features: * Support automatically passing "ABI" flags to the compiler and linker depending on the value of ${ABI}. Currently supports the SunPro compiler with ${ABI} == 64 and the MIPSPro compiler with ${ABI} as any of 32, n32, o32, and 64. * making UnixWare GCC accept -rpath options and silently converting them into an appropriate LD_RUN_PATH * Add cmd-sink-interix-gcc and cmd-sink-interix-ld that errors out when it sees -fpic/-fPIC and -shared/-Bshareable, respectively (requested by ). * Much improved debugging output. It's possible to output the wrapper work log in-line with normal output by setting WRAPPER_LOG to "stderr". Important differences in behaviour from the old buildlink3 code include: * Only move the -l options to the end of the command line, leaving the -L options in-place. * Extend the autodetection of the libtool mode to detect "compile" and "uninstall". * Fix problem noted in both PR pkg/24760 and PR pkg/25500, where -L/usr/lib/* was being mangled improperly. * Remove the top-level "buildlink" target; instead, make buildlinking occur as part of the "wrapper" target. * mangle and sub-mangle are only meant to transform directories in -I, -L, and rpath options, so remove the lines in buildlink3/gen-transform.sh that transformed bare directories. * Add the ability for the libtool wrapper to be called just to unwrap an existing libtool archive by running: libtool --mode=unwrap -o libfoo.la The old --fix-la syntax no longer works. 20040818 ======== * Initial release of a new wrapper script framework that encapsulates the non-buildlink-related code and moves it out of mk/buildlink3. These features include: * making MIPSpro accept GCC options * making MIPSpro "ucode" accept GCC options * making SunPro accept GCC options * making "ld" accept -Wl,* options and silently removing the "-Wl," * (NEW) making UnixWare GCC accept -rpath options and silently converting them into an appropriate LD_RUN_PATH One major benefit of this is that the buildlink3 code is now much tighter and easier to understand since it concerns itself solely with buildlink-related details. I haven't yet optimized the wrapper cache, so the new wrapper scripts may take slightly longer to execute than the old buildlink3 wrapper scripts, but I'll be improving this over time. 20040821 ======== * Move the inclusion of $cmd_sink outside of the main loop in wrapper.sh so that the $cmd_sink script can be used to globally scan and process the arguments. Move the LD_RUN_PATH code to a cmd-sink-unixware-gcc script. Garbage-collect the now unused export_vars-related code. * Add cmd-sink-aix-xlc for AIX xlc that munges -Wl,-R* into an appropriate -blibpath option. * Add cmd-sink-interix-gcc and cmd-sink-interix-ld that errors out when it sees -fpic/-fPIC and -shared/-Bshareable, respectively (requested by ). * Move the code that converts full paths to shared libraries into the "-Ldir -llib" equivalents from the buildlink3 code into wrapper/logic. Remove the same from bsd.buildlink3.mk and gen-transform.sh. * Move the code that checks for absolute rpaths from the buildlink3 code into wrapper/arg-source. Remove the same from bsd.buildlink3.mk and gen-transform.sh. * Only move the -l options to the end of the command line, leaving the -L options in-place. * Add more debugging code. 20040824 ======== * Fix quoting problems after arguments are transformed. Remove the hack that was inserted that magically made almost everything work because we do it the right way now. * Move the inclusion of $logic outside of the main loop in wrapper.sh so that the $logic script doesn't have to worry about underflowing the argument buffer. * Encapsulate the loop in wrapper.sh that fills the argument buffer entirely within the arg-source script. * Move from the logic script into the arg-source script the transformations that merge or split arguments. * Fix bug where skipargs was effectively being ignored if it was more than 1. * Handle the whitespace in transformations in the logic script that turn one library option into multiple library options, e.g. "-lreadline" -> "-ledit -ltermcap". * Allow you to specify an environment variable WRAPPER_SKIP_TRANSFORM for whether you wish to skip the transformation step in the logic script. This is intended for testing purposes. * Added check_prog() and init_lib() functions to the shell code library to make it more reusable outside of the wrapper framework. * Allow the msg_log() function to output to "stdout" or "stderr". If you want to have all of the logging appear on the screen, then you can now set WRAPPER_LOG=stderr. * Make some of the script components not overridable on a per-wrapper basis. * Add a gen-transform.sh script that generates transformation sedfiles. The "transform" script is used to transform arguments, while the "untransform" script is used to unwrap files. Move the no-rpath logic from buildlink3/gen-transform.sh into wrapper/gen-transform.sh since it's not buildlink3-specific. * Check for a non-empty blibpath before adding the option in cmd-sink-aix-xlc. * Extend the autodetection of the libtool mode to detect "compile" and "uninstall". * Add a cmd-sink-libtool script that doesn't pass linker options to libtool unless we're in "link" mode. * Set _USE_RPATH to "yes" for UnixWare so that the wrappers will see the rpath options and convert them to a LD_RUN_PATH definition. * Add more debugging code. 20040826 ======== * Rewrite buildlink3/gen-transform.sh to produce more precise sed commands. Drop some unused commands from the mini-language, and add a few more that are more restrictive in their scope. * Fix problem where repeated options weren't properly handled by some of sed commands. It's not enough that they're "global replace", since some patterns match separator characters before and after each option. We must repeat those patterns twice to catch all instances correctly. * Fix problem noted in both PR pkg/24760 and PR pkg/25500, where -L/usr/lib/* was being mangled improperly. * Remove the top-level "buildlink" target; instead, make buildlinking occur as part of the "wrapper" target. * Add more debugging code. 20040828 ======== * Added a head_queue function to shell-lib that returns the head of the named queue without popping it off the front of the queue. * Strip consecutive, repeated library options from the command line when we read it in the logic script. * Be more careful about not underflowing the argument buffer. 20040906 ======== * shell-lib was moved into pkgsrc/mk/scripts; correct references to that file in the wrapper code. * Use opt-sub instead of sub-mangle when protecting -I/usr/include/* and -L/usr/lib/* from buildlink transformations. This avoids adding lines that look like "-I-I..." in the transformation sedfiles. * mangle and sub-mangle are only meant to transform directories in -I, -L, and rpath options, so remove the lines in buildlink3/gen-transform.sh that transformed bare directories. * Fix bug in strip-slashdot where the "." wasn't backquoted and thus matched all characters instead of only the "." character. * Change the libtool wrapper to use a modified buildcmd script that doesn't rearrange any of the arguments. This should fix spurious problems where libtool doesn't understand how to parse the command line when the -l options are moved to the end of the argument list. * Fix bug in the logic script where the $cachearg and $cachedarg weren't being properly set at all times, which caused the cache to contain the wrong transformed argument. 20040907 ======== * Support automatically passing "ABI" flags to the compiler and linker depending on the value of ${ABI}. Currently supports the SunPro compiler with ${ABI} == 64 and the MIPSPro compiler with ${ABI} as any of 32, n32, o32, and 64. * Move back the code that splits absolute paths to shared libraries from arg-source back into logic. This allows us to correctly skip splitting those paths based on the previous option. Also add a sanity check that the library name in the split argument doesn't contain a "/" since shell globs are not as precise as REs. * Don't transform the path given after --dynamic-linker (used by GNU ld for ELF linkage). * Add the ability for the libtool wrapper to be called just to unwrap an existing libtool archive by running: libtool --mode=unwrap -o libfoo.la 20040914 ======== * Add a loop in libtool-fix-la to ensure that all of the options listed in the dependency_libs lines of *.lai files are processed. This fixes a buildlink3 leakage bug. * Merge the gen-transform.sh scripts between buildlink3 and wrapper and place them all in wrapper. This makes sense since the commands simply allow for many types of transformations, which buildlink3 takes advantage of, but there is nothing inherently buildlink-ish about those commands. * Don't directly manipulate SUBST_SED.unwrap. Instead, create the value of SUBST_SED.unwrap by combining several other variables (currently just _UNWRAP_SED) to ensure that the correct ordering is preserved. * Correct some confusing debugging messages. @ text @#!@@BUILDLINK_SHELL@@ # # $NetBSD: gen-transform.sh,v 1.31 2004/08/28 06:02:21 jlam Exp $ transform="@@_BLNK_TRANSFORM_SEDFILE@@" untransform="@@_BLNK_UNTRANSFORM_SEDFILE@@" reorderlibs="@@_BLNK_REORDERLIBS@@" # Mini-language for translating wrapper arguments into their buildlink # equivalents: # # mangle:src:dst mangles the directory "src" into "dst" # sub-mangle:src:dst mangles "src/*" into "dst/*" # rpath:src:dst translates the directory "src" into "dst" # in rpath options # sub-rpath:src:dst translates "src/*" into "dst/*" in rpath # options # abs-rpath removes all rpath options that try to add # relative paths # no-rpath removes "-R*", "-Wl,-R", and "-Wl,-rpath,*" # reorder:l:foo:bar reorders libs to ensure that "-lfoo" # occurs before "-lbar" # depot:src:dst translates "src//" into "dst/" # I:src:dst translates "-Isrc" into "-Idst" # L:src:dst translates "-Lsrc" into "-Ldst" # l:foo:bar[:baz1...] translates "-lfoo" into "-lbar [-lbaz...]" # P:src:dst translates "src/libfoo.{a,la}" into # "dst/libfoo.{a,la}" # p:path translates "path/*/libfoo.so" into # "-Lpath/* -lfoo" # r:dir removes "dir" and "dir/*" # S:foo:bar translates word "foo" into "bar" # s:foo:bar translates "foo" into "bar" # # Some transformations only make sense in one direction, so if a command # is prefixed with either "transform:" or "untransform:", then the # resulting sed commands are only appended the the corresponding sedfile. _sep=" \`\"':;," gen() { action=$1; shift case "$action" in transform) sedfile="$transform" ;; untransform) sedfile="$untransform" ;; esac save_IFS="${IFS}"; IFS=":" set -- $1 IFS="${save_IFS}" case "$1" in mangle) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|^$2\([/$_sep]\)|$3\1|g s|^$2$|$3|g s|\([$_sep]\)$2\([/$_sep]\)|\1$3\2|g s|\([$_sep]\)$2$|\1$3|g EOF case "$2" in -*) ;; *) @@CAT@@ >> $sedfile << EOF s|\(-[ILR]\)$2\([/$_sep]\)|\1$3\2|g s|\(-[ILR]\)$2$|\1$3|g EOF ;; esac ;; esac ;; sub-mangle) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|^$2\(/[^/$_sep]\)|$3\1|g s|\([$_sep]\)$2\(/[^/$_sep]\)|\1$3\2|g EOF case "$2" in -*) ;; *) @@CAT@@ >> $sedfile << EOF s|\(-[ILR]\)$2\(/[^/$_sep]\)|\1$3\2|g EOF ;; esac ;; esac ;; rpath) gen $action mangle:-Wl,--rpath-link,$2:-Wl,--rpath-link,$3 gen $action mangle:-Wl,--rpath,$2:-Wl,--rpath,$3 gen $action mangle:-Wl,-rpath-link,$2:-Wl,-rpath-link,$3 gen $action mangle:-Wl,-rpath,$2:-Wl,-rpath,$3 gen $action mangle:-Wl,-R$2:-Wl,-R$3 gen $action mangle:-R$2:-R$3 ;; sub-rpath) gen $action sub-mangle:-Wl,--rpath-link,$2:-Wl,--rpath-link,$3 gen $action sub-mangle:-Wl,--rpath,$2:-Wl,--rpath,$3 gen $action sub-mangle:-Wl,-rpath-link,$2:-Wl,-rpath-link,$3 gen $action sub-mangle:-Wl,-rpath,$2:-Wl,-rpath,$3 gen $action sub-mangle:-Wl,-R$2:-Wl,-R$3 gen $action sub-mangle:-R$2:-R$3 ;; abs-rpath) gen $action __r:-Wl,--rpath-link,\\. gen $action __r:-Wl,--rpath,\\. gen $action __r:-Wl,-rpath-link,\\. gen $action __r:-Wl,-rpath,\\. gen $action __r:-Wl,-R\\. gen $action __r:-R\\. ;; no-rpath) gen $action __r:-Wl,--rpath-link, gen $action __r:-Wl,--rpath, gen $action __r:-Wl,-rpath-link, gen $action __r:-Wl,-rpath, gen $action __r:-Wl,-R gen $action __r:-R ;; reorder) case "$action" in transform) shift case $1 in l) @@CAT@@ >> $reorderlibs << EOF # -l$2 comes before -l$3 -l$2) case "\${_libs}" in -l$3" "*|*" "-l$3" "*) _libs="\${_libs%%-l$3 *}-l$2 -l$3 \${_libs#*-l$3 }" ;; -l$3|*" "-l$3) _libs="\${_libs%%-l$3}-l$2 -l$3" ;; *) _libs="\${_libs} \$l" ;; esac ;; EOF ;; esac ;; esac ;; depot) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|^$2/[^/$_sep]*\(/[^$_sep]\)|$3\1|g s|^$2/[^/$_sep]*$|$3|g s|\([$_sep]\)$2/[^/$_sep]*\(/[^$_sep]\)|\1$3\2|g s|\([$_sep]\)$2/[^/$_sep]*$|\1$3|g s|\(-[ILR]\)$2/[^/$_sep]*\(/[^$_sep]\)|\1$3\2|g s|\(-[ILR]\)$2/[^/$_sep]*$|\1$3|g EOF ;; esac ;; I|L) case "$action" in transform) @@CAT@@ >> $sedfile << EOF s|-$1$2\([$_sep]\)|-$1$3\1|g s|-$1$2$|-$1$3|g s|-$1$2/|-$1$3/|g EOF ;; untransform) @@CAT@@ >> $sedfile << EOF s|-$1$3\([$_sep]\)|-$1$2\1|g s|-$1$3$|-$1$2|g s|-$1$3/|-$1$2/|g EOF ;; esac ;; l) case "$action" in transform|untransform) shift tolibs= fromlib="-l$1"; shift while [ $# -gt 0 ]; do case $1 in "") ;; *) case $tolibs in "") tolibs="-l$1" ;; *) tolibs="$tolibs -l$1" esac ;; esac shift done @@CAT@@ >> $sedfile << EOF s|$fromlib\([$_sep]\)|$tolibs\1|g s|$fromlib$|$tolibs|g EOF ;; esac ;; P) case "$action" in transform) @@CAT@@ >> $sedfile << EOF s|$2\(/[^$_sep]*/lib[^/$_sep]*\.la\)\([$_sep]\)|$3\1\2|g s|$2\(/[^$_sep]*/lib[^/$_sep]*\.la\)$|$3\1|g s|$2\(/[^$_sep]*/lib[^/$_sep]*\.a\)\([$_sep]\)|$3\1\2|g s|$2\(/[^$_sep]*/lib[^/$_sep]*\.a\)$|$3\1|g EOF ;; untransform) @@CAT@@ >> $sedfile << EOF s|$3\(/[^$_sep]*/lib[^/$_sep]*\.a\)\([$_sep]\)|$2\1\2|g s|$3\(/[^$_sep]*/lib[^/$_sep]*\.a\)$|$2\1|g s|$3\(/[^$_sep]*/lib[^/$_sep]*\.la\)\([$_sep]\)|$2\1\2|g s|$3\(/[^$_sep]*/lib[^/$_sep]*\.la\)$|$2\1|g EOF ;; esac ;; p) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.so\(\.[0-9]*\)*\([$_sep]\)|-L\1 -l\2\4|g s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.so\(\.[0-9]*\)*$|-L\1 -l\2|g s|\($2\)/lib\([^/$_sep]*\)\.so\(\.[0-9]*\)*\([$_sep]\)|-L\1 -l\2\4|g s|\($2\)/lib\([^/$_sep]*\)\.so\(\.[0-9]*\)*$|-L\1 -l\2|g s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.dylib\([$_sep]\)|-L\1 -l\2\3|g s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.dylib$|-L\1 -l\2|g s|\($2\)/lib\([^/$_sep]*\)\.dylib\([$_sep]\)|-L\1 -l\2\3|g s|\($2\)/lib\([^/$_sep]*\)\.dylib$|-L\1 -l\2|g EOF ;; esac ;; __r) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|$2[^$_sep]*||g EOF ;; esac ;; _r) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|$2\([$_sep]\)|\1|g s|$2$||g s|$2/[^$_sep]*||g EOF ;; esac ;; r) case "$2" in */) r=__r ;; *) r=_r ;; esac gen $action $r:-I$2 gen $action $r:-L$2 gen $action $r:-Wl,--rpath-link,$2 gen $action $r:-Wl,--rpath,$2 gen $action $r:-Wl,-rpath-link,$2 gen $action $r:-Wl,-rpath,$2 gen $action $r:-Wl,-R$2 gen $action $r:-R$2 ;; rmdir) gen $action r:$2 ;; S) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|$2\([$_sep]\)|$3\1|g s|$2$|$3|g EOF ;; esac ;; rename) gen $action S:$2:$3 ;; rm) gen $action S:$2: ;; s) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|$2|$3|g EOF ;; esac ;; *) echo "Unknown arg: $arg" 1>&2 ;; esac } # Write out header for reorderlibs @@CAT@@ > $reorderlibs << EOF \$echo "==> Reordering libraries: \$libs" >> \$wrapperlog prevlibs= while \$test "\$libs" != "\$prevlibs"; do _libs= for l in \$libs; do case \$l in EOF # Parse arguments for arg do case $arg in transform:*) gen transform "${arg#transform:}" ;; untransform:*) gen untransform "${arg#untransform:}" ;; *) gen transform "$arg" gen untransform "$arg" ;; esac done # Write out footer for reorderlibs @@CAT@@ >> $reorderlibs << EOF *) _libs="\${_libs} \$l" ;; esac _libs="\${_libs# }" _libs="\${_libs% }" done prevlibs="\$libs" libs="\${_libs}" done # This section suppress duplicate libraries in sequence. _libs= for l in \$libs; do case "\${_libs}" in \$l|*" "\$l) ;; *) _libs="\${_libs} \$l" ;; esac done _libs="\${_libs# }" _libs="\${_libs% }" libs="\${_libs}" EOF @ 1.31 log @Make "rename" a synonym for "S". @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.30 2004/08/28 05:51:30 jlam Exp $ @ 1.30 log @Add "rm:opt" as a synonym for "S:opt:", and "rmdir:dir" for "r:dir". These are supported options from the soon-to-be-committed wrapper framework and are meant to more precisely state the intended transformation. Also just skip over unknown commands instead of generating an error. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.29 2004/08/27 06:29:09 jlam Exp $ d288 3 @ 1.29 log @Replace RPATH_FLAG with LINKER_RPATH_FLAG and COMPILER_RPATH_FLAG, which are the full option names used to set rpath directives for the linker and the compiler, respectively. In places were we are invoking the linker, use "${LINKER_RPATH_FLAG} ", where the space is inserted in case the flag is a word, e.g. -rpath. The default values of *_RPATH_FLAG are set by the compiler/*.mk files, depending on the compiler that you use. They may be overridden on a ${OPSYS}-specific basis by setting _OPSYS_LINKER_RPATH_FLAG and _OPSYS_COMPILER_RPATH_FLAG, respectively. Garbage-collect _OPSYS_RPATH_NAME and _COMPILER_LD_FLAG. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.28 2004/08/10 15:13:25 jlam Exp $ d275 3 d288 3 a301 1 exit 1 @ 1.28 log @In the rpath transformations, also handle -Wl,@@_OPSYS_RPATH_NAME@@... in case ${_OPSYS_RPATH_NAME} is something surprising, like "-L". @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.27 2004/06/04 19:21:23 tv Exp $ a95 1 gen $action mangle:-Wl,@@_OPSYS_RPATH_NAME@@$2:-Wl,@@_OPSYS_RPATH_NAME@@$3 a103 1 gen $action sub-mangle:-Wl,@@_OPSYS_RPATH_NAME@@$2:-Wl,@@_OPSYS_RPATH_NAME@@$3 a111 1 gen $action __r:-Wl,@@_OPSYS_RPATH_NAME@@\\. a119 1 gen $action __r:-Wl,@@_OPSYS_RPATH_NAME@@ a272 1 gen $action $r:-Wl,@@_OPSYS_RPATH_NAME@@$2 @ 1.27 log @A couple packages (including the new boost) use "libfoo.so" as a directory name -- this seems to be common among Jam-using packages. So, make sure to do the -L -l transform only if at the end of a word. This unfortunately doubles the number of regexes needed to match (one with $_sep, one with $). While here, though, the expressions for .so, .so.X, .so.X.Y, and .so.X.Y.Z can all be collapsed into only one set with the use of \(\.[0-9]\)*, so we actually end up with *less* regexes than before. :) @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.26 2004/03/13 03:41:13 uebayasi Exp $ d96 1 d105 1 d114 1 d123 1 d277 1 @ 1.26 log @Indent. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.25 2004/03/12 15:45:43 jlam Exp $ d229 8 a236 10 s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.so\.[0-9]*\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2\)/lib\([^/$_sep]*\)\.so\.[0-9]*\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.so\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2\)/lib\([^/$_sep]*\)\.so\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.so\.[0-9]*|-L\1 -l\2|g s|\($2\)/lib\([^/$_sep]*\)\.so\.[0-9]*|-L\1 -l\2|g s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.so|-L\1 -l\2|g s|\($2\)/lib\([^/$_sep]*\)\.so|-L\1 -l\2|g s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^/$_sep]*\)\.dylib|-L\1 -l\2|g @ 1.25 log @Put comments in order that make sense. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.24 2004/02/19 18:39:27 jlam Exp $ d345 4 a348 4 case "\${_libs}" in \$l|*" "\$l) ;; *) _libs="\${_libs} \$l" ;; esac @ 1.24 log @According to the documentation on version numbering of shared libraries at: http://fink.sourceforge.net/doc/porting/shared.php It's okay to link against a name like "libqt.2.3.0.dylib" using "-lqt.2.3.0", which means we never need to do anything more than just strip the trailing ".dylib" from shared library names when converting from a full path to "-L... -l...". This should fix PR 24402. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.23 2004/02/12 20:29:34 jlam Exp $ d22 1 a33 1 # occurs before "-lbar" @ 1.23 log @Move a test from the reorderlibs script out to the wrapper scripts for efficiency reasons. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.22 2004/02/12 20:20:35 jlam Exp $ a236 6 s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.[0-9]*\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^/$_sep]*\)\.[0-9]*\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^/$_sep]*\)\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2/[^$_sep]*\)/lib\([^/$_sep]*\)\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^/$_sep]*\)\.[0-9]*\.dylib|-L\1 -l\2|g @ 1.22 log @Add missing "$" that was causing the reorderlibs script to create a variable with an exponentially increasing size. Fixes infinite loop when building security/cyrus-saslauthd. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.21 2004/02/12 08:28:58 jlam Exp $ d313 1 a313 1 while \$test "\$libs" != "\$prevlibs" -a -n "\$libs"; do @ 1.21 log @Modify the "no-rpath" to not need a "/" to start the rpath. Also modify the "r" command to allow paths ending in "/". This should fix PR 24352. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.20 2004/02/01 00:41:25 jlam Exp $ d133 1 a133 1 _libs="\${_libs%%-l$3 *}-l$2 -l$3 \${_libs#*-l3 }" d311 1 @ 1.20 log @How'd that -lb get there? @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.19 2004/01/30 11:29:56 jlam Exp $ d115 6 a120 6 gen $action _r:-Wl,--rpath-link, gen $action _r:-Wl,--rpath, gen $action _r:-Wl,-rpath-link, gen $action _r:-Wl,-rpath, gen $action _r:-Wl,-R gen $action _r:-R d253 1 a253 1 s|$2[^ \`"':;]*||g d271 2 a272 2 "") r=__r; pat="/" ;; *) r=_r; pat="$2" ;; d274 8 a281 8 gen $action $r:-I$pat gen $action $r:-L$pat gen $action $r:-Wl,--rpath-link,$pat gen $action $r:-Wl,--rpath,$pat gen $action $r:-Wl,-rpath-link,$pat gen $action $r:-Wl,-rpath,$pat gen $action $r:-Wl,-R$pat gen $action $r:-R$pat @ 1.19 log @Remove debugging line that I accidentally left there. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.18 2004/01/30 10:56:11 jlam Exp $ d133 1 a133 1 _libs="\${_libs%%-l$3 *}-l$2 -l$3 \${_libs#*-lb }" @ 1.18 log @Teach buildlink3 how to reorder libraries on the command line. You specify library orderings with: BUILDLINK_TRANSFORM+= reorder:l:crypt:crypto The wrapper scripts then reorder the libraries so that -lcrypt will always come before -lcrypto. If there are lots of reorder:l:... commands, then the algorithm looks a bit like a topological sort. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.17 2004/01/21 08:04:29 jlam Exp $ a344 1 echo "==> reorderlibs (\$libs) <<==" 1>&2 # !!! @ 1.17 log @Add a new command "sub-rpath" that does the same thing as "rpath" but only protects subdirectories of the named paths in rpath options to the linker. Use sub-rpath to protect /usr/lib/* in rpath options to the linker. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.16 2004/01/21 07:54:50 jlam Exp $ d7 1 d21 1 d33 1 d122 27 d309 10 d333 27 @ 1.16 log @Rename 'submangle' to 'sub-mangle' @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.15 2004/01/19 10:09:36 jlam Exp $ d15 2 d95 8 @ 1.15 log @* Make the mangle and depot commands a bit more conservative in finding instances of directory paths to mangle. We now check that the path is either a word by itself, or else part of likely compiler/linker options (-[ILR]). * Add a new "submangle" command that does the same thing as mangle but restricts itself to only the directory tree below the named src directory. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.14 2004/01/19 05:11:44 jlam Exp $ d12 1 a12 1 # submangle:src:dst mangles "src/*" into "dst/*" d67 1 a67 1 submangle) @ 1.14 log @Create a word separator $_sep variable and use throughout. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.12 2004/01/17 17:33:49 jlam Exp $ d12 1 d50 29 a78 2 s|$2\([/$_sep]\)|$3\1|g s|$2$|$3|g d80 2 d113 6 a118 2 s|$2/[^/$_sep]*\(/[^$_sep]\)|$3\1|g s|$2/[^/$_sep]*$|$3|g @ 1.13 log @Be even less aggressive and just remove relative paths that start with "." in abs-rpath. @ text @d33 2 d49 1 a49 1 s|$2\([/ \`"':;]\)|$3\1|g d83 2 a84 2 s|$2/[^/ \`"':;]*\(/[^ \`"':;]\)|$3\1|g s|$2/[^/ \`"':;]*$|$3|g d93 1 a93 1 s|-$1$2\([ \`"':;]\)|-$1$3\1|g d100 1 a100 1 s|-$1$3\([ \`"':;]\)|-$1$2\1|g d125 1 a125 1 s|$fromlib\([ "':;]\)|$tolibs\1|g d135 4 a138 4 s|$2\(/[^ \`"':;]*/lib[^/ \`"':;]*\.la\)\([ \`"':;]\)|$3\1\2|g s|$2\(/[^ \`"':;]*/lib[^/ \`"':;]*\.la\)$|$3\1|g s|$2\(/[^ \`"':;]*/lib[^/ \`"':;]*\.a\)\([ \`"':;]\)|$3\1\2|g s|$2\(/[^ \`"':;]*/lib[^/ \`"':;]*\.a\)$|$3\1|g d143 4 a146 4 s|$3\(/[^ \`"':;]*/lib[^/ \`"':;]*\.a\)\([ \`"':;]\)|$2\1\2|g s|$3\(/[^ \`"':;]*/lib[^/ \`"':;]*\.a\)$|$2\1|g s|$3\(/[^ \`"':;]*/lib[^/ \`"':;]*\.la\)\([ \`"':;]\)|$2\1\2|g s|$3\(/[^ \`"':;]*/lib[^/ \`"':;]*\.la\)$|$2\1|g d155 16 a170 16 s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.so|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.so|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.[0-9]*\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.[0-9]*\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.dylib|-L\1 -l\2|g d188 1 a188 1 s|$2\([ \`"':;]\)|\1|g d190 1 a190 1 s|$2/[^ \`"':;]*||g d213 1 a213 1 s|$2\([ \`"':;]\)|$3\1|g @ 1.12 log @Fix overly aggressive substitution pattern in abs-rpath to allow things like "-Wl,-R${exec_prefix}/lib". This fixes any breakage in *-config scripts where the above example was being stripped out. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.11 2004/01/13 07:52:37 jlam Exp $ d62 6 a67 6 gen $action __r:-Wl,--rpath-link,[^/\$] gen $action __r:-Wl,--rpath,[^/\$] gen $action __r:-Wl,-rpath-link,[^/\$] gen $action __r:-Wl,-rpath,[^/\$] gen $action __r:-Wl,-R[^/\$] gen $action __r:-R[^/\$] @ 1.11 log @Add a new command "abs-rpath" to the gen-transform.sh script that removes rpath options that try to add relative paths to the runtime library search path. This basically partly cleans up after lazy programmers. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.10 2004/01/11 03:30:20 grant Exp $ d62 6 a67 6 gen $action __r:-Wl,--rpath-link,[^/] gen $action __r:-Wl,--rpath,[^/] gen $action __r:-Wl,-rpath-link,[^/] gen $action __r:-Wl,-rpath,[^/] gen $action __r:-Wl,-R[^/] gen $action __r:-R[^/] @ 1.10 log @"for arg; do" -> "for arg do", as the latter is more portable. fixes buildlink3's wrappers on Solaris. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.9 2004/01/07 07:10:05 jlam Exp $ d14 2 d61 8 d177 1 a177 1 s|$2/[^ \`"':;]*||g d195 2 a196 2 "") r=__r ;; *) r=_r ;; d198 8 a205 8 gen $action $r:-I$2 gen $action $r:-L$2 gen $action $r:-Wl,--rpath-link,$2 gen $action $r:-Wl,--rpath,$2 gen $action $r:-Wl,-rpath-link,$2 gen $action $r:-Wl,-rpath,$2 gen $action $r:-Wl,-R$2 gen $action $r:-R$2 @ 1.9 log @Remove "$" at the end of rules in the [IL] commands that mistakenly crept in when creating this file based on the one in buildlink2. This should fix the problem noted on tech-pkg@@: "Re: graphics/gdk-pixbuf can't find build problem" where the CFLAGS for glib were being eaten by the unbuildlink step. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.8 2004/01/06 21:39:07 jlam Exp $ d223 1 a223 1 for arg; do @ 1.8 log @Back out revision 1.6 which was wrong. It failed to match -I/usr/pkg/include given I:/usr/pkg:... @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.7 2004/01/06 19:08:59 jlam Exp $ d81 1 a81 1 s|-$1$2\([ \`"':;]\)$|-$1$3\1|g d88 1 a88 1 s|-$1$3\([ \`"':;]\)$|-$1$2\1|g d90 1 a90 1 s|-$1$3/$|-$1$2/|g @ 1.7 log @Allow l:foo: to remove -lfoo. Also remove an incorrect rule in the "l" case. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.6 2004/01/06 18:43:10 jlam Exp $ d81 1 a81 1 s|-$1$2\([/ \`"':;]\)$|-$1$3\1|g d83 1 d88 1 a88 1 s|-$1$3\([/ \`"':;]\)$|-$1$2\1|g d90 1 @ 1.6 log @Reduce the number of lines emitted by the I and L rules. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.5 2004/01/06 18:10:06 jlam Exp $ d97 1 a98 1 tolibs="-l$1"; shift d100 8 a107 1 tolibs="$tolibs -l$1" a112 1 s|$fromlib/|$tolibs/|g @ 1.5 log @Missing trailing $ to only match whole words. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.4 2004/01/03 20:23:51 jlam Exp $ d81 1 a81 1 s|-$1$2\([ \`"':;]\)$|-$1$3\1|g a82 1 s|-$1$2/|-$1$3/|g d87 1 a87 1 s|-$1$3\([ \`"':;]\)$|-$1$2\1|g a88 1 s|-$1$3/|-$1$2/|g @ 1.4 log @Extend the "l" command by allowing changing "-lfoo" into "-lbar -lbaz" by saying "l:foo:bar:baz". @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.3 2003/09/03 16:35:01 jlam Exp $ d107 1 a107 1 s|$fromlib|$tolibs|g @ 1.3 log @Fix typo ;; -> :; @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.2 2003/09/02 06:59:54 jlam Exp $ d18 1 a18 1 # l:foo:bar translates "-lfoo" into "-lbar" d98 11 a108 4 @@CAT@@ >> $sedfile << EOF s|-$1$2\([ "':;]\)|-$1$3\1|g s|-$1$2$|-$1$3|g s|-$1$2/|-$1$3/|g @ 1.2 log @Merge pkgviews-mk branch into the HEAD by running: cd pkgsrc/mk cvs update -Pd -A cvs update -Pd -j pkgviews-mk-base -j pkgviews-mk @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.1.2.8 2003/08/30 10:02:34 jlam Exp $ d99 1 a99 1 s|-$1$2\([ "';;]\)|-$1$3\1|g @ 1.1 log @file gen-transform.sh was initially added on branch pkgviews-mk. @ text @d1 223 @ 1.1.2.1 log @Initial implementation of buildlink3, based on buildlink2 and designed to take advantage of pkgviews. More thought is needed for the pkgviews/libtool interaction because libtool archives (*.la) will likely contain absolute paths to other .la files in depot directories, but we don't want this since binary packages with wildcard dependencies may break. @ text @a0 175 #!@@BUILDLINK_SHELL@@ # # $NetBSD: gen-transform.sh,v 1.12 2003/07/09 16:07:22 salo Exp $ transform="@@_BLNK_TRANSFORM_SEDFILE@@" untransform="@@_BLNK_UNTRANSFORM_SEDFILE@@" # Mini-language for translating wrapper arguments into their buildlink # equivalents: # # mangle:src:dst mangles the directory "src" into "dst" # rpath:src:dst mangles the directory "src" into "dst" # in rpath options # I:src:dst translates "-Isrc" into "-Idst" # L:src:dst translates "-Lsrc" into "-Ldst" # l:foo:bar translates "-lfoo" into "-lbar" # p:path translates "path/*/libfoo.so" into # "-Lpath/* -lfoo" # r:dir removes "dir" and "dir/*" # S:foo:bar translates word "foo" into "bar" # s:foo:bar translates "foo" into "bar" # static:src:dst translates "src/libfoo.a" into "dst/libfoo.a" # no-rpath removes "-R*", "-Wl,-R", and "-Wl,-rpath,*" gen() { action=$1; shift case "$action" in transform) sedfile="$transform" ;; untransform) sedfile="$untransform" ;; esac save_IFS="${IFS}"; IFS=":" set -- $1 IFS="${save_IFS}" case "$1" in mangle) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|$2\([/ ]\)|$3\1|g s|$2$|$3|g EOF ;; esac ;; rpath) gen $action mangle:-Wl,-rpath-link,$2:-Wl,-rpath-link,$3 gen $action mangle:-Wl,-rpath,$2:-Wl,-rpath,$3 gen $action mangle:-Wl,-R$2:-Wl,-R$3 gen $action mangle:-R$2:-R$3 ;; I|L) case "$action" in transform) @@CAT@@ >> $sedfile << EOF s|-$1$2[ ]$|-$1$3 |g s|-$1$2$|-$1$3|g s|-$1$2/|-$1$3/|g EOF ;; untransform) @@CAT@@ >> $sedfile << EOF s|-$1$3[ ]$|-$1$2 |g s|-$1$3$|-$1$2|g s|-$1$3/|-$1$2/|g EOF ;; esac ;; l) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|-$1$2[ ]|-$1$3 |g s|-$1$2$|-$1$3|g s|-$1$2/|-$1$3/|g EOF ;; esac ;; static) case "$action" in transform) s|$2\(/[^ "':;]*/lib[^ /"':;]*\.a\)$|$3\1|g @@CAT@@ >> $sedfile << EOF s|$2\(/[^ "':;]*/lib[^ /"':;]*\.a\)[ ]|$3\1 |g s|$2\(/[^ "':;]*/lib[^ /"':;]*\.a\)$|$3\1|g EOF ;; untransform) @@CAT@@ >> $sedfile << EOF s|$3\(/[^ "':;]*/lib[^ /"':;]*\.a\)[ ]|$2\1 |g s|$3\(/[^ "':;]*/lib[^ /"':;]*\.a\)$|$2\1|g EOF ;; esac ;; p) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|\($2/[^ "':;]*\)/lib\([^ /"':;]*\)\.so\.[0-9]*\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2\)/lib\([^ /"':;]*\)\.so\.[0-9]*\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2/[^ "':;]*\)/lib\([^ /"':;]*\)\.so\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2\)/lib\([^ /"':;]*\)\.so\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2/[^ "':;]*\)/lib\([^ /"':;]*\)\.so\.[0-9]*|-L\1 -l\2|g s|\($2\)/lib\([^ /"':;]*\)\.so\.[0-9]*|-L\1 -l\2|g s|\($2/[^ "':;]*\)/lib\([^ /"':;]*\)\.so|-L\1 -l\2|g s|\($2\)/lib\([^ /"':;]*\)\.so|-L\1 -l\2|g s|\($2/[^ "':;]*\)/lib\([^ /"':;]*\)\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^ /"':;]*\)\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2/[^ "':;]*\)/lib\([^ /"':;]*\)\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^ /"':;]*\)\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2/[^ "':;]*\)/lib\([^ /"':;]*\)\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^ /"':;]*\)\.dylib|-L\1 -l\2|g EOF ;; esac ;; _r) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|$2[ ]| |g s|$2$||g s|$2/[^ "':;]*||g EOF ;; esac ;; r) gen $action _r:-I$2 gen $action _r:-L$2 gen $action _r:-Wl,-rpath-link,$2 gen $action _r:-Wl,-rpath,$2 gen $action _r:-Wl,-R$2 gen $action _r:-R$2 ;; S) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|$2[ ]|$3 |g s|$2$|$3|g EOF ;; esac ;; s) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|$2|$3|g EOF ;; esac ;; no-rpath) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|-Wl,-rpath-link,[^ "':;]*||g s|-Wl,-rpath,[^ "':;]*||g s|-Wl,-R[^ "':;]*||g s|-R[^ "':;]*||g EOF ;; esac ;; esac } for arg do gen transform "$arg" gen untransform "$arg" done @ 1.1.2.2 log @Remove spurious line that causes spewage for "static" action. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.1.2.1 2003/08/14 13:16:48 jlam Exp $ d83 1 @ 1.1.2.3 log @Second pass at making buildink3 usable by overwrite packages. This drags in most of the functionality present in buildlink2. We try something new to prevent libtool from looking in ${LOCALBASE}/lib for more libtool archives. Also, modify the cache-seeding to occur in stages and allow for a way to specify which stages we want. Currently, we seed with only the passthru and transforming bits. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.1.2.2 2003/08/27 06:09:01 jlam Exp $ a16 2 # P:src:dst translates "src/libfoo.{a,la}" into # "dst/libfoo.{a,la}" d22 1 a50 6 no-rpath) gen $action _r:-Wl,-rpath-link, gen $action _r:-Wl,-rpath, gen $action _r:-Wl,-R gen $action _r:-R ;; d80 1 a80 1 P) a83 2 s|$2\(/[^ "':;]*/lib[^ /"':;]*\.la\)[ ]|$3\1 |g s|$2\(/[^ "':;]*/lib[^ /"':;]*\.la\)$|$3\1|g a91 2 s|$3\(/[^ "':;]*/lib[^ /"':;]*\.la\)[ ]|$2\1 |g s|$3\(/[^ "':;]*/lib[^ /"':;]*\.la\)$|$2\1|g d152 12 @ 1.1.2.4 log @Properly preserve some whitespace during tranformations. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.1.2.3 2003/08/28 09:48:20 jlam Exp $ d62 1 a62 1 s|-$1$2\([ ]\)$|-$1$3\1|g d69 1 a69 1 s|-$1$3\([ ]\)$|-$1$2\1|g d80 1 a80 1 s|-$1$2\([ ]\)|-$1$3\1|g d91 1 a91 1 s|$2\(/[^ "':;]*/lib[^ /"':;]*\.la\)\([ ]\)|$3\1\2|g d93 1 a93 1 s|$2\(/[^ "':;]*/lib[^ /"':;]*\.a\)\([ ]\)|$3\1\2|g d99 1 a99 1 s|$3\(/[^ "':;]*/lib[^ /"':;]*\.a\)\([ ]\)|$2\1\2|g d101 1 a101 1 s|$3\(/[^ "':;]*/lib[^ /"':;]*\.la\)\([ ]\)|$2\1\2|g d133 1 a133 1 s|$2\([ ]\)|\1|g d152 1 a152 1 s|$2\([ ]\)|$3\1|g @ 1.1.2.5 log @Avoid removing bare -[ILR], etc. You're allowed to put a space between the option flag and the directory that follows it. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.1.2.4 2003/08/28 10:21:52 jlam Exp $ a128 9 __r) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|$2/[^ "':;]*||g EOF ;; esac ;; d141 6 a146 10 case "$2" in "") r=__r ;; *) r=_r ;; esac gen $action $r:-I$2 gen $action $r:-L$2 gen $action $r:-Wl,-rpath-link,$2 gen $action $r:-Wl,-rpath,$2 gen $action $r:-Wl,-R$2 gen $action $r:-R$2 @ 1.1.2.6 log @Deal with "-Wl,--rpath -Wl,/path/to/dir" by compressing it into a single argument "-Wl,--rpath,/path/to/dir". This makes the cache-lookup much easier. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.1.2.5 2003/08/28 10:29:09 jlam Exp $ a46 2 gen $action mangle:-Wl,--rpath-link,$2:-Wl,--rpath-link,$3 gen $action mangle:-Wl,--rpath,$2:-Wl,--rpath,$3 a52 2 gen $action _r:-Wl,--rpath-link, gen $action _r:-Wl,--rpath, a155 2 gen $action $r:-Wl,--rpath-link,$2 gen $action $r:-Wl,--rpath,$2 @ 1.1.2.7 log @Add a new command "depot:src:dst" that translates "src//" into "dst/". Also be more strict about matching either non-separators or separators that can appear after a directory name. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.1.2.6 2003/08/28 19:12:55 jlam Exp $ d14 3 a16 5 # no-rpath removes "-R*", "-Wl,-R", and "-Wl,-rpath,*" # depot:src:dst translates "src//" into "dst/" # I:src:dst translates "-Isrc" into "-Idst" # L:src:dst translates "-Lsrc" into "-Ldst" # l:foo:bar translates "-lfoo" into "-lbar" d21 4 a24 3 # r:dir removes "dir" and "dir/*" # S:foo:bar translates word "foo" into "bar" # s:foo:bar translates "foo" into "bar" d40 1 a40 1 s|$2\([/ \`"':;]\)|$3\1|g a61 10 depot) case "$action" in transform|untransform) @@CAT@@ >> $sedfile << EOF s|$2/[^/ \`"':;]*\(/[^ \`"':;]\)|$3\1|g s|$2/[^/ \`"':;]*$|$3|g EOF ;; esac ;; d66 1 a66 1 s|-$1$2\([ \`"':;]\)$|-$1$3\1|g d73 1 a73 1 s|-$1$3\([ \`"':;]\)$|-$1$2\1|g d84 1 a84 1 s|-$1$2\([ "';;]\)|-$1$3\1|g d95 4 a98 4 s|$2\(/[^ \`"':;]*/lib[^/ \`"':;]*\.la\)\([ \`"':;]\)|$3\1\2|g s|$2\(/[^ \`"':;]*/lib[^/ \`"':;]*\.la\)$|$3\1|g s|$2\(/[^ \`"':;]*/lib[^/ \`"':;]*\.a\)\([ \`"':;]\)|$3\1\2|g s|$2\(/[^ \`"':;]*/lib[^/ \`"':;]*\.a\)$|$3\1|g d103 4 a106 4 s|$3\(/[^ \`"':;]*/lib[^/ \`"':;]*\.a\)\([ \`"':;]\)|$2\1\2|g s|$3\(/[^ \`"':;]*/lib[^/ \`"':;]*\.a\)$|$2\1|g s|$3\(/[^ \`"':;]*/lib[^/ \`"':;]*\.la\)\([ \`"':;]\)|$2\1\2|g s|$3\(/[^ \`"':;]*/lib[^/ \`"':;]*\.la\)$|$2\1|g d115 14 a128 16 s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*\.[0-9]*|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.so\.[0-9]*|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.so|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.so|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.[0-9]*\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.[0-9]*\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.[0-9]*\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.[0-9]*\.dylib|-L\1 -l\2|g s|\($2/[^ \`"':;]*\)/lib\([^/ \`"':;]*\)\.dylib|-L\1 -l\2|g s|\($2\)/lib\([^/ \`"':;]*\)\.dylib|-L\1 -l\2|g d137 1 a137 1 s|$2/[^ \`"':;]*||g d146 1 a146 1 s|$2\([ \`"':;]\)|\1|g d148 1 a148 1 s|$2/[^ \`"':;]*||g d171 1 a171 1 s|$2\([ \`"':;]\)|$3\1|g @ 1.1.2.8 log @Allow a transformation to be _only_ for either transform or untransform. @ text @d3 1 a3 1 # $NetBSD: gen-transform.sh,v 1.1.2.7 2003/08/30 07:48:53 jlam Exp $ d12 1 a12 1 # rpath:src:dst translates the directory "src" into "dst" a25 4 # # Some transformations only make sense in one direction, so if a command # is prefixed with either "transform:" or "untransform:", then the # resulting sed commands are only appended the the corresponding sedfile. a198 4 *) echo "Unknown arg: $arg" 1>&2 exit 1 ;; d202 3 a204 13 for arg; do case $arg in transform:*) gen transform "${arg#transform:}" ;; untransform:*) gen untransform "${arg#untransform:}" ;; *) gen transform "$arg" gen untransform "$arg" ;; esac @