source: trunk/dports/math/octave/Portfile @ 147494

Last change on this file since 147494 was 147494, checked in by mmoll@…, 4 years ago

hdf5: update to version 1.10.0, bump revision of ports that depend on hdf5 and need to be rebuilt. closes #51062

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.7 KB
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: Portfile 147494 2016-04-05 20:52:07Z mmoll@macports.org $
3
4PortSystem          1.0
5PortGroup           active_variants 1.1
6PortGroup           compiler_blacklist_versions 1.0
7PortGroup           compilers 1.0
8
9name                octave
10
11version             3.8.2
12revision            16
13#conflicts           octave-devel
14categories          math science
15maintainers         michaelld openmaintainer
16license             GPL-3
17platforms           darwin
18
19description         a Matlab-like environment for numerical analysis
20long_description    Octave provides a convenient command line interface \
21                    for solving linear and nonlinear problems numerically, \
22                    using a language that is mostly compatible with Matlab. \
23                    It is easily extensible and customizable via \
24                    user-defined functions or using dynamically loaded \
25                    modules written in e.g. C++, C or Fortran.
26
27homepage            http://www.gnu.org/software/octave/
28dist_subdir         octave
29distname            octave-${version}
30master_sites        gnu:octave
31use_bzip2           yes
32
33checksums           rmd160  60201b29d368d0c935a34288c227d202ae286c6c \
34                    sha256  83bbd701aab04e7e57d0d5b8373dd54719bebb64ce0a850e69bf3d7454f33bae
35
36compilers.choose    fc f77 f90
37compilers.setup     require_fortran
38
39depends_build-append \
40                    port:bison \
41                    port:flex \
42                    port:gperf \
43                    path:bin/perl:perl5 \
44                    port:pkgconfig
45
46depends_lib-append \
47                    port:arpack \
48                    port:curl \
49                    port:fftw-3 \
50                    port:fftw-3-single \
51                    port:gawk \
52                    port:glpk \
53                    port:gnuplot \
54                    port:GraphicsMagick \
55                    port:grep \
56                    port:gsed \
57                    port:hdf5 \
58                    port:less \
59                    port:ncurses \
60                    port:pcre \
61                    port:qhull \
62                    port:qrupdate \
63                    port:readline \
64                    port:SuiteSparse \
65                    port:zlib \
66                    port:texinfo
67
68depends_run-append  port:epstool \
69                    port:ghostscript \
70                    port:transfig \
71                    port:pstoedit
72
73# Octave's build system does not produce universal binaries
74
75universal_variant   no
76
77# Don't link with "-flat_namespace -undefined suppress"
78# on Mac OS X 10.10 Yosemite and later.
79
80patchfiles-append   patch-yosemite-libtool.diff
81
82# Fix certain versions of libc++ use of 'pow';
83# See also: < http://llvm.org/bugs/show_bug.cgi?id=21083 >
84#           < https://trac.macports.org/ticket/45210 >
85# Adding in this patch will not hurt when using a working
86# version of libcxx (< 1101), nor with using libstdcxx
87# (where _LIBCPP_VERSION is not defined).
88#
89# REMINDER: check without this patch when new libcxx
90# is available, to determine a stopping point for
91# when this issue was fixed; add that version to
92# the patch to "mx-inlines.cc".
93
94patchfiles-append   patch-clang-libcxx.diff
95
96# fix gl2ps renderer interface for compiling using older clang.
97# See also: < https://trac.macports.org/ticket/44704 >
98
99patchfiles-append   patch-gl2ps_renderer.diff
100
101# common configure arguments
102
103configure.args \
104    --disable-dependency-tracking \
105    --with-umfpack="-lumfpack -lSuiteSparse" \
106    --enable-docs \
107    --enable-strict-warning-flags \
108    --disable-silent-rules
109
110# when using "hdf5 +mpich", have to manually include
111# "/opt/local/include/mpich-mp". See also:
112# < https://trac.macports.org/ticket/47618 >
113
114pre-configure {
115    # is hdf5 installed and active?
116    if {![catch {set installed [lindex [registry_active hdf5] 0]}]} {
117        # yes: is this one installed with +mpich*?
118        set _variants [lindex ${installed} 3]
119        if {[string first {mpich} ${_variants}] != -1} {
120            # yes; set cpath for both configure and build stages
121            compiler.cpath-append ${prefix}/include/mpich-mp
122            # and, set the configure flag, just in case
123            configure.args-append \
124                "--with-hdf5-includedir=${prefix}/include/mpich-mp"
125        }
126    }
127}
128
129# octave uses a number of other ports to create sources from template:
130# perl, gawk, gsed, flex, bison, texinfo.  Make sure these are the
131# MacPorts' versions.  Python is not used if perl is available, so
132# clear it out.  grep is checked for in 'configure', but not used
133# except inside that script; include it here for completion.
134
135configure.perl      ${prefix}/bin/perl
136configure.python    ' '
137configure.awk       ${prefix}/bin/gawk
138configure.env-append GREP="${prefix}/bin/grep" \
139                     SED="${prefix}/bin/gsed" \
140                     TEXI2DVI="${prefix}/bin/texi2dvi" \
141                     TEXI2PDF="${prefix}/bin/texi2pdf"
142configure.cppflags
143configure.ldflags
144
145test.run            yes
146test.target         check
147
148# Block compilers: Some older versions of CLANG do not honor the CPATH
149# environment variables, which is required for compiling this port
150# when using MacPorts.  The versions seem to be: MacPorts CLANG 2.9 or
151# earlier, and Apple CLANG 318.0.58 or older.
152#
153# See also < http://llvm.org/bugs/show_bug.cgi?id=8971 >
154#          < https://trac.macports.org/ticket/40250 >.
155
156compiler.blacklist-append { clang <= 318.0.61 }
157
158platform darwin {
159    if {${os.major} >= 12} {
160
161        # In 10.8+, the LANG environment variable needs to be set to
162        # "C" otherwise /usr/bin/sed fails with an error.  Ideally,
163        # octave's build system would honor the environment variable
164        # ${SED} throughout; reality is that it does not, so this
165        # addition is required because /usr/bin/sed will be used.
166
167        build.args-append LANG="C"
168    }
169}
170
171# atlas does not work with g95, so always conflict with it
172
173variant atlas description {use BLAS from MacPorts' atlas port} \
174    conflicts g95 accelerate {
175
176    depends_lib-append port:atlas
177    # NOTE: libtatlas does not work as of 3.10.1_5
178    configure.args-append \
179        --with-blas="-lcblas -lf77blas -latlas" \
180        --with-lapack="-llapack"
181
182}
183
184variant accelerate description \
185    {use BLAS from Apple's Accelerate.framework [might be buggy]} \
186    conflicts atlas {
187
188    depends_lib-append port:vecLibFort
189    configure.args-append \
190        --with-blas=-lvecLibFort \
191        --with-lapack="-Wl,-framework -Wl,Accelerate"
192
193}
194
195if {![variant_isset accelerate] && ![variant_isset atlas]} {
196
197    # when neither +accelerate nor +atlas is selected, default to the
198    # correct one for the selected Fortran compiler.
199    if {![variant_isset g95]} {
200        default_variants +atlas
201    } else {
202        default_variants +accelerate
203    }
204
205}
206
207# make sure that either +accelerate or +atlas is selected
208
209if {![variant_isset accelerate] && ![variant_isset atlas]} {
210
211    ui_error "\n\nYou must select either the +accelerate or +atlas variant.\n"
212    return -code error "Invalid variant selection"
213
214}
215
216variant x11 conflicts glgui description {Enable use of X11} {}
217
218if {[variant_isset x11]} {
219
220    configure.args-append --with-x --x-includes=${prefix}
221
222} else {
223
224    configure.args-append --without-x
225
226}
227
228if {![variant_isset x11]} {
229
230    default_variants +glgui
231
232}
233
234variant glgui conflicts x11 description {Enable OpenGL GUI (via FLTK) as the default graphical front-end} {
235
236    depends_lib-append path:lib/libfltk.dylib:fltk
237    depends_lib-append port:fontconfig \
238                       port:freetype \
239                       port:gl2ps
240
241}
242
243if {[variant_isset glgui]} {
244
245    configure.args-append --with-opengl
246
247} else {
248
249    configure.args-append --without-opengl
250
251}
252
253variant gui requires qtgui description {Legacy variant} {}
254
255variant qtgui description {Enable experimental Qt GUI Application} {
256
257    PortGroup qt4 1.0
258    depends_lib-append port:qscintilla
259
260}
261
262if {[variant_isset qtgui]} {
263
264    configure.args-append --enable-gui
265
266} else {
267
268    configure.args-append --disable-gui
269
270}
271
272variant java description {Enable Java interface} {}
273
274if {[variant_isset java]} {
275
276    configure.args-append --enable-java
277
278} else {
279
280    configure.args-append --disable-java
281
282}
283
284# jit build fails for 3.8.1
285# variant jit description {Enable experimental JIT compiler} {}
286
287# if {[variant_isset jit]} {
288
289#     depends_lib-append    port:clang-3.3
290#     configure.args-append --enable-jit
291#     configure.env-append  LLVM_CONFIG=${prefix}/bin/llvm-config-mp-3.3 \
292#                           SHLIB_CXXLD=clang++-mp-3.3
293#     configure.cc          clang-mp-3.3
294#     configure.cxx         clang++-mp-3.3
295
296# } else {
297
298#     configure.args-append --disable-jit
299
300# }
301
302variant metis description {Use SuiteSparse + Metis for graph partitioning} {
303
304    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)."
305
306    depends_lib-append      port:metis
307
308}
309
310if {[variant_isset metis]} {
311
312    configure.args-append   --with-cholmod="-lcholmod -lmetis"
313
314    # make sure SuiteSparse is installed with +metis
315    require_active_variants SuiteSparse metis
316
317} else {
318
319    configure.args-append   --with-cholmod="-lcholmod"
320
321    # make sure SuiteSparse is installed without +metis
322    require_active_variants SuiteSparse {} metis
323
324}
325
326# check for +accelerate here as well as in dependent ports;
327# Apple's VecLib has bugs that cause Octave to crash sometimes,
328# while Atlas does not have these issues.  Print a warning if this
329# variant is in use, but do not force the use of +atlas (for now).
330
331if {![catch {set result [active_variants arpack accelerate {}]}]} {
332    if {$result} {
333        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"
334    }
335}
336
337if {[variant_isset accelerate]} {
338    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"
339}
340
341post-destroot {
342
343    # select the default graphics toolkit depending on the +glgui variant
344
345    if {[variant_isset glgui]} {
346        system "echo 'graphics_toolkit(\"fltk\");' >> ${destroot}${prefix}/share/octave/site/m/startup/octaverc"
347    } else {
348        system "echo 'graphics_toolkit(\"gnuplot\");' >> ${destroot}${prefix}/share/octave/site/m/startup/octaverc"
349    }
350
351    # install the libc++ fix, no matter if used or not, since it is
352    # required for projects including these headers.
353
354    xinstall -m 644 ${worksrcpath}/liboctave/operators/libcxx-fix.h \
355        ${destroot}${prefix}/include/${name}-${version}/${name}/libcxx-fix.h
356
357    # when doing +qtgui variant, create the Mac OS X .app
358
359    if {[variant_isset qtgui]} {
360        set appdir ${destroot}${applications_dir}/Octave.app
361        xinstall -d ${appdir}/Contents/MacOS
362        xinstall -d ${appdir}/Contents/Resources
363
364        xinstall -m 644 ${filespath}/Info.plist ${appdir}/Contents/
365        xinstall -m 644 ${filespath}/Octave.icns ${appdir}/Contents/Resources/
366        xinstall -m 755 ${filespath}/Octave ${appdir}/Contents/MacOS
367
368        reinplace -W ${appdir}/Contents "s,@@VERSION@@,${version},g" Info.plist
369        reinplace -W ${appdir}/Contents/MacOS "s,@@PREFIX@@,${prefix},g" Octave
370    }
371}
372
373livecheck.type      regex
374livecheck.url       http://www.gnu.org/software/octave/download.html
375livecheck.regex     GNU Octave (\[\^\ \]*) was
Note: See TracBrowser for help on using the repository browser.