aboutsummaryrefslogtreecommitdiffstats
path: root/science/hdf-java/Makefile
blob: 346f7f066b91e637a4bc48d08923d1074ceeb1e6 (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
# Created by: rfarmer@predatorlabs.net
# $FreeBSD$

PORTNAME=   hdf-java
PORTVERSION=    2.10
PORTREVISION=   1
CATEGORIES= science java
MASTER_SITES=   http://www.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/hdf-java-${PORTVERSION}/src/
DISTNAME=   ${PORTNAME}-${PORTVERSION}-source

MAINTAINER= ports@FreeBSD.org
COMMENT=    Java interface to HDF5

LIB_DEPENDS=    libhdf5.so:${PORTSDIR}/science/hdf5 \
        libjpeg.so:${PORTSDIR}/graphics/jpeg

USE_JAVA=   yes
JAVA_VERSION=   1.6 1.7
JAVA_BUILD= yes
JAVA_RUN=   yes

USES=       dos2unix gmake
DOS2UNIX_REGEX= .*/examples/.*Makefile.in

GNU_CONFIGURE=  yes
GNU_CONFIGURE_PREFIX=${STAGEDIR}${PREFIX}
GNU_CONFIGURE_MANPREFIX=${STAGEDIR}${PREFIX}
CONFIGURE_ARGS= --with-jdk=${JAVA_HOME}/include,${JAVA_HOME}/jre/lib/ \
        --with-hdf5=${LOCALBASE}/include \
        --with-libz=/lib \
        --with-libjpeg=${LOCALBASE} \
        --without-hdf4 \
        --without-h4toh5
USE_LDCONFIG=   yes

OPTIONS_DEFINE= SZIP DOCS
SZIP_DESC=  SZIP support (must match with science/hdf5)

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MSZIP}
CONFIGURE_ARGS+=    --with-libsz=${LOCALBASE}/lib
.else
CONFIGURE_ARGS+=    --without-libsz
.endif

.if ${PORT_OPTIONS:MDOCS}
ALL_TARGET= all javadocs
.endif

.include <bsd.port.pre.mk>

.if ${JAVA_PORT_VERSION} == "1.6.0"
PLIST_SUB+= JDK6=""
.else
PLIST_SUB+= JDK6="@comment "
.endif

post-patch:
    @${REINPLACE_CMD} -e 's|"/libhdf.$$LLEXT"|"${LOCALBASE}/lib"|' \
        -e 's|$$z_lib"/libz."$$LLEXT|"/lib/libz.so.*"|' \
        -e 's|$$sz_lib"/libsz."$$LLEXT|"${LOCALBASE}/lib/libsz.so.*"|' \
        -e 's|LLEXT="a"|LLEXT="so"|g' \
        -e 's|COPT="-shared"|COPT="-fPIC"|g' ${WRKSRC}/configure
    @${REINPLACE_CMD} -e 's|$$(JH45INSTALLDIR)/lib|${STAGEDIR}${JAVAJARDIR}|g' \
        -e 's|INSTALL_LIB |${INSTALL_LIB} |' \
        -e 's|cp |${INSTALL_DATA} |g' ${WRKSRC}/Makefile.in
    @${REINPLACE_CMD} -e \
        's|$$HDFJAVA"/lib/freebsd:"$$HDFJAVA"/lib/ext|${PREFIX}/lib"|' \
        -e 's|$$HDFJAVA"/lib|${JAVAJARDIR}"|g' \
        ${WRKSRC}/bin/hdfview.sh.in

post-build:
    @${REINPLACE_CMD} -e 's|${STAGEDIR}||' ${WRKSRC}/bin/hdfview.sh

post-install:
.if ${PORT_OPTIONS:MDOCS}
    @${MKDIR} ${STAGEDIR}${DOCSDIR}/UsersGuide
    (cd ${WRKSRC}/docs/hdfview/ && ${COPYTREE_SHARE} "UsersGuide" \
        ${STAGEDIR}${DOCSDIR}/)
    (cd ${WRKSRC}/docs/ && ${COPYTREE_SHARE} "javadocs" \
        ${STAGEDIR}${DOCSDIR}/)
.endif

regression-test: build
    @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} check

.include <bsd.port.post.mk>