aboutsummaryrefslogtreecommitdiffstats
path: root/cad/gmsh/Makefile
blob: 8f4689fc4b4799880324215a9556acfa8315f4d3 (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# New ports collection makefile for:  gmsh
# Date created:               19 April 2003
# Whom:                       Pedro Giffuni <giffunip@asme.org>
#
# $FreeBSD$
#

PORTNAME=   gmsh
PORTVERSION=    2.5.0
PORTREVISION=   1
CATEGORIES= cad
MASTER_SITES=   http://www.geuz.org/gmsh/src/ \
        http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/
DISTNAME=   ${PORTNAME}-${PORTVERSION}-source
EXTRACT_SUFX=   .tgz
DISTFILES=  ${DISTNAME}${EXTRACT_SUFX}
DIST_SUBDIR=    gmsh
EXTRACT_ONLY=   ${DISTNAME}${EXTRACT_SUFX}

MAINTAINER= stephen@FreeBSD.org
COMMENT=    An automatic 3D finite element mesh generator

LIB_DEPENDS=    fltk.1:${PORTSDIR}/x11-toolkits/fltk \
        jpeg.11:${PORTSDIR}/graphics/jpeg \
        lapack.4:${PORTSDIR}/math/lapack

WRKSRC=     ${WRKDIR}/${PORTNAME}-${PORTVERSION}-source

SLAVEDIRS=  cad/gmsh-occ

USE_FORTRAN=    yes
USE_CMAKE=  yes
USE_GMAKE=  yes
USE_GL=     yes
ALL_TARGET= all

MAN1=       gmsh.1

CMAKE_ARGS+=    -DCMAKE_SKIP_RPATH:BOOL=YES \
        -DCMAKE_VERBOSE_MAKEFILE:BOOL=YES

.if !defined(WITHOUT_STATIC_LIB)
ALL_TARGET+=    lib
PLIST_SUB+= STATIC_LIB=""
.else
PLIST_SUB+= STATIC_LIB="@comment "
.endif

.if !defined(WITHOUT_SHARED_LIB)
ALL_TARGET+=    shared
PLIST_SUB+= SHARED_LIB=""
USE_LDCONFIG=   yes
.else
PLIST_SUB+= SHARED_LIB="@comment "
.endif

.if defined(NOPORTDOCS)
CMAKE_ARGS+=    -DINSTALL_DOCS=OFF
.endif

.if defined(WITHOUT_TETGEN)
CMAKE_ARGS+=    -DENABLE_TETGEN=OFF
.else
CMAKE_ARGS+=    -DENABLE_TETGEN=ON
.endif

# Even though the taucs port pulls in the metis port, we will still need
# WITHOUT_METIS not set when WITH_TAUCS is set, otherwise the linker
# does not find the libraries installed by the metis port.
.if defined(WITH_TAUCS) && defined(WITHOUT_METIS)
IGNORE=     requires that WITHOUT_METIS is not set if WITH_TAUCS is set
.endif

.if !defined(WITHOUT_METIS)
CMAKE_ARGS+=    -DENABLE_METIS=ON
.if defined(NOPORTDOCS)
IGNORE=     the license for Metis requires that its documentation is included
.endif
DISTFILES+= manual.pdf
PLIST_SUB+= METIS=""
.else
CMAKE_ARGS+=    -DENABLE_METIS=OFF
PLIST_SUB+= METIS="@comment "
.endif

.if defined(WITH_TAUCS)
LIB_DEPENDS+=   taucs.1:${PORTSDIR}/math/taucs
CMAKE_ARGS+=    -DENABLE_TAUCS=ON
.else
CMAKE_ARGS+=    -DENABLE_TAUCS=OFF
.endif

.if !defined(WITHOUT_MED)
LIB_DEPENDS+=   med.2:${PORTSDIR}/french/med
CMAKE_ARGS+=    -DENABLE_MED=ON
.else
CMAKE_ARGS+=    -DENABLE_MED=OFF
.endif

.if !defined(WITHOUT_CGNS)
LIB_DEPENDS+=   cgns.0:${PORTSDIR}/science/cgnslib
CMAKE_ARGS+=    -DENABLE_CGNS=ON
.else
CMAKE_ARGS+=    -DENABLE_CGNS=OFF
.endif

.if defined(WITHOUT_GMM)
CMAKE_ARGS+=    -DENABLE_GMM=OFF
.endif

.if defined(WITH_OCC)
LIB_DEPENDS+=   TKernel.0:${PORTSDIR}/cad/opencascade
CMAKE_ARGS+=    -DENABLE_OCC=ON
CONFLICTS=  gmsh-2.*
.else
CMAKE_ARGS+=    -DENABLE_OCC=OFF
CONFLICTS=  gmsh-occ-2.*
.endif

PKGMESSAGE= ${WRKDIR}/pkg-message

.include <bsd.port.pre.mk>

pre-everything::
    @${ECHO_MSG} ""
.if !defined(WITHOUT_TETGEN)
    @${ECHO_MSG} "Define WITHOUT_TETGEN to disable Tetgen as an alternative"
    @${ECHO_MSG} "3D mesh generator."
    @${ECHO_MSG} ""
.endif
.if !defined(WITHOUT_METIS)
    @${ECHO_MSG} "Define WITHOUT_METIS to disable Metis as an alternative"
    @${ECHO_MSG} "3D mesh generator."
    @${ECHO_MSG} ""
.endif
.if !defined(WITH_TAUCS)
    @${ECHO_MSG} "Define WITH_TAUCS to enable the Taucs linear algebra solver."
    @${ECHO_MSG} ""
.endif
.if !defined(WITHOUT_MED)
    @${ECHO_MSG} "Define WITHOUT_MED to disable MED support."
    @${ECHO_MSG} ""
.endif
.if !defined(WITHOUT_CGNS)
    @${ECHO_MSG} "Define WITHOUT_CGNS to disable CGNS support."
    @${ECHO_MSG} ""
.endif
.if !defined(WITHOUT_GMM)
    @${ECHO_MSG} "Define WITHOUT_GMM to disable gmm++ support."
    @${ECHO_MSG} ""
.endif
.if !defined(WITH_OCC)
    @${ECHO_MSG} "Define WITH_OCC to enable STEP, IGES and BREP support"
    @${ECHO_MSG} "(through OpenCascade)."
    @${ECHO_MSG} ""
.endif
.if !defined(WITHOUT_STATIC_LIB)
    @${ECHO_MSG} "Define WITHOUT_STATIC_LIB to avoid building and installing the static library."
    @${ECHO_MSG} "(You would want to do this to reduce build time.)"
    @${ECHO_MSG} ""
.endif
.if !defined(WITHOUT_SHARED_LIB)
    @${ECHO_MSG} "Define WITHOUT_SHARED_LIB to avoid building and installing the shared library."
    @${ECHO_MSG} "(You would want to do this to reduce build time.)"
    @${ECHO_MSG} ""
.endif

post-extract:
    ${CP} ${DISTDIR}/${DIST_SUBDIR}/manual.pdf ${WRKDIR}
    ${TOUCH} ${PKGMESSAGE}
.if !defined(WITHOUT_TETGEN)
    @${ECHO} >> ${PKGMESSAGE}
    @${ECHO} "The FreeBSD project has been granted redistribution rights" >> ${PKGMESSAGE}
    @${ECHO} "but anyone attempting to redistribute Gmsh with Tetgen" >> ${PKGMESSAGE}
    @${ECHO} "for strict commercial purposes must still contact the author" >> ${PKGMESSAGE}
    @${ECHO} "(Hang Si) and license the code." >> ${PKGMESSAGE}
.endif
.if !defined(WITHOUT_METIS)
    @${ECHO} >> ${PKGMESSAGE}
    @${ECHO} "The FreeBSD project has been granted redistribution rights" >> ${PKGMESSAGE}
    @${ECHO} "but anyone attempting to redistribute Gmsh with Metis" >> ${PKGMESSAGE}
    @${ECHO} "must still contact the author" >> ${PKGMESSAGE}
    @${ECHO} "http://glaros.dtc.umn.edu/gkhome/metis/metis/faq?q=metis/metis/faq#distribute" >> ${PKGMESSAGE}
    @${ECHO} "\"A Fast and Highly Quality Multilevel Scheme for Partitioning Irregular Graphs\". George Karypis and Vipin Kumar. SIAM Journal on Scientific Computing, Vol. 20, No. 1, pp. 359-392, 1999." >> ${PKGMESSAGE}
.endif
.if defined(WITH_TAUCS)
    @${ECHO} >> ${PKGMESSAGE}
    @${ECHO} "There might be licensing issues with using Taucs with Gmsh" >> ${PKGMESSAGE}
    @${ECHO} "because Taucs requires Metis." >> ${PKGMESSAGE}
.endif

post-patch:
    ${REINPLACE_CMD} -e s+share/doc/gmsh+${DOCSDIR_REL}+ \
        -e s+share/man/man1+man/man1+ ${WRKSRC}/CMakeLists.txt

post-install:
.if !defined(WITHOUT_SHARED_LIB)
    ${MV} -f ${PREFIX}/lib/libGmsh.so ${PREFIX}/lib/libGmsh.so.0
    ${LN} -s ${PREFIX}/lib/libGmsh.so.0 ${PREFIX}/lib/libGmsh.so
.endif
.if !defined(WITHOUT_METIS)
    ${MKDIR} ${DOCSDIR}/metis
    ${INSTALL_DATA} ${WRKDIR}/manual.pdf ${DOCSDIR}/metis
.endif

    @${ECHO_MSG}
    @${CAT} ${PKGMESSAGE}
    @${ECHO_MSG}

.include <bsd.port.post.mk>