[flint] New upstream release. Build against the system zn_poly instead of the included sources. Make sure th

Jerry James jjames at fedoraproject.org
Mon Jul 18 22:42:50 UTC 2011


commit 7dfc414e0f5b81b6937f76e5eeb66af8b50fc3c3
Author: Jerry James <loganjerry at gmail.com>
Date:   Mon Jul 18 16:41:54 2011 -0600

    New upstream release.
    Build against the system zn_poly instead of the included sources.
    Make sure there is no PIC code in the static archive.
    Link mpQS against the shared library instead of including the library.
    Fix build errors and scary warnings with gcc 4.6.
    Remove unnecessary spec file elements (BuildRoot, etc.).

 .gitignore                         |    2 +-
 flint-1.2.0-add-soname.diff        |   11 --
 flint-1.2.0-add-static-lib.diff    |    8 +-
 flint-1.6-redef.patch              |  159 +++++++++++++++++++++++++++
 flint-1.6-use-system-zn_poly.patch |  185 ++++++++++++++++++++++++++++++++
 flint-1.6-warning.patch            |  206 ++++++++++++++++++++++++++++++++++++
 flint.spec                         |   86 +++++++++++-----
 sources                            |    2 +-
 8 files changed, 617 insertions(+), 42 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index f1d4948..a26cf89 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-flint-1.5.2.tar.gz
+/flint-1.6.tgz
diff --git a/flint-1.2.0-add-static-lib.diff b/flint-1.2.0-add-static-lib.diff
index e49c347..3b75936 100644
--- a/flint-1.2.0-add-static-lib.diff
+++ b/flint-1.2.0-add-static-lib.diff
@@ -1,8 +1,8 @@
---- makefile
-+++ makefile	2010-06-26 03:52:55.663889174 +0200
-@@ -150,6 +150,9 @@
+--- makefile.orig	2010-12-23 20:45:11.000000000 -0700
++++ makefile	2011-07-18 14:25:12.977375864 -0600
+@@ -173,6 +173,9 @@
  libflint.so: $(FLINTOBJ)
- 	$(CC) -fPIC -shared -Wl,-soname,libflint.so.0 -o libflint.so.0 $(FLINTOBJ) $(LIBS)
+ 	$(CC) -fPIC -shared -o libflint.so $(FLINTOBJ) $(LIBS)
  
 +libflint.a: $(FLINTOBJ)
 +	$(AR) rcs libflint.a $(FLINTOBJ)
diff --git a/flint-1.6-redef.patch b/flint-1.6-redef.patch
new file mode 100644
index 0000000..77a37d7
--- /dev/null
+++ b/flint-1.6-redef.patch
@@ -0,0 +1,159 @@
+--- ./QS/mpQS.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./QS/mpQS.c	2011-07-18 15:21:13.948375904 -0600
+@@ -75,8 +75,7 @@
+    mpz_set_ui(X, 1);
+    mpz_set_ui(Y, 1);
+    
+-   unsigned long i;
+-   for (i = 0; i < ncols; i++)
++   for (unsigned long i = 0; i < ncols; i++)
+    {
+       if (get_null_entry(nullrows, i, l)) 
+       {
+@@ -93,8 +92,7 @@
+    }
+    mpz_mod(Y, Y, N);
+    
+-   unsigned long i;
+-   for (i = 0; i < num_primes; i++)
++   for (unsigned long i = 0; i < num_primes; i++)
+    {
+       if (prime_count[i]) 
+       {
+@@ -107,8 +105,7 @@
+    mpz_mod(X, X, N);
+    
+ #if TEST
+-   unsigned long i;
+-   for (i = 0; i < num_primes; i++)
++   for (unsigned long i = 0; i < num_primes; i++)
+    {
+       if ((prime_count[i] %2) != 0) printf("Error %ld, %ld, %ld\n", l, i, prime_count[i]);
+    }
+--- ./QS/mp_sieve.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./QS/mp_sieve.c	2011-07-18 15:20:30.950375902 -0600
+@@ -84,7 +84,7 @@
+    const unsigned long second_prime = FLINT_MIN(SECOND_PRIME, num_primes);
+    
+    unsigned long prime;
+-   for (prime = small_primes; prime < second_prime; prime++) 
++   for (unsigned long prime = small_primes; prime < second_prime; prime++) 
+    {
+       if (soln2[prime] == -1) continue;
+       
+@@ -112,8 +112,7 @@
+       }
+    }
+    
+-   unsigned long prime;
+-   for (prime = second_prime; prime < num_primes; prime++) 
++   for (unsigned long prime = second_prime; prime < num_primes; prime++) 
+    {
+       p = factor_base[prime].p;
+       size = sizes[prime];
+@@ -409,7 +408,6 @@
+ #endif
+    } else small[0] = 0;
+    
+-   unsigned long j;
+    for (j = 2; j < small_primes; j++) // pull out small primes
+    {
+       prime = factor_base[j].p;
+--- ./QS/mp_linear_algebra.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./QS/mp_linear_algebra.c	2011-07-18 15:20:30.951375906 -0600
+@@ -70,13 +70,11 @@
+    FILE * lprels = flint_fopen("lprels","w");
+    fclose(lprels);
+     
+-   unsigned long i;
+-   for (i = 0; i < buffer_size; i++) 
++   for (unsigned long i = 0; i < buffer_size; i++) 
+    {
+       mpz_init2(Y_arr[i], prec);
+    }
+-   unsigned long i;
+-   for (i = 0; i < qs_inf->num_primes + EXTRA_RELS + 1000; i++) 
++   for (unsigned long i = 0; i < qs_inf->num_primes + EXTRA_RELS + 1000; i++) 
+    {
+       matrix[i].weight = 0;
+    }
+@@ -94,20 +92,17 @@
+    mpz_t * Y_arr = la_inf->Y_arr;
+    const unsigned long buffer_size = 2*(qs_inf->num_primes + EXTRA_RELS + 500);
+    
+-   unsigned long i;
+-   for (i = 0; i < buffer_size; i++) 
++   for (unsigned long i = 0; i < buffer_size; i++) 
+    {
+       mpz_clear(Y_arr[i]);
+    }
+    
+-	unsigned long i;
+-	for (i = 0; i < la_inf->columns; i++) // Clear all used columns
++   for (unsigned long i = 0; i < la_inf->columns; i++) // Clear all used columns
+    {
+ 		free_col(matrix + i);
+    }
+    
+-   unsigned long i;
+-   for (i = 0; i < la_inf->num_unmerged; i++) // Clear all used columns
++   for (unsigned long i = 0; i < la_inf->num_unmerged; i++) // Clear all used columns
+    {
+       free_col(unmerged + i);
+    }
+@@ -188,8 +183,7 @@
+    long dups = 0;
+    int comp;
+    
+-   long i;
+-   for (i = columns + num_unmerged - 1L; i >= dups; i--) 
++   for (long i = columns + num_unmerged - 1L; i >= dups; i--) 
+    {
+       if (!columns) comp = -1;
+       else if (!num_unmerged) comp = 1;
+@@ -230,8 +224,7 @@
+    
+    if (dups)
+    {
+-      unsigned long i;
+-      for (i = 0; i < columns; i++)
++      for (unsigned long i = 0; i < columns; i++)
+       {
+          copy_col(matrix + i, matrix + i + dups);
+       }
+@@ -326,13 +319,11 @@
+       
+    unsigned long fac_num = 0; 
+    
+-   unsigned long i;
+-   for (i = 0; i < small_primes; i++)
++   for (unsigned long i = 0; i < small_primes; i++)
+    {
+        if (small[i]) add_factor(&rel_ptr, (unsigned long) small[i], (unsigned long) i);
+    }
+-   unsigned long i;
+-   for (i = 0; i < num_factors; i++)
++   for (unsigned long i = 0; i < num_factors; i++)
+    {
+        add_factor(&rel_ptr, (unsigned long) factor[i].exp, (unsigned long) factor[i].ind);
+    }
+@@ -376,8 +367,7 @@
+    unsigned long fac_num = 0; 
+    clear_col(unmerged + num_unmerged);
+    
+-   unsigned long i;
+-   for (i = 0; i < small_primes; i++)
++   for (unsigned long i = 0; i < small_primes; i++)
+    {
+        if (small[i] & 1) insert_col_entry(unmerged + num_unmerged, i);
+        if (small[i]) 
+@@ -387,8 +377,7 @@
+           fac_num++;
+        }
+    }
+-   unsigned long i;
+-   for (i = 0; i < num_factors; i++)
++   for (unsigned long i = 0; i < num_factors; i++)
+    {
+        if (factor[i].exp & 1) insert_col_entry(unmerged + num_unmerged, factor[i].ind);
+        curr_rel[2*fac_num + 1] = factor[i].ind;
diff --git a/flint-1.6-use-system-zn_poly.patch b/flint-1.6-use-system-zn_poly.patch
new file mode 100644
index 0000000..31b8413
--- /dev/null
+++ b/flint-1.6-use-system-zn_poly.patch
@@ -0,0 +1,185 @@
+--- ./fmpz.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./fmpz.c	2011-07-18 15:09:24.366375894 -0600
+@@ -37,7 +37,7 @@
+ #include "mpn_extras.h"
+ #include "F_mpn_mul-tuning.h"
+ #include "long_extras.h"
+-#include "zn_poly/src/zn_poly.h"
++#include <zn_poly/zn_poly.h>
+ 
+ #define SWAP_PTRS(x_dummy_p, y_dummy_p) \
+ do { \
+--- ./fmpz_poly.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./fmpz_poly.c	2011-07-18 15:09:24.371375895 -0600
+@@ -44,7 +44,7 @@
+ #include "ZmodF_poly.h"
+ #include "long_extras.h"
+ #include "zmod_poly.h"
+-#include "zn_poly/src/zn_poly.h"
++#include <zn_poly/zn_poly.h>
+ #include "F_mpz.h"
+ #include "F_mpz_poly.h"
+ 
+--- ./zmod_poly.h.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./zmod_poly.h	2011-07-18 15:09:24.373375895 -0600
+@@ -38,7 +38,7 @@
+ #include "memory-manager.h"
+ #include "mpn_extras.h"
+ #include "long_extras.h"
+-#include "zn_poly/src/zn_poly.h"
++#include <zn_poly/zn_poly.h>
+ 
+ #ifndef _ZMOD_POLY_H_
+ #define _ZMOD_POLY_H_
+--- ./F_mpz.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./F_mpz.c	2011-07-18 15:09:24.375375895 -0600
+@@ -40,7 +40,7 @@
+ #include "long_extras.h"
+ #include "F_mpz.h"
+ #include "mpz_extras.h"
+-#include "zn_poly/src/zn_poly.h"
++#include <zn_poly/zn_poly.h>
+ 
+ /*===============================================================================
+ 
+--- ./makefile.orig	2011-07-18 15:09:12.855375894 -0600
++++ ./makefile	2011-07-18 15:09:24.377375895 -0600
+@@ -20,9 +20,9 @@
+ 	CXX = g++
+ endif
+ 
+-LIBS = -L$(FLINT_GMP_LIB_DIR) $(FLINT_LINK_OPTIONS) -lmpfr -lmpir -lpthread -lm
++LIBS = -L$(FLINT_GMP_LIB_DIR) $(FLINT_LINK_OPTIONS) -lzn_poly -lmpfr -lgmp -lm
+ 
+-LIBS2 = -L$(FLINT_GMP_LIB_DIR) -L$(FLINT_NTL_LIB_DIR) $(FLINT_LINK_OPTIONS) -lntl -lmpfr -lmpir -lpthread -lm 
++LIBS2 = -L$(FLINT_GMP_LIB_DIR) -L$(FLINT_NTL_LIB_DIR) $(FLINT_LINK_OPTIONS) -lzn_poly -lmpfr -lgmp -lgomp -lm
+ 
+ ifndef FLINT_NTL_INCLUDE_DIR
+ 	INCS = -I$(FLINT_GMP_INCLUDE_DIR) -I$(FLINT_MPFR_INCLUDE_DIR) 
+@@ -36,11 +36,6 @@
+ RM = rm -f
+ 
+ HEADERS = \
+-	zn_poly/src/zn_poly.h \
+-	zn_poly/src/wide_arith.h \
+-	zn_poly/src/support.h \
+-	zn_poly/src/profiler.h \
+-	zn_poly/src/zn_poly_internal.h \
+ 	mpz_extras.h \
+ 	F_mpn_mul-tuning.h \
+ 	ZmodF.h \
+@@ -78,23 +73,6 @@
+ ####### library object files
+ 
+ FLINTOBJ = \
+-	zn_mod.o \
+-	misc.o \
+-	mul_ks.o \
+-	pack.o \
+-	mul.o \
+-	mulmid.o \
+-	mulmid_ks.o \
+-	ks_support.o \
+-	mpn_mulmid.o \
+-	nuss.o \
+-	pmf.o \
+-	pmfvec_fft.o \
+-	tuning.o \
+-	mul_fft.o \
+-	mul_fft_dft.o \
+-	array.o \
+-	invert.o \
+ 	mpn_extras.o \
+ 	mpz_extras.o \
+ 	memory-manager.o \
+@@ -176,59 +154,6 @@
+ libflint.a: $(FLINTOBJ)
+ 	$(AR) rcs libflint.a $(FLINTOBJ)
+ 
+-##### zn_poly object files
+-
+-zn_mod.o: zn_poly/src/zn_mod.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o zn_mod.o -c zn_poly/src/zn_mod.c
+-	
+-misc.o: zn_poly/src/misc.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o misc.o -c zn_poly/src/misc.c
+-
+-ks_support.o: zn_poly/src/ks_support.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o ks_support.o -c zn_poly/src/ks_support.c
+-
+-mul_ks.o: zn_poly/src/mul_ks.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o mul_ks.o -c zn_poly/src/mul_ks.c
+-
+-pack.o: zn_poly/src/pack.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o pack.o -c zn_poly/src/pack.c
+-
+-nuss.o: zn_poly/src/nuss.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o nuss.o -c zn_poly/src/nuss.c
+-
+-mul.o: zn_poly/src/mul.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o mul.o -c zn_poly/src/mul.c
+-
+-mulmid.o: zn_poly/src/mulmid.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o mulmid.o -c zn_poly/src/mulmid.c
+-
+-mpn_mulmid.o: zn_poly/src/mpn_mulmid.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o mpn_mulmid.o -c zn_poly/src/mpn_mulmid.c
+-
+-mulmid_ks.o: zn_poly/src/mulmid_ks.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o mulmid_ks.o -c zn_poly/src/mulmid_ks.c
+-
+-pmf.o: zn_poly/src/pmf.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o pmf.o -c zn_poly/src/pmf.c
+-
+-pmfvec_fft.o: zn_poly/src/pmfvec_fft.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o pmfvec_fft.o -c zn_poly/src/pmfvec_fft.c
+-
+-tuning.o: zn_poly/src/tuning.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o tuning.o -c zn_poly/src/tuning.c
+-
+-mul_fft.o: zn_poly/src/mul_fft.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o mul_fft.o -c zn_poly/src/mul_fft.c
+-
+-mul_fft_dft.o: zn_poly/src/mul_fft_dft.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o mul_fft_dft.o -c zn_poly/src/mul_fft_dft.c
+-
+-array.o: zn_poly/src/array.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o array.o -c zn_poly/src/array.c
+-
+-invert.o: zn_poly/src/invert.c $(HEADERS)
+-	$(CC) $(CFLAGS) -DNDEBUG -o invert.o -c zn_poly/src/invert.c
+-
+ ##### Object files
+ 
+ mpn_extras.o: mpn_extras.c $(HEADERS)
+@@ -647,7 +572,7 @@
+ 
+ ####### Integer multiplication timing
+ 
+-ZMULOBJ = zn_mod.o misc.o mul_ks.o pack.o mul.o mulmid.o mulmid_ks.o ks_support.o mpn_mulmid.o nuss.o pmf.o pmfvec_fft.o tuning.o mul_fft.o mul_fft_dft.o array.o invert.o zmod_mat.o zmod_poly.o memory-manager.o fmpz.o ZmodF_mul-tuning.o mpz_poly.o mpz_poly-tuning.o fmpz_poly.o ZmodF_poly.o mpz_extras.o profiler.o ZmodF_mul.o ZmodF.o mpn_extras.o F_mpz_mul-timing.o long_extras.o factor_base.o poly.o sieve.o linear_algebra.o block_lanczos.o
++ZMULOBJ = zmod_mat.o zmod_poly.o memory-manager.o fmpz.o ZmodF_mul-tuning.o mpz_poly.o mpz_poly-tuning.o fmpz_poly.o ZmodF_poly.o mpz_extras.o profiler.o ZmodF_mul.o ZmodF.o mpn_extras.o F_mpz_mul-timing.o long_extras.o factor_base.o poly.o sieve.o linear_algebra.o block_lanczos.o
+ 
+ F_mpz_mul-timing: $(FLINTOBJ) 
+ 	$(CC) $(CFLAGS) F_mpz_mul-timing.c profiler.o -o Zmul $(FLINTOBJ) $(LIBS)
+--- ./F_mpz.h.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./F_mpz.h	2011-07-18 15:09:24.378375895 -0600
+@@ -38,7 +38,7 @@
+ #endif
+ #include "flint.h"
+ #include "mpn_extras.h"
+-#include "zn_poly/src/zn_poly.h"
++#include <zn_poly/zn_poly.h>
+ 
+ 
+ /* 
+--- ./fmpz.h.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./fmpz.h	2011-07-18 15:09:24.379375895 -0600
+@@ -36,7 +36,7 @@
+ #include "memory-manager.h"
+ #include "flint.h"
+ #include "long_extras.h"
+-#include "zn_poly/src/zn_poly.h"
++#include <zn_poly/zn_poly.h>
+ 
+ typedef mp_limb_t * fmpz_t;
+ 
diff --git a/flint-1.6-warning.patch b/flint-1.6-warning.patch
new file mode 100644
index 0000000..691e47e
--- /dev/null
+++ b/flint-1.6-warning.patch
@@ -0,0 +1,206 @@
+--- ./fmpz.c.orig	2011-07-18 16:12:43.495375940 -0600
++++ ./fmpz.c	2011-07-18 16:12:53.376375939 -0600
+@@ -1239,7 +1239,7 @@
+    flint_heap_free(comb->mod);
+ }
+ 
+-unsigned long fmpz_multi_mod_ui_basecase(unsigned long * out, fmpz_t in, 
++void fmpz_multi_mod_ui_basecase(unsigned long * out, fmpz_t in, 
+                                unsigned long * primes, unsigned long num_primes)
+ {
+    unsigned long i;
+--- ./fmpz_poly.c.orig	2011-07-18 16:12:43.501375940 -0600
++++ ./fmpz_poly.c	2011-07-18 16:21:38.896375946 -0600
+@@ -216,7 +216,7 @@
+          
+    while (coeff_m < last_point)
+    {
+-      if ((ulong) coeff_m & 7 == 0) FLINT_PREFETCH(coeff_m, 64);
++      if ((((ulong) coeff_m) & 7) == 0) FLINT_PREFETCH(coeff_m, 64);
+       // k is guaranteed to be less than FLINT_BITS at this point
+       while ((k < HALF_FLINT_BITS) && (coeff_m < last_point))
+       {
+@@ -390,7 +390,7 @@
+       
+    while (coeff_m < next_point)
+    {
+-      if (skip & 7 == 0) FLINT_PREFETCH(array + skip, 64);
++      if ((skip & 7) == 0) FLINT_PREFETCH(array + skip, 64);
+       // read in a full limb
+       full_limb = array[skip];
+       temp2 += l_shift(full_limb,k);
+@@ -1764,7 +1764,7 @@
+    
+    for (i = 0, j = 0; i < poly_fmpz->length; i++, j += 2)
+    {
+-      if (i&3 == 0) FLINT_PREFETCH(coeffs_m+j,64);
++      if ((i&3) == 0) FLINT_PREFETCH(coeffs_m+j,64);
+       if ((long) coeffs_m[j] < 0) sign = -1L;
+       if (coeffs_m[j])
+       {
+--- ./F_mpz_LLL.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./F_mpz_LLL.c	2011-07-18 16:12:53.378375939 -0600
+@@ -3321,13 +3321,13 @@
+    int * copy_expo, * copy_alpha;
+ 
+    int ok = 1;
+-   int newd = d;
++   int newd;
+    double d_rii;
+    double d_gs_B;
+    ulong exp;
+ 
+    n = B->c;
+-   d = B->r;
++   d = newd = B->r;
+    D = d;
+ 
+    ctt = (4*DELTA + 1)/5;
+--- ./QS/poly.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./QS/poly.c	2011-07-18 16:12:53.379375939 -0600
+@@ -146,7 +146,7 @@
+    unsigned long factor, i, p;
+    unsigned long diff, best_diff, best1, best2;
+    
+-   unsigned long A;
++   unsigned long A = 0;
+    
+    if (s <= 4) 
+    {
+@@ -186,6 +186,7 @@
+    
+    if (s == 5) 
+    {
++       best1 = best2 = best_diff = 0;
+        A_ind[0] = ((z_randint(span) + min) | 1);
+        if (A_ind[0] == min + span) A_ind[0] -= 2;
+        
+--- ./QS/linear_algebra.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./QS/linear_algebra.c	2011-07-18 16:13:48.309375940 -0600
+@@ -133,6 +133,7 @@
+   
+   if (ra->data[point] > rb->data[point]) return 1;
+   else if (ra->data[point] < rb->data[point]) return -1;
++  return 0;
+ }
+ 
+ int tiny_relations_cmp2(const void *a, const void *b)
+@@ -152,6 +153,7 @@
+ 
+   if (ra->data[point] > rb->data[point]) return 1;
+   else if (ra->data[point] < rb->data[point]) return -1;
++  return 0;
+ }
+   
+ /*==========================================================================
+--- ./QS/mp_linear_algebra.c.orig	2011-07-18 16:12:48.393375936 -0600
++++ ./QS/mp_linear_algebra.c	2011-07-18 16:12:53.380375939 -0600
+@@ -142,6 +142,7 @@
+   
+   if (ra->data[point] > rb->data[point]) return 1;
+   else if (ra->data[point] < rb->data[point]) return -1;
++  return 0;
+ }
+ 
+ int relations_cmp2(const void *a, const void *b)
+@@ -161,6 +162,7 @@
+ 
+   if (ra->data[point] > rb->data[point]) return 1;
+   else if (ra->data[point] < rb->data[point]) return -1;
++  return 0;
+ }
+   
+ /*==========================================================================
+--- ./packed_vec.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./packed_vec.c	2011-07-18 16:12:53.381375939 -0600
+@@ -173,7 +173,7 @@
+ #endif
+ 		PV_ITER_INIT(iter2, *vec, 0);
+      
+-      ulong temp;
++		ulong temp = 0;
+ 		
+ 		ulong i;
+ 		for (i = 0; i < vec->length; i++)
+--- ./fmpz.h.orig	2011-07-18 16:12:43.537375940 -0600
++++ ./fmpz.h	2011-07-18 16:12:53.382375939 -0600
+@@ -383,7 +383,7 @@
+ 
+ void fmpz_comb_temp_clear(fmpz_t ** temp, fmpz_comb_t comb);
+ 
+-unsigned long fmpz_multi_mod_ui_basecase(unsigned long * out, fmpz_t in, 
++void fmpz_multi_mod_ui_basecase(unsigned long * out, fmpz_t in, 
+                                unsigned long * primes, unsigned long num_primes);
+ 
+ void fmpz_multi_mod_ui(unsigned long * out, fmpz_t in, fmpz_comb_t comb, fmpz_t ** temp);
+--- ./theta.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./theta.c	2011-07-18 16:12:53.383375939 -0600
+@@ -75,7 +75,7 @@
+             fprintf(f, "*");
+ 
+         if (n == 1)
+-            fprintf(f, "q", n);
++            fprintf(f, "q");
+ 
+         if (n > 1)
+             fprintf(f, "q^%ld", n);
+--- ./long_extras.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./long_extras.c	2011-07-18 16:12:53.386375939 -0600
+@@ -1121,7 +1121,7 @@
+ int z_isprime_pocklington(unsigned long const n, unsigned long const iterations)
+ {
+ 	int i, j, k, pass, test, exp;
+-	unsigned long sqrt, n1, f, factor, prod, temp, b, c;
++	unsigned long sqrt, n1, f, factor, prod, temp, b, c = 1;
+ 	factor_t factors;
+ 	pre_inv_t inv;
+ 	
+--- ./F_mpz_poly.c.orig	2010-12-23 20:45:11.000000000 -0700
++++ ./F_mpz_poly.c	2011-07-18 16:19:18.863375945 -0600
+@@ -2172,7 +2172,7 @@
+          
+    while (coeff_m < end_point)
+    {
+-      if ((ulong) coeff_m & 7 == 0) FLINT_PREFETCH(coeff_m, 64);
++      if ((((ulong) coeff_m) & 7) == 0) FLINT_PREFETCH(coeff_m, 64);
+ 
+       // k is guaranteed to be less than FLINT_BITS at this point
+       while ((k < HALF_FLINT_BITS) && (coeff_m < end_point))
+@@ -2276,7 +2276,7 @@
+          
+    while (coeff_m < end_point)
+    {
+-      if ((ulong) coeff_m & 7 == 0) FLINT_PREFETCH(coeff_m, 64);
++      if ((((ulong) coeff_m) & 7) == 0) FLINT_PREFETCH(coeff_m, 64);
+ 
+       // k is guaranteed to be less than FLINT_BITS at this point
+       while ((k < HALF_FLINT_BITS) && (coeff_m < end_point))
+@@ -2462,7 +2462,7 @@
+       
+    while (coeff_m < end_point)
+    {
+-      if (skip & 7 == 0) FLINT_PREFETCH(array + skip, 64);
++      if ((skip & 7) == 0) FLINT_PREFETCH(array + skip, 64);
+       // read in a full limb
+       full_limb = array[skip];
+       temp += l_shift(full_limb, k);
+@@ -2527,7 +2527,7 @@
+          
+    while (coeff_m < end_point)
+    {
+-      if ((ulong) coeff_m & 7 == 0) FLINT_PREFETCH(coeff_m, 64);
++      if ((((ulong) coeff_m) & 7) == 0) FLINT_PREFETCH(coeff_m, 64);
+ 
+       // k is guaranteed to be less than FLINT_BITS at this point
+       while ((k < HALF_FLINT_BITS) && (coeff_m < end_point))
+@@ -3956,8 +3956,8 @@
+    
+ 	if ((bits - sign <= FLINT_BITS - 2) && (bits1) && (bits2)) bitpack = 1;
+    
+-   mp_limb_t * int1, * int2, * int1b, * int2b, * int3, * int3b, * int4;
+-	ulong n1, n2;
++   mp_limb_t * int1 = NULL, * int2 = NULL, * int1b = NULL, * int2b = NULL, * int3, * int3b, * int4;
++	ulong n1 = 0, n2 = 0;
+    
+ 	if (bitpack)
+    {
diff --git a/flint.spec b/flint.spec
index 983f3f9..7b6c868 100644
--- a/flint.spec
+++ b/flint.spec
@@ -1,18 +1,27 @@
 Name:           flint
-Version:        1.5.2
-Release:        2%{?dist}
+Version:        1.6
+Release:        1%{?dist}
 Summary:        Fast Library for Number Theory
 Group:          Applications/Engineering
 License:        GPLv2+
 URL:            http://www.flintlib.org/
-Source0:        http://www.flintlib.org/flint-%{version}.tar.gz
-# Add a soname for the shared library
-Patch0:         flint-1.2.0-add-soname.diff
+Source0:        http://www.flintlib.org/flint-%{version}.tgz
 # Build a static lib (since upstream doesn't keep track of compatible
 # interfaces a soname really makes no sense
-Patch1:         flint-1.2.0-add-static-lib.diff
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+Patch0:         flint-1.2.0-add-static-lib.diff
+# Use the system zn_poly instead of building the sources
+Patch1:         flint-1.6-use-system-zn_poly.patch
+# Fix some variable redefinitions; gcc 4.6 errors out otherwise
+Patch2:         flint-1.6-redef.patch
+# Fix some compiler warnings that indicate possible runtime problems
+Patch3:         flint-1.6-warning.patch
+
 BuildRequires:  gmp-devel
+BuildRequires:  mpfr-devel
+BuildRequires:  zn_poly-devel
+BuildRequires:  tex(latex)
+
+%global sover %(echo %{version} | cut -d. -f 1)
 
 
 %description
@@ -23,8 +32,8 @@ and David Harvey.
 %package        devel
 Summary:        Development files for FLINT
 Group:          Development/Libraries
-Requires:       %{name} = %{version}-%{release}
-Requires:       zn_poly-devel
+Requires:       %{name}%{?_isa} = %{version}-%{release}
+Requires:       gmp-devel%{?_isa}, mpfr-devel%{?_isa}, zn_poly-devel%{?_isa}
 
 
 %description    devel
@@ -35,7 +44,7 @@ developing applications that use %{name}.
 %package        static
 Summary:        Static libraries for FLINT
 Group:          Development/Libraries
-Requires:       %{name}-devel = %{version}-%{release}
+Requires:       %{name}-devel%{?_isa} = %{version}-%{release}
 
 
 %description    static
@@ -45,22 +54,43 @@ developing applications that use %{name}.
 
 %prep
 %setup -q
-sed -i -e 's|^LIBDIR=.*$|LIBDIR=%{_libdir}|'             makefile
-sed -i -e 's|^INCLUDEDIR=.*$|INCLUDEDIR=%{_includedir}|' makefile
-sed -i -e 's|^DOCDIR=.*$|DOCDIR=%{_docdir}|'             makefile
-sed -i -e 's|^CFLAGS =.*$|CFLAGS = $(INCS) %{optflags} -lgmp|' makefile
 %patch0
 %patch1
+%patch2
+%patch3
+
+# Make sure we don't accidentally use the included zn_poly sources
+rm -fr zn_poly
+
+# Add an soname for the shared library and set other values
+sed -e 's|^LIBDIR=.*$|LIBDIR=%{_libdir}|'                        \
+    -e 's|^INCLUDEDIR=.*$|INCLUDEDIR=%{_includedir}|'            \
+    -e 's|^DOCDIR=.*$|DOCDIR=%{_docdir}|'                        \
+    -e 's|^CFLAGS =.*$|CFLAGS = $(INCS) %{optflags}|'            \
+    -e 's|^CFLAGS2 =.*$|CFLAGS2 = $(INCS) %{optflags} -fopenmp|' \
+    -e "s|-shared|-shared -Wl,-h,libflint.so.%{sover}|"          \
+    -e 's|mp_lprels\.o \$(FLINTOBJ)$|mp_lprels.o libflint.so|'   \
+    -e 's|mp_lprels\.o \$(FLINTOBJ)|mp_lprels.o -L. -lflint|'    \
+    -i makefile
+
+# Fix end-of-line encodings
+sed 's/\r//' CHANGES.txt > CHANGES
+touch -r CHANGES.txt CHANGES
+mv -f CHANGES CHANGES.txt
 
 
 %build
-make %{?_smp_mflags} MAKECMDGOALS=library
-make libflint.so
-make libflint.a
+make %{?_smp_mflags} MAKECMDGOALS=library FLINT_GMP_LIB_DIR=%{_libdir}
+rm -f *.o
+make libflint.a FLINT_GMP_LIB_DIR=%{_libdir}
+
+# Build the documentation
+cd doc
+pdflatex %{name}-%{version}.tex
+pdflatex %{name}-%{version}.tex
 
 
 %install
-rm -rf $RPM_BUILD_ROOT
 # generated in build: mpQS libflint.so libflint.a
 install -d -m 755 $RPM_BUILD_ROOT%{_libdir}
 install -p -m 644 libflint.a $RPM_BUILD_ROOT%{_libdir}/
@@ -72,9 +102,9 @@ for header in *.h; do
   install -p -m 644 $header $RPM_BUILD_ROOT%{_includedir}/%{name}/
 done
 
-install -p -m 755 libflint.so.0 $RPM_BUILD_ROOT%{_libdir}/
+install -p -m 755 libflint.so $RPM_BUILD_ROOT%{_libdir}/libflint.so.%{sover}
 pushd $RPM_BUILD_ROOT%{_libdir}/
-  ln -s libflint.so.0 libflint.so
+  ln -s libflint.so.%{sover} libflint.so
 popd
 
 # add symlink FLINT -> flint | sagemath wants it that way
@@ -84,6 +114,7 @@ popd
 
 
 %post -p /sbin/ldconfig
+
 %postun -p /sbin/ldconfig
 
 
@@ -92,25 +123,30 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %files
-%defattr(-,root,root,-)
-%doc doc/%{name}-%{version}.pdf
+%doc CHANGES.txt gpl-2.0.txt doc/%{name}-%{version}.pdf
 %{_bindir}/mpQS
-%{_libdir}/libflint.so.0
+%{_libdir}/libflint.so.%{sover}
 
 
 %files devel
-%defattr(-,root,root,-)
 %{_includedir}/flint
 %{_includedir}/FLINT
 %{_libdir}/libflint.so
 
 
 %files static
-%defattr(-,root,root,-)
 %{_libdir}/libflint.a
 
 
 %changelog
+* Mon Jul 18 2011 Jerry James <loganjerry at gmail.com> - 1.6-1
+- New upstream release
+- Build against the system zn_poly instead of the included sources
+- Make sure there is no PIC code in the static archive
+- Link mpQS against the shared library instead of including the library
+- Fix build errors and scary warnings with gcc 4.6
+- Remove unnecessary spec file elements (BuildRoot, etc.)
+
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.5.2-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 
diff --git a/sources b/sources
index a78f28f..71c1e63 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-613619c129b8b8c85507553f70102113  flint-1.5.2.tar.gz
+72ae4b64e1e7acb03847e8e565bbe432  flint-1.6.tgz


More information about the scm-commits mailing list