Ticket #9312: 9312.patch

File 9312.patch, 9.5 KB (added by drkirkby, 9 years ago)

Mercurial patch which fixes the SAGE64 issue and tons more beside

  • SPKG.txt

    # HG changeset patch
    # User David Kirkby <david.kirkby@onetel.net>
    # Date 1277320820 -3600
    # Node ID 387cc49ee40b2202691411b6a31b3d3b513bc176
    # Parent  042a78470ee9efcc5b861fab49a3dc47666054ca
    #9312 Fix GLPK spkg for SAGE64 (But I actually done a lot more)
    
     * Updated to the latest upstream code, version 4.44.
     * Added code to allow a 64-bit build on any platform.
       If SAGE64 is set to "yes", the compiler flag -m64 is added
       by default. That flag works with GCC and SunStudio, but not
       all compilers - IBM's compiler for AIX and HP's for HP-UX
       both use different flags to create a 64-bit build.
       If the compiler does not use -m64 for 64-bit builds, then
       the environment variable CFLAG64 can be set to indicate what
       flag gets added.
     * Added a file spkg-check so the self-test code is built.
       This includes code which will add the appropriate flag
       for 64-bit builds if the test procedures need code to be
       compiled. (Sometimes running 'make test' actually needs
       the compiler flags set properly, so I do it just in case.
       It appears to be unnecessary with this version of GLPK,
       but might with later releases.
     * Added the configure option --with-gmp which will speed up
       processing of large integers (see src/INSTALL)
     * Added the configure option --disable-static since there is
       no need to build static libraries. (see src/INSTALL)
     * Added the configure option --with-zlib. Adding this allows
       GLPK API routines and the stand-alone solver to read and
       write compressed data files performing compression and
       decompression "on the fly" (see src/INSTALL)
     * Removed linking of the 'ld' library in spkg-install, as the
       reason for it being added was not clear.
     * Corrected SPKG.txt to indicate this code is GPL 3.
       (see src/COPYING)
     * Added the ChangeLog section to the SPKG.txt file
     * Added zlib, python and mpir as dependencies in SPKG.txt
     * Checked that the configure script actually does configure
       properly, if not exits.
     * Checked that 'make' does build the code properly, if not exits.
     * Checked that 'make install' does actually install the library
     * Checked that running 'python setup.py install' does actually work.
       If this is not done, code can appear to install properly as it
       passes 'configure', 'make' and 'make install'. So unusually there
       are 4 cases where spkg-install can fail.
     * The 'patch' directory is left - I think this should be removed
       but I'll leave it to those that know the software better
       than me to mess with this.
    
    diff -r 042a78470ee9 -r 387cc49ee40b SPKG.txt
    a b  
    77and other related problems. It is a set of routines written in ANSI C
    88and organized in the form of a callable library.
    99
    10 GLPK supports the GNU MathProg modeling language, which is a subset of
     10GLPK supports the GNU MathProg modelling language, which is a subset of
    1111the AMPL language.
    1212
    1313The GLPK package includes the following main components:
     
    2121
    2222== License ==
    2323
    24 The GLPK package is part of the GNU project, released under the aegis of GNU.
     24The GLPK package is GPL version 3.
    2525
    2626== SPKG Maintainers ==
    2727
     
    3131
    3232GLPK is currently being maintained by mao@gnu.org, mao@mai2.rcnet.ru
    3333http://www.gnu.org/software/glpk/#maintainer
     34
     35== Dependencies ==
     36
     37 * zlib
     38 * mpir (as an gmp substitute)
     39 * python
     40 * possibly others.
     41
     42== Changelog ==
     43
     44=== glpk-4.44 (David Kirkby, 23rd June 2010) ===
     45 * Updated to the latest upstream code, version 4.44.
     46 * Added code to allow a 64-bit build on any platform.
     47   If SAGE64 is set to "yes", the compiler flag -m64 is added
     48   by default. That flag works with GCC and SunStudio, but not
     49   all compilers - IBM's compiler for AIX and HP's for HP-UX
     50   both use different flags to create a 64-bit build.
     51   If the compiler does not use -m64 for 64-bit builds, then
     52   the environment variable CFLAG64 can be set to indicate what
     53   flag gets added.
     54 * Added a file spkg-check so the self-test code is built.
     55   This includes code which will add the appropriate flag
     56   for 64-bit builds if the test procedures need code to be
     57   compiled. (Sometimes running 'make test' actually needs
     58   the compiler flags set properly, so I do it just in case.
     59   It appears to be unnecessary with this version of GLPK,
     60   but might with later releases.
     61 * Added the configure option --with-gmp which will speed up
     62   processing of large integers (see src/INSTALL)
     63 * Added the configure option --disable-static since there is
     64   no need to build static libraries. (see src/INSTALL)
     65 * Added the configure option --with-zlib. Adding this allows
     66   GLPK API routines and the stand-alone solver to read and
     67   write compressed data files performing compression and
     68   decompression "on the fly" (see src/INSTALL)
     69 * Removed linking of the 'ld' library in spkg-install, as the
     70   reason for it being added was not clear.
     71 * Corrected SPKG.txt to indicate this code is GPL 3.
     72   (see src/COPYING)
     73 * Added the ChangeLog section to the SPKG.txt file
     74 * Added zlib, python and mpir as dependencies in SPKG.txt
     75 * Checked that the configure script actually does configure
     76   properly, if not exits.
     77 * Checked that 'make' does build the code properly, if not exits.
     78 * Checked that 'make install' does actually install the library
     79 * Checked that running 'python setup.py install' does actually work.
     80   If this is not done, code can appear to install properly as it
     81   passes 'configure', 'make' and 'make install'. So unusually there
     82   are 4 cases where spkg-install can fail.
     83 * The 'patch' directory is left - I think this should be removed
     84   but I'll leave it to those that know the software better
     85   than me to mess with this.
     86 
     87== ??? Nathan should fill in previous ChangeLog entries here ==
     88
  • new file spkg-check

    diff -r 042a78470ee9 -r 387cc49ee40b spkg-check
    - +  
     1if [ "$SAGE_LOCAL" = "" ]; then
     2   echo "SAGE_LOCAL undefined ... exiting";
     3   echo "Maybe run 'sage -sh'?"
     4   exit 1
     5fi
     6
     7
     8# Let the user set an environment variable CFLAG64 to indicate the flag
     9# for the C compiler to build 64-bit code. If not set, asssume it is -m64
     10# as that is what is used by both GCC and SunStudio, but -m64 is not used
     11# by IBM's compiler on AIX or HP's compiier on HP-UX
     12
     13if [ -z $CFLAG64 ] ; then
     14  CFLAG64=-m64 # -m64 is used by gcc and SunStudio.
     15fi
     16
     17if [ "x$SAGE64" = xyes ] ; then
     18   echo "Building a 64-bit version of GLPK"
     19   CFLAGS="$CFLAGS $CFLAG64" && export CFLAGS
     20   LDFLAGS="$LDFLAGS $CFLAG64" && export LDFLAGS
     21   CPPFLAGS="$CPPFLAGS $CFLAG64" && export CPPLFLAGS # Very rare is CPPFLAGS needed, but sometimes it is.
     22fi
     23
     24cd src
     25echo "GLPK will now be tested"
     26make check
     27if [ $? -ne 0 ]; then
     28    echo "An error occured whilst testing GLPK"
     29    exit 1
     30fi
     31
  • spkg-install

    diff -r 042a78470ee9 -r 387cc49ee40b spkg-install
    a b  
    44   exit 1
    55fi
    66
    7 
    87# The version of libtool in this glpk package requires that
    98# RM/MV/CP if they are set include the -f option
    109# See for example the discussion at:
    1110# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=523750
    1211
    13 : ${CP=cp}; CP="$CP -f"; export CP
    14 : ${MV=mv}; MV="$MV -f"; export MV
    15 : ${RM=rm}; RM="$RM -f"; export RM
     12# It was agreed some time back to remove these environment variables.
     13# nobody in their right mind will want to set them.
    1614
    17 cd src &&
    18 LIBS=-ldl ./configure --prefix=$SAGE_LOCAL &&
    19 make prefix=$SAGE_LOCAL &&
    20 make install &&
    21 cd .. &&
    22 python setup.py install &&
    23 echo "********************************************************************************" &&
    24 echo "" &&
    25 echo "    ATTENTION: YOU HAVE TO REBUILD THE SAGE LIBRARY TO GET THIS TO WORK" &&
    26 echo "    exit any running sage instances and call \"sage -b\"" &&
    27 echo "" &&
    28 echo "********************************************************************************"
     15unset MV && export MV
     16unset RM && export RM
     17unset CP && export CP
    2918
     19# Let the user set an environment variable CFLAG64 to indicate the flag
     20# for the C compiler to build 64-bit code. If not set, asssume it is -m64
     21# as that is what is used by both GCC and SunStudio, but -m64 is not used
     22# by IBM's compiler on AIX or HP's compiier on HP-UX
     23
     24if [ -z $CFLAG64 ] ; then
     25  CFLAG64=-m64 # -m64 is used by gcc and SunStudio.
     26fi
     27
     28CPPFLAGS="-I $SAGE_LOCAL/include" && export CPPFLAGS
     29LDFLAGS="-L$SAGE_LOCAL/lib" &&  export LDFLAGS
     30
     31if [ "x$SAGE64" = xyes ] ; then
     32   echo "Building a 64-bit version of GLPK"
     33   CFLAGS="$CFLAGS $CFLAG64" && export CFLAGS
     34   LDFLAGS="$LDFLAGS $CFLAG64" && export LDFLAGS
     35   CPPFLAGS="$CPPFLAGS $CFLAG64" && export CPPLFLAGS
     36   # Very rarly is it needed to add '-m64' to CPPFLAGS,
     37   # but potentially it can be.
     38fi
     39
     40cd src
     41
     42./configure --prefix=$SAGE_LOCAL --with-gmp --with-zlib --disable-static
     43
     44if [ $? -ne 0 ]; then
     45    echo "An error occured whilst configuring GLPK"
     46    exit 1
     47fi
     48
     49$MAKE
     50if [ $? -ne 0 ]; then
     51    echo "An error occured whilst building GLPK"
     52    exit 1
     53fi
     54
     55# There are two cases where this can fail to install - at the point of
     56# installing the C source code and at the point of using Python.
     57
     58$MAKE install
     59if [ $? -ne 0 ]; then
     60    echo "An error occured whilst installing GLPK (during the \"make install\" process)"
     61    exit 1
     62fi
     63cd ..
     64
     65python setup.py install
     66if [ $? -ne 0 ]; then
     67    echo "An error occured whilst installing GLPK (during the \"python setup.py install\" process)"
     68    exit 1
     69fi
     70