aboutsummaryrefslogtreecommitdiffstats
path: root/math/mumps-edf/Makefile
blob: c67cc846297bf97ab25adc7ba6a2a4a7b4f854ba (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
# Created by: Pedro Giffuni
# $FreeBSD$

PORTNAME=   mumps
DISTVERSION=    5.1.1-aster2
PORTREVISION=   1
CATEGORIES= math
PKGNAMESUFFIX=  -edf

MAINTAINER= thierry@FreeBSD.org
COMMENT=    MUltifrontal Massively Parallel sparse direct Solver for Code_Aster

LICENSE=    CeCILL_C
LICENSE_NAME=   CeCILL-C
LICENSE_FILE=   ${WRKSRC}/LICENSE
LICENSE_PERMS=  dist-mirror dist-sell pkg-mirror pkg-sell auto-accept

BUILD_DEPENDS=  ${LOCALBASE}/lib/libGKlib.a:math/metis-edf
LIB_DEPENDS=    libblas.so:math/blas        \
        liblapack.so:math/lapack    \
        libmetis.so:math/metis-edf

USES=       fortran

WRKSRC=     ${WRKDIR}/${PORTNAME}-${PORTVERSION:R}
BLAS_LIBS=  -lblas
LAPACK_LIBS=    -llapack
FORTRANLIBS=    -lgfortran
GCCLIBDIR=  ${LDFLAGS}
USE_LDCONFIG=   yes
VEM=        ${PORTVERSION:R:R:R}
MUMPSVERSION=   ${PORTVERSION:R}
LIBS=       cmumps dmumps mumps_common pord smumps zmumps
PLIST_SUB=  VE=${VEM} MUMPSVERSION=${MUMPSVERSION}

CONFLICTS=  mumps-4* mumps-mpich-4*

OPTIONS_DEFINE= DOCS EXAMPLES

MAKE_JOBS_UNSAFE=yes

.include <bsd.port.pre.mk>
.include "${.CURDIR}/../../french/aster/bsd.aster.mk"

.ifdef WITH_MPI
PKGNAMESUFFIX+=     -mpich
BUILD_DEPENDS+= ${LOCALBASE}/include/mpif.h:net/mpich2      \
        ${LOCALBASE}/lib/libblacs.a:math/blacs      \
        ${LOCALBASE}/lib/libptscotch.a:cad/scotch   \
        ${LOCALBASE}/lib/libscalapack.a:math/scalapack  \
        ${LOCALBASE}/lib/parmetis/libmetis.a:math/parmetis
LIB_DEPENDS+=   liblapack.so:math/lapack
# Note: -l?mumps still requires to be linked with -lblacs + -lscalapack
RUN_DEPENDS+=   ${LOCALBASE}/bin/mpirun:net/mpich2  \
        ${LOCALBASE}/lib/libblacs.a:math/blacs  \
        ${LOCALBASE}/lib/libscalapack.a:math/scalapack
PLIST_SUB+= WITH_LIBSEQ="@comment "
CONFLICTS+= mumps-5*
.else
BUILD_DEPENDS+= ${LOCALBASE}/lib/libscotch.a:cad/scotch
PLIST_SUB+= WITH_LIBSEQ=""
LIBS+=      mpiseq
CONFLICTS+= mumps-mpich-5*
.endif

pre-configure:
.ifdef WITH_MPI
    ${INSTALL_DATA} ${WRKSRC}/Make.inc/Makefile.FREEBSD10.PAR \
        ${WRKSRC}/Makefile.inc
.else
    ${INSTALL_DATA} ${WRKSRC}/Make.inc/Makefile.FREEBSD10.SEQ \
        ${WRKSRC}/Makefile.inc
.endif
    ${DIRNAME} `${FC} -print-libgcc-file-name` > ${WRKSRC}/LIBDIR
.for MF in Makefile Makefile.inc PORD/lib/Makefile libseq/Makefile src/Makefile
    ${REINPLACE_CMD} -e 's+@CC@+${CC}+g ; s+@FC@+${FC}+g ; \
    s+/usr/local+${LOCALBASE}+; \
    s+@CFLAGS@+${CFLAGS} -fPIC+g; \
    s+@FCFLAGS@+${FCFLAGS} -fPIC+g; \
    s+@SOVER@+${VEM}+g; \
    s+@GCCLIBDIR@+${GCCLIBDIR}+g; \
    s+@FORTRANLIBS@+${FORTRANLIBS}+g; \
    s+@BLAS_LIBS@+${BLAS_LIBS}+ ; \
    s+@LAPACK_LIBS@+${LAPACK_LIBS}+ ; \
    s+@LOCALBASE@+${LOCALBASE}+g;' \
        ${WRKSRC}/${MF}
.endfor

do-install:
    ${INSTALL_DATA} ${WRKSRC}/include/*.h ${STAGEDIR}${PREFIX}/include
    ${INSTALL_DATA} ${WRKSRC}/lib/lib*.a ${STAGEDIR}${PREFIX}/lib
    ${INSTALL_LIB} ${WRKSRC}/lib/lib*.so.${VEM} ${STAGEDIR}${PREFIX}/lib
.ifndef WITH_MPI
    ${INSTALL_DATA} ${WRKSRC}/libseq/libmpiseq.a ${STAGEDIR}${PREFIX}/lib
    ${INSTALL_LIB} ${WRKSRC}/libseq/libmpiseq*.so.${VEM} ${STAGEDIR}${PREFIX}/lib
.endif
.for lib in ${LIBS}
    (cd ${STAGEDIR}${PREFIX}/lib && ${LN} -sf lib${lib}.so.${VEM} ${STAGEDIR}${PREFIX}/lib/lib${lib}.so)
. endfor
    ${MKDIR} ${STAGEDIR}${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/doc/userguide_${MUMPSVERSION}.pdf ${STAGEDIR}${DOCSDIR}
    ${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
. for ex in Makefile README *.c *.F input_simpletest_*
    ${INSTALL_DATA} ${WRKSRC}/examples/${ex} ${STAGEDIR}${EXAMPLESDIR}
. endfor
. for ex in c_example *simpletest
    ${INSTALL_PROGRAM} ${WRKSRC}/examples/${ex} ${STAGEDIR}${EXAMPLESDIR}
. endfor

regression-test:    install
.if defined (WITH_MPI) && defined(MAINTAINER_MODE)
.  if !exists(${HOME}/.mpd.conf)
    @${ECHO_CMD} "MPD_SECRETWORD=change_on_install" > ${HOME}/.mpd.conf
    ${CHMOD} go-r ${HOME}/.mpd.conf
    @${ECHO_MSG} "${HOME}/.mpd.conf has been generated - please change the secret word!"
.  endif
    ${LOCALBASE}/bin/mpd &
    (cd ${WRKSRC}/examples &&   \
    ${LOCALBASE}/bin/mpirun -np 2 ./ssimpletest < input_simpletest_real ;   \
    ${LOCALBASE}/bin/mpirun -np 2 ./dsimpletest < input_simpletest_real ;   \
    ${LOCALBASE}/bin/mpirun -np 2 ./csimpletest < input_simpletest_cmplx ;  \
    ${LOCALBASE}/bin/mpirun -np 2 ./zsimpletest < input_simpletest_cmplx ;  \
    ${ECHO_MSG} "The solution should be (1,2,3,4,5)" ;  \
    ${LOCALBASE}/bin/mpirun -np 3 ./c_example ; \
    ${ECHO_MSG} "The solution should be (1,2)")
    ${LOCALBASE}/bin/mpdallexit
.else
    (cd ${WRKSRC}/examples &&   \
    ./ssimpletest < input_simpletest_real ;         \
    ./dsimpletest < input_simpletest_real ;         \
    ./csimpletest < input_simpletest_cmplx ;        \
    ./zsimpletest < input_simpletest_cmplx ;        \
    ${ECHO_MSG} "The solution should be (1,2,3,4,5)" ;  \
    ./c_example ;                       \
    ${ECHO_MSG} "The solution should be (1,2)")
.endif

.include <bsd.port.post.mk>