# -*- 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 # $Id$ PortSystem 1.0 PortGroup compilers 1.0 PortGroup muniversal 1.0 PortGroup compiler_blacklist_versions 1.0 PortGroup linear_algebra 1.0 name octave version 4.0.3 revision 1 categories math science platforms darwin license GPL-3+ maintainers mcalhoun openmaintainer description a high-level language for numerical computations long_description \ GNU Octave is a high-level language, primarily intended for numerical \ computations. It provides a convenient command-line interface for \ solving linear and nonlinear problems numerically. homepage http://www.gnu.org/software/octave master_sites gnu:octave checksums rmd160 a0e9edd72966ede204c8ac5f5066790d899473d8 \ sha256 5a16a42fca637ae1b55b4a5a6e7b16a6df590cbaeeb4881a19c7837789515ec6 # 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 } # see http://savannah.gnu.org/bugs/?func=detailitem&item_id=46592 patchfiles-append \ patch-e870a68742a6.diff # see http://savannah.gnu.org/bugs/?41027 patchfiles-append \ octave-bug_41027.patch # Don't link with "-flat_namespace -undefined suppress" # on Mac OS X 10.10 Yosemite and later. patchfiles-append patch-yosemite-libtool.diff pre-patch { # code located in pre-patch because variants from PortGroup compilers must # be evaluated before it can be determined if clang is being used # see http://trac.macports.org/ticket/45011 # see http://savannah.gnu.org/bugs/?43298 set libcxxbug no if { ${configure.cc} eq "/usr/bin/clang" && [lindex [split ${xcodeversion} .] 0] eq 6 } { set libcxxbug yes } elseif { [variant_exists clang35] && [variant_isset clang35] } { set libcxxbug yes } if { ${libcxxbug} } { patchfiles-append \ clang-libcxx-fix.patch } # see https://trac.macports.org/ticket/44704 set gl2psbug no if { ${configure.cc} eq "/usr/bin/clang" && [vercmp ${xcodeversion} 5.0.0] < 0 } { set gl2psbug yes } elseif { [variant_exists clang33] && [variant_isset clang33] } { set gl2psbug yes } if { ${gl2psbug} } { patchfiles-append patch-gl2ps_renderer.diff } } # avoid depends_build-append port:coreutils configure.env-append MKDIR_P="/bin/mkdir -p" # avoid depends_build-append port:cctools configure.env-append RANLIB=/usr/bin/ranlib # workaround for build failure with Xcode8 (#52301) configure.env-append "ac_cv_func_mkostemp=no" # main octave port lists as a depends_lib # configure.ac list it among the "[p]rograms used in Makefiles" depends_build-append port:gawk configure.awk ${prefix}/bin/gawk # in configure.ac, said to be "[p]rograms used to generate icons file formats depends_build-append \ port:icoutils \ port:librsvg configure.env-append \ ICOTOOL=${prefix}/bin/icotool \ RSVG_CONVERT=${prefix}/bin/rsvg-convert # main octave port lists as a depends_lib # configure.ac list it among the "[p]rograms used in Makefiles" depends_build-append port:grep configure.env-append GREP=${prefix}/bin/grep configure.env-append EGREP=${prefix}/bin/egrep configure.env-append FGREP=${prefix}/bin/fgrep # configure.ac list it among the "[p]rograms used in Makefiles" depends_build-append port:findutils configure.env-append FIND=${prefix}/bin/gfind # main octave port lists as a depends_lib # configure.ac list it among the "[p]rograms used in Makefiles" depends_build-append port:gsed configure.env-append SED=${prefix}/bin/gsed depends_build-append port:flex configure.env-append LEX=${prefix}/bin/flex depends_build-append port:bison configure.env-append YACC="${prefix}/bin/bison -y" depends_build-append port:gperf configure.env-append GPERF=/usr/bin/gperf # configure.ac list it among the "[p]rograms used in Makefiles" depends_build-append port:perl5 configure.perl ${prefix}/bin/perl5 # avoid depends_build-append port:desktop-file-utils #configure.env-append DESKTOP_FILE_INSTALL="" configure.env-append ac_cv_prog_DESKTOP_FILE_INSTALL="" depends_build-append \ port:pkgconfig compilers.choose fc f77 f90 cc cxx # for now, limit the number of variants # some of these compilers may work fine # # gcc 5 (and below?) does not work because of # https://stackoverflow.com/questions/22519756/macports-gcc-4-8-2-error-with-mmacosx-version-min-and-foundation-headers # and # https://www.riverbankcomputing.com/pipermail/qscintilla/2016-May/001129.html # # gcc 6 (and above?) does not work because of # http://octave.1599824.n4.nabble.com/Major-issues-with-g-6-and-gnulib-tt4674928.html # and # https://savannah.gnu.org/bugs/?47073 # compilers.setup \ require_fortran \ -dragonegg \ -gcc7 \ -gcc6 \ -gcc5 \ -gcc49 \ -gcc48 \ -gcc47 \ -gcc46 \ -gcc45 \ -gcc44 \ -g95 \ -llvm \ -clang36 \ -clang35 \ -clang34 \ -clang33 # offscreen rendering with OpenGL via osmesa would be nice to have, but the following # causes a segmentation fault: # h = figure ("visible", "off"); fn = tempname (); sombrero (); __osmesa_print__ (h, fn, "svg"); # # solution is ??? # #depends_lib-append port:mesa configure.args-append \ --without-OSMesa #configure.args-append --with-shell=??? configure.args-append \ --with-framework-carbon \ --without-x \ --enable-static configure.args-append \ --disable-openmp configure.args-append \ --disable-java \ --disable-gui \ --without-fltk \ --without-opengl \ --disable-jit \ --without-sndfile \ --without-portaudio \ --without-magick \ --disable-docs # in configure.ac, listed as one of "[p]rograms used when running Octave" depends_lib-append port:python27 configure.python ${prefix}/bin/python2.7 # in configure.ac, listed as one of "[p]rograms used when running Octave" depends_lib-append port:ghostscript configure.env-append GHOSTSCRIPT=${prefix}/bin/gs # in configure.ac, listed as one of "[p]rograms used when running Octave" depends_lib-append port:gnuplot configure.env-append GNUPLOT=${prefix}/bin/gnuplot # in configure.ac, listed as one of "[p]rograms used when running Octave" depends_lib-append port:less configure.env-append DEFAULT_PAGER=${prefix}/bin/less depends_lib-append port:ncurses depends_lib-append port:readline depends_lib-append port:pcre #--without-amd #--without-camd #--without-colamd #--without-cholmod #--without-cxsparse #--without-umfpack depends_lib-append port:SuiteSparse foreach lib {amd camd colamd cholmod cxsparse umfpack} { configure.args-append \ --with-${lib}="-l${lib} -lsuitesparseconfig" } #--without-qhull depends_lib-append port:qhull #--without-z depends_lib-append port:zlib patchfiles-append patch-libinterp-Makefile.in.diff #--without-hdf5 depends_lib-append port:hdf5 #--disable-fftw-threads #--without-fftw3 #--without-fftw3f depends_lib-append port:fftw-3 depends_lib-append port:fftw-3-single #--without-glpk depends_lib-append port:glpk #--without-curl depends_lib-append port:curl #--without-qrupdate depends_lib-append port:qrupdate #--without-arpack depends_lib-append port:arpack #--without-openssl depends_lib-append port:openssl # fortran arch flag is not set automatically if {![variant_isset universal]} { if {${build_arch} eq "x86_64" || ${build_arch} eq "ppc64"} { configure.fflags-append -m64 } else { configure.fflags-append -m32 } } # see etc/README.MacOS depends_run-append \ port:epstool \ port:ghostscript \ port:transfig \ port:pstoedit pre-configure { configure.args-append --with-blas="-L${prefix}/lib ${linalglib}" --with-lapack="" } variant java description {enable Java interface} { PortGroup java 1.0 configure.args-replace --disable-java --enable-java } # java variant seems to cause problems for both users and build bots # https://lists.macosforge.org/pipermail/macports-users/2016-May/thread.html#41052 # #51480 #default_variants-append +java variant qt4gui description {build the GUI using Qt4} { PortGroup qt4 1.0 depends_lib-append port:qscintilla configure.args-replace --disable-gui --enable-gui } default_variants-append +qt4gui variant fltk description {enable fltk as a graphics toolkit for plotting} { depends_lib-append path:lib/libfltk.dylib:fltk configure.args-replace --without-fltk --with-fltk } default_variants-append +fltk if {[variant_isset fltk] || [variant_isset qt4gui]} { # native_graphics (fltk) and gui (Qt) require OpenGL and font and printing capabilities depends_lib-append \ port:fontconfig \ port:freetype \ port:gl2ps configure.args-replace --without-opengl --with-framework-opengl } if {[variant_isset fltk] && [variant_isset qt4gui]} { notes-append "unless octave is run with --no-gui-libs, graphics_toolkit(\"fltk\") will cause a crash" } variant jit description {enable JIT compiler (EXPERIMENTAL)} { # JIT requires LLVM, so select a version to use set llvm_ver 3.8 # prevent multiple versions of llvm being required # if clangXY compiler is requested, use llvm-X.Y foreach clang ${compilers.clang_variants} { if { [variant_exists ${clang}] && [variant_isset ${clang}] } { set llvm_ver [string index ${clang} end-1].[string index ${clang} end] } } depends_lib-append port:llvm-${llvm_ver} configure.args-replace --disable-jit --enable-jit configure.env-append LLVM_CONFIG=${prefix}/bin/llvm-config-mp-${llvm_ver} configure.cxxflags-append -std=c++11 } variant sound description {enable audio support (file I/O and playback)} { depends_lib-append port:libsndfile depends_lib-append port:portaudio configure.args-replace --without-sndfile --with-sndfile configure.args-replace --without-portaudio --with-portaudio } default_variants-append +sound variant app description "build application bundle to launch ${subport}" { depends_build-append port:ImageMagick if {[vercmp ${xcodeversion} 4.5] < 0} { # need a way to generate icns file for XCode prior to 4.5 # see #51487 depends_build-append port:libicns } global appName set appName Octave.app post-build { xinstall -d -m 0755 ${worksrcpath}/${appName}/Contents xinstall -d -m 0755 ${worksrcpath}/${appName}/Contents/Resources xinstall -d -m 0755 ${worksrcpath}/${appName}/Contents/MacOS set script [open "${worksrcpath}/${appName}/Contents/MacOS/Octave" w 0755] if { [variant_isset qt4gui] } { puts ${script} "#!/bin/sh" puts ${script} "" puts ${script} "${prefix}/bin/octave-${version} --force-gui" } else { puts ${script} "#!/usr/bin/osascript" puts ${script} "" puts ${script} "tell application \"Terminal\" to do script \"${prefix}/bin/octave-${version} --no-gui-libs; exit\"" } close ${script} #NSHumanReadableCopyright '' #LSUIElement 1 set values " CFBundleDevelopmentRegion string English CFBundleExecutable string Octave CFBundleIconFile string Octave.icns CFBundleIdentifier string org.octave.Octave CFBundleInfoDictionaryVersion string 6.0 CFBundleSignature string Octave CFBundleVersion string ${version} CFBundleShortVersionString string ${version} CFBundleDocumentTypes array {} CFBundleDocumentTypes: dict {} CFBundleDocumentTypes:0:CFBundleTypeRole string \"Editor\" CFBundleDocumentTypes:0:CFBundleTypeExtensions array {} CFBundleDocumentTypes:0:CFBundleTypeExtensions: string \"m\" CFBundleDocumentTypes:0:CFBundleTypeOSTypes array {} CFBundleDocumentTypes:0:CFBundleTypeOSTypes: string \"Mfile\" " foreach {key type value} ${values} { system -W "${worksrcpath}/${appName}/Contents" "/usr/libexec/PlistBuddy -c \"Add :${key} ${type} ${value}\" Info.plist" } # have Info.plist be human readable system "/usr/bin/plutil -convert xml1 ${worksrcpath}/${appName}/Contents/Info.plist" # conversion by plutil set verys limited permissions system "/bin/chmod 0644 ${worksrcpath}/${appName}/Contents/Info.plist" xinstall -d -m 0755 ${worksrcpath}/Octave.iconset # values from original SVG file set svg etc/icons/octave-logo.svg set width 283.28912 set height 283.28833 set dpi 90 foreach res {16 32 128 256 512} { set hres [expr 2*${res}] # find new density so that converted PNG files do not look pixelated set denw [expr ${dpi}*${res}/${width}] set denh [expr ${dpi}*${res}/${height}] set hdenw [expr 2*${denw}] set hdenh [expr 2*${denh}] system -W ${worksrcpath} "${prefix}/bin/convert -background transparent -resize ${res}x${res} -density ${denw}x${denh} ${svg} Octave.iconset/icon_${res}x${res}.png" system -W ${worksrcpath} "${prefix}/bin/convert -background transparent -resize ${hres}x${hres} -density ${hdenw}x${hdenh} ${svg} Octave.iconset/icon_${res}x${res}@2x.png" } if {[vercmp ${xcodeversion} 4.5] >= 0} { system -W ${worksrcpath} "/usr/bin/iconutil -c icns -o ${appName}/Contents/Resources/Octave.icns Octave.iconset" } else { # /usr/bin/iconutil introduced in XCode 4.5 # see #51487 system -W ${worksrcpath}/Octave.iconset \ "${prefix}/bin/png2icns ${worksrcpath}/${appName}/Contents/Resources/Octave.icns icon_16x16.png icon_32x32.png icon_128x128.png icon_256x256.png icon_512x512.png" } } post-destroot { copy ${worksrcpath}/${appName} ${destroot}${applications_dir} } } default_variants-append +app variant docs description {build documentation files} { depends_build-append port:texinfo configure.env-append \ MAKEINFO=${prefix}/bin/makeinfo \ TEXI2DVI=${prefix}/bin/texi2dvi \ TEXI2PDF=${prefix}/bin/texi2pdf # see https://lists.macosforge.org/pipermail/macports-dev/2016-January/032293.html depends_build-append \ port:texlive-basic \ port:texlive-latex # see #51132 depends_build-append \ port:texlive-fonts-recommended configure.args-replace --disable-docs --enable-docs } default_variants-append +docs # GraphicsMagick and octave need to be built with the same C++ standard library # or else undefined symbols: # "Magick::Image::ping(std::__cxx11::basic_string, std::allocator > const&)" set magickConflict {} set magickDefault yes if {${configure.cxx_stdlib} ne "libstdc++"} { foreach gccVar ${compilers.gcc_variants} { if {[variant_exists ${gccVar}] } { lappend magickConflict ${gccVar} if {[variant_isset ${gccVar}] } { set magickDefault no } } } } eval "variant graphicsmagick description {use GraphicsMagick for image I/O} conflicts ${magickConflict} { depends_lib-append port:GraphicsMagick configure.args-replace --without-magick --with-magick=GraphicsMagick }" if {${magickDefault}} { default_variants-append +graphicsmagick } # remove architecture flags from header file if { [variant_exists universal] && [variant_isset universal] } { merger-post-destroot { foreach arch ${universal_archs_to_use} { set hfile ${destroot}-${arch}${prefix}/include/octave-${version}/octave/oct-conf.h reinplace -E "s:\\w*-arch ${arch}::g" ${hfile} reinplace -E {s:\\w*-m32::g} ${hfile} reinplace -E {s:\\w*-m64::g} ${hfile} } } } else { post-destroot { set hfile ${destroot}${prefix}/include/octave-${version}/octave/oct-conf.h reinplace -E "s:\\w*-arch ${build_arch}::g" ${hfile} reinplace -E {s:\\w*-m32::g} ${hfile} reinplace -E {s:\\w*-m64::g} ${hfile} } } post-destroot { # put any startup commands in ${destroot}${prefix}/share/octave/${version}/m/startup/octaverc # see https://www.gnu.org/software/octave/doc/interpreter/Startup-Files.html file delete ${destroot}${prefix}/share/octave/site/m/startup/octaverc if {[file exists ${worksrcpath}/liboctave/operators/libcxx-fix.h]} { # 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 } } test.run yes test.target check