progname=$0
package=gnulib
-cvsdatestamp='$Date: 2007-03-12 00:48:31 $'
+cvsdatestamp='$Date: 2007-05-28 15:46:55 $'
last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
nl='
-e '/^COPYING$/d' -e '/\/COPYING$/d' \
-e '/^README$/d' -e '/\/README$/d' \
-e '/^TEMPLATE$/d' \
+ -e '/^TEMPLATE-EXTENDED$/d' \
-e '/^TEMPLATE-TESTS$/d' \
-e '/^\..*/d' \
-e '/~$/d' \
&& test "COPYING" != "$module" \
&& test "README" != "$module" \
&& test "TEMPLATE" != "$module" \
+ && test "TEMPLATE-EXTENDED" != "$module" \
&& test "TEMPLATE-TESTS" != "$module"; then
# OK, $module is a correct module name.
# Verify that building the module description with 'patch' succeeds.
done
# Add the dummy module, to make sure the library will be non-empty.
if test -z "$have_lib_SOURCES"; then
- func_append modules " dummy"
+ if func_acceptable "dummy"; then
+ func_append modules " dummy"
+ fi
fi
}
cached_m4base=
cached_docbase=
cached_testsbase=
+ cached_inctests=
cached_libname=
cached_lgpl=
cached_makefile_name=
/gl_TESTS_BASE(/ {
s,^.*gl_TESTS_BASE([[ ]*\([^])]*\).*$,cached_testsbase="\1",p
}
+ /gl_WITH_TESTS/ {
+ s,^.*$,cached_inctests=true,p
+ }
/gl_LIB(/ {
s,^.*gl_LIB([[ ]*\([^])]*\).*$,cached_libname="\1",p
}
func_fatal_error "missing --tests-base option"
fi
fi
+ # Require the tests if specified either way.
+ if test -z "$inctests"; then
+ inctests="$cached_inctests"
+ fi
# The libname defaults to the cached one.
if test -z "$supplied_libname"; then
libname="$cached_libname"
}
# Copy files or make symbolic links. Remove obsolete files.
+ added_files=''
+ removed_files=''
delimiter=' '
# Construct a table with 2 columns: rewritten-file-name original-file-name,
# representing the files according to the last gnulib-tool invocation.
else
echo "Remove file $g (backup in ${g}~)"
fi
+ func_append removed_files "$g$nl"
fi
done
# func_add_or_update handles a file that ought to be present afterwards.
else
echo "Copy file $g"
fi
+ func_append added_files "$g$nl"
fi
rm -f "$tmpfile"
}
func_append actioncmd " --m4-base=$m4base"
func_append actioncmd " --doc-base=$docbase"
func_append actioncmd " --aux-dir=$auxdir"
+ if test -n "$inctests"; then
+ func_append actioncmd " --with-tests"
+ fi
for module in $avoidlist; do
func_append actioncmd " --avoid=$module"
done
echo "Create $sourcebase/$makefile_am"
rm -f "$tmpfile"
fi
+ func_append added_files "$sourcebase/$makefile_am$nl"
fi
# Create m4/gnulib-cache.m4.
echo "gl_M4_BASE([$m4base])"
echo "gl_DOC_BASE([$docbase])"
echo "gl_TESTS_BASE([$testsbase])"
+ test -z "$inctests" || echo "gl_WITH_TESTS"
echo "gl_LIB([$libname])"
test -z "$lgpl" || echo "gl_LGPL"
echo "gl_MAKEFILE_NAME([$makefile_name])"
echo "Create $testsbase/$makefile_am"
rm -f "$tmpfile"
fi
+ func_append added_files "$testsbase/$makefile_am$nl"
fi
fi
+ # Update the .cvsignore and .gitignore files.
+ { echo "$added_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,'
+ echo "$removed_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,'
+ } | LC_ALL=C sort -t'|' -k1,1 > "$tmp"/fileset-changes
+ { # Rearrange file descriptors. Needed because "while ... done < ..."
+ # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh.
+ exec 5<&0 < "$tmp"/fileset-changes
+ func_update_ignorelist ()
+ {
+ ignore="$1"
+ if test -f "$destdir/$dir$ignore"; then
+ if test -n "$dir_added" || test -n "$dir_removed"; then
+ LC_ALL=C sort "$destdir/$dir$ignore" > "$tmp"/ignore
+ echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u \
+ | LC_ALL=C join -v 2 "$tmp"/ignore - > "$tmp"/ignore-added
+ echo "$dir_removed" | sed -e '/^$/d' | LC_ALL=C sort -u \
+ | LC_ALL=C join -v 2 "$tmp"/ignore - > "$tmp"/ignore-removed
+ if test -s "$tmp"/ignore-added || test -s "$tmp"/ignore-removed; then
+ if $doit; then
+ echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
+ mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
+ sed -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed > "$tmp"/sed-ignore-removed
+ cat "$destdir/$dir$ignore"~ "$tmp"/ignore-added \
+ | sed -f "$tmp"/sed-ignore-removed \
+ > "$destdir/$dir$ignore"
+ else
+ echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
+ fi
+ fi
+ fi
+ else
+ if test -n "$dir_added"; then
+ if $doit; then
+ echo "Creating $destdir/$dir$ignore"
+ echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u > "$destdir/$dir$ignore"
+ else
+ echo "Create $destdir/$dir$ignore"
+ fi
+ fi
+ fi
+ }
+ func_done_dir ()
+ {
+ dir="$1"
+ dir_added="$2"
+ dir_removed="$3"
+ if test -d "$destdir/${dir}CVS" || test -f "$destdir/${dir}.cvsignore"; then
+ func_update_ignorelist .cvsignore
+ fi
+ if test -d "$destdir/.git" || test -f "$destdir/${dir}.gitignore"; then
+ func_update_ignorelist .gitignore
+ fi
+ }
+ last_dir=
+ last_dir_added=
+ last_dir_removed=
+ while read line; do
+ # Why not ''read next_dir op file'' ? Because the dir column can be empty.
+ next_dir=`echo "$line" | sed -e 's,|.*,,'`
+ op=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'`
+ file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'`
+ if test "$next_dir" != "$last_dir"; then
+ func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed"
+ last_dir="$next_dir"
+ last_dir_added=
+ last_dir_removed=
+ fi
+ case $op in
+ A) func_append last_dir_added "$file$nl";;
+ R) func_append last_dir_removed "$file$nl";;
+ esac
+ done
+ func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed"
+ exec 0<&5 5<&-
+ }
+
echo "Finished."
echo
echo "You may need to add #include directives for the following .h files."
# distributed (such as getdate.c).
# Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
cleaned_files=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
- | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
+ | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'`
cleaned_files=`for file in $cleaned_files; do echo " $file "; done`
# Extract the value of "BUILT_SOURCES += ...". Remove variable references
# such $(FOO_H) because they don't refer to distributed files.
sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
built_sources=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \
- | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
+ | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \
| sed -e "$sed_remove_make_variables"`
distributed_built_sources=`for file in $built_sources; do
case "$cleaned_files" in
echo " echo rc=\$?"
echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule"
echo "done"
- ) > "$megatestdir/autobuild"
- chmod a+x "$megatestdir/autobuild"
+ ) > "$megatestdir/do-autobuild"
+ chmod a+x "$megatestdir/do-autobuild"
# Create Makefile.am.
(echo "## Process this file with automake to produce Makefile.in."
echo
echo "SUBDIRS = $megasubdirs"
echo
- echo "EXTRA_DIST = autobuild"
+ echo "EXTRA_DIST = do-autobuild"
) > "$megatestdir/Makefile.am"
# Create configure.ac.
# Perform func_import in a subshell, so that variable values
# such as
# local_gnulib_dir, avoidlist, sourcebase, m4base, docbase,
- # testsbase, libname, lgpl, makefile_name, libtool, macro_prefix
+ # testsbase, inctests, libname, lgpl, makefile_name, libtool,
+ # macro_prefix
# don't propagate from one directory to another.
(func_import) || func_exit 1
done