aboutsummaryrefslogtreecommitdiffstats
path: root/science/ncs/Makefile
blob: cdc27c4feda69c4ae2570a179336541030c146b1 (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
# Created by: thierry@pompo.net
# $FreeBSD$

PORTNAME=   ncs
PORTVERSION=    2.0.8
PORTREVISION=   5
CATEGORIES= science parallel
MASTER_SITES=   http://code-saturne.org/releases/

MAINTAINER= thierry@FreeBSD.org
COMMENT=    Code_Saturne Kernel

LICENSE=    GPLv2

BUILD_DEPENDS=  cs_preprocess:science/ecs
LIB_DEPENDS=    libbft.so:science/bft \
        libcgns.so:science/cgnslib \
        libfvm.so:science/fvm \
        libhdf5.so:science/hdf5 \
        libmedC.so:french/med \
        libmei.so:science/mei
RUN_DEPENDS=    xmgrace:math/grace \
        bash:shells/bash \
        xterm:x11/xterm \
        cs_preprocess:science/ecs

USES=       fortran gettext gmake iconv libtool pyqt:4 python:2.7 shebangfix
USE_GNOME=  libxml2
USE_PYQT=   core xml_build
SHEBANG_FILES=  bin/runcase.in
CPPFLAGS+=  -I${LOCALBASE}/include -I${LOCALBASE}/include/libxml2
GNU_CONFIGURE=  yes
CONFIGURE_ENV=  MPI_LIBS="${MPI_LIBS}" \
        PYEXE="${PYTHON_CMD}"
CONFIGURE_ARGS= --with-blas-libs="${BLASLIB} ${LAPACKLIB}"
MAKE_ENV=   NOM_ARCH=${OPSYS} CS_MPI_PATH=${MPI_HOME}/bin   \
        PTHREAD_LIBS=-lpthread TERM=${TERM} \
        MPI_HOME=${MPI_HOME} MPI_LIBS="${MPI_LIBS}"
USE_LDCONFIG=   yes

FORTRANLIBDIR=  `${DIRNAME} \\`${FC} -print-libgcc-file-name\\``
FORTRANLIBDIR2= `${DIRNAME} \\`${FC} -print-libgcc-file-name\\``/../../../

OPTIONS_DEFINE=     DOCS EXAMPLES BATCH
BATCH_DESC=     Use Torque to submit batches
BATCH_CONFIGURE_WITH=   batch=PBS
BATCH_LIB_DEPENDS=  libtorque.so:sysutils/torque

OPTIONS_RADIO=  BLAS
OPTIONS_RADIO_BLAS= REFERENCE ATLAS
OPTIONS_DEFAULT=    REFERENCE

REFERENCE_DESC= Blas / Lapack
REFERENCE_USES= blaslapack:netlib

ATLAS_DESC= ATLAS
ATLAS_USES= blaslapack:atlas

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MREFERENCE}
CONFIGURE_ARGS+=    --with-blas-type=BLAS
.else
CONFIGURE_ARGS+=    --with-blas-type=ATLAS
.endif

.if defined(PACKAGE_BUILDING)
TERM=       vt100   # Force for pointyhat to override su
.else
TERM?=      vt100   # Default value needed for tput in jail or tinderbox
.endif

SUB_DIRS=   data include src users
BIN_SCRIPTS=    autovalid check_mesh compiler_version cree_sat cs.exe gracehst  \
        grp info_cs lance_install rang_mpi.sh
BIN_DATAS=  Makefile SaturneGUI autovalid.xml cs_profile lance lance.help   \
        macros_FreeBSD.mk

.if defined(WITH_OPENMPI)
MPI_HOME=   ${LOCALBASE}/mpi/openmpi
BUILD_DEPENDS+= ${MPI_HOME}/bin/mpicc:net/openmpi
RUN_DEPENDS+=   ${MPI_HOME}/bin/mpirun:net/openmpi
MPI_LIBS=   -lmpi -lorte -lopal
.else
MPI_HOME=   ${LOCALBASE}
BUILD_DEPENDS+= ${MPI_HOME}/bin/mpicc:net/mpich2
RUN_DEPENDS+=   ${MPI_HOME}/bin/mpirun:net/mpich2
MPI_LIBS=   -lmpich -lmpl -lpthread
.endif

.if ${PORT_OPTIONS:MDOCS}
USE_TEX=    tex:build
BUILD_DEPENDS+= fig2dev:print/transfig
ALL_TARGET= all pdf
INSTALL_TARGET= install install-pdf
DOCS=       AUTHORS COMPATIBILITY ChangeLog README
.endif

RUN_DEPENDS+=   xpdf:graphics/xpdf

pre-everything::
    @${ECHO_MSG}
    @${ECHO_MSG} "By default ncs is built with MPICH2, but you can set WITH_OPENMPI"
    @${ECHO_MSG} "if you prefer."
    @${ECHO_MSG}

post-install:
    @cd ${STAGEDIR}${PREFIX}/lib && ${STRIP_CMD} libsaturne.so* libsyrcs.so* libsyrcs.so*
    @${REINPLACE_CMD} -i '' -e 's|^#!.*|#!${PYTHON_CMD}|' ${STAGEDIR}${PREFIX}/bin/code_saturne
.if ${PORT_OPTIONS:MDOCS}
    ${MKDIR} ${STAGEDIR}${DOCSDIR}
    ${INSTALL_DATA} ${DOCS:C|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
.endif
.if ${PORT_OPTIONS:MEXAMPLES}
    ${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
    cd ${WRKSRC}/examples && ${COPYTREE_SHARE} \* ${STAGEDIR}${EXAMPLESDIR}
.endif

.include <bsd.port.mk>