Ticket #4029: trac_4029.2.patch

File trac_4029.2.patch, 5.0 KB (added by iandrus, 12 years ago)
  • sage-env

    # 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  
    44#
    55#  Set environment variables for building and/or running Sage.
    66#  You must source this; see below!
    7 # 
     7#
    88#  AUTHORS:   William Stein                            2005-12
    99#             David Kirkby <david.kirkby@onetel.net>   2005-12-17
    1010#
     
    1313##########################################################################
    1414#
    1515#  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
    1717#
    18 #             source local/bin/sage-env 
     18#             source local/bin/sage-env
    1919#
    2020#  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#
    2323##########################################################################
    2424
    2525# GUESS SAGE_ROOT from pwd
    2626SAVEDIR="`pwd`"
    2727if [ -f sage -a -d spkg ]; then
    2828    GUESSED_SAGE_ROOT="`pwd`"
    29 else 
     29else
    3030    if [ -f ../../sage -a -d ../../spkg ]; then
    3131        cd ../../
    3232        GUESSED_SAGE_ROOT="`pwd`"
     
    4242        echo "Error: You must set the SAGE_ROOT environment"
    4343        echo "variable or run this script from the SAGE_ROOT or "
    4444        echo "SAGE_ROOT/local/bin/ directory."
    45         exit 1
     45        return 1 2>/dev/null || exit 1
    4646    else
    4747        SAGE_ROOT="$GUESSED_SAGE_ROOT"
    4848        export SAGE_ROOT
     
    5757        echo "Error: The SAGE_ROOT environment variable is set to"
    5858        echo "a bad value. You must correct it or erase it and"
    5959        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
    6262    fi
    6363fi
    6464
     
    8282    echo "It is currently \"$SAGE_ROOT\"."
    8383    echo "Please correct this by moving Sage (or renaming one or more directories) first."
    8484    echo "Exiting now..."
    85     exit 1
     85    return 1 2>/dev/null || exit 1
    8686fi
    8787
    8888
     
    210210# The following is needed for openmpi:
    211211LD_LIBRARY_PATH="$SAGE_ROOT/local/lib/openmpi:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
    212212# 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 
     213LD_LIBRARY_PATH="$SAGE_ROOT/local/lib/R/lib:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
    214214# The following is needed for OS X (especially for the
    215215# Singular install).
    216216if [ `uname` = "Darwin" ]; then
     
    222222fi
    223223
    224224if [ "$1" = "-short" ]; then
    225     exit 0
     225    return 0 2>/dev/null || exit 0
    226226fi
    227227
    228228if [ -z "$RHOME" ]; then
    229229    RHOME="$SAGE_LOCAL/lib/R" && export RHOME
    230230fi
    231231
    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.
    235235
    236236if [ -z "$PKG_CONFIG_PATH" ]; then
    237237    PKG_CONFIG_PATH="$SAGE_LOCAL/lib/pkgconfig"
    238     export PKG_CONFIG_PATH 
     238    export PKG_CONFIG_PATH
    239239fi
    240240
    241241
     
    245245# This could be used in code to make special changes only when
    246246# code is being built as part of Sage.
    247247__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.
    250250if [ "$CC" = "" ]; then
    251251     CC="gcc"         && export CC
    252252fi
    253253 # Set the default C++ compiler to g++ if the environment variable
    254 # CXX is not set. 
     254# CXX is not set.
    255255if [ "$CXX" = "" ]; then
    256256    CXX="g++"         && export CXX
    257257fi
     
    277277
    278278if [ "$SAGE64" = "" ]; then
    279279    SAGE64="no"
    280 fi 
     280fi
    281281
    282282if [ "$SAGE64" != "yes" -a "$SAGE64" != "no" ]; then
    283283    echo "The environment variable SAGE64 (=$SAGE64) must be either unset, yes or no."
    284     exit 1
     284    return 1 2>/dev/null || exit 1
    285285fi
    286286
    287287# In case SAGE64 has been set to yes before re-inject it into the environment
     
    309309if [ "$RM" = "" ]; then
    310310    RM="rm"  && export RM
    311311fi
    312  
     312
    313313if [ "$RANLIB" = "" ]; then
    314314    RANLIB="ranlib"  && export RANLIB
    315315fi
    316  
     316
    317317if [ "$LN" = "" ]; then
    318318    LN="ln"  && export LN
    319319fi
    320  
     320
    321321if [ "$MKDIR" = "" ]; then
    322322    MKDIR="mkdir"  && export MKDIR
    323323fi
    324  
     324
    325325if [ "$CHMOD" = "" ]; then
    326326    CHMOD="chmod"  && export CHMOD
    327327fi
    328  
     328
    329329if [ "$TOUCH" = "" ]; then
    330330    TOUCH="touch"  && export TOUCH
    331331fi
     
    341341# See trac 7186 -- this is needed if ecl is moved
    342342ECLDIR="$SAGE_LOCAL/lib/ecl/" && export ECLDIR
    343343
    344 # Export variable names. 
     344# Export variable names.
    345345export SHAREDFLAGS
    346346export UNAME
    347347export CC