Ticket #9860: trac_9860-pari-2.4.3.svn-12577.p4-p5.spkg.patch
| File trac_9860-pari-2.4.3.svn-12577.p4-p5.spkg.patch, 35.0 KB (added by leif, 21 months ago) |
|---|
-
SPKG.txt
# HG changeset patch # User Leif Leonhardy <not.really@online.de> # Date 1283773823 -7200 # Node ID d4c104308548c136e069b35759820ce527f41ca6 # Parent 2d46a19aa9f4a949327cc743c4658c675d078352 #9860: Ported changes from PARI 2.3.5.p4 (#9722) to 2.4.3; some further improvements. === pari-2.4.3.svn-12577.p5 (Leif Leonhardy, September 5th, 2010) === * Added patches to: - config/get_config_options: * Make invalid arguments to "--graphic" a "Configure" error (rather than potentially running into *compilation* errors later). - config/get_fltk: (see also/ported from #9722) * Add libstdc++ to the libraries (to support Fedora 13 et al.). * Also check the presence of the FLTK include directory to prevent compilation errors on broken installations. - config/get_X11: (see also/ported from #9722) * Also search */lib64/* directories when doing a 64-bit build. * Give more specific messages. * Slightly extended existing patch to src/kernel/gmp/mp.c: - Allow disabling PARI's use of "GMP internals" by preprocessor directive (i.e. by adding "-DPARI_DONT_USE_GMP_INTERNALS" to CFLAGS). Brief explanation added. * spkg-install: - Don't override user-specified CFLAGS (w.r.t. optimization, unless SAGE_DEBUG=yes). - Handle PARI_EXTRA_OPTS properly, and print informative messages (regarding graphics support for plotting). - Recognize SAGE_TUNE_PARI in addition to SAGE_TUNE_pari, and add "--tune" to PARI_EXTRA_OPTS if self-tuning was requested. - Clear/unset lots of (environment) variables used by PARI that might unintentionally get their values from user settings. - Quote *all* occurrences of SAGE_LOCAL (and some other expressions). - Use $UNAME instead of `uname` everywhere, use "elif ...". - *Always* use $MAKE (changed for "install-data"). - Begin all error messages with "Error". - Removed useless tests of $? at end. - Some clean-up (typos, formatting); some comments, some messages added. * spkg-check: - Use $MAKE instead of "make". - Don't override user-specified CFLAGS (w.r.t. optimization, unless SAGE_DEBUG=yes). - Begin error message with "Error". - Some clean-up. * Slight corrections to SPKG.txt. * Updated patches/README.txt, some cosmetic changes. diff -r 2d46a19aa9f4 -r d4c104308548 SPKG.txta b 18 18 19 19 == License == 20 20 21 GPL 21 GPL version 2+ 22 22 23 23 == SPKG Maintainers == 24 24 * Robert Bradshaw … … 36 36 * Readline 37 37 * Termcap 38 38 39 == Build Notes ==39 == Special Update/Build Instructions == 40 40 41 41 Most of the building of a new version of the PARI spkg is automated 42 42 in the script spkg-make. Normally, the following should work. In case … … 71 71 72 72 Note from David Kirkby that could be relevant to building on Solaris: 73 73 74 Since pariis using -xarch=native, which implies -xarch=v8plusa on my74 Since PARI is using -xarch=native, which implies -xarch=v8plusa on my 75 75 box, but I set -xarch=v8plus (without the last a), this probably means 76 76 there will be different types of object files and so they may not link 77 77 together. Ick. Feel free to tell me how to modify the configure 78 78 script. 79 79 80 80 I got around it by setting CFLAGS -xarch=v8plus myself, so they were 81 all the same. But it is not right. I have not looked at parito see81 all the same. But it is not right. I have not looked at PARI to see 82 82 exactly where it says native, but I would expect a grep to find it. 83 83 84 84 == Changelog == 85 85 86 === pari-2.4.3.svn-12577.p5 (Leif Leonhardy, September 5th, 2010) === 87 * Added patches to: 88 - config/get_config_options: 89 * Make invalid arguments to "--graphic" a "Configure" error 90 (rather than potentially running into *compilation* errors 91 later). 92 - config/get_fltk: (see also/ported from #9722) 93 * Add libstdc++ to the libraries (to support Fedora 13 et al.). 94 * Also check the presence of the FLTK include directory to 95 prevent compilation errors on broken installations. 96 - config/get_X11: (see also/ported from #9722) 97 * Also search */lib64/* directories when doing a 64-bit build. 98 * Give more specific messages. 99 * Slightly extended existing patch to src/kernel/gmp/mp.c: 100 - Allow disabling PARI's use of "GMP internals" by preprocessor 101 directive (i.e. by adding "-DPARI_DONT_USE_GMP_INTERNALS" to 102 CFLAGS). Brief explanation added. 103 * spkg-install: 104 - Don't override user-specified CFLAGS (w.r.t. optimization, unless 105 SAGE_DEBUG=yes). 106 - Handle PARI_EXTRA_OPTS properly, and print informative messages 107 (regarding graphics support for plotting). 108 - Recognize SAGE_TUNE_PARI in addition to SAGE_TUNE_pari, and 109 add "--tune" to PARI_EXTRA_OPTS if self-tuning was requested. 110 - Clear/unset lots of (environment) variables used by PARI that might 111 unintentionally get their values from user settings. 112 - Quote *all* occurrences of SAGE_LOCAL (and some other expressions). 113 - Use $UNAME instead of `uname` everywhere, use "elif ...". 114 - *Always* use $MAKE (changed for "install-data"). 115 - Begin all error messages with "Error". 116 - Removed useless tests of $? at end. 117 - Some clean-up (typos, formatting); some comments, some messages added. 118 * spkg-check: 119 - Use $MAKE instead of "make". 120 - Don't override user-specified CFLAGS (w.r.t. optimization, unless 121 SAGE_DEBUG=yes). 122 - Begin error message with "Error". 123 - Some clean-up. 124 * Slight corrections to SPKG.txt. 125 * Updated patches/README.txt, some cosmetic changes. 126 86 127 === pari-2.4.3.svn-12577.p4 (Jeroen Demeyer, August 22, 2010) === 87 128 * Change "test -e" to "test -f" for Solaris. 88 129 * Configure using "#!/usr/bin/env bash" instead of "#!/bin/sh" -
patches/README.txt
diff -r 2d46a19aa9f4 -r d4c104308548 patches/README.txt
a b 1 1 Details of which source files are patched in spkg-install, and why. 2 2 See below for information on files which used to be patched but are no 3 longer (do not delete that!)3 longer, or are still but now for a different reason. (Do not delete that!) 4 4 5 5 ====================================================================== 6 Files patched as of pari-2.4.3.svn-12577.p 4:6 Files patched as of pari-2.4.3.svn-12577.p5: 7 7 ====================================================================== 8 8 9 9 Configuration files: 10 * Configure: use "#!/usr/bin/env bash" instead of "#!/bin/sh"11 * config/get_ld: cwitty: disable -rpath12 * config/get_tests: John Cremona: disable testing of ellglobalred in10 * Configure: Use "#!/usr/bin/env bash" instead of "#!/bin/sh". 11 * config/get_ld: cwitty: Disable -rpath. 12 * config/get_tests: John Cremona: Disable testing of ellglobalred in 13 13 "make test-all" in spkg-check, since it requires 14 14 the elldata database which we do not include. 15 15 * config/get_dlcflags: Add -fno-common to DLCFLAGS on Darwin. 16 16 * config/Makefile.SH: Change "test -e" to "test -f" for Solaris. 17 * config/get_config_options: Catch invalid arguments tp "--graphic". 18 * config/get_fltk; Add libstdc++; check presence of FLTK headers, too. 19 * config/get_X11: Search X11 library in */lib64/*, too (not just */lib/*). 17 20 18 21 Documentation: 19 * doc/gphelp.in: cwitty: disable TeX; allow bz2 compression22 * doc/gphelp.in: cwitty: Disable TeX; allow bz2 compression. 20 23 21 24 Header files: 22 * src/headers/paripriv.h: * after* building, on {OS X, SunOS, SYGWIN},23 rename "ECHO" 25 * src/headers/paripriv.h: *After* building, on {OS X, SunOS, CYGWIN}, 26 rename "ECHO". 24 27 25 28 C files: 26 * src/kernel/gmp/mp.c: needed so that Sage can catch pari's error signals. 27 * src/language/init.c: needed so that Sage can catch pari's error signals. 28 * src/basemath/base2.c and src/basemath/polarit3.c: fix PARI bug 1079. 29 * src/kernel/gmp/mp.c: Needed so that Sage can catch PARI's error signals. 30 Also allow disabling use of "GMP internals". 31 * src/language/init.c: Needed so that Sage can catch PARI's error signals. 32 * src/basemath/base2.c and src/basemath/polarit3.c: Fix PARI bug 1079. 29 33 30 34 ====================================================================== 31 35 Files previously patched: 32 36 ====================================================================== 33 37 34 * config/get_cc: on SunOS only, add "-fPIC" to compiler flags (David Kirkby)38 * config/get_cc: On SunOS only, add "-fPIC" to compiler flags (David Kirkby) 35 39 This happens not with a patch file, but with a sed command in 36 40 spkg-install. Now fixed upstream (-fPIC added on all platforms). 37 41 38 * config/get_dlcflags: mabshoff: To get around problem in PPC 32-bit42 * config/get_dlcflags: mabshoff: To get around problem in PPC 32-bit 39 43 Linux build. Now fixed upstream (-fPIC added on all platforms). 44 NB: We still patch this file, but for a slightly different reason. 40 45 41 * config/get_kernel: pjeremy: fix for FreeBSD: #7825. Supposedly fixed46 * config/get_kernel: pjeremy: Fix for FreeBSD: #7825. Supposedly fixed 42 47 upstream. 43 48 44 49 * config/get_dlld: Undocumented patch for Darwin. Removed to see what 45 50 happens... 46 51 52 * config/get_cc: Changed OPTFLAG from "-O3" to "-O1" on Linux because of 53 problems on Fedora 11 (32-bit) with one gcc version (ticket #7092). 47 54 48 * config/get_cc: changed OPTFLAG from "-O3" to "-O1" on Linux because of 49 problems on Fedora 11 (32-bit) with one gcc version (ticket #7092). 55 # Minh Van Nguyen: copy over patched get_cc (see ticket #7092). It's 56 # reported that 32-bit Fedora 11 would fail to build otherwise. 57 if [ `uname` = "Linux" ]; then 58 cp "$TOP"/patches/get_cc config/get_cc 59 fi 50 60 51 # Minh Van Nguyen: copy over patched get_cc (see ticket #7092). It's 52 # reported that 32-bit Fedora 11 would fail to build otherwise. 53 if [ `uname` = "Linux" ]; then 54 cp "$TOP"/patches/get_cc config/get_cc 55 fi 56 57 * src/headers/paridecl.h: used to need a dummy variable changed from B0 61 * src/headers/paridecl.h: Used to need a dummy variable changed from B0 58 62 to N; now fixed upstream. 59 * src/headers/paripriv.h: used to need a dummy variable changed from B060 to N; now fixed upstream. NB There's another patch on this file still63 * src/headers/paripriv.h: Used to need a dummy variable changed from B0 64 to N; now fixed upstream. NB: There's another patch on this file still 61 65 in place! 62 66 -
new file patches/get_X11.patch
diff -r 2d46a19aa9f4 -r d4c104308548 patches/get_X11.patch
- + 1 --- config/get_X11 2010-08-22 21:25:54.000000000 +0200 2 +++ config/get_X11 2010-09-06 11:05:14.000000000 +0200 3 @@ -28,20 +28,44 @@ 4 pth=`echo $x11pth | sed 's,/lib,/include,g'` 5 x=`./locate X11/Xos.h '' $pth` 6 case $x in 7 - /*) Xincroot=`echo $x | sed 's,/X11/Xos.h,,'`;; 8 - *) Xincroot=;; 9 + /*) Xincroot=`echo $x | sed 's,/X11/Xos.h,,'` 10 + # echo "...Found X11 header files in \"$Xincroot/X11\"." 11 + ;; 12 + *) Xincroot="" 13 + echo "### Could not find X11 header files." 14 + ;; 15 esac 16 fi 17 + 18 # X11 -- Lib 19 -pth=$x11pth 20 -lib=X11; . ./locatelib 21 +# leif: ALSO search */lib64/* directories if we're doing a 64-bit build, 22 +# and do this FIRST (since we might find a 32-bit library in */lib/*). 23 +# E.g. on 64-bit Fedora 13, libX11.so is located in /usr/lib64, and 24 +# /usr/lib is NOT a symbolic link to /usr/lib64. 25 +# This still fails if ONLY a 32-bit X11 library is installed on a 26 +# 64-bit system, and the */lib/* directories aren't the 64-bit ones. 27 +if test "$sizeof_long" -eq 8; then 28 + # 64-bit build 29 + pth=`echo $x11pth | sed 's,/lib,/lib64,g'` 30 + lib=X11; . ./locatelib 31 +fi 32 +if test -z "$X11"; then 33 + # X11 library not yet found, search */lib/* directories 34 + pth=$x11pth 35 + lib=X11; . ./locatelib 36 +fi 37 +if test -z "$X11"; then 38 + echo "### Could not find X11 library." 39 +fi 40 + 41 if test -f $Xincroot/X11/Xos.h -a -n "$X11"; then 42 echo ..."Found X11 header files in $Xincroot/X11" 43 + echo ..."Found X11 library in $X11" 44 test -n "$extralib" && echo ..."Extra Libraries are $extralib" 45 X11_LIBS="-L$X11 -lX11 $extralib" 46 X11_INC="-I$Xincroot" 47 else 48 - echo "### X11 not found" 49 + echo "### Not all necessary parts of X11 found." 50 X11= 51 fi 52 -
new file patches/get_config_options.patch
diff -r 2d46a19aa9f4 -r d4c104308548 patches/get_config_options.patch
- + 1 --- config/get_config_options 2010-08-22 21:25:54.000000000 +0200 2 +++ config/get_config_options 2010-08-31 05:18:55.000000000 +0200 3 @@ -58,9 +58,20 @@ 4 -h|-help|--help|-\?)error=true;; 5 -v|-verbhelp|--verbhelp)error=verb;; 6 -s|--static) static=y;; 7 - -graphic|--graphic) shift; which_graphic_lib=$1;; 8 + -graphic|--graphic) 9 + shift; which_graphic_lib="$1" 10 + case "$which_graphic_lib" in 11 + auto|none|X11|qt|Qt|fltk|win32) ;; 12 + *) echo "*** Unrecognized graphic lib \"$which_graphic_lib.\"" >&2 13 + error=true;; 14 + esac;; 15 --graphic=*|--graphi=*|--graph=*|--grap=*|--gra=*|--gr=*|--g=*) 16 - which_graphic_lib=`echo "$1" | sed -e 's/[-a-z]*=//'`;; 17 + which_graphic_lib=`echo "$1" | sed -e 's/[-a-z]*=//'` 18 + case "$which_graphic_lib" in 19 + auto|none|X11|qt|Qt|fltk|win32) ;; 20 + *) echo "*** Unrecognized graphic lib \"$which_graphic_lib.\"" >&2 21 + error=true;; 22 + esac;; 23 24 --without-readline|--with-readline=no) without_readline=yes ;; 25 --with-readline) with_readline=yes ;; 26 @@ -126,7 +137,7 @@ 27 Build Options: 28 --host=<arch-osname> target achitecture 29 --kernel=<kern> kernel used 30 - --graphic=<gr> graphic library used (none X11 Qt fltk win32) 31 + --graphic=<gr> graphic library used (none X11 qt Qt fltk win32 auto) 32 --time=<fun> timing function to use (getrusage times ftime) 33 --builddir=<dir> directory where the object files will be created 34 --tune tune the binary for compiling host (slow) -
new file patches/get_fltk.patch
diff -r 2d46a19aa9f4 -r d4c104308548 patches/get_fltk.patch
- + 1 --- config/get_fltk 2010-08-22 21:26:01.000000000 +0200 2 +++ config/get_fltk 2010-09-06 10:23:09.000000000 +0200 3 @@ -10,19 +10,25 @@ 4 fi 5 ;; 6 *) if test ! -d "$with_fltk"; then 7 - echo "### FLTK directory '$with_fltk' not found" 8 + echo "### Specified FLTK directory '$with_fltk' not found" 9 else 10 FLTKDIR=$with_fltk 11 fi;; 12 esac 13 if test -n "$FLTKDIR"; then 14 case "$FLTKDIR" in /) FLTKDIR=;; esac 15 - echo "Using FLTK library, FLTKDIR = $FLTKDIR" 16 + if test -d "$FLTKDIR/include/FL"; then 17 + echo "Using FLTK library, FLTKDIR = \"$FLTKDIR\"" 18 + else 19 + echo "### Found the FLTK library, but not the necessary headers." 20 + echo "### Building without FLTK support." 21 + FLTKDIR="" 22 + fi 23 else 24 echo "### FLTK not found. Building without FLTK support" 25 fi 26 case "$osname" in 27 cygwin) FLTK_LIBS="-lgdi32 -lole32 -luuid -lwsock32 -lsupc++" ;; 28 darwin) FLTK_LIBS="-framework Carbon -lsupc++" ;; 29 - *) FLTK_LIBS="$X11_LIBS" ;; 30 + *) FLTK_LIBS="$X11_LIBS -lstdc++" ;; 31 esac -
patches/mp.c.patch
diff -r 2d46a19aa9f4 -r d4c104308548 patches/mp.c.patch
a b 1 --- src/kernel/gmp/mp.c (revision 12541)2 +++ src/kernel/gmp/mp.c (working copy)1 --- src/kernel/gmp/mp.c 2010-08-22 21:25:46.000000000 +0200 2 +++ src/kernel/gmp/mp.c 2010-09-06 00:34:54.000000000 +0200 3 3 @@ -56,7 +56,9 @@ 4 4 int pari_kernel_init(void) 5 5 { … … 10 10 return 0; 11 11 } 12 12 13 @@ -949,7 +951,16 @@ 14 15 /* EXACT INTEGER DIVISION */ 16 17 -#if 1 /* use undocumented GMP interface */ 18 +#ifndef PARI_DONT_USE_GMP_INTERNALS /* use "undocumented" GMP interface: */ 19 +/* 20 + * Note: "Undocumented" refers to directly accessing ("private") members 21 + * of GMP's mpz_t / __mpz_struct types, which are defined in gmp.h. 22 + * This is in fact (at least) compatible with both 23 + * - GMP (<= 5.0.1) *and* 24 + * - MPIR (<= 2.1.2), 25 + * so we *don't* disable the use by default. 26 + */ 27 + 28 static void 29 GEN2mpz(mpz_t X, GEN x) 30 { 31 @@ -1008,7 +1019,7 @@ 32 mpz2GEN(z, Z); return z; 33 } 34 } 35 -#else 36 +#else /* don't use "undocumented" GMP interface: */ 37 /* assume y != 0 and the division is exact */ 38 GEN 39 diviuexact(GEN x, ulong y) -
spkg-check
diff -r 2d46a19aa9f4 -r d4c104308548 spkg-check
a b 1 1 #!/usr/bin/env bash 2 ########################################### 3 ## PARI 4 ########################################### 5 2 6 if [ -z "$SAGE_LOCAL" ]; then 3 echo "SAGE_LOCAL undefined ... exiting";4 echo "Maybe run 'sage -sh'?"5 exit 17 echo "SAGE_LOCAL undefined ... exiting" 8 echo "Maybe run 'sage -sh'?" 9 exit 1 6 10 fi 7 11 8 # Let the user cho se a flag other than -m64 for 64-bit builds9 # if needed .10 if [ -z "$CFLAG64" ] ; then11 CFLAG64=-m6412 # Let the user choose a flag other than -m64 for 64-bit builds 13 # if needed: 14 if [ -z "$CFLAG64" ]; then 15 CFLAG64=-m64 12 16 fi 13 17 14 18 if [ "x$SAGE64" = xyes ]; then 15 CFLAGS="$CFLAGS $CFLAG64" 19 CFLAGS="$CFLAGS $CFLAG64" 16 20 CC="$CC $CFLAG64" && export CC 17 21 fi 18 22 19 23 if [ "x$SAGE_DEBUG" = xyes ] ; then 20 CFLAGS="$CFLAGS -O0 -g" # No optimisation. Good for debugging or working around compiler bugs. 24 CFLAGS="$CFLAGS -O0 -g" # Disable optimisation, add debug symbols. Good 25 # for debugging or working around compiler bugs. 21 26 else 22 CFLAGS="$CFLAGS -O3 -g" # Default optimisation. 27 CFLAGS="-O3 -g $CFLAGS" # Default optimisation, with debug symbols. 28 # Prepend to not override user's setting. 23 29 fi 24 30 25 31 export CFLAGS 26 32 27 cd src 33 cd src 28 34 29 maketest-all35 $MAKE test-all 30 36 31 if [ $? -ne 0 ] ; then32 echo "Pari failed the self-tests when running 'maketest-all'"33 exit 137 if [ $? -ne 0 ]; then 38 echo "Error: PARI failed the self-tests when running '$MAKE test-all'" 39 exit 1 34 40 fi 35 41 36 if [ -d ../parisvn ] ; then37 echo "WARNING: you should delete the parisvn directory before submitting this spkg."42 if [ -d ../parisvn ]; then 43 echo "WARNING: You should delete the parisvn directory before submitting this spkg." 38 44 fi 39 45 40 echo "The P ari self-tests all passed"41 exit 0 46 echo "The PARI self-tests all passed" 47 exit 0 42 48 -
spkg-install
diff -r 2d46a19aa9f4 -r d4c104308548 spkg-install
a b 4 4 ########################################### 5 5 6 6 if [ -z "$SAGE_LOCAL" ]; then 7 echo "SAGE_LOCAL undefined ... exiting";8 echo "Maybe run 'sage -sh'?"9 exit 17 echo "SAGE_LOCAL undefined ... exiting" 8 echo "Maybe run 'sage -sh'?" 9 exit 1 10 10 fi 11 11 12 12 TOP=`pwd` 13 13 PATCHED="$TOP/patches/files" 14 14 15 15 ########################################################### 16 ## patching src files. See patches/README.txt for details16 ## Patching src files. See patches/README.txt for details. 17 17 ########################################################### 18 18 19 19 cd src 20 20 21 # These two are needed so that Sage can catch PARI's error signals. 21 # These two are needed so that Sage can catch PARI's error signals. 22 # In addition, let PARI use "GMP internals" (access members of GMP 23 # structures directly) *conditionally*. (We *don't* disable that by 24 # default, since at least currently this is compatible with both GMP 25 # *and* MPIR. To disable the use, add "-DPARI_DONT_USE_GMP_INTERNALS" 26 # to CFLAGS. This is a trivial patch to mp.c only; see also the comment 27 # there.): 22 28 cp "$PATCHED/init.c" src/language/init.c 23 cp "$PATCHED/mp.c" src/kernel/gmp/mp.c 29 cp "$PATCHED/mp.c" src/kernel/gmp/mp.c 24 30 25 # Fix for PARI bug 1079 (jdemeyer: temporary until this is fixed upstream) 31 # Fix for PARI bug 1079 (jdemeyer: temporary until this is fixed upstream): 26 32 cp "$PATCHED/base2.c" "$PATCHED/polarit3.c" src/basemath/ 27 33 28 29 # cwitty: disable -rpath 34 # cwitty: Disable -rpath: 30 35 cp "$PATCHED/get_ld" config/ 31 36 32 # cwitty: disable TeX; allow bz2 compression37 # cwitty: Disable TeX; allow bz2 compression: 33 38 cp "$PATCHED/gphelp.in" doc/ 34 39 35 # John Cremona: copy over a lightly patched get_tests, so thatmake36 # test-all does not test ellglobalred (which requires the elldata37 # package Sage does not install ).40 # John Cremona: Copy over a lightly patched get_tests, so that "make 41 # test-all" does not test ellglobalred (which requires the elldata 42 # package Sage does not install, nor ship, since it is about 14 MB): 38 43 cp "$PATCHED/get_tests" config/ 39 44 40 # Add -fno-common to DLCFLAGS on Darwin 45 # Add -fno-common to DLCFLAGS on Darwin (for Mac OS X 10.4, "Tiger"): 41 46 cp "$PATCHED/get_dlcflags" config/ 42 47 43 # Two configure patches for Solaris 48 # Two configure patches for Solaris: 44 49 cp "$PATCHED/Configure" . 45 50 cp "$PATCHED/Makefile.SH" config/ 46 51 52 # leif: Catch invalid arguments to "--graphic" (and treat such as an error) 53 # since otherwise strange compilation errors might occur (cf. #9722, too). 54 cp "$PATCHED/get_config_options" config/ 55 56 # leif: Explicitly link against libstdc++ when using FLTK (for plotting) to 57 # support Fedora 13, and do an extra check for the FLTK include dir (cf. #9722): 58 cp "$PATCHED/get_fltk" config/ 59 60 # leif: Also search */lib64/* for X11 libraries (since on some systems this 61 # is really a separate directory, i.e. neither a symbolic link to */lib/* nor 62 # the target of a symbolic link */lib/*; cf. #9722, too): 63 cp "$PATCHED/get_X11" config/ 64 47 65 48 66 # This is needed or there are weird locale problems involving rpath 49 # with building Sage .67 # with building Sage: 50 68 LC_ALL=C 51 69 export LC_ALL 52 70 LANG=C 53 71 export LANG 54 72 73 55 74 build() 56 75 { 57 # add the proper flags for 64-bit build mode on OS X and Open Solaris x6458 # Setting CFLAGS is not sufficient on Solaris since PARI 2.4.3, as this 59 # flag is not being used when the check for GMP and Readline are made60 # so the checks for them fail. One must redefine CC and export that. 76 # Add the proper flags for 64-bit build mode on OS X and OpenSolaris x64. 77 # Setting CFLAGS is not sufficient on Solaris since PARI 2.4.3, as this 78 # flag is not being used when the checks for GMP and Readline are made, 79 # so the checks for them fail. One must redefine CC and export that. 61 80 62 # Let the user cho se a flag other than -m64 for 64-bit builds63 # if needed .64 if [ -z "$CFLAG64" ] ; then65 CFLAG64=-m6481 # Let the user choose a flag other than "-m64" for 64-bit builds 82 # if needed: 83 if [ -z "$CFLAG64" ]; then 84 CFLAG64=-m64 66 85 fi 67 86 68 87 if [ "x$SAGE64" = xyes ]; then 69 CFLAGS="$CFLAGS $CFLAG64" 88 echo "Building a 64-bit version of PARI/GP" 89 CFLAGS="$CFLAGS $CFLAG64" 70 90 CC="$CC $CFLAG64" && export CC 71 91 fi 72 92 73 if [ "x$SAGE_DEBUG" = xyes ] ; then 74 CFLAGS="$CFLAGS -O0 -g" # No optimisation. Good for debugging or working around compiler bugs. 93 if [ "x$SAGE_DEBUG" = xyes ]; then 94 # Disable optimisation, add debug symbols. Good for debugging or 95 # working around compiler bugs: 96 CFLAGS="$CFLAGS -O0 -g" 75 97 else 76 CFLAGS="$CFLAGS -O3 -g" # Default optimisation. 77 fi 98 CFLAGS="-O3 -g $CFLAGS" # Default optimisation, with debug symbols. 99 # Prepend to not override user's setting. 100 fi 78 101 export CFLAGS 79 102 80 103 CUR=`pwd` … … 86 109 unset AR 87 110 unset AS 88 111 89 if [ "$PARI_EXTRA_OPTS" = "" ]; then 90 PARI_EXTRA_OPTS=" --graphic=none " 112 # Let the user pass extra parameters to PARI's "Configure", e.g. 113 # to specify desired graphics support (which is disabled by default): 114 if [ -z "$PARI_EXTRA_OPTS" ]; then 115 echo "============================================================" 116 echo "Configuring PARI/GP without graphics support (for plotting)." 117 echo "If you need it, pass the appropriate option(s) to PARI by" 118 echo "setting and exporting \$PARI_EXTRA_OPTS prior to building" 119 echo "Sage (or at least before you build/install the PARI spkg)," 120 echo "e.g. by typing at the shell prompt:" 121 echo " export PARI_EXTRA_OPTS=\"--graphic=auto\"" 122 echo "or" 123 echo " export PARI_EXTRA_OPTS=\"--with-fltk\"" 124 echo "Note that PARI doesn't treat it as an error if the requested" 125 echo "graphics library or the corresponding header files are not" 126 echo "found; it will then simply disable graphics support." 127 echo "Please consult the PARI documentation for further details." 128 echo "============================================================" 129 130 PARI_EXTRA_OPTS="--graphic=none" 131 else 132 echo "============================================================" 133 echo "Configuring PARI/GP with additional user-specified options:" 134 echo " PARI_EXTRA_OPTS=\"$PARI_EXTRA_OPTS\"" 135 136 # Do NOT add "--graphic=none" if the user provided one of these: 137 # "--with-fltk[=...]", "--with-qt[=...]" 138 # Comment by leif: This misbehavoir seems to have been fixed in 139 # PARI 2.4.3; the following doesn't hurt though: 140 if ! (echo "$PARI_EXTRA_OPTS" | egrep -- "--with-fltk|--with-qt") \ 141 >/dev/null; 142 then 143 echo "To avoid unexpected behavior, we prepend \"--graphic=none\":" 144 PARI_EXTRA_OPTS="--graphic=none $PARI_EXTRA_OPTS" 145 echo " \"$PARI_EXTRA_OPTS\"" 146 echo "(Disabling graphics can be overridden by user settings.)" 147 fi 148 echo "============================================================" 91 149 fi 92 150 93 # Allow the user to tune PARI - this is time-consuming, but some may want to do it. 94 # It is also very unreliable 95 if [ "x$SAGE_TUNE_pari" = xyes ] ; then 96 echo "" 97 echo "PARI will be tuned for your system since you set SAGE_TUNE_pari=\"yes\"." 98 echo "This can take a long time." 99 echo "WARNING: Tuning PARI is VERY unreliable. You may find your build" 100 echo "of PARI fails, or PARI does not work properly once built." 101 echo "" 102 ./Configure $PARI_EXTRA_OPTS --prefix=$SAGE_LOCAL --with-readline=$SAGE_LOCAL --with-gmp=$SAGE_LOCAL --kernel=gmp --graphic=none --tune 151 # Allow the user to enable PARI self-tuning. 152 # This is time-consuming, but some may want to do it. 153 # It is also very unreliable, and currently (svn 12577) completely 154 # broken on *many* systems. 155 # Comment by leif: Also, PARI's Configure calls "make" (instead of $MAKE) 156 # if we do tuning, so: 157 # TODO: Replace that in our patched version of Configure! 158 if [ "$SAGE_TUNE_pari" = yes -o "$SAGE_TUNE_PARI" = yes ]; then 159 echo "" 160 echo "PARI will be tuned for your system since you set SAGE_TUNE_pari=\"yes\"." 161 echo "This can take a long time." 162 echo "WARNING: Tuning PARI is currently VERY unreliable. You may find your" 163 echo "build of PARI fails, or PARI does not work properly once built." 164 echo "" 165 PARI_EXTRA_OPTS="$PARI_EXTRA_OPTS --tune" 103 166 else 104 echo "To minimize Sage build time and to ensure the best relieability, PARI"105 echo "will not be tuned for your system. Experience shows tuning is"106 echo "unreliable: see http://trac.sagemath.org/sage_trac/ticket/9343"107 echo "If you wish to test the tuning code, set the environment variable"108 echo "SAGE_TUNE_pari=yes by typing the following before building Sage (or at"109 echo "least before building PARI):"110 echo "SAGE_TUNE_pari=yes"111 echo "export SAGE_TUNE_pari"112 echo ""113 ./Configure $PARI_EXTRA_OPTS --prefix=$SAGE_LOCAL --with-readline=$SAGE_LOCAL --with-gmp=$SAGE_LOCAL --kernel=gmp --graphic=none167 echo "" 168 echo "To minimize Sage build time and to ensure the best reliability, PARI" 169 echo "will not be tuned for your system. Experience shows tuning is" 170 echo "unreliable: see http://trac.sagemath.org/sage_trac/ticket/9343" 171 echo "If you wish to test the tuning code, set the environment variable" 172 echo "SAGE_TUNE_pari=yes by typing the following before building Sage (or at" 173 echo "least before building/installing PARI):" 174 echo " SAGE_TUNE_pari=yes" 175 echo " export SAGE_TUNE_pari" 176 echo "" 114 177 fi 115 178 179 unset GP_INSTALL_PREFIX # we do not want this to be set by the user 180 181 # In addition, a lot of variables used (internally) by PARI might un- 182 # intentionally get their values from the "global" environment, so it's 183 # safer to clear them here (not further messing up PARI's scripts): 184 unset static tune timing_fun error 185 unset enable_tls 186 unset with_fltk with_qt 187 unset with_ncurses_lib 188 unset with_readline_include with_readline_lib without_readline 189 unset with_gmp_include with_gmp_lib without_gmp 190 unset dfltbindir dfltdatadir dfltemacsdir dfltincludedir 191 unset dfltlibdir dfltmandir dfltsysdatadir dfltobjdir 192 # The following get set because we pass the respective parameters: 193 # prefix kernel with_gmp with_readline 194 195 196 # Note that "--graphic=none" is (usually) added to PARI_EXTRA_OPTS: 197 ./Configure $PARI_EXTRA_OPTS --prefix="$SAGE_LOCAL" \ 198 --with-readline="$SAGE_LOCAL" --with-gmp="$SAGE_LOCAL" \ 199 --kernel=gmp 200 116 201 if [ $? -ne 0 ]; then 117 echo "E RROR - configure PARI with readline and gmpfailed."202 echo "Error: Configuring PARI with readline and GMP kernel failed." 118 203 exit 1 119 204 fi 120 205 121 206 if [ ! -f Makefile ]; then 122 echo " Unable to configure PARI."207 echo "Error: Unable to configure PARI: No Makefile generated!" 123 208 exit 1 124 209 fi 125 210 126 echo "Building and install PARI"211 echo "Building and installing PARI/GP..." 127 212 if [ "$UNAME" = "CYGWIN" ]; then 128 213 # There are weird bugs in PARI's build process on Windows XP 129 214 # under Cygwin. 130 215 # Passing in this extra flag gets around the bug. 131 $MAKE GMPINCLUDE= -I$SAGE_LOCAL/includeEXTRADLLDFLAGS=-lgmp gp216 $MAKE GMPINCLUDE="-I$SAGE_LOCAL/include" EXTRADLLDFLAGS=-lgmp gp 132 217 else 133 218 $MAKE gp 134 219 fi … … 140 225 141 226 cp -f gp "$SAGE_LOCAL/bin/" # avoid "make install" 142 227 143 # Install documentation source (compressed), for use by gphelp .228 # Install documentation source (compressed), for use by gphelp: 144 229 mkdir -p "$SAGE_LOCAL/share/pari/doc/" 145 230 cp -f doc/usersch*.tex "$SAGE_LOCAL/share/pari/doc/" 146 231 bzip2 -9 -f "$SAGE_LOCAL/share/pari/doc/"usersch*.tex 147 232 cp -f doc/translations "$SAGE_LOCAL/share/pari/doc/" 148 233 149 # And install gphelp .234 # And install gphelp: 150 235 cp -f doc/gphelp "$SAGE_LOCAL/bin/" 151 236 152 237 $MAKE install-lib-sta 153 238 154 239 if [ $? -ne 0 ]; then 155 echo "Error installing PARI static library"240 echo "Error installing PARI's static library" 156 241 exit 1 157 242 fi 158 243 159 244 # Instead of "make install" we do the following, to avoid building 160 245 # the PARI documentation (which requires latex; or more precisely, 161 # *hangs* under a default cygwin with latex, since some fonts are missing).162 cd `config/objdir`246 # *hangs* under a default Cygwin with latex, since some fonts are missing): 247 cd "`config/objdir`" 163 248 $MAKE install-include 164 249 165 250 if [ $? -ne 0 ]; then 166 echo "Error installing PARI include files"251 echo "Error installing PARI's include files" 167 252 exit 1 168 253 fi 169 254 170 cp -f libpari* $SAGE_LOCAL/lib/255 cp -f libpari* "$SAGE_LOCAL/lib/" 171 256 cd "$CUR" 172 257 173 # On C YGWIN,need the dll for PARI to be in the same258 # On Cygwin, we need the dll for PARI to be in the same 174 259 # directory as the gp binary, or it doesn't find it. 175 260 # Note that just using a symlink doesn't work. 176 if [ $UNAME= "CYGWIN" ]; then177 CUR= "`pwd`"261 if [ "$UNAME" = "CYGWIN" ]; then 262 CUR=`pwd` 178 263 cd "$SAGE_LOCAL"/bin/ 179 264 cp -f "$SAGE_LOCAL"/lib/*pari*.dll . 180 265 cd "$CUR" 181 266 fi 182 267 183 # The following is a hack to get the library installed correctly184 # on OS X.185 if [ $UNAME = "Darwin" ]; then186 echo " MAC OS X hack -- delete and reinstall libpari.a"268 if [ "$UNAME" = "Darwin" ]; then 269 # The following is a hack to get the library installed correctly 270 # on Mac OS X: 271 echo "Applying Mac OS X hack -- deleting and reinstalling libpari.a ..." 187 272 rm -f Odarwin-ppc/*lib* 188 273 $MAKE install-lib-sta 189 274 190 275 if [ $? -ne 0 ]; then 191 echo "Error Re-installing PARIstatic libraries (OS X trick)"276 echo "Error reinstalling PARI's static libraries (OS X trick)" 192 277 exit 1 193 278 fi 194 279 195 cd `config/objdir`280 cd "`config/objdir`" 196 281 cp -f libpari* "$SAGE_LOCAL"/lib 197 282 cd "$CUR" 198 283 199 284 # Also another patch since paripriv.h won't compile right on OS X 200 285 # when used by client Sage code. So we replace it by a slightly 201 # modified version. 286 # modified version: 287 echo "Patching include/pari/paripriv.h so it works on Mac OS X..." 202 288 cp -pf "$PATCHED/paripriv.h" "$SAGE_LOCAL/include/pari/paripriv.h" 203 fi 204 # Like on OS X (see above), the Sage library would not build 205 # without some changes. Though on Solaris the changes are much simpler than 206 # on OS X. 207 if [ `uname` = "SunOS" ]; then 208 set -e 209 echo "Patching include/pari/paripriv.h so it works on Solaris" 210 echo "The changes are much smaller than needed on OS X" 211 cp "$PATCHED/paripriv.h" $SAGE_LOCAL/include/pari/paripriv.h 212 set +e 289 290 elif [ "$UNAME" = "SunOS" ]; then 291 # Like on Mac OS X (see above), the Sage library would not build 292 # without some changes on Solaris, though the changes are much simpler: 293 echo "Patching include/pari/paripriv.h so it works on Solaris..." 294 cp -f "$PATCHED/paripriv.h" "$SAGE_LOCAL/include/pari/paripriv.h" 295 213 296 elif [ "$UNAME" = "CYGWIN" ]; then 214 # We need to the same thing on Cygwin that we have to do on Solaris 215 cp "$PATCHED/paripriv.h" $SAGE_LOCAL/include/pari/paripriv.h 297 # We need to the same thing on Cygwin that we have to do on Solaris 298 echo "Patching include/pari/paripriv.h so it works on Cygwin..." 299 cp -f "$PATCHED/paripriv.h" "$SAGE_LOCAL/include/pari/paripriv.h" 216 300 fi 217 301 218 echo "Installing extra Galois groups data. "219 makeinstall-data302 echo "Installing extra Galois groups data..." 303 $MAKE install-data 220 304 if [ $? -ne 0 ]; then 221 echo "Error installing extra galois groups data."305 echo "Error installing extra Galois groups data." 222 306 exit 1 223 307 fi 224 308 } 225 309 226 310 build 227 311 228 if [ $? -ne 0 ]; then 229 echo "Error building PARI." 312 # All (previous) errors are catched in build(), so we don't test $? here. 313 # Although we perhaps should also check success of the numerous copy commands 314 # inside build(). 315 316 if [ "$UNAME" = "Darwin" ]; then 317 pari_shlib="libpari.dylib" 318 else 319 pari_shlib="libpari.so" 320 fi 321 if [ ! -f "$SAGE_LOCAL/lib/$pari_shlib" ]; then 322 echo "Error: PARI's shared library $pari_shlib has not been installed!" 230 323 exit 1 231 324 fi 232 325 233 if [ $UNAME="Darwin" -a -f $SAGE_LOCAL/lib/libpari.dylib ]; then234 exit 0235 fi236 237 if [ -f $SAGE_LOCAL/lib/libpari.so ]; then238 exit 0239 fi240 241 if [ $? -ne 0 ]; then242 echo "Error building PARI."243 exit 1244 fi245
