# HG changeset patch
# User David Kirkby <david.kirkby@onetel.net>
# Date 1275077426 -3600
# Node ID b25b4b41a626fcc25e97f150d1e59d3eee05f394
# Parent  e9a8d50202cfd4f762654ee197c6a226fe707201
 * Force 64-bit build if SAGE64 is set to "yes" and not "yes"
   and "1" as before, since an early part of Sage ensures SAGE64
   can only be "yes" or "no", so it is pointless to check for "1" too.
 * Added a variable CXXFLAG64 to spkg-install, which defaults to
   -m64, but can be set as an environment variable to whatever flag
   is needed by the C++ compiler.
 * Export CXXFLAG64 if SAGE64 is set to "yes".
 * Added {$CXXFLAG64} to patches/Makefile.sage, so that the right flag
   is added for a 64-bit build at the link phase.
 * It should be noted the Makefile makes extensive use of $(FOOBAR),
   but such variables only work internally to the Makefile. If they need
   to be inported, then it needs to be ${FOOBAR}, and not $(FOOBAR).
 * Removed these 4 files from the source, since they serve no useful
   purpose (see note in Special Build Instructions).
   ./src/src/.Makefile.old.swp
   ./src/src/.Lcommandline.ggo.swp
   ./src/include/.Lvalue.h.swp
   ./src/include/.Lexplicit_formula.h.swp

diff -r e9a8d50202cf -r b25b4b41a626 SPKG.txt
--- a/SPKG.txt	Fri May 28 21:08:46 2010 +0100
+++ b/SPKG.txt	Fri May 28 21:10:26 2010 +0100
@@ -12,10 +12,41 @@
 
  * Rishikesh
 
+== Special Build instructions  ==
+
+Check if there are any unwanted binary files. 4 were found on 
+version 1.23, which I removed. (David Kirkby, 27th May 2010). 
+
+./src/src/.Makefile.old.swp
+./src/src/.Lcommandline.ggo.swp
+./src/include/.Lvalue.h.swp
+./src/include/.Lexplicit_formula.h.swp
+
 == Upstream contact ==
 
 Michael Rubinstein <mrubinst@uwaterloo.ca>
 
+=== lcalc-1.23.p0 (David Kirkby, 27th May 2010)  ===
+ * See: #9043 - lcalc failing to build on OpenSolaris x64.
+ * Force 64-bit build if SAGE64 is set to "yes" and not "yes" 
+   and "1" as before, since an early part of Sage ensures SAGE64
+   can only be "yes" or "no", so it is pointless to check for "1" too.
+ * Added a variable CXXFLAG64 to spkg-install, which defaults to 
+   -m64, but can be set as an environment variable to whatever flag
+   is needed by the C++ compiler. 
+ * Export CXXFLAG64 if SAGE64 is set to "yes".
+ * Added {$CXXFLAG64} to patches/Makefile.sage, so that the right flag
+   is added for a 64-bit build at the link phase. 
+ * It should be noted the Makefile makes extensive use of $(FOOBAR),
+   but such variables only work internally to the Makefile. If they need
+   to be inported, then it needs to be ${FOOBAR}, and not $(FOOBAR). 
+ * Removed these 4 files from the source, since they serve no useful 
+   purpose (see note in Special Build Instructions). 
+   ./src/src/.Makefile.old.swp
+   ./src/src/.Lcommandline.ggo.swp
+   ./src/include/.Lvalue.h.swp
+   ./src/include/.Lexplicit_formula.h.swp
+
 === lcalc-1.23 (Rishikesh, 24th March 2010)  ===
  * changed spkg-install to change location of header files (#4793)
  * changed compile flags so that lcalc compiles on OSX (#4793)
diff -r e9a8d50202cf -r b25b4b41a626 patches/Makefile.sage
--- a/patches/Makefile.sage	Fri May 28 21:08:46 2010 +0100
+++ b/patches/Makefile.sage	Fri May 28 21:10:26 2010 +0100
@@ -246,7 +246,7 @@
 
 
 libLfunction.so: $(OBJ_L)
-	g++ -$(DYN_OPTION)  -o libLfunction.so $(OBJ_L)
+	g++ -$(DYN_OPTION) ${CXXFLAG64} -o libLfunction.so $(OBJ_L)
 
 clean:
 	rm -f *.o lcalc libLfunction.so example_programs/example
diff -r e9a8d50202cf -r b25b4b41a626 spkg-install
--- a/spkg-install	Fri May 28 21:08:46 2010 +0100
+++ b/spkg-install	Fri May 28 21:10:26 2010 +0100
@@ -26,18 +26,39 @@
 CPPFLAGS="$CPPFLAGS -I$SAGE_LOCAL/include"
 LDFLAGS="$LDFLAGS -L$SAGE_LOCAL/lib"
 
-# Compile for 64-bit if SAGE64 is set to 'yes' or '1'
-if [ "x$SAGE64" = "xyes" ] || [ "x$SAGE64" = "x1" ]  ; then
+
+# Compile for 64-bit if SAGE64 is set to 'yes' 
+if [ "x$SAGE64" = xyes ]  ; then
    echo "Building a 64-bit version of lcalc"
-   CFLAGS="$CFLAGS -m64 "
-   CXXFLAGS="$CXXFLAGS -m64 "
-   FCFLAGS="$FCFLAGS -m64 "
-   F77FLAGS="$F77FLAGS -m64 "
+
+   # Both Sun and GNU compilers use -m64 to build 64-bit code,
+   # but compilers from IBM (on AIX), and HP (on HP-UX) 
+   # do not. So allow the environment
+   # variables CFLAG64 and CXXFLAG64 to set the flag to whatever
+   # option the C and C++ compilers want for 64-bit code. If not default to -m64. 
+
+   if [ -z $CFLAG64 ] ; then
+      CFLAG64=-m64
+   fi 
+
+   if [ -z $CXXFLAG64 ] ; then
+      CXXFLAG64=-m64
+   fi 
+   export CFLAG64
+   export CXXFLAG64
+
+   CFLAGS="$CFLAGS $CFLAG64 "
+   CXXFLAGS="$CXXFLAGS $CXXFLAG64 "
+   FCFLAGS="$FCFLAGS $CXXFLAG64 "
+   F77FLAGS="$F77FLAGS $CXXFLAG64 "
    # Some packages may need LDFLAGS and/or ABI set here. 
    # LDFLAGS="$LDFLAGS -m64 "
    # ABI=64
-else
-   echo "Building a 32-bit version of lcalc"
+   # Normally one would just add this to CXXFLAGS, but since the Makefile
+   # does not import CXXFLAGS properly, and it would take a major change to 
+   # sort out the Makefile properly, the variable can just be added here, 
+   # and ${CXXFLAG64} added at the right point in the Makefile for 64-bit builds. 
+   export CXXFLAG64
 fi
 
 # If SAGE_DEBUG is set either unset (the default), or set to  'yes'
@@ -45,9 +66,9 @@
 # Since both the Sun and GNU compilers accept -g to give debugging information
 # there is no need to do anything specific to one compiler or the other.
 
-if [ "x$SAGE_DEBUG" = "x" ] || [ "x$SAGE_DEBUG" = "xyes" ] ; then
+if [ "x$SAGE_DEBUG" = xyes ] ; then
    echo "Code will be built with debugging information present. Set 'SAGE_DEBUG' to 'no' if you don't want that."
-   # Actually anything othe than 'yes' or '1' will cause 
+   # Actually anything othe than 'yes' will cause 
    # no debugging information to be added.
    CFLAGS="$CFLAGS -g "
    CXXFLAGS="$CXXFLAGS -g "
@@ -130,6 +151,8 @@
 
 # Flags which may be set. 
 echo "The following environment variables will be exported"
+echo "Using CFLAG64=$CFLAG64"
+echo "Using CXXFLAG64=$CXXFLAG64"
 echo "Using CFLAGS=$CFLAGS"
 echo "Using CXXFLAGS=$CXXFLAGS"
 echo "Using FCFLAGS=$FCFLAGS"
