Ticket #65627: Portfile

File Portfile, 5.1 KB (added by mbrethen, 21 months ago)
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2
3PortSystem          1.0
4PortGroup           active_variants 1.1
5PortGroup           mpi 1.0
6
7name                CalculiX-ccx
8version             2.18
9categories          cad
10platforms           darwin
11maintainers         {gmail.com:mark.brethen @mbrethen} openmaintainer
12license             GPL-2+
13description         CalculiX CrunchiX solver ccx
14long_description    {*}${description} 
15homepage            http://www.calculix.de/
16master_sites        http://www.dhondt.de/:ccx \
17                    http://www.netlib.org/linalg/spooles/:spooles
18use_bzip2           yes
19
20distname            ccx_${version}
21distfiles           ${distname}.src${extract.suffix}:ccx \
22                    ${distname}.htm${extract.suffix}:ccx \
23                    ${distname}.test${extract.suffix}:ccx \
24                    spooles.2.2.tgz:spooles
25dist_subdir         CalculiX
26
27checksums \
28    ${distname}.src.tar.bz2 \
29    sha256  fad533bd66693daa398856262bf7c6feb12599c3051955238b0a70420852ff65 \
30    size    1593157 \
31    ${distname}.htm.tar.bz2 \
32    sha256  5b9cc5e6a1ef70bd93737b507cb754d485b229ec3cef31ea33501a74deff23e6 \
33    size    2586160 \
34    ${distname}.test.tar.bz2 \
35    sha256  c5f771fc152d876366570b0d88032d908d912efb566ccddf070184acceeed7f4 \
36    size    9759177 \
37    spooles.2.2.tgz \
38    sha256  a84559a0e987a1e423055ef4fdf3035d55b65bbe4bf915efaa1a35bef7f8c5dd \
39    size    4510271
40
41extract.mkdir       yes
42extract.only        ${distname}.src${extract.suffix}
43extract.post_args-append --strip-components=3
44
45depends_lib-append  port:arpack
46
47require_active_variants arpack accelerate
48
49patchfiles          patch-ccx-build.diff \
50                    patch-spooles-Make.inc.diff
51patch.dir           ${workpath}
52
53use_configure       no
54
55mpi.setup            require require_fortran -g95 -clang -openmpi
56
57build.dir           ${worksrcpath}/src
58build.target
59use_parallel_build  no
60
61variant docs description {Install html documentation} {}
62
63variant examples description {Install test examples} {}
64
65universal_variant   no
66
67default_variants    +docs +examples
68
69post-extract {
70    ui_info "Extracting spooles.2.2.tgz"
71    file mkdir ${workpath}/spooles.2.2
72    system -W ${workpath}/spooles.2.2 "tar -xf ${distpath}/spooles.2.2.tgz"
73
74    if { [variant_isset docs] } {
75        system -W ${worksrcpath} \
76            "bzip2 -dc ${distpath}/${distname}.htm${extract.suffix} ${extract.post_args}"
77    }
78
79    if { [variant_isset examples] } {
80        system -W ${worksrcpath} \
81            "bzip2 -dc ${distpath}/${distname}.test${extract.suffix} ${extract.post_args}"
82    }
83}
84
85post-patch {
86    if { [variant_isset examples] } {
87        reinplace -W ${worksrcpath}/test "s|~/CalculiX/CalculiX|${prefix}/bin/ccx|g" \
88            compare \
89            compare_valgrind_leaks
90    }
91}
92
93# The spooles library is not currently maintained and so would not be a
94# good port candidate. Instead it will be static linked to ccx.
95
96pre-build {
97    set cc      "${configure.cc}"
98    set fc      "${configure.fc}"
99    set cflags  "${configure.cflags} [get_canonical_archflags cc]"
100    set ldflags "${configure.ldflags} [get_canonical_archflags ld]"
101   
102    # workaround for Rank mismatch between actual argument
103    set ver [regsub -all {[[:alpha:]]+} ${compilers.gcc_default} {}]
104
105    if { ${ver} >= 10 } {
106        set fflags "${configure.fflags} [get_canonical_archflags fc] -fallow-argument-mismatch"
107    } else {
108        set fflags "${configure.fflags} [get_canonical_archflags fc]"
109    }
110
111    # Set environment variables for build
112    set args    [list \
113                     "CC=${cc}" \
114                     "FC=${fc}" \
115                     "CFLAGS=${cflags}" \
116                     "FFLAGS=${fflags}" \
117                     "LDFLAGS=${ldflags}"
118                ]
119
120    build.env-append   {*}${args}
121
122    # Patch spooles library
123    reinplace "s|@@PREFIX@@|${prefix}|g" ${workpath}/spooles.2.2/Make.inc
124    reinplace "s|@@CC@@|${cc}|g" ${workpath}/spooles.2.2/Make.inc
125   
126    # Build serial spooles library
127    ui_info "Building spooles"
128    system -W ${workpath}/spooles.2.2 "${build.cmd} lib CFLAGS=\"${cflags}\" LDFLAGS=\"${ldflags}\""
129   
130    # Extend library with multi-threading (MT) subroutines
131    system -W ${workpath}/spooles.2.2/MT/src "${build.cmd} makeLib CFLAGS=\"${cflags}\" LDFLAGS=\"${ldflags}\""
132}
133
134destroot {
135    xinstall -m a+rx ${worksrcpath}/src/${distname} ${destroot}${prefix}/bin/ccx
136
137    if {[variant_isset docs]} {
138        set docsdir     ${prefix}/share/doc/CalculiX
139        xinstall -d ${destroot}${docsdir}
140        copy {*}[glob ${worksrcpath}/doc/*] ${destroot}${docsdir}
141    }
142
143    if {[variant_isset examples]} {
144        set examplesdir    ${prefix}/share/examples/ccx
145        xinstall -d ${destroot}${examplesdir}
146        copy {*}[glob ${worksrcpath}/test/*] ${destroot}${examplesdir}
147    }
148}
149
150livecheck.type        regex
151livecheck.url         http://www.dhondt.de/
152livecheck.regex       {${distname}.src}
153
154notes {
155    Spooles: by default the single-threaded solver is used unless you set the\
156        environment variables CCX_NPROC_EQUATION_SOLVER or OMP_NUM_THREADS with\
157        the number of cores you want to use.
158}