Ticket #10039: install

File install, 8.9 KB (added by vbraun, 8 years ago)

Updated spkg-install for sage-4.6.alpha1

Line 
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###############################################################################
9if [ ! -f pipestatus ]; then
10  echo "Creating pipestatus."
11  cat > pipestatus <<EOF
12#!/usr/bin/env bash
13
14if [ -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
19fi
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
26VER=\${BASH_VERSINFO[0]}
27
28if [ \$VER -gt 2 ]; then
29    # Use bash 3.0's pipefail option.
30    (set -o pipefail; eval "\$1 | \$2")
31    exit \$?
32else
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
44fi
45EOF
46  chmod +x pipestatus
47fi
48
49###############################################################################
50
51
52CUR=`pwd`
53cd ..
54SAGE_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.
58echo `date -u "+%s"` > .BUILDSTART
59cd "$CUR"
60SAGE_LOCAL="$SAGE_ROOT/local"
61SAGE_LOGS="$SAGE_ROOT/spkg/logs"
62PATH="$SAGE_ROOT:$SAGE_LOCAL/bin:$PATH"
63PYTHONPATH="$SAGE_LOCAL"
64PKGDIR=standard
65export PATH SAGE_ROOT SAGE_LOCAL SAGE_LOGS PYTHONPATH
66
67if [ ! -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/"
75fi
76
77if [ ! -d "$SAGE_LOGS" ]; then
78    mkdir -p "$SAGE_LOGS"
79fi
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###############################################################################
89if [ "$SAGE_UPGRADING" = yes ] \
90    || ([ -f "$SAGE_LOCAL/bin/sage-upgrade" ] && \
91        ! grep SAGE_UPGRADING "$SAGE_LOCAL/bin/sage-upgrade" >/dev/null);
92then
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"
97fi
98
99###############################################################################
100# Setup environment variables pointing to the newest versions
101# of the base packages:
102###############################################################################
103newest="$PKGDIR/newest_version -base "
104
105SAGE_BZIP2=`$newest bzip2`
106export SAGE_BZIP2
107
108DIR=`$newest dir`
109export DIR
110
111PREREQ=`$newest prereq`
112export PREREQ
113
114###############################################################################
115# Setup environment variables pointing to the newest versions
116# of the standard packages:
117###############################################################################
118newest="$PKGDIR/newest_version"
119
120ATLAS=`$newest atlas`
121export ATLAS
122
123BLAS=`$newest blas`
124export BLAS
125
126BOEHM_GC=`$newest boehm_gc`
127export BOEHM_GC
128
129BOOST_CROPPED=`$newest boost-cropped`
130export BOOST_CROPPED
131
132CEPHES=`$newest cephes`
133export CEPHES
134
135CLIQUER=`$newest cliquer`
136export CLIQUER
137
138CDDLIB=`$newest cddlib`
139export CDDLIB
140
141PPL=`$newest ppl`
142export PPL
143
144ECL=`$newest ecl`
145export ECL
146
147CONWAY=`$newest conway_polynomials`
148if [ $? -ne 0 ]; then
149    echo "Error determining package name using spkg/standard/newest_version script."
150    exit 1
151fi
152export CONWAY
153
154ECLIB=`$newest eclib`
155export ECLIB
156
157ELLIPTIC_CURVES=`$newest elliptic_curves`
158export ELLIPTIC_CURVES
159
160CVXOPT=`$newest cvxopt`
161export CVXOPT
162
163DOCUTILS=`$newest docutils`
164export DOCUTILS
165
166ECM=`$newest ecm`
167export ECM
168
169EXAMPLES=`$newest examples`
170export EXAMPLES
171
172EXTCODE=`$newest extcode`
173export EXTCODE
174
175F2C=`$newest f2c`
176export F2C
177
178GLPK=`$newest glpk`
179export GLPK
180
181ICONV=`$newest iconv`
182export ICONV
183
184#############
185# This is all for GNUtls crypto
186LIBGCRYPT=`$newest libgcrypt`
187export LIBGCRYPT
188
189OPENCDK=`$newest opencdk`
190export OPENCDK
191
192GNUTLS=`$newest gnutls`
193export GNUTLS
194
195LIBGPG_ERROR=`$newest libgpg_error`
196export LIBGPG_ERROR
197
198PYGMENTS=`$newest pygments`
199export PYGMENTS
200
201PYTHON_GNUTLS=`$newest python_gnutls`
202export PYTHON_GNUTLS
203############# end gnutls crypto
204
205PIL=`$newest pil`
206export PIL
207
208LIBM4RI=`$newest libm4ri`
209export LIBM4RI
210
211FORTRAN=`$newest fortran`
212export FORTRAN
213
214FPLLL=`$newest libfplll`
215export FPLLL
216
217FREETYPE=`$newest freetype`
218export FREETYPE
219
220GAP=`$newest gap`
221export GAP
222
223G2RED=`$newest genus2reduction`
224export G2RED
225
226GD=`$newest gd`
227export GD
228
229GDMODULE=`$newest gdmodule`
230export GDMODULE
231
232GFAN=`$newest gfan`
233export GFAN
234
235GIVARO=`$newest givaro`
236export GIVARO
237
238MPIR=`$newest mpir`
239export MPIR
240
241GRAPHS=`$newest graphs`
242export GRAPHS
243
244GSL=`$newest gsl`
245export GSL
246
247IPYTHON=`$newest ipython`
248export IPYTHON
249
250LAPACK=`$newest lapack`
251export LAPACK
252
253LCALC=`$newest lcalc`
254export LCALC
255
256LIBPNG=`$newest libpng`
257export LIBPNG
258
259LINBOX=`$newest linbox`
260export LINBOX
261
262IML=`$newest iml`
263export IML
264
265JINJA2=`$newest jinja2` 
266export JINJA2
267
268MATPLOTLIB=`$newest matplotlib`
269export MATPLOTLIB
270
271MAXIMA=`$newest maxima`
272export MAXIMA
273
274MERCURIAL=`$newest mercurial`
275export MERCURIAL
276
277MPFI=`$newest mpfi`
278export MPFI
279
280MOIN=`$newest moin`
281export MOIN
282
283MPFR=`$newest mpfr`
284export MPFR
285
286MPMATH=`$newest mpmath`
287export MPMATH
288
289NETWORKX=`$newest networkx`
290export NETWORKX
291
292NUMPY=`$newest numpy`
293export NUMPY
294
295NTL=`$newest ntl`
296export NTL
297
298#OPENSSL=`$newest openssl`
299#export OPENSSL
300
301#PYOPENSSL=`$newest pyopenssl`
302#export PYOPENSSL
303
304PALP=`$newest palp`
305export PALP
306
307PARI=`$newest pari`
308export PARI
309
310PEXPECT=`$newest pexpect`
311export PEXPECT
312
313POLYBORI=`$newest polybori`
314export POLYBORI
315
316PYNAC=`$newest pynac`
317export PYNAC
318
319CYTHON=`$newest cython`
320export CYTHON
321
322RATPOINTS=`$newest ratpoints`
323export RATPOINTS
324
325SAGENB=`$newest sagenb`
326export SAGENB
327
328SAGETEX=`$newest sagetex`
329export SAGETEX
330
331SPHINX=`$newest sphinx`
332export SPHINX
333
334SQLALCHEMY=`$newest sqlalchemy`
335export SQLALCHEMY
336
337SQLITE=`$newest sqlite`
338export SQLITE
339
340FLINTQS=`$newest flintqs`
341export FLINTQS
342
343FLINT=`$newest flint`
344export FLINT
345
346POLYTOPES_DB=`$newest polytopes_db`
347export POLYTOPES_DB
348
349PYCRYPTO=`$newest pycrypto`
350export PYCRYPTO
351
352PYTHON=`$newest python`
353export PYTHON
354
355R=`$newest r`
356export R
357
358# Needed when #9906 gets merged:
359# RPY=`$newest rpy2`
360# export RPY
361
362READLINE=`$newest readline`
363export READLINE
364
365RUBIKS=`$newest rubiks`
366export RUBIKS
367
368SAGE=`$newest sage`
369export SAGE
370
371SAGE_SCRIPTS=`$newest sage_scripts`
372export SAGE_SCRIPTS
373
374SCIPY=`$newest scipy`
375export SCIPY
376
377SCIPY_SANDBOX=`$newest scipy_sandbox`
378export SCIPY_SANDBOX
379
380TACHYON=`$newest tachyon`
381export TACHYON
382
383TWISTED=`$newest twisted`
384export TWISTED
385
386SCONS=`$newest scons`
387export SCONS
388
389SETUPTOOLS=`$newest setuptools`
390export SETUPTOOLS
391
392SINGULAR=`$newest singular`
393export SINGULAR
394
395SYMPOW=`$newest sympow`
396export SYMPOW
397
398SYMPY=`$newest sympy`
399export SYMPY
400
401SYMMETRICA=`$newest symmetrica`
402export SYMMETRICA
403
404TERMCAP=`$newest termcap`
405export TERMCAP
406
407WEAVE=`$newest weave`
408export WEAVE
409
410ZLIB=`$newest zlib`
411export ZLIB
412
413ZODB=`$newest zodb3`
414export ZODB
415
416ZNPOLY=`$newest zn_poly`
417export ZNPOLY
418
419
420###############################################################################
421# NOW do the actual build:
422###############################################################################
423if [ "$SAGE_PARALLEL_SPKG_BUILD" = "yes" ] && [ -n "$MAKE" ]; then
424    time $MAKE -f standard/deps $1
425else
426    time make -f standard/deps $1
427fi
428
429# added by Burcin Erocal, see trac #6295.
430if [ $? -ne 0 ]; then
431    echo "Error building Sage."
432    exit 1
433fi
434
435cd "$SAGE_ROOT"
436
437# Rename makefile to Makefile (see #10156)
438if [ -f makefile ]; then
439    mv makefile Makefile
440    if [ $? -ne 0 ]; then
441        echo "Error renaming 'makefile' to 'Makefile'."
442        exit 1
443    fi
444fi
445
446# build succeeded
447if [ "$1" = "all" ]; then
448    echo "To install gap, gp, singular, etc., scripts"
449    echo "in a standard bin directory, start sage and"
450    echo "type something like"
451    echo "   sage: install_scripts('/usr/local/bin')"
452    echo "at the Sage command prompt."
453    echo ""
454    echo "To build the documentation, run"
455    echo "   make doc"
456    echo ""
457fi
458
459echo "Sage build/upgrade complete!"
460