Ticket #8664: trac_8664-mpir-2.1.1_vs._2.1.3.p0-spkg.patch

File trac_8664-mpir-2.1.1_vs._2.1.3.p0-spkg.patch, 9.4 KB (added by leif, 9 years ago)

SPKG patch, based on Mike's 2.1.1. For reference/review.

  • SPKG.txt

    # HG changeset patch
    # User Leif Leonhardy <not.really@online.de>
    # Date 1288850172 -3600
    # Node ID 5a198e81b0913051b85c1ad32b1fb74bd68c9e17
    # Parent  33a8a10d84111f192c8fed77adfab0dc7813d3bc
    #8664 mpir-2.1.3.p0: Upgrade to MPIR 2.1.3, based on Mike's 2.1.1 spkg. Major clean-up.
    
    === mpir-2.1.3.p0 (Leif Leonhardy, November 3rd, 2010) ===
     * #8664: Upgrade Sage's MPIR spkg to version 2.1.3
     * Dependencies corrected (might be even more, depending on the configuration).
     * Work around executable stack issue on Fedora 14 (and other SELinux-
       enabled systems).
     * If 'make install' fails, this might be due to a rare race condition;
       give a hint that rerunning 'make' might be sufficient.
     * Support SAGE_DEBUG (disabling optimzation), but add debug symbols by
       default and enable optimization (-O3) if SAGE_DEBUG!="yes".
     * spkg-install clean-up:
       - Use $UNAME instead of `uname`.
       - Support "fat" binaries on Linux i486 and i586 as well,
         give warning if not supported (e.g. ia64 [?]).
       - Remove dead code; more or less cosmetic changes.
     * spkg-check:
       - Use $MAKE instead of 'make'.
       - Print messages on success and error.
    
    diff -r 33a8a10d8411 -r 5a198e81b091 SPKG.txt
    a b  
    99See http://www.mpir.org
    1010
    1111== License ==
    12 
    1312 * LGPL V3+
    1413
    1514== SPKG Maintainers ==
    16 
    1715 * William Stein
    1816
    1917== Upstream Contact ==
    20 
    2118 * The Google group mpir-devel
     19 * thempirteam@googlemail.com
    2220
    2321== Dependencies ==
     22 * iconv
    2423
    25  * None
     24== Special Update/Build Instructions ==
     25 * Make sure the patches still apply; also, putting "-Wl,z,noexecstack"
     26   into LDFLAGS might not be necessary for later versions.
    2627
    2728== Changelog ==
    2829
     30=== mpir-2.1.3.p0 (Leif Leonhardy, November 3rd, 2010) ===
     31 * #8664: Upgrade Sage's MPIR spkg to version 2.1.3
     32 * Dependencies corrected (might be even more, depending on the configuration).
     33 * Work around executable stack issue on Fedora 14 (and other SELinux-
     34   enabled systems).
     35 * If 'make install' fails, this might be due to a rare race condition;
     36   give a hint that rerunning 'make' might be sufficient.
     37 * Support SAGE_DEBUG (disabling optimzation), but add debug symbols by
     38   default and enable optimization (-O3) if SAGE_DEBUG!="yes".
     39 * spkg-install clean-up:
     40   - Use $UNAME instead of `uname`.
     41   - Support "fat" binaries on Linux i486 and i586 as well,
     42     give warning if not supported (e.g. ia64 [?]).
     43   - Remove dead code; more or less cosmetic changes.
     44 * spkg-check:
     45   - Use $MAKE instead of 'make'.
     46   - Print messages on success and error.
     47
    2948=== mpir-2.1.1 (Mike Hansen, August 16th, 2010) ===
    3049 * #8664: Upgrade Sage's MPIR spkg to version 2.1.1
    3150
  • spkg-check

    diff -r 33a8a10d8411 -r 5a198e81b091 spkg-check
    a b  
    11#!/usr/bin/env bash
    22
    3 if [ "$SAGE_LOCAL" = "" ]; then
    4    echo "SAGE_LOCAL undefined ... exiting";
    5    echo "Maybe run 'sage -sh'?"
    6    exit 1
     3if [ -z "$SAGE_LOCAL" ]; then
     4    echo "Error: SAGE_LOCAL undefined - exiting..."
     5    echo "Maybe run 'sage -sh'?"
     6    exit 1
    77fi
    88
    99cd src
    10 make check
     10
     11$MAKE check
     12if [ $? -ne 0 ]; then
     13    echo "Error: The MPIR test suite failed."
     14    exit 1
     15fi
     16
     17echo "The MPIR test suite passed successfully."
  • spkg-install

    diff -r 33a8a10d8411 -r 5a198e81b091 spkg-install
    a b  
    11#!/usr/bin/env bash
    22
    3 if [ "$SAGE_LOCAL" = "" ]; then
    4    echo "SAGE_LOCAL undefined ... exiting";
    5    echo "Maybe run 'sage -sh'?"
    6    exit 1
    7 fi
    8 # Add a patch which allow MPIR to build with Sun Studio
    9 # if
    10 
    11 if [ "x`uname`" = "xSunOS" ] ; then
    12    echo "Copying a version of gmp-h.in which is patched for Sun Studio"
    13    cp patches/gmp-h.in src/
    14    if ! [ $? -eq 0 ]; then
    15       echo "Failed to patch for Sun Studio"
    16       exit 1
    17    fi
     3if [ -z "$SAGE_LOCAL" ]; then
     4    echo "Error: SAGE_LOCAL undefined - exiting..."
     5    echo "Maybe run 'sage -sh'?"
     6    exit 1
    187fi
    198
    20 # The Yasm build uses PYTHON from env to find python, so unset it
    21 # since the version from newest_version confuses it
     9CUR=`pwd`
     10
     11# Add a patch which allow MPIR to build with Sun Studio:
     12if [ "x$UNAME" = "xSunOS" ]; then
     13    # XXX Independent of the actual compiler used?
     14    echo "Copying a version of gmp-h.in which is patched for Sun Studio..."
     15    cp patches/gmp-h.in src/
     16    if [ $? -ne 0 ]; then
     17        echo "Error: Failed to patch MPIR for Sun Studio."
     18        exit 1
     19    fi
     20fi
     21
     22# The Yasm build uses PYTHON from the environment to find python,
     23# so unset it since the version from newest_version confuses it:
    2224unset PYTHON
    2325
    2426remove_pic_osx_32_bit()
    2527{
    26     echo "Deleting assembly files which depend on PIC assembly working or 32 bit OSX on Intel hardware"
     28    # Assumes we are in src/
     29    echo "Deleting assembly files which depend on PIC assembly" \
     30        "working or 32 bit OSX on Intel hardware..."
    2731    rm mpn/x86/dive_1.asm
    2832    rm mpn/x86/diveby3.asm
    2933    rm mpn/x86/pentium4/sse2/dive_1.asm
     
    4145}
    4246
    4347
     48if [ "$SAGE_DEBUG" = yes ]; then
     49    # Disable optimization, add debug symbols:
     50    CFLAGS="$CFLAGS -g -O0"
     51else
     52    # Add debug symbols by default, enable optimization:
     53    CFLAGS="-g -O3 $CFLAGS"
     54fi
     55
     56
    4457build()
    4558{
    46 
    4759    SAGE_CONF_OPTS="--enable-shared --disable-static"
    48     case $UNAME in
     60    case "$UNAME" in
    4961
    5062    SunOS)
    5163        if [ "$SAGE64" = "yes" ]; then
    52             echo "Building 64 bit Solaris version"
     64            echo "Building a 64-bit version of MPIR"
    5365            ABI=64
    5466        else
    5567            ABI=32
     
    5769
    5870    Darwin)
    5971        if [ "$SAGE64" = "yes" ]; then
    60             echo "Building 64 bit OS X version"
     72            echo "Building a 64-bit version of MPIR"
    6173            ABI=64
    6274        else
    6375            # Do not set ABI=32 on OS X 10.6, since there everything
    64             # defaults to 64-bit. 
    65             if [ `uname -r | sed 's/\..*//'` != "10" ]; then
     76            # defaults to 64-bit.
     77            if [ "`uname -r | sed 's/\..*//'`" != "10" ]; then
    6678                ABI=32
    6779                if [ "`uname -m`" = "i386" ]; then
    6880                    remove_pic_osx_32_bit
     
    7183        fi;;
    7284
    7385    Linux)
     86        # Work around (erroneously) set "executable stack" attributes,
     87        # causing runtime errors on Fedora 14 and other SELinux-
     88        # enabled systems:
     89        LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
     90        export LDFLAGS # perhaps redundant, but safe(r)
     91
    7492        if [ "$SAGE_FAT_BINARY" = "yes" ]; then
    75            # For now we do the same thing -- namely "--enable-fat" --
    76            # on both 64-bit and 32-bit, though this is likely to
    77            # change.
    78            if [ "`uname -m`" = "i686" ]; then
     93            # For now we do the same thing -- namely "--enable-fat" --
     94            # on both 64-bit and 32-bit, though this is likely to
     95            # change.
     96            case "`uname -m`" in
     97            i[3456]86)
    7998                echo "** Building with FAT Binary Support (32-bit) **"
    8099                SAGE_CONF_OPTS=$SAGE_CONF_OPTS" --enable-fat"
    81            fi
    82            if [ "`uname -m`" = "i386" ]; then
    83                 echo "** Building with FAT Binary Support (32-bit) **"
    84                 SAGE_CONF_OPTS=$SAGE_CONF_OPTS" --enable-fat"
    85            fi
    86            if [ "`uname -m`" = "x86_64" ]; then
     100                ;;
     101            x86_64|amd64)
    87102                echo "** Building with FAT Binary Support (64-bit) **"
    88103                SAGE_CONF_OPTS=$SAGE_CONF_OPTS" --enable-fat"
    89            fi 
     104                ;;
     105            *) # e.g. ia64
     106                echo "Warning: Fat binary build currently not" \
     107                    "supported on this platform"
     108                # XXX or exit 1 ?
     109            esac
    90110        fi
    91111
    92112    esac
    93113
    94114    export ABI CFLAGS CXXFLAGS
    95115
    96     ./configure --prefix="$SAGE_LOCAL" --enable-gmpcompat --enable-cxx=yes  $SAGE_CONF_OPTS
     116    ./configure --prefix="$SAGE_LOCAL" --enable-gmpcompat --enable-cxx=yes \
     117        $SAGE_CONF_OPTS
    97118    if [ $? -ne 0 ]; then
    98         echo "Failed to configure."
     119        echo "Error configuring MPIR."
    99120        exit 1
    100121    fi
    101122
    102123    $MAKE
    103124    if [ $? -ne 0 ]; then
    104125        echo "Error building MPIR."
     126        echo ""
     127        echo "If you see a message like:"
     128        cat <<EOF
     129    cp: cannot stat 'mpir.h': No such file or directory
     130    make[6]: *** [install-data-hook] Error 1
     131    make[6]: Leaving directory ...
     132    make[5]: *** [install-data-am] Error 2
     133    make[5]: *** Waiting for unfinished jobs....
     134EOF
     135        echo "above, this is just due to a rare race condition."
     136        echo "Please simply rerun 'make' (or 'sage -i ...')."
     137        echo ""
    105138        exit 1
    106139    fi
    107140
    108     echo "Removing old headers and libraries"
     141    echo "Removing old headers and libraries..."
    109142    rm -f "$SAGE_LOCAL"/include/mpir*.h "$SAGE_LOCAL"/include/gmp*.h
    110143    rm -f "$SAGE_LOCAL"/lib/libmpir* "$SAGE_LOCAL"/lib/libgmp*
    111144
    112145    $MAKE install
    113146    if [ $? -ne 0 ]; then
    114         if [ "$UNAME" != "CYGWIN" ]; then  # on cygwin error is not fatal.
     147        if [ "$UNAME" != "CYGWIN" ]; then  # On Cygwin an error is not fatal.
    115148            echo "Error installing MPIR."
    116149            exit 1
    117150        fi
    118     fi 
    119 }
     151    fi
     152} # build()
    120153
    121154cd src
    122155
    123156build
    124157
    125 if ! [ $? -eq 0 ]; then
    126     echo "Failed to build shared MPIR library."
    127     exit 1
    128 fi
     158# All errors catched in build(), on Cygwin we ignore the last:
     159exit 0