aboutsummaryrefslogtreecommitdiffstats
path: root/french/aster/Makefile
blob: 10b7b1f9d92b82827c13e2b9280cc1ec44b18978 (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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# New ports collection makefile for:    aster
# Date created:     Thu Jun 26 2003
# Whom:         thierry@pompo.net
#
# $FreeBSD$
#

PORTNAME=   aster
DISTVERSION=    8.2.0-3
CATEGORIES= french cad python
MASTER_SITES=   http://www.code-aster.org/FICHIERS/
DISTNAME=   ${PORTNAME}-full-src-${DISTVERSION}

MAINTAINER= ports@FreeBSD.org
COMMENT=    Analyse des structures et thermo-mécanique

#-----------------------------------------------------------------------
# You may define these options:
#
# - F77: don't use the default fortran compiler;
# - FFLAGS: fortan compiler's flags (-O2 by default);
# - WITH_ZSH or WITH_BASH or WITH_KSH: select a shell among
#           zsh (default), bash or ksh;
# - WITH_ED: select an editor accepting '-display' (e.g. gvim, nedit);
# - WITH_BLAS: don't link with atlas, but with blas;
#           (blas is slower, but lighter)
# - WITHOUT_ASTK_CLI: won't use the GUI from this machine;
# - WITHOUT_EFICAS: don't install ASter Command FIle Editor;
# - WITHOUT_GMSH: don't install GMSH (a mesh generator);
# - WITHOUT_GRACE: don't install Grace (used to create 2D graph);
# - WITHOUT_MACR_RECAL: don't install Numerical Python
#           (required by the macro MACR_RECAL);
#
#-----------------------------------------------------------------------

BUILD_DEPENDS+= ${LOCALBASE}/aster/ASTK/ASTK_SERV:${PORTSDIR}/cad/astk-serveur  \
        ${SHELL_INSTALL_ASTER}:${PORTSDIR}/shells/${SHIADEP}        \
        ${PYNUMERIC}
LIB_DEPENDS+=   tcl${SHORT_TCL_VER}:${PORTSDIR}/lang/tcl${SHORT_TCL_VER}    \
        tk${SHORT_TK_VER}:${PORTSDIR}/x11-toolkits/tk${SHORT_TK_VER}    \
        lapack.3:${PORTSDIR}/math/lapack                \
        hdf5.0:${PORTSDIR}/science/hdf5                 \
        med.1:${PORTSDIR}/french/med
RUN_DEPENDS+=   ${PYTHON_SITELIBDIR}/Gnuplot:${PORTSDIR}/math/py-gnuplot    \
        ${LOCALBASE}/bin/onmetis.exe:${PORTSDIR}/math/metis-edf     \
        ${LOCALBASE}/aster/ASTK/ASTK_SERV:${PORTSDIR}/cad/astk-serveur

#USE_GCC=   3.4 # Helps on 4.x, but not sufficient.
USE_PYTHON= yes
HAS_CONFIGURE=  yes
REINPLACE_ARGS= -i ""

WRKSRC=     ${WRKDIR}/${PORTNAME}-src-${PORTVERSION:R}
PLIST_SUB=  ASTERDIR=${PORTNAME}/${vaster} TOOLDIR=${PORTNAME}/${vaster}/outils
PKGMESSAGE= ${WRKDIR}/pkg-message
.if defined(WITHOUT_ASTK_CLI)
PKGMESSIN=  pkg-message.sans-astk.in
.else
PKGMESSIN=  pkg-message.in
.endif

.include <bsd.port.pre.mk>

.if ${ARCH} == "i386"
FLAGARCH=   P_LINUX     # 32 bits
.else
FLAGARCH=   TRU64       # 64 bits
.endif

.if ${OSVERSION} < 500000
BROKEN= "Does not compile on FreeBSD-4.x, and cannot be patched easily."
.endif
.if ${ARCH} == "amd64"
BROKEN= "Seg. fault on ${ARCH} during compilation of elements."
.endif

.if ${ARCH} == "sparc64"
BROKEN=     "Does not build on sparc64"
.endif

.if defined(WITH_BLAS)
LIB_DEPENDS+=   blas.1:${PORTSDIR}/math/blas
.else
LIB_DEPENDS+=   f77blas.1:${PORTSDIR}/math/atlas
.endif
.if !defined(WITHOUT_ASTK_CLI)
RUN_DEPENDS+=   ${ASTKDIR}:${PORTSDIR}/cad/astk-client
PLIST_SUB+= ASTK_CLIENT=""  ASTKDIR=${ASTKDIR}
.else
PLIST_SUB+= ASTK_CLIENT="@comment " ASTKDIR=""
.endif
.if !defined(WITHOUT_EFICAS)
RUN_DEPENDS+=   ${LOCALBASE}/apps/eficas:${PORTSDIR}/french/eficas
PLIST_SUB+= EFICAS=""
.else
PLIST_SUB+= EFICAS="@comment "
.endif
.if !defined(WITHOUT_GMSH)
RUN_DEPENDS+=   ${LOCALBASE}/bin/gmsh:${PORTSDIR}/cad/gmsh
PLIST_SUB+= GMSH=""
.else
PLIST_SUB+= GMSH="@comment "
.endif
.if !defined(WITHOUT_GRACE)
RUN_DEPENDS+=   ${X11BASE}/bin/xmgrace:${PORTSDIR}/math/grace
PLIST_SUB+= GRACE=""
.else
PLIST_SUB+= GRACE="@comment "
.endif
.if !defined(WITHOUT_MACR_RECAL)
RUN_DEPENDS+=   ${PYNUMERIC}
.endif

.if !${OSVERSION} < 500039
F77?=       f77
.endif
FFLAGS?=    -O2

TK_VER?=    8.4
SHORT_TK_VER=   ${TK_VER:S/.//}

TCL_VER?=   ${TK_VER}
SHORT_TCL_VER=  ${TCL_VER:S/.//}

.if defined(WITH_ZSH)
SHIA=       zsh
.elif defined(WITH_BASH)
SHIA=       bash
.elif defined(WITH_KSH)
SHIA=       ksh93
.elif exists(${LOCALBASE}/bin/zsh)
SHIA=       zsh
.elif exists(${LOCALBASE}/bin/bash)
SHIA=       bash
.elif exists(${LOCALBASE}/bin/ksh93)
SHIA=       ksh93
.else
SHIA=       zsh
.endif
.if ${SHIA} == "bash"
SHIADEP=    bash2
.else
SHIADEP=    ${SHIA}
.endif

.if !defined(WITH_ED)
. if exists(${X11BASE}/bin/nedit)
WITH_ED=    nedit
RUN_DEPENDS+=   ${X11BASE}/bin/nedit:${PORTSDIR}/editors/nedit
. elif exists(${LOCALBASE}/bin/gvim)
WITH_ED=    gvim
RUN_DEPENDS+=   ${LOCALBASE}/bin/gvim:${PORTSDIR}/editors/vim
. elif exists(${LOCALBASE}/bin/emacs)
WITH_ED=    emacs
RUN_DEPENDS+=   ${LOCALBASE}/bin/emacs:${PORTSDIR}/editors/emacs
. elif exists(${LOCALBASE}/bin/xemacs)
WITH_ED=    xemacs
RUN_DEPENDS+=   ${LOCALBASE}/bin/xemacs:${PORTSDIR}/editors/xemacs
. else
WITH_ED=    xedit
RUN_DEPENDS+=   ${X11BASE}/bin/xedit:${X_CLIENTS_PORT}
. endif
.endif

vaster=     STA${PORTVERSION:R:R}
INST_DAT=   LICENSE.TERMS astest cata_ele.pickled catalo catapy \
        elements etude materiau
INST_PY=    bibpyt commande
DAT2FIX=    astout.export config.txt forma01a.export
inst_dir=   ${PREFIX}/${PORTNAME}/${vaster}
tools_dir=  ${inst_dir}/outils
v_ifdef=    ${OPSYS:U}
SHELL_INSTALL_ASTER=    ${LOCALBASE}/bin/${SHIA}
tcl_dir=    ${LOCALBASE}
hdf_dir=    ${LOCALBASE}
.if defined(WITH_BLAS)
lib_blas=   blas
.else
lib_blas=   f77blas
lib_atlas=  atlas
.endif
LASTKDIR?=  ${PORTNAME}/ASTK/ASTK_CLIENT
ASTKDIR=    ${LOCALBASE}/${LASTKDIR}

pre-configure:
    @${REINPLACE_CMD} -e 's|/opt/aster|${WRKSRC}/instdir|'      \
        -e 's|/usr/bin/gcc|${CC}|;s|/usr/bin/g77|${F77}|'   \
        ${WRKSRC}/setup.cfg
.if !defined(WITH_BLAS)
    @${REINPLACE_CMD} -e "s|cfg\['BLASLIB'\]|cfg['BLASLIB'], cfg['ATLASLIB']|"  \
        ${WRKSRC}/products.py
.endif
    @${ECHO_CMD} "_install_hdf5 = False"            >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_med = False"         >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_tcl = False"         >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_tk  = False"         >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_Pmw = False"         >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_Numeric = False"         >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_gmsh = False"            >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_gibi = False"            >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_homard = False"          >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_eficas = False"          >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_astk = False"            >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_astk_serv = False"       >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_metis = False"           >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_crpcrs = False"          >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_aster_Linux = False"     >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "_install_scotch  = False"         >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "HOME_SCOTCH = ''"             >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "HOME_MUMPS = ''"              >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "HOME_ZMAT = ''"               >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "HOME_HDF='${hdf_dir}'"            >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "HOME_MED='${LOCALBASE}'"          >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "HOME_TCL_TK='${tcl_dir}'"         >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "BLASLIB='${lib_blas}'"            >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "ATLASLIB='${lib_atlas}'"          >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "LAPACKLIB='${LOCALBASE}/lib/liblapack.a'" >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "GZIP='/usr/bin/gzip'"         >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "SHELL_EXECUTION='${SHELL_INSTALL_ASTER}'" >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "EDITOR='${WITH_ED}'"          >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "LDFLAGS='-v ${LDFLAGS}'"          >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "FFLAGS='-c ${FFLAGS} -D${FLAGARCH}'"  >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "FFLAGS_DBG='-c -g -O -D${FLAGARCH}'"  >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "CFLAGS='-c ${CFLAGS} ${PTHREAD_CFLAGS} -D${FLAGARCH}'"    \
        >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "CFLAGS_DBG='-c -g -O -pipe ${PTHREAD_CFLAGS} -D${FLAGARCH}'"  \
        >> ${WRKSRC}/setup.cfg
    @${ECHO_CMD} "SYSLIB='-Xlinker -export-dynamic ${PTHREAD_LIBS} -lutil -lm -lz -lg2c'"   \
        >> ${WRKSRC}/setup.cfg

do-configure:
    (cd ${CONFIGURE_WRKSRC} && ${PYTHON_CMD} setup.py test      \
        | tee ${CONFIGURE_LOG})

pre-build:
    ${MKDIR} ${WRKSRC}/instdir/ASTK/ASTK_SERV/conf ${WRKSRC}/instdir/outils
    ${SED} -e 's|${LOCALBASE}/aster|${WRKSRC}/instdir|'     \
        < ${LOCALBASE}/aster/ASTK/ASTK_SERV/conf/config     \
        > ${WRKSRC}/instdir/ASTK/ASTK_SERV/conf/config
    ${CP} ${LOCALBASE}/aster/ASTK/ASTK_SERV/conf/aster_profile.sh   \
        ${WRKSRC}/instdir/ASTK/ASTK_SERV/conf
    ${LN} -sf ${LOCALBASE}/aster/ASTK/ASTK_SERV/bin         \
        ${WRKSRC}/instdir/ASTK/ASTK_SERV
    ${LN} -sf ${LOCALBASE}/aster/ASTK/ASTK_SERV/lib         \
        ${WRKSRC}/instdir/ASTK/ASTK_SERV

do-build:
    (cd ${BUILD_WRKSRC} && ${PYTHON_CMD} setup.py install       \
        | tee ${BUILD_WRKSRC}/build.log)

pre-install:
    ${CHMOD} go-x ${WRKSRC}/instdir/${vaster}/materiau/A42_REF_A.NOMI

do-install:
    ${MKDIR} ${tools_dir} ${inst_dir}
    ${INSTALL_PROGRAM} ${WRKSRC}/instdir/${vaster}/asteru ${inst_dir}
    ${INSTALL_SCRIPT} ${WRKSRC}/instdir/${vaster}/asterd ${inst_dir} # Don't strip!
.for FILE in ${DAT2FIX}
    ${SED} -e 's|${WRKSRC}/instdir/${vaster}|${inst_dir}|g'     \
        -e 's|${WRKSRC}/instdir|${inst_dir}|g'          \
        -e 's|${WRKSRC}/instdir/outils|${tools_dir}|g'      \
        -e 's|P mode astout|P mode interactif|'         \
        -e 's|P mode forma01a|P mode interactif|'       \
    < ${WRKSRC}/instdir/${vaster}/${FILE} > ${inst_dir}/${FILE}
.endfor
.for FILE in ${INST_DAT} ${INST_PY}
    ${CP} -R ${WRKSRC}/instdir/${vaster}/${FILE} ${inst_dir}
.endfor
    ${REINPLACE_CMD} -e 's|cat ./fort.15 ./ficode|cat ./ficode|'    \
        ${inst_dir}/bibpyt/Execution/E_SUPERV.py
.for FILE in ${INST_PY}
    @${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py ${inst_dir}/${FILE}
    @${PYTHON_CMD} -O ${PYTHON_LIBDIR}/compileall.py ${inst_dir}/${FILE}
.endfor

post-install:
    @${TOUCH} ${inst_dir}/etude/forma01a.17
    ${LN} -fs ${LOCALBASE}/bin/kmetis ${tools_dir}/
    ${LN} -fs ${LOCALBASE}/bin/onmetis ${tools_dir}/
    ${LN} -fs ${LOCALBASE}/bin/pmetis ${tools_dir}/
    ${LN} -fs ${LOCALBASE}/bin/gnuplot ${tools_dir}/
.if !defined(WITHOUT_ASTK) && !defined(WITHOUT_ASTK_CLI)
    ${LN} -fs ${ASTKDIR}/bin/astk ${tools_dir}/
    ${LN} -fs ${ASTKDIR}/bin/bsf ${tools_dir}/
.endif
.if !defined(WITHOUT_EFICAS)
    ${LN} -fs ${LOCALBASE}/bin/eficas ${tools_dir}/
.endif
.if !defined(WITHOUT_GMSH)
    ${LN} -fs ${LOCALBASE}/bin/gmsh ${tools_dir}/
.endif
.if !defined(WITHOUT_GRACE)
    ${LN} -fs ${X11BASE}/bin/gracebat ${tools_dir}/
    ${LN} -fs ${X11BASE}/bin/xmgrace ${tools_dir}/
.endif
    @${ECHO_MSG}
    @${SED} -e "s#%%tools_dir%%#${tools_dir}#"  \
        ${FILESDIR}/${PKGMESSIN} > ${PKGMESSAGE}
    @${CAT} ${PKGMESSAGE}
    @${ECHO_MSG}

.if defined(MAINTAINER_MODE)
test:   install
    (cd ${inst_dir};    \
    ${LOCALBASE}/aster/ASTK/ASTK_SERV/bin/as_run forma01a.export)
    @${ECHO_CMD} Note: homard must be installed to run some steps succesfully.
    (cd ${inst_dir};    \
    ${LOCALBASE}/aster/ASTK/ASTK_SERV/bin/as_run astout.export)
    @${ECHO_CMD} Check ${inst_dir}/astest/*.erre
.endif

.include <bsd.port.post.mk>