1 local/bin/make 000755 000314 000000 00000000000 11320004222 020073 2/usr/local/bin/gmake ustar 00pjeremy wheel 000000 000000 local/bin/gfortran 000755 000314 000000 00000000000 11423202337 021722 2/usr/local/bin/gfortran45 ustar 00pjeremy wheel 000000 000000 local/bin/gcc 000755 000314 000000 00000000000 11413615755 017561 2/usr/local/bin/gcc45 ustar 00pjeremy wheel 000000 000000 local/bin/g++ 000755 000314 000000 00000000000 11413615761 017216 2/usr/local/bin/g++45 ustar 00pjeremy wheel 000000 000000 spkg/base/sage-spkg 000755 000314 000000 00000031350 11412621140 015334 0 ustar 00pjeremy wheel 000000 000000 #!/usr/bin/env bash
2
3 # William Stein, 2005-12-20 -- removed "m" option from tar,
4 # which was seriously confusing the build process on some
5 # (too fast?) machines, especially for mpfr.
6
7 #######################################################
8 # Install a Sage package. This script is
9 # typically invoked by giving the command
10 # sage -i <package name>
11 #
12 # A package may assume that the following environment
13 # variables are defined:
14 #
15 # SAGE_ROOT -- root directory of sage install
16 # SAGE_LOCAL -- $SAGE_ROOT/local
17 # SAGE_DATA -- $SAGE_ROOT/data
18 # LIBRARY_PATH, PYTHONPATH, LD_LIBRARY_PATH, DYLD_LIBRARY_PATH
19 # CC, CXX, CFLAGS, CXXFLAGS, LDFLAGS, MAKE
20 #
21 # Your package script should try to build using the giving CC, CXX,
22 # CFLAGS, MAKE, etc, via a file spkg-install in your script.
23 #
24 # This script does the following:
25 #
26 # 1. Set environment variables (by calling sage-env)
27 # 2. Decompress package into a build directory
28 # 3. Run the script in the package called spkg-install
29 # 4. Return error 1 if anything goes wrong.
30 #
31 #######################################################
32
33 mymkdir()
34 {
35 if [ ! -d $1 ]; then
36 mkdir $1
37 fi
38 }
39
40 no_version()
41 {
42 if [ -z "`echo "$1" | grep -`" ]; then
43 echo "no version"
44 fi
45 }
46 # The following sets environment variables for building
47 # packages. (Using dot suggested by W. Cheung.)
48
49 . "$SAGE_ROOT/local/bin/sage-env"
50
51 cd "$SAGE_PACKAGES"
52
53 if [ $# -eq 0 ]; then
54 echo "Currently installed packages:"
55 /bin/ls -1 "$SAGE_PACKAGES/installed/"
56 exit 0
57 fi
58
59
60 cd "$SAGE_PACKAGES"
61 mymkdir "$BUILD"
62 mymkdir installed
63 cd "$BUILD"
64 mymkdir old
65
66 # the following two options are mutually exclusive -- i.e., you
67 # can give only one.
68
69 INFO=0
70 if [ $1 = '-info' ]; then
71 INFO=1
72 shift
73 fi
74
75 FORCE=0
76 if [ $1 = '-f' ]; then
77 FORCE=1
78 shift
79 fi
80 export FORCE
81
82 DELETE_TMP=0
83 if [ $1 = '-s' -o $1 = '-m' ]; then
84 DELETE_TMP=0
85 shift
86 fi
87
88 INSTALLED="$SAGE_PACKAGES/installed/"
89 PKG_NAME=`echo "$1" | sed -e "s/\.spkg$//"`
90 PKG_NAME=`basename "$PKG_NAME"`
91 PKG_SRC="$1"
92 PKG_BASE=`echo "$PKG_NAME" | sed -e "s/-.*//"`
93
94 # check if noclobber is set and warn about it
95 if [ $PKG_SRC == "noclobber" ]; then
96 echo "***********************************************************"
97 echo "* WARNING WARNING WARNING WARNING WARNING WARNING WARNING *"
98 echo "* *"
99 echo "* noclobber is set in .bashrc and/or .bash_profile - you *"
100 echo "* should consider disabling it. The Sage install should *"
101 echo "* continue to work, so don't worry about it too much. *"
102 echo "* *"
103 echo "* WARNING WARNING WARNING WARNING WARNING WARNING WARNING *"
104 echo "***********************************************************"
105 exit 0
106 fi
107
108 if [ ! -f "$PKG_SRC" ]; then
109 if [ -f "$SAGE_PACKAGES/standard/$PKG_NAME.spkg" ]; then
110 PKG_SRC="$SAGE_PACKAGES/standard/$PKG_NAME.spkg"
111 else
112 if [ -f "$SAGE_PACKAGES/optional/$PKG_NAME.spkg" ]; then
113 PKG_SRC="$SAGE_PACKAGES/optional/$PKG_NAME.spkg"
114 else
115 CUR=`pwd`
116 cd "$SAGE_PACKAGES"
117 PKG_NEWEST_VER=`./standard/newest_version "$PKG_NAME" 2> /dev/null`
118 if [ -n "$PKG_NEWEST_VER" ]; then
119 PKG_SRC="$SAGE_PACKAGES/standard/$PKG_NEWEST_VER.spkg"
120 else
121 PKG_NEWEST_VER=`./standard/newest_version -base "$PKG_NAME" 2> /dev/null`
122 if [ -n "$PKG_NEWEST_VER" ]; then
123 PKG_SRC="$SAGE_PACKAGES/standard/$PKG_NEWEST_VER.spkg"
124 fi
125 fi
126 fi
127 fi
128 fi
129
130 if [ $INFO -ne 0 ]; then
131 if [ ! -f "$PKG_SRC" ]; then
132 echo "Package $PKG_NAME not found"
133 fi
134 bunzip2 -c "$PKG_SRC" 2>/dev/null | tar Ofx - $PKG_NAME/SAGE.txt 2>/dev/null
135 if [ $? -ne 0 ]; then
136 tar Ofx "$PKG_SRC" "$PKG_NAME/SAGE.txt" 2>/dev/null
137 fi
138 echo ""
139 if [ $? -ne 0 ]; then
140 echo "No file SAGE.txt in $PKG_NAME"
141 exit 1
142 fi
143 exit 0
144 fi
145
146 echo "$PKG_NAME"
147
148 echo "Machine:"
149 uname -a
150
151 if [ -f "$INSTALLED/$PKG_NAME" -a $FORCE -eq 0 ]; then
152 echo "sage: $1 is already installed"
153 touch "$INSTALLED/$PKG_NAME"
154 exit 0
155 fi
156
157 cd "$SAGE_PACKAGES/build"
158
159 if [ $DELETE_TMP -eq 1 ]; then
160 echo "Deleting directories from past builds of previous/current versions of $PKG_NAME"
161 # Make triply sure that we are in the build directory before doing
162 # a scary "rm -rf".
163 cd "$SAGE_PACKAGES/build"
164 if [ $? -ne 0 ]; then
165 echo "Unable to find build directory."
166 else
167 rm -rf "$PKG_BASE-"*
168 fi
169 else
170 echo "Moving directories from past builds of previous/current versions of $PKG_NAME to build/old"
171 mv -f "$PKG_BASE-"* old/ 2>/dev/null
172 fi
173
174 if [ ! -f "$PKG_SRC" ]; then
175
176 echo "$0: file $PKG_NAME does not exist"
177 echo "Attempting to download it."
178 CUR=`pwd`
179 cd "$SAGE_PACKAGES"
180 if [ ! -d optional ]; then
181 mkdir optional
182 fi
183 cd optional
184
185 FOUND_VERSION=''
186 if [ -n "`no_version "$PKG_NAME"`" ]; then
187 echo "Searching for latest version of $PKG_NAME"
188 PKG_NAME=`sage-latest-online-package "$PKG_NAME"`
189 if [ $? -eq 0 ]; then
190 echo "Found package $PKG_NAME"
191 FOUND_VERSION='1'
192 else
193 echo "$PKG_NAME"
194 exit 1
195 fi
196 fi
197
198 # See trac ticket #7544. One should be able to install a package using
199 # sage -i <package-name> where <package-name> can be any of the
200 # following values:
201 #
202 # 1. <package>-x.y.z, i.e. the name of the package plus the package's
203 # version numbers.
204 # 2. the full name <package>-x.y.z.spkg, i.e. the name of the package in
205 # addition to the version numbers and the ".spkg" extension.
206 # 3. <URL>/<package>-x.y.z.spkg, i.e. the full URL where the package is
207 # hosted. This can be a URL on the Sage website or somewhere else.
208 # 4. /path/to/<package>-x.y.z.spkg, i.e. the package is found somewhere
209 # in your file system and you're giving an absolute or relative path
210 # to the package.
211 #
212 # See trac ticket #8043. If no version was specified but a version
213 # was found above, then $PKG_NAME now contains the version number.
214 # Download this, since it's a known Sage package. Otherwise,
215 # download the package specified by $1, since it either already
216 # contains the version number or is a URL.
217 if [ "x$FOUND_VERSION" = "x" ]; then
218 sage-download_package "$1"
219 else
220 sage-download_package "$PKG_NAME"
221 fi
222 if [ ! -f "$PKG_NAME.spkg" ]; then
223 echo "sage: Failed to download package $PKG_NAME from $SAGE_SERVER"
224 exit 1
225 fi
226 PKG_SRC="`pwd`/$PKG_NAME.spkg"
227 cd "$CUR"
228 fi
229
230 # * The -i option below to ignore checksum errors, since
231 # I've had problems with this on Solaris.
232 # * The m option avoids clock skew problems.
233
234 echo "Extracting package $PKG_SRC ..."
235 ls -l "$PKG_SRC"
236
237 if [ -d "$PKG_NAME" ]; then
238 echo "Removing previous version."
239 rm -rf "$PKG_NAME"
240 fi
241
242 bunzip2 -c "$PKG_SRC" 2>/dev/null | tar fxv - 2>/dev/null
243 if [ ! -d "$PKG_NAME" ]; then
244 tar fxv "$PKG_SRC"
245 fi
246 echo "Finished extraction"
247
248 if [ ! -d "$PKG_NAME" ]; then
249 echo "sage: After decompressing the directory $PKG_NAME does not exist"
250 echo "This means that the corresponding .spkg needs to be downloaded"
251 echo "again."
252 if [ -n "`no_version "$PKG_NAME"`" ]; then
253 echo "Searching for latest version of $PKG_NAME"
254 PKG_NAME=`sage-latest-online-package "$PKG_NAME"`
255 if [ $? -eq 0 ]; then
256 echo "Found package $PKG_NAME"
257 else
258 echo "$PKG_NAME"
259 exit 1
260 fi
261 fi
262 sage-download_package "$PKG_NAME"
263 echo `pwd`
264 bunzip2 -c "$PKG_NAME.spkg" | tar fxv -
265 if [ ! -d "$PKG_NAME.spkg" ]; then
266 tar fxv "$PKG_NAME.spkg"
267 fi
268 if [ ! -d "$PKG_NAME" ]; then
269 echo "Second download resulted in a corrupted package."
270 exit 1
271 fi
272 fi
273
274 if [ -f "$SAGE_PACKAGES/patches/$PKG_NAME.patch" ]; then
275 echo "Applying local patches for $PKG_NAME"
276 if ! patch -p0 < "$SAGE_PACKAGES/patches/$PKG_NAME.patch"; then
277 echo "Patching failed"
278 exit 1
279 fi
280 fi
281
282 cd "$PKG_NAME"
283 if [ ! -f spkg-install ]; then
284 echo "#!/usr/bin/env bash" > spkg-install
285 echo "" >> spkg-install
286 if [ -f setup.py ]; then
287 echo "python setup.py install" >> spkg-install
288 else
289 if [ -f configure ]; then
290 echo "./configure --prefix=\$SAGE_ROOT/local/" >> spkg-install
291 echo "make" >> spkg-install
292 echo "make install" >> spkg-install
293 else
294 echo "There is no spkg-install script, no setup.py, and no configure script,"
295 echo "so I do not know how to install $PKG_SRC."
296 exit 1
297 fi
298 fi
299 fi
300
301 chmod +x spkg-install
302
303 # this is just wrong... (so don't do it)
304 #echo "TOUCHING"
305 #touch * */* */*/* */*/*/* 1>/dev/null 2>/dev/null
306
307 echo "****************************************************"
308 echo "Host system"
309 echo "uname -a:"
310 uname -a
311 if [ $? -ne 0 ]; then
312 echo "Unable to determine host system information."
313 fi
314 echo "****************************************************"
315
316 echo "****************************************************"
317 echo "CC Version"
318 echo "$CC -v"
319 $CC -v
320 if [ $? -ne 0 ]; then
321 echo "Unable to determine C compiler version."
322 fi
323 echo "****************************************************"
324
325 BASEDIR=`pwd`
326 if [ -n "$DEBIAN_RELEASE" ]; then
327 SAGE_CHECK=''
328 if [ -e ./spkg-debian ]; then
329 time ./spkg-debian
330 else
331 time sage-build-debian $BASEDIR
332 fi
333 else
334 time ./spkg-install
335 fi
336
337 if [ $? -eq 0 ]; then
338 cd $INSTALLED
339 # TURNED OFF: Remove all old packages with the same name up to the first "-":
340 # rm -f $PKG_BASE-*
341
342 # Mark that the new package has been installed.
343 # This file will eventually be a certificate like in OS X.
344 echo "PACKAGE NAME: $PKG_NAME" > "$PKG_NAME"
345 echo "INSTALL DATE: `date`" >> "$PKG_NAME"
346 echo "UNAME: `uname -a`" >> "$PKG_NAME"
347 echo "Sage VERSION: `grep Sage $SAGE_LOCAL/bin/sage-banner`" >> "$PKG_NAME"
348 echo "Successfully installed $PKG_NAME"
349
350 cd $BASEDIR
351 if [ "$SAGE_CHECK" != "" -a -f spkg-check ]; then
352 echo "Running the test suite."
353 chmod +x spkg-check
354 ./spkg-check
355 if [ $? -ne 0 ]; then
356 echo "*************************************"
357 echo "Error testing package ** $PKG_NAME **"
358 echo "*************************************"
359 rm -f $SAGE_ROOT/spkg/installed/$PKG_NAME
360 echo "sage: An error occurred while testing $PKG_NAME"
361 echo "Please email sage-devel http://groups.google.com/group/sage-devel"
362 echo "explaining the problem and send the relevant part of"
363 echo "of $SAGE_ROOT/install.log. Describe your computer, operating system, etc."
364 echo "If you want to try to fix the problem yourself, *don't* just cd to"
365 echo "`pwd` and type 'make check' or whatever is appropriate."
366 echo "Instead, the following commands setup all environment variables"
367 echo "correctly and load a subshell for you to debug the error:"
368 echo "(cd '`pwd`' && '$SAGE_ROOT/sage' -sh)"
369 echo "When you are done debugging, you can type \"exit\" to leave the"
370 echo "subshell."
371 exit 1
372 else
373 echo "TEST SUITE: passed" >> "$PKG_NAME"
374 fi
375 fi
376
377
378 # Delete the temporary build directory if required.
379 if [ $DELETE_TMP -eq 1 ]; then
380 echo "Now cleaning up tmp files."
381 if [ -d "$SAGE_PACKAGES/build/$PKG_NAME" ]; then
382 # the if is there only to avoid the possibility of a weird bug.
383 rm -rf "$SAGE_PACKAGES/build/$PKG_NAME"
384 fi
385 else
386 echo "You can safely delete the temporary build directory"
387 echo "$SAGE_PACKAGES/build/$PKG_NAME"
388 fi
389
390 else
391 echo "sage: An error occurred while installing $PKG_NAME"
392 echo "Please email sage-devel http://groups.google.com/group/sage-devel"
393 echo "explaining the problem and send the relevant part of"
394 echo "of $SAGE_ROOT/install.log. Describe your computer, operating system, etc."
395 echo "If you want to try to fix the problem yourself, *don't* just cd to"
396 echo "`pwd` and type 'make check' or whatever is appropriate."
397 echo "Instead, the following commands setup all environment variables"
398 echo "correctly and load a subshell for you to debug the error:"
399 echo "(cd '`pwd`' && '$SAGE_ROOT/sage' -sh)"
400 echo "When you are done debugging, you can type \"exit\" to leave the"
401 echo "subshell."
402 exit 1
403 fi
404
405
406 echo "Making Sage/Python scripts relocatable..."
407
408 cd "$SAGE_LOCAL"/bin
409 ./sage-make_relative
410
411 echo "Finished installing $PKG_NAME.spkg"
412
413 # It's OK if the above fails -- in fact it will until Python
414 # itself gets installed. That's fine.
415 exit 0
416