[arch-commits] Commit in lcalc/trunk (4 files)

Antonio Rojas arojas at archlinux.org
Mon Jan 5 11:59:53 UTC 2015


    Date: Monday, January 5, 2015 @ 12:59:52
  Author: arojas
Revision: 125405

Fix memory issues when calling PARI

Added:
  lcalc/trunk/init_stack.patch
Modified:
  lcalc/trunk/Lcommon.h.patch
  lcalc/trunk/PKGBUILD
  lcalc/trunk/pari-2.7.patch

------------------+
 Lcommon.h.patch  |   24 ++++++++++++++++++------
 PKGBUILD         |   19 ++++++++++---------
 init_stack.patch |   31 +++++++++++++++++++++++++++++++
 pari-2.7.patch   |   11 -----------
 4 files changed, 59 insertions(+), 26 deletions(-)

Modified: Lcommon.h.patch
===================================================================
--- Lcommon.h.patch	2015-01-05 10:45:13 UTC (rev 125404)
+++ Lcommon.h.patch	2015-01-05 11:59:52 UTC (rev 125405)
@@ -1,11 +1,23 @@
---- src/include/Lcommon.h	2010-01-31 15:16:45.000000000 +0000
-+++ src/include/Lcommon.h	2011-03-08 21:19:11.849443238 +0000
-@@ -25,7 +25,7 @@
+--- L-1.23/include/Lcommon.h.orig	2011-04-09 04:09:25.984121006 -0300
++++ L-1.23/include/Lcommon.h	2011-04-09 04:09:58.750265003 -0300
+@@ -25,6 +25,8 @@ inline double lcalc_to_double(const Doub
  #ifdef USE_MPFR
  inline double lcalc_to_double(const double& x) { return x; }
  #endif
--//inline double lcalc_to_double(const long double& x) { return x; }
-+inline double lcalc_to_double(const long double& x) { return x; }
++
++#if 0
+ //inline double lcalc_to_double(const long double& x) { return x; }
  inline double lcalc_to_double(const int& x) { return x; }
  inline double lcalc_to_double(const long long& x) { return x; }
- inline double lcalc_to_double(const short& x) { return x; }
+@@ -33,6 +35,10 @@ inline double lcalc_to_double(const char
+ inline double lcalc_to_double(const long int& x) { return x; }
+ inline double lcalc_to_double(const unsigned int& x) { return x; }
+ inline double lcalc_to_double(const long unsigned int& x) { return x; }
++#else
++#  define lcalc_to_double(x)	((double)(x))
++#endif
++
+ #define Int(x) (int)(lcalc_to_double(x))
+ #define Long(x) (Long)(lcalc_to_double(x))
+ #define double(x) (double)(lcalc_to_double(x))
+ 
\ No newline at end of file

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2015-01-05 10:45:13 UTC (rev 125404)
+++ PKGBUILD	2015-01-05 11:59:52 UTC (rev 125405)
@@ -2,7 +2,7 @@
 
 pkgname=lcalc
 pkgver=1.23
-pkgrel=3
+pkgrel=4
 pkgdesc="C++ L-function class library and command line interface"
 arch=('i686' 'x86_64')
 url="http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/L.html"
@@ -9,26 +9,27 @@
 license=('GPL2')
 depends=('pari')
 makedepends=('chrpath')
-source=("http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/CODE/L-$pkgver.tar.gz" 'Lcommon.h.patch' 'gcc-4.9.patch' 'pari-2.7.patch')
+source=("http://oto.math.uwaterloo.ca/~mrubinst/L_function_public/CODE/L-$pkgver.tar.gz" 'Lcommon.h.patch' 'gcc-4.9.patch' 'pari-2.7.patch' 
+'init_stack.patch')
 md5sums=('8262d4495e0bbe0283e5341ef8694c23'
-         '717f630a387fb1a4569e843a421f30cc'
+         '8af1dd6d3118bb785f193283a31305a2'
          '436dd35b06766dffad0941bcfb511e89'
-         '5b1937955ca9ceb5d635e57af2364ed2')
+         '9829d36d0c68e37f2692f44cbb6df535'
+         'c1de0b9cdfa9991e980c34092a43dddf')
 
 prepare() {
   cd L-$pkgver
   patch -p1 -i "$srcdir"/Lcommon.h.patch  
   patch -p1 -i "$srcdir"/gcc-4.9.patch
+# Use pari_init_stack() instead of old allocatemoremem()
+  patch -p1 -i "$srcdir"/init_stack.patch
 # port to PARI 2.7 API
   patch -p1 -i "$srcdir"/pari-2.7.patch
-# link to PARI
-  sed -e 's|#PARI_DEFINE = -DINCLUDE_PARI|PARI_DEFINE = -DINCLUDE_PARI|' -i src/Makefile
-  sed -e 's|#include "pari.h"|#include "pari/pari.h"|' -i include/Lcommandline.h -i include/Lcommandline_elliptic.h
 }
 
 build() {
   cd L-$pkgver/src
-  make
+  make PARI_DEFINE="-DINCLUDE_PARI" LOCATION_PARI_H="/usr/include/pari"	LOCATION_PARI_LIBRARY="/usr/lib" all
 }
 
 package() {
@@ -37,7 +38,7 @@
   make INSTALL_DIR="$pkgdir"/usr install
 
 # remove leftover files
-  rm "$pkgdir"/usr/include/Lfunction/{Lexplicit_formula.h.swap.crap,.Lexplicit_formula.h.swp}
+  rm "$pkgdir"/usr/include/Lfunction/{Lexplicit_formula.h.swap.crap,.*.swp,.DS*}
 # fix wrong permissions
   chmod 644 "$pkgdir"/usr/include/Lfunction/Ldokchitser.h
 # fix insecure rpath

Added: init_stack.patch
===================================================================
--- init_stack.patch	                        (rev 0)
+++ init_stack.patch	2015-01-05 11:59:52 UTC (rev 125405)
@@ -0,0 +1,31 @@
+diff -ru src/include/Lcommandline.h b/include/Lcommandline.h
+--- src/include/Lcommandline.h	2012-08-08 23:21:55.000000000 +0200
++++ b/include/Lcommandline.h	2014-01-06 14:04:55.981027532 +0100
+@@ -40,12 +40,7 @@
+ #include "Lcommandline_globals.h"      //command line global variables
+ #ifdef INCLUDE_PARI
+ #include "pari.h"          //for pari's elliptic curve functions
+-#undef init                //pari has a '#define init pari_init' which
+-                           //causes trouble with the stream.h init.
+-                           //pari also causes trouble with things like abs.
+-                           //we place the pari include first since otherwise it
+-                           //messes up.
+-
++#include "paripriv.h"      //for pari_init_stack()
+ #endif //ifdef INCLUDE_PARI
+ 
+ 
+diff -ru src/src/Lcommandline.cc b/src/Lcommandline.cc
+--- src/src/Lcommandline.cc	2012-08-08 23:21:56.000000000 +0200
++++ b/src/Lcommandline.cc	2014-01-06 14:02:19.463388366 +0100
+@@ -473,7 +473,9 @@
+ 
+ #ifdef INCLUDE_PARI
+         if(do_elliptic_curve){
+-             allocatemoremem((int) N_terms*16+1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double
++             // Reallocate PARI stack
++             pari_init_stack((size_t)N_terms*16 + 1000000, top-bot); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double
++
+              if (my_verbose>0) cout << "Will precompute " << N_terms << " elliptic L-function dirichlet coefficients..." << endl;
+              initialize_new_L(a1,a2,a3,a4,a6,N_terms); 
+         }

Modified: pari-2.7.patch
===================================================================
--- pari-2.7.patch	2015-01-05 10:45:13 UTC (rev 125404)
+++ pari-2.7.patch	2015-01-05 11:59:52 UTC (rev 125405)
@@ -4,17 +4,6 @@
 Bug-Debian: http://bugs.debian.org/635506
             http://bugs.debian.org/743327
 
---- a/src/Lcommandline.cc
-+++ b/src/Lcommandline.cc
-@@ -473,7 +473,7 @@
- 
- #ifdef INCLUDE_PARI
-         if(do_elliptic_curve){
--             allocatemoremem((int) N_terms*16+1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double
-+             allocatemem((int) N_terms*16+1000000); //XXXXXXXXX this should depend on whether we're double or long double or mpfr double
-              if (my_verbose>0) cout << "Will precompute " << N_terms << " elliptic L-function dirichlet coefficients..." << endl;
-              initialize_new_L(a1,a2,a3,a4,a6,N_terms); 
-         }
 --- a/src/Lcommandline_elliptic.cc
 +++ b/src/Lcommandline_elliptic.cc
 @@ -121,11 +121,11 @@



More information about the arch-commits mailing list