Ticket #9523: readline-6.1.patch

File readline-6.1.patch, 13.5 KB (added by jdemeyer, 3 years ago)

Complete spkg patch for reference

  • SPKG.txt

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

    diff -r 894db1d3de14 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. 
    112 linux*-*|gnu*-*|k*bsd*-gnu-*) 
     111# All versions of Linux (including Gentoo/FreeBSD) or the semi-mythical GNU Hurd. 
     112linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo) 
    113113        SHOBJ_CFLAGS=-fPIC 
    114114        SHOBJ_LD='${CC}' 
    115115        SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' 
     
    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 
     150freebsd[4-9]*|freebsdelf*|dragonfly*) 
     151        SHOBJ_CFLAGS=-fPIC 
     152        SHOBJ_LD='${CC}' 
     153 
     154        SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' 
     155        SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)' 
     156 
     157        SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' 
     158        ;; 
     159 
    149160# Darwin/MacOS X 
    150161darwin[89]*|darwin10*) 
    151162        SHOBJ_STATUS=supported 
  • patches/shobj-conf.patch

    diff -r 894db1d3de14 patches/shobj-conf.patch
    a b  
    1 --- ../src/support/shobj-conf   2009-01-04 11:32:42.000000000 -0800 
    2 +++ shobj-conf  2010-06-22 15:06:53.000000000 -0700 
     1--- src/support/shobj-conf      Wed Oct 28 13:20:21 2009 
     2+++ patches/shobj-conf  Sun Oct 24 11:44:08 2010 
    33@@ -132,11 +132,12 @@ 
    44        SHOBJ_CFLAGS=-fPIC 
    55        SHOBJ_LD='${CC}' 
  • new file spkg-check

    diff -r 894db1d3de14 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 "as there is a 'check' target, and we might hope the readline" 
     6echo "deveolopers actually add some test code." 
     7 
     8 
     9cd src 
     10$MAKE check 
     11 
  • spkg-install

    diff -r 894db1d3de14 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 
    7    echo "SAGE_LOCAL undefined ... exiting"; 
     7   echo "SAGE_LOCAL undefined ... exiting" 
    88   echo "Maybe run 'sage -sh'?" 
    99   exit 1 
    1010fi 
    1111 
    12 set -e 
     12if [ "x$CFLAG64" = x ] ; then 
     13   CFLAG64=-m64 
     14fi 
    1315 
    1416# Add a sensible default optimisation flag. Change if necessary. 
    1517OPTIMIZATION_FLAGS="-O2" 
    1618 
    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. 
     19# If the user sets CFLAGS, and sets a new optimisation level 
     20# such as -O3, then this will take presidence, as most compilers 
     21# will take the last option (gcc definately does). 
    2022 
    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" 
     23CFLAGS="$OPTIMIZATION_FLAGS $CFLAGS" 
    2724 
    28 # Compile for 64-bit if SAGE64 is set to 'yes' or '1' 
    29 if [ "x$SAGE64" = "xyes" ] || [ "x$SAGE64" = "x1" ] ; then 
     25# Compile for 64-bit if SAGE64 is set to 'yes'  
     26if [ "x$SAGE64" = xyes ] ; then 
    3027   echo "Building a 64-bit version of Readline" 
    31    CFLAGS="$CFLAGS -m64 " 
    32    CXXFLAGS="$CXXFLAGS -m64 " 
    33    FCFLAGS="$FCFLAGS -m64 " 
    34    F77FLAGS="$F77FLAGS -m64 " 
     28   CFLAGS="$CFLAGS $CFLAG64" 
    3529   # 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" 
     30   LDFLAGS="$LDFLAGS $CFLAG64" 
    4031fi 
    4132 
    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 " 
     33if [ "x$SAGE_DEBUG" = xyes ] ; then 
     34   echo "Code will be built with no optimisation to aid debugging" 
     35   CFLAGS="$CFLAGS -g -O0" 
    5536else 
    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)." 
     37   CFLAGS="$CFLAGS -g $OPTIMIZATION_FLAGS" 
    5838fi 
    5939 
    6040# Add appropriate flag(s) to show all warnings. 
    6141# This test of a compiler is not perfect by any means, but 
    6242# is better than nothing. 
    6343if "$CC" -flags > /dev/null 2>&1 ; then 
    64    SUN_COMPILER=1 
     44   echo "Not adding any compiler flags to show extra warnings - Sun compiler is strict enough" 
    6545   # The Sun compilers are fussy, and adding extra 
    6646   # warnings will just show too many. 
    6747else 
    6848   # Assume gcc if not the Sun C compiler. 
    6949   # 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 
     50   CFLAGS="$CFLAGS -Wall" 
    7551fi 
    7652 
    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 
    118 fi 
    119  
    120 # These are all used by GNU to specify compilers. 
    12153echo "Using CC=$CC" 
    122 echo "Using CXX=$CXX" 
    123 echo "Using FC=$FC" 
    124 echo "Using F77=$F77" 
    125  
    126 # Used by Sage in connection with Fortran. 
    127 echo "Using SAGE_FORTRAN=$SAGE_FORTRAN" 
    128 echo "Using SAGE_FORTRAN_LIB=$SAGE_FORTRAN_LIB" 
    12954 
    13055# Flags which may be set. 
    13156echo "The following environment variables will be exported." 
    13257echo "Using CFLAGS=$CFLAGS" 
    133 echo "Using CXXFLAGS=$CXXFLAGS" 
    134 echo "Using FCFLAGS=$FCFLAGS" 
    135 echo "Using F77FLAGS=$F77FLAGS" 
    13658echo "Using CPPFLAGS=$CPPFLAGS" 
    13759echo "Using LDFLAGS=$LDFLAGS" 
    138 echo "Using ABI=$ABI" 
    13960echo "configure scripts and/or makefiles might override these later" 
    14061echo " " 
    14162 
    14263# export everything. Probably not necessary in most cases. 
    14364export CFLAGS 
    144 export CXXFLAGS 
    145 export FCFLAGS 
    146 export F77FLAGS 
    14765export CPPFLAGS 
    14866export LDFLAGS 
    149 export ABI 
    15067 
    15168# End of pretty general spkg-install file. 
    15269# Now do the specific things needed for this package (Readline) 
     
    18299    fi 
    183100fi 
    184101 
    185 # We also check for Arch Linux, since it crashes with "undefined symbol: PC". 
    186 # If anyone knows a better way to fix this, please do. 
    187  
    188 if [ $UNAME = "Linux" -a -n "`uname -r | grep ARCH`" ]; then 
    189     if [ -f "/usr/lib/libreadline.so" ]; then 
    190         echo "Copying over system's libreadline." 
    191         cp /lib/libreadline.so.* "$SAGE_LOCAL"/lib 
    192         exit 0 
    193     else 
    194         echo "Could not find a system copy of libreadline. Exiting." 
    195         exit 1 
    196     fi 
    197 fi 
    198  
    199  
    200102cp patches/shobj-conf src/support/ 
    201103if [ $? -ne 0 ]; then 
    202104    echo "Error copying patch over." 
    203105    exit 1 
    204106fi 
    205107 
    206 cd src/ 
     108cd src 
    207109 
    208 build() 
    209 { 
    210     ./configure --prefix="$SAGE_LOCAL" $CONF_FLAGS 
    211     make install 
    212 } 
    213  
    214 build 
    215 set +e 
     110./configure --prefix="$SAGE_LOCAL" $CONF_FLAGS 
    216111if [ $? -ne 0 ]; then 
    217     echo "Error building and installing readline." 
     112    echo "Error configuring readline" 
    218113    exit 1 
    219114fi 
    220 set -e 
    221115 
    222 if [ $UNAME = "Darwin" ]; then 
     116$MAKE  
     117if [ $? -ne 0 ]; then 
     118    echo "Error building readline" 
     119    exit 1 
     120fi 
     121 
     122$MAKE install 
     123if [ $? -ne 0 ]; then 
     124    echo "Error installing readline." 
     125    exit 1 
     126fi 
     127 
     128if [ "$UNAME" = "Darwin" ]; then 
    223129  DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.dylib 
    224 elif [ $UNAME = "CYGWIN" ]; then 
     130elif [ "$UNAME" = "CYGWIN" ]; then 
    225131  # It is of course very lame that readline names the file .dll.a, but that's what it does. 
    226132  DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.dll.a 
    227133elif [ "$UNAME" = "OpenBSD" ]; then 
    228   DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.so.6.0 
     134  DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.so.6.1 # Untested. David Kirkby, 24th Oct 2010 
    229135elif [ "$UNAME" = "FreeBSD" ]; then 
    230136  DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.so.6 
    231137elif [ "$UNAME" = "HP-UX" ]; then 
     
    234140  DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.so 
    235141fi 
    236142 
    237 # # We only enter this block on openSUSE 11.1. 
    238 # if [ $OVERWRITE_READLINE = "true" ]; then 
    239 #   echo "Overwriting libreadline.so.6.0 with the system one." 
    240 #   rm -f $SAGE_LOCAL/lib/libreadline.so.6.0 
    241 #   if [ `uname -p` = "x86_64" ]; then 
    242 #     cp /lib64/libreadline.so.* $SAGE_LOCAL/lib 
    243 #   else 
    244 #     cp /lib/libreadline.so.* $SAGE_LOCAL/lib 
    245 #   fi 
    246 # fi 
    247  
    248143# Make sure that the install worked, despite whatever the error 
    249144# code of build was. 
    250145if [ -f "$DYLIB_NAME" -a -f "$SAGE_LOCAL"/lib/libreadline.a ]; then