1 | #!/usr/bin/env bash |
---|
2 | |
---|
3 | ############################################################################### |
---|
4 | # Check if pipestatus already exists, otherwise |
---|
5 | # create it to allow upgrade from Sage <4.5. This is a temporary fix. |
---|
6 | # See trac 9528: http://trac.sagemath.org/sage_trac/ticket/9528 |
---|
7 | # Go about 30 lines down from here for the actual "install" script. |
---|
8 | ############################################################################### |
---|
9 | if [ ! -f pipestatus ]; then |
---|
10 | echo "Creating pipestatus." |
---|
11 | cat > pipestatus <<EOF |
---|
12 | #!/usr/bin/env bash |
---|
13 | |
---|
14 | if [ -z "\$1" ]; then |
---|
15 | echo "Run two commands in a pipeline 'CMD1 | CMD2' and exit" |
---|
16 | echo "with the exit status of CMD1, *not* that of CMD2." |
---|
17 | echo "\$0 cmd1 cmd2" |
---|
18 | exit |
---|
19 | fi |
---|
20 | |
---|
21 | # This is useful, for example, in a makefile, where we tee the output |
---|
22 | # of a build command to a log file. Because \$? is the exit status of |
---|
23 | # the last command in a pipeline, make won't stop if tee succeeds but |
---|
24 | # a preceding command in the pipeline fails. |
---|
25 | |
---|
26 | VER=\${BASH_VERSINFO[0]} |
---|
27 | |
---|
28 | if [ \$VER -gt 2 ]; then |
---|
29 | # Use bash 3.0's pipefail option. |
---|
30 | (set -o pipefail; eval "\$1 | \$2") |
---|
31 | exit \$? |
---|
32 | else |
---|
33 | # Use redirection. Adapted from the comp.unix.shell FAQ. See |
---|
34 | # http://www.unix.com/shell-programming-scripting/92163-command-does-not-return-exit-status-due-tee.html |
---|
35 | exec 3>&1 |
---|
36 | eval \` |
---|
37 | exec 4>&1 >&3 3>&- |
---|
38 | { |
---|
39 | eval "\$1" 4>&-; echo "ES1=\$?;" >&4 |
---|
40 | } | eval "\$2" |
---|
41 | echo "ES2=\$?;" >&4 |
---|
42 | \` |
---|
43 | exit \$ES1 |
---|
44 | fi |
---|
45 | EOF |
---|
46 | chmod +x pipestatus |
---|
47 | fi |
---|
48 | |
---|
49 | ############################################################################### |
---|
50 | |
---|
51 | |
---|
52 | CUR=`pwd` |
---|
53 | cd .. |
---|
54 | SAGE_ROOT=`pwd` |
---|
55 | # Storing the start time of the build process. The time is stored in |
---|
56 | # seconds since 1970-01-01 in a hidden file called |
---|
57 | # "SAGE_ROOT/.BUILDSTART". See ticket #6744. |
---|
58 | echo `date -u "+%s"` > .BUILDSTART |
---|
59 | cd "$CUR" |
---|
60 | SAGE_LOCAL="$SAGE_ROOT/local" |
---|
61 | SAGE_LOGS="$SAGE_ROOT/spkg/logs" |
---|
62 | PATH="$SAGE_ROOT:$SAGE_LOCAL/bin:$PATH" |
---|
63 | PYTHONPATH="$SAGE_LOCAL" |
---|
64 | PKGDIR=standard |
---|
65 | export PATH SAGE_ROOT SAGE_LOCAL SAGE_LOGS PYTHONPATH |
---|
66 | |
---|
67 | if [ ! -f "$SAGE_LOCAL/bin/sage-spkg" ]; then |
---|
68 | if [ ! -d "$SAGE_LOCAL" ]; then |
---|
69 | mkdir "$SAGE_LOCAL" |
---|
70 | fi |
---|
71 | if [ ! -d "$SAGE_LOCAL/bin" ]; then |
---|
72 | mkdir "$SAGE_LOCAL/bin" |
---|
73 | fi |
---|
74 | cp base/sage-* base/testcc.sh base/testcxx.sh "$SAGE_LOCAL/bin/" |
---|
75 | fi |
---|
76 | |
---|
77 | if [ ! -d "$SAGE_LOGS" ]; then |
---|
78 | mkdir -p "$SAGE_LOGS" |
---|
79 | fi |
---|
80 | |
---|
81 | ############################################################################### |
---|
82 | # Make upgrading work: If this script is called from sage-upgrade, |
---|
83 | # either sage-upgrade has set SAGE_UPGRADING to "yes", |
---|
84 | # or we have an old version of sage-upgrade that doesn't contain |
---|
85 | # the string "SAGE_UPGRADING". |
---|
86 | # If SAGE_UPGRADING is not set to "yes", or sage-upgrade does not (yet) |
---|
87 | # exist, do the usual build (without setting SAGE_SPKG_OPTS). |
---|
88 | ############################################################################### |
---|
89 | if [ "$SAGE_UPGRADING" = yes ] \ |
---|
90 | || ([ -f "$SAGE_LOCAL/bin/sage-upgrade" ] && \ |
---|
91 | ! grep -q SAGE_UPGRADING "$SAGE_LOCAL/bin/sage-upgrade"); |
---|
92 | then |
---|
93 | # We're doing an upgrade. |
---|
94 | # Let the Makefile (spkg/standard/deps) call sage-spkg with "-f" |
---|
95 | # to force rebuilding dependent packages, too: |
---|
96 | export SAGE_SPKG_OPTS="-f" |
---|
97 | fi |
---|
98 | |
---|
99 | ############################################################################### |
---|
100 | # Setup environment variables pointing to the newest versions |
---|
101 | # of the base packages: |
---|
102 | ############################################################################### |
---|
103 | newest="$PKGDIR/newest_version -base " |
---|
104 | |
---|
105 | SAGE_BZIP2=`$newest bzip2` |
---|
106 | export SAGE_BZIP2 |
---|
107 | |
---|
108 | DIR=`$newest dir` |
---|
109 | export DIR |
---|
110 | |
---|
111 | PREREQ=`$newest prereq` |
---|
112 | export PREREQ |
---|
113 | |
---|
114 | ############################################################################### |
---|
115 | # Setup environment variables pointing to the newest versions |
---|
116 | # of the standard packages: |
---|
117 | ############################################################################### |
---|
118 | newest="$PKGDIR/newest_version" |
---|
119 | |
---|
120 | ATLAS=`$newest atlas` |
---|
121 | export ATLAS |
---|
122 | |
---|
123 | BLAS=`$newest blas` |
---|
124 | export BLAS |
---|
125 | |
---|
126 | BOEHM_GC=`$newest boehm_gc` |
---|
127 | export BOEHM_GC |
---|
128 | |
---|
129 | BOOST_CROPPED=`$newest boost-cropped` |
---|
130 | export BOOST_CROPPED |
---|
131 | |
---|
132 | CEPHES=`$newest cephes` |
---|
133 | export CEPHES |
---|
134 | |
---|
135 | CLIQUER=`$newest cliquer` |
---|
136 | export CLIQUER |
---|
137 | |
---|
138 | CDDLIB=`$newest cddlib` |
---|
139 | export CDDLIB |
---|
140 | |
---|
141 | ECL=`$newest ecl` |
---|
142 | export ECL |
---|
143 | |
---|
144 | CONWAY=`$newest conway_polynomials` |
---|
145 | if [ $? -ne 0 ]; then |
---|
146 | echo "Error determining package name using spkg/standard/newest_version script." |
---|
147 | exit 1 |
---|
148 | fi |
---|
149 | export CONWAY |
---|
150 | |
---|
151 | ECLIB=`$newest eclib` |
---|
152 | export ECLIB |
---|
153 | |
---|
154 | ELLIPTIC_CURVES=`$newest elliptic_curves` |
---|
155 | export ELLIPTIC_CURVES |
---|
156 | |
---|
157 | CVXOPT=`$newest cvxopt` |
---|
158 | export CVXOPT |
---|
159 | |
---|
160 | DOCUTILS=`$newest docutils` |
---|
161 | export DOCUTILS |
---|
162 | |
---|
163 | ECM=`$newest ecm` |
---|
164 | export ECM |
---|
165 | |
---|
166 | EXAMPLES=`$newest examples` |
---|
167 | export EXAMPLES |
---|
168 | |
---|
169 | EXTCODE=`$newest extcode` |
---|
170 | export EXTCODE |
---|
171 | |
---|
172 | F2C=`$newest f2c` |
---|
173 | export F2C |
---|
174 | |
---|
175 | GLPK=`$newest glpk` |
---|
176 | export GLPK |
---|
177 | |
---|
178 | ICONV=`$newest iconv` |
---|
179 | export ICONV |
---|
180 | |
---|
181 | ############# |
---|
182 | # This is all for GNUtls crypto |
---|
183 | LIBGCRYPT=`$newest libgcrypt` |
---|
184 | export LIBGCRYPT |
---|
185 | |
---|
186 | OPENCDK=`$newest opencdk` |
---|
187 | export OPENCDK |
---|
188 | |
---|
189 | GNUTLS=`$newest gnutls` |
---|
190 | export GNUTLS |
---|
191 | |
---|
192 | LIBGPG_ERROR=`$newest libgpg_error` |
---|
193 | export LIBGPG_ERROR |
---|
194 | |
---|
195 | PYGMENTS=`$newest pygments` |
---|
196 | export PYGMENTS |
---|
197 | |
---|
198 | PYTHON_GNUTLS=`$newest python_gnutls` |
---|
199 | export PYTHON_GNUTLS |
---|
200 | ############# end gnutls crypto |
---|
201 | |
---|
202 | PIL=`$newest pil` |
---|
203 | export PIL |
---|
204 | |
---|
205 | LIBM4RI=`$newest libm4ri` |
---|
206 | export LIBM4RI |
---|
207 | |
---|
208 | FORTRAN=`$newest fortran` |
---|
209 | export FORTRAN |
---|
210 | |
---|
211 | FPLLL=`$newest libfplll` |
---|
212 | export FPLLL |
---|
213 | |
---|
214 | FREETYPE=`$newest freetype` |
---|
215 | export FREETYPE |
---|
216 | |
---|
217 | GAP=`$newest gap` |
---|
218 | export GAP |
---|
219 | |
---|
220 | G2RED=`$newest genus2reduction` |
---|
221 | export G2RED |
---|
222 | |
---|
223 | GD=`$newest gd` |
---|
224 | export GD |
---|
225 | |
---|
226 | GDMODULE=`$newest gdmodule` |
---|
227 | export GDMODULE |
---|
228 | |
---|
229 | GFAN=`$newest gfan` |
---|
230 | export GFAN |
---|
231 | |
---|
232 | GIVARO=`$newest givaro` |
---|
233 | export GIVARO |
---|
234 | |
---|
235 | MPIR=`$newest mpir` |
---|
236 | export MPIR |
---|
237 | |
---|
238 | GRAPHS=`$newest graphs` |
---|
239 | export GRAPHS |
---|
240 | |
---|
241 | GSL=`$newest gsl` |
---|
242 | export GSL |
---|
243 | |
---|
244 | IPYTHON=`$newest ipython` |
---|
245 | export IPYTHON |
---|
246 | |
---|
247 | LAPACK=`$newest lapack` |
---|
248 | export LAPACK |
---|
249 | |
---|
250 | LCALC=`$newest lcalc` |
---|
251 | export LCALC |
---|
252 | |
---|
253 | LIBPNG=`$newest libpng` |
---|
254 | export LIBPNG |
---|
255 | |
---|
256 | LINBOX=`$newest linbox` |
---|
257 | export LINBOX |
---|
258 | |
---|
259 | IML=`$newest iml` |
---|
260 | export IML |
---|
261 | |
---|
262 | JINJA2=`$newest jinja2` |
---|
263 | export JINJA2 |
---|
264 | |
---|
265 | MATPLOTLIB=`$newest matplotlib` |
---|
266 | export MATPLOTLIB |
---|
267 | |
---|
268 | MAXIMA=`$newest maxima` |
---|
269 | export MAXIMA |
---|
270 | |
---|
271 | MERCURIAL=`$newest mercurial` |
---|
272 | export MERCURIAL |
---|
273 | |
---|
274 | MPFI=`$newest mpfi` |
---|
275 | export MPFI |
---|
276 | |
---|
277 | MOIN=`$newest moin` |
---|
278 | export MOIN |
---|
279 | |
---|
280 | MPFR=`$newest mpfr` |
---|
281 | export MPFR |
---|
282 | |
---|
283 | MPMATH=`$newest mpmath` |
---|
284 | export MPMATH |
---|
285 | |
---|
286 | NETWORKX=`$newest networkx` |
---|
287 | export NETWORKX |
---|
288 | |
---|
289 | NUMPY=`$newest numpy` |
---|
290 | export NUMPY |
---|
291 | |
---|
292 | NTL=`$newest ntl` |
---|
293 | export NTL |
---|
294 | |
---|
295 | #OPENSSL=`$newest openssl` |
---|
296 | #export OPENSSL |
---|
297 | |
---|
298 | #PYOPENSSL=`$newest pyopenssl` |
---|
299 | #export PYOPENSSL |
---|
300 | |
---|
301 | PALP=`$newest palp` |
---|
302 | export PALP |
---|
303 | |
---|
304 | PARI=`$newest pari` |
---|
305 | export PARI |
---|
306 | |
---|
307 | PEXPECT=`$newest pexpect` |
---|
308 | export PEXPECT |
---|
309 | |
---|
310 | POLYBORI=`$newest polybori` |
---|
311 | export POLYBORI |
---|
312 | |
---|
313 | PYNAC=`$newest pynac` |
---|
314 | export PYNAC |
---|
315 | |
---|
316 | CYTHON=`$newest cython` |
---|
317 | export CYTHON |
---|
318 | |
---|
319 | RATPOINTS=`$newest ratpoints` |
---|
320 | export RATPOINTS |
---|
321 | |
---|
322 | SAGENB=`$newest sagenb` |
---|
323 | export SAGENB |
---|
324 | |
---|
325 | SAGETEX=`$newest sagetex` |
---|
326 | export SAGETEX |
---|
327 | |
---|
328 | SPHINX=`$newest sphinx` |
---|
329 | export SPHINX |
---|
330 | |
---|
331 | SQLALCHEMY=`$newest sqlalchemy` |
---|
332 | export SQLALCHEMY |
---|
333 | |
---|
334 | SQLITE=`$newest sqlite` |
---|
335 | export SQLITE |
---|
336 | |
---|
337 | FLINTQS=`$newest flintqs` |
---|
338 | export FLINTQS |
---|
339 | |
---|
340 | FLINT=`$newest flint` |
---|
341 | export FLINT |
---|
342 | |
---|
343 | POLYTOPES_DB=`$newest polytopes_db` |
---|
344 | export POLYTOPES_DB |
---|
345 | |
---|
346 | PYCRYPTO=`$newest pycrypto` |
---|
347 | export PYCRYPTO |
---|
348 | |
---|
349 | PYTHON=`$newest python` |
---|
350 | export PYTHON |
---|
351 | |
---|
352 | R=`$newest r` |
---|
353 | export R |
---|
354 | |
---|
355 | # Needed when #9906 gets merged: |
---|
356 | # RPY=`$newest rpy2` |
---|
357 | # export RPY |
---|
358 | |
---|
359 | READLINE=`$newest readline` |
---|
360 | export READLINE |
---|
361 | |
---|
362 | RUBIKS=`$newest rubiks` |
---|
363 | export RUBIKS |
---|
364 | |
---|
365 | SAGE=`$newest sage` |
---|
366 | export SAGE |
---|
367 | |
---|
368 | SAGE_ROOT_REPO=`$newest sage_root` |
---|
369 | export SAGE_ROOT_REPO |
---|
370 | |
---|
371 | SAGE_SCRIPTS=`$newest sage_scripts` |
---|
372 | export SAGE_SCRIPTS |
---|
373 | |
---|
374 | SCIPY=`$newest scipy` |
---|
375 | export SCIPY |
---|
376 | |
---|
377 | SCIPY_SANDBOX=`$newest scipy_sandbox` |
---|
378 | export SCIPY_SANDBOX |
---|
379 | |
---|
380 | TACHYON=`$newest tachyon` |
---|
381 | export TACHYON |
---|
382 | |
---|
383 | TWISTED=`$newest twisted` |
---|
384 | export TWISTED |
---|
385 | |
---|
386 | SCONS=`$newest scons` |
---|
387 | export SCONS |
---|
388 | |
---|
389 | SETUPTOOLS=`$newest setuptools` |
---|
390 | export SETUPTOOLS |
---|
391 | |
---|
392 | SINGULAR=`$newest singular` |
---|
393 | export SINGULAR |
---|
394 | |
---|
395 | SYMPOW=`$newest sympow` |
---|
396 | export SYMPOW |
---|
397 | |
---|
398 | SYMPY=`$newest sympy` |
---|
399 | export SYMPY |
---|
400 | |
---|
401 | SYMMETRICA=`$newest symmetrica` |
---|
402 | export SYMMETRICA |
---|
403 | |
---|
404 | TERMCAP=`$newest termcap` |
---|
405 | export TERMCAP |
---|
406 | |
---|
407 | WEAVE=`$newest weave` |
---|
408 | export WEAVE |
---|
409 | |
---|
410 | ZLIB=`$newest zlib` |
---|
411 | export ZLIB |
---|
412 | |
---|
413 | ZODB=`$newest zodb3` |
---|
414 | export ZODB |
---|
415 | |
---|
416 | ZNPOLY=`$newest zn_poly` |
---|
417 | export ZNPOLY |
---|
418 | |
---|
419 | |
---|
420 | ############################################################################### |
---|
421 | # NOW do the actual build: |
---|
422 | ############################################################################### |
---|
423 | if [ "$SAGE_PARALLEL_SPKG_BUILD" = "yes" ] && [ -n "$MAKE" ]; then |
---|
424 | time $MAKE -f standard/deps $1 |
---|
425 | else |
---|
426 | time make -f standard/deps $1 |
---|
427 | fi |
---|
428 | |
---|
429 | # added by Burcin Erocal, see trac #6295. |
---|
430 | if [ $? -ne 0 ]; then |
---|
431 | echo "Error building Sage." |
---|
432 | exit 1 |
---|
433 | fi |
---|
434 | |
---|
435 | # build succeeded |
---|
436 | if [ "$1" = "all" ]; then |
---|
437 | echo "To install gap, gp, singular, etc., scripts" |
---|
438 | echo "in a standard bin directory, start sage and" |
---|
439 | echo "type something like" |
---|
440 | echo " sage: install_scripts('/usr/local/bin')" |
---|
441 | echo "at the Sage command prompt." |
---|
442 | echo "" |
---|
443 | echo "To build the documentation, run" |
---|
444 | echo " make doc" |
---|
445 | echo "" |
---|
446 | fi |
---|
447 | |
---|
448 | echo "Sage build/upgrade complete!" |
---|
449 | |
---|