Ticket #9528: install

File install, 7.4 KB (added by was, 11 years ago)

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