From nobody@FreeBSD.org  Fri Aug 19 16:02:28 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7316B106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 19 Aug 2011 16:02:28 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 61F948FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 19 Aug 2011 16:02:28 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JG2SG1092036
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 19 Aug 2011 16:02:28 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p7JG2Rtt092034;
	Fri, 19 Aug 2011 16:02:27 GMT
	(envelope-from nobody)
Message-Id: <201108191602.p7JG2Rtt092034@red.freebsd.org>
Date: Fri, 19 Aug 2011 16:02:27 GMT
From: bf <bf@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATCH]math/scilab: fix buld with lang/gcc46, blas/lapack usage, and WITHOUT_GUI
X-Send-Pr-Version: www-3.1
X-GNATS-Notify: rfarmer@predatorlabs.net

>Number:         159917
>Category:       ports
>Synopsis:       [PATCH]math/scilab: fix buld with lang/gcc46, blas/lapack usage, and WITHOUT_GUI
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bf
>State:          feedback
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 19 16:10:09 UTC 2011
>Closed-Date:    
>Last-Modified:  Tue Sep 13 19:10:08 UTC 2011
>Originator:     bf
>Release:        
>Organization:
-
>Environment:
>Description:
--Fix a bug uncovered by exp-runs to evaluate the change of the default USE_GCC/FORTRAN compiler to lang/gcc46, as seen in:

http://pointyhat.FreeBSD.org/errorlogs/amd64-errorlogs/a.8-exp.20110808071730/scilab-5.3.3.log

The configure script is failing to set lt_prog_compiler_wl_F77='-Wl,',
and hence builds a broken local libtool that fails during linking.
This was "fixed" upstream by adding a workaround, for Linux and Debian derivatives only:

http://gitweb.scilab.org/?p=scilab.git;a=commit;h=90634e389092d082f6d6a8f37667c3b525dd093e

that doesn't address the real problem, which is that too many of the configure script tests depend on --with-gfortran being issued.  Circumvent the problem here by adding this to CONFIGURE_ARGS. PIC flags are now detected and added automatically, so remove addition to FFLAGS.   

--Whitespace fix on line 223.   

--Typo in post-install target comment

--Remove obsolete configure script option --with-atlas-library and properly inform configure script of blas and lapack libraries; fix a link line in one of the port Makefiles where a library was being linked with lapack but not with blas

--fix plist and build breakage when building the help index WITHOUT_GUI

--be more conservative in use of CFLAGS, and respect LDFLAGS

--add a test target, disabled by default because of unresolved i18n problems
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/math/scilab/Makefile,v
retrieving revision 1.80
diff -u -r1.80 Makefile
--- Makefile	4 Aug 2011 07:23:17 -0000	1.80
+++ Makefile	19 Aug 2011 14:40:27 -0000
@@ -30,8 +30,12 @@
 USE_GMAKE=	yes
 USE_LDCONFIG=	yes
 
-CFLAGS+=	-I${LOCALBASE}/include -L${LOCALBASE}/lib ${PTHREAD_LIBS}
-FFLAGS+=	-fPIC
+CPPFLAGS+=	-I${LOCALBASE}/include
+LDFLAGS+=	-L${LOCALBASE}/lib
+CONFIGURE_ARGS =	--with-gfortran
+CONFIGURE_ENV=	ac_cv_search_pthread_join="${PTHREAD_LIBS}" \
+	BLAS_LIBS="${BLAS_LIBS}" LAPACK_LIBS="${LAPACK_LIBS}" \
+	LDFLAGS="${LDFLAGS}"
 
 OPTIONS=	ATLAS "Use Atlas instead of Blas" OFF \
 		FFTW "Use FFTW" ON \
@@ -47,15 +51,15 @@
 .include <bsd.port.options.mk>
 
 .if defined(WITH_ATLAS)
-CONFIGURE_ARGS+=	--with-atlas-library=${LOCALBASE}/lib
 LIB_DEPENDS+=	atlas.2:${PORTSDIR}/math/atlas
-BLAS_LIBS=	-lalapack -lcblas -lf77blas -latlas
+BLAS_LIBS=	-lf77blas -latlas
+LAPACK_LIBS=	-lalapack -lcblas
 .else
 LIB_DEPENDS+=	lapack.4:${PORTSDIR}/math/lapack
 LIB_DEPENDS+=	blas.2:${PORTSDIR}/math/blas
-BLAS_LIBS?=	-llapack -lblas
+BLAS_LIBS?=	-lblas
+LAPACK_LIBS?=	-llapack
 .endif
-MAKE_ENV+=	BLAS_LIBS="-L${LOCALBASE}/lib ${BLAS_LIBS}"
 
 .if defined(WITHOUT_NLS)
 CONFIGURE_ARGS+=	--disable-build-localization
@@ -81,6 +85,8 @@
 			--without-hdf5 \
 			--without-xcos \
 			--disable-build-help
+CONFIGURE_ENV +=	JAVADOC="${TRUE}"
+PLIST_SUB+=		WITHOUT_GUI=""
 .else
 DISTFILES+=	${JGRAPHX_JAR}:jgraphx
 JGRAPHX_VERSION=	1.4.1.0
@@ -131,6 +137,7 @@
 CONFIGURE_ARGS+=	--with-jdk=${JAVA_HOME} \
 			--with-docbook=${LOCALBASE}/share/xsl/docbook \
 			--enable-build-help
+PLIST_SUB+=		WITHOUT_GUI="@comment "
 .endif
 
 .if !defined(WITHOUT_HELP)
@@ -220,7 +227,10 @@
 		${WRKSRC}/bin/scilab-adv-cli ${WRKSRC}/bin/scilab-cli
 	@${REINPLACE_CMD} -e 's|/usr/share/scilab|${DATADIR}|' ${WRKSRC}/desktop/scilab.desktop
 	@${REINPLACE_CMD} -e 's|/usr/share/scilab-cli|${DATADIR}|' \
-		${WRKSRC}/desktop/scilab-adv-cli.desktop ${WRKSRC}/desktop/scilab-cli.desktop 
+		${WRKSRC}/desktop/scilab-adv-cli.desktop ${WRKSRC}/desktop/scilab-cli.desktop
+.else
+	@${REINPLACE_CMD} -e '/^check-local:/,/^$$/s/scilab-adv-cli/scilab-cli/g' \
+		${WRKSRC}/Makefile.in
 .endif
 
 pre-install:
@@ -231,7 +241,7 @@
 .endif
 
 post-install:
-	@# Remove empty dirs in DATDIR/modules - they will be removed by the
+	@# Remove empty dirs in DATADIR/modules - they will be removed by the
 	@# toolbox uninstaller otherwise if 3rd party toolboxes are used
 	@${FIND} ${DATADIR}/modules -type d -empty -delete
 	@# plist for include/scilab
@@ -252,5 +262,12 @@
 		-not -path ${DATADIR}/.atoms\* -not -path ${DATADIR} | \
 		${SORT} -r | ${SED} -e 's,^${PREFIX}/,@dirrm ,' >> ${TMPPLIST}
 	@${ECHO_CMD} "@unexec rmdir %D/share/scilab 2>/dev/null || true" >> ${TMPPLIST}
+.if defined(WITHOUT_GUI)
+	@${TOUCH} ${DATADIR}/contrib/xcos_toolbox_skeleton/images/h5/.keep_me
+.endif
+
+check test: build
+	@cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${_MAKE_JOBS} \
+		${MAKE_ARGS} check
 
 .include <bsd.port.mk>
Index: pkg-plist
===================================================================
RCS file: /home/pcvs/ports/math/scilab/pkg-plist,v
retrieving revision 1.23
diff -u -r1.23 pkg-plist
--- pkg-plist	28 Jul 2011 18:07:09 -0000	1.23
+++ pkg-plist	9 Aug 2011 15:38:26 -0000
@@ -81,6 +81,7 @@
 %%DATADIR%%/contrib/xcos_toolbox_skeleton/help/en_US/tbx_sum.xml
 %%DATADIR%%/contrib/xcos_toolbox_skeleton/help/fr_FR/build_help.sce
 %%DATADIR%%/contrib/xcos_toolbox_skeleton/images/gif/TBX_SUM_c.gif
+%%WITHOUT_GUI%%%%DATADIR%%/contrib/xcos_toolbox_skeleton/images/h5/.keep_me
 %%DATADIR%%/contrib/xcos_toolbox_skeleton/images/svg/TBX_SUM_c.svg
 %%DATADIR%%/contrib/xcos_toolbox_skeleton/license.txt
 %%DATADIR%%/contrib/xcos_toolbox_skeleton/macros/buildmacros.sce
Index: files/patch-modules__arnoldi__Makefile.in
===================================================================
RCS file: files/patch-modules__arnoldi__Makefile.in
diff -N files/patch-modules__arnoldi__Makefile.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-modules__arnoldi__Makefile.in	9 Aug 2011 13:53:17 -0000
@@ -0,0 +1,11 @@
+--- modules/arnoldi/Makefile.in.orig	2011-07-20 04:15:42.000000000 -0400
++++ modules/arnoldi/Makefile.in	2011-08-09 09:52:07.000000000 -0400
+@@ -489,7 +489,7 @@
+ 
+ libsciarnoldi_la_FFLAGS = -I$(srcdir)/src/arpack/
+ pkglib_LTLIBRARIES = libsciarnoldi.la
+-libsciarnoldi_la_LDFLAGS = -version-number $(SCILAB_LIBRARY_VERSION) $(LAPACK_LIBS)
++libsciarnoldi_la_LDFLAGS = -version-number $(SCILAB_LIBRARY_VERSION) $(LAPACK_LIBS) $(BLAS_LIBS)
+ libsciarnoldi_la_SOURCES = $(ARNOLDI_FORTRAN_SOURCES) $(GATEWAY_C_SOURCES)
+ 
+ # For the code check (splint)


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->bf 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Fri Aug 19 16:10:20 UTC 2011 
Responsible-Changed-Why:  
Submitter has GNATS access (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=159917 
State-Changed-From-To: open->feedback 
State-Changed-By: edwin 
State-Changed-When: Fri Aug 19 16:10:24 UTC 2011 
State-Changed-Why:  
Awaiting maintainers feedback (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=159917 

From: Edwin Groothuis <edwin@FreeBSD.org>
To: rfarmer@predatorlabs.net
Cc: bug-followup@FreeBSD.org
Subject: Re: ports/159917: [PATCH]math/scilab: fix buld with lang/gcc46, blas/lapack usage, and WITHOUT_GUI
Date: Fri, 19 Aug 2011 16:10:22 UT

 Maintainer of math/scilab,
 
 Please note that PR ports/159917 has just been submitted.
 
 If it contains a patch for an upgrade, an enhancement or a bug fix
 you agree on, reply to this email stating that you approve the patch
 and a committer will take care of it.
 
 The full text of the PR can be found at:
     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/159917
 
 -- 
 Edwin Groothuis via the GNATS Auto Assign Tool
 edwin@FreeBSD.org

From: Chris Rees <crees@freebsd.org>
To: bf@freebsd.org, Rob Farmer <rfarmer@predatorlabs.net>
Cc: bug-followup@freebsd.org
Subject: Re: ports/159917: [PATCH]math/scilab: fix buld with lang/gcc46,
 blas/lapack usage, and WITHOUT_GUI
Date: Fri, 19 Aug 2011 18:09:19 +0100

 Hm, upstream were pretty good at paying attention to patches when I
 spoke to them last -- perhaps they'll fix it properly this time :)
 
 Chris

From: Rob Farmer <rfarmer@predatorlabs.net>
To: Chris Rees <crees@freebsd.org>
Cc: bf@freebsd.org, bug-followup@freebsd.org
Subject: Re: ports/159917: [PATCH]math/scilab: fix buld with lang/gcc46,
 blas/lapack usage, and WITHOUT_GUI
Date: Sun, 21 Aug 2011 01:00:57 -0700

 On Fri, Aug 19, 2011 at 10:09 AM, Chris Rees <crees@freebsd.org> wrote:
 > Hm, upstream were pretty good at paying attention to patches when I
 > spoke to them last -- perhaps they'll fix it properly this time :)
 >
 > Chris
 >
 
 I'm not sure exactly what part to send upstream - just the new patch
 or something more? I'm not very clear on libtool stuff. If
 --with-gfortran fixes it, then that seems right for the port - they
 are allowing the Intel Fortran/C compilers too.
 
 What's posted works for me, so go ahead and commit it.
 
 -- 
 Rob Farmer

From: Chris Rees <crees@freebsd.org>
To: Rob Farmer <rfarmer@predatorlabs.net>
Cc: bf@freebsd.org, bug-followup@freebsd.org
Subject: Re: ports/159917: [PATCH]math/scilab: fix buld with lang/gcc46,
 blas/lapack usage, and WITHOUT_GUI
Date: Sun, 21 Aug 2011 12:14:40 +0100

 On 21 August 2011 09:00, Rob Farmer <rfarmer@predatorlabs.net> wrote:
 > On Fri, Aug 19, 2011 at 10:09 AM, Chris Rees <crees@freebsd.org> wrote:
 >> Hm, upstream were pretty good at paying attention to patches when I
 >> spoke to them last -- perhaps they'll fix it properly this time :)
 >>
 >> Chris
 >>
 >
 > I'm not sure exactly what part to send upstream - just the new patch
 > or something more? I'm not very clear on libtool stuff. If
 > --with-gfortran fixes it, then that seems right for the port - they
 > are allowing the Intel Fortran/C compilers too.
 >
 > What's posted works for me, so go ahead and commit it.
 
 Ugh, libtool, I'll stay well away.
 
 Sorry for the noise,
 
 Chris

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/159917: commit references a PR
Date: Tue, 23 Aug 2011 08:28:20 +0000 (UTC)

 bf          2011-08-23 08:28:05 UTC
 
   FreeBSD ports repository
 
   Modified files:
     math/scilab          Makefile pkg-plist 
   Added files:
     math/scilab/files    patch-modules__arnoldi__Makefile.in 
   Log:
   fix build with lang/gcc46 [1]; fix use of blas and lapack;
   fix WITHOUT_GUI; minor clean-up
   
   Reported by:    pav,gerald [1]
   PR:             159917
   Approved by:    Rob Farmer (maintainer)
   
   Revision  Changes    Path
   1.81      +26 -9     ports/math/scilab/Makefile
   1.1       +11 -0     ports/math/scilab/files/patch-modules__arnoldi__Makefile.in (new)
   1.24      +1 -0      ports/math/scilab/pkg-plist
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: "b. f." <bf1783@googlemail.com>
To: Chris Rees <crees@freebsd.org>
Cc: Rob Farmer <rfarmer@predatorlabs.net>, bf@freebsd.org, bug-followup@freebsd.org
Subject: Re: ports/159917: [PATCH]math/scilab: fix buld with lang/gcc46,
 blas/lapack usage, and WITHOUT_GUI
Date: Tue, 13 Sep 2011 15:07:01 -0400

 On 8/21/11, Chris Rees <crees@freebsd.org> wrote:
 > On 21 August 2011 09:00, Rob Farmer <rfarmer@predatorlabs.net> wrote:
 >> On Fri, Aug 19, 2011 at 10:09 AM, Chris Rees <crees@freebsd.org> wrote:
 >>> Hm, upstream were pretty good at paying attention to patches when I
 >>> spoke to them last -- perhaps they'll fix it properly this time :)
 >>>
 >>> Chris
 >>>
 >>
 >> I'm not sure exactly what part to send upstream - just the new patch
 >> or something more? I'm not very clear on libtool stuff. If
 >> --with-gfortran fixes it, then that seems right for the port - they
 >> are allowing the Intel Fortran/C compilers too.
 >>
 >> What's posted works for me, so go ahead and commit it.
 >
 > Ugh, libtool, I'll stay well away.
 >
 > Sorry for the noise,
 
 It's a good suggestion to contact upstream about this and a few other
 problems.  I intended to to this anyway, but I've been busy. I haven't
 closed the PR because I spotted some additional problems that I fixed
 but haven't had time to test.  I'll let you know when I get a chance.
 
 b.
>Unformatted:
