Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 May 2014 07:57:44 GMT
From:      Frederic Han <han@math.jussieu.fr>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/189541: [Maintainer] math/giacxcas update
Message-ID:  <201405100757.s4A7vid0035331@cgiserv.freebsd.org>
Resent-Message-ID: <201405100800.s4A800Pn098090@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         189541
>Category:       ports
>Synopsis:       [Maintainer] math/giacxcas update
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 10 08:00:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Frederic Han
>Release:        10 and 11
>Organization:
Universite Paris 7
>Environment:
FreeBSD bsd11 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r265054: Mon Apr 28 19:28:37 UTC 2014     root@grind.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
. Fix the compilation problem in the HEAD branch:
http://beefy2.isc.freebsd.org/bulk/head-amd64-default/latest/logs/errors/giacxcas-1.1.0_4.log
. Update to the latest stable upstream version. (warning the upstream number has not changed. it is still 1.1.0 so I had to change the source entry
. Make the no cdrom entry match the string in LEGAL
. Add patches for a clang build BUT:
  without USE_GCC, on both freebsd 10 and 11 make install gave bad binaries (immediate crash), while binaries in work/giacxcas-1.1.0/src were functional before make install. As I failed to solve this problem I still use gcc.
. NB: this version of giac is now compatible with ntl 6, but with USE_GCC and ntl in Freebsd>10 the build is broken with unknown symbols from ntl. I tried with a ntl port modified with USE_GCC and then the problem was solved. So I let the disable ntl tag with freebsd>10.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -ruN giacxcas.orig/Makefile giacxcas/Makefile
--- giacxcas.orig/Makefile	2014-04-23 15:25:16.000000000 +0200
+++ giacxcas/Makefile	2014-05-07 19:31:30.000000000 +0200
@@ -3,10 +3,10 @@
 
 PORTNAME=	giacxcas
 PORTVERSION=	1.1.0
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	math
-MASTER_SITES=	http://www-fourier.ujf-grenoble.fr/~parisse/giac/freebsd/ \
-		http://www.math.jussieu.fr/~han/xcas/sources/
+MASTER_SITES=	http://www-fourier.ujf-grenoble.fr/~parisse/giac/ \
+		http://www.math.jussieu.fr/~han/xcas/sources/v2/
 DISTFILES=	fltk-giac.tar.gz CoCoALib-0.9950.tgz giac-${PORTVERSION}.tar.gz
 DIST_SUBDIR=	${PORTNAME}
 
@@ -19,13 +19,13 @@
 		${LOCALBASE}/lib/libntl.a:${PORTSDIR}/math/ntl
 LIB_DEPENDS=	libgmp.so:${PORTSDIR}/math/gmp \
 		libpng.so:${PORTSDIR}/graphics/png \
-                libjpeg.so:${PORTSDIR}/graphics/jpeg \
+		libjpeg.so:${PORTSDIR}/graphics/jpeg \
 		libpari.so:${PORTSDIR}/math/pari \
 		libmpfr.so:${PORTSDIR}/math/mpfr \
 		libgsl.so:${PORTSDIR}/math/gsl \
 		liblapack.so:${PORTSDIR}/math/lapack
 
-NO_CDROM=	French documentation is for non-commercial use only
+NO_CDROM=	The french documentation is for non commercial only use
 
 GNU_CONFIGURE=	yes
 USES=		desktop-file-utils gettext gmake libtool:keepla shebangfix
@@ -33,6 +33,7 @@
 USE_XORG=	x11 xcursor xft xi
 USE_TEX=	latex:build dvipsk:build
 USE_LDCONFIG=	yes
+# Warning:  don't remove the USE_GCC without a runtime test *after* make install
 USE_GCC=	yes
 DOCSDIR=	${PREFIX}/share/doc/giac
 PORTDOCS=	*
@@ -53,6 +54,8 @@
 
 .include <bsd.port.options.mk>
 
+#NB: built of giacxcas with USE_GCC and nlt is successfull if the ntl port is also
+#    installed  with USE_GCC
 .if ${OSVERSION} >= 1000000
 CONFIGURE_ARGS+=	--disable-ntl
 .endif
@@ -73,6 +76,6 @@
 	${GMAKE} library && \
 	cd ${FLTKDEV-GIAC} && \
 	./configure --prefix=${FLTKDEV-GIAC} \
-	&& ${MAKE}
+	&& cd src && ${MAKE}
 
 .include <bsd.port.mk>
diff -ruN giacxcas.orig/distinfo giacxcas/distinfo
--- giacxcas.orig/distinfo	2014-01-22 16:30:13.000000000 +0100
+++ giacxcas/distinfo	2014-05-07 19:03:52.000000000 +0200
@@ -2,5 +2,5 @@
 SIZE (giacxcas/fltk-giac.tar.gz) = 4776876
 SHA256 (giacxcas/CoCoALib-0.9950.tgz) = b30d840593e1930c1629467918b508c429e0a983ef0d1343eab570f238275678
 SIZE (giacxcas/CoCoALib-0.9950.tgz) = 4120680
-SHA256 (giacxcas/giac-1.1.0.tar.gz) = 23eaad028abc2e5453c8ad5029c5610e4f051f9385973832ec0785cf6cbfe5eb
-SIZE (giacxcas/giac-1.1.0.tar.gz) = 45684044
+SHA256 (giacxcas/giac-1.1.0.tar.gz) = 2464613ff477a6f7c53dc5dfba6015bf2320ce634742a2aa4aeb8c7196eae6ef
+SIZE (giacxcas/giac-1.1.0.tar.gz) = 46376334
diff -ruN giacxcas.orig/files/patch-src-Graph3d.cc giacxcas/files/patch-src-Graph3d.cc
--- giacxcas.orig/files/patch-src-Graph3d.cc	1970-01-01 01:00:00.000000000 +0100
+++ giacxcas/files/patch-src-Graph3d.cc	2014-05-01 10:37:06.000000000 +0200
@@ -0,0 +1,19 @@
+--- src/Graph3d.cc.orig	2014-05-01 10:34:20.000000000 +0200
++++ src/Graph3d.cc	2014-05-01 10:22:33.000000000 +0200
+@@ -582,7 +582,7 @@
+   // surface without grid evaluation, should not happen!
+   void glsurface(const vecteur & point,const gen & uv,double umin,double umax,double vmin,double vmax,int nu,int nv,int draw_mode,GIAC_CONTEXT){
+     double u=umin,v=vmin,deltau=(umax-umin)/nu,deltav=(vmax-vmin)/nv;
+-    gen prevline[nv+1];//,line[nv+1];
++    gen * prevline=new gen[nv+1];//,line[nv+1]; //cf clang
+     vecteur curuv(2);
+     gen old,current;
+     curuv[0]=u;
+@@ -615,6 +615,7 @@
+ 	cerr << endl;
+       */
+     }
++    delete [] prevline; //cf clang
+   }
+ 
+   unsigned int line_stipple(unsigned int i){
diff -ruN giacxcas.orig/files/patch-src-gausspol.h giacxcas/files/patch-src-gausspol.h
--- giacxcas.orig/files/patch-src-gausspol.h	1970-01-01 01:00:00.000000000 +0100
+++ giacxcas/files/patch-src-gausspol.h	2014-05-01 12:47:05.000000000 +0200
@@ -0,0 +1,20 @@
+--- src/gausspol.h.orig	2014-05-01 12:46:28.000000000 +0200
++++ src/gausspol.h	2014-05-01 12:36:38.000000000 +0200
+@@ -440,7 +440,7 @@
+     U u,prevu=0;
+     int k;
+     int count=0;
+-#if defined(GIAC_NO_OPTIMIZATIONS) || ((defined(VISUALC) || defined(__APPLE__)) && !defined(GIAC_VECTOR))
++#if defined(GIAC_NO_OPTIMIZATIONS) || ((defined(VISUALC) || defined(__APPLE__) ||defined(__clang__)) && !defined(GIAC_VECTOR))
+     if (0){ count=0; }
+ #else
+     if (pdim<=POLY_VARS){
+@@ -551,7 +551,7 @@
+       convert_from<T,U>(it,itend,deg,jt,0); 
+       return;
+     }
+-#if defined(HAVE_PTHREAD_H) && !defined(EMCC)
++#if defined(HAVE_PTHREAD_H) && !defined(EMCC) &&!defined(__clang__)
+     unsigned taille=itend-it;
+     if (nthreads>1 
+ 	&& int(taille)>nthreads*1000
diff -ruN giacxcas.orig/files/patch-src-index.cc giacxcas/files/patch-src-index.cc
--- giacxcas.orig/files/patch-src-index.cc	1970-01-01 01:00:00.000000000 +0100
+++ giacxcas/files/patch-src-index.cc	2014-05-01 10:55:46.000000000 +0200
@@ -0,0 +1,11 @@
+--- src/index.cc.orig	2014-05-01 10:55:21.000000000 +0200
++++ src/index.cc	2014-05-01 10:54:07.000000000 +0200
+@@ -339,7 +339,7 @@
+     return true;
+   }
+ 
+-#if !defined(GIAC_NO_OPTIMIZATIONS) && (defined(GIAC_VECTOR) || (!defined(VISUALC) && !defined(__APPLE__) && !defined(BESTA_WIN32_TARGET)))
++#if !defined(GIAC_NO_OPTIMIZATIONS) && (defined(GIAC_VECTOR) || (!defined(VISUALC)&& !defined(__clang__) && !defined(__APPLE__) && !defined(BESTA_WIN32_TARGET)))
+   index_t index_m::iref() const { 
+     if ( (taille % 2)==0)
+       return riptr->i;
diff -ruN giacxcas.orig/files/patch-src-index.h giacxcas/files/patch-src-index.h
--- giacxcas.orig/files/patch-src-index.h	1970-01-01 01:00:00.000000000 +0100
+++ giacxcas/files/patch-src-index.h	2014-05-01 12:26:01.000000000 +0200
@@ -0,0 +1,20 @@
+--- src/index.h.orig	2013-11-28 09:39:20.000000000 +0100
++++ src/index.h	2014-05-01 12:12:57.000000000 +0200
+@@ -36,7 +36,7 @@
+ #endif
+ ///////////////////////////////////////////
+ 
+-#if defined UNORDERED_MAP && !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(VISUALC)
++#if defined UNORDERED_MAP && !defined(__APPLE__) && !defined(__clang__) && !defined(VISUALC)
+ #include <tr1/unordered_map>
+ #define HASH_MAP_NAMESPACE std::tr1
+ #define hash_map unordered_map
+@@ -243,7 +243,7 @@
+   // capacity of deg_t by direct addressing
+   const int POLY_VARS=POLY_VARS_DIRECT+POLY_VARS_OTHER-1;
+ 
+-#if defined(GIAC_NO_OPTIMIZATIONS) || ((defined(VISUALC) || defined(__APPLE__)) && !defined(GIAC_VECTOR))
++#if defined(GIAC_NO_OPTIMIZATIONS) || ((defined(VISUALC) || defined(__APPLE__) ||defined(__clang__)) && !defined(GIAC_VECTOR))
+   class index_m {
+   public:
+     ref_index_t * riptr;
diff -ruN giacxcas.orig/files/patch-src-modfactor.cc giacxcas/files/patch-src-modfactor.cc
--- giacxcas.orig/files/patch-src-modfactor.cc	1970-01-01 01:00:00.000000000 +0100
+++ giacxcas/files/patch-src-modfactor.cc	2014-05-01 13:31:18.000000000 +0200
@@ -0,0 +1,26 @@
+--- src/modfactor.cc.orig	2014-05-01 13:30:20.000000000 +0200
++++ src/modfactor.cc	2014-05-01 13:29:26.000000000 +0200
+@@ -1316,11 +1316,13 @@
+     }
+     try {
+       int n=q.lexsorted_degree();
+-      inttype tab[n+1]; // dense rep of the polynomial
++      inttype * tab=new inttype[n+1]; // dense rep of the polynomial
+       inttype * result[n]; // array of dense rep of the polynomial
+       int resultdeg[n];
+-      if (!polynome2tab(q,n,tab))
++      if (!polynome2tab(q,n,tab)){
++	delete [] tab; //cf clang
+ 	return false;
++      }
+       // cerr << "NTL factor begins" << endl;
+       int size=ntlfactor(tab,n,result,resultdeg,debug); 
+       // cerr << "NTL factor end" << endl;
+@@ -1329,6 +1331,7 @@
+ 	v.push_back(tab2polynome(result[i],resultdeg[i]));
+ 	delete [] result[i];
+       }
++      delete [] tab; // cf clang
+     } catch (std::runtime_error & e){
+     }
+ #ifdef HAVE_LIBPTHREAD
diff -ruN giacxcas.orig/files/patch-src-modpoly.cc giacxcas/files/patch-src-modpoly.cc
--- giacxcas.orig/files/patch-src-modpoly.cc	1970-01-01 01:00:00.000000000 +0100
+++ giacxcas/files/patch-src-modpoly.cc	2014-05-01 13:30:47.000000000 +0200
@@ -0,0 +1,33 @@
+--- src/modpoly.cc.orig	2014-05-01 13:30:07.000000000 +0200
++++ src/modpoly.cc	2014-05-01 13:29:45.000000000 +0200
+@@ -4455,12 +4455,17 @@
+       return giac_gcd_modular_algo1(p,q,d);
+     bool res=true;
+     try {
+-      inttype tabp[np+1]; // dense rep of the polynomial
+-      if (!polynome2tab(p,np,tabp))
++      inttype * tabp=new inttype[np+1]; // dense rep of the polynomial
++      if (!polynome2tab(p,np,tabp)){
++	delete [] tabp; //cf clang
+ 	return false;
+-      inttype tabq[nq+1]; // dense rep of the polynomial
+-      if (!polynome2tab(q,nq,tabq))
++      }
++      inttype * tabq=new inttype[nq+1]; // dense rep of the polynomial
++      if (!polynome2tab(q,nq,tabq)){
++	delete [] tabp; //cf clang
++	delete [] tabq; //cf clang
+ 	return false;
++      }
+       int nd;
+       inttype * res;
+       ntlgcd(tabp,np,tabq,nq,res,nd);
+@@ -4471,6 +4476,8 @@
+ 	p = p/d;
+ 	q = q/d;
+       }
++    delete [] tabp; // cf clang
++    delete [] tabq; // cf clang
+     } catch(std::runtime_error & e){
+       res=false;
+     }
diff -ruN giacxcas.orig/files/patch-src-threaded.h giacxcas/files/patch-src-threaded.h
--- giacxcas.orig/files/patch-src-threaded.h	1970-01-01 01:00:00.000000000 +0100
+++ giacxcas/files/patch-src-threaded.h	2014-05-01 10:45:06.000000000 +0200
@@ -0,0 +1,44 @@
+--- src/threaded.h.orig	2014-03-27 14:21:00.000000000 +0100
++++ src/threaded.h	2014-05-01 10:44:15.000000000 +0200
+@@ -300,7 +300,7 @@
+     return os << std::endl;
+   }
+ 
+-#ifdef VISUALC
++#if defined VISUALC || defined __clang__
+   template<class T>
+   class vector_size64:public std::vector<T>{
+   };
+@@ -1869,7 +1869,7 @@
+     // degree of product wrt to the main variable
+     // will launch deg1v+1 threads to compute each degree
+     pthread_t tab[deg1v+1];
+-    threadmult_t<T,U> arg[deg1v+1];
++    threadmult_t<T,U> * arg=new threadmult_t<T,U>[deg1v+1];//pr clang
+     possible_size=0;
+     int res=0;
+     int i=deg1v;
+@@ -1940,6 +1940,7 @@
+ 	res=pthread_create(&tab[i],(pthread_attr_t *) NULL,do_threadmult<T,U>,(void *) &arg[i]);
+ 	if (res){
+ 	  // should cancel previous threads and delete created arg[i].vptr
++	  delete [] arg;//pr clang
+ 	  return false;
+ 	}
+       } // end initial thread creation
+@@ -1973,6 +1974,7 @@
+ 		res=pthread_create(&tab[i],(pthread_attr_t *) NULL,do_threadmult<T,U>,(void *) &arg[i]);
+ 		if (res){
+ 		  // should cancel previous threads and delete created arg[i].vptr
++		  delete [] arg; //cf clang
+ 		  return false;
+ 		}
+ 		in_progress[j]=i;
+@@ -2051,6 +2053,7 @@
+     }
+     if (debug_infolevel>30)
+       std::cerr << "End copy " << clock() << std::endl;
++    delete [] arg; //cf clang
+     return true;
+   }
+ 
diff -ruN giacxcas.orig/pkg-plist giacxcas/pkg-plist
--- giacxcas.orig/pkg-plist	2014-01-22 16:16:56.000000000 +0100
+++ giacxcas/pkg-plist	2014-05-01 17:27:53.000000000 +0200
@@ -74,6 +74,7 @@
 lib/libgiac.la
 lib/libgiac.so
 lib/libgiac.so.0
+lib/libgiac.so.0.0.0
 share/application-registry/xcas.applications
 share/applications/xcas.desktop
 share/icons/hicolor/256x256/apps/xcas.png


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405100757.s4A7vid0035331>