Ticket #10303: trac_10303-scripts-SAGE64.v2.patch

File trac_10303-scripts-SAGE64.v2.patch, 8.5 KB (added by jhpalmieri, 11 years ago)

scripts repo

  • sage-build

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1290401054 28800
    # Node ID 97e1530398191b7760de24cba5cd8434da1d0be0
    # Parent  59635e5e648992b2bc16abf08c98e26e89b27ad3
    #10303: clean up use of SAGE64. Don't insist that it is only used on Solaris or OS X, only call sage-check-64 in sage-build and sage-spkg, store the setting of SAGE64 in the file SAGE_LOCAL/lib/sage-64.txt, and query the user if SAGE64 disagrees with the contents of that file, to prevent mixed 32-bit and 64-bit builds.
    
    diff -r 59635e5e6489 -r 97e153039819 sage-build
    a b if [ $DO_BUILD_ALL = 1 ]; then 
    8888   cd "$CUR"
    8989fi
    9090
    91 # In case SAGE64 has been set to yes before re-inject it into the environment
    92 # This is only done on OSX and Solaris since those are the only real multi lib
    93 # arches we support. Eventually Linux PPC on the PS3 might need to be added here
    94 source $SAGE_LOCAL/bin/sage-check-64
     91# Check whether this seems to a 64-bit build:
     92source "$SAGE_LOCAL"/bin/sage-check-64
     93
     94if [ $? -ne 0 ]; then
     95    exit 1
     96fi
    9597
    9698build "sage"
  • sage-check-64

    diff -r 59635e5e6489 -r 97e153039819 sage-check-64
    a b  
    11#!/usr/bin/env bash
    22
    3 # If SAGE64 is set to yes check if $SAGE_LOCAL/lib exists on Solaris as well as
    4 # OSX since those are currently the only two platforms which require SAGE64. If
    5 # it does not exist create the directory and then create a file sage-64.txt
    6 # Eventually Linux PPC on the PS3 might need to be added here
     3# WARNING: This file should not be executed directly.  It should be
     4# executed, using 'source', by other scripts which have set the
     5# environment correctly.  (This script is run by sage-spkg before
     6# running an spkg's spkg-install file.  It is also run by sage-build,
     7# and also by SAGE_ROOT/spkg/install before starting the build
     8# process.)
    79
    8 if [ "$SAGE64" = "yes" ]; then
    9     CHECKFILE="no"
    10     if [ `uname` = "SunOS" ]; then
    11         echo "Building Sage on Solaris in 64-bit mode"
    12         CHECKFILE="yes"
    13     fi
    14     if [ `uname` = "Darwin" ]; then
    15         echo "Building Sage on OS X in 64-bit mode"
    16         CHECKFILE="yes"
    17     fi
    18     if [ $CHECKFILE = "yes" ]; then
    19         if ! [ -d "$SAGE_LOCAL"/lib ]; then
    20             echo "Creating SAGE_LOCAL/lib since it does not exist"
    21             mkdir "$SAGE_LOCAL"/lib
    22         fi
    23         echo "Creating SAGE_LOCAL/lib/sage-64.txt since it does not exist"
    24         touch "$SAGE_LOCAL"/lib/sage-64.txt
     10# Check whether to build 64-bit or not.  Print a message if building
     11# 64-bit.
     12
     13# This script checks the variable SAGE64 as well as the file
     14# SAGE_LOCAL/lib/sage-64.txt.  If the file does not exist, then save
     15# the value of SAGE64 to that file, using value "no" if SAGE64 is not
     16# set.  If the file does exist, its contents should be either "yes" or
     17# "no".  If this agrees with the value of SAGE64, proceed.  If not,
     18# query the user about whether to continue.  If the user wants to
     19# continue, change the contents of the file to match SAGE64.
     20
     21if [ "$SAGE_LOCAL" = "" ]; then
     22    echo
     23    echo "SAGE_LOCAL undefined ... exiting"
     24    echo "Do not call sage-check-64 directly!"
     25    return 1
     26fi
     27
     28# Note that setting the variable SAGE64 to 'yes' is only allowed on OS
     29# X, Solaris, or OpenSolaris machines.  On any other platform, check
     30# the setting.  If bad, error and return.  If okay, return
     31# immediately: no need to do bother with the file
     32# SAGE_LOCAL/lib/sage-64.txt.
     33if [ "$UNAME" != Darwin ] && [ "$UNAME" != SunOS ]; then
     34    if [ "$SAGE64" != no ] && ! [ -z "$SAGE64" ]; then
     35        echo
     36        echo "Error: On any platform other than OS X, Solaris, or OpenSolaris,"
     37        echo "SAGE64 must be unset or set to 'no'."
     38        return 1
     39    else
     40        # exit silently if SAGE64=no or is unset
     41        return 0
    2542    fi
    2643fi
    2744
    28 # Check if SAGE_LOCAL/lib/sage-64.txt exists. If it does on Solaris and OSX
    29 # force the setting of SAGE64
    30 
    31 if [ -a "$SAGE_LOCAL"/lib/sage-64.txt ]; then
    32     echo "Detected SAGE64 flag"
    33     if [ `uname` = "SunOS" ]; then
    34         echo "Building Sage on Solaris in 64-bit mode"
    35         SAGE64="yes"; export SAGE64
     45# if SAGE64 not set or empty, set it to the contents of $sage64file,
     46# or to "no" if that file is not present.
     47sage64file="$SAGE_LOCAL"/lib/sage-64.txt
     48if [ -z "$SAGE64" ]; then
     49    # If SAGE64 was not set, it defaults to the contents of
     50    # $sage64file, or to "no" if that file is not present.
     51    if [ -f "$sage64file" ]; then
     52        SAGE64=`cat "$sage64file"`
     53    else
     54        SAGE64=no
    3655    fi
    37     if [ `uname` = "Darwin" ]; then
    38         echo "Building Sage on OS X in 64-bit mode"
    39         SAGE64="yes"; export SAGE64
    40     fi
     56    export SAGE64
    4157fi
    4258
     59# Now make sure SAGE64 is either "yes" or "no" and that it is
     60# consistent with the contents of SAGE_LOCAL/lib/sage-64.txt.
     61case "$SAGE64" in
     62    yes|no)
     63        if [ -f "$sage64file" ]; then
     64            contents=`cat "$sage64file"`
     65            if [ "$contents" != "$SAGE64" ]; then
     66                echo
     67                echo "Warning: SAGE64 (=$SAGE64) and the file SAGE_LOCAL/lib/sage-64.txt"
     68                echo "(which contains '$contents') are not compatible.  Continuing"
     69                echo "could lead to incompatible files in your Sage build, some"
     70                echo "32-bit and some 64-bit."
     71                echo
     72                echo -n "Continue anyway [y/N]?"
     73                read CONFIRM
     74                case $CONFIRM in
     75                    y|Y|YES|yes|Yes)
     76                        echo $SAGE64 > "$sage64file";;
     77                    *)
     78                        echo "Aborting"
     79                        return 1;;
     80                esac
     81            fi
     82        else
     83            mkdir -p "$SAGE_LOCAL"/lib
     84            echo "Creating SAGE_LOCAL/lib/sage-64.txt since it does not exist."
     85            if [ $SAGE64 = no ]; then
     86                echo "32-bit build, so writing 'no' to SAGE_LOCAL/lib/sage-64.txt."
     87            else
     88                echo "64-bit build, so writing 'yes' to SAGE_LOCAL/lib/sage-64.txt."
     89            fi
     90            echo $SAGE64 > "$sage64file"
     91        fi
     92        ;;
     93    *)
     94        echo
     95        echo "The environment variable SAGE64 (=$SAGE64) must be either unset, yes or no."
     96        echo "Aborting."
     97        return 1
     98        ;;
     99esac
     100
     101# Now print a message if building 64-bit.
     102if [ "$SAGE64" = "yes" ]; then
     103    echo "Building Sage in 64-bit mode"
     104fi
  • sage-env

    diff -r 59635e5e6489 -r 97e153039819 sage-env
    a b if [ 1 = 2 ]; then 
    101101    echo "MAKE        The make program (e.g. make, /usr/bin/make or /usr/local/bin/gmake)"
    102102    echo "MAKEFLAGS   Flag(s) to make (e.g. -j4)."
    103103    echo "RANLIB      Archiver ranlib (e.g. ranlib, /usr/ccs/bin/ranlib etc)"
    104     echo "SAGE64      Set to \"yes\" to build a 64-bit binary (Solaris SPARC or Solaris x86 only)"
     104    echo "SAGE64      Set to \"yes\" to build a 64-bit binary (OS X, Solaris, or OpenSolaris only)"
    105105    echo "SHAREDFLAGS Flag(s) necessary for building a shared library (e.g. -fPIC or -xcode=pic32)"
    106106    echo "We attempt to set this to sensible values, but check below to"
    107107    echo "ensure they are OK. If you wish to override any then please use:"
    if [ "$LDFLAGS" = "" ]; then 
    275275    LDFLAGS=""          && export LDFLAGS
    276276fi
    277277
    278 if [ "$SAGE64" = "" ]; then
    279     SAGE64="no"
    280 fi
    281 
    282 if [ "$SAGE64" != "yes" -a "$SAGE64" != "no" ]; then
    283     echo "The environment variable SAGE64 (=$SAGE64) must be either unset, yes or no."
    284     exit 1
    285 fi
    286 
    287 # In case SAGE64 has been set to yes before re-inject it into the environment
    288 # This is only done on OSX and Solaris since those are the only real multi lib
    289 # arches we support. Eventually Linux PPC on the PS3 might need to be added here
    290 source $SAGE_LOCAL/bin/sage-check-64 2> /dev/null
    291 export SAGE64
    292 
    293278if [ "$CXXFLAGS" = "" ]; then
    294279   CXXFLAGS="$CFLAGS"
    295280fi
  • sage-make_devel_packages

    diff -r 59635e5e6489 -r 97e153039819 sage-make_devel_packages
    a b mkdir $SCRIPTS 
    138138chmod +x sage-*
    139139chmod -x sage-README-osx.txt sage-banner sage-gdb-commands
    140140chmod -x sage-maxima.lisp sage-verify-pyc
     141chmod -x sage-check-64
    141142rm sage-*~
    142143
    143144cp -pr sage-* .hg* ipy_profile_sage.py $SCRIPTS/
  • sage-sdist

    diff -r 59635e5e6489 -r 97e153039819 sage-sdist
    a b cd "$CUR" 
    3939cp $SAGE_ROOT/local/bin/sage-spkg $PKGDIR/base/
    4040cp $SAGE_ROOT/local/bin/sage-env  $PKGDIR/base/
    4141cp $SAGE_ROOT/local/bin/sage-make_relative $PKGDIR/base/
     42cp $SAGE_ROOT/local/bin/sage-check-64 $PKGDIR/base/
    4243
    4344TMP="/tmp/$TARGET"
    4445
  • sage-spkg

    diff -r 59635e5e6489 -r 97e153039819 sage-spkg
    a b uname -a 
    311311if [ $? -ne 0 ]; then
    312312    echo "Unable to determine host system information."
    313313fi
     314# Check whether this seems to a 64-bit build:
     315source "$SAGE_LOCAL"/bin/sage-check-64
     316if [ $? -ne 0 ]; then
     317    exit 1
     318fi
    314319echo "****************************************************"
    315320
    316321echo "****************************************************"