libtool-patches
[Top][All Lists]
Advanced

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

patch-6: several changes to libtoolize.m4sh (was: HEAD: patch queue)


From: Ralf Wildenhues
Subject: patch-6: several changes to libtoolize.m4sh (was: HEAD: patch queue)
Date: Sun, 4 Dec 2005 16:58:35 +0100
User-agent: Mutt/1.5.11

* Ralf Wildenhues wrote on Sun, Dec 04, 2005 at 03:56:15PM CET:
>
> - several (dunno how many yet) patches to fix the actual `make dist' 
>   stuff for clients.

This patch is the last of the queue, and the most intertwined.  Maybe I
should make the effort to rip it apart -- please say so.

Several open bugs:

- aclocal.m4 should be copied, even if all other files are symlinked,
  because `aclocal' will otherwise overwrite the target
  (And we should write a bug report against Automake).
  Note that in the symlink-case, this file *must* retain its old time
  stamp, hence `cp -p'.  Maybe we'd need `tar' instead here?
  (Luckily the subsecond problem is not *so* much of an issue here:
  `cd libltdl && aclocal' still takes a second on a fast machine --
  maybe we should put a `sleep 1' into the manual rule even?)

- in case of `libtoolize --copy', it would actually be wise to have the
  copied files have *current* time stamps, so that its dependents will
  be rebuilt.  Bob and I noted this some time ago.
  This patch does `cp -p' and a subsequent `touch', to preserve
  permission bits.

- To fix both, quite a few other changes are necessary: the `main' part
  of libtoolize now has to handle all files in the correct order: the
  .m4 files come before the other libltdl files, so that their
  timestamps will stay older.

- As a consequence, libtoolize output changes a bit, and the
  corresponding tests need to be adjusted.

- As a nice side effect, func_copy_cb has some logic errors removed
  (previously, it would not fail for every failure situation).

Now, we still have the issue that `make dist' will fail for recursive
and nonrecursive mode.  In these modes, we will simply now always copy
Makefile.am or Makefile.inc, respectively.  Since we've already had
func_fixup_Makefile_inc for the latter, we just generalize that to also
cope with the former (in recursive mode only!).

The additional functionality of func_fixup_Makefile is that it removes
the non-existent files from the EXTRA_DIST lines of the file.

As a final bit, we default $tst_dist to `dist' now -- should work. :)

OK to apply?

Cheers,
Ralf

        * libtoolize.m4sh (func_copy_cb):
        If `$opt_link', still copy `aclocal.m4', so a subsequent
        `aclocal' will not overwrite the symlink target.
        In `--copy' mode, do `cp -p' and `touch' for each file, so
        timestamps are updated but permissions preserved.
        (main): Reorder installing of files to match logical order
        and timestamp requirements.
        (func_fixup_Makefile_inc): Renamed to
        (func_fixup_Makefile): this.  Add sed scriptlet to remove
        non-existent files from EXTRA_DIST, for either nonrecursive
        or recursive mode.
        (main): call it to mangle also in recursive mode.
        * tests/libtoolize.at (expout): Adjusted.
        * tests/testsuite.at (tst_dist): Default to `dist'.



--- libtoolize.m4sh     2005-12-04 15:42:49.000000000 +0100
+++ libtoolize.m4sh     2005-12-04 15:49:43.000000000 +0100
@@ -248,17 +248,26 @@
     func_mkdir_p `$ECHO "X$my_destdir/$my_file" | $Xsed -e "$dirname"`
 
     $RM "$my_destdir/$my_file"
-    if $opt_link && $LN_S "$my_srcdir/$my_file" "$my_destdir/$my_file"; then
-      $opt_quiet || func_echo "linking $my_copy_msg"
-      copy_return_status=0
-    elif { ( cd "$my_srcdir" 2>/dev/null && $TAR chf - "$my_file" 2>/dev/null; 
) \
-        | ( umask 0 && cd "$my_destdir" 2>/dev/null && "$TAR" xf - >/dev/null 
2>&1; ); } ; then
-      $opt_quiet || func_echo "copying $my_copy_msg"
-      copy_return_status=0
-    elif $CP -p "$my_srcdir/$my_file" "$my_destdir/$my_file"; then
-      $opt_quiet || func_echo "copying $my_copy_msg"
-      copy_return_status=0
+    if $opt_link; then
+      if test "$my_file" = "aclocal.m4"; then
+       if $CP -p "$my_srcdir/$my_file" "$my_destdir/$my_file"; then
+         $opt_quiet || func_echo "copying $my_copy_msg"
+         copy_return_status=0
+       fi
+      else
+       if $LN_S "$my_srcdir/$my_file" "$my_destdir/$my_file"; then
+         $opt_quiet || func_echo "linking $my_copy_msg"
+         copy_return_status=0
+       fi
+      fi
     else
+      if $CP -p "$my_srcdir/$my_file" "$my_destdir/$my_file" &&
+        touch "$my_destdir/$my_file"; then
+       $opt_quiet || func_echo "copying $my_copy_msg"
+       copy_return_status=0
+      fi
+    fi
+    if test "$copy_return_status" != 0; then
       func_error "can not copy \`$my_srcdir/$my_file' to \`$my_destdir/'"
       exit_status=$EXIT_FAILURE
     fi
@@ -298,28 +308,45 @@
     IFS="$my_save_IFS"
 }
 
-# func_fixup_Makefile_inc srcfile srcdir destdir
-func_fixup_Makefile_inc ()
+# func_fixup_Makefile srcfile srcdir destdir
+func_fixup_Makefile ()
 {
     my_filename="$1"
     my_srcdir="$2"
     my_destdir="$3"
+    my_fixup_non_subpackage_script="\
+      s,libltdl/configure.ac,,
+      s,libltdl/configure,,
+      s,libltdl/aclocal.m4,,
+      s,libltdl/config-h.in,,
+      s,libltdl/Makefile.am,,
+      s,libltdl/Makefile.in,,"
+    case $my_filename in
+      Makefile.am)
+       my_fixup_non_subpackage_script=`echo "$my_fixup_non_subpackage_script" 
| \
+               sed 's,libltdl/,,'`
+       my_fixup_inc_paths_script= ;;
+      Makefile.inc)
+       repl=$ltdldir
+       repl_uscore=`$ECHO "X$repl" | $Xsed -e 's,[[/.+-]],_,g'`
+       my_fixup_inc_paths_script="\
+         s,libltdl_,@address@hidden,
+         s,libltdl/,@repl@/,
+         s,: libltdl/,: @repl@/,
+         s,\\\$(libltdl_,\$(@address@hidden,
+         s,)/libltdl ,)/@repl@ ,
+         s,@repl_uscore@,${repl_uscore},g
+         s,@repl@,${repl},g"
+       ;;
+    esac
 
-    repl=$ltdldir
-    repl_uscore=`$ECHO "X$repl" | $Xsed -e 's,[[/.+-]],_,g'`
     $RM "$my_destdir/$my_filename" 2>/dev/null
     $opt_quiet || func_echo "creating file \`$my_destdir/$my_filename'"
     if $opt_dry_run; then :;
     else
-      $SED "\
-       s,libltdl_,@address@hidden,
-       s,libltdl/,@repl@/,
-       s,: libltdl/,: @repl@/,
-       s,\\\$(libltdl_,\$(@address@hidden,
-       s,)/libltdl ,)/@repl@ ,
-       s,@repl_uscore@,${repl_uscore},g
-       s,@repl@,${repl},g
-       "  < "$my_srcdir/$my_filename" > "$my_destdir/$my_filename" ||
+      $SED "$my_fixup_non_subpackage_script
+           $my_fixup_inc_paths_script" \
+       < "$my_srcdir/$my_filename" > "$my_destdir/$my_filename" ||
        func_fatal_error "cannot create $my_destdir/$my_filename"
     fi
 }
@@ -1003,48 +1030,6 @@
 
   func_scan_files
 
-  # These files are handled specially, depending on ltdl_mode:
-  case $ltdl_mode in
-    *recursive)
-      glob_exclude_pkgltdl_files='Makefile.am|Makefile.in*|aclocal.m4|config*'
-      ;;
-    *)
-      glob_exclude_pkgltdl_files='Makefile.inc'
-      ;;
-  esac
-
-  func_massage_pkgltdl_files "$glob_exclude_pkgltdl_files"
-  func_massage_pkgconfig_files
-
-  # libtool.m4 and ltdl.m4 are handled specially below
-  func_massage_aclocal_DATA 'libtool.m4|ltdl.m4'
-
-  # Copy all the files from installed libltdl to this project, if the
-  # user specified `--ltdl'.
-  if $opt_ltdl; then
-
-    # For recursive ltdl modes, copy a suitable Makefile.{am,inc}:
-    case $ltdl_mode in
-      recursive)    pkgltdl_files="Makefile.am:$pkgltdl_files"  ;;
-    esac
-
-    func_copy_some_files "$pkgltdl_files" "$pkgltdldir/libltdl" "$ltdldir"
-
-    case $ltdl_mode in
-      nonrecursive) func_fixup_Makefile_inc "Makefile.inc" 
"$pkgltdldir/libltdl" "$ltdldir" ;;
-    esac
-
-    # Unless we share CONFIG_MACRO_DIR with our parent project,
-    # copy macros here.
-    if test "$ltdldir/m4" != "$m4dir"; then
-      func_copy_some_files "$pkgmacro_files:libtool.m4:ltdl.m4" \
-        "$aclocaldir" "$ltdldir/m4"
-    fi
-
-    # Copy config aux files into libltdl.
-    func_copy_some_files "$pkgconfig_files" "$pkgdatadir" "$ltdldir"
-  fi
-
   # Unless we share CONFIG_AUX_DIR with the libltdl subproject, then
   # if they are newer, copy all the installed utility files to the
   # auxiliary directory if `--install' was passed, or else copy just
@@ -1065,6 +1050,9 @@
     func_verbose "AC_CONFIG_AUX_DIR not defined, not copying libtool auxiliary 
files."
   fi
 
+  # libtool.m4 and ltdl.m4 were handled specially above
+  func_massage_aclocal_DATA 'libtool.m4|ltdl.m4'
+
   # Copy libtool's m4 macros to the macro directory, if they are newer.
   if test -n "$m4dir"; then
     $opt_quiet || func_echo "putting macros in AC_CONFIG_MACRO_DIR, \`$m4dir'."
@@ -1087,6 +1075,42 @@
     IFS="$my_save_IFS"
   fi
 
+  # These files are handled specially, depending on ltdl_mode:
+  case $ltdl_mode in
+    *recursive)
+      glob_exclude_pkgltdl_files='Makefile.am|Makefile.in*|aclocal.m4|config*'
+      ;;
+    *)
+      glob_exclude_pkgltdl_files='Makefile.inc'
+      ;;
+  esac
+
+  func_massage_pkgltdl_files "$glob_exclude_pkgltdl_files"
+  func_massage_pkgconfig_files
+
+  # Copy all the files from installed libltdl to this project, if the
+  # user specified `--ltdl'.
+  if $opt_ltdl; then
+
+    # Unless we share CONFIG_MACRO_DIR with our parent project,
+    # copy macros here.
+    if test "$ltdldir/m4" != "$m4dir"; then
+      func_copy_some_files "$pkgmacro_files:libtool.m4:ltdl.m4" \
+        "$aclocaldir" "$ltdldir/m4"
+    fi
+
+    func_copy_some_files "$pkgltdl_files" "$pkgltdldir/libltdl" "$ltdldir"
+
+    # For recursive ltdl modes, copy a suitable Makefile.{am,inc}:
+    case $ltdl_mode in
+      recursive)    func_fixup_Makefile "Makefile.am" "$pkgltdldir/libltdl" 
"$ltdldir" ;;
+      nonrecursive) func_fixup_Makefile "Makefile.inc" "$pkgltdldir/libltdl" 
"$ltdldir" ;;
+    esac
+
+    # Copy config aux files into libltdl.
+    func_copy_some_files "$pkgconfig_files" "$pkgdatadir" "$ltdldir"
+  fi
+
   $opt_quiet || func_check_macros
 }
 
--- tests/libtoolize.at 2005-11-20 11:33:27.000000000 +0100
+++ tests/libtoolize.at 2005-12-04 11:31:22.000000000 +0100
@@ -308,11 +308,19 @@
 ]])
 
 AT_DATA(expout,
-[[libtoolize: linking file `ltdl/COPYING.LIB'
+[[libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `ltdl/m4'.
+libtoolize: linking file `ltdl/m4/libtool.m4'
+libtoolize: linking file `ltdl/m4/ltdl.m4'
+libtoolize: linking file `ltdl/m4/argz.m4'
+libtoolize: linking file `ltdl/m4/ltoptions.m4'
+libtoolize: linking file `ltdl/m4/ltsugar.m4'
+libtoolize: linking file `ltdl/m4/ltversion.m4'
+libtoolize: linking file `ltdl/m4/lt~obsolete.m4'
+libtoolize: linking file `ltdl/COPYING.LIB'
 libtoolize: linking file `ltdl/README'
 libtoolize: linking file `ltdl/Makefile.am'
 libtoolize: linking file `ltdl/configure.ac'
-libtoolize: linking file `ltdl/aclocal.m4'
+libtoolize: copying file `ltdl/aclocal.m4'
 libtoolize: linking file `ltdl/Makefile.in'
 libtoolize: linking file `ltdl/config-h.in'
 libtoolize: linking file `ltdl/configure'
@@ -349,14 +357,6 @@
 libtoolize: linking file `ltdl/config/install-sh'
 libtoolize: linking file `ltdl/config/missing'
 libtoolize: linking file `ltdl/config/ltmain.sh'
-libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `ltdl/m4'.
-libtoolize: linking file `ltdl/m4/libtool.m4'
-libtoolize: linking file `ltdl/m4/ltdl.m4'
-libtoolize: linking file `ltdl/m4/argz.m4'
-libtoolize: linking file `ltdl/m4/ltoptions.m4'
-libtoolize: linking file `ltdl/m4/ltsugar.m4'
-libtoolize: linking file `ltdl/m4/ltversion.m4'
-libtoolize: linking file `ltdl/m4/lt~obsolete.m4'
 ]])
 
 LT_AT_CHECK_LIBTOOLIZE([--ltdl], 0, expout)
--- tests/testsuite.at  2005-12-04 16:06:54.000000000 +0100
+++ tests/testsuite.at  2005-12-04 13:38:07.000000000 +0100
@@ -19,7 +19,7 @@
 # 02110-1301, USA.
 
 m4_divert_push([PREPARE_TESTS])dnl
-: ${tst_dist=""}
+: ${tst_dist=dist}
 : ${ACLOCAL=aclocal}
 : ${AUTOHEADER=autoheader}
 : ${AUTOCONF=autoconf}




reply via email to

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