Ticket #57761: Portfile

File Portfile, 4.9 KB (added by mbrethen, 6 years 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           compilers 1.0
5PortGroup           github    1.0
6PortGroup           cmake     1.1
7PortGroup           cxx11     1.1
8PortGroup           active_variants 1.1
9
10github.setup        NGSolve netgen 6.2.1808 v
11platforms           darwin
12categories          math
13license             LGPL-2
14maintainers         {mcalhoun @MarcusCalhoun-Lopez} openmaintainer
15description         NETGEN is an automatic 3d tetrahedral mesh generator
16long_description    ${description}. It accepts input from constructive \
17                    solid geometry (CSG) or boundary representation (BRep) \
18                    from STL file format. The connection to a geometry kernel \
19                    allows the handling of IGES and STEP files. NETGEN contains \
20                    modules for mesh optimization and hierarchical mesh \
21                    refinement.
22homepage            https://ngsolve.org/
23
24checksums           rmd160  ec1aabc5732a558bcf3744ea883b0b09c036ee0d \
25                    sha256  619548a62b16c635f81cfbc8611e1e65053cc41766cdd247d32bd1a4073ff1bf \
26                    size    3002932
27
28compilers.choose    cc cxx
29compilers.setup
30
31# do not attempt to download & install tkdnd or Tcl/Tk
32patchfiles-append   patch-no-external.diff
33# do not install another version of pybind11
34patchfiles-append   patch-no-pybind.diff
35# link Tcl/Tk libraries like other systems (unnecessary?)
36patchfiles-append   patch-link-ng.diff
37# behave like other systems except use of RPATH
38patchfiles-append   patch-CMakeLists.txt.diff
39# prevent console window from appearing
40# see http://wiki.tcl.tk/26777
41patchfiles-append   patch-no-console.diff
42
43set python_branch   3.7
44set python_version  [string map {. ""} ${python_branch}]
45
46depends_lib-append  \
47    port:zlib \
48    port:tcl \
49    port:tk \
50    port:tkdnd \
51    port:Togl \
52    port:python${python_version} \
53    path:lib/libavcodec.dylib:ffmpeg \
54    port:jpeg
55
56depends_build-append \
57    port:pybind11
58
59depends_run-append \
60    port:py${python_version}-tkinter
61
62configure.args-append \
63    -DUSE_NATIVE_ARCH=OFF \
64    -DPYBIND_INCLUDE_DIR=${prefix}/include \
65    -DPYTHON_EXECUTABLE=${frameworks_dir}/Python.framework/Versions/${python_branch}/bin/python${python_branch} \
66    -DTCL_INCLUDE_PATH:PATH=${prefix}/include \
67    -DTK_INCLUDE_PATH:PATH=${prefix}/include \
68    -DOPENGL_glu_LIBRARY="" \
69    -DUSE_JPEG=ON \
70    -DUSE_MPEG=ON
71
72variant quartz conflicts x11 {
73    require_active_variants tk    quartz
74    require_active_variants tkdnd quartz
75    require_active_variants Togl  quartz
76    post-patch {
77        reinplace \
78            "s|MACPORTS_NO_X11|TRUE|g" \
79            ${worksrcpath}/CMakeLists.txt
80    }
81}
82
83variant x11 conflicts quartz {
84    require_active_variants tk    x11
85    require_active_variants tkdnd x11
86    require_active_variants Togl  x11
87    depends_lib-append \
88        port:xorg-libX11 \
89        port:xorg-libXmu \
90        port:mesa
91    depends_build-append \
92        port:libGLU
93    configure.args-append \
94        -DOPENGL_gl_LIBRARY=${prefix}/lib/libGL.dylib
95}
96
97if {![variant_isset quartz]} {
98    default_variants +x11
99}
100
101variant oce conflicts opencascade description {(not supported) compile with Open CASCADE Community Edition geometry kernel} {
102    depends_lib-append     port:oce
103    configure.args-append  -DUSE_OCC=ON \
104                           -DOCC_INCLUDE_DIR=${prefix}/include/oce \
105                           -DOCC_LIBRARY=${prefix}/lib
106}
107
108variant opencascade conflicts oce description {(not supported) compile with Open CASCADE geometry kernel} {
109    depends_lib-append     port:opencascade
110    configure.args-append  -DUSE_OCC=ON \
111        -DOCC_INCLUDE_DIR=${prefix}/include/opencascade \
112        -DOCC_LIBRARY=${prefix}/lib
113}
114
115pre-configure {
116    if {![variant_isset quartz] && ![variant_isset x11]} {
117        error "Either +x11 or +quartz is required"
118    }
119}
120
121post-destroot {
122    delete ${destroot}${prefix}/bin/Netgen1
123    delete ${destroot}${prefix}/bin/startup.sh
124
125    xinstall -d -m 0755 ${destroot}${applications_dir}/Netgen.app/Contents/Resources
126    xinstall -d -m 0755 ${destroot}${applications_dir}/Netgen.app/Contents/MacOS
127
128    ln -s \
129        ${prefix}/bin/netgen \
130        ${destroot}${applications_dir}/Netgen.app/Contents/MacOS/Netgen
131
132    move \
133        ${destroot}${prefix}/Info.plist \
134        ${destroot}${applications_dir}/Netgen.app/Contents
135
136    move \
137        ${destroot}${prefix}/Netgen.icns \
138        ${destroot}${applications_dir}/Netgen.app/Contents/Resources
139
140    xinstall -d -m 0755 \
141        ${destroot}${frameworks_dir}/Python.framework/Versions/${python_branch}/lib/python${python_branch}/site-packages
142    ln -s \
143        ${prefix}/lib/python${python_branch}/site-packages/netgen \
144        ${destroot}${frameworks_dir}/Python.framework/Versions/${python_branch}/lib/python${python_branch}/site-packages/
145}