aboutsummaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap1054
1 files changed, 696 insertions, 358 deletions
diff --git a/bootstrap b/bootstrap
index b790192..e72894c 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,8 +1,10 @@
1#! /bin/sh 1#! /bin/sh
2# Print a version string.
3scriptversion=2014-12-08.12; # UTC
2 4
3# Bootstrap this package from checked-out sources. 5# Bootstrap this package from checked-out sources.
4 6
5# Copyright (C) 2003-2008 Free Software Foundation, Inc. 7# Copyright (C) 2003-2015 Free Software Foundation, Inc.
6 8
7# This program is free software: you can redistribute it and/or modify 9# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by 10# it under the terms of the GNU General Public License as published by
@@ -17,7 +19,15 @@
17# You should have received a copy of the GNU General Public License 19# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>. 20# along with this program. If not, see <http://www.gnu.org/licenses/>.
19 21
20# Written by Paul Eggert. 22# Originally written by Paul Eggert. The canonical version of this
23# script is maintained as build-aux/bootstrap in gnulib, however, to
24# be useful to your project, you should place a copy of it under
25# version control in the top-level directory of your project. The
26# intent is that all customization can be done with a bootstrap.conf
27# file also maintained in your version control; gnulib comes with a
28# template build-aux/bootstrap.conf to get you started.
29
30# Please report bugs or propose patches to bug-gnulib@gnu.org.
21 31
22nl=' 32nl='
23' 33'
@@ -26,36 +36,77 @@ nl='
26LC_ALL=C 36LC_ALL=C
27export LC_ALL 37export LC_ALL
28 38
39# Ensure that CDPATH is not set. Otherwise, the output from cd
40# would cause trouble in at least one use below.
41(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
42
29local_gl_dir=gl 43local_gl_dir=gl
30 44
31# Temporary directory names. 45# Honour $PERL, but work even if there is none
32bt='._bootmp' 46PERL="${PERL-perl}"
33bt_regex=`echo "$bt"| sed 's/\./[.]/g'` 47
34bt2=${bt}2 48me=$0
35 49
36usage() { 50usage() {
37 echo >&2 "\ 51 cat <<EOF
38Usage: $0 [OPTION]... 52Usage: $me [OPTION]...
39Bootstrap this package from the checked-out sources. 53Bootstrap this package from the checked-out sources.
40 54
41Options: 55Options:
42 --gnulib-srcdir=DIRNAME Specify the local directory where gnulib 56 --gnulib-srcdir=DIRNAME specify the local directory where gnulib
43 sources reside. Use this if you already 57 sources reside. Use this if you already
44 have gnulib sources on your machine, and 58 have gnulib sources on your machine, and
45 do not want to waste your bandwidth downloading 59 do not want to waste your bandwidth downloading
46 them again. 60 them again. Defaults to \$GNULIB_SRCDIR
47 --copy Copy files instead of creating symbolic links. 61 --bootstrap-sync if this bootstrap script is not identical to
48 --force Attempt to bootstrap even if the sources seem 62 the version in the local gnulib sources,
49 not to have been checked out. 63 update this script, and then restart it with
50 --skip-po Do not download po files. 64 /bin/sh or the shell \$CONFIG_SHELL
51 65 --no-bootstrap-sync do not check whether bootstrap is out of sync
52If the file bootstrap.conf exists in the current working directory, its 66 --copy copy files instead of creating symbolic links
67 --force attempt to bootstrap even if the sources seem
68 not to have been checked out
69 --no-git do not use git to update gnulib. Requires that
70 --gnulib-srcdir point to a correct gnulib snapshot
71 --skip-po do not download po files
72
73If the file $me.conf exists in the same directory as this script, its
53contents are read as shell variables to configure the bootstrap. 74contents are read as shell variables to configure the bootstrap.
54 75
76For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
77are honored.
78
55Running without arguments will suffice in most cases. 79Running without arguments will suffice in most cases.
56" 80EOF
57} 81}
58 82
83# warnf_ FORMAT-STRING ARG1...
84warnf_ ()
85{
86 warnf_format_=$1
87 shift
88 nl='
89'
90 case $* in
91 *$nl*) me_=$(printf "$me"|tr "$nl|" '??')
92 printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;;
93 *) printf "$me: $warnf_format_" "$@" ;;
94 esac >&2
95}
96
97# warn_ WORD1...
98warn_ ()
99{
100 # If IFS does not start with ' ', set it and emit the warning in a subshell.
101 case $IFS in
102 ' '*) warnf_ '%s\n' "$*";;
103 *) (IFS=' '; warn_ "$@");;
104 esac
105}
106
107# die WORD1...
108die() { warn_ "$@"; exit 1; }
109
59# Configuration. 110# Configuration.
60 111
61# Name of the Makefile.am 112# Name of the Makefile.am
@@ -67,32 +118,51 @@ gnulib_modules=
67# Any gnulib files needed that are not in modules. 118# Any gnulib files needed that are not in modules.
68gnulib_files= 119gnulib_files=
69 120
121: ${AUTOPOINT=autopoint}
122: ${AUTORECONF=autoreconf}
123
124# A function to be called right after gnulib-tool is run.
125# Override it via your own definition in bootstrap.conf.
126bootstrap_post_import_hook() { :; }
127
128# A function to be called after everything else in this script.
129# Override it via your own definition in bootstrap.conf.
130bootstrap_epilogue() { :; }
131
70# The command to download all .po files for a specified domain into 132# The command to download all .po files for a specified domain into
71# a specified directory. Fill in the first %s is the domain name, and 133# a specified directory. Fill in the first %s is the domain name, and
72# the second with the destination directory. Use rsync's -L and -r 134# the second with the destination directory. Use rsync's -L and -r
73# options because the latest/%s directory and the .po files within are 135# options because the latest/%s directory and the .po files within are
74# all symlinks. 136# all symlinks.
75po_download_command_format=\ 137po_download_command_format=\
76"rsync -Lrtvz 'translationproject.org::tp/latest/%s/' '%s'" 138"rsync --delete --exclude '*.s1' -Lrtvz \
139 'translationproject.org::tp/latest/%s/' '%s'"
77 140
141# Fallback for downloading .po files (if rsync fails).
142po_download_command_format2=\
143"wget --mirror -nd -q -np -A.po -P '%s' \
144 http://translationproject.org/latest/%s/"
145
146# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
147# fall back to the package name (1st argument with munging)
78extract_package_name=' 148extract_package_name='
79 /^AC_INIT(/{ 149 /^AC_INIT(\[*/{
80 /.*,.*,.*, */{ 150 s///
81 s/// 151 /^[^,]*,[^,]*,[^,]*,[ []*\([^][ ,)]\)/{
82 s/[][]//g 152 s//\1/
83 s/)$// 153 s/[],)].*//
84 p 154 p
85 q 155 q
86 } 156 }
87 s/AC_INIT(\[*// 157 s/[],)].*//
88 s/]*,.*//
89 s/^GNU // 158 s/^GNU //
90 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ 159 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
91 s/[^A-Za-z0-9_]/-/g 160 s/[^abcdefghijklmnopqrstuvwxyz0123456789_]/-/g
92 p 161 p
93 } 162 }
94' 163'
95package=`sed -n "$extract_package_name" configure.ac` || exit 164package=$(sed -n "$extract_package_name" configure.ac) \
165 || die 'cannot find package name in configure.ac'
96gnulib_name=lib$package 166gnulib_name=lib$package
97 167
98build_aux=build-aux 168build_aux=build-aux
@@ -100,17 +170,7 @@ source_base=lib
100m4_base=m4 170m4_base=m4
101doc_base=doc 171doc_base=doc
102tests_base=tests 172tests_base=tests
103 173gnulib_extra_files=''
104# Extra files from gnulib, which override files from other sources.
105gnulib_extra_files="
106 $build_aux/install-sh
107 $build_aux/mdate-sh
108 $build_aux/texinfo.tex
109 $build_aux/depcomp
110 $build_aux/config.guess
111 $build_aux/config.sub
112 doc/INSTALL
113"
114 174
115# Additional gnulib-tool options to use. Use "\newline" to break lines. 175# Additional gnulib-tool options to use. Use "\newline" to break lines.
116gnulib_tool_option_extras= 176gnulib_tool_option_extras=
@@ -125,7 +185,8 @@ XGETTEXT_OPTIONS='\\\
125 --flag=error:3:c-format --flag=error_at_line:5:c-format\\\ 185 --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
126' 186'
127 187
128# Package bug report address for gettext files 188# Package bug report address and copyright holder for gettext files
189COPYRIGHT_HOLDER='Free Software Foundation, Inc.'
129MSGID_BUGS_ADDRESS=bug-$package@gnu.org 190MSGID_BUGS_ADDRESS=bug-$package@gnu.org
130 191
131# Files we don't want to import. 192# Files we don't want to import.
@@ -144,8 +205,76 @@ copy=false
144# on which version control system (if any) is used in the source directory. 205# on which version control system (if any) is used in the source directory.
145vc_ignore=auto 206vc_ignore=auto
146 207
208# Set this to true in bootstrap.conf to enable --bootstrap-sync by
209# default.
210bootstrap_sync=false
211
212# Use git to update gnulib sources
213use_git=true
214
215check_exists() {
216 if test "$1" = "--verbose"; then
217 ($2 --version </dev/null) >/dev/null 2>&1
218 if test $? -ge 126; then