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

PORTNAME=   ncs
PORTVERSION=    2.0.4
PORTREVISION=   2
CATEGORIES= science parallel
MASTER_SITES=   http://research.edf.com/fichiers/fckeditor/Commun/Innovation/logiciels/code_saturne/Releases/
DISTNAME=   ${PORTNAME}-${PORTVERSION:S/.//g}

MAINTAINER= thierry@FreeBSD.org
COMMENT=    Code_Saturne Kernel

LICENSE=    GPLv2

BUILD_DEPENDS=  ${PYTHON_PKGNAMEPREFIX}qt4-core>=0:${PORTSDIR}/devel/py-qt4 \
        cs_preprocess:${PORTSDIR}/science/ecs   \
        pyrcc4:${PORTSDIR}/textproc/py-qt4-xml
LIB_DEPENDS=    fvm.0:${PORTSDIR}/science/fvm   \
        mei.0:${PORTSDIR}/science/mei
RUN_DEPENDS=    xmgrace:${PORTSDIR}/math/grace  \
        bash:${PORTSDIR}/shells/bash    \
        xterm:${PORTSDIR}/x11/xterm \
        cs_preprocess:${PORTSDIR}/science/ecs

USE_ZIP=    yes
USES=       fortran gettext gmake iconv
USE_GNOME=  libxml2
USE_PYTHON= yes
WRKSRC=     ${WRKDIR}/${PORTNAME}-${PORTVERSION}
CPPFLAGS+=  -I${LOCALBASE}/include/libxml2
GNU_CONFIGURE=  yes
CONFIGURE_ENV=  MPI_LIBS="${MPI_LIBS}" \
        PYEXE="${PYTHON_CMD}"
MAKE_ENV=   NOM_ARCH=${OPSYS} CS_MPI_PATH=${MPI_HOME}/bin   \
        PTHREAD_LIBS=${PTHREAD_LIBS} 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\\``/../../../

.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

MAN1=       code_saturne.1 cs_solver.1

.if defined(WITH_LAM)
MPI_HOME=   ${LOCALBASE}
BUILD_DEPENDS+= ${MPI_HOME}/lib/liblam.a:${PORTSDIR}/net/lam
RUN_DEPENDS+=   ${MPI_HOME}/bin/lamboot:${PORTSDIR}/net/lam
MPI_LIBS=   -lmpi -llam
.elif defined(WITH_OPENMPI)
MPI_HOME=   ${LOCALBASE}/mpi/openmpi
BUILD_DEPENDS+= ${MPI_HOME}/bin/mpicc:${PORTSDIR}/net/openmpi
RUN_DEPENDS+=   ${MPI_HOME}/bin/mpirun:${PORTSDIR}/net/openmpi
MPI_LIBS=   -lmpi -lorte -lopal
.else
MPI_HOME=   ${LOCALBASE}
BUILD_DEPENDS+= ${MPI_HOME}/bin/mpicc:${PORTSDIR}/net/mpich2
RUN_DEPENDS+=   ${MPI_HOME}/bin/mpirun:${PORTSDIR}/net/mpich2
MPI_LIBS=   -lmpich -lmpl ${PTHREAD_LIBS}
.endif

.if !defined(NOPORTDOCS)
USE_TEX=    tex:build
BUILD_DEPENDS+= fig2dev:${PORTSDIR}/print/transfig
ALL_TARGET= all pdf
INSTALL_TARGET= install install-pdf
DOCS=       AUTHORS COMPATIBILITY ChangeLog README
.endif

NO_STAGE=   yes
.include <bsd.port.pre.mk>

.if exists(${LOCALBASE}/lib/libatlas.so) && !defined(WITH_BLAS)
WITH_ATLAS= yes
.endif
.if defined(WITH_ATLAS) && !defined(WITHOUT_ATLAS)
LIB_DEPENDS+=   atlas.2:${PORTSDIR}/math/atlas
BLAS_LIB=   -lf77blas
.elif !defined(WITHOUT_BLAS)
LIB_DEPENDS+=   blas.2:${PORTSDIR}/math/blas
BLAS_LIB=   -lblas
.endif

.if exists(${LOCALBASE}/bin/acroread)
RUN_DEPENDS+=   acroread:${PORTSDIR}/print/acroreadwrapper
.else
RUN_DEPENDS+=   xpdf:${PORTSDIR}/graphics/xpdf
.endif

pre-everything::
    @${ECHO_MSG}
    @${ECHO_MSG} "By default ncs is built with MPICH2, but you can set WITH_LAM or WITH_OPENMPI"
    @${ECHO_MSG} "if you prefer."
    @${ECHO_MSG}
    @${ECHO_MSG} "By default ncs is built with BLAS, unless ATLAS is installed, but you can set"
    @${ECHO_MSG} "WITHOUT_BLAS or WITHOUT_ATLAS if you prefer."
    @${ECHO_MSG}

pre-configure:
    ${REINPLACE_CMD} -e 's|/bin/bash| ${LOCALBASE}/bin/bash|' ${WRKSRC}/bin/runcase.in

post-install:
.if !defined(NOPORTDOCS)
    ${INSTALL_DATA} ${DOCS:C|^|${WRKSRC}/|} ${DOCSDIR}
.endif
.if !defined(NOPORTEXAMPLES)
    ${MKDIR} ${EXAMPLESDIR}
    cd ${WRKSRC}/examples && ${COPYTREE_SHARE} \* ${EXAMPLESDIR}
.endif

.include <bsd.port.post.mk>