summaryrefslogtreecommitdiff
path: root/science/cdo/Makefile
blob: f5d9ff5928170a5f46e6f85124ce40fb0b228f4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# New ports collection makefile for:	CDO
# Date created:			29 May 2006
# Whom:				Sunpoet Po-Chuan Hsieh <sunpoet@sunpoet.net>
#
# $FreeBSD$
#

PORTNAME=	cdo
PORTVERSION=	1.5.2
CATEGORIES=	science
MASTER_SITES=	https://code.zmaw.de/attachments/download/1690/ \
		LOCAL/sunpoet

MAINTAINER=	sunpoet@FreeBSD.org
COMMENT=	Climate Data Operators

OPTIONS=	HDF5	"HDF5 support"		on \
		JASPER	"Japser support"	off \
		NETCDF	"NetCDF support"	on \
		PROJ	"PROJ support"		on \
		SZIP	"SZIP support"		on

CFLAGS+=	${PTHREAD_CFLAGS}
CPPFLAGS+=	-I${LOCALBASE}/include
CONFIGURE_ARGS=	--enable-cdi-lib --program-transform-name="" --with-zlib=/usr
CONFIGURE_ENV=	LDFLAGS="${LDFLAGS}"
GNU_CONFIGURE=	yes
LDFLAGS+=	-L${LOCALBASE}/lib ${PTHREAD_LIBS}
USE_GNOME=	gnomehack
USE_LDCONFIG=	yes

HDF5_VER?=	18
NETCDF_VER?=	4

.include <bsd.port.options.mk>

.if !defined(WITHOUT_NETCDF) && !defined(WITHOUT_HDF5) && ${NETCDF_VER} == 4 && ${HDF5_VER} == 16
IGNORE=		netCDF 4 requires HDF5 1.8
.endif

.if !defined(WITHOUT_NETCDF) && (${NETCDF_VER} == 4)
HDF5_VER=	18
WITH_HDF5=	yes
.endif

.if !defined(WITHOUT_HDF5)
CONFIGURE_ARGS+=--with-hdf5=${LOCALBASE}
WITH_SZIP=	yes
.if (${HDF5_VER} == 18)
LIB_DEPENDS+=	hdf5.7:${PORTSDIR}/science/hdf5-18
.else
LIB_DEPENDS+=	hdf5.0:${PORTSDIR}/science/hdf5
.endif
.endif

.if defined(WITH_JASPER)
CONFIGURE_ARGS+=--with-jasper=${LOCALBASE}
LIB_DEPENDS+=	jasper:${PORTSDIR}/graphics/jasper
.endif

.if !defined(WITHOUT_NETCDF)
CONFIGURE_ARGS+=--with-netcdf=${LOCALBASE}
.if (${NETCDF_VER} == 4)
LIB_DEPENDS+=	netcdf.7:${PORTSDIR}/science/netcdf4
.else
LIB_DEPENDS+=	netcdf.4:${PORTSDIR}/science/netcdf
.endif
PLIST_SUB=	NETCDF=""
.else
PLIST_SUB=	NETCDF="@comment "
.endif

.if !defined(WITHOUT_PROJ)
CONFIGURE_ARGS+=--with-proj=${LOCALBASE}
LIB_DEPENDS+=	proj.6:${PORTSDIR}/graphics/proj
.endif

.if !defined(WITHOUT_SZIP)
CONFIGURE_ARGS+=--with-szlib=${LOCALBASE}
LIB_DEPENDS+=	sz.2:${PORTSDIR}/science/szip
.endif

.include <bsd.port.pre.mk>

.if ${ARCH} != "sparc64"
CFLAGS+=	-DPTHREAD_MUTEXATTR_CONDATTR
.endif

post-patch:
.if !defined(WITHOUT_NETCDF)
	@${REINPLACE_CMD} \
		-e '/bin_PROGRAMS = / s|$$| cdotest|' \
		-e '/noinst_PROGRAMS = / s| cdotest||' \
			${WRKSRC}/src/Makefile.in
.endif

post-build:
.if !defined(WITHOUT_NETCDF)
	@cd ${WRKSRC}/src/ && ${SETENV} CDO_PATH=${WRKSRC}/src/cdo ${WRKSRC}/src/cdotest
.endif

regression-test:
	@cd ${WRKSRC}/ && ${SETENV} ${MAKE_ENV} ${MAKE} check

.include <bsd.port.post.mk>