From 651a8e564df53d7760430d6d73c888fc975f2329 Mon Sep 17 00:00:00 2001
From: Marcus Alves Grando <mnag@FreeBSD.org>
Date: Wed, 22 Mar 2006 00:37:53 +0000
Subject: - Change master site to fix fetch [1] - math/atlas change default
 option to not compile static libs. Change scilab to use .so - Add OPTIONS to
 use or not use atlas and gtk2 interface [1] - portlint(1)

PR:		93695 [1]
Submitted by:	maintainer
---
 math/scilab/Makefile                               | 42 +++++++++++++++-------
 math/scilab/files/patch-Makefile.OBJ.in            | 11 ++++++
 .../files/patch-routines__graphics__periFig.c      | 18 ++++++++++
 .../files/patch-routines__graphics__periGtk.c      | 12 +++++++
 .../files/patch-routines__graphics__periPos.c      | 18 ++++++++++
 math/scilab/files/patch-routines__gtksci__x_main.c | 23 ++++++++++++
 math/scilab/pkg-plist                              |  5 +--
 7 files changed, 115 insertions(+), 14 deletions(-)
 create mode 100644 math/scilab/files/patch-Makefile.OBJ.in
 create mode 100644 math/scilab/files/patch-routines__graphics__periFig.c
 create mode 100644 math/scilab/files/patch-routines__graphics__periGtk.c
 create mode 100644 math/scilab/files/patch-routines__graphics__periPos.c
 create mode 100644 math/scilab/files/patch-routines__gtksci__x_main.c

diff --git a/math/scilab/Makefile b/math/scilab/Makefile
index 5aa3f77735f9..5b187f37efc2 100644
--- a/math/scilab/Makefile
+++ b/math/scilab/Makefile
@@ -7,16 +7,15 @@
 
 PORTNAME=	scilab
 PORTVERSION=	3.1.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	math cad parallel
-MASTER_SITES=	http://scilabsoft.inria.fr/download/stable/
+MASTER_SITES=	http://scilabsoft.inria.fr/download/${PORTVERSION}/
 EXTRACT_SUFX=	-src.tar.gz
 
 MAINTAINER=	js@jeannot.org
 COMMENT=	A free Matlab clone by INRIA & ENPC
 
 LIB_DEPENDS=	Xaw3d.${XAWVER}:${PORTSDIR}/x11-toolkits/Xaw3d \
-		f77blas.1:${PORTSDIR}/math/atlas \
 		lapack.3:${PORTSDIR}/math/lapack
 BUILD_DEPENDS=	pvm:${PORTSDIR}/net/pvm \
 		wish8.4:${PORTSDIR}/x11-toolkits/tk84 \
@@ -27,7 +26,8 @@ RUN_DEPENDS+=	pvm:${PORTSDIR}/net/pvm \
 PVM_ROOT=	${LOCALBASE}/lib/pvm
 
 GNU_CONFIGURE=	yes
-USE_REINPLACE=	yes
+USE_GETTEXT=	yes
+WANT_GNOME=	yes
 
 CONFIGURE_ARGS=	--with-tk \
 		--with-tk-library=${LOCALBASE}/lib \
@@ -39,7 +39,6 @@ CONFIGURE_ARGS=	--with-tk \
 		--with-xaw3d \
 		--x-include=${X11BASE}/include \
 		--x-libraries=${X11BASE}/lib \
-		--with-atlas-library=${LOCALBASE}/lib \
 		--without-java \
 		--without-ocaml
 
@@ -48,30 +47,49 @@ MAKE_ENV=	PVM_INCLUDE=${LOCALBASE}/include
 
 PLIST_SUB=	PORTVERSION="${PORTVERSION}" DOCSDIR="share/doc/scilab"
 
+OPTIONS=	ATLAS	"Use Atlas"		on \
+		GTK2	"Adds Gtk+2 support"	off
+
 .include <bsd.port.pre.mk>
 
+.if defined(WITH_GTK2)
+USE_GNOME=		pkgconfig gtk20 libgtkhtml vte
+CONFIGURE_ARGS+=	--with-gtk2
+PLIST_SUB+=		GTK2="" NOGTK2="@comment "
+.if ${OSVERSION} < 500000
+LIB_DEPENDS+=		readline.5:${PORTSDIR}/devel/readline
+.endif
+.else
+PLIST_SUB+=		GTK2="@comment " NOGTK2=""
+.endif
+
+.if !defined(WITHOUT_ATLAS)
+CONFIGURE_ARGS+=	--with-atlas-library=${LOCALBASE}/lib
+LIB_DEPENDS+=		f77blas.1:${PORTSDIR}/math/atlas
+.endif
+
 # Scilab broken with GCC 3.3 on FreeBSD 5.3
 .if ${OSVERSION} >= 503000 && ${OSVERSION} < 600000
 USE_GCC=	3.2
 .endif
 
 .if ${ARCH} == "alpha" && ${OSVERSION} >= 502102 || ${ARCH} == "sparc64"
-BROKEN=		"Does not compile on alpha 5.x or sparc64"
+BROKEN=		does not compile on alpha 5.x or sparc64
 .endif
 
 post-patch:
-	# malloc.h -> stdlib.h conversions
-	${GREP} -lr "<malloc.h>" ${WRKSRC} \
+	@# malloc.h -> stdlib.h conversions
+	@${GREP} -lr "<malloc.h>" ${WRKSRC} \
 		| ${XARGS} ${REINPLACE_CMD} -e \
 		's/[<"]malloc.h[>"]/<stdlib.h>/'
 .if defined(NOPORTDOCS)
-	${REINPLACE_CMD} -e 's/%%PORTDOCS%%/#/' ${WRKSRC}/Makefile.in
+	@${REINPLACE_CMD} -e 's/%%PORTDOCS%%/#/' ${WRKSRC}/Makefile.in
 .else
-	${REINPLACE_CMD} -e 's/%%PORTDOCS%%//' ${WRKSRC}/Makefile.in
+	@${REINPLACE_CMD} -e 's/%%PORTDOCS%%//' ${WRKSRC}/Makefile.in
 .endif
 
 pre-install:
-	${FIND} ${WRKSRC} -name \*.orig -delete
-	${FIND} ${WRKSRC} -name \*.bak -delete
+	@${FIND} ${WRKSRC} -name \*.orig -delete
+	@${FIND} ${WRKSRC} -name \*.bak -delete
 
 .include <bsd.port.post.mk>
diff --git a/math/scilab/files/patch-Makefile.OBJ.in b/math/scilab/files/patch-Makefile.OBJ.in
new file mode 100644
index 000000000000..5c3ddedc9f86
--- /dev/null
+++ b/math/scilab/files/patch-Makefile.OBJ.in
@@ -0,0 +1,11 @@
+--- Makefile.OBJ.in.orig	Tue Mar 21 15:35:41 2006
++++ Makefile.OBJ.in	Tue Mar 21 15:37:45 2006
+@@ -2,7 +2,7 @@
+ ATLASDIR=@ATLAS_DIR@
+ 
+ STD_BLAS=$(SCIDIR)/libs/blas.a  
+-ATLAS_LAPACKBLAS= $(ATLASDIR)/liblapack.a $(ATLASDIR)/libcblas.a $(ATLASDIR)/libf77blas.a $(ATLASDIR)/libatlas.a
++ATLAS_LAPACKBLAS= -L$(ATLASDIR) -lalapack -lcblas -lf77blas -latlas
+ 
+ BLAS=$(@WHICH_BLAS@) 
+ 
diff --git a/math/scilab/files/patch-routines__graphics__periFig.c b/math/scilab/files/patch-routines__graphics__periFig.c
new file mode 100644
index 000000000000..0013ab14d7b6
--- /dev/null
+++ b/math/scilab/files/patch-routines__graphics__periFig.c
@@ -0,0 +1,18 @@
+--- ./routines/graphics/periFig.c.orig	Tue Mar 21 19:22:44 2006
++++ ./routines/graphics/periFig.c	Tue Mar 21 19:22:57 2006
+@@ -1176,6 +1176,7 @@
+   integer rect[4], font=-1,font_flag=2;
+   integer verbose=0,Dnarg,Dvalue1[10];
+   int pen_color;
++  int alloc;
+ 
+   if ( ScilabGCXfig_is_initialized == FALSE ) {
+     sciprint("xinit must be called before any action \r\n");
+@@ -1183,7 +1184,6 @@
+   }
+ 
+ #ifdef WITH_GTK
+-  int alloc;
+   string = sci_convert_from_utf8(string, &alloc,NULL);
+ #endif 
+   C2F(boundingboxXfig)(string,x,y,rect,PI0,PI0,PI0,PD0,PD0,PD0,PD0);
diff --git a/math/scilab/files/patch-routines__graphics__periGtk.c b/math/scilab/files/patch-routines__graphics__periGtk.c
new file mode 100644
index 000000000000..dc285691beb8
--- /dev/null
+++ b/math/scilab/files/patch-routines__graphics__periGtk.c
@@ -0,0 +1,12 @@
+--- routines/graphics/periGtk.c.orig	Tue Mar 21 18:51:59 2006
++++ routines/graphics/periGtk.c	Tue Mar 21 18:52:33 2006
+@@ -862,8 +862,8 @@
+ static void xset_curwin(integer *intnum, integer *v2, integer *v3, integer *v4)
+ { 
+   struct BCG *bcgk;
+-  bcgk =  ScilabXgc ;
+   integer ierr;
++  bcgk =  ScilabXgc ;
+   /** send info to menu **/
+   if (v2 != (integer *) 0) MenuFixCurrentWin(*intnum);
+   if ( ScilabXgc == (struct BCG *) 0 ) 
diff --git a/math/scilab/files/patch-routines__graphics__periPos.c b/math/scilab/files/patch-routines__graphics__periPos.c
new file mode 100644
index 000000000000..4f1067180c02
--- /dev/null
+++ b/math/scilab/files/patch-routines__graphics__periPos.c
@@ -0,0 +1,18 @@
+--- ./routines/graphics/periPos.c.orig	Tue Mar 21 19:07:20 2006
++++ ./routines/graphics/periPos.c	Tue Mar 21 19:07:46 2006
+@@ -1225,6 +1225,7 @@
+ {     
+   integer i,rect[4] ;
+   int yn = (int) (*y + ascentPos());
++  int alloc;
+ 
+   if ( ScilabGCPos_is_initialized == FALSE ) {
+     sciprint("xinit must be called before any action \r\n");
+@@ -1232,7 +1233,6 @@
+   }
+   
+ #ifdef WITH_GTK
+-  int alloc;
+   /* we expect iso-latin1 in postscript */
+   string = sci_convert_from_utf8(string, &alloc,NULL);
+ #endif 
diff --git a/math/scilab/files/patch-routines__gtksci__x_main.c b/math/scilab/files/patch-routines__gtksci__x_main.c
new file mode 100644
index 000000000000..57337e371256
--- /dev/null
+++ b/math/scilab/files/patch-routines__gtksci__x_main.c
@@ -0,0 +1,23 @@
+--- ./routines/gtksci/x_main.c.orig	Tue Mar 21 19:50:48 2006
++++ ./routines/gtksci/x_main.c	Tue Mar 21 19:51:50 2006
+@@ -655,8 +655,8 @@
+   /* sciprint("GetScreenProperty not implemented in gtk 1\r\n"); */
+   return -1;
+ #else 
+-  start_sci_gtk();
+   GdkScreen *screen =  gdk_screen_get_default();
++  start_sci_gtk();
+   
+   if(!strcmp(prop,"screensize_px"))
+     {
+@@ -714,9 +714,9 @@
+   *iyres = 96;
+   return 0;
+ #else 
+-  start_sci_gtk();
+   GdkScreen *screen =  gdk_screen_get_default();
+   double xres, yres;
++  start_sci_gtk();
+   
+   /*
+    * there are 2.54 centimeters to an inch; so there are 25.4 millimeters.
diff --git a/math/scilab/pkg-plist b/math/scilab/pkg-plist
index e7adfa48476b..ac5442c2fc1d 100644
--- a/math/scilab/pkg-plist
+++ b/math/scilab/pkg-plist
@@ -14,7 +14,7 @@ lib/scilab/README_Unix
 lib/scilab/Version.incl
 lib/scilab/X11_defaults/.cvsignore
 lib/scilab/X11_defaults/README
-lib/scilab/X11_defaults/Xscilab
+%%NOGTK2%%lib/scilab/X11_defaults/Xscilab
 lib/scilab/X11_defaults/scilab.xpm
 lib/scilab/bin/.cvsignore
 lib/scilab/bin/.scicos_pal
@@ -43,6 +43,7 @@ lib/scilab/bin/wgscilabE.mnu
 lib/scilab/bin/wgscilabF.mnu
 lib/scilab/bin/wscilabE.mnu
 lib/scilab/bin/wscilabF.mnu
+%%GTK2%%lib/scilab/bin/zterm
 lib/scilab/config/.cvsignore
 lib/scilab/config/Makecygdll.incl
 lib/scilab/config/Makedll.incl
@@ -10763,7 +10764,7 @@ lib/scilab/routines/xsci/All-extern-x.h
 lib/scilab/routines/xsci/All-extern-x1.h
 lib/scilab/routines/xsci/All-extern.h
 lib/scilab/routines/xsci/All-static.h
-lib/scilab/routines/xsci/Xscilab.ad.h
+%%NOGTK2%%lib/scilab/routines/xsci/Xscilab.ad.h
 lib/scilab/routines/xsci/h_display.h
 lib/scilab/routines/xsci/h_help.ad.h
 lib/scilab/routines/xsci/jpc_defs.h
-- 
cgit debian/1.2.3+git2.25.1-1-2-gaceb0