head 1.8; access; symbols pkgsrc-2013Q2:1.8.0.48 pkgsrc-2013Q2-base:1.8 pkgsrc-2012Q4:1.8.0.46 pkgsrc-2012Q4-base:1.8 pkgsrc-2011Q4:1.8.0.44 pkgsrc-2011Q4-base:1.8 pkgsrc-2011Q2:1.8.0.42 pkgsrc-2011Q2-base:1.8 pkgsrc-2009Q4:1.8.0.40 pkgsrc-2009Q4-base:1.8 pkgsrc-2008Q4:1.8.0.38 pkgsrc-2008Q4-base:1.8 pkgsrc-2008Q3:1.8.0.36 pkgsrc-2008Q3-base:1.8 cube-native-xorg:1.8.0.34 cube-native-xorg-base:1.8 pkgsrc-2008Q2:1.8.0.32 pkgsrc-2008Q2-base:1.8 pkgsrc-2008Q1:1.8.0.30 pkgsrc-2008Q1-base:1.8 pkgsrc-2007Q4:1.8.0.28 pkgsrc-2007Q4-base:1.8 pkgsrc-2007Q3:1.8.0.26 pkgsrc-2007Q3-base:1.8 pkgsrc-2007Q2:1.8.0.24 pkgsrc-2007Q2-base:1.8 pkgsrc-2007Q1:1.8.0.22 pkgsrc-2007Q1-base:1.8 jlam-pkgviews:1.8.0.20 jlam-pkgviews-base:1.8 pkgsrc-2006Q4:1.8.0.18 pkgsrc-2006Q4-base:1.8 pkgsrc-2006Q3:1.8.0.16 pkgsrc-2006Q3-base:1.8 pkgsrc-2006Q2:1.8.0.14 pkgsrc-2006Q2-base:1.8 pkgsrc-2006Q1:1.8.0.12 pkgsrc-2006Q1-base:1.8 pkgsrc-2005Q4:1.8.0.10 pkgsrc-2005Q4-base:1.8 pkgsrc-2005Q3:1.8.0.8 pkgsrc-2005Q3-base:1.8 pkgsrc-2005Q2:1.8.0.6 pkgsrc-2005Q2-base:1.8 pkgsrc-2005Q1:1.8.0.4 pkgsrc-2005Q1-base:1.8 pkgsrc-2004Q4:1.8.0.2 pkgsrc-2004Q4-base:1.8 pkgsrc-2004Q3:1.7.0.6 pkgsrc-2004Q3-base:1.7 pkgsrc-2004Q2:1.7.0.4 pkgsrc-2004Q2-base:1.7 pkgsrc-2004Q1:1.7.0.2 pkgsrc-2004Q1-base:1.7 pkgsrc-2003Q4:1.1.0.2 pkgsrc-2003Q4-base:1.1; locks; strict; comment @# @; 1.8 date 2004.09.21.15.01.40; author jlam; state dead; branches; next 1.7; 1.7 date 2004.01.30.13.44.52; author jlam; state Exp; branches; next 1.6; 1.6 date 2004.01.29.07.19.00; author jlam; state Exp; branches; next 1.5; 1.5 date 2004.01.29.07.14.30; author jlam; state Exp; branches; next 1.4; 1.4 date 2004.01.27.08.23.45; author jlam; state Exp; branches; next 1.3; 1.3 date 2004.01.07.17.40.36; author jlam; state Exp; branches; next 1.2; 1.2 date 2004.01.07.17.31.02; author jlam; state Exp; branches; next 1.1; 1.1 date 2003.10.09.12.15.15; author jlam; state Exp; branches; next ; desc @@ 1.8 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 @# $NetBSD: buffer,v 1.7 2004/01/30 13:44:52 jlam Exp $ # # Push arguments onto the argument stack and shift the arguments. The # next argument checked by the cache and logic files is take from the # the top of the stack. # if $test -z "$depth"; then arg="$1"; shift # # Marshall any group of consecutive arguments into a single # $arg to be checked in the cache and logic files. # . $marshall # # Push the argument onto the stack. # depth=${depth}0 eval stack${depth}="\$arg" fi argok=no while $test "$argok" = "no"; do # # Take $arg from the top of the stack. # eval arg="\$stack${depth}" depth=${depth%0} argok=yes case $arg in # # Change "-/path1:/path2" into # "-/path1 -/path2" so that # they can be checked correctly in the cache and logic # files. # -R*:*|-Wl,-R*:*|-Wl,-rpath,*:*|-Wl,-rpath-link,*:*|\ -Wl,--rpath,*:*|-Wl,--rpath-link,*:*) case $arg in -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," ;; -Wl,--rpath-link,*) R="-Wl,--rpath-link," ;; esac arg=`$echo "X$arg" | $Xsed -e "s|^"$R"||g"` save_IFS="${IFS}"; IFS=":" revarg= for dir in $arg; do revarg="$dir $revarg" done IFS="${save_IFS}" for dir in $revarg; do depth=${depth}0 eval stack${depth}="\$R\$dir" done argok=no ;; esac done @ 1.7 log @Use the stack in a smarter way. Take an argument (perhaps marshalling several arguments together) from the command line and push it onto the stack. Pop the top off the stack, process, and push replacement arguments onto the stack. Repeat the last step until no more processing is done, and we have our final argument to be passed on through to the rest of the wrapper script. @ text @d1 1 a1 1 # $NetBSD: buffer,v 1.6 2004/01/29 07:19:00 jlam Exp $ @ 1.6 log @Revert the changes in revision 1.2 to do duplicate directory suppression. We just let the rest of the wrapper scripts do it now that we can't overflow a fixed-sized circular buffer. @ text @d1 1 a1 1 # $NetBSD: buffer,v 1.5 2004/01/29 07:14:30 jlam Exp $ d15 1 a15 1 # Fill the buffers from $arg. d17 13 d31 6 a38 6 # # Change "-/path1:/path2" into # "-/path1 -/path2" so that # they can be checked correctly in the cache and logic # files. # a47 1 allargs="$@@" d49 6 a54 2 set -- $arg while $test $# -gt 0; do d56 1 a56 2 eval stack${depth}="\$R\$1" shift d58 1 a58 8 IFS="${save_IFS}" if $test -n "$allargs"; then set -- $allargs fi ;; *) depth=${depth}0 eval stack${depth}="\$arg" d61 1 a61 6 fi # # Re-fetch $arg from the top of the stack. # eval arg="\$stack${depth}" depth=${depth%0} @ 1.5 log @Use a stack instead of the broken implementation of a circular list for the argument buffer. @ text @d1 1 a1 1 # $NetBSD: buffer,v 1.4 2004/01/27 08:23:45 jlam Exp $ a36 1 dirlist= d39 2 a40 5 case "$dirlist" in "$1"|"$1 "*) ;; *" $1 "*|*" $1") ;; *) dirlist="$1 $dirlist" ;; esac a46 4 for dir in $dirlist; do depth=${depth}0 eval stack${depth}="\$R\$dir" done @ 1.4 log @Also break up -R*:* into separate -R options. @ text @d1 1 a1 1 # $NetBSD: buffer,v 1.3 2004/01/07 17:40:36 jlam Exp $ d3 3 a5 4 # Fill the buffer if it's empty, and shift the arguments. The next # argument checked by the cache and logic files is taken from the # first non-empty buffer. We avoid using "eval" so that we can skip # having to specially quote the argument using "sed". d7 1 a7 2 case ${buf1}${buf2}${buf3}${buf4}${buf5} in "") d42 2 a43 10 *" $1 "*|*" $1") ;; *) dirlist="$dirlist $1" if $test -z "$buf1"; then buf1="$R$1" elif $test -z "$buf2"; then buf2="$R$1" elif $test -z "$buf3"; then buf3="$R$1" elif $test -z "$buf4"; then buf4="$R$1" elif $test -z "$buf5"; then buf5="$R$1" else exit 2 fi ;; d51 4 d57 2 a58 7 if $test -z "$buf1"; then buf1="$arg" elif $test -z "$buf2"; then buf2="$arg" elif $test -z "$buf3"; then buf3="$arg" elif $test -z "$buf4"; then buf4="$arg" elif $test -z "$buf5"; then buf5="$arg" else exit 2 fi d61 1 a61 2 ;; esac d63 1 a63 1 # Re-fetch $arg from the first non-empty buffer. d65 2 a66 6 if $test -n "$buf1"; then arg="$buf1"; buf1= elif $test -n "$buf2"; then arg="$buf2"; buf2= elif $test -n "$buf3"; then arg="$buf3"; buf3= elif $test -n "$buf4"; then arg="$buf4"; buf4= elif $test -n "$buf5"; then arg="$buf5"; buf5= fi @ 1.3 log @Make the wrapper exit with error code 2 to signify a buffer overflow to avoid infinite loops. @ text @d1 1 a1 1 # $NetBSD: buffer,v 1.2 2004/01/07 17:31:02 jlam Exp $ d20 1 a20 1 -Wl,-R*:*|-Wl,-rpath,*:*|-Wl,-rpath-link,*:*|\ d23 2 a24 2 # Change "-Wl,-R/path1:/path2:/path3" into # "-Wl,-R/path1 -Wl,-R/path2 -Wl,-R/path3" so that d29 1 @ 1.2 log @Suppress duplicates when splitting -Wl,-R/dir1:/dir2:... into separate arguments. This avoids overfilling the circular buffer (length 5) used by the buildlink3 wrappers. @ text @d1 1 a1 1 # $NetBSD: buffer,v 1.1 2003/10/09 12:15:15 jlam Exp $ d50 1 d67 1 @ 1.1 log @Change the way in which arguments are processed by the wrappers. We know read the arguments by first placing them in a buffer and taking the argument in the first non-empty buffer as the argument to process. The buffer is there to allow "splitting" an argument into multiple arguments (currently up to five arguments), e.g. "-Wl,-R/path1:/path2" is split into "-Wl,-R/path1" and "-Wl,-R/path2". Each split argument is placed into a buffer. Using a buffer lets us read and process all of the arguments in a single pass despite "pushing" more arguments onto the front of the argument array. @ text @d1 1 a1 1 # $NetBSD$ d38 1 d41 13 a53 6 if $test -z "$buf1"; then buf1="$R$1"; shift elif $test -z "$buf2"; then buf2="$R$1"; shift elif $test -z "$buf3"; then buf3="$R$1"; shift elif $test -z "$buf4"; then buf4="$R$1"; shift elif $test -z "$buf5"; then buf5="$R$1"; shift fi @