5
5
#
6
6
# If the -s option is given, save the autogenerated scripts in
7
7
# $SAGE_ROOT/upstream/configure-$CONFVERSION.tar.gz where CONFVERSION
8
- # is the version number stored in
9
- # build/pkgs/configure/package-version.txt
10
- #
11
- # If optional argument -i is given, then automatically increment the
12
- # version number.
8
+ # is the sha1 of HEAD `git rev-parse HEAD`
13
9
#
14
10
# If optional argument -d is given and bootstrapping failed, instead
15
11
# extract the files from a local configure tarball, downloading it if
16
12
# needed. If -D is given, don't try to bootstrap and always extract or
17
13
# download.
14
+ #
15
+ # If optional argument -u <URL> is given download the configure
16
+ # tarball from that base url. That is, "bootstrap -u http://host/path"
17
+ # will download http://host/path/configure-$CONFVERSION.tar.gz to
18
+ # upstream/configure-$CONFVERSION.tar.gz. This is used by the buildbot
19
+ # to download tarballs that are not published.
18
20
# #######################################################################
19
21
20
22
# Set SAGE_ROOT to the path to this file and then cd into it
@@ -25,7 +27,49 @@ export PATH="$SAGE_ROOT/build/bin:$PATH"
25
27
26
28
PKG=build/pkgs/configure
27
29
MAKE=" ${MAKE:- make} "
28
- CONFVERSION=` cat $PKG /package-version.txt`
30
+ CONFVERSION=$( cat $PKG /package-version.txt)
31
+
32
+ install_config_rpath () {
33
+ # The file config.rpath which comes from gettext is supposed to be
34
+ # installed by automake, but due to a bug in most distros it is not;
35
+ # see https://trac.sagemath.org/ticket/27823#comment:17
36
+ #
37
+ # Here we need to determine where gettext stores its data files and
38
+ # copy config.rpath from there to config/
39
+ gettextize=" $( command -v gettextize) "
40
+ if [ -z " $gettextize " ]; then
41
+ echo >&2 " gettext and the gettextize program must be installed and be in"
42
+ echo >&2 " your PATH. E.g. Homebrew installs them in /usr/local/opt/gettext/bin."
43
+ return 179
44
+ fi
45
+ eval ` sed -n ' /^prefix=.*$/p' $gettextize `
46
+ eval ` sed -n ' /^datarootdir=.*$/p' $gettextize `
47
+ eval ` sed -n ' /^: \${gettext_datadir=.*$/p' $gettextize `
48
+
49
+ if [ -z " $gettext_datadir " ]; then
50
+ eval ` sed -n ' /^gettext_dir=.*$/p' $gettextize `
51
+ # In older versions (before 2014) this is spelled gettext_dir
52
+ # See https://github.com/autotools-mirror/gettext/commit/ff18897068486560e2bb421004cfbd42b7cdd0f8
53
+ gettext_datadir=" $gettext_dir "
54
+ fi
55
+
56
+ if [ -z " $gettext_datadir " ]; then
57
+ echo >&2 " Failed to read the gettext_datadir directory from $gettextize "
58
+ echo >&2 " The config.rpath file must manually be copied into config/"
59
+ echo >&2 " This file is installed with gettext typically in /usr/share/gettext"
60
+ return 179
61
+ fi
62
+
63
+ config_rpath=" $gettext_datadir /config.rpath"
64
+ if [ ! -f " $config_rpath " ]; then
65
+ echo >&2 " Missing $config_rpath file; this indicates a broken gettext install."
66
+ return 179
67
+ fi
68
+
69
+ echo " bootstrap:$LINENO : installing 'config/config.rpath'"
70
+ cp " $config_rpath " config/
71
+ }
72
+
29
73
30
74
31
75
bootstrap () {
@@ -39,6 +83,7 @@ SAGE_SPKG_CONFIGURE_$(echo ${pkgname} | tr '[a-z]' '[A-Z]')"
39
83
done
40
84
echo " $spkg_configures " >> m4/sage_spkg_configures.m4
41
85
86
+ install_config_rpath && \
42
87
aclocal -I m4 && \
43
88
automake --add-missing --copy build/make/Makefile-auto && \
44
89
autoconf
@@ -47,7 +92,7 @@ SAGE_SPKG_CONFIGURE_$(echo ${pkgname} | tr '[a-z]' '[A-Z]')"
47
92
case $st in
48
93
0) true ;; # Success
49
94
50
- 16|63|127) # no m4 for pkg-config, or autotools not installed, or version too old
95
+ 179| 16|63|127) # install_config_rpath failed| no m4 for pkg-config| autotools not installed| or version too old
51
96
if [ $DOWNLOAD = yes ]; then
52
97
echo >&2 " Bootstrap failed, downloading required files instead."
53
98
bootstrap-download || exit $?
@@ -94,35 +139,39 @@ save () {
94
139
exit 63
95
140
fi
96
141
142
+ NEWCONFVERSION=` git rev-parse HEAD`
143
+ NEWCONFBALL=" upstream/configure-$NEWCONFVERSION .tar.gz"
144
+
97
145
# Create configure tarball
98
- echo " Creating $CONFBALL ..."
146
+ echo " Creating $NEWCONFBALL ..."
99
147
mkdir -p upstream
100
- tar zcf " $CONFBALL " configure config/* build/make/Makefile-auto.in
148
+ tar zcf " $NEWCONFBALL " configure config/* build/make/Makefile-auto.in
101
149
102
- # Update version number
103
- echo " $CONFVERSION " > $PKG /package-version.txt
150
+ # Update version
151
+ echo " $NEWCONFVERSION " > $PKG /package-version.txt
104
152
105
153
# Compute checksum
106
- SAGE_ROOT=. src/bin/ sage- fix-pkg-checksums " $CONFBALL "
154
+ ./ sage --package fix-checksum configure
107
155
}
108
156
109
157
110
158
usage () {
111
- echo >&2 " Usage: $0 [-d|-D|-s] [-i ] [-h]"
159
+ echo >&2 " Usage: $0 [-d|-D|-s] [-u <URL> ] [-h]"
112
160
}
113
161
114
162
115
163
# Parse options
116
164
SAVE=no
117
165
DOWNLOAD=no
118
166
ALWAYSDOWNLOAD=no
119
- while getopts " Ddsih" OPTION
167
+ CONFTARBALL_URL=" "
168
+ while getopts " Ddshu:" OPTION
120
169
do
121
170
case " $OPTION " in
122
171
D) ALWAYSDOWNLOAD=yes; DOWNLOAD=yes;;
123
172
d) DOWNLOAD=yes;;
124
173
s) SAVE=yes;;
125
- i) CONFVERSION= $(( CONFVERSION + 1 )) ;;
174
+ u) CONFTARBALL_URL= " $OPTARG " ; ALWAYSDOWNLOAD=yes ; DOWNLOAD=yes ;;
126
175
h) usage; exit 0;;
127
176
? ) usage; exit 2;;
128
177
esac
@@ -146,7 +195,17 @@ source src/bin/sage-env 2>/dev/null
146
195
147
196
148
197
if [ $ALWAYSDOWNLOAD = yes ]; then
149
- bootstrap-download || exit $?
198
+ if [ -n " $CONFTARBALL_URL " ]; then
199
+ URL=" $CONFTARBALL_URL " /configure-$CONFVERSION .tar.gz
200
+ sage-download-file " $URL " upstream/configure-$CONFVERSION .tar.gz
201
+ if [ $? -ne 0 ]; then
202
+ echo >&2 " Error: downloading configure-$CONFVERSION .tar.gz from $CONFTARBALL_URL failed"
203
+ exit 1
204
+ fi
205
+ echo >&2 " Downloaded configure-$CONFVERSION .tar.gz from $CONFTARBALL_URL "
206
+ else
207
+ bootstrap-download || exit $?
208
+ fi
150
209
else
151
210
bootstrap
152
211
fi
0 commit comments