Ticket #9533: 9533-add-SAGE_DEBUG-and_CFLAG64.patch

File 9533-add-SAGE_DEBUG-and_CFLAG64.patch, 2.6 KB (added by drkirkby, 9 years ago)

Adds support for SAGE_DEBUG, CFLAG64, checks SAGE_ROOT and exports LDFLAGS on 64-bit builds

  • spkg-check

    # HG changeset patch
    # User David Kirkby <david.kirkby@onetel.net>
    # Date 1279489608 -3600
    # Node ID 705d5c336f5841721a43cc895296711ae4b5ee34
    # Parent  765f7a4e484339c58d3c7a47440beb9e99c13719
    #9533 Check for SAGE_ROOT in both spkg-check and spkg-install. Make use of SAGE_DEBUG and CFLAG64 too.
    
    diff -r 765f7a4e4843 -r 705d5c336f58 spkg-check
    a b  
    11#!/usr/bin/env bash
    22
     3if [ -z $SAGE_LOCAL ] ; then
     4   echo "SAGE_LOCAL undefined ... exiting";
     5   echo "Maybe run 'sage -sh'?"
     6   exit 1
     7fi
     8
     9# Let the user set an environment variable CFLAG64 to
     10# indicate the C compiler flag for 64-bit builds. By
     11# default this will be -m64. IBM's compiler on AIX
     12# and HP's on HP-UX do NOT use -m64. 
     13
     14if [ -z $CFLAG64 ] ; then
     15   CFLAG64=-m64
     16fi
     17
     18# There is no C++ code in GSL, so no need to do likewise
     19# with CXXFLAG64.
     20
     21if [ "x$SAGE64" = xyes ]; then
     22   echo "Building a 64-bit version of the GNU Scientific Library (GSL)"
     23   CFLAGS="$CFLAGS $CFLAG64"
     24   CPPFLAGS="$CPPFLAGS $CFLAG64" ; export CPPFLAGS
     25   LDFLAGS="$LDFLAGS $CFLAG64" ; export LDFLAGS
     26fi
     27
     28if [ "x$SAGE_DEBUG" = xyes ] ; then
     29  CFLAGS="$CFLAGS -g -O0" # No optimisation, aids debugging.
     30else
     31  CFLAGS="$CFLAGS -g -O2" # Normal optimisation.
     32fi
     33
     34export CFLAGS
     35
    336cd src
    437
    538$MAKE check
  • spkg-install

    diff -r 765f7a4e4843 -r 705d5c336f58 spkg-install
    a b  
    11#!/usr/bin/env bash
    22
     3if [ -z $SAGE_LOCAL ] ; then
     4   echo "SAGE_LOCAL undefined ... exiting";
     5   echo "Maybe run 'sage -sh'?"
     6   exit 1
     7fi
     8
     9# Let the user set an environment variable CFLAG64 to
     10# indicate the C compiler flag for 64-bit builds. By
     11# default this will be -m64. IBM's compiler on AIX
     12# and HP's on HP-UX do NOT use -m64. 
     13
     14if [ -z $CFLAG64 ] ; then
     15   CFLAG64=-m64
     16fi
     17
     18# There is no C++ code in GSL, so no need to do likewise
     19# with CXXFLAG64.
     20
    321if [ "x$SAGE64" = xyes ]; then
    422   echo "Building a 64-bit version of the GNU Scientific Library (GSL)"
    5    CFLAGS="$CFLAGS -m64 "
    6    CPPFLAGS="$CPPFLAGS -m64" ; export CPPFLAGS
     23   CFLAGS="$CFLAGS $CFLAG64"
     24   CPPFLAGS="$CPPFLAGS $CFLAG64" ; export CPPFLAGS
     25   LDFLAGS="$LDFLAGS $CFLAG64" ; export LDFLAGS
    726fi
    827
    9 CFLAGS="$CFLAGS -g -O2"
     28if [ "x$SAGE_DEBUG" = xyes ] ; then
     29  CFLAGS="$CFLAGS -g -O0" # No optimisation, aids debugging.
     30else
     31  CFLAGS="$CFLAGS -g -O2" # Normal optimisation.
     32fi
     33
    1034export CFLAGS
    1135
    1236# An error "/bin/rm: cannot remove `libtoolT': No such file or directory"