ports/132430: science/netcdf: fix and make packageable WITH_FORTRAN

Thierry Thomas thierry at FreeBSD.org
Sun Mar 8 20:20:02 UTC 2009


>Number:         132430
>Category:       ports
>Synopsis:       science/netcdf: fix and make packageable WITH_FORTRAN
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 08 20:20:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Thierry Thomas
>Release:        FreeBSD 7.1-STABLE i386
>Organization:
Kabbale Eros
>Environment:
System: FreeBSD graf.pompo.net 7.1-STABLE FreeBSD 7.1-STABLE #0: Tue Feb 3 22:52:14 CET 2009 thierry at graf.pompo.net:/usr/obj/usr/src/sys/GRAF071102 i386


	
>Description:
	1) When you set the option WITH_FORTRAN, the port builds fine,
	but the consumer program cannot link with libnetcdff: it gives
	this kind of errors:

	/usr/local/lib/libnetcdff.a(netcdf.o)(.text+0x1b): In function `nf90_inq_libvers':
	/usr/ports/science/netcdf-ftn/work/netcdf-3.6.3/f90/netcdf_file.f90:5: undefined reference to `nf_inq_libvers_'
	/usr/local/lib/libnetcdff.a(netcdf.o)(.text+0x56): In function `nf90_strerror':
	/usr/ports/science/netcdf-ftn/work/netcdf-3.6.3/f90/netcdf_file.f90:12: undefined reference to `nf_strerror_'
	/usr/local/lib/libnetcdff.a(netcdf.o)(.text+0x8e): In function `nf90_inq_base_pe':
	/usr/ports/science/netcdf-ftn/work/netcdf-3.6.3/f90/netcdf_file.f90:23: undefined reference to `nf_inq_base_pe_'
	/usr/local/lib/libnetcdff.a(netcdf.o)(.text+0xb2): In function `nf90_set_base_pe':
	/usr/ports/science/netcdf-ftn/work/netcdf-3.6.3/f90/netcdf_file.f90:30: undefined reference to `nf_set_base_pe_'
	/usr/local/lib/libnetcdff.a(netcdf.o)(.text+0x107): In function `nf90_create':
	etc.

	(same result with the shared library)

	To fix this problem, -Df2cFortran must be replaced by -DpgiFortran.

	Note: %%FORTRAN%%include/netcdf.inc must also be added to plist.

	2) This option WITH_FORTRAN is off by default, and other ports
	which could use it cannot be packaged (e.g. the new version of
	science/abinit). The simplest solution to solve this problem would
	be to bump PORTREVISION and to default this option to on, but if
	for some reason the maintainer does not like this idea, another
	solution is to create a slave port for netcdf with Fortran support.

	Attached is a diff and a shar file for the new slave port.

>How-To-Repeat:
	Try to link a program with libnetcdff.

>Fix:
	- either apply the following patch and create the new slave port
	from the shar file;

	- or just:
	  . bump PORTREVISION;
	  . default the optin WITH_FORTRAN to on;
	  . s/-Df2cFortran/-DpgiFortran/;
	  . fix pkg-plist.

--- netcdf.diff begins here ---
diff -urN science/netcdf.orig/Makefile science/netcdf/Makefile
--- science/netcdf.orig/Makefile	2009-01-21 08:29:15.000000000 +0100
+++ science/netcdf/Makefile	2009-03-08 14:23:39.000000000 +0100
@@ -13,17 +13,19 @@
 		http://sunpoet.net/distfiles/
 
 MAINTAINER=	sunpoet at sunpoet.net
-COMMENT=	Library for machine-independent, array-oriented data access
+COMMENT?=	Library for machine-independent, array-oriented data access
 
 CONFLICTS=	hdf-4.* netcdf-4.*
 
 CONFIGURE_ARGS=	--enable-shared
-CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include -fPIC -DPIC -Df2cFortran"
+CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include -fPIC -DPIC ${FTNTYPE}"
 
 GNU_CONFIGURE=	yes
 USE_LDCONFIG=	yes
 #CONFIGURE_ENV+=	${MAKE_ENV}
 
+SLAVEDIRS=	science/netcdf-ftn
+
 MAN1=		ncdump.1 ncgen.1
 MAN3=		netcdf.3
 
@@ -49,9 +51,13 @@
 
 .if defined(WITH_FORTRAN)
 USE_FORTRAN=	yes
+PKGNAMESUFFIX+=	-ftn
+CONFLICTS+=	netcdf-3.*
 MAN3+=		netcdf_f77.3 netcdf_f90.3
 PLIST_SUB+=	FORTRAN=""
+FTNTYPE=	-DpgiFortran
 .else
+CONFLICTS+=	netcdf-ftn-3.*
 CONFIGURE_ARGS+=--disable-f77
 PLIST_SUB+=	FORTRAN="@comment "
 .endif
diff -urN science/netcdf.orig/pkg-plist science/netcdf/pkg-plist
--- science/netcdf.orig/pkg-plist	2009-01-13 19:33:44.000000000 +0100
+++ science/netcdf/pkg-plist	2009-03-08 16:24:40.000000000 +0100
@@ -3,6 +3,7 @@
 include/ncvalues.h
 include/netcdf.h
 include/netcdf.hh
+%%FORTRAN%%include/netcdf.inc
 %%FORTRAN%%include/netcdf.mod
 include/netcdfcpp.h
 %%FORTRAN%%include/typesizes.mod
--- netcdf.diff ends here ---

--- netcdf-ftn.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	science/netcdf-ftn
#	science/netcdf-ftn/Makefile
#
echo c - science/netcdf-ftn
mkdir -p science/netcdf-ftn > /dev/null 2>&1
echo x - science/netcdf-ftn/Makefile
sed 's/^X//' >science/netcdf-ftn/Makefile << '3ac4cf10fbfd950ab8f974d3d140c9a3'
X# New ports collection makefile for:	netcdf-ftn
X# Date created:		Sun Mar 08 2009
X# Whom:			thierry at pompo.net
X#
X# $FreeBSD$
X#
X
XPORTNAME=	netcdf
X
XCOMMENT=	Network Common Data Form, with Fortran support
X
XMASTERDIR=	${.CURDIR}/../netcdf
X
XWITH_FORTRAN=	yes
X
X.include "${MASTERDIR}/Makefile"
3ac4cf10fbfd950ab8f974d3d140c9a3
exit
--- netcdf-ftn.shar ends here ---

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



More information about the freebsd-ports-bugs mailing list