libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] fix nits in recent cwrapper patch


From: Charles Wilson
Subject: [patch] fix nits in recent cwrapper patch
Date: Fri, 08 Jun 2007 13:11:17 -0400
User-agent: Thunderbird 1.5.0.12 (Windows/20070509)

Hopefully the attached addresses all of the concerns mentions by Noah, Erick, and Peter with regards to my recent cwrapper-emits-shwrapper patch.

Tested on cygwin, mingw, and linux with no regressions from http://lists.gnu.org/archive/html/libtool-patches/2007-04/msg00088.html although, as expected, the new lt_dlopenadvise test fails on both cygwin and mingw.


Recapping those test results (and some test numbers have changed)

___________________________________________________________
cygwin
======================
All 115 tests passed
(9 tests were not run)
======================
 14: Java convenience archives       FAILED (convenience.at:273)
 16: Link order of deplibs.          FAILED (link-order2.at:129)
 32: lt_dlopenadvise library loading FAILED (lt_dladvise.at:316)
 54: Run tests with low max_cmd_len  FAILED (cmdline_wrap.at:43)
This is the expected output, for now.

___________________________________________________________
mingw
======================
All 115 tests passed
(9 tests were not run)
======================
 14: Java convenience archives       FAILED (convenience.at:273)
 16: Link order of deplibs.          FAILED (link-order2.at:129)
 26: DESTDIR with in-package deplibs FAILED (destdir.at:131)
 32: lt_dlopenadvise library loading FAILED (lt_dladvise.at:314)
 35: installable libltdl             FAILED (standalone.at:69)
 39: installable libltdl             FAILED (subproject.at:99)
 43: installable libltdl             FAILED (nonrecursive.at:143)
 46: installable libltdl             FAILED (recursive.at:113)
 54: Run tests with low max_cmd_len  FAILED (cmdline_wrap.at:43)

14/16/51 are the same as cygwin.
32 expected on win32
35/39/43/46 appear to be due to msys trying to execute "INSTALL" as if it were install.exe.
Not sure about 26.

None of these errors represent regressions on this platform.

___________________________________________________________
Linux
====================
All 106 tests passed
====================
52 tests behaved as expected.
2 tests were skipped.


___________________________________________________________
Changelog:

2007-06-08  Charles Wilson  <...>

        * ltmain.m4sh (func_emit_libtool_wrapper_script):
        take an argument to specify value assigned to
        WRAPPER_SCRIPT_BELONGS_IN_OBJDIR in the emitted
        script.
        (func_emit_libtool_cwrapperexe_source) [file scope]:
        define permission flags S_IXGRP and S_IXOTH if not
        already defined.
        (func_emit_libtool_cwrapperexe_source) [LTWRAPPER_DEBUGPRINTF]:
        declare as a function, not a macro, as variadic macros
        are not supported by C89.
        (func_emit_libtool_cwrapperexe_source) [check_executable]:
        avoid embedded #ifdefs; use S_IXGRP and S_IXOTH
        unconditionally.
        (func_emit_libtool_cwrapperexe_source) [make_executable]:
        ditto.
        (func_emit_libtool_cwrapperexe_source): don't rewrite
        WRAPPER_SCRIPT_BELONGS_IN_OBJDIR posthoc; instead pass
        correct argument when calling func_emit_libtool_wrapper_script.
        (func_mode_link): pass correct argument when calling
        func_emit_libtool_wrapper_script.

--
Chuck

Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.78
diff -u -r1.78 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  7 Jun 2007 08:50:17 -0000       1.78
+++ libltdl/config/ltmain.m4sh  8 Jun 2007 07:16:54 -0000
@@ -2209,15 +2209,27 @@
 test "$mode" = install && func_mode_install ${1+"$@"}
 
 
-# func_emit_libtool_wrapper_script
+# func_emit_libtool_wrapper_script arg
+#
 # 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.
+#
+# arg is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the '.lib' directory.  This is a cygwin/mingw-specific
+# behavior.
 func_emit_libtool_wrapper_script ()
 {
+       func_emit_libtool_wrapper_script_arg1=no
+       if test -n "$1" ; then
+         func_emit_libtool_wrapper_script_arg1=$1
+       fi
+         
        $ECHO "\
 #! $SHELL
 
@@ -2301,8 +2313,9 @@
     file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
   done
 
-  # cygwin/mingw cwrapper will rewrite this line:
-  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
+  # Usually 'no', except on cygwin/mingw when embedded into 
+  # the cwrapper.
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_libtool_wrapper_script_arg1
   if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
     # special case for '.'
     if test \"\$thisdir\" = \".\"; then
@@ -2463,6 +2476,13 @@
 # define LT_PATHMAX 1024
 #endif
 
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
 #ifndef DIR_SEPARATOR
 # define DIR_SEPARATOR '/'
 # define PATH_SEPARATOR ':'
@@ -2497,12 +2517,15 @@
   if (stale) { free ((void *) stale); stale = 0; } \
 } while (0)
 
-#undef LTWRAPPER_DEBUGPRINTF
+void LTWRAPPER_DEBUGPRINTF(const char* fmt, ...)
+{
 #if defined DEBUGWRAPPER
-# define LTWRAPPER_DEBUGPRINTF(format, ...) fprintf(stderr, format, 
__VA_ARGS__)
-#else
-# define LTWRAPPER_DEBUGPRINTF(format, ...)
+    va_list args;
+    va_start (args, fmt);
+    (void) vfprintf (stderr, fmt, args);
+    va_end(args);
 #endif
+}
 
 const char *program_name = NULL;
 
@@ -2519,9 +2542,8 @@
 static const char *script_text = 
 EOF
 
-           func_emit_libtool_wrapper_script |
+           func_emit_libtool_wrapper_script yes |
                $SED -e 's/\([\\"]\)/\\\1/g' \
-                    -e 's/\(WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\)=.*/\1=yes/' \
                     -e 's/^/  "/' -e 's/$/\\n"/' 
            echo ";"
 
@@ -2720,13 +2742,8 @@
     return 0;
 
   if ((stat (path, &st) >= 0) && (
-                                  /* MinGW & native WIN32 do not support 
S_IXOTH or S_IXGRP */
-#if defined (S_IXOTH)
-                                  ((st.st_mode & S_IXOTH) == S_IXOTH) ||
-#endif
-#if defined (S_IXGRP)
-                                  ((st.st_mode & S_IXGRP) == S_IXGRP) ||
-#endif
+                                  ((S_IXOTH != 0) && ((st.st_mode & S_IXOTH) 
== S_IXOTH)) ||
+                                  ((S_IXGRP != 0) && ((st.st_mode & S_IXGRP) 
== S_IXGRP)) ||
                                   ((st.st_mode & S_IXUSR) == S_IXUSR)))
     return 1;
   else
@@ -2739,16 +2756,6 @@
   int rval = 0;
   struct stat st;
 
-  /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
-  int S_XFLAGS = 
-#if defined (S_IXOTH)
-    S_IXOTH ||
-#endif
-#if defined (S_IXGRP)
-    S_IXGRP ||
-#endif
-    S_IXUSR;
-
   LTWRAPPER_DEBUGPRINTF ("(make_executable)  : %s\n",
                         path ? (*path ? path : "EMPTY!") : "NULL!");
   if ((!path) || (!*path))
@@ -2756,7 +2763,7 @@
 
   if (stat (path, &st) >= 0)
     {
-      rval = chmod (path, st.st_mode | S_XFLAGS);
+      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
     }
   return rval;
 }
@@ -6718,7 +6725,7 @@
        $RM $output
        trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
 
-       func_emit_libtool_wrapper_script > $output
+       func_emit_libtool_wrapper_script no > $output
        chmod +x $output
       }
       exit $EXIT_SUCCESS

reply via email to

[Prev in Thread] Current Thread [Next in Thread]