Mercurial > hg > octave-nkf > gnulib-hg
comparison gnulib-tool @ 5684:0aebab2c04d4
* gnulib-tool: Only replace files via --import when they have
actually changed.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Fri, 04 Mar 2005 19:28:13 +0000 |
parents | 54000928a33d |
children | 18b4bb3dea47 |
comparison
equal
deleted
inserted
replaced
5683:d0a22d17762b | 5684:0aebab2c04d4 |
---|---|
20 # This program is meant for authors or maintainers which want to import | 20 # This program is meant for authors or maintainers which want to import |
21 # modules from gnulib into their packages. | 21 # modules from gnulib into their packages. |
22 | 22 |
23 progname=$0 | 23 progname=$0 |
24 package=gnulib | 24 package=gnulib |
25 cvsdatestamp='$Date: 2005-01-05 02:50:04 $' | 25 cvsdatestamp='$Date: 2005-03-04 19:28:13 $' |
26 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'` | 26 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'` |
27 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'` | 27 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'` |
28 | 28 |
29 # You can set AUTOCONFPATH to empty if autoconf 2.57 is already in your PATH. | 29 # You can set AUTOCONFPATH to empty if autoconf 2.57 is already in your PATH. |
30 AUTOCONFPATH= | 30 AUTOCONFPATH= |
113 func_fatal_error () | 113 func_fatal_error () |
114 { | 114 { |
115 echo "gnulib-tool: *** $1" 1>&2 | 115 echo "gnulib-tool: *** $1" 1>&2 |
116 echo "gnulib-tool: *** Stop." 1>&2 | 116 echo "gnulib-tool: *** Stop." 1>&2 |
117 exit 1 | 117 exit 1 |
118 } | |
119 | |
120 # func_cp_if_changed SRC DEST | |
121 # | |
122 # cp, but avoid munging timestamps if the file hasn't changed. | |
123 func_cp_if_changed () | |
124 { | |
125 if test $# -ne 2; then | |
126 echo "usage: cp_if_changed SRC DEST" >&2 | |
127 fi | |
128 test -n "$dry_run" && dry=echo | |
129 if cmp "$1" "$2" >/dev/null 2>&1; then :; else | |
130 $dry cp -p "$1" "$2" | |
131 fi | |
132 } | |
133 | |
134 # func_mv_if_changed SRC DEST | |
135 # | |
136 # mv, but avoid munging timestamps if the file hasn't changed. | |
137 # Remove the source file if it is not renamed. | |
138 func_mv_if_changed () | |
139 { | |
140 if test $# -ne 2; then | |
141 echo "usage: mv_if_changed SRC DEST" >&2 | |
142 fi | |
143 test -n "$dry_run" && dry=echo | |
144 if cmp "$1" "$2" >/dev/null 2>&1; then | |
145 $dry rm "$1" | |
146 else | |
147 $dry mv "$1" "$2" | |
148 fi | |
118 } | 149 } |
119 | 150 |
120 # Command-line option processing. | 151 # Command-line option processing. |
121 # Removes the OPTIONS from the arguments. Sets the variables: | 152 # Removes the OPTIONS from the arguments. Sets the variables: |
122 # - mode list or import or create-testdir or create-megatestdir | 153 # - mode list or import or create-testdir or create-megatestdir |
521 config/*) g=`echo "$f" | sed -e 's,^config/,,'` ;; | 552 config/*) g=`echo "$f" | sed -e 's,^config/,,'` ;; |
522 lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"`; source=true ;; | 553 lib/*) g=`echo "$f" | sed -e "s,^lib/,$sourcebase/,"`; source=true ;; |
523 m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;; | 554 m4/*) g=`echo "$f" | sed -e "s,^m4/,$m4base/,"` ;; |
524 *) g="$f" ;; | 555 *) g="$f" ;; |
525 esac | 556 esac |
526 test -n "$dry_run" && dry=echo | 557 func_cp_if_changed "$gnulib_dir/$f" "$destdir/$g" |
527 $dry cp -p "$gnulib_dir/$f" "$destdir/$g" | |
528 # Update license. | 558 # Update license. |
529 if test -z "$dry_run" && test -n "$lgpl" && test -n "$source"; then | 559 if test -z "$dry_run" && test -n "$lgpl" && test -n "$source"; then |
530 perl -pi -e 's/GNU General/GNU Lesser General/g;' \ | 560 perl -pi -e 's/GNU General/GNU Lesser General/g;' \ |
531 -e 's/version 2([ ,])/version 2.1\1/g' \ | 561 -e 's/version 2([ ,])/version 2.1\1/g' \ |
532 $destdir/$g | 562 $destdir/$g |
546 actioncmd="gnulib-tool --import --dir=$destdir --lib=$libname --source-base=$sourcebase --m4-base=$m4base $opt_libtool $opt_lgpl `echo $modules`" | 576 actioncmd="gnulib-tool --import --dir=$destdir --lib=$libname --source-base=$sourcebase --m4-base=$m4base $opt_libtool $opt_lgpl `echo $modules`" |
547 | 577 |
548 # Create lib/Makefile.am. | 578 # Create lib/Makefile.am. |
549 echo "Creating $destdir/$sourcebase/Makefile.am..." | 579 echo "Creating $destdir/$sourcebase/Makefile.am..." |
550 if test -z "$dry_run"; then | 580 if test -z "$dry_run"; then |
551 func_emit_lib_Makefile_am > $destdir/$sourcebase/Makefile.am | 581 func_emit_lib_Makefile_am > $destdir/$sourcebase/Makefile.am.new |
552 else | 582 else |
553 func_emit_lib_Makefile_am | 583 func_emit_lib_Makefile_am |
554 fi | 584 fi |
585 func_mv_if_changed $destdir/$sourcebase/Makefile.am.new \ | |
586 $destdir/$sourcebase/Makefile.am | |
555 | 587 |
556 # Create gnulib.m4. | 588 # Create gnulib.m4. |
557 echo "Creating $destdir/$m4base/gnulib.m4..." | 589 echo "Creating $destdir/$m4base/gnulib.m4..." |
558 ( | 590 ( |
559 if test -z "$dry_run"; then | 591 if test -z "$dry_run"; then |
560 exec > $destdir/$m4base/gnulib.m4 | 592 exec > $destdir/$m4base/gnulib.m4.new |
561 else | 593 else |
562 echo "# $destdir/$m4base/gnulib.m4" | 594 echo "# $destdir/$m4base/gnulib.m4" |
563 fi | 595 fi |
564 echo "# Copyright (C) 2004 Free Software Foundation, Inc." | 596 echo "# Copyright (C) 2004 Free Software Foundation, Inc." |
565 echo "# This file is free software, distributed under the terms of the GNU" | 597 echo "# This file is free software, distributed under the terms of the GNU" |
614 echo "dnl Usage: gl_LGPL" | 646 echo "dnl Usage: gl_LGPL" |
615 echo "AC_DEFUN([gl_LGPL], [])" | 647 echo "AC_DEFUN([gl_LGPL], [])" |
616 echo | 648 echo |
617 echo "# gnulib.m4 ends here" | 649 echo "# gnulib.m4 ends here" |
618 ) | 650 ) |
651 func_mv_if_changed $destdir/$m4base/gnulib.m4.new $destdir/$m4base/gnulib.m4 | |
619 echo "Finished." | 652 echo "Finished." |
620 echo | 653 echo |
621 echo "You may need to add #include directives for the following .h files." | 654 echo "You may need to add #include directives for the following .h files." |
622 for module in $modules; do | 655 for module in $modules; do |
623 func_get_include_directive "$module" | sed -e '/^$/d;' -e 's/^/ /' | 656 func_get_include_directive "$module" | sed -e '/^$/d;' -e 's/^/ /' |