diff options
author | Gary V. Vaughan <gary@gnu.org> | 2011-12-08 11:54:40 +0700 |
---|---|---|
committer | Gary V. Vaughan <gary@gnu.org> | 2012-10-02 21:02:25 +0700 |
commit | 013c91874e974543d2f58843c1e839ba102d6ee0 (patch) | |
tree | 3be5febe07b14c3bc44f6425fc3736154f6e2b70 /bootstrap | |
parent | 006695fed2e9cd10664c97c69880a82545dde1ef (diff) | |
download | libtool-013c91874e974543d2f58843c1e839ba102d6ee0.tar.gz |
bootstrap: make sure patch is available to bootstrap if necessary.
Make sure we're not lacking any functionality provided by the
incumbent gnulib bootstrap script, and where it's easy to do so
(like it is here), provide better functionality!
* bootstrap (require_patch): Make sure that PATCH expands to the
best `patch' command available on the system, honouring
overrides in the users environment.
(require_patch_buildreq): Automatically add a requirement for a
patch command to buildreq when there are diff files in
$local_gl_dir.
(func_require_buildtools_uptodate): Call require_patch_buildreq
before testing build tool versions.
(func_gnulib_tool_copy_file): Make sure PATCH is set before using
gnulib-tool to copy files.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
Diffstat (limited to 'bootstrap')
-rwxr-xr-x | bootstrap | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -556,6 +556,7 @@ func_gnulib_tool_copy_file () $require_gnulib_path $require_gnulib_tool + $require_patch gnulib_copy_cmd="$gnulib_tool --copy-file" $opt_copy || func_append gnulib_copy_cmd " --symlink" @@ -1080,6 +1081,7 @@ func_require_buildtools_uptodate () $require_automake_buildreq $require_libtoolize_buildreq $require_autopoint_buildreq + $require_patch_buildreq test -n "$buildreq" && { _G_error_hdr= @@ -1613,6 +1615,59 @@ func_gnulib_tool has installed the \`git-version-gen' script." } +# require_patch +# ------------- +# Find patch, according to the PATCH environment variable, or else +# searching the user's PATH. +require_patch=func_require_patch +func_require_patch () +{ + $debug_cmd + + test -n "$PATCH" || { + # Find a patch program, preferring gpatch which is usually better + # than the vendor patch. + func_find_tool PATCH gpatch patch + } + + func_verbose "export PATCH='$PATCH'" + + # Make sure the search result is visible to subshells + export PATCH + + require_patch=: +} + + +# require_patch_buildreq +# ---------------------- +# Automatically add a patch build-requirement if there are diff files +# in $local_gl_dir. +require_patch_buildreq=func_require_patch_buildreq +func_require_patch_buildreq () +{ + $debug_cmd + + # This ensures PATCH is set appropriately by the time + # func_check_versions enforces $buildreq. + $require_patch + + # If patch is not already listed in $buildreq... + printf '%s\n' "$buildreq" |func_grep_q '^[ ]*patch' || { + # The ugly find invocation is necessary to exit with non-zero + # status for old find binaries that don't support -exec fully. + if test ! -d "$local_gl_dir" \ + || find "$local_gl_dir" -name *.diff -exec false {} +; then : + else + func_append buildreq 'patch - http://www.gnu.org/s/patch +' + fi + } + + require_patch_buildreq=: +} + + # require_source_base # ------------------- # Ensure that source_base has a sensible value, extracted from |