Ticket #9530: trac_9530-old_p3_vs_p4_reviewer.patch

File trac_9530-old_p3_vs_p4_reviewer.patch, 8.5 KB (added by leif, 12 years ago)

SPKG reviewer patch, based on the previous p3. (The new, perhaps now alternate spkg is p4.) See commit message for an overview of the changes.

  • SPKG.txt

    # HG changeset patch
    # User Leif Leonhardy <not.really@online.de>
    # Date 1288236376 -7200
    # Node ID 7cedf220e9f3f877f80ed803f53ad546a002df9f
    # Parent  d3af31ee47820830ce9c99c9dbfa57156fb9ce12
    #9530 readline-6.0.p4 - previous p3 with reviewer patch (making it more robust)
    
    === readline-6.0.p4 (Leif Leonhardy, October 28th, 2010) ===
     * #9530: Reviewer patch. Some clean-up, also making it more
       portable and robust. (Also fixes "set -e" preventing us to
       check exit codes and print appropriate error messages.)
       Now also supports Arch Linux with readline 5.x, then building
       Sage's version.
       Now does *not* build Sage's readline on OpenSuSE 11.x when
       the headers are missing (since this would break bash as well);
       instead, instruct the user to install OpenSuSE's devel version
       of libreadline 6.x, which contains these.
     * Bumped the patch level again to avoid confusion.
    
    diff -r d3af31ee4782 -r 7cedf220e9f3 SPKG.txt
    a b  
    3333   since it took tons of space; didn't delete anything else.
    3434 * Work around some MacOSX dynamic lib flags
    3535
    36 == readline-6.0p3 (Thomas Bächler, Mitesh Patel, October 24th, 2010) ==
    37  * #9530: Update openSUSE and Arch Linux workarounds to fix failed
    38    builds.
     36== Changelog ==
    3937
    40 == readline-6.0p2 (Mike Hansen, June 22nd, 2010) ==
     38=== readline-6.0.p4 (Leif Leonhardy, October 28th, 2010) ===
     39 * #9530: Reviewer patch. Some clean-up, also making it more
     40   portable and robust. (Also fixes "set -e" preventing us to
     41   check exit codes and print appropriate error messages.)
     42   Now also supports Arch Linux with readline 5.x, then building
     43   Sage's version.
     44   Now does *not* build Sage's readline on OpenSuSE 11.x when
     45   the headers are missing (since this would break bash as well);
     46   instead, instruct the user to install OpenSuSE's devel version
     47   of libreadline 6.x, which contains these.
     48 * Except for the "set -e" issue (and an added error check), the
     49   changes again only affect Arch Linux and OpenSuSE.
     50 * Bumped the patch level again to avoid confusion.
     51
     52=== readline-6.0.p3 (Thomas Bächler, Mitesh Patel, October 24th, 2010) ===
     53 * #9530: Update openSuSE and Arch Linux workarounds to fix failed
     54   builds. No changes that could affect other platforms.
     55
     56=== readline-6.0.p2 (Mike Hansen, June 22nd, 2010) ===
    4157 * #7821: readline-6.0.p1 fails on FreeBSD
    4258
    43 == readline-6.0p1 (Tim Dumol, December 6th, 2009) ==
     59=== readline-6.0.p1 (Tim Dumol, December 6th, 2009) ===
    4460 * #7610: Add workaround for Arch Linux readline issues ("undefined
    4561   symbol: PC") by copying over the system version.
    4662
  • spkg-install

    diff -r d3af31ee4782 -r 7cedf220e9f3 spkg-install
    a b  
    33## Readline 6.0
    44###########################################
    55
    6 if [ -z "$SAGE_LOCAL" ] ; then
    7    echo "SAGE_LOCAL undefined ... exiting";
    8    echo "Maybe run 'sage -sh'?"
    9    exit 1
     6if [ -z "$SAGE_LOCAL" ]; then
     7    echo "SAGE_LOCAL undefined ... exiting"
     8    echo "Maybe run 'sage -sh'?"
     9    exit 1
    1010fi
    1111
    1212set -e
     
    158158
    159159# OVERWRITE_READLINE=false; export OVERWRITE_READLINE
    160160
    161 # First we check for OpenSUSE 11.1 since bash is linked dynamically with a
    162 # readline that breaks when we build Sage's readline, so we work around this
    163 # for now.
     161set +e # We want the exit codes!
     162
     163# First we check for OpenSUSE 11.x, since there bash is linked dynamically with a
     164# more recent readline such that bash crashes when we build Sage's readline, so
     165# we work around this for now by not building Sage's version and instead using
     166# the system's one.
    164167
    165168if [ -f /etc/SuSE-release ]; then
     169    echo "OpenSuSE detected"
     170    # Note that "-q" doesn't work with Solaris' non-POSIX grep
     171    # in the default path, but we're certainly on Linux here:
    166172    if grep -q 11\\. /etc/SuSE-release 2>/dev/null; then
    167         echo "OpenSUSE 11 detected"
     173        echo "OpenSuSE 11 detected"
    168174        if [ -d /usr/include/readline/ ]; then
    169175            echo "The development version of libreadline is installed -> copying"
    170             if [ `uname -p` = "x86_64" ]; then
    171                 cp -a /lib64/libreadline.so.6* "$SAGE_LOCAL"/lib
     176            # Note that "cp -a" isn't POSIX, but again: We're on Linux.
     177            # ("uname -p" gives "unknown" on at least some Linuces, so we
     178            # better use the more portable "-m".)
     179            if [ "`uname -m`" = "x86_64" ]; then
     180                cp -af /lib64/libreadline.so.6* "$SAGE_LOCAL"/lib
    172181            else
    173                 cp -a /lib/libreadline.so.6* "$SAGE_LOCAL"/lib
     182                cp -af /lib/libreadline.so.6* "$SAGE_LOCAL"/lib
    174183            fi
    175             ln -s libreadline.so.6 "$SAGE_LOCAL"/lib/libreadline.so
    176             cp -r /usr/include/readline  "$SAGE_LOCAL"/include
     184            if [ $? -ne 0 ]; then
     185                echo "Error copying the system's libreadline"
     186                exit 1
     187            fi
     188            ln -snf libreadline.so.6 "$SAGE_LOCAL"/lib/libreadline.so
     189            if [ $? -ne 0 ]; then
     190                echo "Error creating symbolic link to libreadline.so.6"
     191                exit 1
     192            fi
     193            cp -rf /usr/include/readline "$SAGE_LOCAL"/include
     194            if [ $? -ne 0 ]; then
     195                echo "Error copying the system's readline header files"
     196                exit 1
     197            fi
    177198            exit 0
    178199        else
    179             echo "No headers found, building library."
     200            echo "No readline headers found. Please install OpenSuSE's development"
     201            echo "version of libreadline 6.x since building the version currently"
     202            echo "shipped with Sage would break your shell (bash). Sorry."
     203            exit 1
    180204            # # This variable is only set to "true" on openSUSE 11.1.
    181205            # OVERWRITE_READLINE="true"; export OVERWRITE_READLINE
    182206        fi
     207    else
     208        echo "... but not OpenSuSE 11 -> building Sage's version of libreadline."
    183209    fi
    184210fi
    185211
     
    187213# If anyone knows a better way to fix this, please do.
    188214
    189215if [ -f /etc/arch-release ]; then
     216    echo "Arch Linux detected"
    190217    if [ -f "/lib/libreadline.so.6" ]; then
    191         echo "Copying over system's libreadline."
    192         cp -a /lib/libreadline.so.6* "$SAGE_LOCAL"/lib
    193         ln -s libreadline.so.6 "$SAGE_LOCAL"/lib/libreadline.so
     218        echo "Copying over system's libreadline (version 6.x)."
     219        cp -af /lib/libreadline.so.6* "$SAGE_LOCAL"/lib
     220        if [ $? -ne 0 ]; then
     221            echo "Error copying the system's libreadline"
     222            exit 1
     223        fi
     224        ln -snf libreadline.so.6 "$SAGE_LOCAL"/lib/libreadline.so
     225        if [ $? -ne 0 ]; then
     226            echo "Error creating symbolic link to libreadline.so.6"
     227            exit 1
     228        fi
     229        # We shouldn't have to copy the headers...
     230        # (On Arch Linux, these are installed by default.)
    194231        exit 0
     232    elif [ -f "/lib/libreadline.so.5" ]; then
     233        # We might have only an older version of libreadline
     234        echo "Couldn't find a system copy of libreadline 6.x, only 5.x."
     235        echo "Building Sage's more recent version of libreadline."
    195236    else
    196         echo "Could not find a system copy of libreadline. Exiting."
     237        echo "Could not find a system copy of libreadline 5.x or 6.x."
     238        echo "This is abnormal, so we better stop here..."
    197239        exit 1
    198240    fi
    199241fi
     
    210252build()
    211253{
    212254    ./configure --prefix="$SAGE_LOCAL" $CONF_FLAGS
     255    if [ $? -ne 0 ]; then
     256        echo "Error configuring readline."
     257        exit 1
     258    fi
    213259    make install
    214260}
    215261
    216262build
    217 set +e
    218263if [ $? -ne 0 ]; then
    219264    echo "Error building and installing readline."
    220265    exit 1
    221266fi
     267
    222268set -e
    223269
    224 if [ $UNAME = "Darwin" ]; then
     270if [ "$UNAME" = "Darwin" ]; then
    225271  DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.dylib
    226 elif [ $UNAME = "CYGWIN" ]; then
     272elif [ "$UNAME" = "CYGWIN" ]; then
    227273  # It is of course very lame that readline names the file .dll.a, but that's what it does.
    228274  DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.dll.a
    229275elif [ "$UNAME" = "OpenBSD" ]; then
     
    251297# code of build was.
    252298if [ -f "$DYLIB_NAME" -a -f "$SAGE_LOCAL"/lib/libreadline.a ]; then
    253299  # Fix permissions.
     300  echo "Fixing permissions..."
    254301  chmod 755 "$SAGE_LOCAL"/lib/libreadline.*
    255302  chmod 755 "$SAGE_LOCAL"/lib/libhistory.*
    256303  exit 0
    257304else
    258   echo "Readline's build claims to have finished, but files that should have been built weren't."
     305  echo "Error: Readline's build claims to have finished, but files that should have been built weren't."
    259306  exit 1
    260307fi