Ticket #14405: readline-tinfo.diff

File readline-tinfo.diff, 10.5 KB (added by vbraun, 8 years ago)

for review only

  • SPKG.txt

    diff -r c751f87f0077 -r 459e3c61c4b7 SPKG.txt
    a b  
    1313
    1414== License ==
    1515
    16  * GPL V2+
     16 * GPL V3+
    1717
    1818== SPKG Maintainers ==
    1919
    20  * Nobody
     20 * Volker Braun
    2121
    2222== Upstream Contact ==
    2323
     
    2525
    2626== Dependencies ==
    2727
    28  * GNU patch
    29 
    30  * libtermcap (or libncurses or libtinfo), but not Sage's one,
    31    since we only build a static version. I.e., the system has
    32    to provide one of these.
     28 * ncurses
    3329
    3430== Special Update/Build Instructions ==
    3531
    36  * Deleted some files from the doc directory from the standard distro,
    37    since it took tons of space; didn't delete anything else.
    38  * Work around some MacOSX dynamic lib flags.
    39  * When self-tests are added upstream, we may have to set up
    40    variables like CFLAGS in the script spkg-check: imitate the
    41    settings in spkg-install.  For self-tests, when we use the system's
    42    version of libreadline (e.g. [Open]SuSE or Arch Linux), we have to
    43    make sure we don't try to run the test suite in `spkg-check`, since
    44    this wouldn't work (and wouldn't make any sense either).
    45  * In #11882, we turned off the fixes for Arch Linux and OpenSuSE by
    46    changing various tests in spkg-install from "if ..." to "if false
    47    && ...".  When Arch Linux or OpenSuSE are updated, modified
    48    versions of these tests may need to be reinstated.
     32We build readline using ncurses. Readline needs to be told to link
     33with libtinfo (part of ncurses), this is what the patch to shobj-conf
     34does.
     35
     36
     37== Patches ==
     38
     39 * shobj-conf.patch: Readline's hand-crafted shared library options
     40   are buggy (should be using libtool).
     41
    4942
    5043== Changelog ==
    5144
    5245=== readline-6.2.p4 (Volker Braun, 3 April 2013) ===
    5346 * Do not build static libraries
    5447 * Use ncurses instead of termcap
     48 * Remove various commented-out hacks
     49 * Patch to src/shlib/Makefile.in removed, this belongs into shobj-conf
    5550
    5651=== readline-6.2.p3 (Leif Leonhardy, 3 January 2012) ===
    5752 * #11970: Support Ubuntu 11.10 by adding the library libreadline depends on
  • deleted file patches/shlib__Makefile.in.patch

    diff -r c751f87f0077 -r 459e3c61c4b7 patches/shlib__Makefile.in.patch
    + -  
    1 --- src/shlib/Makefile.in       2010-12-28 21:56:21.000000000 +0100
    2 +++ src/shlib/Makefile.in       2011-10-28 06:39:23.000000000 +0200
    3 @@ -166,7 +166,8 @@
    4  
    5  $(SHARED_READLINE):    $(SHARED_OBJ)
    6         $(RM) $@
    7 -       $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_OBJ) $(SHLIB_LIBS)
    8 +       # $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_OBJ) $(SHLIB_LIBS)
    9 +       $(SHOBJ_LD) ${SHOBJ_LDFLAGS} ${SHLIB_XLDFLAGS} -o $@ $(SHARED_OBJ) $(SHLIB_LIBS) $(TERMCAP_LIB)
    10  
    11  $(SHARED_HISTORY):     $(SHARED_HISTOBJ) xmalloc.so xfree.so
    12         $(RM) $@
  • patches/shobj-conf.patch

    diff -r c751f87f0077 -r 459e3c61c4b7 patches/shobj-conf.patch
    a b  
    1 --- src/support/shobj-conf      2009-10-28 06:20:21.000000000 -0700
    2 +++ src/support/shobj-conf      2011-09-30 09:49:02.000000000 -0700
     1--- src/support/shobj-conf      2009-10-28 13:20:21.000000000 +0000
     2+++ new/support/shobj-conf      2013-08-14 13:38:06.634576906 +0100
     3@@ -39,10 +39,10 @@
     4 SHOBJ_LD=
     5 SHOBJ_LDFLAGS=
     6 SHOBJ_XLDFLAGS=
     7-SHOBJ_LIBS=
     8+SHOBJ_LIBS='-ltinfo'
     9 
     10 SHLIB_XLDFLAGS=
     11-SHLIB_LIBS=
     12+SHLIB_LIBS='-ltinfo'
     13 
     14 SHLIB_DOT='.'
     15 SHLIB_LIBPREF='lib'
    316@@ -109,7 +109,7 @@
    417        ;;
    518 
     
    922        SHOBJ_CFLAGS=-fPIC
    1023        SHOBJ_LD='${CC}'
    1124        SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
    12 @@ -132,11 +132,12 @@
     25@@ -132,7 +132,7 @@
    1326        SHOBJ_CFLAGS=-fPIC
    1427        SHOBJ_LD='${CC}'
    1528 
     
    1831                SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
    1932 
    2033                SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
    21                 SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
    22 +                SHLIB_LIBS='-ltermcap'
    23         else
    24                 SHOBJ_LDFLAGS='-shared'
    25  
    26 @@ -146,30 +147,28 @@
     34@@ -146,32 +146,30 @@
    2735        ;;
    2836 
    2937 # FreeBSD-4.x and later have only ELF
     
    3644-
    3745-       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
    3846+freebsdelf*|dragonfly*)
    39 +        SHOBJ_CFLAGS=-fPIC
    40 +        SHOBJ_LD='${CC}'
    41 +        SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
    42 +        SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
     47+       SHOBJ_CFLAGS=-fPIC
     48+       SHOBJ_LD='${CC}'
     49+       SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
     50+       SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
    4351+       SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
    4452        ;;
    4553 
     
    6270+       SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup'
    6371+       SHLIB_XLDFLAGS='-dynamiclib -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
    6472 
    65         SHLIB_LIBS='-lncurses'  # see if -lcurses works on MacOS X 10.1
     73-       SHLIB_LIBS='-lncurses'  # see if -lcurses works on MacOS X 10.1
     74+       SHLIB_LIBS='-ltinfo -lncurses'  # see if -lcurses works on MacOS X 10.1
    6675        ;;
    67 @@ -186,11 +185,11 @@
     76 
     77 darwin*|macosx*)
     78@@ -186,15 +184,15 @@
    6879        SHLIB_LIBSUFF='dylib'
    6980 
    7081        case "${host_os}" in
     
    7990                        ;;
    8091        esac
    8192 
     93-       SHLIB_LIBS='-lncurses'  # see if -lcurses works on MacOS X 10.1
     94+       SHLIB_LIBS='-ltinfo -lncurses'  # see if -lcurses works on MacOS X 10.1
     95        ;;
     96 
     97 openbsd*|netbsd*)
  • spkg-install

    diff -r c751f87f0077 -r 459e3c61c4b7 spkg-install
    a b  
    2525    CFLAGS="-g -O2 $CFLAGS"
    2626fi
    2727
    28 # NOTE: Do *not* add -L$SAGE_LOCAL/lib to LDFLAGS,
    29 #       nor -I$SAGE_LOCAL/include to CPPFLAGS or CFLAGS.
    30 #       Sage ships and builds a libtermcap, but only a static one,
    31 #       and we actually *want* readline to use the system's
    32 #       libtermcap (or libncurses, or libtinfo).
    33 #       Readline does not need any [other] headers or libraries
    34 #       shipped / installed by Sage, so this is pretty ok.
    35 
    36 
    3728echo "The following environment variables will be exported:"
    3829echo "Using CC=$CC"
    3930echo "Using CFLAGS=$CFLAGS"
    4031echo "Using CPPFLAGS=$CPPFLAGS"
    4132echo "Using LDFLAGS=$LDFLAGS"
    4233echo "Configure scripts and/or makefiles might override these later."
    43 echo
    4434
     35export CC
    4536export CFLAGS
    4637export CPPFLAGS
    4738export LDFLAGS
    4839
    49 # End of pretty generic spkg-install file.
    50 # Now do the specific things needed for this package (Readline).
    51 
    52 # OVERWRITE_READLINE=false; export OVERWRITE_READLINE
    53 
    54 # First we check for OpenSUSE 11.x, since there bash is linked dynamically with
    55 # a potentially more recent readline such that bash crashes when we build Sage's
    56 # readline (or more precisely Sage's version is found along LD_LIBRARY_PATH), so
    57 # we work around this for now by not building Sage's version and instead using
    58 # the system's one.
    59 #
    60 # Since Sage's readline version (6.2) is meanwhile (or at the moment) current,
    61 # there are no problems building it on OpenSuSE (and Arch Linux) as well, so
    62 # we can bypass the work-arounds.  This might change once these operating
    63 # systems are again ahead of Sage w.r.t. their readline version.
    64 
    65 if [[ -f /etc/SuSE-release ]]; then
    66     echo "OpenSuSE or SuSE Linux detected."
    67     # #11882: Bypass this work-around for OpenSuSE.
    68     #
    69     # Note that "-q" doesn't work with Solaris' non-POSIX grep
    70     # in the default path, but we're certainly on Linux here:
    71     if false && grep -q 11\\. /etc/SuSE-release 2>/dev/null; then
    72         echo "OpenSuSE 11 detected."
    73         if [[ -d /usr/include/readline/ ]]; then
    74             echo "The development version of libreadline is installed => copying..."
    75             # Note that "cp -a" isn't POSIX, but again: We're on Linux.
    76             # ("uname -p" gives "unknown" on at least some Linuces, so we
    77             # better use the more portable "-m".)
    78             if [[ "`uname -m`" = x86_64 ]]; then
    79                 cp -af /lib64/libreadline.so.6* "$SAGE_LOCAL"/lib
    80             else
    81                 cp -af /lib/libreadline.so.6* "$SAGE_LOCAL"/lib
    82             fi
    83             if [[ $? -ne 0 ]]; then
    84                 echo >&2 "Error copying the system's libreadline."
    85                 exit 1
    86             fi
    87             ln -snf libreadline.so.6 "$SAGE_LOCAL"/lib/libreadline.so
    88             if [[ $? -ne 0 ]]; then
    89                 echo >&2 "Error creating symbolic link to libreadline.so.6."
    90                 exit 1
    91             fi
    92             cp -rf /usr/include/readline "$SAGE_LOCAL"/include
    93             if [[ $? -ne 0 ]]; then
    94                 echo >&2 "Error copying the system's readline header files."
    95                 exit 1
    96             fi
    97             # Copying succeeded, nothing else to be done.
    98             exit 0
    99         else
    100             echo >&2 "Error: No readline headers found. Please install OpenSuSE's development"
    101             echo >&2 "version of libreadline 6.x since building the version currently shipped"
    102             echo >&2 "with Sage would break your shell (bash). Sorry."
    103             exit 1
    104             # # This variable is only set to "true" on openSUSE 11.1.
    105             # OVERWRITE_READLINE="true"; export OVERWRITE_READLINE
    106         fi
    107     else
    108         if false; then
    109             echo "... but not OpenSuSE 11 => building Sage's version of libreadline."
    110         else
    111             echo "Building Sage's version of readline 6.2 anyway, since it is assumed"
    112             echo "to be current and to not break your dynamically linked bash..."
    113             echo "(Please report if this is no longer the case.)"
    114         fi
    115     fi
    116 fi
    117 
    118 # #11882: Bypass this test / work-around for Arch Linux since it apparently
    119 #         is no longer needed, at least at the moment (October 2011).
    120 #
    121 # We also check for Arch Linux, since it crashes with "undefined symbol: PC".
    122 # If anyone knows a better way to fix this, please do.
    123 # [This is likely to be fixed by putting libtermcap or libncurses into
    124 #  the NEEDED tags of our shared libreadline. -leif (October 2011)]
    125 if [[ -f /etc/arch-release ]]; then
    126     echo "Arch Linux detected."
    127 fi
    128 if false && [[ -f /etc/arch-release ]]; then
    129     if [[ -f "/lib/libreadline.so.6" ]]; then
    130         echo "Copying over system's libreadline (version 6.x)..."
    131         cp -af /lib/libreadline.so.6* "$SAGE_LOCAL"/lib
    132         if [[ $? -ne 0 ]]; then
    133             echo >&2 "Error copying the system's libreadline."
    134             exit 1
    135         fi
    136         ln -snf libreadline.so.6 "$SAGE_LOCAL"/lib/libreadline.so
    137         if [[ $? -ne 0 ]]; then
    138             echo >&2 "Error creating symbolic link to libreadline.so.6."
    139             exit 1
    140         fi
    141         # We shouldn't have to copy the headers...
    142         # (On Arch Linux, these are installed by default.)
    143         exit 0
    144     elif [[ -f "/lib/libreadline.so.5" ]]; then
    145         # We might have only an older version of libreadline.
    146         echo "Couldn't find a system copy of libreadline 6.x, only 5.x."
    147         echo "Building Sage's more recent version of libreadline..."
    148     else
    149         echo >&2 "Error: Could not find a system copy of libreadline 5.x or 6.x."
    150         echo >&2 "This is abnormal, so we better stop here..."
    151         exit 1
    152     fi
    153 fi
    154 
    155 
    15640cd src/
    15741
    15842echo "Applying patches to upstream source..."