Bruno Haible <[EMAIL PROTECTED]> writes:
> Would you mind adding a --copy option to the bootstrap script? Roughly
> like this?
Good suggestion, yes. I installed the following somewhat-different
patch, which is a bit more cautious about switching between a
bootstrap with and without --copy. Also, it uses "cp -p", which
more-closely approximates the symlink and gives builders a better idea
of when the source file actually changed.
2006-10-09 Paul Eggert <[EMAIL PROTECTED]>
* bootstrap (usage, main program, symlink_to_gnulib): Add option
--copy. Inspired by a suggestion from Bruno Haible.
--- bootstrap 2 Oct 2006 11:47:35 -0000 1.19
+++ bootstrap 9 Oct 2006 20:33:11 -0000
@@ -40,6 +40,7 @@
have gnulib sources on your machine, and
do not want to waste your bandwidth dowloading
them again.
+ --copy Copy files instead of creating symbolic links.
--force Bootstrap even if the sources didn't come from CVS.
--skip-po Do not download po files.
--cvs-user=USERNAME Set the CVS username to be used when accessing
@@ -112,6 +113,9 @@
# the distributed version.
CVS_only_file=CVS
+# Whether to use copies instead of symlinks.
+copy=false
+
# Override the default configuration, if necessary.
test -r bootstrap.conf && . ./bootstrap.conf
@@ -133,6 +137,8 @@
SKIP_PO=t;;
--force)
CVS_only_file=;;
+ --copy)
+ copy=true;;
*)
echo >&2 "$0: $option: unknown option"
exit 1;;
@@ -249,29 +255,42 @@
{
src=$GNULIB_SRCDIR/$1
dst=${2-$1}
- dot_dots=
-
- case $src in
- /*) ;;
- *)
- case /$dst/ in
- *//* | */../* | */./* | /*/*/*/*/*/)
- echo >&2 "$0: invalid symlink calculation: $src -> $dst"
- exit 1;;
- /*/*/*/*/) dot_dots=../../../;;
- /*/*/*/) dot_dots=../../;;
- /*/*/) dot_dots=../;;
- esac;;
- esac
test -f "$src" && {
- test -h "$dst" &&
- src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 &&
- dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 &&
- test "$src_i" = "$dst_i" || {
- echo "$0: ln -fs $dot_dots$src $dst" &&
- ln -fs "$dot_dots$src" "$dst"
- }
+ if $copy; then
+ {
+ test ! -h "$dst" || {
+ echo "$0: rm -f $dst" &&
+ rm -f "$dst"
+ }
+ } &&
+ test -f "$dst" &&
+ cmp -s "$src" "$dst" || {
+ echo "$0: cp -fp $src $dst" &&
+ cp -fp "$src" "$dst"
+ }
+ else
+ test -h "$dst" &&
+ src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 &&
+ dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 &&
+ test "$src_i" = "$dst_i" || {
+ case $src in
+ /*) dot_dots=;;
+ *)
+ case /$dst/ in
+ *//* | */../* | */./* | /*/*/*/*/*/)
+ echo >&2 "$0: invalid symlink calculation: $src -> $dst"
+ exit 1;;
+ /*/*/*/*/) dot_dots=../../../;;
+ /*/*/*/) dot_dots=../../;;
+ /*/*/) dot_dots=../;;
+ esac;;
+ esac
+
+ echo "$0: ln -fs $dot_dots$src $dst" &&
+ ln -fs "$dot_dots$src" "$dst"
+ }
+ fi
}
}