Ticket #9433: install

File install, 8.7 KB (added by jhpalmieri, 9 years ago)

the file SAGE_ROOT/spkg/install

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 -q SAGE_UPGRADING "$SAGE_LOCAL/bin/sage-upgrade");
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
141ECL=`$newest ecl`
142export ECL
143
144CONWAY=`$newest conway_polynomials`
145if [ $? -ne 0 ]; then
146    echo "Error determining package name using spkg/standard/newest_version script."
147    exit 1
148fi
149export CONWAY
150
151ECLIB=`$newest eclib`
152export ECLIB
153
154ELLIPTIC_CURVES=`$newest elliptic_curves`
155export ELLIPTIC_CURVES
156
157CVXOPT=`$newest cvxopt`
158export CVXOPT
159
160DOCUTILS=`$newest docutils`
161export DOCUTILS
162
163ECM=`$newest ecm`
164export ECM
165
166EXAMPLES=`$newest examples`
167export EXAMPLES
168
169EXTCODE=`$newest extcode`
170export EXTCODE
171
172F2C=`$newest f2c`
173export F2C
174
175GLPK=`$newest glpk`
176export GLPK
177
178ICONV=`$newest iconv`
179export ICONV
180
181#############
182# This is all for GNUtls crypto
183LIBGCRYPT=`$newest libgcrypt`
184export LIBGCRYPT
185
186OPENCDK=`$newest opencdk`
187export OPENCDK
188
189GNUTLS=`$newest gnutls`
190export GNUTLS
191
192LIBGPG_ERROR=`$newest libgpg_error`
193export LIBGPG_ERROR
194
195PYGMENTS=`$newest pygments`
196export PYGMENTS
197
198PYTHON_GNUTLS=`$newest python_gnutls`
199export PYTHON_GNUTLS
200############# end gnutls crypto
201
202PIL=`$newest pil`
203export PIL
204
205LIBM4RI=`$newest libm4ri`
206export LIBM4RI
207
208FORTRAN=`$newest fortran`
209export FORTRAN
210
211FPLLL=`$newest libfplll`
212export FPLLL
213
214FREETYPE=`$newest freetype`
215export FREETYPE
216
217GAP=`$newest gap`
218export GAP
219
220G2RED=`$newest genus2reduction`
221export G2RED
222
223GD=`$newest gd`
224export GD
225
226GDMODULE=`$newest gdmodule`
227export GDMODULE
228
229GFAN=`$newest gfan`
230export GFAN
231
232GIVARO=`$newest givaro`
233export GIVARO
234
235MPIR=`$newest mpir`
236export MPIR
237
238GRAPHS=`$newest graphs`
239export GRAPHS
240
241GSL=`$newest gsl`
242export GSL
243
244IPYTHON=`$newest ipython`
245export IPYTHON
246
247LAPACK=`$newest lapack`
248export LAPACK
249
250LCALC=`$newest lcalc`
251export LCALC
252
253LIBPNG=`$newest libpng`
254export LIBPNG
255
256LINBOX=`$newest linbox`
257export LINBOX
258
259IML=`$newest iml`
260export IML
261
262JINJA2=`$newest jinja2` 
263export JINJA2
264
265MATPLOTLIB=`$newest matplotlib`
266export MATPLOTLIB
267
268MAXIMA=`$newest maxima`
269export MAXIMA
270
271MERCURIAL=`$newest mercurial`
272export MERCURIAL
273
274MPFI=`$newest mpfi`
275export MPFI
276
277MOIN=`$newest moin`
278export MOIN
279
280MPFR=`$newest mpfr`
281export MPFR
282
283MPMATH=`$newest mpmath`
284export MPMATH
285
286NETWORKX=`$newest networkx`
287export NETWORKX
288
289NUMPY=`$newest numpy`
290export NUMPY
291
292NTL=`$newest ntl`
293export NTL
294
295#OPENSSL=`$newest openssl`
296#export OPENSSL
297
298#PYOPENSSL=`$newest pyopenssl`
299#export PYOPENSSL
300
301PALP=`$newest palp`
302export PALP
303
304PARI=`$newest pari`
305export PARI
306
307PEXPECT=`$newest pexpect`
308export PEXPECT
309
310POLYBORI=`$newest polybori`
311export POLYBORI
312
313PYNAC=`$newest pynac`
314export PYNAC
315
316CYTHON=`$newest cython`
317export CYTHON
318
319RATPOINTS=`$newest ratpoints`
320export RATPOINTS
321
322SAGENB=`$newest sagenb`
323export SAGENB
324
325SAGETEX=`$newest sagetex`
326export SAGETEX
327
328SPHINX=`$newest sphinx`
329export SPHINX
330
331SQLALCHEMY=`$newest sqlalchemy`
332export SQLALCHEMY
333
334SQLITE=`$newest sqlite`
335export SQLITE
336
337FLINTQS=`$newest flintqs`
338export FLINTQS
339
340FLINT=`$newest flint`
341export FLINT
342
343POLYTOPES_DB=`$newest polytopes_db`
344export POLYTOPES_DB
345
346PYCRYPTO=`$newest pycrypto`
347export PYCRYPTO
348
349PYTHON=`$newest python`
350export PYTHON
351
352R=`$newest r`
353export R
354
355# Needed when #9906 gets merged:
356# RPY=`$newest rpy2`
357# export RPY
358
359READLINE=`$newest readline`
360export READLINE
361
362RUBIKS=`$newest rubiks`
363export RUBIKS
364
365SAGE=`$newest sage`
366export SAGE
367
368SAGE_ROOT_REPO=`$newest sage_root`
369export SAGE_ROOT_REPO
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
435# build succeeded
436if [ "$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 ""
446fi
447
448echo "Sage build/upgrade complete!"
449