Ticket #13443: r-2.14.0.p6.diff

File r-2.14.0.p6.diff, 7.9 KB (added by Jeroen Demeyer, 10 years ago)

Diff for the R spkg. For reference / review only.

  • SPKG.txt

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1347291124 -7200
    # Node ID a655dc03b4526b3c08df6c7a5901febc4a841157
    # Parent  f0edda81fd678bde69766f4f41c002bc7a716283
    Trac #13443: some clean up of spkg-install
    
    diff --git a/SPKG.txt b/SPKG.txt
    a b  
    4141
    4242== Changelog ==
    4343
     44=== r-2.14.0.p6 (Jeroen Demeyer, 10 September 2012) ===
     45 * #13443: some clean up of spkg-install.
     46 * Compile R with optimization (at -O2 level).
     47 * No longer pass -I and -L options to gcc (see #13348).
     48 * No longer use sage_fortran (see #13349).
     49 * Re-enable parallel make install, which works now (see #13428).
     50
    4451=== r-2.14.0.p5 (Jeroen Demeyer, 4 September 2012) ===
    4552 * #9906: separate the rpy2 spkg.
    4653
  • spkg-install

    diff --git a/spkg-install b/spkg-install
    a b  
    11#!/usr/bin/env bash
    22
    33if [ -z "$SAGE_LOCAL" ]; then
    4    echo "SAGE_LOCAL undefined ... exiting";
    5    echo "Maybe run 'sage -sh'?"
    6    exit 1
     4    echo >&2 "SAGE_LOCAL undefined ... exiting"
     5    echo >&2 "Maybe run 'sage --sh'?"
     6    exit 1
    77fi
    88
    9 if [ "x$SAGE64" = xyes  ]; then
    10    echo "Building R 64 bit."
    11    CFLAGS="-O2 -g -m64 "; export CFLAGS
    12    LDFLAGS="-m64 "; export LDFLAGS
     9
     10# Make sure CPPFLAGS and LDFLAGS are set to something (even the empty
     11# string) to prevent R from overriding them.
     12CPPFLAGS="$CPPFLAGS"
     13LDFLAGS="$LDFLAGS"
     14
     15# Optimization flags
     16if [ "$SAGE_DEBUG" = yes ]; then
     17    CFLAGS="-g -O0 $CFLAGS"
     18    FCFLAGS="-g -O0 $FCFLAGS"
     19else
     20    CFLAGS="-g -O2 $CFLAGS"
     21    FCFLAGS="-g -O2 $FCFLAGS"
    1322fi
    1423
     24if [ "$SAGE64" = yes ]; then
     25   echo "Building R 64 bit."
     26   CFLAGS="-m64 $CFLAGS"
     27   FCFLAGS="-m64 $FCFLAGS"
     28   LDFLAGS="-m64 $LDFLAGS"
     29fi
     30
     31export CFLAGS CPPFLAGS FCFLAGS LDFLAGS
     32
    1533if [ "$UNAME" = "Darwin" ]; then
    16    echo "Copying fake java and javac compiler on OSX"
     34   echo "Copying fake java and javac compiler on OS X"
    1735   cp patches/java "$SAGE_LOCAL"/bin
    1836   cp patches/javac "$SAGE_LOCAL"/bin
    1937fi
    2038
    2139
    22 # set CPPFLAGS so that Sage's readline & iconv are picked up
    23 CPPFLAGS="-I$SAGE_LOCAL/include $CPPFLAGS"; export CPPFLAGS
     40# Determine special configure options $R_CONFIGURE (don't put paths in
     41# this variable as this can cause problems with quoting)
     42R_CONFIGURE="--enable-R-shlib $R_CONFIGURE"
    2443
    2544# Note by Karl-Dieter Crisman, April 12th 2010. X support would be nice
    2645# to have in OSX, but see
     
    3352#
    3453# Note by David Kirkby, Feb 16th 2010. /usr/include/X11/Xwindows.h does
    3554# not exist on Solaris, but R configures OK with X support. Hence I've added
    36 # a more specific test on Solaris, by testing for a library. That library 
     55# a more specific test on Solaris, by testing for a library. That library
    3756# exists both on Solaris 10 03/2005 (SPARC) and on OpenSolaris.
    3857if [ "$UNAME" = "Darwin" ]; then
    3958    XSUPPORT=no
    4059elif [ -f /usr/include/X11/Xwindows.h ]; then
    4160    XSUPPORT=yes
     61elif [ "$UNAME" = "SunOS" ] && [ -f /usr/X11/lib/libXv.so ] ; then
     62    XSUPPORT=yes
    4263else
    43    if [ "$UNAME" = "SunOS" ] && [ -f /usr/X11/lib/libXv.so ] ; then
    44        XSUPPORT=yes
    45    else
    46        XSUPPORT=no
    47    fi
     64    XSUPPORT=no
     65fi
     66R_CONFIGURE="--with-x=$XSUPPORT $R_CONFIGURE"
     67
     68if [ "$UNAME" = "Darwin" ]; then
     69    # We don't want to install R as a library framework on OSX
     70    R_CONFIGURE="--enable-R-framework=no $R_CONFIGURE"
    4871fi
    4972
    50 OSXFW=
    51 if [ "$UNAME" = "Darwin" ]; then
    52     # We don't want to install R as a library framework on OSX
    53     OSXFW="--enable-R-framework=no"
    54 fi
    55 
    56 if [ "$UNAME" = "SunOS" ]; then
     73if [ "$SAGE_FAT_BINARY" = yes ]; then
     74    echo "Disabling ICU for a binary build"
     75    R_CONFIGURE="--without-ICU $R_CONFIGURE"
     76elif [ "$UNAME" = "SunOS" ]; then
    5777    # Note by David Kirkby, 16th Feb 2010. Even after adding the iconv library
    58     # R would not build properly on Solaris 10, complaining of undefined symbols 
     78    # R would not build properly on Solaris 10, complaining of undefined symbols
    5979    # uiter_setUTF8 and  ucol_strcollIter
    6080    # After an email to r-help@r-project.org, Ei-ji Nakama (rim.nakama@gmail.com)
    61     # emailed me and said the option --without-ICU might help, which it did. I don't see 
    62     # this option documented, but for now at least, it does allow R to build. 
     81    # emailed me and said the option --without-ICU might help, which it did. I don't see
     82    # this option documented, but for now at least, it does allow R to build.
    6383
    6484    echo "Disabling ICU on Solaris, using an undocumented option --without-ICU"
    6585    echo "since the ICU library is not included on Solaris."
    66     SUN_FLAGS="--without-ICU"; export SUN_FLAGS
     86    R_CONFIGURE="--without-ICU $R_CONFIGURE"
    6787fi
    6888
    69 # let's remove old install, even the wrongly installed ones
    70 rm -rf "$SAGE_LOCAL"/lib/r
    71 rm -rf "$SAGE_LOCAL"/lib/R
    72 rm -rf "$SAGE_LOCAL"/lib64/R
    73 rm -rf "$SAGE_LOCAL"/lib64/r
    74 # and let's also nuke some leftovers on SAGE_LOCAL/lib
    75 rm -rf "$SAGE_LOCAL"/lib/libRblas.so "$SAGE_LOCAL"/lib/libRlapack.so "$SAGE_LOCAL"/lib/libR.so
    76 rm -rf "$SAGE_LOCAL"/lib/libRblas.dylib "$SAGE_LOCAL"/lib/libRlapack.dylib "$SAGE_LOCAL"/lib/libR.dylib
    77 
    7889cd src
    7990
    8091# Apply patches.  See SPKG.txt for information about what each patch
     
    91102# See patches/R.sh.patch
    92103export SAGE_BUILDING_R=yes
    93104
    94 # make sure the prefix is always lib, not lib64 on 64 bit linux
    95 LIBnn="lib"; export LIBnn
    96 
    97 FC=sage_fortran; export FC
    98 F77=sage_fortran; export F77
    99 
    100 # These flags are *critical* so that R will be built against Sage's
    101 # copy of readline and ATLAS.
    102 CFLAGS="-I$SAGE_LOCAL/include -L$SAGE_LOCAL/lib/ $CFLAGS"; export CFLAGS
    103 LDFLAGS="-L$SAGE_LOCAL/lib/ $LDFLAGS"; export LDFLAGS   
    104105
    105106if [ "$UNAME" = "Darwin" ]; then
    106      echo "Configuring R for OSX"
    107     ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" --enable-R-shlib --with-x=$XSUPPORT --with-readline="$SAGE_LOCAL" $OSXFW
     107    echo "Configuring R without ATLAS for OS X"
     108    ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" $R_CONFIGURE \
     109        --with-readline="$SAGE_LOCAL"
    108110else
    109      echo "Configuring R with ATLAS"
    110      if [ "x$SAGE_FAT_BINARY" = xyes ] ; then
    111       ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" --enable-R-shlib --with-x=$XSUPPORT --with-readline="$SAGE_LOCAL" --with-blas="-L$SAGE_LOCAL/lib -lf77blas -latlas" --with-lapack="-L$SAGE_LOCAL/lib -llapack -lcblas" --with-ICU=no
    112      else
    113       ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" --enable-R-shlib --with-x=$XSUPPORT --with-readline="$SAGE_LOCAL" --with-blas="-L$SAGE_LOCAL/lib -lf77blas -latlas" --with-lapack="-L$SAGE_LOCAL/lib -llapack -lcblas" $SUN_FLAGS
    114      fi
     111    echo "Configuring R with ATLAS"
     112    ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" $R_CONFIGURE \
     113        --with-readline="$SAGE_LOCAL" \
     114        --with-blas="-L$SAGE_LOCAL/lib -lf77blas -latlas" \
     115        --with-lapack="-L$SAGE_LOCAL/lib -llapack -lcblas"
    115116fi
    116117
    117118if [ $? -ne 0 ]; then
    118      echo "Configuring R with fallback options"
    119     ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" --enable-R-shlib --with-x=no --with-readline="$SAGE_LOCAL" $OSXFW $SUN_FLAGS
     119    echo "Configuring R with fallback options"
     120    R_CONFIGURE=`echo "$R_CONFIGURE" | sed 's/--with-x=yes/--with-x=no/' `
     121    ./configure --prefix="$SAGE_LOCAL" --libdir="$SAGE_LOCAL/lib" $R_CONFIGURE \
     122        --with-readline="$SAGE_LOCAL"
    120123fi
    121124
    122125if [ $? -ne 0 ]; then
     
    130133    exit 1
    131134fi
    132135
    133 # Disable parallel make install, which is supposedly broken
    134 $MAKE -j1 vignettes  # Needed for help system
    135 $MAKE -j1 install
     136# Remove old install
     137rm -rf "$SAGE_LOCAL"/lib/r
     138rm -rf "$SAGE_LOCAL"/lib/R
     139rm -rf "$SAGE_LOCAL"/lib/libRblas.* "$SAGE_LOCAL"/lib/libRlapack.* "$SAGE_LOCAL"/lib/libR.*
     140
     141
     142$MAKE vignettes   # needed for help system
     143$MAKE install
    136144if [ $? -ne 0 ]; then
    137145    echo "Error installing R."
    138146    exit 1
    139147fi
    140148
    141 #$MAKE install-libR
    142 #if [ $? -ne 0 ]; then
    143 #    echo "Error installing libR."
    144 #    exit 1
    145 #fi
    146 
    147149if [ "$UNAME" = "Darwin" ]; then
    148150    echo "Removing fake java and javac compiler"
    149151    rm -f "$SAGE_LOCAL"/bin/java