Ticket #14406: 14406_cygwin_prereq.patch

File 14406_cygwin_prereq.patch, 14.9 KB (added by jdemeyer, 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 9f6b348f2d514c6812c67aeb728ca9fada52c69b
    # Parent  5ad6e2e85d2262293a49fb0d179d9c34e20189d8
    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
     
    2323echo "Machine: `uname -a`"
    2424
    2525if [ "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
     26    if [ "$UNAME" = "SunOS" ]; then
    4127       if [ "$RELEASE" = "5.9" ] || [ "$RELEASE" = "5.8" ] || [ "$RELEASE" = "5.7" ] || [ "$RELEASE" = "5.6" ] ; then
    4228          echo "Sage is not supported on any version of Solaris earlier than 10."
    4329          echo "Sage has been tested on the first release of Solaris 10"
     
    4733          echo "More information can be found about Sage on Solaris"
    4834          echo "on the Wiki at http://wiki.sagemath.org/solaris"
    4935          echo ""
    50           echo "To get past this message, export the variable SAGE_PORT to"
    51           echo "something non-empty."
    52           exit 1
     36          fail=yes
    5337       fi
    5438    elif [ "$UNAME" = "HP-UX" ]; then
    5539        echo "You are attempting to build Sage on HP's HP-UX operating system,"
     
    6347        echo "http://groups.google.com/group/sage-devel"
    6448        echo "The Sage community would also appreciate any patches you submit."
    6549        echo ""
    66         echo "To get past this message, export the variable SAGE_PORT to"
    67         echo "something non-empty."
    68         exit 1
     50        fail=yes
    6951    elif [ "$UNAME" = "AIX" ]; then
    7052        echo "You are attempting to build Sage on IBM's AIX operating system,"
    7153        echo "which is not a supported platform for Sage yet. Things may or"
     
    7456        echo "http://groups.google.com/group/sage-devel"
    7557        echo "The Sage community would also appreciate any patches you submit."
    7658        echo ""
    77         echo "To get past this message, export the variable SAGE_PORT to"
    78         echo "something non-empty."
    79         exit 1
     59        fail=yes
    8060    elif [ "$UNAME" = "IRIX" ] || [ "$UNAME" = "IRIX64"  ]; then
    8161        echo "You are attempting to build Sage on SGI's IRIX operating system,"
    8262        echo "which is not a supported platform for Sage yet. Things may or"
     
    8565        echo "http://groups.google.com/group/sage-devel"
    8666        echo "The Sage community would also appreciate any patches you submit."
    8767        echo ""
    88         echo "To get past this message, export the variable SAGE_PORT to"
    89         echo "something non-empty."
    90         exit 1
     68        fail=yes
    9169    elif [ "$UNAME" = "Tru64" ]; then
    9270        echo "You are attempting to build Sage on HP's Tru64 operating system,"
    9371        echo "which is not a supported platform for Sage yet. Things may or"
     
    9674        echo "http://groups.google.com/group/sage-devel"
    9775        echo "The Sage community would also appreciate any patches you submit."
    9876        echo ""
    99         echo "To get past this message, export the variable SAGE_PORT to"
    100         echo "something non-empty."
    101         exit 1
     77        fail=yes
    10278    elif [ "$UNAME" = "FreeBSD" ]; then
    10379        echo "You are attempting to build Sage on the FreeBSD operating system,"
    10480        echo "which is not a supported platform for Sage yet, though"
     
    10884        echo "http://groups.google.com/group/sage-devel"
    10985        echo "The Sage community would also appreciate any patches you submit."
    11086        echo ""
    111         echo "To get past this message, export the variable SAGE_PORT to"
    112         echo "something non-empty."
    113         exit 1
     87        fail=yes
    11488    elif [ "$UNAME" != "SunOS" ] && [ "$UNAME" != "Darwin" ] && [ "$UNAME" != "Linux" ]; then
    11589        echo "You are attempting to build Sage on $UNAME,"
    11690        echo "which is not a supported platform for Sage yet. Things may or"
     
    11993        echo "http://groups.google.com/group/sage-devel"
    12094        echo "The Sage community would also appreciate any patches you submit."
    12195        echo ""
    122         echo "To get past this message, export the variable SAGE_PORT to"
    123         echo "something non-empty."
     96        fail=yes
     97    fi
     98
     99    # Test versions of "tar" and "make".
     100    have_gnu_tar=`tar --version 2>&1 | grep GNU`
     101    have_bsd_tar=`tar --version 2>&1 | grep bsdtar`
     102    have_gnu_make=`make --version 2>&1 | grep GNU`
     103
     104    if [ -z "${have_gnu_tar}${have_bsd_tar}" ] ; then
     105         echo "You MUST use either the GNU or BSD version of tar, as some parts of the"
     106         echo "Sage source code are contained in tar files, which were produced with GNU"
     107         echo "tar. These are not POSIX compliant tar files (unless they were created with"
     108         echo "the --posix option), so can not always be extracted with other 'tar'"
     109         echo "programs."
     110         echo ""
     111         echo "Please ensure that a GNU or BSD version of tar is first in your path."
     112         echo ""
     113         fail=yes
     114    fi
     115
     116    if [ -z "${have_gnu_make}" ] ; then
     117         echo "Due to numerous GNUisms, you MUST use the GNU version of 'make'"
     118         echo "to build Sage. Other versions will not work."
     119         echo ""
     120         fail=yes
     121    fi
     122
     123    if [ -z "${have_gnu_tar}${have_bsd_tar}" ] || [ -z "${have_gnu_make}" ] ; then
     124        if [ -f "/usr/sfw/bin/gtar" ] && [ -f "/usr/sfw/bin/gmake" ] ; then
     125            echo "There is a copy of GNU tar, but renamed to 'gtar' in"
     126            echo "the directory /usr/sfw/bin. It is suggested that you copy"
     127            echo "/usr/sfw/bin/gtar to a different directory, renaming it"
     128            echo "'tar' instead of gtar. Then ensure that directory is in"
     129            echo "you path before /usr/bin, so whenever you type 'tar' you"
     130            echo "run the GNU version. The same applies with 'make'."
     131            echo ""
     132            echo "Executing something like"
     133            echo ""
     134            echo '$ mkdir $HOME/bins-for-sage'
     135            echo '$ cp /usr/sfw/bin/gmake $HOME/bins-for-sage/make'
     136            echo '$ cp /usr/sfw/bin/gtar $HOME/bins-for-sage/tar'
     137            echo '$ export PATH=$HOME/bins-for-sage:$PATH'
     138            echo ""
     139            echo "will put the GNU versions of 'tar' and 'make' in your path"
     140            echo "before /usr/bin/."
     141            echo ""
     142            echo "If you type 'tar --version' or 'make --version', it should be obvious"
     143            echo "whether the GNU versions of 'tar' and 'make' are first in your path or"
     144            echo "not."
     145            echo ""
     146        fi
     147    fi
     148
     149    if [ x$fail = xyes ]; then
     150        echo "To get past this message and try building Sage anyway,"
     151        echo "export the variable SAGE_PORT to something non-empty."
    124152        exit 1
    125153    fi
    126154fi
    127155
     156
    128157# Only run configure if the tarfile exists.  Unfortunately, sage-update
    129158# does not update the base packages and we cannot retro-actively change
    130159# that in earlier versions.  So the only thing to do is to skip this
    131160# test.
    132161prereq_tarball="$SAGE_ROOT/spkg/base/$TARGET.tar.gz"
    133162if [ -f "$prereq_tarball" ]; then
    134     gzip -cd "$prereq_tarball" | tar xf - --no-same-owner
     163    gzip -cd "$prereq_tarball" | tar xf -
    135164    if [ $? -ne 0 ]; then
    136165        echo >&2 "Error: failed to extract '$prereq_tarball'"
    137166        exit 1
     
    261290    fi
    262291fi
    263292
    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 
    398293if [ -z "$SAGE_KEEP_BUILT_SPKGS" ]; then
    399294    echo "Now cleaning up tmp files."
    400295    cd "$SAGE_BUILD_DIR"