Ticket #9523: readline-6.1.patch
| File readline-6.1.patch, 13.5 KB (added by jdemeyer, 3 years ago) |
|---|
-
SPKG.txt
diff -r 894db1d3de14 SPKG.txt
a b 33 33 since it took tons of space; didn't delete anything else. 34 34 * Work around some MacOSX dynamic lib flags 35 35 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 36 95 == readline-6.0p2 (Mike Hansen, June 22nd, 2010) == 37 96 * #7821: readline-6.0.p1 fails on FreeBSD 38 97 -
patches/shobj-conf
diff -r 894db1d3de14 patches/shobj-conf
a b 64 64 esac 65 65 done 66 66 67 case "${host_os}-${SHOBJ_CC} " in67 case "${host_os}-${SHOBJ_CC}-${host_vendor}" in 68 68 sunos4*-*gcc*) 69 69 SHOBJ_CFLAGS=-fpic 70 70 SHOBJ_LD=/usr/bin/ld … … 108 108 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' 109 109 ;; 110 110 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. 112 linux*-*|gnu*-*|k*bsd*-gnu-*|freebsd*-gentoo) 113 113 SHOBJ_CFLAGS=-fPIC 114 114 SHOBJ_LD='${CC}' 115 115 SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' … … 128 128 ;; 129 129 130 130 # FreeBSD-3.x ELF 131 freebsd [3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)131 freebsd3*|freebsdaout*) 132 132 SHOBJ_CFLAGS=-fPIC 133 133 SHOBJ_LD='${CC}' 134 134 … … 146 146 fi 147 147 ;; 148 148 149 # FreeBSD-4.x and later have only ELF 150 freebsd[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 149 160 # Darwin/MacOS X 150 161 darwin[89]*|darwin10*) 151 162 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 -08002 +++ shobj-conf 2010-06-22 15:06:53.000000000 -07001 --- src/support/shobj-conf Wed Oct 28 13:20:21 2009 2 +++ patches/shobj-conf Sun Oct 24 11:44:08 2010 3 3 @@ -132,11 +132,12 @@ 4 4 SHOBJ_CFLAGS=-fPIC 5 5 SHOBJ_LD='${CC}' -
new file spkg-check
diff -r 894db1d3de14 spkg-check
- + 1 #!/usr/bin/env bash 2 3 echo "Unfortunately, there is no way to check the readline package" 4 echo "as there are no self-tests. However, we will run 'make check'" 5 echo "as there is a 'check' target, and we might hope the readline" 6 echo "deveolopers actually add some test code." 7 8 9 cd src 10 $MAKE check 11 -
spkg-install
diff -r 894db1d3de14 spkg-install
a b 1 1 #!/usr/bin/env bash 2 2 ########################################### 3 ## Readline 6. 03 ## Readline 6.1 4 4 ########################################### 5 5 6 6 if [ -z "$SAGE_LOCAL" ] ; then 7 echo "SAGE_LOCAL undefined ... exiting" ;7 echo "SAGE_LOCAL undefined ... exiting" 8 8 echo "Maybe run 'sage -sh'?" 9 9 exit 1 10 10 fi 11 11 12 set -e 12 if [ "x$CFLAG64" = x ] ; then 13 CFLAG64=-m64 14 fi 13 15 14 16 # Add a sensible default optimisation flag. Change if necessary. 15 17 OPTIMIZATION_FLAGS="-O2" 16 18 17 # Most packages do not need all these set.18 # But it is better to do them all each time, rather than omit19 # 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). 20 22 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" 23 CFLAGS="$OPTIMIZATION_FLAGS $CFLAGS" 27 24 28 # Compile for 64-bit if SAGE64 is set to 'yes' or '1'29 if [ "x$SAGE64" = "xyes" ] || [ "x$SAGE64" = "x1" ]; then25 # Compile for 64-bit if SAGE64 is set to 'yes' 26 if [ "x$SAGE64" = xyes ] ; then 30 27 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" 35 29 # 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" 40 31 fi 41 32 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 " 33 if [ "x$SAGE_DEBUG" = xyes ] ; then 34 echo "Code will be built with no optimisation to aid debugging" 35 CFLAGS="$CFLAGS -g -O0" 55 36 else 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" 58 38 fi 59 39 60 40 # Add appropriate flag(s) to show all warnings. 61 41 # This test of a compiler is not perfect by any means, but 62 42 # is better than nothing. 63 43 if "$CC" -flags > /dev/null 2>&1 ; then 64 SUN_COMPILER=144 echo "Not adding any compiler flags to show extra warnings - Sun compiler is strict enough" 65 45 # The Sun compilers are fussy, and adding extra 66 46 # warnings will just show too many. 67 47 else 68 48 # Assume gcc if not the Sun C compiler. 69 49 # 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" 75 51 fi 76 52 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 ; then80 SUN_COMPILER=181 else82 GNU_COMPILER=183 fi84 85 86 # Determine if the Fortran compiler is the Sun or GNU compiler.87 if [ -z "$SAGE_FORTRAN" ] ; then88 echo "No Fortran compiler has been defined. This is not normally a problem."89 else90 if "$SAGE_FORTRAN" -flags > /dev/null 2>&1 ; then91 SUN_COMPILER=192 else93 GNU_COMPILER=194 fi95 fi96 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, then99 # the file should exist.100 101 if [ -n "$SAGE_FORTRAN_LIB" ] && [ ! -e "$SAGE_FORTRAN_LIB" ]; then102 echo "SAGE_FORTRAN_LIB is defined as $SAGE_FORTRAN_LIB, but does not exist."103 exit 1104 fi105 106 # Checks that the user is not mixing the Sun and GNU compilers. This problem107 # has been seen on code built with the aid of SCons, but in general could108 # 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 done110 # it myself when building Sage!111 112 if [ "x$SUN_COMPILER" = "x1" ] && [ "x$GNU_COMPILER" = "x1" ] ; then113 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 1118 fi119 120 # These are all used by GNU to specify compilers.121 53 echo "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"129 54 130 55 # Flags which may be set. 131 56 echo "The following environment variables will be exported." 132 57 echo "Using CFLAGS=$CFLAGS" 133 echo "Using CXXFLAGS=$CXXFLAGS"134 echo "Using FCFLAGS=$FCFLAGS"135 echo "Using F77FLAGS=$F77FLAGS"136 58 echo "Using CPPFLAGS=$CPPFLAGS" 137 59 echo "Using LDFLAGS=$LDFLAGS" 138 echo "Using ABI=$ABI"139 60 echo "configure scripts and/or makefiles might override these later" 140 61 echo " " 141 62 142 63 # export everything. Probably not necessary in most cases. 143 64 export CFLAGS 144 export CXXFLAGS145 export FCFLAGS146 export F77FLAGS147 65 export CPPFLAGS 148 66 export LDFLAGS 149 export ABI150 67 151 68 # End of pretty general spkg-install file. 152 69 # Now do the specific things needed for this package (Readline) … … 182 99 fi 183 100 fi 184 101 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`" ]; then189 if [ -f "/usr/lib/libreadline.so" ]; then190 echo "Copying over system's libreadline."191 cp /lib/libreadline.so.* "$SAGE_LOCAL"/lib192 exit 0193 else194 echo "Could not find a system copy of libreadline. Exiting."195 exit 1196 fi197 fi198 199 200 102 cp patches/shobj-conf src/support/ 201 103 if [ $? -ne 0 ]; then 202 104 echo "Error copying patch over." 203 105 exit 1 204 106 fi 205 107 206 cd src /108 cd src 207 109 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 216 111 if [ $? -ne 0 ]; then 217 echo "Error building and installing readline."112 echo "Error configuring readline" 218 113 exit 1 219 114 fi 220 set -e221 115 222 if [ $UNAME = "Darwin" ]; then 116 $MAKE 117 if [ $? -ne 0 ]; then 118 echo "Error building readline" 119 exit 1 120 fi 121 122 $MAKE install 123 if [ $? -ne 0 ]; then 124 echo "Error installing readline." 125 exit 1 126 fi 127 128 if [ "$UNAME" = "Darwin" ]; then 223 129 DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.dylib 224 elif [ $UNAME= "CYGWIN" ]; then130 elif [ "$UNAME" = "CYGWIN" ]; then 225 131 # It is of course very lame that readline names the file .dll.a, but that's what it does. 226 132 DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.dll.a 227 133 elif [ "$UNAME" = "OpenBSD" ]; then 228 DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.so.6. 0134 DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.so.6.1 # Untested. David Kirkby, 24th Oct 2010 229 135 elif [ "$UNAME" = "FreeBSD" ]; then 230 136 DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.so.6 231 137 elif [ "$UNAME" = "HP-UX" ]; then … … 234 140 DYLIB_NAME="$SAGE_LOCAL"/lib/libreadline.so 235 141 fi 236 142 237 # # We only enter this block on openSUSE 11.1.238 # if [ $OVERWRITE_READLINE = "true" ]; then239 # echo "Overwriting libreadline.so.6.0 with the system one."240 # rm -f $SAGE_LOCAL/lib/libreadline.so.6.0241 # if [ `uname -p` = "x86_64" ]; then242 # cp /lib64/libreadline.so.* $SAGE_LOCAL/lib243 # else244 # cp /lib/libreadline.so.* $SAGE_LOCAL/lib245 # fi246 # fi247 248 143 # Make sure that the install worked, despite whatever the error 249 144 # code of build was. 250 145 if [ -f "$DYLIB_NAME" -a -f "$SAGE_LOCAL"/lib/libreadline.a ]; then
