# HG changeset patch
# User Ivan Andrus <darthandrus@gmail.com>
# Date 1293654359 -3600
# Node ID db0a6a044a3621472dd315b3439e2b59e1b6bfd3
# Parent cd55de2f84b552a15c14613e6c467147c37ec790
[mq]: trac_4029.patch
diff --git a/sage-env b/sage-env
a
|
b
|
|
4 | 4 | # |
5 | 5 | # Set environment variables for building and/or running Sage. |
6 | 6 | # You must source this; see below! |
7 | | # |
| 7 | # |
8 | 8 | # AUTHORS: William Stein 2005-12 |
9 | 9 | # David Kirkby <david.kirkby@onetel.net> 2005-12-17 |
10 | 10 | # |
… |
… |
|
13 | 13 | ########################################################################## |
14 | 14 | # |
15 | 15 | # If you want to set all environment variables for your shell like |
16 | | # they are during the build of Sage packages, type |
| 16 | # they are during the build of Sage packages, type |
17 | 17 | # |
18 | | # source local/bin/sage-env |
| 18 | # source local/bin/sage-env |
19 | 19 | # |
20 | 20 | # from the SAGE_ROOT directory. To do the same from a /bin/bash |
21 | | # script use ". local/bin/sage-env". |
22 | | # |
| 21 | # script use ". local/bin/sage-env". |
| 22 | # |
23 | 23 | ########################################################################## |
24 | 24 | |
25 | 25 | # GUESS SAGE_ROOT from pwd |
26 | 26 | SAVEDIR="`pwd`" |
27 | 27 | if [ -f sage -a -d spkg ]; then |
28 | 28 | GUESSED_SAGE_ROOT="`pwd`" |
29 | | else |
| 29 | else |
30 | 30 | if [ -f ../../sage -a -d ../../spkg ]; then |
31 | 31 | cd ../../ |
32 | 32 | GUESSED_SAGE_ROOT="`pwd`" |
… |
… |
|
42 | 42 | echo "Error: You must set the SAGE_ROOT environment" |
43 | 43 | echo "variable or run this script from the SAGE_ROOT or " |
44 | 44 | echo "SAGE_ROOT/local/bin/ directory." |
45 | | exit 1 |
| 45 | return 1 2>/dev/null || exit 1 |
46 | 46 | else |
47 | 47 | SAGE_ROOT="$GUESSED_SAGE_ROOT" |
48 | 48 | export SAGE_ROOT |
… |
… |
|
57 | 57 | echo "Error: The SAGE_ROOT environment variable is set to" |
58 | 58 | echo "a bad value. You must correct it or erase it and" |
59 | 59 | echo "run this script from the SAGE_ROOT or" |
60 | | echo "SAGE_ROOT/local/bin/ directory." |
61 | | exit 1 |
| 60 | echo "SAGE_ROOT/local/bin/ directory." |
| 61 | return 1 2>/dev/null || exit 1 |
62 | 62 | fi |
63 | 63 | fi |
64 | 64 | |
… |
… |
|
82 | 82 | echo "It is currently \"$SAGE_ROOT\"." |
83 | 83 | echo "Please correct this by moving Sage (or renaming one or more directories) first." |
84 | 84 | echo "Exiting now..." |
85 | | exit 1 |
| 85 | return 1 2>/dev/null || exit 1 |
86 | 86 | fi |
87 | 87 | |
88 | 88 | |
… |
… |
|
210 | 210 | # The following is needed for openmpi: |
211 | 211 | LD_LIBRARY_PATH="$SAGE_ROOT/local/lib/openmpi:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH |
212 | 212 | # The following is needed for R (in case the Sage install is moved): |
213 | | LD_LIBRARY_PATH="$SAGE_ROOT/local/lib/R/lib:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH |
| 213 | LD_LIBRARY_PATH="$SAGE_ROOT/local/lib/R/lib:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH |
214 | 214 | # The following is needed for OS X (especially for the |
215 | 215 | # Singular install). |
216 | 216 | if [ `uname` = "Darwin" ]; then |
… |
… |
|
222 | 222 | fi |
223 | 223 | |
224 | 224 | if [ "$1" = "-short" ]; then |
225 | | exit 0 |
| 225 | return 0 2>/dev/null || exit 0 |
226 | 226 | fi |
227 | 227 | |
228 | 228 | if [ -z "$RHOME" ]; then |
229 | 229 | RHOME="$SAGE_LOCAL/lib/R" && export RHOME |
230 | 230 | fi |
231 | 231 | |
232 | | # PKG_CONFIG_PATH is used by 'pkg-config' on Solaris and Linux, |
233 | | # but at least some versions of OS X do not have the pkg-config |
234 | | # command, so relying on this is not wise on OS X. |
| 232 | # PKG_CONFIG_PATH is used by 'pkg-config' on Solaris and Linux, |
| 233 | # but at least some versions of OS X do not have the pkg-config |
| 234 | # command, so relying on this is not wise on OS X. |
235 | 235 | |
236 | 236 | if [ -z "$PKG_CONFIG_PATH" ]; then |
237 | 237 | PKG_CONFIG_PATH="$SAGE_LOCAL/lib/pkgconfig" |
238 | | export PKG_CONFIG_PATH |
| 238 | export PKG_CONFIG_PATH |
239 | 239 | fi |
240 | 240 | |
241 | 241 | |
… |
… |
|
245 | 245 | # This could be used in code to make special changes only when |
246 | 246 | # code is being built as part of Sage. |
247 | 247 | __sage__="" && export __sage__ |
248 | | # Set the default compiler to gcc if the enviroment variable |
249 | | # CC is not set. |
| 248 | # Set the default compiler to gcc if the enviroment variable |
| 249 | # CC is not set. |
250 | 250 | if [ "$CC" = "" ]; then |
251 | 251 | CC="gcc" && export CC |
252 | 252 | fi |
253 | 253 | # Set the default C++ compiler to g++ if the environment variable |
254 | | # CXX is not set. |
| 254 | # CXX is not set. |
255 | 255 | if [ "$CXX" = "" ]; then |
256 | 256 | CXX="g++" && export CXX |
257 | 257 | fi |
… |
… |
|
277 | 277 | |
278 | 278 | if [ "$SAGE64" = "" ]; then |
279 | 279 | SAGE64="no" |
280 | | fi |
| 280 | fi |
281 | 281 | |
282 | 282 | if [ "$SAGE64" != "yes" -a "$SAGE64" != "no" ]; then |
283 | 283 | echo "The environment variable SAGE64 (=$SAGE64) must be either unset, yes or no." |
284 | | exit 1 |
| 284 | return 1 2>/dev/null || exit 1 |
285 | 285 | fi |
286 | 286 | |
287 | 287 | # In case SAGE64 has been set to yes before re-inject it into the environment |
… |
… |
|
309 | 309 | if [ "$RM" = "" ]; then |
310 | 310 | RM="rm" && export RM |
311 | 311 | fi |
312 | | |
| 312 | |
313 | 313 | if [ "$RANLIB" = "" ]; then |
314 | 314 | RANLIB="ranlib" && export RANLIB |
315 | 315 | fi |
316 | | |
| 316 | |
317 | 317 | if [ "$LN" = "" ]; then |
318 | 318 | LN="ln" && export LN |
319 | 319 | fi |
320 | | |
| 320 | |
321 | 321 | if [ "$MKDIR" = "" ]; then |
322 | 322 | MKDIR="mkdir" && export MKDIR |
323 | 323 | fi |
324 | | |
| 324 | |
325 | 325 | if [ "$CHMOD" = "" ]; then |
326 | 326 | CHMOD="chmod" && export CHMOD |
327 | 327 | fi |
328 | | |
| 328 | |
329 | 329 | if [ "$TOUCH" = "" ]; then |
330 | 330 | TOUCH="touch" && export TOUCH |
331 | 331 | fi |
… |
… |
|
341 | 341 | # See trac 7186 -- this is needed if ecl is moved |
342 | 342 | ECLDIR="$SAGE_LOCAL/lib/ecl/" && export ECLDIR |
343 | 343 | |
344 | | # Export variable names. |
| 344 | # Export variable names. |
345 | 345 | export SHAREDFLAGS |
346 | 346 | export UNAME |
347 | 347 | export CC |