Re: [cygwin, libtool] use shell function to emit wrapper scripts and wrapper.exe source
Hello Charles, * Charles Wilson wrote on Thu, Apr 19, 2007 at 11:40:58PM CEST: 2007-04-19 Charles Wilson [EMAIL PROTECTED] * libltdl/config/ltmain.m4sh (func_mode_link): move wrapper script generation from here... (func_emit_libtool_wrapper_script): to this new function, and write to stdout (func_mode_link): move cwrapper source code generation from here... (func_emit_libtool_cwrapperexe_source): to this new function, and write to stdout (func_mode_link): call the two new functions and redirect output to appropriate file. Thanks. I've applied this patch. Cheers, Ralf
Re: [cygwin, libtool] use shell function to emit wrapper scripts and wrapper.exe source
* Charles Wilson wrote on Thu, Apr 19, 2007 at 06:13:19AM CEST: Test results -- new tests. Unexpected failures: 14: Java convenience archives FAILED (convenience.at:273) 16: Link order of deplibs. FAILED (link-order2.at:129) 49: Run tests with low max_cmd_len FAILED (cmdline_wrap.at:42) are actually not unexpected on cygwin. And certainly have nothing to do with this patch. Actually, I think this is may be the best test conformance I've ever seen on cygwin... I think I saw the new testsuite passing on Cygwin at one point. Could you post tests/testsuite.log (gzipped if it's large)? Thanks, Ralf
Re: [cygwin, libtool] use shell function to emit wrapper scripts and wrapper.exe source
* Charles Wilson wrote on Thu, Apr 19, 2007 at 03:55:20AM CEST: [Added libtool-patches to CC list. Discussion of this patch should probably drop libtool and cygwin] Done. Okay, here's the first bit. It's pretty simple. Testing is in progress (and in conjuction with the new argz fix I just posted to libtool-patches), but looks good so far: the new wrapper scripts are identical to old ones generated without this patch. Thanks. Please resubmit with the new functions moved to right before func_mode_link (or func_mode_install/func_mode_execute, in case you intend to use them from inside them in a followup patch); there's a real performance benefit to doing this for compile mode, as it saves the shell from having to parse the functions in that case. It may be lost in the fork/exec overhead on w32, but on GNU/Linux, libtool compile mode overhead is dominated by shell parsing (see the 2007-02-11 changes for a 30% execution time reduction this way). Also, please use round parentheses as per GCS for referring to functions in the ChangeLog entry. I'll apply the reposted patch then. Cheers, and thanks again, Ralf 2007-04-18 Charles Wilson [EMAIL PROTECTED] * libltdl/config/ltmain.m4sh [func_mode_link]: move wrapper script writing from here... [func_emit_libtool_wrapper_script]: to this new function, and write to stdout [func_mode_link]: move cwrapper source code writing from here... [func_emit_libtool_cwrapperexe_source]: to this new function, and write to stdout [func_mode_link]: call the two new functions and redirect to appropriate file.
Re: [cygwin, libtool] use shell function to emit wrapper scripts and wrapper.exe source
Ralf Wildenhues wrote: * Charles Wilson wrote: Test results -- new tests. Unexpected failures: 14: Java convenience archives FAILED (convenience.at:273) 16: Link order of deplibs. FAILED (link-order2.at:129) 49: Run tests with low max_cmd_len FAILED (cmdline_wrap.at:42) are actually not unexpected on cygwin. And certainly have nothing to do with this patch. Actually, I think this is may be the best test conformance I've ever seen on cygwin... I think I saw the new testsuite passing on Cygwin at one point. ??? that would surprise me. Could you post tests/testsuite.log (gzipped if it's large)? attached. -- Chuck testsuite.log.gz Description: GNU Zip compressed data
Re: [cygwin, libtool] use shell function to emit wrapper scripts and wrapper.exe source
Ralf Wildenhues wrote: Thanks. Please resubmit with the new functions moved to right before func_mode_link (or func_mode_install/func_mode_execute, in case you intend to use them from inside them in a followup patch); there's a real performance benefit to doing this for compile mode, as it saves the shell from having to parse the functions in that case. It may be lost in the fork/exec overhead on w32, but on GNU/Linux, libtool compile mode overhead is dominated by shell parsing (see the 2007-02-11 changes for a 30% execution time reduction this way). Done. Testing is still in progress (again, in conjunction with updated argz.m4 patch). However, mdemo works (on all six test variants described in the argz.m4 messages), and the entire old test suite passes on cygwin(broken argz kernel: 1.5.24-2). Also, please use round parentheses as per GCS for referring to functions in the ChangeLog entry. I'll apply the reposted patch then. Done. -- Chuck 2007-04-19 Charles Wilson [EMAIL PROTECTED] * libltdl/config/ltmain.m4sh (func_mode_link): move wrapper script generation from here... (func_emit_libtool_wrapper_script): to this new function, and write to stdout (func_mode_link): move cwrapper source code generation from here... (func_emit_libtool_cwrapperexe_source): to this new function, and write to stdout (func_mode_link): call the two new functions and redirect output to appropriate file. Index: libltdl/config/ltmain.m4sh === RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v retrieving revision 1.72 diff -u -r1.72 ltmain.m4sh --- libltdl/config/ltmain.m4sh 2007-04-19 14:51:24.109375000 -0400 +++ libltdl/config/ltmain.m4sh 2007-04-19 14:51:00.96875 -0400 @@ -2209,6 +2209,555 @@ test $mode = install func_mode_install ${1+$@} +# func_emit_libtool_wrapper_script +# emit a libtool wrapper script on stdout +# don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variable +# set therein. +func_emit_libtool_wrapper_script () +{ + $ECHO \ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \\${ZSH_VERSION+set}\ (emulate sh) /dev/null 21; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\[EMAIL PROTECTED]}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\[EMAIL PROTECTED]}'='\[EMAIL PROTECTED]' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) /dev/null 21 unset CDPATH + +relink_command=\$relink_command\ + +# This environment variable determines our operation mode. +if test \\$libtool_install_magic\ = \$magic\; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \\$libtool_execute_magic\ != \$magic\; then +ECHO=\$qecho\ +file=\\$0\ +# Make sure echo works. +if test \X\$1\ = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test \X\`{ \$ECHO '\t'; } 2/dev/null\`\ = 'X\t'; then + # Yippee, \$ECHO works! + : +else + # Restart under the correct shell, and then maybe \$ECHO will work. + exec $SHELL \\$0\ --no-reexec \${1+\[EMAIL PROTECTED]} +fi + fi\ + + $ECHO \ + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \X\$file\ | \$Xsed -e 's%/[^/]*$%%'\` + test \x\$thisdir\ = \x\$file\ thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \\$file\ | ${SED} -n 's/.*- //p'\` + while test -n \\$file\; do +destdir=\`\$ECHO \X\$file\ | \$Xsed -e 's%/[^/]*\$%%'\` + +# If there was a directory component, then change thisdir. +if test \x\$destdir\ != \x\$file\; then + case \\$destdir\ in + [/]* | [A-Za-z]:[/]*) thisdir=\\$destdir\ ;; + *)
[cygwin, libtool] use shell function to emit wrapper scripts and wrapper.exe source [Was: Re: .exe magic]
[Added libtool-patches to CC list. Discussion of this patch should probably drop libtool and cygwin] Ralf Wildenhues wrote: * Charles Wilson wrote on Wed, Apr 18, 2007 at 08:49:31PM CEST: Caveat: over a year after the message referenced above, but libtool2.0 is STILL in code-slush, so the desired fixes will have to wait until after 2.0 ... I'd prefer to see such a patch before deciding when it's good to put it in. Okay, here's the first bit. It's pretty simple. Testing is in progress (and in conjuction with the new argz fix I just posted to libtool-patches), but looks good so far: the new wrapper scripts are identical to old ones generated without this patch. -- Chuck ChangeLog 2007-04-18 Charles Wilson [EMAIL PROTECTED] * libltdl/config/ltmain.m4sh [func_mode_link]: move wrapper script writing from here... [func_emit_libtool_wrapper_script]: to this new function, and write to stdout [func_mode_link]: move cwrapper source code writing from here... [func_emit_libtool_cwrapperexe_source]: to this new function, and write to stdout [func_mode_link]: call the two new functions and redirect to appropriate file. Index: libltdl/config/ltmain.m4sh === RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v retrieving revision 1.72 diff -u -r1.72 ltmain.m4sh --- libltdl/config/ltmain.m4sh 10 Apr 2007 19:09:26 - 1.72 +++ libltdl/config/ltmain.m4sh 19 Apr 2007 01:05:30 - @@ -1202,6 +1202,555 @@ } } +# func_emit_libtool_wrapper_script +# emit a libtool wrapper script on stdout +# don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variable +# set therein. +func_emit_libtool_wrapper_script () +{ + $ECHO \ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \\${ZSH_VERSION+set}\ (emulate sh) /dev/null 21; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\[EMAIL PROTECTED]}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\[EMAIL PROTECTED]}'='\[EMAIL PROTECTED]' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) /dev/null 21 unset CDPATH + +relink_command=\$relink_command\ + +# This environment variable determines our operation mode. +if test \\$libtool_install_magic\ = \$magic\; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \\$libtool_execute_magic\ != \$magic\; then +ECHO=\$qecho\ +file=\\$0\ +# Make sure echo works. +if test \X\$1\ = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test \X\`{ \$ECHO '\t'; } 2/dev/null\`\ = 'X\t'; then + # Yippee, \$ECHO works! + : +else + # Restart under the correct shell, and then maybe \$ECHO will work. + exec $SHELL \\$0\ --no-reexec \${1+\[EMAIL PROTECTED]} +fi + fi\ + + $ECHO \ + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \X\$file\ | \$Xsed -e 's%/[^/]*$%%'\` + test \x\$thisdir\ = \x\$file\ thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \\$file\ | ${SED} -n 's/.*- //p'\` + while test -n \\$file\; do +destdir=\`\$ECHO \X\$file\ | \$Xsed -e 's%/[^/]*\$%%'\` + +# If there was a directory component, then change thisdir. +if test \x\$destdir\ != \x\$file\; then + case \\$destdir\ in + [/]* | [A-Za-z]:[/]*) thisdir=\\$destdir\ ;; + *) thisdir=\\$thisdir/\$destdir\ ;; + esac +fi + +file=\`\$ECHO \X\$file\ | \$Xsed -e 's%^.*/%%'\` +file=\`ls -ld \\$thisdir/\$file\ | ${SED} -n 's/.*- //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \\$thisdir\ pwd\` + test -n \\$absdir\ thisdir=\\$absdir\ + + + if test $fast_install = yes; then +
Re: [cygwin, libtool] use shell function to emit wrapper scripts and wrapper.exe source [Was: Re: .exe magic]
Charles Wilson wrote: Okay, here's the first bit. It's pretty simple. Testing is in progress (and in conjuction with the new argz fix I just posted to libtool-patches), but looks good so far: the new wrapper scripts are identical to old ones generated without this patch. Test results -- old tests: == All 115 tests passed (9 tests were not run) --- gcc-3.4.5 doesn't supply gfortran, only g77. == Test results -- new tests. Unexpected failures: 14: Java convenience archives FAILED (convenience.at:273) 16: Link order of deplibs. FAILED (link-order2.at:129) 49: Run tests with low max_cmd_len FAILED (cmdline_wrap.at:42) are actually not unexpected on cygwin. And certainly have nothing to do with this patch. Actually, I think this is may be the best test conformance I've ever seen on cygwin... -- Chuck