| 1 |
#! /bin/sh |
| 2 |
|
| 3 |
# Bootstrap an Autotooled package from checked-out sources. |
| 4 |
# Written by Gary V. Vaughan, 2010 |
| 5 |
# Inspired by a script written by Paul Eggert. |
| 6 |
|
| 7 |
# This is free software. There is NO warranty; not even for |
| 8 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 9 |
# |
| 10 |
# Copyright (C) 2010-2019 Bootstrap Authors |
| 11 |
# |
| 12 |
# This file is dual licensed under the terms of the MIT license |
| 13 |
# <https://opensource.org/license/MIT>, and GPL version 2 or later |
| 14 |
# <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of |
| 15 |
# these licenses when using or redistributing this software or any of |
| 16 |
# the files within it. See the URLs above, or the file `LICENSE` |
| 17 |
# included in the Bootstrap distribution for the full license texts. |
| 18 |
|
| 19 |
# You should place a copy of this script under version control in the |
| 20 |
# top-level directory of your project. The intent is that all |
| 21 |
# customization can be done with a `bootstrap.conf` file also maintained |
| 22 |
# in your version control. |
| 23 |
|
| 24 |
# Please report bugs or propose patches to: |
| 25 |
# <https://github.com/gnulib-modules/bootstrap/issues> |
| 26 |
|
| 27 |
|
| 28 |
## ------ ## |
| 29 |
## Usage. ## |
| 30 |
## ------ ## |
| 31 |
|
| 32 |
# Most GNUish projects do not keep all of the generated Autotool |
| 33 |
# files under version control, but running all of the right tools |
| 34 |
# with the right arguments, in the correct order to regenerate |
| 35 |
# all of those files in readiness for configuration and building |
| 36 |
# can be surprisingly involved! Many projects have a 'bootstrap' |
| 37 |
# script under version control to invoke Autotools and perform |
| 38 |
# other assorted book-keeping with version numbers and the like. |
| 39 |
# |
| 40 |
# This bootstrap script aims to probe the configure.ac and top |
| 41 |
# Makefile.am of your project to automatically determine what |
| 42 |
# the correct ordering and arguments are and then run the tools for |
| 43 |
# you. In order to use it, you can generate an initial standalone |
| 44 |
# script with: |
| 45 |
# |
| 46 |
# gl/build-aux/inline-source gl/build-aux/bootstrap.in > bootstrap |
| 47 |
# |
| 48 |
# You should then store than script in version control for other |
| 49 |
# developers in you project. It will give you instructions about |
| 50 |
# how to keep it up to date if the sources change. |
| 51 |
# |
| 52 |
# See gl/doc/bootstrap.texi for documentation on how to write |
| 53 |
# a bootstrap.conf to customize it for your project's |
| 54 |
# idiosyncracies. |
| 55 |
|
| 56 |
|
| 57 |
## ================================================================== ## |
| 58 |
## ## |
| 59 |
## DO NOT EDIT THIS FILE, CUSTOMIZE IT USING A BOOTSTRAP.CONF ## |
| 60 |
## ## |
| 61 |
## ================================================================== ## |
| 62 |
|
| 63 |
## ------------------------------- ## |
| 64 |
## User overridable command paths. ## |
| 65 |
## ------------------------------- ## |
| 66 |
|
| 67 |
# All uppercase denotes values stored in the environment. These |
| 68 |
# variables should generally be overridden by the user - however, we do |
| 69 |
# set them to 'true' in some parts of this script to prevent them being |
| 70 |
# called at the wrong time by other tools that we call ('autoreconf', |
| 71 |
# for example). |
| 72 |
# |
| 73 |
# We also allow 'LIBTOOLIZE', 'M4', 'SHA1SUM' and some others to be |
| 74 |
# overridden, and export the result for child processes, but they are |
| 75 |
# handled by the function 'func_find_tool' and not defaulted in this |
| 76 |
# section. |
| 77 |
|
| 78 |
: ${ACLOCAL="aclocal"} |
| 79 |
: ${AUTOCONF="autoconf"} |
| 80 |
: ${AUTOHEADER="autoheader"} |
| 81 |
: ${AUTOM4TE="autom4te"} |
| 82 |
: ${AUTOHEADER="autoheader"} |
| 83 |
: ${AUTOMAKE="automake"} |
| 84 |
: ${AUTOPOINT="autopoint"} |
| 85 |
: ${AUTORECONF="autoreconf"} |
| 86 |
: ${CMP="cmp"} |
| 87 |
: ${CONFIG_SHELL="/bin/sh"} |
| 88 |
: ${DIFF="diff"} |
| 89 |
: ${GIT="git"} |
| 90 |
: ${LN_S="ln -s"} |
| 91 |
: ${RM="rm"} |
| 92 |
|
| 93 |
export ACLOCAL |
| 94 |
export AUTOCONF |
| 95 |
export AUTOHEADER |
| 96 |
export AUTOM4TE |
| 97 |
export AUTOHEADER |
| 98 |
export AUTOMAKE |
| 99 |
export AUTOPOINT |
| 100 |
export AUTORECONF |
| 101 |
export CONFIG_SHELL |
| 102 |
|
| 103 |
|
| 104 |
## -------------- ## |
| 105 |
## Configuration. ## |
| 106 |
## -------------- ## |
| 107 |
|
| 108 |
# A newline delimited list of triples of programs (that respond to |
| 109 |
# --version), the minimum version numbers required (or just '-' in the |
| 110 |
# version field if any version will be sufficient) and homepage URLs |
| 111 |
# to help locate missing packages. |
| 112 |
buildreq= |
| 113 |
|
| 114 |
# Name of a file containing instructions on installing missing packages |
| 115 |
# required in 'buildreq'. |
| 116 |
buildreq_readme=README-hacking |
| 117 |
|
| 118 |
# These are extracted from AC_INIT in configure.ac, though you can |
| 119 |
# override those values in 'bootstrap.conf' if you prefer. |
| 120 |
build_aux= |
| 121 |
macro_dir= |
| 122 |
package= |
| 123 |
package_name= |
| 124 |
package_version= |
| 125 |
package_bugreport= |
| 126 |
|
| 127 |
# These are extracted from 'gnulib-cache.m4', or else fall-back |
| 128 |
# automatically on the gnulib defaults; unless you set the values |
| 129 |
# manually in 'bootstrap.conf'. |
| 130 |
doc_base= |
| 131 |
gnulib_mk= |
| 132 |
gnulib_name= |
| 133 |
local_gl_path= |
| 134 |
source_base= |
| 135 |
tests_base= |
| 136 |
|
| 137 |
# The list of gnulib modules required at 'gnulib-tool' time. If you |
| 138 |
# check 'gnulib-cache.m4' into your repository, then this list will be |
| 139 |
# extracted automatically. |
| 140 |
gnulib_modules= |
| 141 |
|
| 142 |
# Extra gnulib files that are not in modules, which override files of |
| 143 |
# the same name installed by other bootstrap tools. |
| 144 |
gnulib_non_module_files=" |
| 145 |
build-aux/compile |
| 146 |
build-aux/install-sh |
| 147 |
build-aux/mdate-sh |
| 148 |
build-aux/texinfo.tex |
| 149 |
build-aux/depcomp |
| 150 |
build-aux/config.guess |
| 151 |
build-aux/config.sub |
| 152 |
doc/INSTALL |
| 153 |
" |
| 154 |
|
| 155 |
# Relative path to the local gnulib submodule, and url to the upstream |
| 156 |
# git repository. If you have a gnulib entry in your .gitmodules file, |
| 157 |
# these values are ignored. |
| 158 |
gnulib_path= |
| 159 |
gnulib_url= |
| 160 |
|
| 161 |
# Date from which to clone github, to avoid a full clone. |
| 162 |
gnulib_clone_since= |
| 163 |
|
| 164 |
# Additional gnulib-tool options to use. |
| 165 |
gnulib_tool_options=" |
| 166 |
--no-changelog |
| 167 |
" |
| 168 |
|
| 169 |
# bootstrap removes any macro-files that are not included by aclocal.m4, |
| 170 |
# except for files listed in this variable that are always kept. |
| 171 |
gnulib_precious=" |
| 172 |
gnulib-tool.m4 |
| 173 |
" |
| 174 |
|
| 175 |
# When truncating long commands for display, always allow at least this |
| 176 |
# many characters before truncating. |
| 177 |
min_cmd_len=160 |
| 178 |
|
| 179 |
# The command to download all .po files for a specified domain into |
| 180 |
# a specified directory. Fill in the first %s is the domain name, and |
| 181 |
# the second with the destination directory. Use rsync's -L and -r |
| 182 |
# options because the latest/%s directory and the .po files within are |
| 183 |
# all symlinks. |
| 184 |
po_download_command_format=\ |
| 185 |
"rsync --delete --exclude '*.s1' -Lrtvz \ |
| 186 |
'translationproject.org::tp/latest/%s/' '%s'" |
| 187 |
|
| 188 |
# Other locale categories that need message catalogs. |
| 189 |
extra_locale_categories= |
| 190 |
|
| 191 |
# Additional xgettext options to use. Gnulib might provide you with an |
| 192 |
# extensive list of additional options to append to this, but gettext |
| 193 |
# 0.16.1 and newer appends them automaticaly, so you can safely ignore |
| 194 |
# the complaints from 'gnulib-tool' if your $configure_ac states: |
| 195 |
# |
| 196 |
# AM_GNU_GETTEXT_VERSION([0.16.1]) |
| 197 |
xgettext_options=" |
| 198 |
--flag=_:1:pass-c-format |
| 199 |
--flag=N_:1:pass-c-format |
| 200 |
" |
| 201 |
|
| 202 |
# Package copyright holder for gettext files. Defaults to FSF if unset. |
| 203 |
copyright_holder= |
| 204 |
|
| 205 |
# File that should exist in the top directory of a checked out hierarchy, |
| 206 |
# but not in a distribution tarball. |
| 207 |
checkout_only_file= |
| 208 |
|
| 209 |
# Whether to use copies instead of symlinks by default (if set to true, |
| 210 |
# the --copy option has no effect). |
| 211 |
copy=false |
| 212 |
|
| 213 |
# Set this to ".cvsignore .gitignore" in 'bootstrap.conf' if you want |
| 214 |
# those files to be generated in directories like 'lib/', 'm4/', and 'po/', |
| 215 |
# or set it to "auto" to make this script select what to use based |
| 216 |
# on what version control system (if any) is used in the source directory. |
| 217 |
# Or set it to "none" to ignore VCS ignore files entirely. Default is |
| 218 |
# "auto". |
| 219 |
vc_ignore= |
| 220 |
|
| 221 |
|
| 222 |
## ------------------- ## |
| 223 |
## External Libraries. ## |
| 224 |
## ------------------- ## |
| 225 |
|
| 226 |
# Source required external libraries: |
| 227 |
. `echo "$0" |${SED-sed} 's|[^/]*$||'`"funclib.sh" |
| 228 |
. `echo "$0" |${SED-sed} 's|[^/]*$||'`"options-parser" |
| 229 |
. `echo "$0" |${SED-sed} 's|[^/]*$||'`"extract-trace" |
| 230 |
|
| 231 |
# Set a version string for *this* script. |
| 232 |
scriptversion=2019-03-22.11; # UTC |
| 233 |
|
| 234 |
|
| 235 |
## ------------------- ## |
| 236 |
## Hookable functions. ## |
| 237 |
## ------------------- ## |
| 238 |
|
| 239 |
# After 'bootstrap.conf' has been sourced, execution proceeds by calling |
| 240 |
# 'func_bootstrap'. Wherever a function is decorated with |
| 241 |
# 'func_hookable func_name', you will find a matching 'func_run_hooks |
| 242 |
# func_name', which executes all functions added with 'func_add_hook |
| 243 |
# func_name my_func'. |
| 244 |
# |
| 245 |
# You might notice that many of these functions begin with a series of |
| 246 |
# '$require_foo' lines. See the docu-comments at the start of the |
| 247 |
# 'Resource management' section for a description of what these are. |
| 248 |
|
| 249 |
|
| 250 |
# func_bootstrap [ARG]... |
| 251 |
# ----------------------- |
| 252 |
# All the functions called inside func_bootstrap are hookable. See the |
| 253 |
# the individual implementations for details. |
| 254 |
func_bootstrap () |
| 255 |
{ |
| 256 |
$debug_cmd |
| 257 |
|
| 258 |
# Save the current positional parameters to prevent them being |
| 259 |
# corrupted by calls to 'set' in 'func_init'. |
| 260 |
func_quote eval ${1+"$@"} |
| 261 |
_G_saved_positional_parameters=$func_quote_result |
| 262 |
|
| 263 |
# Initialisation. |
| 264 |
func_init |
| 265 |
|
| 266 |
# Option processing. |
| 267 |
eval func_options "$_G_saved_positional_parameters" |
| 268 |
|
| 269 |
# Post-option preparation. |
| 270 |
func_prep |
| 271 |
|
| 272 |
# Reconfigure the package. |
| 273 |
func_reconfigure |
| 274 |
|
| 275 |
# Ensure .version is up-to-date. |
| 276 |
func_update_dotversion |
| 277 |
|
| 278 |
# Finalisation. |
| 279 |
func_fini |
| 280 |
} |
| 281 |
|
| 282 |
|
| 283 |
# func_init |
| 284 |
# --------- |
| 285 |
# Any early initialisations can be hooked to this function. Consider |
| 286 |
# whether you can hook onto 'func_prep' instead, because if you hook |
| 287 |
# any slow to execute code in here, it will also add to the time before |
| 288 |
# './bootstrap --version' can respond. |
| 289 |
func_hookable func_init |
| 290 |
func_init () |
| 291 |
{ |
| 292 |
$debug_cmd |
| 293 |
|
| 294 |
func_run_hooks func_init |
| 295 |
} |
| 296 |
|
| 297 |
|
| 298 |
# func_prep |
| 299 |
# --------- |
| 300 |
# Function to perform preparation for remaining bootstrap process. If |
| 301 |
# your hooked code relies on the outcome of 'func_options' hook it here |
| 302 |
# rather than to 'func_init'. |
| 303 |
# |
| 304 |
# All the functions called inside func_prep are hookable. See the |
| 305 |
# individual implementations for details. |
| 306 |
func_hookable func_prep |
| 307 |
func_prep () |
| 308 |
{ |
| 309 |
$debug_cmd |
| 310 |
|
| 311 |
$require_buildtools_uptodate |
| 312 |
$require_checkout_only_file |
| 313 |
|
| 314 |
$require_gnulib_merge_changelog |
| 315 |
|
| 316 |
# Report the results of SED and GREP searches from funclib.sh. |
| 317 |
func_verbose "GREP='$GREP'" |
| 318 |
func_verbose "SED='$SED'" |
| 319 |
|
| 320 |
# fetch update files from the translation project |
| 321 |
func_update_translations |
| 322 |
|
| 323 |
func_run_hooks func_prep |
| 324 |
} |
| 325 |
|
| 326 |
|
| 327 |
# func_update_translations |
| 328 |
# ------------------------ |
| 329 |
# Update package po files and translations. |
| 330 |
func_hookable func_update_translations |
| 331 |
func_update_translations () |
| 332 |
{ |
| 333 |
$debug_cmd |
| 334 |
|
| 335 |
$opt_skip_po || { |
| 336 |
test -d po && { |
| 337 |
$require_package |
| 338 |
|
| 339 |
func_update_po_files po $package || exit $? |
| 340 |
} |
| 341 |
|
| 342 |
func_run_hooks func_update_translations |
| 343 |
} |
| 344 |
} |
| 345 |
|
| 346 |
|
| 347 |
# func_reconfigure |
| 348 |
# ---------------- |
| 349 |
# Reconfigure the current package by running the appropriate autotools in a |
| 350 |
# suitable order. |
| 351 |
func_hookable func_reconfigure |
| 352 |
func_reconfigure () |
| 353 |
{ |
| 354 |
$debug_cmd |
| 355 |
|
| 356 |
$require_automake_options |
| 357 |
|
| 358 |
# Automake (without 'foreign' option) requires that NEWS & README exist. |
| 359 |
case " $automake_options " in |
| 360 |
" foreign ") ;; |
| 361 |
*) |
| 362 |
func_ensure_NEWS |
| 363 |
func_ensure_README |
| 364 |
;; |
| 365 |
esac |
| 366 |
|
| 367 |
# Ensure ChangeLog presence. |
| 368 |
if test -n "$gnulib_modules"; then |
| 369 |
func_ifcontains "$gnulib_modules" gitlog-to-changelog \ |
| 370 |
func_ensure_changelog |
| 371 |
else |
| 372 |
$require_gnulib_cache |
| 373 |
if $SED -n '/^gl_MODULES(\[/,/^])$/p' $gnulib_cache 2>/dev/null | |
| 374 |
func_grep_q gitlog-to-changelog |
| 375 |
then |
| 376 |
func_ensure_changelog |
| 377 |
fi |
| 378 |
fi |
| 379 |
|
| 380 |
# Released 'autopoint' has the tendency to install macros that have |
| 381 |
# been obsoleted in current 'gnulib', so run this before 'gnulib-tool'. |
| 382 |
func_autopoint |
| 383 |
|
| 384 |
# Autoreconf runs 'aclocal' before 'libtoolize', which causes spurious |
| 385 |
# warnings if the initial 'aclocal' is confused by the libtoolized |
| 386 |
# (or worse: out-of-date) macro directory. |
| 387 |
func_libtoolize |
| 388 |
|
| 389 |
# If you need to do anything after 'gnulib-tool' is done, but before |
| 390 |
# 'autoreconf' runs, you don't need to override this whole function, |
| 391 |
# because 'func_gnulib_tool' is hookable. |
| 392 |
func_gnulib_tool |
| 393 |
|
| 394 |
func_autoreconf |
| 395 |
|
| 396 |
func_run_hooks func_reconfigure |
| 397 |
} |
| 398 |
|
| 399 |
|
| 400 |
# func_gnulib_tool |
| 401 |
# ---------------- |
| 402 |
# Run 'gnulib-tool' to fetch gnulib modules into the current package. |
| 403 |
# |
| 404 |
# It's assumed that since you are using gnulib's 'bootstrap' script, |
| 405 |
# you're also using gnulib elsewhere in your package. If not, then |
| 406 |
# you can replace this function in 'bootstrap.conf' with: |
| 407 |
# |
| 408 |
# func_gnulib_tool () { :; } |
| 409 |
# |
| 410 |
# (although the function returns immediately if $gnulib_tool is set to |
| 411 |
# true in any case). |
| 412 |
func_hookable func_gnulib_tool |
| 413 |
func_gnulib_tool () |
| 414 |
{ |
| 415 |
$debug_cmd |
| 416 |
|
| 417 |
$require_gnulib_tool |
| 418 |
$require_libtoolize |
| 419 |
|
| 420 |
test true = "$gnulib_tool" || { |
| 421 |
$require_gnulib_git_submodules |
| 422 |
|
| 423 |
# bootstrap.conf written for gnulib bootstrap expects |
| 424 |
# gnulib_tool_option_extras to which --no-changelog is appended, |
| 425 |
# but libtool bootstrap expects you to append to gnulib_tool_options |
| 426 |
# so that you can override the --no-changelog default: make sure we |
| 427 |
# support both styles so users can migrate between them easily. |
| 428 |
gnulib_tool_all_options="$gnulib_tool_options $gnulib_tool_option_extras" |
| 429 |
|
| 430 |
if test -n "$gnulib_modules"; then |
| 431 |
$require_gnulib_cache |
| 432 |
$require_gnulib_tool_base_options |
| 433 |
|
| 434 |
gnulib_mode=--import |
| 435 |
|
| 436 |
# Try not to pick up any stale values from 'gnulib-cache.m4'. |
| 437 |
rm -f "$gnulib_cache" |
| 438 |
|
| 439 |
test -n "$gnulib_tool_base_options" \ |
| 440 |
&& func_append_uniq gnulib_tool_all_options " $gnulib_tool_base_options" |
| 441 |
test -n "$gnulib_mk" \ |
| 442 |
&& func_append_uniq gnulib_tool_all_options " --makefile-name=$gnulib_mk" |
| 443 |
test -n "$tests_base" && { |
| 444 |
func_append_uniq gnulib_tool_all_options " --tests-base=$tests_base" |
| 445 |
func_append_uniq gnulib_tool_all_options " --with-tests" |
| 446 |
} |
| 447 |
else |
| 448 |
|
| 449 |
# 'gnulib_modules' and others are cached in 'gnulib-cache.m4': |
| 450 |
# Use 'gnulib --update' to fetch gnulib modules. |
| 451 |
gnulib_mode=--update |
| 452 |
fi |
| 453 |
|
| 454 |
# Add a sensible default libtool option to gnulib_tool_options. |
| 455 |
# The embedded echo is to squash whitespace before globbing. |
| 456 |
case `echo " "$gnulib_tool_all_options" "` in |
| 457 |
*" --no-libtool "*|*" --libtool "*) ;; |
| 458 |
*) if test true = "$LIBTOOLIZE"; then |
| 459 |
func_append_uniq gnulib_tool_all_options " --no-libtool" |
| 460 |
else |
| 461 |
func_append_uniq gnulib_tool_all_options " --libtool" |
| 462 |
fi |
| 463 |
;; |
| 464 |
esac |
| 465 |
|
| 466 |
$opt_copy || func_append_uniq gnulib_tool_all_options " --symlink" |
| 467 |
|
| 468 |
func_append_uniq gnulib_tool_all_options " $gnulib_mode" |
| 469 |
func_append gnulib_tool_all_options " $gnulib_modules" |
| 470 |
|
| 471 |
# The embedded echo is to squash whitespace before display. |
| 472 |
gnulib_cmd=`echo $gnulib_tool $gnulib_tool_all_options` |
| 473 |
|
| 474 |
func_show_eval "$gnulib_cmd" 'exit $?' |
| 475 |
|
| 476 |
# Use 'gnulib-tool --copy-file' to install non-module files. |
| 477 |
func_install_gnulib_non_module_files |
| 478 |
} |
| 479 |
|
| 480 |
func_run_hooks func_gnulib_tool |
| 481 |
} |
| 482 |
|
| 483 |
|
| 484 |
# func_fini |
| 485 |
# --------- |
| 486 |
# Function to perform all finalisation for the bootstrap process. |
| 487 |
func_hookable func_fini |
| 488 |
func_fini () |
| 489 |
{ |
| 490 |
$debug_cmd |
| 491 |
|
| 492 |
func_gettext_configuration |
| 493 |
func_clean_dangling_symlinks |
| 494 |
func_clean_unused_macros |
| 495 |
func_skip_po_recommendation |
| 496 |
|
| 497 |
func_run_hooks func_fini |
| 498 |
|
| 499 |
$require_bootstrap_uptodate |
| 500 |
|
| 501 |
func_echo "Done. Now you can run './configure'." |
| 502 |
} |
| 503 |
|
| 504 |
|
| 505 |
# func_gettext_configuration |
| 506 |
# -------------------------- |
| 507 |
# Edit configuration values into po/Makevars. |
| 508 |
func_hookable func_gettext_configuration |
| 509 |
func_gettext_configuration () |
| 510 |
{ |
| 511 |
$debug_cmd |
| 512 |
|
| 513 |
$require_autopoint |
| 514 |
|
| 515 |
test true = "$AUTOPOINT" || { |
| 516 |
$require_copyright_holder |
| 517 |
$require_extra_locale_categories |
| 518 |
$require_package_bugreport |
| 519 |
|
| 520 |
# Escape xgettext options for sed Makevars generation below. |
| 521 |
# We have to delete blank lines in a separate script so that we don't |
| 522 |
# append \\\ to the penultimate line, and then delete the last empty |
| 523 |
# line, which messes up the variable substitution later in this |
| 524 |
# function. Note that adding a literal \\\ requires double escaping |
| 525 |
# here, once for the execution subshell, and again for the assignment, |
| 526 |
# which is why there are actually 12 (!!) backslashes in the script. |
| 527 |
_G_xgettext_options=`echo "$xgettext_options$nl" |$SED '/^$/d' |$SED ' |
| 528 |
$b |
| 529 |
s|$| \\\\\\\\\\\\|'` |
| 530 |
|
| 531 |
# Create gettext configuration. |
| 532 |
func_echo "Creating po/Makevars from po/Makevars.template ..." |
| 533 |
$RM -f po/Makevars |
| 534 |
$SED ' |
| 535 |
/^EXTRA_LOCALE_CATEGORIES *=/s|=.*|= '"$extra_locale_categories"'| |
| 536 |
/^COPYRIGHT_HOLDER *=/s|=.*|= '"$copyright_holder"'| |
| 537 |
/^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$package_bugreport"'| |
| 538 |
/^XGETTEXT_OPTIONS *=/{ |
| 539 |
s|$| \\| |
| 540 |
a\ |
| 541 |
'"$_G_xgettext_options"' \\\ |
| 542 |
$${end_of_xgettext_options+} |
| 543 |
} |
| 544 |
s/ *$// |
| 545 |
' po/Makevars.template >po/Makevars || exit 1 |
| 546 |
} |
| 547 |
|
| 548 |
func_run_hooks func_gettext_configuration |
| 549 |
} |
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
## --------------- ## |
| 554 |
## Core functions. ## |
| 555 |
## --------------- ## |
| 556 |
|
| 557 |
# This section contains the main functions called from the 'Hookable |
| 558 |
# functions' (shown above), and are the ones you're most likely |
| 559 |
# to want to replace with your own implementations in 'bootstrap.conf'. |
| 560 |
|
| 561 |
|
| 562 |
# func_autopoint |
| 563 |
# -------------- |
| 564 |
# If this package uses gettext, then run 'autopoint'. |
| 565 |
func_autopoint () |
| 566 |
{ |
| 567 |
$debug_cmd |
| 568 |
|
| 569 |
$require_autopoint |
| 570 |
|
| 571 |
test true = "$AUTOPOINT" \ |
| 572 |
|| func_show_eval "$AUTOPOINT --force" 'exit $?' |
| 573 |
} |
| 574 |
|
| 575 |
|
| 576 |
# func_libtoolize |
| 577 |
# --------------- |
| 578 |
# If this package uses libtool, then run 'libtoolize'. |
| 579 |
func_libtoolize () |
| 580 |
{ |
| 581 |
$debug_cmd |
| 582 |
|
| 583 |
$require_libtoolize |
| 584 |
|
| 585 |
test true = "$LIBTOOLIZE" || { |
| 586 |
_G_libtoolize_options= |
| 587 |
$opt_copy && func_append _G_libtoolize_options " --copy" |
| 588 |
$opt_force && func_append _G_libtoolize_options " --force" |
| 589 |
$opt_verbose || func_append _G_libtoolize_options " --quiet" |
| 590 |
func_show_eval "$LIBTOOLIZE$_G_libtoolize_options" 'exit $?' |
| 591 |
} |
| 592 |
} |
| 593 |
|
| 594 |
|
| 595 |
# func_gnulib_tool_copy_file SRC DEST |
| 596 |
# ----------------------------------- |
| 597 |
# Copy SRC, a path relative to the gnulib sub-tree, to DEST, a path |
| 598 |
# relative to the top-level source directory using gnulib-tool so that |
| 599 |
# any patches or replacements in $local_gl_path are applied. |
| 600 |
func_gnulib_tool_copy_file () |
| 601 |
{ |
| 602 |
$debug_cmd |
| 603 |
|
| 604 |
$require_gnulib_tool |
| 605 |
$require_patch |
| 606 |
|
| 607 |
if test true = "$gnulib_tool"; then |
| 608 |
# If gnulib-tool is not available (e.g. bootstrapping in a |
| 609 |
# distribution tarball), make sure that at least we have some |
| 610 |
# version of the required file already in place. |
| 611 |
test -f "$2" || func_fatal_error "\ |
| 612 |
Can't find, copy or download '$2', a required |
| 613 |
gnulib supplied file, please provide the location of a |
| 614 |
complete 'gnulib' tree by setting 'gnulib_path' in your |
| 615 |
'bootstrap.conf' or with the '--gnulib-srcdir' option - |
| 616 |
or else specify the location of your 'git' binary by |
| 617 |
setting 'GIT' in the environment so that a fresh |
| 618 |
'gnulib' submodule can be cloned." |
| 619 |
else |
| 620 |
$require_gnulib_copy_cmd |
| 621 |
|
| 622 |
$gnulib_copy_cmd $1 $2 2>/dev/null || { |
| 623 |
$require_gnulib_path |
| 624 |
|
| 625 |
func_error "'$gnulib_path/$1' does not exist" |
| 626 |
return 1 |
| 627 |
} |
| 628 |
fi |
| 629 |
} |
| 630 |
|
| 631 |
|
| 632 |
# func_install_gnulib_non_module_files |
| 633 |
# ------------------------------------ |
| 634 |
# Get additional non-module files from gnulib, overriding existing files. |
| 635 |
func_install_gnulib_non_module_files () |
| 636 |
{ |
| 637 |
$debug_cmd |
| 638 |
|
| 639 |
$require_build_aux |
| 640 |
$require_gnulib_tool |
| 641 |
|
| 642 |
test -n "$gnulib_non_module_files" && { |
| 643 |
maybe_exit_cmd=: |
| 644 |
|
| 645 |
for file in $gnulib_non_module_files; do |
| 646 |
case $file in |
| 647 |
*/COPYING*) dest=COPYING;; |
| 648 |
*/INSTALL) dest=INSTALL;; |
| 649 |
build-aux/missing) dest= |
| 650 |
func_warning settings "\ |
| 651 |
Please remove build-aux/missing from gnulib_module_files in |
| 652 |
'bootstrap.conf', as it may clash with Automake's version." |
| 653 |
;; |
| 654 |
build-aux/*) dest=$build_aux/`expr "$file" : 'build-aux/\(.*\)'`;; |
| 655 |
*) dest=$file;; |
| 656 |
esac |
| 657 |
|
| 658 |
# Be sure to show all copying errors before bailing out |
| 659 |
test -z "$dest" \ |
| 660 |
|| func_gnulib_tool_copy_file "$file" "$dest" \ |
| 661 |
|| maybe_exit_cmd="exit $EXIT_FAILURE" |
| 662 |
done |
| 663 |
|
| 664 |
$maybe_exit_cmd |
| 665 |
} |
| 666 |
} |
| 667 |
|
| 668 |
|
| 669 |
# func_ensure_changelog |
| 670 |
# --------------------- |
| 671 |
# Even with 'gitlog-to-changelog' generated ChangeLogs, automake |
| 672 |
# will not run to completion with no ChangeLog file. |
| 673 |
func_ensure_changelog () |
| 674 |
{ |
| 675 |
$debug_cmd |
| 676 |
|
| 677 |
test -f ChangeLog && mv -f ChangeLog ChangeLog~ |
| 678 |
|
| 679 |
cat >ChangeLog <<'EOT' |
| 680 |
## ---------------------- ## |
| 681 |
## DO NOT EDIT THIS FILE! ## |
| 682 |
## ---------------------- ## |
| 683 |
|
| 684 |
ChangeLog is generated by gitlog-to-changelog. |
| 685 |
EOT |
| 686 |
|
| 687 |
_G_message="creating dummy 'ChangeLog'" |
| 688 |
test -f ChangeLog~ \ |
| 689 |
&& func_append _G_message ' (backup in ChangeLog~)' |
| 690 |
func_verbose "$_G_message" |
| 691 |
|
| 692 |
return 0 |
| 693 |
} |
| 694 |
|
| 695 |
|
| 696 |
# func_ensure_NEWS |
| 697 |
# ---------------- |
| 698 |
# Without AM_INIT_AUTOMAKE([foreign]), automake will not run to |
| 699 |
# completion with no NEWS file, even though NEWS.md or NEWS.txt |
| 700 |
# is often preferable. |
| 701 |
func_ensure_NEWS () |
| 702 |
{ |
| 703 |
$debug_cmd |
| 704 |
|
| 705 |
test -f NEWS || { |
| 706 |
_G_NEWS= |
| 707 |
for _G_news in NEWS.txt NEWS.md NEWS.rst; do |
| 708 |
test -f "$_G_news" && break |
| 709 |
done |
| 710 |
|
| 711 |
test -f "$_G_news" && $LN_S $_G_news NEWS |
| 712 |
func_verbose "$LN_S $_G_news NEWS" |
| 713 |
} |
| 714 |
|
| 715 |
return 0 |
| 716 |
} |
| 717 |
|
| 718 |
|
| 719 |
# func_ensure_README |
| 720 |
# ------------------ |
| 721 |
# Without AM_INIT_AUTOMAKE([foreign]), automake will not run to |
| 722 |
# completion with no README file, even though README.md or README.txt |
| 723 |
# is often preferable. |
| 724 |
func_ensure_README () |
| 725 |
{ |
| 726 |
$debug_cmd |
| 727 |
|
| 728 |
test -f README || { |
| 729 |
_G_README= |
| 730 |
for _G_readme in README.txt README.md README.rst; do |
| 731 |
test -f "$_G_readme" && break |
| 732 |
done |
| 733 |
|
| 734 |
test -f "$_G_readme" && $LN_S $_G_readme README |
| 735 |
func_verbose "$LN_S $_G_readme README" |
| 736 |
} |
| 737 |
|
| 738 |
return 0 |
| 739 |
} |
| 740 |
|
| 741 |
|
| 742 |
# func_autoreconf [SUBDIR] |
| 743 |
# ------------------------ |
| 744 |
# Being careful not to re-run 'autopoint' or 'libtoolize', and not to |
| 745 |
# try to run 'autopoint', 'libtoolize' or 'autoheader' on packages that |
| 746 |
# don't use them, defer to 'autoreconf' for execution of the remaining |
| 747 |
# autotools to bootstrap this package. |
| 748 |
# |
| 749 |
# Projects with multiple trees to reconfigure can hook another call to |
| 750 |
# this function onto func_reconfigure: |
| 751 |
# |
| 752 |
# my_autoreconf_foo () |
| 753 |
# { |
| 754 |
# func_autoreconf foo |
| 755 |
# } |
| 756 |
# func_add_hook func_reconfigure my_autoreconf_foo |
| 757 |
func_autoreconf () |
| 758 |
{ |
| 759 |
$debug_cmd |
| 760 |
|
| 761 |
$require_autoheader |
| 762 |
$require_build_aux # automake and others put files in here |
| 763 |
$require_macro_dir # aclocal and others put files in here |
| 764 |
|
| 765 |
# We ran these manually already, and autoreconf won't exec ':' |
| 766 |
save_AUTOPOINT=$AUTOPOINT; AUTOPOINT=true |
| 767 |
save_LIBTOOLIZE=$LIBTOOLIZE; LIBTOOLIZE=true |
| 768 |
|
| 769 |
_G_autoreconf_options= |
| 770 |
$opt_copy || func_append _G_autoreconf_options " --symlink" |
| 771 |
$opt_force && func_append _G_autoreconf_options " --force" |
| 772 |
$opt_verbose && func_append _G_autoreconf_options " --verbose" |
| 773 |
func_show_eval "$AUTORECONF$_G_autoreconf_options --install${1+ $1}" 'exit $?' |
| 774 |
|
| 775 |
AUTOPOINT=$save_AUTOPOINT |
| 776 |
LIBTOOLIZE=$save_LIBTOOLIZE |
| 777 |
} |
| 778 |
|
| 779 |
|
| 780 |
# func_check_configuration VARNAME [CONFIGURE_MACRO] |
| 781 |
# -------------------------------------------------- |
| 782 |
# Exit with a suitable diagnostic for an important configuration change |
| 783 |
# that needs to be made before bootstrap can run correctly. |
| 784 |
func_check_configuration () |
| 785 |
{ |
| 786 |
$debug_cmd |
| 787 |
|
| 788 |
$require_configure_ac |
| 789 |
|
| 790 |
eval 'test -n "$'$1'"' || { |
| 791 |
_G_error_msg="please set '$1' in 'bootstrap.conf'" |
| 792 |
if test -n "$configure_ac" && test -n "$2"; then |
| 793 |
func_append _G_error_msg " |
| 794 |
or add the following (or similar) to your '$configure_ac': |
| 795 |
$2" |
| 796 |
fi |
| 797 |
|
| 798 |
func_fatal_error "$_G_error_msg" |
| 799 |
} |
| 800 |
} |
| 801 |
|
| 802 |
|
| 803 |
# func_clean_dangling_symlinks |
| 804 |
# ---------------------------- |
| 805 |
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some |
| 806 |
# gnulib-populated directories. Such .m4 files would cause aclocal to |
| 807 |
# fail. The following requires GNU find 4.2.3 or newer. Considering |
| 808 |
# the usual portability constraints of this script, that may seem a very |
| 809 |
# demanding requirement, but it should be ok. Ignore any failure, |
| 810 |
# which is fine, since this is only a convenience to help developers |
| 811 |
# avoid the relatively unusual case where a symlinked-to .m4 file is |
| 812 |
# git-removed from gnulib between successive runs of this script. |
| 813 |
func_clean_dangling_symlinks () |
| 814 |
{ |
| 815 |
$debug_cmd |
| 816 |
|
| 817 |
$require_macro_dir |
| 818 |
$require_source_base |
| 819 |
|
| 820 |
func_verbose "cleaning dangling symlinks" |
| 821 |
|
| 822 |
find "$macro_dir" "$source_base" \ |
| 823 |
-depth \( -name '*.m4' -o -name '*.[ch]' \) \ |
| 824 |
-type l -xtype l -delete > /dev/null 2>&1 |
| 825 |
} |
| 826 |
|
| 827 |
|
| 828 |
# func_clean_unused_macros |
| 829 |
# ------------------------ |
| 830 |
# Autopoint can result in over-zealously adding macros into $macro_dir |
| 831 |
# even though they are not actually used, for example tests to help |
| 832 |
# build the 'intl' directory even though you have specified |
| 833 |
# 'AM_GNU_GETTEXT([external])' in your configure.ac. This function |
| 834 |
# looks removes any macro files that can be found in gnulib, but |
| 835 |
# are not 'm4_include'd by 'aclocal.m4'. |
| 836 |
func_clean_unused_macros () |
| 837 |
{ |
| 838 |
$debug_cmd |
| 839 |
|
| 840 |
$require_gnulib_path |
| 841 |
$require_macro_dir |
| 842 |
|
| 843 |
test -n "$gnulib_path" && test -f aclocal.m4 && { |
| 844 |
aclocal_m4s=`find . -name aclocal.m4 -print` |
| 845 |
|
| 846 |
# We use 'ls|grep' instead of 'ls *.m4' to avoid exceeding |
| 847 |
# command line length limits in some shells. |
| 848 |
for file in `cd "$macro_dir" && ls -1 |$GREP '\.m4$'`; do |
| 849 |
|
| 850 |
# Remove a macro file when aclocal.m4 does not m4_include it... |
| 851 |
func_grep_q 'm4_include([[]'$macro_dir/$file'])' $aclocal_m4s \ |
| 852 |
|| test ! -f "$gnulib_path/m4/$file" || { |
| 853 |
|
| 854 |
# ...and there is an identical file in gnulib... |
| 855 |
if func_cmp_s "$gnulib_path/m4/$file" "$macro_dir/$file"; then |
| 856 |
|
| 857 |
# ...and it's not in the precious list ('echo' is needed |
| 858 |
# here to squash whitespace for the match expression). |
| 859 |
case " "`echo $gnulib_precious`" " in |
| 860 |
*" $file "*) ;; |
| 861 |
*) rm -f "$macro_dir/$file" |
| 862 |
func_verbose \ |
| 863 |
"removing unused gnulib file '$macro_dir/$file'" |
| 864 |
esac |
| 865 |
fi |
| 866 |
} |
| 867 |
done |
| 868 |
} |
| 869 |
} |
| 870 |
|
| 871 |
|
| 872 |
# func_skip_po_recommendation |
| 873 |
# --------------------------- |
| 874 |
# If there is a po directory, and '--skip-po' wasn't passed, let the |
| 875 |
# user know that they can use '--skip-po' on subsequent invocations. |
| 876 |
func_skip_po_recommendation () |
| 877 |
{ |
| 878 |
$debug_cmd |
| 879 |
|
| 880 |
test ! -d po \ |
| 881 |
|| $opt_skip_po \ |
| 882 |
|| func_warning recommend "\ |
| 883 |
If your pofiles are up-to-date, you can rerun bootstrap |
| 884 |
as '$progname --skip-po' to avoid redownloading." |
| 885 |
} |
| 886 |
|
| 887 |
|
| 888 |
# func_update_dotversion |
| 889 |
# ---------------------- |
| 890 |
# Even with 'gitlog-to-changelog' generated ChangeLogs, automake |
| 891 |
# will not run to completion with no ChangeLog file. |
| 892 |
func_update_dotversion () |
| 893 |
{ |
| 894 |
$debug_cmd |
| 895 |
|
| 896 |
test -f "$build_aux/git-version-gen" && { |
| 897 |
_G_message="updating .version" |
| 898 |
test -f .version && { |
| 899 |
mv .version .version~ |
| 900 |
func_append _G_message " (backup in .version~)" |
| 901 |
} |
| 902 |
func_verbose "updating .version" |
| 903 |
|
| 904 |
$build_aux/git-version-gen dummy-arg > .version |
| 905 |
} |
| 906 |
} |
| 907 |
|
| 908 |
|
| 909 |
|
| 910 |
## -------------------- ## |
| 911 |
## Resource management. ## |
| 912 |
## -------------------- ## |
| 913 |
|
| 914 |
# This section contains definitions for functions that each ensure a |
| 915 |
# particular resource (a file, or a non-empty configuration variable for |
| 916 |
# example) is available, and if appropriate to extract default values |
| 917 |
# from pertinent package files. Where a variable already has a non- |
| 918 |
# empty value (as set by the package's 'bootstrap.conf'), that value is |
| 919 |
# used in preference to deriving the default. Call them using their |
| 920 |
# associated 'require_*' variable to ensure that they are executed, at |
| 921 |
# most, once. |
| 922 |
|
| 923 |
|
| 924 |
# require_gnulib_git_submodules |
| 925 |
# ----------------------------- |
| 926 |
# Initialize all git modules from $gnulib_git_submodules before we |
| 927 |
# run 'gnulib-tool'. |
| 928 |
require_gnulib_git_submodules=func_require_gnulib_git_submodules |
| 929 |
func_require_gnulib_git_submodules () |
| 930 |
{ |
| 931 |
test -n "$gnulib_git_submodules" && { |
| 932 |
for _G_submodule in $gnulib_git_submodules |
| 933 |
do |
| 934 |
func_show_eval "git submodule init -- $_G_submodule" \ |
| 935 |
&& func_show_eval "git submodule update -- $_G_submodule" \ |
| 936 |
|| func_fatal_error "Unable to init git module '$_G_submodule'." |
| 937 |
done |
| 938 |
} |
| 939 |
|
| 940 |
require_gnulib_git_submodules=: |
| 941 |
} |
| 942 |
|
| 943 |
|
| 944 |
# require_checkout_only_file |
| 945 |
# -------------------------- |
| 946 |
# Bail out if this package only bootstraps properly from a repository |
| 947 |
# checkout. |
| 948 |
require_checkout_only_file=func_require_checkout_only_file |
| 949 |
func_require_checkout_only_file () |
| 950 |
{ |
| 951 |
$debug_cmd |
| 952 |
|
| 953 |
$opt_force || { |
| 954 |
test -n "$checkout_only_file" && test ! -f "$checkout_only_file" \ |
| 955 |
&& func_fatal_error "\ |
| 956 |
Bootstrapping from a non-checked-out distribution is risky. |
| 957 |
If you wish to bootstrap anyway, use the '--force' option." |
| 958 |
} |
| 959 |
|
| 960 |
require_checkout_only_file=: |
| 961 |
} |
| 962 |
|
| 963 |
|
| 964 |
# require_aclocal_amflags |
| 965 |
# ----------------------- |
| 966 |
# Ensure '$aclocal_amflags' has a sensible default, extracted from |
| 967 |
# 'Makefile.am' if necessary. |
| 968 |
require_aclocal_amflags=func_require_aclocal_amflags |
| 969 |
func_require_aclocal_amflags () |
| 970 |
{ |
| 971 |
$debug_cmd |
| 972 |
|
| 973 |
$require_makefile_am |
| 974 |
|
| 975 |
_G_sed_extract_aclocal_amflags='s|#.*$|| |
| 976 |
/^[ ]*ACLOCAL_AMFLAGS[ ]*=/ { |
| 977 |
s|^.*=[ ]*\(.*\)|aclocal_amflags="\1"| |
| 978 |
p |
| 979 |
}' |
| 980 |
|
| 981 |
_G_aclocal_flags_cmd=`$SED -n "$_G_sed_extract_aclocal_amflags" \ |
| 982 |
"$makefile_am"` |
| 983 |
eval "$_G_aclocal_flags_cmd" |
| 984 |
|
| 985 |
func_verbose "ACLOCAL_AMFLAGS='$aclocal_amflags'" |
| 986 |
|
| 987 |
require_aclocal_amflags=: |
| 988 |
} |
| 989 |
|
| 990 |
|
| 991 |
# require_autoheader |
| 992 |
# ------------------ |
| 993 |
# Skip autoheader if it's not needed. |
| 994 |
require_autoheader=func_require_autoheader |
| 995 |
func_require_autoheader () |
| 996 |
{ |
| 997 |
$debug_cmd |
| 998 |
|
| 999 |
test true = "$AUTOHEADER" || { |
| 1000 |
func_extract_trace AC_CONFIG_HEADERS |
| 1001 |
test -n "$func_extract_trace_result" \ |
| 1002 |
|| func_extract_trace AC_CONFIG_HEADER |
| 1003 |
|
| 1004 |
test -n "$func_extract_trace_result" || { |
| 1005 |
AUTOHEADER=true |
| 1006 |
|
| 1007 |
func_verbose "export AUTOHEADER='$AUTOHEADER'" |
| 1008 |
|
| 1009 |
# Make sure the search result is visible to subshells |
| 1010 |
export AUTOHEADER |
| 1011 |
} |
| 1012 |
} |
| 1013 |
|
| 1014 |
require_autoheader=: |
| 1015 |
} |
| 1016 |
|
| 1017 |
|
| 1018 |
# require_automake_options |
| 1019 |
# ------------------------ |
| 1020 |
# Extract options from AM_AUTOMAKE_INIT. |
| 1021 |
require_automake_options=func_require_automake_options |
| 1022 |
func_require_automake_options () |
| 1023 |
{ |
| 1024 |
$debug_cmd |
| 1025 |
|
| 1026 |
func_extract_trace AM_INIT_AUTOMAKE |
| 1027 |
automake_options=$func_extract_trace_result |
| 1028 |
|
| 1029 |
require_automake_options=: |
| 1030 |
} |
| 1031 |
|
| 1032 |
|
| 1033 |
# require_autopoint |
| 1034 |
# ----------------- |
| 1035 |
# Skip autopoint if it's not needed. |
| 1036 |
require_autopoint=func_require_autopoint |
| 1037 |
func_require_autopoint () |
| 1038 |
{ |
| 1039 |
$debug_cmd |
| 1040 |
|
| 1041 |
test true = "$AUTOPOINT" || { |
| 1042 |
func_extract_trace AM_GNU_GETTEXT_VERSION |
| 1043 |
|
| 1044 |
test -n "$func_extract_trace_result" || { |
| 1045 |
AUTOPOINT=true |
| 1046 |
|
| 1047 |
func_verbose "export AUTOPOINT='$AUTOPOINT'" |
| 1048 |
|
| 1049 |
# Make sure the search result is visible to subshells |
| 1050 |
export AUTOPOINT |
| 1051 |
} |
| 1052 |
} |
| 1053 |
|
| 1054 |
require_autopoint=: |
| 1055 |
} |
| 1056 |
|
| 1057 |
|
| 1058 |
# require_bootstrap_uptodate |
| 1059 |
# -------------------------- |
| 1060 |
# Complain if the version of bootstrap in the gnulib directory differs |
| 1061 |
# from the one we are running. |
| 1062 |
require_bootstrap_uptodate=func_require_bootstrap_uptodate |
| 1063 |
func_require_bootstrap_uptodate () |
| 1064 |
{ |
| 1065 |
$debug_cmd |
| 1066 |
|
| 1067 |
$require_build_aux |
| 1068 |
|
| 1069 |
_G_bootstrap_sources=" |
| 1070 |
$build_aux/bootstrap.in |
| 1071 |
$build_aux/extract-trace |
| 1072 |
$build_aux/funclib.sh |
| 1073 |
$build_aux/options-parser |
| 1074 |
" |
| 1075 |
|
| 1076 |
_G_missing_bootstrap_sources=false |
| 1077 |
for _G_src in $_G_bootstrap_sources; do |
| 1078 |
test -f "$_G_src" || _G_missing_bootstrap_sources=: |
| 1079 |
done |
| 1080 |
|
| 1081 |
if $_G_missing_bootstrap_sources; then |
| 1082 |
func_warning upgrade "\ |
| 1083 |
Please add bootstrap to your gnulib_modules list in |
| 1084 |
'bootstrap.conf', so that I can tell you when there are |
| 1085 |
updates available." |
| 1086 |
else |
| 1087 |
rm -f bootstrap.new |
| 1088 |
$build_aux/inline-source $build_aux/bootstrap.in > bootstrap.new |
| 1089 |
|
| 1090 |
if func_cmp_s "$progpath" bootstrap.new; then |
| 1091 |
rm -f bootstrap.new |
| 1092 |
func_verbose "bootstrap script up to date" |
| 1093 |
else |
| 1094 |
chmod 555 bootstrap.new |
| 1095 |
func_warning upgrade "\ |
| 1096 |
An updated bootstrap script has been generated for you in |
| 1097 |
'bootstrap.new'. After you've verified that you want |
| 1098 |
the changes, you can update with: |
| 1099 |
mv -f bootstrap.new $progname |
| 1100 |
./$progname |
| 1101 |
|
| 1102 |
Or you can disable this check permanently by adding the |
| 1103 |
following to 'bootstrap.conf': |
| 1104 |
require_bootstrap_uptodate=:" |
| 1105 |
fi |
| 1106 |
fi |
| 1107 |
|
| 1108 |
require_bootstrap_uptodate=: |
| 1109 |
} |
| 1110 |
|
| 1111 |
|
| 1112 |
# require_build_aux |
| 1113 |
# ----------------- |
| 1114 |
# Ensure that '$build_aux' is set, and if it doesn't already point to an |
| 1115 |
# existing directory, create one. |
| 1116 |
require_build_aux=func_require_build_aux |
| 1117 |
func_require_build_aux () |
| 1118 |
{ |
| 1119 |
$debug_cmd |
| 1120 |
|
| 1121 |
test -n "$build_aux" || { |
| 1122 |
func_extract_trace_first AC_CONFIG_AUX_DIR |
| 1123 |
build_aux=$func_extract_trace_first_result |
| 1124 |
func_check_configuration build_aux \ |
| 1125 |
"AC_CONFIG_AUX_DIR([name of a directory for build scripts])" |
| 1126 |
|
| 1127 |
func_verbose "build_aux='$build_aux'" |
| 1128 |
} |
| 1129 |
|
| 1130 |
$require_vc_ignore_files |
| 1131 |
|
| 1132 |
# If the build_aux directory doesn't exist, create it now, and mark it |
| 1133 |
# as ignored for the VCS. |
| 1134 |
if test ! -d "$build_aux"; then |
| 1135 |
func_show_eval "mkdir '$build_aux'" |
| 1136 |
|
| 1137 |
test -n "$vc_ignore_files" \ |
| 1138 |
|| func_insert_if_absent "$build_aux" $vc_ignore_files |
| 1139 |
fi |
| 1140 |
|
| 1141 |
require_build_aux=: |
| 1142 |
} |
| 1143 |
|
| 1144 |
|
| 1145 |
# require_buildreq_autobuild |
| 1146 |
# -------------------------- |
| 1147 |
# Try to find whether the bootstrap requires autobuild. |
| 1148 |
require_buildreq_autobuild=func_require_buildreq_autobuild |
| 1149 |
func_require_buildreq_autobuild () |
| 1150 |
{ |
| 1151 |
$debug_cmd |
| 1152 |
|
| 1153 |
$require_macro_dir |
| 1154 |
|
| 1155 |
test -f "$macro_dir/autobuild.m4" \ |
| 1156 |
|| printf '%s\n' "$buildreq" |func_grep_q '^[ ]*autobuild' \ |
| 1157 |
|| { |
| 1158 |
func_extract_trace AB_INIT |
| 1159 |
test -n "$func_extract_trace_result" && { |
| 1160 |
func_append buildreq 'autobuild - http://josefsson.org/autobuild/ |
| 1161 |
' |
| 1162 |
func_verbose "auto-adding 'autobuild' to build requirements" |
| 1163 |
} |
| 1164 |
} |
| 1165 |
|
| 1166 |
require_buildreq_autobuild=: |
| 1167 |
} |
| 1168 |
|
| 1169 |
|
| 1170 |
# require_buildreq_autoconf |
| 1171 |
# require_buildreq_autopoint |
| 1172 |
# require_buildreq_libtoolize |
| 1173 |
# --------------------------- |
| 1174 |
# Try to find the minimum compatible version of autoconf/libtool |
| 1175 |
# required to bootstrap successfully, and add it to '$buildreq'. |
| 1176 |
for tool in autoconf libtoolize autopoint; do |
| 1177 |
b=$tool |
| 1178 |
v=require_buildreq_${tool} |
| 1179 |
f=func_$v |
| 1180 |
case $tool in |
| 1181 |
autoconf) m=AC_PREREQ ;; |
| 1182 |
libtoolize) m=LT_PREREQ; b=libtool ;; |
| 1183 |
autopoint) m=AM_GNU_GETTEXT_VERSION b=gettext ;; |
| 1184 |
esac |
| 1185 |
|
| 1186 |
eval $v'='$f' |
| 1187 |
'$f' () |
| 1188 |
{ |
| 1189 |
$debug_cmd |
| 1190 |
|
| 1191 |
# The following is ignored if undefined, but might be necessary |
| 1192 |
# in order for `func_find_tool` to run. |
| 1193 |
${require_'$tool'-:} |
| 1194 |
|
| 1195 |
printf '\''%s\n'\'' "$buildreq" |func_grep_q '\''^[ ]*'$tool\'' || { |
| 1196 |
func_extract_trace '$m' |
| 1197 |
_G_version=$func_extract_trace_result |
| 1198 |
test -n "$_G_version" && { |
| 1199 |
func_append buildreq "\ |
| 1200 |
'$tool' $_G_version http://www.gnu.org/s/'$b' |
| 1201 |
" |
| 1202 |
func_verbose \ |
| 1203 |
"auto-adding '\'$tool'-$_G_version'\'' to build requirements" |
| 1204 |
} |
| 1205 |
} |
| 1206 |
|
| 1207 |
'$v'=: |
| 1208 |
} |
| 1209 |
' |
| 1210 |
done |
| 1211 |
|
| 1212 |
|
| 1213 |
# require_buildreq_automake |
| 1214 |
# ------------------------- |
| 1215 |
# Try to find the minimum compatible version of automake required to |
| 1216 |
# bootstrap successfully, and add it to '$buildreq'. |
| 1217 |
require_buildreq_automake=func_require_buildreq_automake |
| 1218 |
func_require_buildreq_automake () |
| 1219 |
{ |
| 1220 |
$debug_cmd |
| 1221 |
|
| 1222 |
# if automake is not already listed in $buildreq... |
| 1223 |
printf '%s\n' "$buildreq" |func_grep_q automake || { |
| 1224 |
func_extract_trace AM_INIT_AUTOMAKE |
| 1225 |
|
| 1226 |
# ...and AM_INIT_AUTOMAKE is declared... |
| 1227 |
test -n "$func_extract_trace_result" && { |
| 1228 |
automake_version=`$ECHO "$func_extract_trace_result" \ |
| 1229 |
|$SED -e 's|[^0-9]*||' -e 's| .*$||'` |
| 1230 |
test -n "$automake_version" || automake_version=- |
| 1231 |
|
| 1232 |
func_append buildreq "\ |
| 1233 |
automake $automake_version http://www.gnu.org/s/automake |
| 1234 |
" |
| 1235 |
func_verbose \ |
| 1236 |
"auto-adding 'automake-$automake_version' to build requirements" |
| 1237 |
} |
| 1238 |
} |
| 1239 |
|
| 1240 |
require_buildreq_automake=: |
| 1241 |
} |
| 1242 |
|
| 1243 |
|
| 1244 |
# require_buildreq_patch |
| 1245 |
# ---------------------- |
| 1246 |
# Automatically add a patch build-requirement if there are diff files |
| 1247 |
# in $local_gl_path. |
| 1248 |
require_buildreq_patch=func_require_buildreq_patch |
| 1249 |
func_require_buildreq_patch () |
| 1250 |
{ |
| 1251 |
$debug_cmd |
| 1252 |
|
| 1253 |
$require_local_gl_path |
| 1254 |
|
| 1255 |
# This ensures PATCH is set appropriately by the time |
| 1256 |
# func_check_versions enforces $buildreq. |
| 1257 |
$require_patch |
| 1258 |
|
| 1259 |
# If patch is not already listed in $buildreq... |
| 1260 |
printf '%s\n' "$buildreq" |func_grep_q '^[ ]*patch' || { |
| 1261 |
eval "set dummy $local_gl_path_quoted" ; shift |
| 1262 |
|
| 1263 |
for _G_dir |
| 1264 |
do |
| 1265 |
# The ugly find invocation is necessary to exit with non-zero |
| 1266 |
# status for old find binaries that don't support -exec fully. |
| 1267 |
if test ! -d "$_G_dir" \ |
| 1268 |
|| find "$_G_dir" -name "*.diff" -exec false {} \; ; then : |
| 1269 |
else |
| 1270 |
func_append buildreq "patch - http://www.gnu.org/s/patch$nl" |
| 1271 |
break |
| 1272 |
fi |
| 1273 |
done |
| 1274 |
} |
| 1275 |
|
| 1276 |
require_buildreq_patch=: |
| 1277 |
} |
| 1278 |
|
| 1279 |
|
| 1280 |
# require_buildtools_uptodate |
| 1281 |
# --------------------------- |
| 1282 |
# Ensure all the packages listed in BUILDREQS are available on the build |
| 1283 |
# machine at the minimum versions or better. |
| 1284 |
require_buildtools_uptodate=func_require_buildtools_uptodate |
| 1285 |
func_require_buildtools_uptodate () |
| 1286 |
{ |
| 1287 |
$debug_cmd |
| 1288 |
|
| 1289 |
$require_buildreq_autobuild |
| 1290 |
$require_buildreq_autoconf |
| 1291 |
$require_buildreq_automake |
| 1292 |
$require_buildreq_libtoolize |
| 1293 |
$require_buildreq_autopoint |
| 1294 |
$require_buildreq_patch |
| 1295 |
|
| 1296 |
test -n "$buildreq" && { |
| 1297 |
_G_error_hdr= |
| 1298 |
|
| 1299 |
func_check_versions $buildreq |
| 1300 |
$func_check_versions_result || { |
| 1301 |
test -n "$buildreq_readme" \ |
| 1302 |
&& test -f "$buildreq_readme" \ |
| 1303 |
&& _G_error_hdr="\ |
| 1304 |
$buildreq_readme explains how to obtain these prerequisite programs: |
| 1305 |
" |
| 1306 |
func_strtable 0 11 12 36 \ |
| 1307 |
"Program" "Min_version" "Homepage" $buildreq |
| 1308 |
func_fatal_error "$_G_error_hdr$func_strtable_result" |
| 1309 |
} |
| 1310 |
} |
| 1311 |
|
| 1312 |
require_buildtools_uptodate=: |
| 1313 |
} |
| 1314 |
|
| 1315 |
|
| 1316 |
# require_copyright_holder |
| 1317 |
# ------------------------ |
| 1318 |
# Ensure there is a sensible non-empty default value in '$copyright_holder'. |
| 1319 |
require_copyright_holder=func_require_copyright_holder |
| 1320 |
func_require_copyright_holder () |
| 1321 |
{ |
| 1322 |
$debug_cmd |
| 1323 |
|
| 1324 |
test -n "$copyright_holder" || { |
| 1325 |
copyright_holder='Free Software Foundation, Inc.' |
| 1326 |
func_warning settings "\ |
| 1327 |
Please set copyright_holder explicitly in 'bootstrap.conf'; |
| 1328 |
defaulting to '$copyright_holder'." |
| 1329 |
} |
| 1330 |
|
| 1331 |
require_copyright_holder=: |
| 1332 |
} |
| 1333 |
|
| 1334 |
|
| 1335 |
# require_doc_base |
| 1336 |
# ---------------- |
| 1337 |
# Ensure doc_base has a sensible value, extracted from 'gnulib-cache.m4' |
| 1338 |
# if possible, otherwise letting 'gnulib-tool' pick a default. |
| 1339 |
require_doc_base=func_require_doc_base |
| 1340 |
func_require_doc_base () |
| 1341 |
{ |
| 1342 |
$debug_cmd |
| 1343 |
|
| 1344 |
$require_gnulib_cache |
| 1345 |
|
| 1346 |
test -f "$gnulib_cache" && test -z "$doc_base" && { |
| 1347 |
func_extract_trace_first "gl_DOC_BASE" "$gnulib_cache" |
| 1348 |
doc_base=$func_extract_trace_first_result |
| 1349 |
|
| 1350 |
test -n "$doc_base" && func_verbose "doc_base='$doc_base'" |
| 1351 |
} |
| 1352 |
|
| 1353 |
require_doc_base=: |
| 1354 |
} |
| 1355 |
|
| 1356 |
|
| 1357 |
# require_dotgitmodules |
| 1358 |
# --------------------- |
| 1359 |
# Ensure we have a '.gitmodules' file, with appropriate 'gnulib' settings. |
| 1360 |
require_dotgitmodules=func_require_dotgitmodules |
| 1361 |
func_require_dotgitmodules () |
| 1362 |
{ |
| 1363 |
$debug_cmd |
| 1364 |
|
| 1365 |
$require_git |
| 1366 |
|
| 1367 |
test true = "$GIT" || { |
| 1368 |
# A gnulib entry in .gitmodules always takes precedence. |
| 1369 |
_G_path=`$GIT config --file .gitmodules submodule.gnulib.path 2>/dev/null` |
| 1370 |
|
| 1371 |
test -n "$_G_path" || { |
| 1372 |
$require_vc_ignore_files |
| 1373 |
|
| 1374 |
func_verbose "creating '.gitmodules'" |
| 1375 |
|
| 1376 |
# If the .gitmodules file doesn't exist, create it now, and mark |
| 1377 |
# it as ignored for the VCS. |
| 1378 |
test -n "$gnulib_path" || gnulib_path=gnulib |
| 1379 |
test -n "$gnulib_url" || gnulib_url=git://git.sv.gnu.org/gnulib |
| 1380 |
|
| 1381 |
{ |
| 1382 |
echo '[submodule "gnulib"]' |
| 1383 |
echo " path = $gnulib_path" |
| 1384 |
echo " url = $gnulib_url" |
| 1385 |
} >> .gitmodules |
| 1386 |
|
| 1387 |
test -n "$vc_ignore_files" \ |
| 1388 |
|| func_insert_if_absent ".gitmodules" $vc_ignore_files |
| 1389 |
} |
| 1390 |
} |
| 1391 |
|
| 1392 |
require_dotgitmodules=: |
| 1393 |
} |
| 1394 |
|
| 1395 |
|
| 1396 |
# require_extra_locale_categories |
| 1397 |
# ------------------------------- |
| 1398 |
# Ensure there is a default value in '$extra_locale_categories' |
| 1399 |
require_extra_locale_categories=func_require_extra_locale_categories |
| 1400 |
func_require_extra_locale_categories () |
| 1401 |
{ |
| 1402 |
$debug_cmd |
| 1403 |
|
| 1404 |
# Defaults to empty, so run with whatever value may have been set in |
| 1405 |
# 'bootstrap.conf'. |
| 1406 |
require_extra_locale_categories=: |
| 1407 |
} |
| 1408 |
|
| 1409 |
|
| 1410 |
# require_git |
| 1411 |
# ----------- |
| 1412 |
# Ignore git if it's not available, or we're not in a git checkout tree. |
| 1413 |
require_git=func_require_git |
| 1414 |
func_require_git () |
| 1415 |
{ |
| 1416 |
$debug_cmd |
| 1417 |
|
| 1418 |
$opt_skip_git && GIT=true |
| 1419 |
|
| 1420 |
test true = "$GIT" || { |
| 1421 |
if test -d .git/.; then |
| 1422 |
($GIT --version) >/dev/null 2>&1 || GIT=true |
| 1423 |
fi |
| 1424 |
} |
| 1425 |
|
| 1426 |
func_verbose "GIT='$GIT'" |
| 1427 |
|
| 1428 |
require_git=: |
| 1429 |
} |
| 1430 |
|
| 1431 |
|
| 1432 |
# require_gnulib_cache |
| 1433 |
# -------------------- |
| 1434 |
# Ensure there is a non-empty default for '$gnulib_cache', and that it |
| 1435 |
# names an existing file. |
| 1436 |
require_gnulib_cache=func_require_gnulib_cache |
| 1437 |
func_require_gnulib_cache () |
| 1438 |
{ |
| 1439 |
$debug_cmd |
| 1440 |
|
| 1441 |
$require_macro_dir |
| 1442 |
|
| 1443 |
test -n "$gnulib_cache" \ |
| 1444 |
|| gnulib_cache=$macro_dir/gnulib-cache.m4 |
| 1445 |
|
| 1446 |
func_verbose "found '$gnulib_cache'" |
| 1447 |
|
| 1448 |
require_gnulib_cache=: |
| 1449 |
} |
| 1450 |
|
| 1451 |
|
| 1452 |
# require_gnulib_copy_cmd |
| 1453 |
# ----------------------- |
| 1454 |
# Only calculate the options for copying files with gnulib once. |
| 1455 |
require_gnulib_copy_cmd=func_require_gnulib_copy_cmd |
| 1456 |
func_require_gnulib_copy_cmd () |
| 1457 |
{ |
| 1458 |
$debug_cmd |
| 1459 |
|
| 1460 |
$require_gnulib_tool |
| 1461 |
$require_gnulib_tool_base_options |
| 1462 |
|
| 1463 |
gnulib_copy_cmd="$gnulib_tool $gnulib_tool_base_options --copy-file" |
| 1464 |
$opt_copy || func_append gnulib_copy_cmd " --symlink" |
| 1465 |
$opt_quiet || func_append gnulib_copy_cmd " --verbose" |
| 1466 |
|
| 1467 |
require_gnulib_copy_cmd=: |
| 1468 |
} |
| 1469 |
|
| 1470 |
|
| 1471 |
# require_gnulib_merge_changelog |
| 1472 |
# ------------------------------ |
| 1473 |
# See if we can use gnulib's git-merge-changelog merge driver. |
| 1474 |
require_gnulib_merge_changelog=func_require_gnulib_merge_changelog |
| 1475 |
func_require_gnulib_merge_changelog () |
| 1476 |
{ |
| 1477 |
$debug_cmd |
| 1478 |
|
| 1479 |
test -f ChangeLog && { |
| 1480 |
$require_git |
| 1481 |
|
| 1482 |
func_grep_q '^\(/\|\)ChangeLog$' .gitignore || test true = "$GIT" || { |
| 1483 |
if $GIT config merge.merge-changelog.driver >/dev/null; then |
| 1484 |
: |
| 1485 |
elif (git-merge-changelog --version) >/dev/null 2>&1; then |
| 1486 |
func_echo "initializing git-merge-changelog driver" |
| 1487 |
$GIT config merge.merge-changelog.name 'GNU-style ChangeLog merge driver' |
| 1488 |
$GIT config merge.merge-changelog.driver 'git-merge-changelog %O %A %B' |
| 1489 |
else |
| 1490 |
func_warning recommend \ |
| 1491 |
"Consider installing git-merge-changelog from gnulib." |
| 1492 |
fi |
| 1493 |
} |
| 1494 |
} |
| 1495 |
|
| 1496 |
require_gnulib_merge_changelog=: |
| 1497 |
} |
| 1498 |
|
| 1499 |
|
| 1500 |
# require_gnulib_mk |
| 1501 |
# ----------------- |
| 1502 |
# Ensure gnulib_mk has a sensible value, extracted from 'gnulib-cache.m4' |
| 1503 |
# if possible, otherwise letting 'gnulib-tool' pick a default. |
| 1504 |
require_gnulib_mk=func_require_gnulib_mk |
| 1505 |
func_require_gnulib_mk () |
| 1506 |
{ |
| 1507 |
$debug_cmd |
| 1508 |
|
| 1509 |
$require_gnulib_cache |
| 1510 |
|
| 1511 |
test -f "$gnulib_cache" && test -z "$gnulib_mk" && { |
| 1512 |
func_extract_trace_first "gl_MAKEFILE_NAME" "$gnulib_cache" |
| 1513 |
gnulib_mk=$func_extract_trace_first_result |
| 1514 |
|
| 1515 |
test -n "$gnulib_mk" && func_verbose "gnulib_mk='$gnulib_mk'" |
| 1516 |
} |
| 1517 |
|
| 1518 |
require_gnulib_mk=: |
| 1519 |
} |
| 1520 |
|
| 1521 |
|
| 1522 |
# require_gnulib_name |
| 1523 |
# ------------------- |
| 1524 |
# Ensure gnulib_name has a sensible value, extracted from 'gnulib-cache.m4' |
| 1525 |
# if possible, otherwise letting 'gnulib-tool' pick a default. |
| 1526 |
require_gnulib_name=func_require_gnulib_name |
| 1527 |
func_require_gnulib_name () |
| 1528 |
{ |
| 1529 |
$debug_cmd |
| 1530 |
|
| 1531 |
$require_gnulib_cache |
| 1532 |
|
| 1533 |
test -f "$gnulib_cache" && test -z "$gnulib_name" && { |
| 1534 |
func_extract_trace_first "gl_LIB" "$gnulib_cache" |
| 1535 |
gnulib_name=$func_extract_trace_first_result |
| 1536 |
|
| 1537 |
test -n "$gnulib_name" && func_verbose "gnulib_name='$gnulib_name'" |
| 1538 |
} |
| 1539 |
|
| 1540 |
require_gnulib_name=: |
| 1541 |
} |
| 1542 |
|
| 1543 |
|
| 1544 |
# require_gnulib_path |
| 1545 |
# require_gnulib_url |
| 1546 |
# ------------------- |
| 1547 |
# Ensure 'gnulib_path' and 'gnulib_url' are set. |
| 1548 |
require_gnulib_path=func_require_dotgitmodules_parameters |
| 1549 |
require_gnulib_url=func_require_dotgitmodules_parameters |
| 1550 |
func_require_dotgitmodules_parameters () |
| 1551 |
{ |
| 1552 |
$debug_cmd |
| 1553 |
|
| 1554 |
$require_git |
| 1555 |
|
| 1556 |
test true = "$GIT" && { |
| 1557 |
# If we can't find git (or if the user specified '--skip-git'), |
| 1558 |
# then use an existing gnulib directory specified with |
| 1559 |
# '--gnulib-srcdir' if possible. |
| 1560 |
test -n "$gnulib_path" \ |
| 1561 |
|| test ! -x "$opt_gnulib_srcdir/gnulib-tool" \ |
| 1562 |
|| gnulib_path=$opt_gnulib_srcdir |
| 1563 |
} |
| 1564 |
|
| 1565 |
|
| 1566 |
$require_dotgitmodules |
| 1567 |
|
| 1568 |
test -f .gitmodules && { |
| 1569 |
# Extract the parameters with sed, since git may be missing |
| 1570 |
test -n "$gnulib_path" \ |
| 1571 |
|| gnulib_path=`$SED -e '/^.submodule "gnulib".$/,${ |
| 1572 |
/[ ]*path *= */{ |
| 1573 |
s|[ ]*||g;s|^[^=]*=||;p |
| 1574 |
} |
| 1575 |
} |
| 1576 |
d' .gitmodules |$SED 1q` |
| 1577 |
test -n "$gnulib_url" \ |
| 1578 |
|| gnulib_url=`$SED -e '/^.submodule "gnulib".$/,${ |
| 1579 |
/[ ]*url *= */{ |
| 1580 |
s|[ ]*||g;s|^[^=]*=||;p |
| 1581 |
} |
| 1582 |
} |
| 1583 |
d' .gitmodules |$SED 1q` |
| 1584 |
|
| 1585 |
func_verbose "gnulib_path='$gnulib_path'" |
| 1586 |
func_verbose "gnulib_url='$gnulib_url'" |
| 1587 |
} |
| 1588 |
|
| 1589 |
require_gnulib_path=: |
| 1590 |
require_gnulib_url=: |
| 1591 |
} |
| 1592 |
|
| 1593 |
|
| 1594 |
# require_gnulib_submodule |
| 1595 |
# ------------------------ |
| 1596 |
# Ensure that there is a current gnulib submodule at '$gnulib_path'. |
| 1597 |
require_gnulib_submodule=func_require_gnulib_submodule |
| 1598 |
func_require_gnulib_submodule () |
| 1599 |
{ |
| 1600 |
$debug_cmd |
| 1601 |
|
| 1602 |
$require_git |
| 1603 |
|
| 1604 |
if test true = "$GIT"; then |
| 1605 |
func_warning recommend \ |
| 1606 |
"No 'git' found; imported gnulib modules may be outdated." |
| 1607 |
else |
| 1608 |
$require_gnulib_path |
| 1609 |
$require_gnulib_url |
| 1610 |
|
| 1611 |
if test -f .gitmodules && test -f "$gnulib_path/gnulib-tool"; then |
| 1612 |
: All present and correct. |
| 1613 |
|
| 1614 |
elif test -n "$opt_gnulib_srcdir"; then |
| 1615 |
# Older git can't clone into an empty directory. |
| 1616 |
rmdir "$gnulib_path" 2>/dev/null |
| 1617 |
func_show_eval "$GIT clone --reference '$opt_gnulib_srcdir' \ |
| 1618 |
'$gnulib_url' '$gnulib_path'" \ |
| 1619 |
|| func_fatal_error "Unable to fetch gnulib submodule." |
| 1620 |
|
| 1621 |
# Without --gnulib-srcdir, and no existing checked out submodule, we |
| 1622 |
# create a new shallow clone of the remote gnulib repository. |
| 1623 |
else |
| 1624 |
trap func_cleanup_gnulib 1 2 13 15 |
| 1625 |
|
| 1626 |
shallow= |
| 1627 |
test -n "$gnulib_clone_since" && \ |
| 1628 |
$GIT clone -h 2>&1 |func_grep_q -- --shallow-since \ |
| 1629 |
&& shallow="--shallow-since=$gnulib_clone_since" |
| 1630 |
|
| 1631 |
func_show_eval "$GIT clone $shallow '$gnulib_url' '$gnulib_path'" \ |
| 1632 |
func_cleanup_gnulib |
| 1633 |
|
| 1634 |
# FIXME: Solaris /bin/sh will try to execute '-' if any of |
| 1635 |
# these signals are caught after this. |
| 1636 |
trap - 1 2 13 15 |
| 1637 |
fi |
| 1638 |
|
| 1639 |
# Make sure we've checked out the correct revision of gnulib. |
| 1640 |
func_show_eval "$GIT submodule init -- $gnulib_path" \ |
| 1641 |
&& func_show_eval "$GIT submodule update -- $gnulib_path" \ |
| 1642 |
|| func_fatal_error "Unable to update gnulib submodule." |
| 1643 |
fi |
| 1644 |
|
| 1645 |
require_gnulib_submodule=: |
| 1646 |
} |
| 1647 |
|
| 1648 |
|
| 1649 |
# require_gnulib_tool |
| 1650 |
# ------------------- |
| 1651 |
# Ensure that '$gnulib_tool' is set, and points to an executable file, |
| 1652 |
# or else fall back to using the binary 'true' if the main gnulib |
| 1653 |
# files appear to have been imported already. |
| 1654 |
require_gnulib_tool=func_require_gnulib_tool |
| 1655 |
func_require_gnulib_tool () |
| 1656 |
{ |
| 1657 |
$debug_cmd |
| 1658 |
|
| 1659 |
test true = "$gnulib_tool" || { |
| 1660 |
$require_gnulib_submodule |
| 1661 |
$require_gnulib_path |
| 1662 |
|
| 1663 |
test -n "$gnulib_tool" \ |
| 1664 |
|| gnulib_tool=$gnulib_path/gnulib-tool |
| 1665 |
|
| 1666 |
test -x "$gnulib_tool" || { |
| 1667 |
gnulib_tool=true |
| 1668 |
func_warning recommend \ |
| 1669 |
"No 'gnulib-tool' found; gnulib modules may be missing." |
| 1670 |
} |
| 1671 |
|
| 1672 |
test true = "$gnulib_tool" \ |
| 1673 |
|| func_verbose "found '$gnulib_tool'" |
| 1674 |
} |
| 1675 |
|
| 1676 |
require_gnulib_tool=: |
| 1677 |
} |
| 1678 |
|
| 1679 |
|
| 1680 |
# require_gnulib_tool_base_options |
| 1681 |
# -------------------------------- |
| 1682 |
# Ensure that '$gnulib_tool_base_options' contains all the base options |
| 1683 |
# required according to user configuration from bootstrap.conf. |
| 1684 |
require_gnulib_tool_base_options=func_require_gnulib_tool_base_options |
| 1685 |
func_require_gnulib_tool_base_options () |
| 1686 |
{ |
| 1687 |
$debug_cmd |
| 1688 |
|
| 1689 |
$require_gnulib_tool |
| 1690 |
|
| 1691 |
gnulib_tool_base_options= |
| 1692 |
|
| 1693 |
test true = "$gnulib_tool" || { |
| 1694 |
# 'gnulib_modules' and others are maintained in 'bootstrap.conf': |
| 1695 |
# Use 'gnulib --import' to fetch gnulib modules. |
| 1696 |
$require_build_aux |
| 1697 |
test -n "$build_aux" \ |
| 1698 |
&& func_append_uniq gnulib_tool_base_options " --aux-dir=$build_aux" |
| 1699 |
$require_macro_dir |
| 1700 |
test -n "$macro_dir" \ |
| 1701 |
&& func_append_uniq gnulib_tool_base_options " --m4-base=$macro_dir" |
| 1702 |
$require_doc_base |
| 1703 |
test -n "$doc_base" \ |
| 1704 |
&& func_append_uniq gnulib_tool_base_options " --doc-base=$doc_base" |
| 1705 |
$require_gnulib_name |
| 1706 |
test -n "$gnulib_name" \ |
| 1707 |
&& func_append_uniq gnulib_tool_base_options " --lib=$gnulib_name" |
| 1708 |
$require_local_gl_path |
| 1709 |
test -n "$local_gl_path" && { |
| 1710 |
eval "set dummy $local_gl_path_quoted" ; shift |
| 1711 |
for _G_dir |
| 1712 |
do |
| 1713 |
func_append_uniq gnulib_tool_base_options " --local-dir=$_G_dir" |
| 1714 |
done |
| 1715 |
} |
| 1716 |
$require_source_base |
| 1717 |
test -n "$source_base" \ |
| 1718 |
&& func_append_uniq gnulib_tool_base_options " --source-base=$source_base" |
| 1719 |
} |
| 1720 |
|
| 1721 |
require_gnulib_tool_base_options=: |
| 1722 |
} |
| 1723 |
|
| 1724 |
|
| 1725 |
# require_libtoolize |
| 1726 |
# ------------------ |
| 1727 |
# Skip libtoolize if it's not needed. |
| 1728 |
require_libtoolize=func_require_libtoolize |
| 1729 |
func_require_libtoolize () |
| 1730 |
{ |
| 1731 |
$debug_cmd |
| 1732 |
|
| 1733 |
# Unless we're not searching for libtool use by this package, set |
| 1734 |
# LIBTOOLIZE to true if none of 'LT_INIT', 'AC_PROG_LIBTOOL' and |
| 1735 |
# 'AM_PROG_LIBTOOL' are used in configure. |
| 1736 |
test true = "$LIBTOOLIZE" || { |
| 1737 |
func_extract_trace LT_INIT |
| 1738 |
test -n "$func_extract_trace_result" || func_extract_trace AC_PROG_LIBTOOL |
| 1739 |
test -n "$func_extract_trace_result" || func_extract_trace AM_PROG_LIBTOOL |
| 1740 |
test -n "$func_extract_trace_result" || LIBTOOLIZE=true |
| 1741 |
} |
| 1742 |
|
| 1743 |
test -n "$LIBTOOLIZE" || { |
| 1744 |
# Find libtoolize, named glibtoolize in Mac Ports, but prefer |
| 1745 |
# user-installed libtoolize to ancient glibtoolize shipped by |
| 1746 |
# Apple with Mac OS X when Mac Ports is not installed. |
| 1747 |
func_find_tool LIBTOOLIZE libtoolize glibtoolize |
| 1748 |
} |
| 1749 |
|
| 1750 |
test -n "$LIBTOOLIZE" || func_fatal_error "\ |
| 1751 |
Please install GNU Libtool, or 'export LIBTOOLIZE=/path/to/libtoolize'." |
| 1752 |
|
| 1753 |
func_verbose "export LIBTOOLIZE='$LIBTOOLIZE'" |
| 1754 |
|
| 1755 |
# Make sure the search result is visible to subshells |
| 1756 |
export LIBTOOLIZE |
| 1757 |
|
| 1758 |
require_libtoolize=: |
| 1759 |
} |
| 1760 |
|
| 1761 |
|
| 1762 |
# require_local_gl_path |
| 1763 |
# --------------------- |
| 1764 |
# Ensure local_gl_path has a sensible value, extracted from 'gnulib-cache.m4' if |
| 1765 |
# possible, otherwise letting 'gnulib-tool' pick a default. |
| 1766 |
require_local_gl_path=func_require_local_gl_path |
| 1767 |
func_require_local_gl_path () |
| 1768 |
{ |
| 1769 |
$debug_cmd |
| 1770 |
|
| 1771 |
$require_gnulib_cache |
| 1772 |
|
| 1773 |
# Compat with older bootstrap versions. |
| 1774 |
test -n "$local_gl_dir" && { |
| 1775 |
func_warning settings "\ |
| 1776 |
Please use 'local_gl_path' instead of 'local_gl_dir' in your |
| 1777 |
'bootstrap.conf' file." |
| 1778 |
local_gl_path=$local_gl_dir |
| 1779 |
local_gl_dir= |
| 1780 |
} |
| 1781 |
|
| 1782 |
test -f "$gnulib_cache" && test -z "$local_gl_path" && { |
| 1783 |
func_extract_trace_first "gl_LOCAL_DIR" "$gnulib_cache" |
| 1784 |
local_gl_path=$func_extract_trace_first_result |
| 1785 |
test -n "$local_gl_path" && func_verbose "local_gl_path='$local_gl_path'" |
| 1786 |
} |
| 1787 |
|
| 1788 |
test -z "$local_gl_path_quoted" && test -n "$local_gl_path" && { |
| 1789 |
save_IFS=$IFS |
| 1790 |
set dummy |
| 1791 |
# Don't use PATH_SEPARATOR here, gnulib must be fixed to store only ':' as |
| 1792 |
# path separator into gnulib-cache.m4 (consistency reasons among systems). |
| 1793 |
IFS=: |
| 1794 |
for _G_dir in $local_gl_path |
| 1795 |
do |
| 1796 |
set "$@" "$_G_dir" |
| 1797 |
done |
| 1798 |
shift |
| 1799 |
IFS=$save_IFS |
| 1800 |
func_quote eval "$@" |
| 1801 |
local_gl_path_quoted=$func_quote_result |
| 1802 |
} |
| 1803 |
|
| 1804 |
require_local_gl_path=: |
| 1805 |
} |
| 1806 |
|
| 1807 |
|
| 1808 |
# require_macro_dir |
| 1809 |
# ----------------- |
| 1810 |
# Ensure that '$macro_dir' is set, and if it doesn't already point to an |
| 1811 |
# existing directory, create one. |
| 1812 |
require_macro_dir=func_require_macro_dir |
| 1813 |
func_require_macro_dir () |
| 1814 |
{ |
| 1815 |
$debug_cmd |
| 1816 |
|
| 1817 |
# Sometimes this is stored in 'configure.ac'. |
| 1818 |
test -n "$macro_dir" || { |
| 1819 |
# AC_CONFIG_MACRO_DIRS takes a space delimited list of directories, |
| 1820 |
# but we only care about the first one in bootstrap. |
| 1821 |
func_extract_trace_first AC_CONFIG_MACRO_DIRS |
| 1822 |
macro_dir=`expr "x$func_extract_trace_first_result" : 'x\([^ ]*\)'` |
| 1823 |
} |
| 1824 |
test -n "$macro_dir" || { |
| 1825 |
func_extract_trace_first AC_CONFIG_MACRO_DIR |
| 1826 |
macro_dir=$func_extract_trace_first_result |
| 1827 |
} |
| 1828 |
|
| 1829 |
# Otherwise we might find it in 'Makefile.am'. |
| 1830 |
test -n "$macro_dir" || { |
| 1831 |
$require_aclocal_amflags |
| 1832 |
|
| 1833 |
# Take the argument following the first '-I', if any. |
| 1834 |
_G_minus_I_seen=false |
| 1835 |
for _G_arg in $aclocal_amflags; do |
| 1836 |
case $_G_minus_I_seen,$_G_arg in |
| 1837 |
:,*) macro_dir=$_G_arg; break ;; |
| 1838 |
*,-I) _G_minus_I_seen=: ;; |
| 1839 |
*,-I*) macro_dir=`expr x$_G_arg : 'x-I\(.*\)$'`; break ;; |
| 1840 |
esac |
| 1841 |
done |
| 1842 |
} |
| 1843 |
|
| 1844 |
func_verbose "macro_dir='$macro_dir'" |
| 1845 |
|
| 1846 |
func_check_configuration macro_dir \ |
| 1847 |
"AC_CONFIG_MACRO_DIRS([name of a directory for configure m4 files])" |
| 1848 |
|
| 1849 |
$require_vc_ignore_files |
| 1850 |
|
| 1851 |
# If the macro_dir directory doesn't exist, create it now, and mark it |
| 1852 |
# as ignored for the VCS. |
| 1853 |
if test ! -d "$macro_dir"; then |
| 1854 |
mkdir "$macro_dir" || func_permissions_error "$macro_dir" |
| 1855 |
|
| 1856 |
test -n "$vc_ignore_files" \ |
| 1857 |
|| func_insert_if_absent "$macro_dir" $vc_ignore_files |
| 1858 |
fi |
| 1859 |
|
| 1860 |
require_macro_dir=: |
| 1861 |
} |
| 1862 |
|
| 1863 |
|
| 1864 |
# require_makefile_am |
| 1865 |
# ------------------- |
| 1866 |
# Ensure there is a 'Makefile.am' in the current directory. |
| 1867 |
require_makefile_am=func_require_makefile_am |
| 1868 |
func_require_makefile_am () |
| 1869 |
{ |
| 1870 |
$debug_cmd |
| 1871 |
|
| 1872 |
test -n "$makefile_am" \ |
| 1873 |
|| makefile_am=Makefile.am |
| 1874 |
|
| 1875 |
<"$makefile_am" |
| 1876 |
|
| 1877 |
func_verbose "found '$makefile_am'" |
| 1878 |
|
| 1879 |
require_makefile_am=: |
| 1880 |
} |
| 1881 |
|
| 1882 |
|
| 1883 |
# require_package |
| 1884 |
# --------------- |
| 1885 |
# Ensure that '$package' contains a sensible default value. |
| 1886 |
require_package=func_require_package |
| 1887 |
func_require_package () |
| 1888 |
{ |
| 1889 |
$debug_cmd |
| 1890 |
|
| 1891 |
test -n "$package" || { |
| 1892 |
$require_package_name |
| 1893 |
|
| 1894 |
package=`echo "$package_name" \ |
| 1895 |
|$SED -e 's/GNU //' \ |
| 1896 |
-e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` |
| 1897 |
} |
| 1898 |
|
| 1899 |
func_verbose "package='$package'" |
| 1900 |
|
| 1901 |
require_package=: |
| 1902 |
} |
| 1903 |
|
| 1904 |
|
| 1905 |
# require_package_bugreport |
| 1906 |
# ------------------------- |
| 1907 |
# Ensure that this has a sensible value, extracted from 'configure.ac' |
| 1908 |
# if appropriate (and possible!). |
| 1909 |
require_package_bugreport=func_require_package_bugreport |
| 1910 |
func_require_package_bugreport () |
| 1911 |
{ |
| 1912 |
$debug_cmd |
| 1913 |
|
| 1914 |
func_extract_trace AC_INIT |
| 1915 |
|
| 1916 |
save_ifs=$IFS |
| 1917 |
IFS=: |
| 1918 |
set dummy $func_extract_trace_result |
| 1919 |
IFS=$save_ifs |
| 1920 |
shift |
| 1921 |
|
| 1922 |
test -n "$package_bugreport" || package_bugreport=$3 |
| 1923 |
func_check_configuration package_bugreport \ |
| 1924 |
"AC_INIT([$package_name], [$package_version], [[email protected]])" |
| 1925 |
func_verbose "package_bugreport='$package_bugreport'" |
| 1926 |
|
| 1927 |
require_package_bugreport=: |
| 1928 |
} |
| 1929 |
|
| 1930 |
|
| 1931 |
# require_package_name |
| 1932 |
# -------------------- |
| 1933 |
# Ensure that this has a sensible value, extracted from 'configure.ac' |
| 1934 |
# if appropriate (and possible!). |
| 1935 |
require_package_name=func_require_package_name |
| 1936 |
func_require_package_name () |
| 1937 |
{ |
| 1938 |
$debug_cmd |
| 1939 |
|
| 1940 |
func_extract_trace AC_INIT |
| 1941 |
|
| 1942 |
save_ifs=$IFS |
| 1943 |
IFS=: |
| 1944 |
set dummy $func_extract_trace_result |
| 1945 |
IFS=$save_ifs |
| 1946 |
shift |
| 1947 |
|
| 1948 |
test -n "$package_name" || package_name=$1 |
| 1949 |
func_check_configuration package_name \ |
| 1950 |
"AC_INIT([name of your package], [package version number])" |
| 1951 |
func_verbose "package_name='$package_name'" |
| 1952 |
|
| 1953 |
require_package_name=: |
| 1954 |
} |
| 1955 |
|
| 1956 |
|
| 1957 |
# require_package_version |
| 1958 |
# ----------------------- |
| 1959 |
# Ensure that this has a sensible value, extracted from 'configure.ac' |
| 1960 |
# if appropriate (and possible!). While we might have set all the |
| 1961 |
# parameters extracted from AC_INIT at once, 'package_version' in |
| 1962 |
# particular is not necessarily available as early as the others, since |
| 1963 |
# 'git-version-gen' is often involved, and until then we can't rely on |
| 1964 |
# getting a correct version number from an AC_INIT extraction. |
| 1965 |
require_package_version=func_require_package_version |
| 1966 |
func_require_package_version () |
| 1967 |
{ |
| 1968 |
$debug_cmd |
| 1969 |
|
| 1970 |
func_extract_trace AC_INIT |
| 1971 |
|
| 1972 |
save_ifs=$IFS |
| 1973 |
IFS=: |
| 1974 |
set dummy $func_extract_trace_result |
| 1975 |
IFS=$save_ifs |
| 1976 |
shift |
| 1977 |
|
| 1978 |
test -n "$package_version" || package_version=$2 |
| 1979 |
test -n "$package_version" || { |
| 1980 |
# The embedded echo is to squash whitespace before globbing. |
| 1981 |
case " "`echo $gnulib_modules`" " in |
| 1982 |
*" git-version-gen "*) |
| 1983 |
func_fatal_error "\ |
| 1984 |
cannot \$require_package_version in bootstrap.conf before |
| 1985 |
func_gnulib_tool has installed the 'git-version-gen' script." |
| 1986 |
;; |
| 1987 |
*) |
| 1988 |
func_check_configuration package_version \ |
| 1989 |
"AC_INIT([name of your package], [package version number])" |
| 1990 |
;; |
| 1991 |
esac |
| 1992 |
} |
| 1993 |
func_verbose "package_version='$package_version'" |
| 1994 |
|
| 1995 |
require_package_version=: |
| 1996 |
} |
| 1997 |
|
| 1998 |
|
| 1999 |
# require_patch |
| 2000 |
# ------------- |
| 2001 |
# Find patch, according to the PATCH environment variable, or else |
| 2002 |
# searching the user's PATH. |
| 2003 |
require_patch=func_require_patch |
| 2004 |
func_require_patch () |
| 2005 |
{ |
| 2006 |
$debug_cmd |
| 2007 |
|
| 2008 |
test -n "$PATCH" || { |
| 2009 |
# Find a patch program, preferring gpatch, which is usually better |
| 2010 |
# than the vendor patch. |
| 2011 |
func_find_tool PATCH gpatch patch |
| 2012 |
} |
| 2013 |
|
| 2014 |
test -n "$PATCH" || func_fatal_error "\ |
| 2015 |
Please install GNU Patch, or 'export PATCH=/path/to/gnu/patch'." |
| 2016 |
|
| 2017 |
func_verbose "export PATCH='$PATCH'" |
| 2018 |
|
| 2019 |
# Make sure the search result is visible to subshells |
| 2020 |
export PATCH |
| 2021 |
|
| 2022 |
require_patch=: |
| 2023 |
} |
| 2024 |
|
| 2025 |
|
| 2026 |
# require_source_base |
| 2027 |
# ------------------- |
| 2028 |
# Ensure that source_base has a sensible value, extracted from |
| 2029 |
# 'gnulib-cache.m4' if possible. |
| 2030 |
require_source_base=func_require_source_base |
| 2031 |
func_require_source_base () |
| 2032 |
{ |
| 2033 |
$debug_cmd |
| 2034 |
|
| 2035 |
$require_gnulib_cache |
| 2036 |
|
| 2037 |
test -f "$gnulib_cache" && test -z "$source_base" && { |
| 2038 |
func_extract_trace_first "gl_SOURCE_BASE" "$gnulib_cache" |
| 2039 |
|
| 2040 |
source_base=$func_extract_trace_first_result |
| 2041 |
|
| 2042 |
func_verbose "source_base='$source_base'" |
| 2043 |
} |
| 2044 |
|
| 2045 |
require_source_base=: |
| 2046 |
} |
| 2047 |
|
| 2048 |
|
| 2049 |
# require_vc_ignore_files |
| 2050 |
# ----------------------- |
| 2051 |
# Ensure that '$vc_ignore' has been processed to list VCS ignore files |
| 2052 |
# in '$vc_ignore_files' |
| 2053 |
require_vc_ignore_files=func_require_vc_ignore_files |
| 2054 |
func_require_vc_ignore_files () |
| 2055 |
{ |
| 2056 |
$debug_cmd |
| 2057 |
|
| 2058 |
test -n "$vc_ignore" || vc_ignore=auto |
| 2059 |
|
| 2060 |
if test auto = "$vc_ignore" && test -z "$vc_ignore_files"; then |
| 2061 |
vc_ignore_files= |
| 2062 |
test -d .git && vc_ignore_files=.gitignore |
| 2063 |
test -d CVS && vc_ignore_files="$vc_ignore_files .cvsignore" |
| 2064 |
else |
| 2065 |
vc_ignore_files=$vc_ignore |
| 2066 |
fi |
| 2067 |
|
| 2068 |
func_verbose "vc_ignore_files='$vc_ignore_files'" |
| 2069 |
|
| 2070 |
require_vc_ignore_files=: |
| 2071 |
} |
| 2072 |
|
| 2073 |
|
| 2074 |
## ----------------- ## |
| 2075 |
## Helper functions. ## |
| 2076 |
## ----------------- ## |
| 2077 |
|
| 2078 |
# This section contains the helper functions used by the rest of 'bootstrap'. |
| 2079 |
|
| 2080 |
# func_len STRING |
| 2081 |
# --------------- |
| 2082 |
# STRING may not start with a hyphen. |
| 2083 |
if (eval 'x=123; test x${#x} = "x3"') 2>/dev/null |
| 2084 |
then |
| 2085 |
# This is an XSI compatible shell, allowing a faster implementation... |
| 2086 |
eval 'func_len () |
| 2087 |
{ |
| 2088 |
$debug_cmd |
| 2089 |
|
| 2090 |
func_len_result=${#1} |
| 2091 |
}' |
| 2092 |
else |
| 2093 |
# ...otherwise fall back to using expr, which is often a shell builtin. |
| 2094 |
func_len () |
| 2095 |
{ |
| 2096 |
$debug_cmd |
| 2097 |
|
| 2098 |
func_len_result=`expr "$1" : ".*" 2>/dev/null || echo 0` |
| 2099 |
} |
| 2100 |
fi |
| 2101 |
|
| 2102 |
|
| 2103 |
# func_cmp_s FILE1 FILE2 |
| 2104 |
# ---------------------- |
| 2105 |
# Return non-zero exit status unless FILE1 and FILE2 are identical, without |
| 2106 |
# any output at all, even error messages. |
| 2107 |
func_cmp_s () |
| 2108 |
{ |
| 2109 |
$debug_cmd |
| 2110 |
|
| 2111 |
# This function relies on non-zero exit status, which will cause the |
| 2112 |
# program to exit when running in 'set -e' mode. |
| 2113 |
$CMP "$@" >/dev/null 2>&1 |
| 2114 |
} |
| 2115 |
|
| 2116 |
|
| 2117 |
# func_grep_q EXPRESSION [FILENAME..] |
| 2118 |
# ----------------------------------- |
| 2119 |
# Check whether EXPRESSION matches any line of any listed FILENAME, |
| 2120 |
# without any output at all, even error messages. |
| 2121 |
func_grep_q () |
| 2122 |
{ |
| 2123 |
$debug_cmd |
| 2124 |
|
| 2125 |
# This function relies on non-zero exit status, which will cause the |
| 2126 |
# program to exit when running in 'set -e' mode. |
| 2127 |
$GREP "$@" >/dev/null 2>&1 |
| 2128 |
} |
| 2129 |
|
| 2130 |
|
| 2131 |
# func_ifcontains LIST MEMBER YES-CMD [NO-CMD] |
| 2132 |
# -------------------------------------------- |
| 2133 |
# If whitespace-separated LIST contains MEMBER then execute YES-CMD, |
| 2134 |
# otherwise if NO-CMD was given, execute that. |
| 2135 |
func_ifcontains () |
| 2136 |
{ |
| 2137 |
$debug_cmd |
| 2138 |
|
| 2139 |
_G_wslist=$1 |
| 2140 |
_G_member=$2 |
| 2141 |
_G_yes_cmd=$3 |
| 2142 |
_G_no_cmd=${4-":"} |
| 2143 |
|
| 2144 |
_G_found=false |
| 2145 |
for _G_item in $_G_wslist; do |
| 2146 |
test "x$_G_item" = "x$_G_member" && { |
| 2147 |
_G_found=: |
| 2148 |
break |
| 2149 |
} |
| 2150 |
done |
| 2151 |
if $_G_found; then |
| 2152 |
eval "$_G_yes_cmd" |
| 2153 |
_G_status=$? |
| 2154 |
else |
| 2155 |
eval "$_G_no_cmd" |
| 2156 |
_G_status=$? |
| 2157 |
fi |
| 2158 |
|
| 2159 |
test 0 -eq "$_G_status" || exit $_G_status |
| 2160 |
} |
| 2161 |
|
| 2162 |
|
| 2163 |
# func_strpad STR WIDTH CHAR |
| 2164 |
# -------------------------- |
| 2165 |
# Trim STR, or pad with CHAR to force a total length of WIDTH. |
| 2166 |
func_strpad () |
| 2167 |
{ |
| 2168 |
$debug_cmd |
| 2169 |
|
| 2170 |
_G_width=`expr "$2" - 1` |
| 2171 |
func_strpad_result=`$ECHO "$1" |$SED ' |
| 2172 |
:a |
| 2173 |
s|^.\{0,'"$_G_width"'\}$|&'"$3"'| |
| 2174 |
ta |
| 2175 |
'` |
| 2176 |
} |
| 2177 |
|
| 2178 |
|
| 2179 |
# func_strrpad STR WIDTH CHAR |
| 2180 |
# --------------------------- |
| 2181 |
# Trim STR, or right-justify-pad with CHAR to force a total length of |
| 2182 |
# WIDTH. |
| 2183 |
func_strrpad () |
| 2184 |
{ |
| 2185 |
$debug_cmd |
| 2186 |
|
| 2187 |
_G_width=`expr "$2" - 1` |
| 2188 |
func_strrpad_result=`$ECHO "$1" |$SED ' |
| 2189 |
:a |
| 2190 |
s|^.\{0,'"$_G_width"'\}$|'"$3"'&| |
| 2191 |
ta |
| 2192 |
'` |
| 2193 |
} |
| 2194 |
|
| 2195 |
|
| 2196 |
# func_strrow INDENT FIELD WIDTH [FIELDn WIDTHn]... |
| 2197 |
# ------------------------------------------------- |
| 2198 |
# Return a string containing each FIELD left justified to WIDTH, with |
| 2199 |
# the whole thing indented by INDENT spaces. This function is used to |
| 2200 |
# render one row of aligned columns for a table by func_strtable(). |
| 2201 |
func_strrow () |
| 2202 |
{ |
| 2203 |
$debug_cmd |
| 2204 |
|
| 2205 |
func_strrow_linelen=$1; shift |
| 2206 |
|
| 2207 |
_G_row= |
| 2208 |
while test $# -gt 0; do |
| 2209 |
func_strrow_linelen=`expr $func_strrow_linelen + $2` |
| 2210 |
func_strpad "$1" $2 " " |
| 2211 |
func_append _G_row "$func_strpad_result" |
| 2212 |
shift; shift |
| 2213 |
done |
| 2214 |
|
| 2215 |
func_strrpad "$_G_row" $func_strrow_linelen " " |
| 2216 |
func_strrow_result=$func_strrpad_result |
| 2217 |
} |
| 2218 |
|
| 2219 |
|
| 2220 |
# func_strtable INDENT WIDTH1...WIDTHn HEADER1...HEADERn FIELD1...FIELDn |
| 2221 |
# ---------------------------------------------------------------------- |
| 2222 |
# Generate a string of newline-separated rows arranged in lined-up |
| 2223 |
# columns of the given WIDTHs, with the entire table indented by INDENT |
| 2224 |
# spaces. The number of columns is determined by the number of integer |
| 2225 |
# valued WIDTH arguments following INDENT. The next set (i.e. a number |
| 2226 |
# of arguments equal to the number of WIDTH arguments) of fields are |
| 2227 |
# treated as the table's column HEADERs, and are separated from the |
| 2228 |
# remainder of the table by an indented row of '-' characters. Remaining |
| 2229 |
# arguments are each aligned below the next available header, wrapping |
| 2230 |
# to a new row as necessary. Finally another row of '-' characters is |
| 2231 |
# added to mark the end of the table. |
| 2232 |
# |
| 2233 |
# For example an unindented 3 column table with 2 rows of data would be |
| 2234 |
# generated by this call: |
| 2235 |
# |
| 2236 |
# func_strtable 3 20 10 25 \ |
| 2237 |
# Header1 Header2 Header3 \ |
| 2238 |
# Row1Col1 Row1Col2 Row1Col3 \ |
| 2239 |
# Row2Col1 Row2Col2 Row2Col3 |
| 2240 |
# |
| 2241 |
# returning the following string: |
| 2242 |
# |
| 2243 |
# " Header1 Header2 Header3 |
| 2244 |
# ------------------------------------------------------- |
| 2245 |
# Row1Col1 Row1Col2 Row1Col3 |
| 2246 |
# Row2Col1 Row2Col2 Row2Col3 |
| 2247 |
# -------------------------------------------------------" |
| 2248 |
func_strtable () |
| 2249 |
{ |
| 2250 |
$debug_cmd |
| 2251 |
|
| 2252 |
# Save the indent value, we'll need it for each row we render. |
| 2253 |
_G_indent=$1; shift |
| 2254 |
|
| 2255 |
# Collect remaining numeric args into a list for reuse between |
| 2256 |
# members of each row when we call func_strrow later. |
| 2257 |
_G_widths=$1; shift |
| 2258 |
while test 0 -lt `expr "$1" : '[1-9][0-9]*$'`; do |
| 2259 |
func_append _G_widths " $1"; shift |
| 2260 |
done |
| 2261 |
|
| 2262 |
# Extract the same number of positional parameters as there are |
| 2263 |
# width elements - we'll do the header rows separately so that |
| 2264 |
# we can insert a divider line. |
| 2265 |
_G_header=$_G_indent |
| 2266 |
for _G_width in $_G_widths; do |
| 2267 |
func_append _G_header " $1 $_G_width"; shift |
| 2268 |
done |
| 2269 |
func_strrow $_G_header |
| 2270 |
|
| 2271 |
# Strip off the indent, and make a divider with '-' chars, then |
| 2272 |
# reindent. |
| 2273 |
_G_divider=`$ECHO "$func_strrow_result" \ |
| 2274 |
|$SED 's|[^ ]|-|g |
| 2275 |
:a |
| 2276 |
s|- |--|g |
| 2277 |
ta |
| 2278 |
'` |
| 2279 |
|
| 2280 |
# Append the header and divider to the running result. |
| 2281 |
func_append func_strtable_result "\ |
| 2282 |
$func_strrow_result |
| 2283 |
$_G_divider |
| 2284 |
" |
| 2285 |
|
| 2286 |
# The remaining rows are zipped between the width values we |
| 2287 |
# unwound earlier just like the header row above. |
| 2288 |
while test $# -gt 0; do |
| 2289 |
_G_row=$_G_indent |
| 2290 |
for _G_width in $_G_widths; do |
| 2291 |
func_append _G_row " $1 $_G_width"; shift |
| 2292 |
done |
| 2293 |
func_strrow $_G_row |
| 2294 |
func_append func_strtable_result "\ |
| 2295 |
$func_strrow_result |
| 2296 |
" |
| 2297 |
done |
| 2298 |
|
| 2299 |
# Mark the end of the table with a final divider line. |
| 2300 |
func_append func_strtable_result "$_G_divider" |
| 2301 |
} |
| 2302 |
|
| 2303 |
|
| 2304 |
# func_internal_error ARG... |
| 2305 |
# -------------------------- |
| 2306 |
# Echo program name prefixed message to standard error, and exit. |
| 2307 |
func_internal_error () |
| 2308 |
{ |
| 2309 |
func_fatal_error "\ |
| 2310 |
INTERNAL: " ${1+"$@"} " |
| 2311 |
Please report this bug to '[email protected]' |
| 2312 |
in as much detail as possible." |
| 2313 |
} |
| 2314 |
|
| 2315 |
|
| 2316 |
# func_permissions_error FILE-OR-DIRECTORY |
| 2317 |
# ---------------------------------------- |
| 2318 |
# Echo program name prefixed permissions error message to standard |
| 2319 |
# error, and exit. |
| 2320 |
func_permissions_error () |
| 2321 |
{ |
| 2322 |
$debug_cmd |
| 2323 |
|
| 2324 |
func_fatal_error "Failed to create '$1', check permissions." |
| 2325 |
} |
| 2326 |
|
| 2327 |
|
| 2328 |
# func_show_eval CMD [FAIL_EXP] |
| 2329 |
# ----------------------------- |
| 2330 |
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is |
| 2331 |
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP |
| 2332 |
# is given, then evaluate it. |
| 2333 |
func_show_eval () |
| 2334 |
{ |
| 2335 |
$debug_cmd |
| 2336 |
|
| 2337 |
$require_term_colors |
| 2338 |
|
| 2339 |
_G_cmd=$1 |
| 2340 |
_G_fail_exp=${2-':'} |
| 2341 |
|
| 2342 |
${opt_silent-'false'} || { |
| 2343 |
func_quote eval $_G_cmd |
| 2344 |
eval func_truncate_cmd $func_quote_result |
| 2345 |
func_echo "running: $tc_bold$func_truncate_cmd_result$tc_reset" |
| 2346 |
} |
| 2347 |
|
| 2348 |
${opt_dry_run-'false'} || { |
| 2349 |
eval "$_G_cmd" |
| 2350 |
_G_status=$? |
| 2351 |
test 0 -eq "$_G_status" || eval "(exit $_G_status); $_G_fail_exp" |
| 2352 |
} |
| 2353 |
} |
| 2354 |
|
| 2355 |
|
| 2356 |
# func_truncate_cmd CMD [ARG]... |
| 2357 |
# ------------------------------ |
| 2358 |
# For unreasonably long commands (such as a gnulib-tool invocation with |
| 2359 |
# the full module list for import), truncate CMD after the second non- |
| 2360 |
# option ARG. |
| 2361 |
func_truncate_cmd () |
| 2362 |
{ |
| 2363 |
$debug_cmd |
| 2364 |
|
| 2365 |
_G_last_arg_opt_p=false |
| 2366 |
func_truncate_cmd_result= |
| 2367 |
|
| 2368 |
set dummy "$@"; shift |
| 2369 |
|
| 2370 |
while test $# -gt 0; do |
| 2371 |
_G_opt=$1; shift |
| 2372 |
|
| 2373 |
test -n "$func_truncate_cmd_result" \ |
| 2374 |
&& func_append func_truncate_cmd_result ' ' |
| 2375 |
func_append func_truncate_cmd_result "$_G_opt" |
| 2376 |
|
| 2377 |
func_len "x$func_truncate_cmd_result" |
| 2378 |
|
| 2379 |
case $_G_opt in |
| 2380 |
-*) _G_last_arg_opt_p=: ;; |
| 2381 |
*) $_G_last_arg_opt_p \ |
| 2382 |
|| test "$min_cmd_len" -gt "$func_len_result" \ |
| 2383 |
|| break |
| 2384 |
_G_last_arg_opt_p=false |
| 2385 |
;; |
| 2386 |
esac |
| 2387 |
done |
| 2388 |
|
| 2389 |
test $# -gt 0 && func_append func_truncate_cmd_result "..." |
| 2390 |
} |
| 2391 |
|
| 2392 |
|
| 2393 |
# func_gitignore_entries FILE... |
| 2394 |
# ------------------------------ |
| 2395 |
# Strip blank and comment lines to leave significant entries. |
| 2396 |
func_gitignore_entries () |
| 2397 |
{ |
| 2398 |
$debug_cmd |
| 2399 |
|
| 2400 |
$SED -e '/^#/d' -e '/^$/d' "$@" |
| 2401 |
} |
| 2402 |
|
| 2403 |
|
| 2404 |
# func_insert_if_absent STR FILE... |
| 2405 |
# --------------------------------- |
| 2406 |
# If $STR is not already on a line by itself in $FILE, insert it, at the |
| 2407 |
# start. Entries are inserted at the start of the ignore list to ensure |
| 2408 |
# existing entries starting with ! are not overridden. Such entries |
| 2409 |
# support whilelisting exceptions after a more generic blacklist pattern. |
| 2410 |
# sorting the new contents of the file and replacing $FILE with the result. |
| 2411 |
func_insert_if_absent () |
| 2412 |
{ |
| 2413 |
$debug_cmd |
| 2414 |
|
| 2415 |
str=$1 |
| 2416 |
shift |
| 2417 |
|
| 2418 |
for file |
| 2419 |
do |
| 2420 |
test -f "$file" || touch "$file" |
| 2421 |
|
| 2422 |
duplicate_entries=`func_gitignore_entries "$file" |sort |uniq -d` |
| 2423 |
test -n "$duplicate_entries" \ |
| 2424 |
&& func_error "duplicate entries in $file: " $duplicate_entries |
| 2425 |
|
| 2426 |
func_grep_q "^$str\$" "$file" \ |
| 2427 |
|| func_verbose "inserting '$str' into '$file'" |
| 2428 |
|
| 2429 |
linesold=`func_gitignore_entries "$file" |wc -l` |
| 2430 |
linesnew=`{ $ECHO "$str"; cat "$file"; } \ |
| 2431 |
|func_gitignore_entries |sort -u |wc -l` |
| 2432 |
test "$linesold" -eq "$linesnew" \ |
| 2433 |
|| { $SED "1i\\$nl$str$nl" "$file" >"$file"T && mv "$file"T "$file"; } \ |
| 2434 |
|| func_permissions_error "$file" |
| 2435 |
done |
| 2436 |
} |
| 2437 |
|
| 2438 |
|
| 2439 |
# func_get_version APP |
| 2440 |
# -------------------- |
| 2441 |
# echo the version number (if any) of APP, which is looked up along your |
| 2442 |
# PATH. |
| 2443 |
func_get_version () |
| 2444 |
{ |
| 2445 |
$debug_cmd |
| 2446 |
|
| 2447 |
_G_app=$1 |
| 2448 |
|
| 2449 |
# Rather than uncomment the sed script in-situ, strip the comments |
| 2450 |
# programatically before passing the result to $SED for evaluation. |
| 2451 |
sed_get_version=`$ECHO '# extract version within line |
| 2452 |
s|.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*|\1| |
| 2453 |
t done |
| 2454 |
|
| 2455 |
# extract version at start of line |
| 2456 |
s|^\([0-9]\{1,\}\.[.a-z0-9-]*\).*|\1| |
| 2457 |
t done |
| 2458 |
|
| 2459 |
d |
| 2460 |
|
| 2461 |
:done |
| 2462 |
# the following essentially does s|5.005|5.5| |
| 2463 |
s|\.0*\([1-9]\)|.\1|g |
| 2464 |
p |
| 2465 |
q' \ |
| 2466 |
|$SED '/^[ ]*#.*$/d'` |
| 2467 |
|
| 2468 |
func_tool_version_output $_G_app >/dev/null |
| 2469 |
_G_status=$? |
| 2470 |
|
| 2471 |
test 0 -ne "$_G_status" \ |
| 2472 |
|| $_G_app --version 2>&1 |$SED -n "$sed_get_version" |
| 2473 |
|
| 2474 |
(exit $_G_status) |
| 2475 |
} |
| 2476 |
|
| 2477 |
|
| 2478 |
# func_check_tool APP |
| 2479 |
# ------------------- |
| 2480 |
# Search PATH for an executable at APP. |
| 2481 |
func_check_tool () |
| 2482 |
{ |
| 2483 |
$debug_cmd |
| 2484 |
|
| 2485 |
func_check_tool_result= |
| 2486 |
|
| 2487 |
case $1 in |
| 2488 |
*[\\/]*) |
| 2489 |
test -x "$1" && func_check_tool_result=$1 |
| 2490 |
;; |
| 2491 |
*) |
| 2492 |
save_IFS=$IFS |
| 2493 |
IFS=${PATH_SEPARATOR-:} |
| 2494 |
for _G_check_tool_path in $PATH; do |
| 2495 |
IFS=$save_IFS |
| 2496 |
if test -x "$_G_check_tool_path/$1"; then |
| 2497 |
func_check_tool_result=$_G_check_tool_path/$1 |
| 2498 |
break |
| 2499 |
fi |
| 2500 |
done |
| 2501 |
IFS=$save_IFS |
| 2502 |
;; |
| 2503 |
esac |
| 2504 |
} |
| 2505 |
|
| 2506 |
|
| 2507 |
# func_check_versions APP1 VER1 URL1 ...[APPN VERN URLN] |
| 2508 |
# ------------------------------------------------------ |
| 2509 |
func_check_versions () |
| 2510 |
{ |
| 2511 |
$debug_cmd |
| 2512 |
|
| 2513 |
func_check_versions_result=: |
| 2514 |
|
| 2515 |
while test $# -gt 0; do |
| 2516 |
_G_app=$1; shift |
| 2517 |
_G_reqver=$1; shift |
| 2518 |
_G_url=$1; shift |
| 2519 |
|
| 2520 |
# Diagnose bad buildreq formatting. |
| 2521 |
case $_G_url in |
| 2522 |
[a-z]*://*) ;; # looks like a url |
| 2523 |
*) func_fatal_error "\ |
| 2524 |
'$_G_url' from the buildreq table in |
| 2525 |
'bootstrap.conf' does not look like the URL for downloading |
| 2526 |
$_G_app. Please ensure that buildreq is a strict newline |
| 2527 |
delimited list of triples; 'program min-version url'." |
| 2528 |
;; |
| 2529 |
esac |
| 2530 |
|
| 2531 |
# Honor $APP variables ($TAR, $AUTOCONF, etc.) |
| 2532 |
_G_appvar=`echo $_G_app |tr '[a-z]' '[A-Z]'` |
| 2533 |
test TAR = "$_G_appvar" && _G_appvar=AMTAR |
| 2534 |
eval "_G_app=\${$_G_appvar-$_G_app}" |
| 2535 |
|
| 2536 |
# Fail if no version specified, but the program can't be found. |
| 2537 |
if test x- = "x$_G_reqver"; then |
| 2538 |
func_check_tool $_G_app |
| 2539 |
if test -z "$func_check_tool_result"; then |
| 2540 |
func_error "Prerequisite '$_G_app' not not found. Please install it, or |
| 2541 |
'export $_G_appvar=/path/to/$_G_app'." |
| 2542 |
func_check_versions_result=false |
| 2543 |
else |
| 2544 |
func_verbose "found '$func_check_tool_result' for $_G_appvar." |
| 2545 |
fi |
| 2546 |
else |
| 2547 |
_G_instver=`func_get_version $_G_app` |
| 2548 |
|
| 2549 |
# Fail if --version didn't work. |
| 2550 |
if test -z "$_G_instver"; then |
| 2551 |
func_error "Prerequisite '$_G_app' not found. Please install it, or |
| 2552 |
'export $_G_appvar=/path/to/$_G_app'." |
| 2553 |
func_check_versions_result=false |
| 2554 |
|
| 2555 |
# Fail if a newer version than what we have is required. |
| 2556 |
else |
| 2557 |
func_verbose "found '$_G_app' version $_G_instver." |
| 2558 |
|
| 2559 |
case $_G_reqver in |
| 2560 |
=*) |
| 2561 |
# If $buildreq version starts with '=', version must |
| 2562 |
# match the installed program exactly. |
| 2563 |
test "x$_G_reqver" = "x=$_G_instver" || { |
| 2564 |
func_error "\ |
| 2565 |
'$_G_app' version == $_G_instver is too old |
| 2566 |
'exactly $_G_app-$_G_reqver is required" |
| 2567 |
func_check_versions_result=false |
| 2568 |
} |
| 2569 |
;; |
| 2570 |
*) |
| 2571 |
# Otherwise, anything that is not older is a match. |
| 2572 |
func_lt_ver "$_G_reqver" "$_G_instver" || { |
| 2573 |
func_error "\ |
| 2574 |
'$_G_app' version == $_G_instver is too old |
| 2575 |
'$_G_app' version >= $_G_reqver is required" |
| 2576 |
func_check_versions_result=false |
| 2577 |
} |
| 2578 |
;; |
| 2579 |
esac |
| 2580 |
fi |
| 2581 |
fi |
| 2582 |
done |
| 2583 |
} |
| 2584 |
|
| 2585 |
|
| 2586 |
# func_cleanup_gnulib |
| 2587 |
# ------------------- |
| 2588 |
# Recursively delete everything below the path in the global variable |
| 2589 |
# GNULIB_PATH. |
| 2590 |
func_cleanup_gnulib () |
| 2591 |
{ |
| 2592 |
$debug_cmd |
| 2593 |
|
| 2594 |
_G_status=$? |
| 2595 |
$RM -fr "$gnulib_path" |
| 2596 |
exit $_G_status |
| 2597 |
} |
| 2598 |
|
| 2599 |
|
| 2600 |
# func_download_po_files SUBDIR DOMAIN |
| 2601 |
# ------------------------------------ |
| 2602 |
func_download_po_files () |
| 2603 |
{ |
| 2604 |
$debug_cmd |
| 2605 |
|
| 2606 |
func_echo "getting translations into $1 for $2..." |
| 2607 |
_G_cmd=`printf "$po_download_command_format" "$2" "$1"` |
| 2608 |
eval "$_G_cmd" |
| 2609 |
} |
| 2610 |
|
| 2611 |
|
| 2612 |
# func_update_po_files PO_DIR DOMAIN |
| 2613 |
# ---------------------------------- |
| 2614 |
# Mirror .po files to $po_dir/.reference and copy only the new |
| 2615 |
# or modified ones into $po_dir. Also update $po_dir/LINGUAS. |
| 2616 |
# Note po files that exist locally only are left in $po_dir but will |
| 2617 |
# not be included in LINGUAS and hence will not be distributed. |
| 2618 |
func_update_po_files () |
| 2619 |
{ |
| 2620 |
$debug_cmd |
| 2621 |
|
| 2622 |
# Directory containing primary .po files. |
| 2623 |
# Overwrite them only when we're sure a .po file is new. |
| 2624 |
_G_po_dir=$1 |
| 2625 |
_G_domain=$2 |
| 2626 |
|
| 2627 |
# Mirror *.po files into this dir. |
| 2628 |
# Usually contains *.s1 checksum files. |
| 2629 |
_G_ref_po_dir=$_G_po_dir/.reference |
| 2630 |
|
| 2631 |
test -d "$_G_ref_po_dir" || mkdir $_G_ref_po_dir || return |
| 2632 |
func_download_po_files $_G_ref_po_dir $_G_domain \ |
| 2633 |
&& ls "$_G_ref_po_dir"/*.po 2>/dev/null \ |
| 2634 |
|$SED -e 's|.*/||' -e 's|\.po$||' > "$_G_po_dir/LINGUAS" || return |
| 2635 |
|
| 2636 |
# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6+. |
| 2637 |
func_find_tool SHA1SUM sha1sum gsha1sum shasum sha1 |
| 2638 |
|
| 2639 |
test -n "$SHA1SUM" || func_fatal_error "\ |
| 2640 |
Please install GNU Coreutils, or 'export SHA1SUM=/path/to/sha1sum'." |
| 2641 |
|
| 2642 |
_G_langs=`cd $_G_ref_po_dir && echo *.po|$SED 's|\.po||g'` |
| 2643 |
test '*' = "$_G_langs" && _G_langs=x |
| 2644 |
for _G_po in $_G_langs; do |
| 2645 |
case $_G_po in x) continue;; esac |
| 2646 |
_G_new_po=$_G_ref_po_dir/$_G_po.po |
| 2647 |
_G_cksum_file=$_G_ref_po_dir/$_G_po.s1 |
| 2648 |
if ! test -f "$_G_cksum_file" || |
| 2649 |
! test -f "$_G_po_dir/$_G_po.po" || |
| 2650 |
! $SHA1SUM -c "$_G_cksum_file" \ |
| 2651 |
< "$_G_new_po" > /dev/null; then |
| 2652 |
echo "updated $_G_po_dir/$_G_po.po..." |
| 2653 |
cp "$_G_new_po" "$_G_po_dir/$_G_po.po" \ |
| 2654 |
&& $SHA1SUM < "$_G_new_po" > "$_G_cksum_file" || return |
| 2655 |
fi |
| 2656 |
done |
| 2657 |
} |
| 2658 |
|
| 2659 |
|
| 2660 |
|
| 2661 |
## --------------- ## |
| 2662 |
## Option parsing. ## |
| 2663 |
## --------------- ## |
| 2664 |
|
| 2665 |
# Hook in the functions to make sure our own options are parsed during |
| 2666 |
# the option parsing loop. |
| 2667 |
|
| 2668 |
usage='$progpath [OPTION]...' |
| 2669 |
|
| 2670 |
# Short help message in response to '-h'. Add to this in 'bootstrap.conf' |
| 2671 |
# if you accept any additional options. |
| 2672 |
usage_message="Common Bootstrap Options: |
| 2673 |
-c, --copy copy files instead of creating symbolic links. |
| 2674 |
--debug enable verbose shell tracing |
| 2675 |
-n, --dry-run print commands rather than running them |
| 2676 |
-f, --force attempt to bootstrap even if the sources seem not |
| 2677 |
to have been checked out. |
| 2678 |
--gnulib-srcdir=DIRNAME |
| 2679 |
specify a local directory where gnulib sources |
| 2680 |
reside. Use this if you already have the gnulib |
| 2681 |
sources on your machine, and don't want to waste |
| 2682 |
your bandwidth downloading them again. Defaults to |
| 2683 |
\$GNULIB_SRCDIR. |
| 2684 |
--no-warnings equivalent to '-Wnone' |
| 2685 |
--skip-git do not fetch files from remote repositories |
| 2686 |
--skip-po do not download po files. |
| 2687 |
-v, --verbose verbosely report processing |
| 2688 |
--version print version information and exit |
| 2689 |
-W, --warnings=CATEGORY |
| 2690 |
report the warnings falling in CATEGORY [all] |
| 2691 |
-h, --help print short or long help message and exit |
| 2692 |
" |
| 2693 |
|
| 2694 |
# Additional text appended to 'usage_message' in response to '--help'. |
| 2695 |
long_help_message=$long_help_message" |
| 2696 |
'recommend' show warnings about missing recommended packages |
| 2697 |
'settings' show warnings about missing '$progname.conf' settings |
| 2698 |
'upgrade' show warnings about out-dated files |
| 2699 |
|
| 2700 |
If the file '$progname.conf' exists in the same directory as this |
| 2701 |
script, its contents are read as shell variables to configure the |
| 2702 |
bootstrap. |
| 2703 |
|
| 2704 |
For build prerequisites, environment variables like \$AUTOCONF and |
| 2705 |
\$AMTAR are honored. |
| 2706 |
|
| 2707 |
Running without arguments will suffice in most cases. |
| 2708 |
" |
| 2709 |
|
| 2710 |
# Warning categories used by 'bootstrap', append others if you use them |
| 2711 |
# in your 'bootstrap.conf'. |
| 2712 |
warning_categories='recommend settings upgrade' |
| 2713 |
|
| 2714 |
|
| 2715 |
# bootstrap_options_prep [ARG]... |
| 2716 |
# ------------------------------- |
| 2717 |
# Preparation for options parsed by Bootstrap. |
| 2718 |
bootstrap_options_prep () |
| 2719 |
{ |
| 2720 |
$debug_cmd |
| 2721 |
|
| 2722 |
# Option defaults: |
| 2723 |
opt_copy=${copy-'false'} |
| 2724 |
opt_dry_run=false |
| 2725 |
opt_force=false |
| 2726 |
opt_gnulib_srcdir=$GNULIB_SRCDIR |
| 2727 |
opt_skip_git=false |
| 2728 |
opt_skip_po=false |
| 2729 |
|
| 2730 |
# Pass back the list of options we consumed. |
| 2731 |
func_quote eval ${1+"$@"} |
| 2732 |
bootstrap_options_prep_result=$func_quote_result |
| 2733 |
} |
| 2734 |
func_add_hook func_options_prep bootstrap_options_prep |
| 2735 |
|
| 2736 |
|
| 2737 |
# bootstrap_parse_options [ARG]... |
| 2738 |
# -------------------------------- |
| 2739 |
# Provide handling for Bootstrap specific options. |
| 2740 |
bootstrap_parse_options () |
| 2741 |
{ |
| 2742 |
$debug_cmd |
| 2743 |
|
| 2744 |
# Perform our own loop to consume as many options as possible in |
| 2745 |
# each iteration. |
| 2746 |
while test $# -gt 0; do |
| 2747 |
_G_opt=$1 |
| 2748 |
shift |
| 2749 |
case $_G_opt in |
| 2750 |
--dry-run|--dryrun|-n) |
| 2751 |
opt_dry_run=: ;; |
| 2752 |
--copy|-c) opt_copy=: ;; |
| 2753 |
--force|-f) opt_force=: ;; |
| 2754 |
|
| 2755 |
--gnulib-srcdir) |
| 2756 |
test $# = 0 && func_missing_arg $_G_opt && break |
| 2757 |
opt_gnulib_srcdir=$1 |
| 2758 |
shift |
| 2759 |
;; |
| 2760 |
|
| 2761 |
--skip-git|--no-git) |
| 2762 |
opt_skip_git=: |
| 2763 |
;; |
| 2764 |
|
| 2765 |
--skip-po|--no-po) |
| 2766 |
opt_skip_po=: |
| 2767 |
;; |
| 2768 |
|
| 2769 |
# Separate non-argument short options: |
| 2770 |
-c*|-f*|-n*) |
| 2771 |
func_split_short_opt "$_G_opt" |
| 2772 |
set dummy "$func_split_short_opt_name" \ |
| 2773 |
"-$func_split_short_opt_arg" ${1+"$@"} |
| 2774 |
shift |
| 2775 |
;; |
| 2776 |
|
| 2777 |
*) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; |
| 2778 |
esac |
| 2779 |
done |
| 2780 |
|
| 2781 |
# save modified positional parameters for caller |
| 2782 |
func_quote eval ${1+"$@"} |
| 2783 |
bootstrap_parse_options_result=$func_quote_result |
| 2784 |
} |
| 2785 |
func_add_hook func_parse_options bootstrap_parse_options |
| 2786 |
|
| 2787 |
|
| 2788 |
# bootstrap_validate_options [ARG]... |
| 2789 |
# ----------------------------------- |
| 2790 |
# Perform any sanity checks on option settings and/or unconsumed |
| 2791 |
# arguments. |
| 2792 |
bootstrap_validate_options () |
| 2793 |
{ |
| 2794 |
$debug_cmd |
| 2795 |
|
| 2796 |
# Validate options. |
| 2797 |
test $# -gt 0 \ |
| 2798 |
&& func_fatal_help "too many arguments" |
| 2799 |
|
| 2800 |
# Pass back the (empty) list of unconsumed options. |
| 2801 |
func_quote eval ${1+"$@"} |
| 2802 |
bootstrap_validate_options_result=$func_quote_result |
| 2803 |
} |
| 2804 |
func_add_hook func_validate_options bootstrap_validate_options |
| 2805 |
|
| 2806 |
|
| 2807 |
## -------------------------------------------------- ## |
| 2808 |
## Source package customisations in 'bootstrap.conf'. ## |
| 2809 |
## -------------------------------------------------- ## |
| 2810 |
|
| 2811 |
# Override the default configuration, if necessary. |
| 2812 |
# Make sure that bootstrap.conf is sourced from the current directory |
| 2813 |
# if we were invoked as "sh bootstrap". |
| 2814 |
case $0 in |
| 2815 |
*/*) test -r "$0.conf" && . "$0.conf" ;; |
| 2816 |
*) test -r "$0.conf" && . ./"$0.conf" ;; |
| 2817 |
esac |
| 2818 |
|
| 2819 |
|
| 2820 |
## ------------------------------- ## |
| 2821 |
## Actually perform the bootstrap. ## |
| 2822 |
## ------------------------------- ## |
| 2823 |
|
| 2824 |
func_bootstrap ${1+"$@"} |
| 2825 |
|
| 2826 |
# The End. |
| 2827 |
exit ${exit_status-$EXIT_SUCCESS} |
| 2828 |
|
| 2829 |
# Local variables: |
| 2830 |
# mode: shell-script |
| 2831 |
# sh-indentation: 2 |
| 2832 |
# eval: (add-hook 'before-save-hook 'time-stamp) |
| 2833 |
# time-stamp-pattern: "500/scriptversion=%:y-%02m-%02d.%02H; # UTC" |
| 2834 |
# time-stamp-time-zone: "UTC" |
| 2835 |
# End: |