# -*- 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 # $Id: Portfile 141182 2015-10-12 00:05:23Z jeremyhu@macports.org $ PortSystem 1.0 PortGroup active_variants 1.1 PortGroup compiler_blacklist_versions 1.0 PortGroup compilers 1.0 name octave version 3.8.2 revision 13 #conflicts octave-devel categories math science maintainers michaelld openmaintainer license GPL-3 platforms darwin description a Matlab-like environment for numerical analysis long_description Octave provides a convenient command line interface \ for solving linear and nonlinear problems numerically, \ using a language that is mostly compatible with Matlab. \ It is easily extensible and customizable via \ user-defined functions or using dynamically loaded \ modules written in e.g. C++, C or Fortran. homepage http://www.gnu.org/software/octave/ dist_subdir octave distname octave-${version} master_sites gnu:octave use_bzip2 yes checksums rmd160 60201b29d368d0c935a34288c227d202ae286c6c \ sha256 83bbd701aab04e7e57d0d5b8373dd54719bebb64ce0a850e69bf3d7454f33bae compilers.choose fc f77 f90 compilers.setup require_fortran depends_build-append \ port:bison \ port:flex \ port:gperf \ path:bin/perl:perl5 \ port:pkgconfig depends_lib-append \ port:arpack \ port:curl \ port:fftw-3 \ port:fftw-3-single \ port:gawk \ port:glpk \ port:gnuplot \ port:GraphicsMagick \ port:grep \ port:gsed \ port:hdf5 \ port:less \ port:ncurses \ port:pcre \ port:qhull \ port:qrupdate \ port:readline \ port:SuiteSparse \ port:zlib \ port:texinfo depends_run-append port:epstool \ port:ghostscript \ port:transfig \ port:pstoedit # Octave's build system does not produce universal binaries universal_variant no # Don't link with "-flat_namespace -undefined suppress" # on Mac OS X 10.10 Yosemite and later. patchfiles-append patch-yosemite-libtool.diff # Fix certain versions of libc++ use of 'pow'; # See also: < http://llvm.org/bugs/show_bug.cgi?id=21083 > # < https://trac.macports.org/ticket/45210 > # Adding in this patch will not hurt when using a working # version of libcxx (< 1101), nor with using libstdcxx # (where _LIBCPP_VERSION is not defined). # # REMINDER: check without this patch when new libcxx # is available, to determine a stopping point for # when this issue was fixed; add that version to # the patch to "mx-inlines.cc". patchfiles-append patch-clang-libcxx.diff # fix gl2ps renderer interface for compiling using older clang. # See also: < https://trac.macports.org/ticket/44704 > patchfiles-append patch-gl2ps_renderer.diff # common configure arguments configure.args \ --disable-dependency-tracking \ --with-umfpack="-lumfpack -lSuiteSparse" \ --enable-docs \ --enable-strict-warning-flags \ --disable-silent-rules # when using "hdf5 +mpich", have to manually include # "/opt/local/include/mpich-mp". See also: # < https://trac.macports.org/ticket/47618 > pre-configure { # is hdf5 installed and active? if {![catch {set installed [lindex [registry_active hdf5] 0]}]} { # yes: is this one installed with +mpich*? set _variants [lindex ${installed} 3] if {[string first {mpich} ${_variants}] != -1} { # yes; set cpath for both configure and build stages compiler.cpath-append ${prefix}/include/mpich-mp # and, set the configure flag, just in case configure.args-append \ "--with-hdf5-includedir=${prefix}/include/mpich-mp" } } } # octave uses a number of other ports to create sources from template: # perl, gawk, gsed, flex, bison, texinfo. Make sure these are the # MacPorts' versions. Python is not used if perl is available, so # clear it out. grep is checked for in 'configure', but not used # except inside that script; include it here for completion. configure.perl ${prefix}/bin/perl configure.python ' ' configure.awk ${prefix}/bin/gawk configure.env-append GREP="${prefix}/bin/grep" \ SED="${prefix}/bin/gsed" \ TEXI2DVI="${prefix}/bin/texi2dvi" \ TEXI2PDF="${prefix}/bin/texi2pdf" configure.cppflags configure.ldflags test.run yes test.target check # Block compilers: Some older versions of CLANG do not honor the CPATH # environment variables, which is required for compiling this port # when using MacPorts. The versions seem to be: MacPorts CLANG 2.9 or # earlier, and Apple CLANG 318.0.58 or older. # # See also < http://llvm.org/bugs/show_bug.cgi?id=8971 > # < https://trac.macports.org/ticket/40250 >. compiler.blacklist-append { clang <= 318.0.61 } platform darwin { if {${os.major} >= 12} { # In 10.8+, the LANG environment variable needs to be set to # "C" otherwise /usr/bin/sed fails with an error. Ideally, # octave's build system would honor the environment variable # ${SED} throughout; reality is that it does not, so this # addition is required because /usr/bin/sed will be used. build.args-append LANG="C" } } # atlas does not work with g95, so always conflict with it variant atlas description {use BLAS from MacPorts' atlas port} \ conflicts g95 accelerate { depends_lib-append port:atlas # NOTE: libtatlas does not work as of 3.10.1_5 configure.args-append \ --with-blas="-lcblas -lf77blas -latlas" \ --with-lapack="-llapack" } variant accelerate description \ {use BLAS from Apple's Accelerate.framework [might be buggy]} \ conflicts atlas { depends_lib-append port:vecLibFort configure.args-append \ --with-blas=-lvecLibFort \ --with-lapack="-Wl,-framework -Wl,Accelerate" } if {![variant_isset accelerate] && ![variant_isset atlas]} { # when neither +accelerate nor +atlas is selected, default to the # correct one for the selected Fortran compiler. if {![variant_isset g95]} { default_variants +atlas } else { default_variants +accelerate } } # make sure that either +accelerate or +atlas is selected if {![variant_isset accelerate] && ![variant_isset atlas]} { ui_error "\n\nYou must select either the +accelerate or +atlas variant.\n" return -code error "Invalid variant selection" } variant x11 conflicts glgui description {Enable use of X11} {} if {[variant_isset x11]} { configure.args-append --with-x --x-includes=${prefix} } else { configure.args-append --without-x } if {![variant_isset x11]} { default_variants +glgui } variant glgui conflicts x11 description {Enable OpenGL GUI (via FLTK) as the default graphical front-end} { # for now on OSX 10.11, just use fltk-devel since fltk does not # build; remove this condition with the next fltk release (noted # in that Portfile too). if {${os.major} == 15} { depends_lib-append port:fltk-devel } else { depends_lib-append path:lib/libfltk.dylib:fltk } depends_lib-append port:fontconfig \ port:freetype \ port:gl2ps } if {[variant_isset glgui]} { configure.args-append --with-opengl } else { configure.args-append --without-opengl } variant gui requires qtgui description {Legacy variant} {} variant qtgui description {Enable experimental Qt GUI Application} { depends_lib-append port:qscintilla } if {[variant_isset qtgui]} { configure.args-append --enable-gui } else { configure.args-append --disable-gui } variant java description {Enable Java interface} {} if {[variant_isset java]} { configure.args-append --enable-java } else { configure.args-append --disable-java } # jit build fails for 3.8.1 # variant jit description {Enable experimental JIT compiler} {} # if {[variant_isset jit]} { # depends_lib-append port:clang-3.3 # configure.args-append --enable-jit # configure.env-append LLVM_CONFIG=${prefix}/bin/llvm-config-mp-3.3 \ # SHLIB_CXXLD=clang++-mp-3.3 # configure.cc clang-mp-3.3 # configure.cxx clang++-mp-3.3 # } else { # configure.args-append --disable-jit # } variant metis description {Use SuiteSparse + Metis for graph partitioning} { 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)." depends_lib-append port:metis } if {[variant_isset metis]} { configure.args-append --with-cholmod="-lcholmod -lmetis" # make sure SuiteSparse is installed with +metis require_active_variants SuiteSparse metis } else { configure.args-append --with-cholmod="-lcholmod" # make sure SuiteSparse is installed without +metis require_active_variants SuiteSparse {} metis } # check for +accelerate here as well as in dependent ports; # Apple's VecLib has bugs that cause Octave to crash sometimes, # while Atlas does not have these issues. Print a warning if this # variant is in use, but do not force the use of +atlas (for now). if {![catch {set result [active_variants arpack accelerate {}]}]} { if {$result} { 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" } } if {[variant_isset accelerate]} { 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" } post-destroot { # select the default graphics toolkit depending on the +glgui variant if {[variant_isset glgui]} { system "echo 'graphics_toolkit(\"fltk\");' >> ${destroot}${prefix}/share/octave/site/m/startup/octaverc" } else { system "echo 'graphics_toolkit(\"gnuplot\");' >> ${destroot}${prefix}/share/octave/site/m/startup/octaverc" } # install the libc++ fix, no matter if used or not, since it is # required for projects including these headers. xinstall -m 644 ${worksrcpath}/liboctave/operators/libcxx-fix.h \ ${destroot}${prefix}/include/${name}-${version}/${name}/libcxx-fix.h # when doing +qtgui variant, create the Mac OS X .app if {[variant_isset qtgui]} { set appdir ${destroot}${applications_dir}/Octave.app xinstall -d ${appdir}/Contents/MacOS xinstall -d ${appdir}/Contents/Resources xinstall -m 644 ${filespath}/Info.plist ${appdir}/Contents/ xinstall -m 644 ${filespath}/Octave.icns ${appdir}/Contents/Resources/ xinstall -m 755 ${filespath}/Octave ${appdir}/Contents/MacOS reinplace -W ${appdir}/Contents "s,@@VERSION@@,${version},g" Info.plist reinplace -W ${appdir}/Contents/MacOS "s,@@PREFIX@@,${prefix},g" Octave } } livecheck.type regex livecheck.url http://www.gnu.org/software/octave/download.html livecheck.regex GNU Octave (\[\^\ \]*) was