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

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

scripts repo

  • sage-build

    # HG changeset patch
    # User J. H. Palmieri <palmieri@math.washington.edu>
    # Date 1290529918 28800
    # Node ID e6e1a00c029dbc63d72e500c306ac2b0c4ffefb3
    # 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 e6e1a00c029d 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 e6e1a00c029d 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
    25     fi
     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
    2626fi
    2727
    28 # Check if SAGE_LOCAL/lib/sage-64.txt exists. If it does on Solaris and OSX
    29 # force the setting of SAGE64
     28# Now make sure SAGE64 is either "yes" or "no" and that it is
     29# consistent with the contents of SAGE_LOCAL/lib/sage-64.txt.
     30sage64file="$SAGE_LOCAL"/lib/sage-64.txt
     31case "$SAGE64" in
     32    yes|no)
     33        if [ -f "$sage64file" ]; then
     34            contents=`cat "$sage64file"`
     35            if [ "$contents" != "$SAGE64" ]; then
     36                echo
     37                echo "Warning: SAGE64 (=$SAGE64) and the file SAGE_LOCAL/lib/sage-64.txt"
     38                echo "(which contains '$contents') are not compatible.  Continuing"
     39                echo "could lead to incompatible files in your Sage build, some"
     40                echo "32-bit and some 64-bit."
     41                echo
     42                echo -n "Continue anyway [y/N]?"
     43                read CONFIRM
     44                case $CONFIRM in
     45                    y|Y|YES|yes|Yes)
     46                        echo $SAGE64 > "$sage64file";;
     47                    *)
     48                        echo "Aborting"
     49                        return 1;;
     50                esac
     51            fi
     52        else
     53            mkdir -p "$SAGE_LOCAL"/lib
     54            if [ $SAGE64 = no ]; then
     55                echo "Creating SAGE_LOCAL/lib/sage-64.txt since it does not exist."
     56                echo "SAGE64='no', so writing 'no' to SAGE_LOCAL/lib/sage-64.txt."
     57            else
     58                echo "Creating SAGE_LOCAL/lib/sage-64.txt since it does not exist."
     59                echo "64-bit build, so writing 'yes' to SAGE_LOCAL/lib/sage-64.txt."
     60            fi
     61            echo $SAGE64 > "$sage64file"
     62        fi
     63        ;;
     64    '')
     65        # if SAGE64 not set or empty, set it to the contents of
     66        # $sage64file, or to "no" if that file is not present.
     67        if [ -f "$sage64file" ]; then
     68            SAGE64=`cat "$sage64file"`
     69        else
     70            SAGE64=no
     71            mkdir -p "$SAGE_LOCAL"/lib
     72            echo "Creating SAGE_LOCAL/lib/sage-64.txt since it does not exist."
     73            echo "SAGE64 unset, so writing 'no' to SAGE_LOCAL/lib/sage-64.txt."
     74            echo $SAGE64 > "$sage64file"
     75        fi
     76        export SAGE64
     77        ;;
     78    *)
     79        echo
     80        echo "The environment variable SAGE64 (=$SAGE64) must be either unset, yes or no."
     81        echo "Aborting."
     82        return 1
     83        ;;
     84esac
    3085
    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
    36     fi
    37     if [ `uname` = "Darwin" ]; then
    38         echo "Building Sage on OS X in 64-bit mode"
    39         SAGE64="yes"; export SAGE64
    40     fi
     86# Now print a message if building 64-bit.
     87if [ "$SAGE64" = "yes" ]; then
     88    echo "Building Sage in 64-bit mode"
    4189fi
    42 
  • sage-env

    diff -r 59635e5e6489 -r e6e1a00c029d sage-env
    a b fi 
    8787
    8888
    8989if [ 1 = 2 ]; then
    90     echo "The following enviroment variables can be set by the user"
     90    echo
     91    echo "WARNING: At least some of the following information is outdated."
     92    echo "See the Sage installation guide for more up-to-date information"
     93    echo "about environment variables related to Sage."
     94    echo
     95    echo "The following environment variables can be set by the user"
    9196    echo "AR          The archiver (e.g. ar, /usr/ccs/bin/ar or /usr/bin/ar)"
    9297    echo "AS          The assembler (e.g. as, /usr/ccs/bin/as or /usr/bin/as)"
    9398    echo "CC          The C compiler (e.g cc, /opt/SUNWspro/bin/cc or /usr/bin/gcc)"
    if [ 1 = 2 ]; then 
    101106    echo "MAKE        The make program (e.g. make, /usr/bin/make or /usr/local/bin/gmake)"
    102107    echo "MAKEFLAGS   Flag(s) to make (e.g. -j4)."
    103108    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)"
    105109    echo "SHAREDFLAGS Flag(s) necessary for building a shared library (e.g. -fPIC or -xcode=pic32)"
    106     echo "We attempt to set this to sensible values, but check below to"
     110    echo "We attempt to set these to sensible values, but check below to"
    107111    echo "ensure they are OK. If you wish to override any then please use:"
    108     echo "setenv NAME_OF_ENVIROMENT_VARIABLE value_of_enviroment_variable"
     112    echo "setenv NAME_OF_ENVIRONMENT_VARIABLE value_of_environment_variable"
    109113    echo "(if you use tcsh, csh or a similar shell) or"
    110     echo "NAME_OF_ENVIROMENT_VARIABLE value_of_enviroment_variable"
    111     echo "export NAME_OF_ENVIROMENT_VARIABLE"
     114    echo "NAME_OF_ENVIRONMENT_VARIABLE=value_of_environment_variable"
     115    echo "export NAME_OF_ENVIRONMENT_VARIABLE"
    112116    echo "if you use sh, bash or a similar shell"
     117    echo
     118    echo "See also the Sage installation guide for a list of Sage-specific"
     119    echo "environment variables which you can set to control the build process"
     120    echo "or other aspects of Sage's behavior."
     121    echo
    113122fi
    114123
    115124# Setting Sage-related location environment variables.
    fi 
    245254# This could be used in code to make special changes only when
    246255# code is being built as part of Sage.
    247256__sage__="" && export __sage__
    248 # Set the default compiler to gcc if the enviroment variable
     257# Set the default compiler to gcc if the environment variable
    249258# CC is not set.
    250259if [ "$CC" = "" ]; then
    251260     CC="gcc"         && export CC
    if [ "$LDFLAGS" = "" ]; then 
    275284    LDFLAGS=""          && export LDFLAGS
    276285fi
    277286
    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 
    293287if [ "$CXXFLAGS" = "" ]; then
    294288   CXXFLAGS="$CFLAGS"
    295289fi
    echo "LN=$LN" 
    361355echo "MAKE=$MAKE"
    362356echo "MAKEFLAGS=$MAKEFLAGS (MFLAGS will be exported the same too)"
    363357echo "RANLIB=$RANLIB"
    364 echo "SAGE64=$SAGE64"
    365358echo "SHAREDFLAGS=$SHAREDFLAGS"
    366359echo "If any of the above are wrong, or are not optimal, override"
    367 echo "them by setting the appropiate enviroment variable."
     360echo "them by setting the appropiate environment variable."
    368361fi
  • sage-make_devel_packages

    diff -r 59635e5e6489 -r e6e1a00c029d 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 e6e1a00c029d 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 e6e1a00c029d 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 "****************************************************"