Ticket #9523: 9523-brand-new-patch-based-on-readline-6.0.p4.patch

File 9523-brand-new-patch-based-on-readline-6.0.p4.patch, 15.1 KB (added by drkirkby, 11 years ago)

Mercurial patch with all (well hopefully all) the changes needed to update to 6.1 and clean up.

  • SPKG.txt

    # HG changeset patch
    # User David Kirkby <david.kirkby@onetel.net>
    # Date 1289503957 0
    # Node ID 2a049af06209b468e3d0723249fb5e343a5d02a0
    # Parent  7cedf220e9f3f877f80ed803f53ad546a002df9f
    #9523 Upgrade the Readline spkg to 6.1 cleaning up where necessary
    
    diff -r 7cedf220e9f3 -r 2a049af06209 SPKG.txt
    a b  
    3535
    3636== Changelog ==
    3737
     38== readline-6.1 (David Kirkby, 11th November 2010) ==
     39 * Update to latest version #9523
     40 * Removed a hack for Arch Linux, as this is no longer needed
     41   with the latest readline (see #9523)
     42 * Removed some commented out code from spkg-install - the file
     43   was big enough without even more things.
     44 * Removed checks that there was not a mix of Sun and
     45   GNU compilers. This is a bit pointless now, as
     46   the 'prereq' script does this.
     47 * Removed checks that SAGE_FORTRAN_LIB exits - again
     48   this is taken care of in one place, and does not need
     49   to be in every single .spkg file.
     50 * Removed reference to ABI, FCFLAGS and F77FLAGS since
     51   there's no Fortran in the Readline package, and no ABI
     52   to set.
     53 * Removed references to CXX and other C++ related items
     54   as there is no C++ code.
     55 * No longer check if SAGE64=1, since it can only be set to
     56   "yes" or "no", so restrict the check for "yes"
     57 * Removed a note that a 32-bit build was taking place if
     58   SAGE64 was not set to "yes" or "1". This was in
     59   inaccurate comment, as many systems build 64-bit by
     60   default, and so the comment is inaccurate on many systems.
     61   (Though of course it was harmless).
     62 * Removed an unnecessary semi-colon on the line
     63   echo "SAGE_LOCAL undefined ... exiting"
     64   The semi-colon is on various .spkg files, and seems
     65   to be the result of a bit of code copied from one
     66   package to another.
     67 * Updated the file to patch support/shobj-conf (done for
     68   FreeBSD), since this file has changed in the latest source
     69   code for readline. This should be reported upstream if it
     70   has not already been done. It is pointless us patching
     71   a file every time, if there's a bug in it that could be
     72   solved in the upstream source code.
     73 * Add an spkg-check file, though it does nothing useful,
     74   as there are no self-tests. However, there is a 'check'
     75   target, so running 'make check' does not generate an
     76   error, but instead reports there is nothing to be done.
     77 * Removed set -e and set +e. Used properly these are useful,
     78   but used poorly they are likely to cause more problems than
     79   enough. So these have been removed, as it's clear they were
     80   not being used properly.
     81 * Added support for any compiler flag for 64-bit builds, using
     82   $CFLAG64
     83 * Use compiler options -g -O0 if SAGE_DEBUG=yes. Otherwise use
     84   -g -O2. Other options may be added too. 
     85 * Removed the 'build' function as it was a bit pointless - it takes
     86   less characters to just put the code inline.
     87 * Tested exit code of 'configure', 'make' and 'make install'
     88   separately - no longer run "make install".
     89 * Used $MAKE instead of make, which will allow parallel builds
     90   but will need extensive testing.
     91 * Change name of library from libreadline.so.6.0 to
     92   libreadline.so.6.1 on OpenBSD. This seems logical, but is untested
     93   as I don't have an OpenBSD box around, and currently there's even
     94   less development going into OpenBSD than there is AIX or HP-UX!!
     95   
    3896=== readline-6.0.p4 (Leif Leonhardy, October 28th, 2010) ===
    3997 * #9530: Reviewer patch. Some clean-up, also making it more
    4098   portable and robust. (Also fixes "set -e" preventing us to
  • patches/shobj-conf

    diff -r 7cedf220e9f3 -r 2a049af06209 patches/shobj-conf
    a b  
    6464        esac
    6565done
    6666
    67 case "${host_os}-${SHOBJ_CC}" in
     67case "${host_os}-${SHOBJ_CC}-${host_vendor}" in
    6868sunos4*-*gcc*)
    6969        SHOBJ_CFLAGS=-fpic
    7070        SHOBJ_LD=/usr/bin/ld
     
    108108        SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
    109109        ;;
    110110
    111 # All versions of Linux or the semi-mythical GNU Hurd.
     111# All versions of Linux (including Gentoo/FreeBSD) or the semi-mythical GNU Hurd.
    112112linux*-*|gnu*-*|k*bsd*-gnu-*)
    113113        SHOBJ_CFLAGS=-fPIC
    114114        SHOBJ_LD='${CC}'
     
    128128        ;;
    129129
    130130# FreeBSD-3.x ELF
    131 freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
     131freebsd3*|freebsdaout*)
    132132        SHOBJ_CFLAGS=-fPIC
    133133        SHOBJ_LD='${CC}'
    134134
     
    146146        fi
    147147        ;;
    148148
     149# FreeBSD-4.x and later have only ELF
     150freebsdelf*|dragonfly*)
     151        SHOBJ_CFLAGS=-fPIC
     152        SHOBJ_LD='${CC}'
     153        SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
     154        SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
     155        SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
     156        ;;
    149157# Darwin/MacOS X
    150158darwin[89]*|darwin10*)
    151159        SHOBJ_STATUS=supported
  • new file patches/shobj-conf.diff

    diff -r 7cedf220e9f3 -r 2a049af06209 patches/shobj-conf.diff
    - +  
     1--- ./src/support/shobj-conf    Wed Oct 28 13:20:21 2009
     2+++ ./patches/shobj-conf        Thu Nov 11 18:56:28 2010
     3@@ -109,7 +109,7 @@
     4        ;;
     5 
     6 # All versions of Linux (including Gentoo/FreeBSD) or the semi-mythical GNU Hurd.
     7-linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo)
     8+linux*-*|gnu*-*|k*bsd*-gnu-*)
     9        SHOBJ_CFLAGS=-fPIC
     10        SHOBJ_LD='${CC}'
     11        SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
     12@@ -128,15 +128,16 @@
     13        ;;
     14 
     15 # FreeBSD-3.x ELF
     16-freebsd3*|freebsdaout*)
     17+freebsd3*|freebsdaout*)
     18        SHOBJ_CFLAGS=-fPIC
     19        SHOBJ_LD='${CC}'
     20 
     21-       if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
     22+       if [ ! -x /usr/bin/objformat ] || [ "`/usr/bin/objformat`" = "elf" ]; then
     23                SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
     24 
     25                SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
     26                SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
     27+                SHLIB_LIBS='-ltermcap'
     28        else
     29                SHOBJ_LDFLAGS='-shared'
     30 
     31@@ -145,17 +146,14 @@
     32        fi
     33        ;;
     34 
     35-# FreeBSD-4.x and later have only ELF
     36-freebsd[4-9]*|freebsdelf*|dragonfly*)
     37-       SHOBJ_CFLAGS=-fPIC
     38-       SHOBJ_LD='${CC}'
     39-
     40-       SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
     41-       SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
     42-
     43-       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
     44-       ;;
     45-
     46+# FreeBSD-4.x and later have only ELF
     47+freebsdelf*|dragonfly*)
     48+        SHOBJ_CFLAGS=-fPIC
     49+        SHOBJ_LD='${CC}'
     50+        SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
     51+        SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
     52+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
     53+       ;;
     54 # Darwin/MacOS X
     55 darwin[89]*|darwin10*)
     56        SHOBJ_STATUS=supported
  • deleted file patches/shobj-conf.patch

    diff -r 7cedf220e9f3 -r 2a049af06209 patches/shobj-conf.patch
    + -  
    1 --- ../src/support/shobj-conf   2009-01-04 11:32:42.000000000 -0800
    2 +++ shobj-conf  2010-06-22 15:06:53.000000000 -0700
    3 @@ -132,11 +132,12 @@
    4         SHOBJ_CFLAGS=-fPIC
    5         SHOBJ_LD='${CC}'
    6  
    7 -       if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
    8 +       if [ ! -x /usr/bin/objformat ] || [ "`/usr/bin/objformat`" = "elf" ]; then
    9                 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
    10  
    11                 SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
    12                 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
    13 +                SHLIB_LIBS='-ltermcap'
    14         else
    15                 SHOBJ_LDFLAGS='-shared'
    16  
  • new file spkg-check

    diff -r 7cedf220e9f3 -r 2a049af06209 spkg-check
    - +  
     1#!/usr/bin/env bash
     2
     3echo "Unfortunately, there is no way to check the readline package"
     4echo "as there are no self-tests. However, we will run 'make check'"
     5echo "in case a target is added at a later date"
     6
     7
     8cd src
     9$MAKE check
     10
  • spkg-install

    diff -r 7cedf220e9f3 -r 2a049af06209 spkg-install
    a b  
    11#!/usr/bin/env bash
    22###########################################
    3 ## Readline 6.0
     3## Readline 6.1
    44###########################################
    55
    66if [ -z "$SAGE_LOCAL" ]; then
     
    99    exit 1
    1010fi
    1111
    12 set -e
     12if [ "x$CFLAG64" = x ] ; then
     13   CFLAG64=-m64
     14fi
    1315
    14 # Add a sensible default optimisation flag. Change if necessary.
    15 OPTIMIZATION_FLAGS="-O2"
    16 
    17 # Most packages do not need all these set.
    18 # But it is better to do them all each time, rather than omit
    19 # a flag by mistake.
    20 
    21 CFLAGS="$CFLAGS $OPTIMIZATION_FLAGS "
    22 CXXFLAGS="$CXXFLAGS $OPTIMIZATION_FLAGS "
    23 FCFLAGS="$FCFLAGS $OPTIMIZATION_FLAGS "
    24 F77FLAGS="$F77FLAGS $OPTIMIZATION_FLAGS "
    25 #CPPFLAGS="$CPPFLAGS -I$SAGE_LOCAL/include"
    26 #LDFLAGS="$LDFLAGS -L$SAGE_LOCAL/lib"
    27 
    28 # Compile for 64-bit if SAGE64 is set to 'yes' or '1'
    29 if [ "x$SAGE64" = "xyes" ] || [ "x$SAGE64" = "x1" ]  ; then
     16# Compile for 64-bit if SAGE64 is set to 'yes'
     17if [ "x$SAGE64" = xyes ] ; then
    3018   echo "Building a 64-bit version of Readline"
    31    CFLAGS="$CFLAGS -m64 "
    32    CXXFLAGS="$CXXFLAGS -m64 "
    33    FCFLAGS="$FCFLAGS -m64 "
    34    F77FLAGS="$F77FLAGS -m64 "
     19   CFLAGS="$CFLAGS $CFLAG64"
     20   CPPFLAGS="$CPPFLAGS $CFLAG64"
    3521   # Some packages may need LDFLAGS and/or ABI set here.
    36    LDFLAGS="$LDFLAGS -m64 "
    37    # ABI=64
    38 else
    39    echo "Building a 32-bit version of Readline"
     22   LDFLAGS="$LDFLAGS $CFLAG64"
    4023fi
    4124
    42 # If SAGE_DEBUG is set either unset (the default), or set to  'yes'
    43 # then add debugging information.
    44 # Since both the Sun and GNU compilers accept -g to give debugging information,
    45 # there is no need to do anything specific to one compiler or the other.
    46 
    47 if [ "x$SAGE_DEBUG" = "x" ] || [ "x$SAGE_DEBUG" = "xyes" ] ; then
    48    echo "Code will be built with debugging information present. Set 'SAGE_DEBUG' to 'no' if you don't want that."
    49    # Actually anything other than 'yes' or '1' will cause
    50    # no debugging information to be added.
    51    CFLAGS="$CFLAGS -g "
    52    CXXFLAGS="$CXXFLAGS -g "
    53    FCFLAGS="$FCFLAGS -g "
    54    F77FLAGS="$F77FLAGS -g "
     25if [ "x$SAGE_DEBUG" = "xyes" ] ; then
     26   CFLAGS="$CFLAGS -g -O0"
    5527else
    56    echo "No debugging information will be used during the build of this package."
    57    echo "Unset SAGE_DEBUG if you want debugging information present (-g added)."
    58 fi
    59 
    60 # Add appropriate flag(s) to show all warnings.
    61 # This test of a compiler is not perfect by any means, but
    62 # is better than nothing.
    63 if "$CC" -flags > /dev/null 2>&1 ; then
    64    SUN_COMPILER=1
    65    # The Sun compilers are fussy, and adding extra
    66    # warnings will just show too many.
    67 else
    68    # Assume gcc if not the Sun C compiler.
    69    # Add -Wall to show all warnings.
    70    CFLAGS="$CFLAGS -Wall "
    71    CXXFLAGS="$CXXFLAGS -Wall "
    72    FCFLAGS="$FCFLAGS -Wall "
    73    F77FLAGS="$F77FLAGS -Wall "
    74    GNU_COMPILER=1
    75 fi
    76 
    77 # Determine if the C++ compiler is the Sun or GNU compiler.
    78 # Just to check we are not mixing GNU and non-GNU.
    79 if "$CXX" -flags > /dev/null 2>&1 ; then
    80    SUN_COMPILER=1
    81 else
    82    GNU_COMPILER=1
    83 fi
    84 
    85 
    86 # Determine if the Fortran compiler is the Sun or GNU compiler.
    87 if [ -z "$SAGE_FORTRAN" ] ; then
    88    echo "No Fortran compiler has been defined. This is not normally a problem."
    89 else
    90    if "$SAGE_FORTRAN" -flags > /dev/null 2>&1 ;  then
    91       SUN_COMPILER=1
    92    else
    93       GNU_COMPILER=1
    94    fi
    95 fi
    96 
    97 # Check if SAGE_FORTRAN_LIB is defined, that the file actually exists.
    98 # SAGE_FORTRAN_LIB does not always need to be defined, but if it is defined, then
    99 # the file should exist.
    100 
    101 if [ -n "$SAGE_FORTRAN_LIB" ] &&  [ ! -e "$SAGE_FORTRAN_LIB" ]; then
    102    echo "SAGE_FORTRAN_LIB is defined as $SAGE_FORTRAN_LIB, but does not exist."
    103    exit 1
    104 fi
    105 
    106 # Checks that the user is not mixing the Sun and GNU compilers. This problem
    107 # has been seen on code built with the aid of SCons, but in general could
    108 # happen with any code if the user has specified a C compiler but not a C++ one.
    109 # This problem is even more likely to occur with the Fortran compiler - I've done
    110 # it myself when building Sage!
    111 
    112 if [ "x$SUN_COMPILER" = "x1" ] && [ "x$GNU_COMPILER" = "x1" ] ; then
    113    echo "You are mixing the Sun and GNU C/C++/Fortran compilers."
    114    echo "Such a combination will lead to problems."
    115    echo "Check CC, CXX & SAGE_FORTRAN carefully."
    116    echo "Exiting ..."
    117    exit 1
     28   CFLAGS="$CFLAGS -g -O2"
    11829fi
    11930
    12031# These are all used by GNU to specify compilers.
    12132echo "Using CC=$CC"
    122 echo "Using CXX=$CXX"
    123 echo "Using FC=$FC"
    124 echo "Using F77=$F77"
    12533
    126 # Used by Sage in connection with Fortran.
    127 echo "Using SAGE_FORTRAN=$SAGE_FORTRAN"
    128 echo "Using SAGE_FORTRAN_LIB=$SAGE_FORTRAN_LIB"
    12934
    13035# Flags which may be set.
    13136echo "The following environment variables will be exported."
    13237echo "Using CFLAGS=$CFLAGS"
    133 echo "Using CXXFLAGS=$CXXFLAGS"
    134 echo "Using FCFLAGS=$FCFLAGS"
    135 echo "Using F77FLAGS=$F77FLAGS"
    13638echo "Using CPPFLAGS=$CPPFLAGS"
    13739echo "Using LDFLAGS=$LDFLAGS"
    138 echo "Using ABI=$ABI"
    13940echo "configure scripts and/or makefiles might override these later"
    14041echo " "
    14142
    142 # export everything. Probably not necessary in most cases.
    14343export CFLAGS
    144 export CXXFLAGS
    145 export FCFLAGS
    146 export F77FLAGS
    14744export CPPFLAGS
    14845export LDFLAGS
    149 export ABI
    15046
    15147# End of pretty general spkg-install file.
    15248# Now do the specific things needed for this package (Readline)
    15349
    154 
    155 echo "Deleting old readline headers and libs"
     50echo "Deleting old readline headers and libs..."
    15651rm -rf "$SAGE_LOCAL"/include/readline/
    15752rm -rf "$SAGE_LOCAL"/lib/libreadline.*
    15853
    15954# OVERWRITE_READLINE=false; export OVERWRITE_READLINE
    16055
    161 set +e # We want the exit codes!
    162 
    16356# First we check for OpenSUSE 11.x, since there bash is linked dynamically with a
    16457# more recent readline such that bash crashes when we build Sage's readline, so
    16558# we work around this for now by not building Sage's version and instead using
     
    249142
    250143cd src/
    251144
    252 build()
    253 {
    254     ./configure --prefix="$SAGE_LOCAL" $CONF_FLAGS
    255     if [ $? -ne 0 ]; then
    256         echo "Error configuring readline."
    257         exit 1
    258     fi
    259     make install
    260 }
     145./configure --prefix="$SAGE_LOCAL"
     146if [ $? -ne 0 ]; then
     147  echo "Error configuring readline."
     148  exit 1
     149fi
    261150
    262 build
     151$MAKE
    263152if [ $? -ne 0 ]; then
    264     echo "Error building and installing readline."
     153    echo "Error building readline."
    265154    exit 1
    266155fi
    267156
    268 set -e
     157$MAKE install
     158if [ $? -ne 0 ]; then
     159    echo "Error installing readline."
     160    exit 1
     161fi
    269162
    270163if [ "$UNAME" = "Darwin" ]; then
    271164  DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.dylib
     
    273166  # It is of course very lame that readline names the file .dll.a, but that's what it does.
    274167  DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.dll.a
    275168elif [ "$UNAME" = "OpenBSD" ]; then
    276   DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.so.6.0
     169  DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.so.6.1  # Untested. David Kirkby, 11th November 2010
    277170elif [ "$UNAME" = "FreeBSD" ]; then
    278171  DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.so.6
    279172elif [ "$UNAME" = "HP-UX" ]; then
     
    282175  DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.so
    283176fi
    284177
    285 # # We only enter this block on openSUSE 11.1.
    286 # if [ $OVERWRITE_READLINE = "true" ]; then
    287 #   echo "Overwriting libreadline.so.6.0 with the system one."
    288 #   rm -f $SAGE_LOCAL/lib/libreadline.so.6.0
    289 #   if [ `uname -p` = "x86_64" ]; then
    290 #     cp /lib64/libreadline.so.* $SAGE_LOCAL/lib
    291 #   else
    292 #     cp /lib/libreadline.so.* $SAGE_LOCAL/lib
    293 #   fi
    294 # fi
    295 
    296178# Make sure that the install worked, despite whatever the error
    297179# code of build was.
    298180if [ -f "$DYLIB_NAME" -a -f "$SAGE_LOCAL"/lib/libreadline.a ]; then