Ticket #14406: trac_14406+reviewer-v3.patch

File trac_14406+reviewer-v3.patch, 15.7 KB (added by jpflori, 8 years ago)
  • (a) a/spkg/base/prereq-1.1-install vs. (b) b/spkg/base/prereq-1.2-install

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1365000805 -7200
    # Node ID 9a6e60170bb14bb662eaadc1236eb17275b04585
    # Parent  43b20c159a39cff4e0a59f0d59ea3b109649c50c
    Trac #14406: Various prereq fixes
    * Allow Sage to build on Cygwin without setting SAGE_PORT.
    * Check for tar before actually untarring the prereq tarball (originally #14407), only do these checks if SAGE_PORT is unset.
    
    diff --git a/spkg/base/prereq-1.1-install b/spkg/base/prereq-1.2-install
    rename from spkg/base/prereq-1.1-install
    rename to spkg/base/prereq-1.2-install
    a b  
    44###########################################
    55
    66
    7 TARGET=prereq-1.1
     7TARGET=prereq-1.2
    88if [ "x$SAGE_BUILD_DIR" = x ]; then
    99    SAGE_BUILD_DIR="$SAGE_ROOT/spkg/build"
    1010fi
     
    2121
    2222echo "Starting prerequisite check."
    2323echo "Machine: `uname -a`"
     24echo ""
    2425
    2526if [ "x$SAGE_PORT" = x ]; then
    26     if [ `uname | sed -e 's/WIN.\+/WIN/'` = "CYGWIN" ]; then
    27         echo "Unfortunately, building SAGE on Cygwin is not currently supported,"
    28         echo "though we are actively working on supporting it.  If you would like"
    29         echo "to help with the porting effort, please post to"
    30         echo ""
    31         echo "   http://groups.google.com/group/sage-windows"
    32         echo ""
    33         echo "Also, see http://trac.sagemath.org/sage_trac/ticket/6743"
    34         echo "In the meantime, to run Sage on Windows, please use"
    35         echo "a virtualization solution instead, such as VirtualBox"
    36         echo ""
    37         echo "To get past this message, export the variable 'SAGE_PORT' to"
    38         echo "something non-empty."
    39         exit 1
    40     elif [ "$UNAME" = "SunOS" ]; then
     27    if [ "$UNAME" = "SunOS" ]; then
    4128       if [ "$RELEASE" = "5.9" ] || [ "$RELEASE" = "5.8" ] || [ "$RELEASE" = "5.7" ] || [ "$RELEASE" = "5.6" ] ; then
    4229          echo "Sage is not supported on any version of Solaris earlier than 10."
    4330          echo "Sage has been tested on the first release of Solaris 10"
     
    4734          echo "More information can be found about Sage on Solaris"
    4835          echo "on the Wiki at http://wiki.sagemath.org/solaris"
    4936          echo ""
    50           echo "To get past this message, export the variable SAGE_PORT to"
    51           echo "something non-empty."
    52           exit 1
     37          fail=yes
    5338       fi
    5439    elif [ "$UNAME" = "HP-UX" ]; then
    5540        echo "You are attempting to build Sage on HP's HP-UX operating system,"
     
    6348        echo "http://groups.google.com/group/sage-devel"
    6449        echo "The Sage community would also appreciate any patches you submit."
    6550        echo ""
    66         echo "To get past this message, export the variable SAGE_PORT to"
    67         echo "something non-empty."
    68         exit 1
     51        fail=yes
    6952    elif [ "$UNAME" = "AIX" ]; then
    7053        echo "You are attempting to build Sage on IBM's AIX operating system,"
    7154        echo "which is not a supported platform for Sage yet. Things may or"
     
    7457        echo "http://groups.google.com/group/sage-devel"
    7558        echo "The Sage community would also appreciate any patches you submit."
    7659        echo ""
    77         echo "To get past this message, export the variable SAGE_PORT to"
    78         echo "something non-empty."
    79         exit 1
     60        fail=yes
    8061    elif [ "$UNAME" = "IRIX" ] || [ "$UNAME" = "IRIX64"  ]; then
    8162        echo "You are attempting to build Sage on SGI's IRIX operating system,"
    8263        echo "which is not a supported platform for Sage yet. Things may or"
     
    8566        echo "http://groups.google.com/group/sage-devel"
    8667        echo "The Sage community would also appreciate any patches you submit."
    8768        echo ""
    88         echo "To get past this message, export the variable SAGE_PORT to"
    89         echo "something non-empty."
    90         exit 1
     69        fail=yes
    9170    elif [ "$UNAME" = "Tru64" ]; then
    9271        echo "You are attempting to build Sage on HP's Tru64 operating system,"
    9372        echo "which is not a supported platform for Sage yet. Things may or"
     
    9675        echo "http://groups.google.com/group/sage-devel"
    9776        echo "The Sage community would also appreciate any patches you submit."
    9877        echo ""
    99         echo "To get past this message, export the variable SAGE_PORT to"
    100         echo "something non-empty."
    101         exit 1
     78        fail=yes
    10279    elif [ "$UNAME" = "FreeBSD" ]; then
    10380        echo "You are attempting to build Sage on the FreeBSD operating system,"
    10481        echo "which is not a supported platform for Sage yet, though"
     
    10885        echo "http://groups.google.com/group/sage-devel"
    10986        echo "The Sage community would also appreciate any patches you submit."
    11087        echo ""
    111         echo "To get past this message, export the variable SAGE_PORT to"
    112         echo "something non-empty."
    113         exit 1
     88        fail=yes
    11489    elif [ "$UNAME" != "SunOS" ] && [ "$UNAME" != "Darwin" ] && [ "$UNAME" != "Linux" ]; then
    11590        echo "You are attempting to build Sage on $UNAME,"
    11691        echo "which is not a supported platform for Sage yet. Things may or"
     
    11994        echo "http://groups.google.com/group/sage-devel"
    12095        echo "The Sage community would also appreciate any patches you submit."
    12196        echo ""
    122         echo "To get past this message, export the variable SAGE_PORT to"
    123         echo "something non-empty."
     97        fail=yes
     98    fi
     99
     100    # Test versions of "tar" and "make".
     101    have_gnu_tar=`tar --version 2>&1 | grep GNU`
     102    have_bsd_tar=`tar --version 2>&1 | grep bsdtar`
     103    have_gnu_make=`make --version 2>&1 | grep GNU`
     104
     105    if [ -z "${have_gnu_tar}${have_bsd_tar}" ] ; then
     106         echo "You MUST use either the GNU or BSD version of tar, as some parts of the"
     107         echo "Sage source code are contained in tar files, which were produced with GNU"
     108         echo "tar. These are not POSIX compliant tar files (unless they were created with"
     109         echo "the --posix option), so can not always be extracted with other 'tar'"
     110         echo "programs."
     111         echo ""
     112         echo "Please ensure that a GNU or BSD version of tar is first in your path."
     113         echo ""
     114         fail=yes
     115
     116         if [ -f "/usr/sfw/bin/gtar" ] ; then
     117            echo "There is a copy of GNU tar, but renamed to 'gtar' in"
     118            echo "the directory /usr/sfw/bin. It is suggested that you copy"
     119            echo "/usr/sfw/bin/gtar to a different directory, renaming it"
     120            echo "'tar' instead of gtar. Then ensure that directory is in"
     121            echo "you path before /usr/bin, so whenever you type 'tar' you"
     122            echo "run the GNU version."
     123            echo ""
     124            echo "Executing something like"
     125            echo ""
     126            echo '$ mkdir $HOME/bins-for-sage'
     127            echo '$ cp /usr/sfw/bin/gtar $HOME/bins-for-sage/tar'
     128            echo '$ export PATH=$HOME/bins-for-sage:$PATH'
     129            echo ""
     130            echo "will put the GNU version of 'tar' in your path before /usr/bin/."
     131            echo ""
     132            echo "If you type 'tar --version', it should be obvious"
     133            echo "whether the GNU version of 'tar' is first in your path or"
     134            echo "not."
     135            echo ""
     136        fi
     137    fi
     138
     139    if [ -z "${have_gnu_make}" ] ; then
     140         echo "Due to numerous GNUisms, you MUST use the GNU version of 'make'"
     141         echo "to build Sage. Other versions will not work."
     142         echo ""
     143         fail=yes
     144
     145         if [ -f "/usr/sfw/bin/gmake" ] ; then
     146            echo "There is a copy of GNU make, but renamed to 'gmake' in"
     147            echo "the directory /usr/sfw/bin. It is suggested that you copy"
     148            echo "/usr/sfw/bin/gmake to a different directory, renaming it"
     149            echo "'make' instead of gmake. Then ensure that directory is in"
     150            echo "you path before /usr/ccs/bin, so whenever you type 'make' you"
     151            echo "run the GNU version."
     152            echo ""
     153            echo "Executing something like"
     154            echo ""
     155            echo '$ mkdir $HOME/bins-for-sage'
     156            echo '$ cp /usr/sfw/bin/gmake $HOME/bins-for-sage/make'
     157            echo '$ export PATH=$HOME/bins-for-sage:$PATH'
     158            echo ""
     159            echo "will put the GNU version of 'make' in your path before /usr/ccs/bin/."
     160            echo ""
     161            echo "If you type 'make --version', it should be obvious"
     162            echo "whether the GNU version of 'make' is first in your path or"
     163            echo "not."
     164            echo ""
     165        fi
     166    fi
     167
     168    if [ x$fail = xyes ]; then
     169        echo "To get past this message and try building Sage anyway,"
     170        echo "export the variable SAGE_PORT to something non-empty."
    124171        exit 1
    125172    fi
    126173fi
    127174
     175
    128176# Only run configure if the tarfile exists.  Unfortunately, sage-update
    129177# does not update the base packages and we cannot retro-actively change
    130178# that in earlier versions.  So the only thing to do is to skip this
    131179# test.
    132180prereq_tarball="$SAGE_ROOT/spkg/base/$TARGET.tar.gz"
    133181if [ -f "$prereq_tarball" ]; then
    134     gzip -cd "$prereq_tarball" | tar xf - --no-same-owner
     182    gzip -cd "$prereq_tarball" | tar xf -
    135183    if [ $? -ne 0 ]; then
    136184        echo >&2 "Error: failed to extract '$prereq_tarball'"
    137185        exit 1
     
    261309    fi
    262310fi
    263311
    264 # Solaris only
    265 # Sun's 'tar' and 'make' are unsuitable for building Sage.
    266 # So check on Solaris systems that the GNU versions are used.
    267 # One issue, which still remains and will make a build non-trivial
    268 # on Solaris is the fact that the first linker and assembler
    269 # in the path must be the ones used by gcc if the user is using gcc
    270 # to compile Sage. This is not addressed in this version of 'prereq'
    271 # but will in a later one.
    272 
    273 if [ "$UNAME" = "SunOS" ] ; then
    274    if [ -z "`tar --version 2>&1 | grep GNU`" ] ; then
    275       echo ""
    276       echo "ERROR **********************************************"
    277       echo "ERROR **********************************************"
    278       echo "You MUST also use the GNU version of tar, as some parts"
    279       echo "of the Sage source code are compressed tar files, which"
    280       echo "were compressed with GNU tar. GNU tar does not produce"
    281       echo "POSIX compliant tar files unless called with the --posix"
    282       echo "option, so can not always be extracted with Sun's tar."
    283       echo ""
    284       echo ""
    285       echo "Therefore, to build Sage on Solaris you MUST have"
    286       echo "the GNU version of tar in your path before the Sun version"
    287       echo ""
    288       if [ -f "/usr/sfw/bin/gtar" ]  && [ -f "/usr/sfw/bin/gmake" ] ; then
    289           echo "There is a copy of GNU tar, but renamed to 'gtar' in"
    290           echo "the directory /usr/sfw/bin. It is suggested that you copy"
    291           echo "/usr/sfw/bin/gtar to a different directory, renaming it" 
    292           echo "'tar' instead of gtar. Then ensure that directory is in"
    293           echo "you path before /usr/bin, so whenever you type 'tar' you"
    294           echo "run the GNU version, and not the Sun version of tar."
    295           echo ""
    296           echo "Due to some GNUisms, the same applies with 'make'"
    297           echo ""
    298           echo "Executing something like"
    299           echo ""
    300           echo "$ mkdir \$HOME/bins-for-sage"
    301           echo "$ cp /usr/sfw/bin/gmake \$HOME/bins-for-sage/make"
    302           echo "$ cp /usr/sfw/bin/gtar \$HOME/bins-for-sage/tar"
    303           echo "$ export PATH=\$HOME/bins-for-sage:\$PATH"
    304           echo ""
    305           echo "will put the GNU versions of 'tar' and 'make' in your path"   
    306           echo "before the Sun versions"
    307           echo ""
    308           echo "If you type 'tar --version' it should be obvious whether"
    309           echo "the GNU version of 'tar' is first in your path or not"
    310           echo ""
    311           echo "If you type  'make --version' is should be obvious whether"
    312           echo "the GNU version of 'make' is first in your path or not"
    313           echo ""
    314       fi
    315       exit 1
    316    fi
    317    if [ -z "`make --version 2>&1 | grep GNU`" ] ; then
    318       echo "Due to numerous GNUisms, you MUST use the GNU version of 'make'"
    319       echo "to build Sage on Solaris - Sun's version will not work."
    320       echo ""
    321       if [ -f "/usr/sfw/bin/gtar" ]  && [ -f "/usr/sfw/bin/gmake" ] ; then
    322          echo "There is a copy of GNU 'make', but renamed to 'gmake' in"
    323          echo "the directory /usr/sfw/bin. It is suggested that you copy"
    324          echo "/usr/sfw/bin/gmake to a different directory, renaming it" 
    325          echo "'make' instead of gmake. Then ensure that directory is in"
    326          echo "you path before /usr/ccs/bin, so whenever you type 'make' you"
    327          echo "run the GNU version, and not the Sun version of make."
    328          echo ""
    329          echo "You MUST also use the GNU version of tar, as some parts"
    330          echo "of the Sage source code are compressed tar files, which"
    331          echo "were compressed with GNU tar. GNU tar does not produce"
    332          echo "POSIX compliant tar files unless called with the --posix"
    333          echo "option, so can not always be extracted with Sun's tar."
    334          echo ""
    335          echo "Executing something like"
    336          echo "$ mkdir \$HOME/bins-for-sage"
    337          echo "$ cp /usr/sfw/bin/gmake \$HOME/bins-for-sage/make"
    338          echo "$ cp /usr/sfw/bin/gtar \$HOME/bins-for-sage/tar"
    339          echo "$ export PATH=\$HOME/bins-for-sage:\$PATH"
    340          echo "will put the GNU versions of 'tar' and 'make' in your path"   
    341          echo "before the Sun versions"
    342          echo ""
    343          echo "If you type 'make --version' it should be obvious whether"
    344          echo "the GNU version of 'make' is first in your path or not"
    345          echo ""
    346          echo "If you type  'tar --version' is should be obvious whether"
    347          echo "the GNU version of 'tar' is first in your path or not"
    348          echo ""
    349       else
    350          echo "You can either compile GNU make from source, or it may be"
    351          echo "obtained from Blastwave or Sunfreeware.com"
    352          echo ""
    353          echo "On Open Solaris, some GNU tools can be found at /usr/gnu"
    354          echo "although at the time of writing, this directory did not contain"
    355          echo "make or tar, but you might try looking there."
    356       fi
    357       exit 1
    358    fi
    359 fi
    360 
    361 # Test for GNU versions of tar and make on AIX, HP-UX, IRIX and Tru64
    362 # Unlike on Solaris, no help is given about where to find the GNU
    363 # versions, as I've not used a sufficient number of these machines
    364 # to know where to find the GNU tools. The tests for operating system
    365 # are split across two lines, as it's unwise to make more than 4 test.
    366 # The split shown seemed the most natural, with making the
    367 # IRIX and IRIX64 tests on a line of their own. David Kirkby January 2010
    368 
    369 if [ -z "`tar --version 2>&1 | grep GNU`" ] ; then
    370    if [ "$UNAME" = "HP-UX" ] || [ "$UNAME" = "AIX" ] || [ "$UNAME" = "Tru64" ] ; then
    371        echo ""
    372        echo "You must use the GNU version of tar on $UNAME. Please"
    373        echo "ensure that a GNU version of tar is first in your path"
    374        exit 1
    375    elif [ "$UNAME" = "IRIX" ] || [ "$UNAME" = "IRIX64" ] ; then
    376        echo ""
    377        echo "You must use the GNU version of tar on IRIX. Please"
    378        echo "ensure that a GNU version of tar is first in your path"
    379        exit 1
    380    fi
    381 fi
    382 
    383 
    384 if [ -z "`make --version 2>&1 | grep GNU`" ] ; then
    385    if [ "$UNAME" = "HP-UX" ] || [ "$UNAME" = "AIX" ] || [ "$UNAME" = "Tru64" ] ; then
    386        echo ""
    387        echo "You must use the GNU version of make on $UNAME. Please"
    388        echo "ensure that a GNU version of make is first in your path"
    389        exit 1
    390    elif [ "$UNAME" = "IRIX" ] || [ "$UNAME" = "IRIX64" ] ; then
    391        echo ""
    392        echo "You must use the GNU version of make on IRIX. Please"
    393        echo "ensure that a GNU version of make is first in your path"
    394        exit 1
    395    fi
    396 fi
    397 
    398312if [ -z "$SAGE_KEEP_BUILT_SPKGS" ]; then
    399313    echo "Now cleaning up tmp files."
    400314    cd "$SAGE_BUILD_DIR"