Ticket #41155: Portfile

File Portfile, 8.9 KB (added by seanfarley (Sean Farley), 10 years ago)

Full Portfile proposal for 3.8.1

Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
2# $Id$
3
4PortSystem          1.0
5PortGroup           active_variants 1.1
6PortGroup           compiler_blacklist_versions 1.0
7PortGroup           compilers 1.0
8
9compilers.choose    fc f77 f90
10compilers.setup     require_fortran
11
12name                octave
13
14version             3.8.1
15#conflicts           octave-devel
16categories          math science
17maintainers         michaelld openmaintainer
18license             GPL-3
19platforms           darwin
20
21description         a Matlab-like environment for numerical analysis
22long_description    Octave provides a convenient command line interface \
23                    for solving linear and nonlinear problems numerically, \
24                    using a language that is mostly compatible with Matlab. \
25                    It is easily extensible and customizable via \
26                    user-defined functions or using dynamically loaded \
27                    modules written in e.g. C++, C or Fortran.
28
29homepage            http://www.gnu.org/software/octave/
30dist_subdir         octave
31distname            octave-${version}
32master_sites        gnu:octave
33use_bzip2           yes
34
35checksums           rmd160  a76587b29a964791982bd9c803b0394411b9f874 \
36                    sha256  d6762ed2ad4a042243a095fb44c7a1d3a91c635b6dca37fcef15a5efdffa9bbd
37
38depends_build-append \
39                    port:bison \
40                    port:flex \
41                    port:gperf \
42                    path:bin/perl:perl5 \
43                    port:pkgconfig
44
45depends_lib-append \
46                    port:arpack \
47                    port:curl \
48                    port:fftw-3 \
49                    port:fftw-3-single \
50                    port:gawk \
51                    port:glpk \
52                    port:gnuplot \
53                    port:GraphicsMagick \
54                    port:grep \
55                    port:gsed \
56                    port:hdf5-18 \
57                    port:less \
58                    port:ncurses \
59                    port:pcre \
60                    port:qhull \
61                    port:qrupdate \
62                    port:readline \
63                    port:SuiteSparse \
64                    port:zlib
65
66depends_run-append  port:epstool \
67                    port:ghostscript \
68                    port:transfig \
69                    port:pstoedit
70
71universal_variant   no
72
73# common configure arguments
74configure.args \
75    --disable-dependency-tracking \
76    --with-umfpack="-lumfpack -lSuiteSparse" \
77    --disable-java \
78    --with-opengl \
79    --with-framework-opengl
80
81# octave uses a number of other ports to create sources from template:
82# perl, gawk, gsed, flex, bison, texinfo.  Make sure these are the
83# MacPorts' versions.  Python is not used if perl is available, so
84# clear it out.  grep is checked for in 'configure', but not used
85# except inside that script; include it here for completion.
86
87configure.perl      ${prefix}/bin/perl
88configure.python    ' '
89configure.awk       ${prefix}/bin/gawk
90configure.env-append GREP="${prefix}/bin/grep" \
91                     SED="${prefix}/bin/gsed" \
92                     TEXI2DVI="${prefix}/bin/texi2dvi" \
93                     TEXI2PDF="${prefix}/bin/texi2pdf"
94configure.cppflags
95configure.ldflags
96
97test.run            yes
98test.target         check
99
100# Block compilers: Some older versions of CLANG do not honor the CPATH
101# environment variables, which is required for compiling this port
102# when using MacPorts.  The versions seem to be: MacPorts CLANG 2.9 or
103# earlier, and Apple CLANG 318.0.58 or older.
104#
105# See also < http://llvm.org/bugs/show_bug.cgi?id=8971 >
106#          < https://trac.macports.org/ticket/40250 >.
107
108compiler.blacklist-append { clang <= 318.0.61 } macports-clang-2.9
109
110platform darwin {
111    if {${os.major} >= 12} {
112
113        # In 10.8+, the LANG environment variable needs to be set to
114        # "C" otherwise /usr/bin/sed fails with an error.  Ideally,
115        # octave's build system would honor the environment variable
116        # ${SED} throughout; reality is that it does not, so this
117        # addition is required because /usr/bin/sed will be used.
118
119        build.args-append LANG="C"
120    }
121}
122
123if {![fortran_variant_isset]} {
124    default_variants-append +gcc48
125}
126
127# atlas does not work with g95, so always conflict with it
128
129variant atlas description {use BLAS from MacPorts' atlas port} \
130    conflicts g95 accelerate {}
131
132variant accelerate description \
133    {use BLAS from Apple's Accelerate.framework [might be buggy]} \
134    conflicts atlas {}
135
136if {![variant_isset accelerate] && ![variant_isset atlas]} {
137    default_variants +atlas
138}
139
140# make sure that either +accelerate or +atlas is selected
141
142if {![variant_isset accelerate] && ![variant_isset atlas]} {
143
144    ui_error "\n\nYou must select either the +accelerate or +atlas variant.\n"
145    return -code error "Invalid variant selection"
146
147}
148
149if {[variant_isset accelerate]} {
150
151    depends_lib-append port:dotwrp
152    configure.args-append \
153        --with-blas="-ldotwrp -Wl,-framework -Wl,Accelerate" \
154        --with-lapack="-Wl,-framework -Wl,Accelerate"
155
156} else {
157
158    depends_lib-append    port:atlas
159    # NOTE: libtatlas does not work as of 3.10.1_5
160    configure.args-append \
161        --with-blas="-lcblas -lf77blas -latlas" \
162        --with-lapack="-llapack"
163
164}
165
166variant docs description {Enable creation and installation of \
167                          documentation including manpages} {}
168
169if {[variant_isset docs]} {
170
171    depends_lib-append \
172        port:texinfo \
173        port:texlive-latex
174
175    configure.args-append --enable-docs
176
177} else {
178
179    configure.args-append --disable-docs
180
181}
182
183variant x11 description {Enable use of X11} {}
184
185if {[variant_isset x11]} {
186
187    configure.args-append --with-x --x-includes=${prefix}
188
189} else {
190
191    configure.args-append --without-x
192
193}
194
195variant gui description {Enable experimental gui} {}
196
197if {[variant_isset gui]} {
198
199    depends_lib-append port:qt4-mac
200    configure.args-append --enable-gui
201
202} else {
203
204    configure.args-append --disable-gui
205
206}
207
208# jit build fails for 3.8.1
209# variant jit description {Enable experimental JIT compiler} {}
210
211# if {[variant_isset jit]} {
212
213#     depends_lib-append    port:clang-3.3
214#     configure.args-append --enable-jit
215#     configure.env-append  LLVM_CONFIG=${prefix}/bin/llvm-config-mp-3.3 \
216#                           SHLIB_CXXLD=clang++-mp-3.3
217#     configure.cc          clang-mp-3.3
218#     configure.cxx         clang++-mp-3.3
219
220# } else {
221
222#     configure.args-append --disable-jit
223
224# }
225
226variant metis description {Use SuiteSparse + Metis for graph partitioning} {
227    notes-append "\nWARNING: ${name} variant +metis uses the metis port, whose license is incompatible with Octave's.  You can use this combination locally, but you cannot distribute them as a single package (e.g., tarball, m/pkg, archive)."
228}
229
230if {[variant_isset metis]} {
231
232    depends_lib-append      port:metis
233    configure.args-append   --with-cholmod="-lcholmod -lmetis"
234
235    # make sure SuiteSparse is installed with +metis
236    require_active_variants SuiteSparse metis
237
238} else {
239
240    configure.args-append   --with-cholmod="-lcholmod"
241
242    # make sure SuiteSparse is installed without +metis
243    require_active_variants SuiteSparse {} metis
244
245}
246
247# check for +accelerate here as well as in dependent ports;
248# Apple's VecLib has bugs that cause Octave to crash sometimes,
249# while Atlas does not have these issues.  Print a warning if this
250# variant is in use, but do not force the use of +atlas (for now).
251
252if {![catch {set result [active_variants arpack accelerate {}]}]} {
253    if {$result} {
254        notes-append "\nWARNING: Dependency 'arpack' is installed with the +accelerate variant, using Apple's Vector Libraries which have some known bugs that can cause Octave to crash if using certain functions in arpack.  The +atlas variant does not have these issues with Octave, but does take many hours to compile even on modern hardware.\n"
255    }
256}
257
258if {[variant_isset accelerate]} {
259    notes-append "\nWARNING: The +accelerate variant has been selected, using Apple's Vector Libraries which have some known bugs that can cause Octave to crash.  The +atlas variant does not have these issues with Octave, but does take many hours to compile even on modern hardware.\n"
260}
261
262post-destroot {
263    system "echo 'graphics_toolkit(\"gnuplot\");' >> ${destroot}${prefix}/share/octave/site/m/startup/octaverc"
264
265    if {[variant_isset gui]} {
266        set appdir ${destroot}${applications_dir}/Octave.app
267        xinstall -d ${appdir}/Contents/MacOS
268        xinstall -d ${appdir}/Contents/Resources
269
270        xinstall -m 644 ${filespath}/Info.plist ${appdir}/Contents/
271        xinstall -m 644 ${filespath}/Octave.icns ${appdir}/Contents/Resources/
272        xinstall -m 755 ${filespath}/Octave ${appdir}/Contents/MacOS
273
274        reinplace -W ${appdir}/Contents "s,@@VERSION@@,${version},g" Info.plist
275    }
276}
277
278livecheck.type      regex
279livecheck.url       http://www.gnu.org/software/octave/download.html
280livecheck.regex     GNU Octave (\[\^\ \]*) was