[lrslib] New upstream release.

Jerry James jjames at fedoraproject.org
Mon Nov 10 22:16:08 UTC 2014


commit 09e756662066b23dde3370c94089caf1c571b7f3
Author: Jerry James <jamesjer at betterlinux.com>
Date:   Mon Nov 10 15:15:32 2014 -0700

    New upstream release.
    
    Also:
    - Drop upstreamed -memleak patch.
    - Link with $RPM_LD_FLAGS.
    - Fix license handling.

 .gitignore           |    2 +-
 lrslib-fixes.patch   |  477 +++++++++++++++++++++++++++++++++++++++++---------
 lrslib-memleak.patch |   48 -----
 lrslib.spec          |   73 +++++----
 sources              |    2 +-
 5 files changed, 440 insertions(+), 162 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 153a372..5dcc0d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
 /lrslib-man.tar.xz
-/lrslib-043.tar.gz
+/lrslib-050.tar.gz
diff --git a/lrslib-fixes.patch b/lrslib-fixes.patch
index cee6acd..538112e 100644
--- a/lrslib-fixes.patch
+++ b/lrslib-fixes.patch
@@ -1,15 +1,5 @@
---- ./lrsgmp.c.orig	2009-09-10 12:40:50.000000000 -0600
-+++ ./lrsgmp.c	2009-09-10 12:40:50.000000000 -0600
-@@ -7,6 +7,7 @@
- 
- #include <stdio.h>
- #include <stdlib.h>
-+#include <string.h>
- #include "lrsgmp.h"
- 
- long lrs_digits;		/* max permitted no. of digits   */
---- ./2gnash.c.orig	2009-09-10 12:40:50.000000000 -0600
-+++ ./2gnash.c	2009-09-10 12:40:50.000000000 -0600
+--- ./2nash.c.orig	2012-10-02 20:07:17.000000000 -0600
++++ ./2nash.c	2014-11-07 20:00:00.000000000 -0700
 @@ -8,6 +8,7 @@
         #include <stdlib.h>
         #include <unistd.h>
@@ -22,30 +12,30 @@
  		      if(cpid[l-1] == 0) {
  			 //forked threads
  			// n= sprintf(buffer, "lrs %s > out%i", argv[l], l);
-+                         int n = sprintf(buffer, "out%i", l);
++			 int n = sprintf(buffer, "out%i", l);
 +			 int fd = creat(buffer, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-+                         dup2(fd, 1);
++			 dup2(fd, 1);
                           if(l==1) {
--                              int n= sprintf(buffer, "gnash %s %s > out%i", argv[1], argv[2], l);
-+                              execlp("lrs-nash", "lrs-nash", argv[1], argv[2], NULL);
+-                              int n= sprintf(buffer, "nash %s %s > out%i", argv[1], argv[2], l);
++			      execlp("lrs-nash", "lrs-nash", argv[1], argv[2], NULL);
                           }
                           else     {
--                              int n= sprintf(buffer, "gnash %s %s > out%i", argv[2], argv[1], l);
-+                              execlp("lrs-nash", "lrs-nash", argv[2], argv[1], NULL);
+-                              int n= sprintf(buffer, "nash %s %s > out%i", argv[2], argv[1], l);
++			      execlp("lrs-nash", "lrs-nash", argv[2], argv[1], NULL);
                           }
  
 -			 int i=system(buffer);
                            _exit(0);
  		      }
  		  }
-@@ -44,24 +47,24 @@
+@@ -44,23 +47,23 @@
  		      if(w == cpid[j-1]) {
  			  // this child finished first
                            if(j==1)
--			      printf("gnash %s %s   finished first\n", argv[1], argv[2]);
+-			      printf("nash %s %s   finished first\n", argv[1], argv[2]);
 +			      printf("lrs-nash %s %s   finished first\n", argv[1], argv[2]);
                            else {
--			      printf("gnash %s %s   finished first\n", argv[2], argv[1]);
+-			      printf("nash %s %s   finished first\n", argv[2], argv[1]);
 +			      printf("lrs-nash %s %s   finished first\n", argv[2], argv[1]);
  			      printf("player numbers will be reversed in output\n");
                                 }
@@ -63,65 +53,394 @@
                             }
 -			  int i = system(buffer);
  		      } else {
- 			 // printf("terminating lrs of file %s\n", argv[j]);
 -			  int n = sprintf(buffer, "/bin/rm -f out%i", j);
 -			  int i = system(buffer);
-+                          int n = sprintf(buffer, "out%i", j);
-+                          unlink(buffer);
++			  int n = sprintf(buffer, "out%i", j);
++			  unlink(buffer);
  		      }
  		  }
-                   printf("the other process will be ");   /*...will be killed */
---- ./lrslong.c.orig	2009-09-10 12:40:50.000000000 -0600
-+++ ./lrslong.c	2009-09-10 12:40:50.000000000 -0600
-@@ -7,6 +7,7 @@
- 
- #include <stdio.h>
- #include <stdlib.h>
-+#include <string.h>
- #include "lrslong.h"
- 
- long digits;
---- ./buffer.c.orig	2009-09-10 12:40:52.000000000 -0600
-+++ ./buffer.c	2009-09-10 12:40:52.000000000 -0600
-@@ -70,7 +70,7 @@ main(int argc, char *argv[])
- /* getline from KR P.32 */
- int Getline(void)
- {
--	int c,i;
-+	int c=EOF,i;
- 	extern int maxline;
-         extern char *line;
- 
---- ./lrslib.html.orig	2009-09-10 12:40:50.000000000 -0600
-+++ ./lrslib.html	2009-09-10 12:40:50.000000000 -0600
-@@ -145,7 +145,7 @@ of the driver, and does basic setup func
- some information about version numer or lrslib and which arithmetic package
- is used. FALSE is returned in case of failure.</font></blockquote>
- 
--<p><br><font color="#990000">lrs_dat&nbsp; *lrs_alloc_dat (char *name);&nbsp;&nbsp;&nbsp;
-+<p><br><font color="#990000">lrs_dat&nbsp; *lrs_alloc_dat (const char *name);&nbsp;&nbsp;&nbsp;
- /* allocate for lrs_dat structure "name"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
- */</font>
- <br>&nbsp;
---- ./lrslib.h.orig	2010-07-07 01:58:36.000000000 -0600
-+++ ./lrslib.h	2010-07-07 01:58:36.000000000 -0600
-@@ -218,7 +218,7 @@ extern lrs_dic *PBnew;    /* we will sav
- long lrs_main (int argc, char *argv[]);    /* lrs driver, argv[1]=input file, [argc-1]=output file */
- long redund_main (int argc, char *argv[]); /* redund driver, argv[1]=input file, [2]=output file */
- 
--lrs_dat *lrs_alloc_dat (char *name);	/* allocate for lrs_dat structure "name"       */
-+lrs_dat *lrs_alloc_dat (const char *name);	/* allocate for lrs_dat structure "name"       */
- lrs_dic *lrs_alloc_dic (lrs_dat * Q);	/* allocate for lrs_dic structure corr. to Q   */
- 
- void lrs_estimate (lrs_dic * P, lrs_dat * Q);	/* get estimates only                          */
---- ./lrslib.c.orig	2012-05-31 23:20:49.000000000 -0600
-+++ ./lrslib.c	2012-08-13 14:54:20.155363341 -0600
-@@ -560,7 +560,7 @@ lrs_close (char *name)
- /* allocate and initialize lrs_dat */
- /***********************************/
- lrs_dat *
--lrs_alloc_dat (char *name)
-+lrs_alloc_dat (const char *name)
- {
-   lrs_dat *Q;
-   long i;
+ 		  printf("the other process will be ");   /*...will be killed */
+--- ./lrsgmp.c.orig	2013-03-05 22:25:53.000000000 -0700
++++ ./lrsgmp.c	2014-11-07 20:00:00.000000000 -0700
+@@ -250,7 +250,7 @@ readrat (lrs_mp Na, lrs_mp Da)	/* read a
+ }
+ 
+ #ifdef PLRS
+-string prat (char name[], lrs_mp Nin, lrs_mp Din)	/*reduce and print Nin/Din  */
++string prat (const char *name, lrs_mp Nin, lrs_mp Din)	/*reduce and print Nin/Din  */
+ {
+ 
+ 	//create stream to collect output
+@@ -285,7 +285,7 @@ string prat (char name[], lrs_mp Nin, lr
+ }
+ 
+ 
+-string pmp (char name[], lrs_mp Nt)	/*print the long precision integer a */
++string pmp (const char *name, lrs_mp Nt)	/*print the long precision integer a */
+ {
+ 	
+ 	//create stream to collect output
+@@ -307,7 +307,7 @@ string pmp (char name[], lrs_mp Nt)	/*pr
+ #else
+ 
+ void
+-pmp (char name[], lrs_mp Nt)
++pmp (const char *name, lrs_mp Nt)
+ {
+   fprintf (lrs_ofp, "%s", name);
+   if (sign (Nt) != NEG)
+@@ -317,7 +317,7 @@ pmp (char name[], lrs_mp Nt)
+ }
+ 
+ void 
+-prat (char name[], lrs_mp Nin, lrs_mp Din)
++prat (const char *name, lrs_mp Nin, lrs_mp Din)
+      /*print the long precision rational Nt/Dt  */
+ {
+ 	lrs_mp temp1, temp2;
+@@ -432,7 +432,7 @@ lrs_getdigits (long *a, long *b)
+ }
+ 
+ void *
+-xcalloc (long n, long s, long l, char *f)
++xcalloc (long n, long s, long l, const char *f)
+ {
+   void *tmp;
+ 
+@@ -468,7 +468,7 @@ lrs_mp_init (long dec_digits, FILE * fpi
+ 
+ 
+ void 
+-notimpl (char s[])
++notimpl (const char *s)
+ {
+   fflush (stdout);
+   fprintf (stderr, "\nAbnormal Termination  %s\n", s);
+--- ./lrsgmp.h.orig	2012-10-23 03:51:39.000000000 -0600
++++ ./lrsgmp.h	2014-11-07 20:00:00.000000000 -0700
+@@ -173,12 +173,12 @@ void atomp (const char s[], lrs_mp a);	/
+ long compare (lrs_mp a, lrs_mp b);	/* a ? b and returns -1,0,1 for <,=,>             */
+ void linint (lrs_mp a, long ka, lrs_mp b, long kb);     /* compute a*ka+b*kb --> a        */
+ #ifdef PLRS
+-string pmp (char name[], lrs_mp a);	/* print the long precision integer a             */
+-string prat (char name[], lrs_mp Nt, lrs_mp Dt);	/* reduce and print  Nt/Dt                        */
++string pmp (const char *name, lrs_mp a);	/* print the long precision integer a             */
++string prat (const char *name, lrs_mp Nt, lrs_mp Dt);	/* reduce and print  Nt/Dt                        */
+ long plrs_readrat (lrs_mp Na, lrs_mp Da, const char * rat);	/* take a rational number and convert to lrs_mp   */
+ #else
+-void pmp (char name[], lrs_mp a);	/* print the long precision integer a             */
+-void prat (char name[], lrs_mp Nt, lrs_mp Dt);	/* reduce and print  Nt/Dt                        */
++void pmp (const char *name, lrs_mp a);	/* print the long precision integer a             */
++void prat (const char *name, lrs_mp Nt, lrs_mp Dt);	/* reduce and print  Nt/Dt                        */
+ #endif
+ void readmp (lrs_mp a);		/* read an integer and convert to lrs_mp          */
+ long readrat (lrs_mp Na, lrs_mp Da);	/* read a rational or int and convert to lrs_mp   */
+@@ -199,7 +199,7 @@ void lcm (lrs_mp a, lrs_mp b);	/* a = le
+ void mulrat (lrs_mp Na, lrs_mp Da, lrs_mp Nb, lrs_mp Db, lrs_mp Nc, lrs_mp Dc);
+ 						       /* computes Nc/Dc=(Na/Da)*(Nb/Db) and reduce      */
+ long myrandom (long num, long nrange);	/* return a random number in range 0..nrange-1    */
+-void notimpl (char s[]);	/* bail out - help!                               */
++void notimpl (const char *s);	/* bail out - help!                               */
+ void rattodouble (lrs_mp a, lrs_mp b, double *x);	/* convert lrs_mp rational to double              */
+ void reduceint (lrs_mp Na, lrs_mp Da);	/* divide Na by Da and return it                  */
+ void reducearray (lrs_mp_vector p, long n);	/* find gcd of p[0]..p[n-1] and divide through by */
+@@ -218,7 +218,7 @@ void *calloc ();
+ void *malloc ();
+ #endif
+ 
+-void *xcalloc (long n, long s, long l, char *f);
++void *xcalloc (long n, long s, long l, const char *f);
+ 
+ void lrs_default_digits_overflow ();
+ 
+--- ./lrslib.c.orig	2013-05-27 20:10:38.000000000 -0600
++++ ./lrslib.c	2014-11-07 20:00:00.000000000 -0700
+@@ -950,7 +950,7 @@ void lrs_lpoutput(lrs_dic * P,lrs_dat *
+ /* end of lrs_lpoutput */
+ /***********************/
+ void 
+-lrs_printrow (char name[], lrs_dat * Q, lrs_mp_vector output, long rowd)
++lrs_printrow (const char *name, lrs_dat * Q, lrs_mp_vector output, long rowd)
+ /* print a row of A matrix in output in "original" form  */
+ /* rowd+1 is the dimension of output vector                */
+ /* if input is H-rep. output[0] contains the RHS      */
+@@ -1033,7 +1033,7 @@ lrs_getsolution (lrs_dic * P, lrs_dat *
+ 
+ 
+ long
+-lrs_init (char *name)       /* returns TRUE if successful, else FALSE */
++lrs_init (const char *name)       /* returns TRUE if successful, else FALSE */
+ {
+ 
+   printf ("%s", name);
+@@ -1057,7 +1057,7 @@ lrs_init (char *name)       /* returns T
+ }
+ 
+ void 
+-lrs_close (char *name)
++lrs_close (const char *name)
+ {
+ 
+   fprintf (lrs_ofp, "\n*%s", name);
+@@ -4612,7 +4612,7 @@ printA (lrs_dic * P, lrs_dat * Q)	/* pri
+ 
+ 
+ void 
+-pimat (lrs_dic * P, long r, long s, lrs_mp Nt, char name[])
++pimat (lrs_dic * P, long r, long s, lrs_mp Nt, const char *name)
+  /*print the long precision integer in row r col s of matrix A */
+ {
+   long *B = P->B;
+@@ -5185,7 +5185,7 @@ setup_signals ()
+ }
+ 
+ void 
+-timecheck ()
++timecheck (int signum __attribute__((unused)))
+ {
+   lrs_dump_state ();
+   errcheck ("signal", signal (SIGALRM, timecheck));
+@@ -5193,14 +5193,14 @@ timecheck ()
+ }
+ 
+ void 
+-checkpoint ()
++checkpoint (int signum __attribute__((unused)))
+ {
+   lrs_dump_state ();
+   errcheck ("signal", signal (SIGUSR1, checkpoint));
+ }
+ 
+ void 
+-die_gracefully ()
++die_gracefully (int signum __attribute__((unused)))
+ {
+   lrs_dump_state ();
+ 
+--- ./lrslib.h.orig	2013-05-27 20:10:38.000000000 -0600
++++ ./lrslib.h	2014-11-07 20:00:00.000000000 -0700
+@@ -253,12 +253,12 @@ long lrs_getnextbasis (lrs_dic ** dict_p
+ long lrs_getsolution (lrs_dic * P, lrs_dat * Q, lrs_mp_vector output, long col);
+ long lrs_getray (lrs_dic * P, lrs_dat * Q, long col, long comment, lrs_mp_vector output);
+ long lrs_getvertex (lrs_dic * P, lrs_dat * Q, lrs_mp_vector output);
+-void lrs_close (char *name);	/* close lrs lib program "name"                 */
+-long lrs_init (char *name);	/* initialize lrslib and arithmetic package for prog "name" */
++void lrs_close (const char *name);	/* close lrs lib program "name"                 */
++long lrs_init (const char *name);	/* initialize lrslib and arithmetic package for prog "name" */
+ void lrs_lpoutput(lrs_dic * P,lrs_dat * Q, lrs_mp_vector output); /* print LP primal and dual solutions */
+ void lrs_printcobasis (lrs_dic * P, lrs_dat * Q, long col); /* print cobasis for column col(verted or ray)  */
+ void lrs_printoutput (lrs_dat * Q, lrs_mp_vector output); /* print output array                           */
+-void lrs_printrow (char name[], lrs_dat * Q, lrs_mp_vector output, long rowd); /*print row of A matrix in output[0..rowd]      */
++void lrs_printrow (const char *name, lrs_dat * Q, lrs_mp_vector output, long rowd); /*print row of A matrix in output[0..rowd]      */
+ void lrs_printsol (lrs_dic * P, lrs_dat * Q, long col, long comment);	/* print out solution from col, comment= 0=normal,-1=geometric ray,1..inputd=linearity */
+ void lrs_printtotals (lrs_dic * P, lrs_dat * Q);/* print final totals for lrs                   */
+ long lrs_set_digits (long dec_digits );  /* set lrsmp digits to equiv. of decimal dec_digits */
+@@ -297,7 +297,7 @@ void updatevolume (lrs_dic * P, lrs_dat
+ long lrs_degenerate (lrs_dic * P, lrs_dat * Q);	/* TRUE if the dictionary is primal degenerate    */
+ void print_basis (FILE * fp, lrs_dat * Q);
+ void printA (lrs_dic * P, lrs_dat * Q);	/* raw print of dictionary, bases for debugging   */
+-void pimat (lrs_dic * P, long r, long s, lrs_mp Nt, char name[]); /* print the row r col s of A                     */
++void pimat (lrs_dic * P, long r, long s, lrs_mp Nt, const char *name); /* print the row r col s of A                     */
+ long readfacets (lrs_dat * Q, long facet[]);	/* read and check facet list                      */
+ long readlinearity (lrs_dat * Q);	/* read and check linearity list                  */
+ void rescaledet (lrs_dic * P, lrs_dat * Q, lrs_mp Vnum, lrs_mp Vden);	/* rescale determinant to get its volume */
+@@ -330,10 +330,10 @@ lrs_dic *resize (lrs_dic * P, lrs_dat *
+ /*******************************/
+ /* signals handling            */
+ /*******************************/
+-void checkpoint ();
+-void die_gracefully ();
++void checkpoint (int signum);
++void die_gracefully (int signum);
+ void setup_signals ();
+-void timecheck ();
++void timecheck (int signum);
+ 
+ /*******************************/
+ /* utilities                   */
+--- ./lrslong.c.orig	2012-10-02 20:07:17.000000000 -0600
++++ ./lrslong.c	2014-11-07 20:00:00.000000000 -0700
+@@ -272,7 +272,7 @@ readmp (lrs_mp a)		/* read an integer an
+ 
+ #ifdef PLRS
+ 
+-string prat (char name[], lrs_mp Nin, lrs_mp Din)	/*reduce and print Nin/Din  */
++string prat (const char *name, lrs_mp Nin, lrs_mp Din)	/*reduce and print Nin/Din  */
+ {
+ 
+ 	//create stream to collect output
+@@ -294,7 +294,7 @@ string prat (char name[], lrs_mp Nin, lr
+ 	return str;
+ }
+ 
+-string pmp (char name[], lrs_mp Nt)	/*print the long precision integer a */
++string pmp (const char *name, lrs_mp Nt)	/*print the long precision integer a */
+ {
+ 	
+ 	//create stream to collect output
+@@ -312,7 +312,7 @@ string pmp (char name[], lrs_mp Nt)	/*pr
+ }
+ #else
+ void 
+-pmp (char name[], lrs_mp Nt)
++pmp (const char *name, lrs_mp Nt)
+ {
+   fprintf (lrs_ofp, "%s", name);
+   if (sign (Nt) != NEG)
+@@ -322,7 +322,7 @@ pmp (char name[], lrs_mp Nt)
+ }
+ 
+ void 
+-prat (char name[], lrs_mp Nin, lrs_mp Din)
++prat (const char *name, lrs_mp Nin, lrs_mp Din)
+      /*print the long precision rational Nt/Dt  */
+ {
+   lrs_mp Nt, Dt;
+@@ -427,7 +427,7 @@ lrs_getdigits (long *a, long *b)
+ }
+ 
+ void *
+-xcalloc (long n, long s, long l, char *f)
++xcalloc (long n, long s, long l, const char *f)
+ {
+   void *tmp;
+ 
+@@ -461,7 +461,7 @@ lrs_mp_init (long dec_digits, FILE * fpi
+ }
+ 
+ void 
+-notimpl (char s[])
++notimpl (const char *s)
+ {
+   fflush (stdout);
+   fprintf (stderr, "\nAbnormal Termination  %s\n", s);
+--- ./lrslong.h.orig	2012-10-23 03:51:39.000000000 -0600
++++ ./lrslong.h	2014-11-07 20:00:00.000000000 -0700
+@@ -186,12 +186,12 @@ void gcd (lrs_mp u, lrs_mp v);	/* return
+ void mptodouble (lrs_mp a, double *x);	/* convert lrs_mp to double                       */
+ long mptoi (lrs_mp a);		/* convert lrs_mp to long integer */
+ #ifdef PLRS
+-string pmp (char name[], lrs_mp a);	/* print the long precision integer a             */
+-string prat (char name[], lrs_mp Nt, lrs_mp Dt);	/* reduce and print  Nt/Dt                        */
++string pmp (const char *name, lrs_mp a);	/* print the long precision integer a             */
++string prat (const char *name, lrs_mp Nt, lrs_mp Dt);	/* reduce and print  Nt/Dt                        */
+ long plrs_readrat (lrs_mp Na, lrs_mp Da, const char * rat);	/* take a rational number and convert to lrs_mp   */
+ #else
+-void pmp (char name[], lrs_mp a);	/* print the long precision integer a             */
+-void prat (char name[], lrs_mp Nt, lrs_mp Dt);	/* reduce and print  Nt/Dt                        */
++void pmp (const char *name, lrs_mp a);	/* print the long precision integer a             */
++void prat (const char *name, lrs_mp Nt, lrs_mp Dt);	/* reduce and print  Nt/Dt                        */
+ #endif
+ void readmp (lrs_mp a);		/* read an integer and convert to lrs_mp          */
+ long readrat (lrs_mp Na, lrs_mp Da);	/* read a rational or int and convert to lrs_mp   */
+@@ -213,7 +213,7 @@ void lcm (lrs_mp a, lrs_mp b);	/* a = le
+ void mulrat (lrs_mp Na, lrs_mp Da, lrs_mp Nb, lrs_mp Db, lrs_mp Nc, lrs_mp Dc);
+ 						       /* computes Nc/Dc=(Na/Da)*(Nb/Db) and reduce      */
+ long myrandom (long num, long nrange);	/* return a random number in range 0..nrange-1    */
+-void notimpl (char s[]);	/* bail out - help!                               */
++void notimpl (const char *s);	/* bail out - help!                               */
+ void rattodouble (lrs_mp a, lrs_mp b, double *x);	/* convert lrs_mp rational to double              */
+ void reduceint (lrs_mp Na, lrs_mp Da);	/* divide Na by Da and return it                  */
+ void reducearray (lrs_mp_vector p, long n);	/* find gcd of p[0]..p[n-1] and divide through by */
+@@ -229,7 +229,7 @@ void stringcpy (char *s, char *t);	/* co
+ 
+ void *calloc ();
+ void *malloc ();
+-void *xcalloc (long n, long s, long l, char *f);
++void *xcalloc (long n, long s, long l, const char *f);
+ 
+ void lrs_default_digits_overflow ();
+ 
+--- ./lrsmp.c.orig	2012-10-23 03:51:39.000000000 -0600
++++ ./lrsmp.c	2014-11-07 20:00:00.000000000 -0700
+@@ -618,7 +618,7 @@ mptoi (lrs_mp a)		/* convert lrs_mp to l
+ 
+ 
+ #ifdef PLRS
+-string prat (char name[], lrs_mp Nin, lrs_mp Din)	/*reduce and print Nin/Din  */
++string prat (const char *name, lrs_mp Nin, lrs_mp Din)	/*reduce and print Nin/Din  */
+ {
+ 
+ 	
+@@ -658,7 +658,7 @@ string prat (char name[], lrs_mp Nin, lr
+ }
+ 
+ 
+-string pmp (char name[], lrs_mp a)	/*print the long precision integer a */
++string pmp (const char *name, lrs_mp a)	/*print the long precision integer a */
+ {
+ 	
+   	long i;
+@@ -683,7 +683,7 @@ string pmp (char name[], lrs_mp a)	/*pri
+ 	return str;
+ }
+ #else
+-void prat (char name[], lrs_mp Nin, lrs_mp Din)	/*reduce and print Nin/Din  */
++void prat (const char *name, lrs_mp Nin, lrs_mp Din)	/*reduce and print Nin/Din  */
+ {
+ 	 lrs_mp Nt, Dt;
+ 	long i;
+@@ -711,7 +711,7 @@ void prat (char name[], lrs_mp Nin, lrs_
+ 	
+ }
+ 
+-void pmp (char name[], lrs_mp a)	/*print the long precision integer a */
++void pmp (const char *name, lrs_mp a)	/*print the long precision integer a */
+ {
+ 
+ 	long i;
+@@ -956,7 +956,7 @@ comprod (lrs_mp Na, lrs_mp Nb, lrs_mp Nc
+ 
+ 
+ void 
+-notimpl (char s[])
++notimpl (const char *s)
+ {
+   fflush (stdout);
+   fprintf (stderr, "\nAbnormal Termination  %s\n", s);
+@@ -1031,7 +1031,7 @@ mulrat (lrs_mp Na, lrs_mp Da, lrs_mp Nb,
+ 
+ 
+ void *
+-xcalloc (long n, long s, long l, char *f)
++xcalloc (long n, long s, long l, const char *f)
+ {
+   void *tmp;
+ 
+--- ./lrsmp.h.orig	2013-03-04 01:56:21.000000000 -0700
++++ ./lrsmp.h	2014-11-07 20:00:00.000000000 -0700
+@@ -181,12 +181,12 @@ long mptoi (lrs_mp a);		/* convert lrs_m
+ void mulint (lrs_mp a, lrs_mp b, lrs_mp c);	/* multiply two integers a*b --> c                */
+ void normalize (lrs_mp a);	/* normalize lrs_mp after computation             */
+ #ifdef PLRS
+-string pmp (char name[], lrs_mp a);	/* print the long precision integer a             */
+-string prat (char name[], lrs_mp Nt, lrs_mp Dt);	/* reduce and print  Nt/Dt                        */
++string pmp (const char *name, lrs_mp a);	/* print the long precision integer a             */
++string prat (const char *name, lrs_mp Nt, lrs_mp Dt);	/* reduce and print  Nt/Dt                        */
+ long plrs_readrat (lrs_mp Na, lrs_mp Da, const char * rat);	/* take a rational number and convert to lrs_mp   */
+ #else
+-void pmp (char name[], lrs_mp a);	/* print the long precision integer a             */
+-void prat (char name[], lrs_mp Nt, lrs_mp Dt);	/* reduce and print  Nt/Dt                        */
++void pmp (const char *name, lrs_mp a);	/* print the long precision integer a             */
++void prat (const char *name, lrs_mp Nt, lrs_mp Dt);	/* reduce and print  Nt/Dt                        */
+ #endif
+ long readrat (lrs_mp Na, lrs_mp Da);	/* read a rational or int and convert to lrs_mp   */
+ void reduce (lrs_mp Na, lrs_mp Da);	/* reduces Na Da by gcd(Na,Da)                    */
+@@ -210,7 +210,7 @@ void lcm (lrs_mp a, lrs_mp b);	/* a = le
+ void mulrat (lrs_mp Na, lrs_mp Da, lrs_mp Nb, lrs_mp Db, lrs_mp Nc, lrs_mp Dc);
+ 						       /* computes Nc/Dc=(Na/Da)*(Nb/Db) and reduce      */
+ long myrandom (long num, long nrange);	/* return a random number in range 0..nrange-1    */
+-void notimpl (char s[]);	/* bail out - help!                               */
++void notimpl (const char *s);	/* bail out - help!                               */
+ void rattodouble (lrs_mp a, lrs_mp b, double *x);	/* convert lrs_mp rational to double              */
+ void reduceint (lrs_mp Na, lrs_mp Da);	/* divide Na by Da and return it                  */
+ void reducearray (lrs_mp_vector p, long n);	/* find gcd of p[0]..p[n-1] and divide through by */
+@@ -227,7 +227,7 @@ void lrs_getdigits (long *a, long *b);	/
+ 
+ void stringcpy (char *s, char *t);	/* copy t to s pointer version                            */
+ 
+-void *xcalloc (long n, long s, long l, char *f);
++void *xcalloc (long n, long s, long l, const char *f);
+ 
+ void lrs_default_digits_overflow ();
+ void digits_overflow ();
diff --git a/lrslib.spec b/lrslib.spec
index e21bf23..29ccafc 100644
--- a/lrslib.spec
+++ b/lrslib.spec
@@ -1,9 +1,9 @@
 Name:           lrslib
-Version:        4.3
-Release:        5%{?dist}
+Version:        5.0
+Release:        1%{?dist}
 Summary:        Reverse search for vertex enumeration/convex hull problems
 
-%global upver 0%(echo %{version} | sed 's/\\.//')
+%global upver 0%(sed 's/\\.//' <<< %{version})
 
 License:        GPLv2+
 URL:            http://cgm.cs.mcgill.ca/~avis/C/lrs.html
@@ -14,10 +14,8 @@ Source1:        %{name}-man.tar.xz
 # This patch was sent upstream on 31 May 2011.  It fixes some miscellaneous
 # bugs and adapts to the naming scheme we choose for installation.
 Patch0:         %{name}-fixes.patch
-# This patch is from Thomas Rehn, who also sent the patch upstream.  It fixes
-# a memory leak.
-Patch1:         %{name}-memleak.patch
 
+BuildRequires:  boost-devel
 BuildRequires:  gmp-devel
 
 %description
@@ -49,57 +47,58 @@ Sample programs that use %{name}.
 %setup -q -n %{name}-%{upver} -T -D -a 1
 %patch0
 
-# Fix the FSF's address
-for f in COPYING lrsgmp.h lrslib.{c,h} lrslong.h lrsmp.{c,h}; do
-  sed -i.orig \
-    's/675 Mass Ave, Cambridge, MA 02139/51 Franklin Street, Suite 500, Boston, MA  02110-1335/' \
-    $f
-  touch -r $f.orig $f
-  rm -f $f.orig
-done
+# Do not use the bundled version of boost
+rm -fr boost.atomic
+
+# Fix an invalid memory model
+sed -i.orig 's/memory_order_consume/memory_order_acq_rel/' plrs.cpp
+touch -r plrs.cpp.orig plrs.cpp
+rm -f plrs.cpp.orig
 
 %build
 # The Makefile is too primitive to use.  For one thing, it only builds
 # binaries, not libraries.  We do our own thing here.
 
 # Extract the version numbers to be used for the shared libraries.
-%global ver %(echo %{version} | sed -r 's/([\\\.[:digit:]]*)[[:alpha:]]/\\\1/')
-%global sover %(echo %{version} | cut -d. -f1)
+%global ver %(sed -r 's/([\\\.[:digit:]]*)[[:alpha:]]/\\\1/' <<< %{version})
+%global sover %(cut -d. -f1 <<< %{version})
 
-CFLAGS="${RPM_OPT_FLAGS} -DTIMES -DSIGNALS"
+CFLAGS="${RPM_OPT_FLAGS} -DTIMES -DSIGNALS -I. -I%{_includedir}/boost"
 if [ %{__isa_bits} = "64" ]; then
   CFLAGS+=" -DB64"
 fi
 
 # Build the GMP version of the library
-gcc $CFLAGS -DGMP -fPIC -shared -o liblrsgmp.so.%{ver} \
+gcc $CFLAGS $RPM_LD_FLAGS -DGMP -fPIC -shared -o liblrsgmp.so.%{ver} \
     -Wl,-soname,liblrsgmp.so.%{sover} lrslib.c lrsgmp.c -lgmp
 ln -s liblrsgmp.so.%{ver} liblrsgmp.so.%{sover}
 ln -s liblrsgmp.so.%{sover} liblrsgmp.so
 
 # Build the integer version of the library
-gcc $CFLAGS -DLONG -fPIC -shared -o liblrslong.so.%{ver} \
+gcc $CFLAGS $RPM_LD_FLAGS -DLONG -fPIC -shared -o liblrslong.so.%{ver} \
     -Wl,-soname,liblrslong.so.%{sover} lrslib.c lrslong.c
 ln -s liblrslong.so.%{ver} liblrslong.so.%{sover}
 ln -s liblrslong.so.%{sover} liblrslong.so
 
 # Build the multi-precision version of the library
-gcc $CFLAGS -DLRSMP -fPIC -shared -o liblrsmp.so.%{ver} \
+gcc $CFLAGS $RPM_LD_FLAGS -DLRSMP -fPIC -shared -o liblrsmp.so.%{ver} \
     -Wl,-soname,liblrsmp.so.%{sover} lrslib.c lrsmp.c
 ln -s liblrsmp.so.%{ver} liblrsmp.so.%{sover}
 ln -s liblrsmp.so.%{sover} liblrsmp.so
 
 # Build the binaries against the GMP version of the library, except rat2float
-gcc $CFLAGS -DGMP lrs.c -o lrs -L. -llrsgmp
-gcc $CFLAGS -DGMP redund.c -o lrs-redund -L. -llrsgmp
-gcc $CFLAGS -DGMP nash.c -o lrs-nash -L. -llrsgmp -lgmp
-gcc $CFLAGS -DGMP fourier.c -o lrs-fourier -L. -llrsgmp -lgmp
-gcc $CFLAGS -DGMP setupnash.c -o lrs-setupnash -L. -llrsgmp
-gcc $CFLAGS -DGMP setupnash2.c -o lrs-setupnash2 -L. -llrsgmp
-gcc $CFLAGS -DLRSMP rat2float.c -o lrs-rat2float -L. -llrsmp
-gcc $CFLAGS float2rat.c -o lrs-float2rat
-gcc $CFLAGS buffer.c -o lrs-buffer
-gcc $CFLAGS 2gnash.c -o lrs-2gnash
+gcc $CFLAGS -DGMP lrs.c -o lrs $RPM_LD_FLAGS -L. -llrsgmp
+gcc $CFLAGS -DGMP redund.c -o lrs-redund $RPM_LD_FLAGS -L. -llrsgmp
+gcc $CFLAGS -DGMP nash.c -o lrs-nash $RPM_LD_FLAGS -L. -llrsgmp -lgmp
+gcc $CFLAGS -DGMP fourier.c -o lrs-fourier $RPM_LD_FLAGS -L. -llrsgmp -lgmp
+g++ $CFLAGS -DGMP -DPLRS plrs.cpp lrslib.c lrsgmp.c -o plrs $RPM_LD_FLAGS \
+    -L. -llrsgmp -lgmp -lboost_thread
+gcc $CFLAGS -DGMP redund.c -o lrs-redund $RPM_LD_FLAGS -L. -llrsgmp
+gcc $CFLAGS -DGMP setupnash.c -o lrs-setupnash $RPM_LD_FLAGS -L. -llrsgmp
+gcc $CFLAGS -DGMP setupnash2.c -o lrs-setupnash2 $RPM_LD_FLAGS -L. -llrsgmp
+gcc $CFLAGS -DLRSMP rat2float.c -o lrs-rat2float $RPM_LD_FLAGS -L. -llrsmp
+gcc $CFLAGS float2rat.c -o lrs-float2rat $RPM_LD_FLAGS
+gcc $CFLAGS 2nash.c -o lrs-2nash $RPM_LD_FLAGS
 
 %install
 # Install the libraries
@@ -108,7 +107,7 @@ cp -a liblrs*.so* $RPM_BUILD_ROOT%{_libdir}
 
 # Install the binaries
 mkdir -p $RPM_BUILD_ROOT%{_bindir}
-cp -p lrs lrs-* $RPM_BUILD_ROOT%{_bindir}
+cp -p lrs plrs lrs-* $RPM_BUILD_ROOT%{_bindir}
 
 # Install the header files, but alter them to reflect 32-/64-bitness and fix
 # up the include directives.
@@ -142,19 +141,27 @@ done
 %postun -p /sbin/ldconfig
 
 %files
-%doc COPYING readme
+%doc readme
+%license COPYING
 %{_libdir}/*.so.*
 
 %files devel
-%doc lrslib.html chdemo.c lpdemo.c vedemo.c
+%doc chdemo.c lpdemo.c vedemo.c
 %{_includedir}/%{name}
 %{_libdir}/*.so
 
 %files utils
 %{_bindir}/lrs*
+%{_bindir}/plrs
 %{_mandir}/man1/lrs*
 
 %changelog
+* Mon Nov 10 2014 Jerry James <loganjerry at gmail.com> - 5.0-1
+- New upstream release
+- Drop upstreamed -memleak patch
+- Link with RPM_LD_FLAGS
+- Fix license handling
+
 * Sun Aug 17 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 4.3-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
 
diff --git a/sources b/sources
index cefebd0..1f9bc35 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-86dd9a45d20a3a0069f77e61be5b46ad  lrslib-043.tar.gz
+9ef550ca753c2bf349901ff7a2d80df7  lrslib-050.tar.gz
 6d96329a9bd4d8101402444d71482084  lrslib-man.tar.xz


More information about the scm-commits mailing list