# -*- 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 active_variants 1.1
PortGroup compiler_blacklist_versions 1.0
PortGroup select 1.0
name octave-devel
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
#fetch.type hg
#hg.url http://hg.savannah.gnu.org/hgweb/octave/
set version_release 4.0.2
set version_rc 4.0.1-rc4
set version_tip 4.1.0+
if { ${name} eq ${subport} } {
version ${version_tip}
revision 14
hg.tag 19e8eddd4773
# see http://savannah.gnu.org/bugs/?41027
patchfiles-append \
octave-bug_41027-half.patch
# see http://savannah.gnu.org/bugs/index.php?47886
patchfiles-append \
patch-configure.diff
checksums-append \
${hg.tag}${extract.suffix} \
rmd160 bf6d26b12fa1f0e2a8434a54ffa395c2b4e7f31e \
sha256 934b7f116018e3f8d97c7bbd2d213a77c823d934a4865155e24eac5cb42a636b
livecheck.regex "\ntip"
}
subport octave-devel-rc {
version ${version_rc}
revision 7
hg.tag 2b66f30a0de7
if {${version_rc} eq ${version_release}} {
conflicts-append octave-devel-release
}
# 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
checksums-append \
${hg.tag}${extract.suffix} \
rmd160 4bf919790f28f21752381e127cf55b3a5f4d7344 \
sha256 4785967cff091dddd7d82dbbd094658a39ad26d4a7219abc1f1bbc4fe696d43a
livecheck.regex "\nrc-"
}
subport octave-devel-release {
version ${version_release}
revision 3
hg.tag acaf1e137c5e
if {${version_release} eq ${version_rc}} {
conflicts-append octave-devel-release
}
# 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
checksums-append \
${hg.tag}${extract.suffix} \
rmd160 454f0f6ef1657a49f9a41ff5bae03c09a332d77f \
sha256 3aafb5568bd46c1c6e6bae494cf8fdf457e8a84fea402b14a454e992c0885a8c
livecheck.regex "\nrelease-"
}
# 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 }
select.group octave
select.file ${filespath}/${subport}
# see ${worksrcpath}/.hgsubstate to find revision of gnulib-hg subrepository that should be used
if { ${subport} eq "octave-devel-rc" || ${subport} eq "octave-devel-release" } {
set hg_gnu_tag 7f19e7f2afa2
checksums-append \
${hg_gnu_tag}${extract.suffix} \
rmd160 9d906212fdb4201f8592da10524606dadb3f50e3 \
sha256 85add8ce0c53e8868d903c28c407d864ca54bd42e8d472e09b1a1bb4b105b741
} else {
# check http://hg.savannah.gnu.org/hgweb/octave/gnulib-hg/rev for latest version
set hg_gnu_tag 4a3a7c6111c8
checksums-append \
${hg_gnu_tag}${extract.suffix} \
rmd160 367b2811b5d4e3bab5ed22382c4ecfed808335e7 \
sha256 39f09d2000654d0d75a95b756fdd0724f869dfe65ef08f47814fbad230e8b25c
}
master_sites http://hg.savannah.gnu.org/hgweb/octave/archive:octave \
http://hg.savannah.gnu.org/hgweb/octave/gnulib-hg/archive:gnulib
distfiles \
${hg.tag}${extract.suffix}:octave \
${hg_gnu_tag}${extract.suffix}:gnulib
worksrcdir octave-${hg.tag}
post-extract {
# mimic presence of mercurial subrepository
move ${worksrcpath}/../gnulib-hg-${hg_gnu_tag} ${worksrcpath}/gnulib-hg
}
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
}
}
# need for autoconf
depends_build-append \
port:autoconf \
port:automake \
port:libtool
use_autoconf yes
autoconf.cmd ./bootstrap
autoconf.args
# 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
compilers.setup \
require_fortran \
-dragonegg \
-gcc49 \
-gcc48 \
-gcc47 \
-gcc46 \
-gcc45 \
-gcc44 \
-g95 \
-llvm \
-clang36 \
-clang35 \
-clang34 \
-clang33
# help prevent conflicts with various octave ports
configure.args-append \
--infodir=${prefix}/share/info/octave_${version}
# 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 \
--without-fltk \
--without-opengl \
--disable-jit \
--without-sndfile \
--without-portaudio \
--without-magick \
--disable-docs
if { ${subport} eq "octave-devel-rc" || ${subport} eq "octave-devel-release" } {
configure.args-append \
--disable-gui
} else {
configure.args-append \
--without-qt
}
# 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
#--without-hdf5
if { ${name} eq ${subport} } {
# see #51080
# see http://savannah.gnu.org/bugs/?47858 for upstream report
depends_lib-append port:hdf5-18
configure.args-append \
--with-hdf5-libdir=${prefix}/lib/hdf5-18/lib \
--with-hdf5-includedir=${prefix}/lib/hdf5-18/include
} else {
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
depends_run-append port:octave_select
variant accelerate description {use BLAS from Apple's Accelerate.framework} conflicts atlas openblas {
depends_lib-append port:vecLibFort
configure.args-append \
--with-blas=-lvecLibFort \
--with-lapack=""
}
variant openblas description {use BLAS from MacPorts' openblas port} conflicts atlas accelerate {
depends_lib-append path:lib/libopenblas.dylib:OpenBLAS
# LAPACK required
require_active_variants path:lib/libopenblas.dylib:OpenBLAS lapack
# replicate default values if configure script finds openblas on its own
configure.args-append \
--with-blas=-lopenblas \
--with-lapack=""
}
variant atlas description {use BLAS from MacPorts' atlas port} conflicts accelerate openblas {
depends_lib-append port:atlas
# replicate default values if configure script finds atlas on its own
configure.args-append \
--with-blas="-lcblas -lf77blas -latlas" \
--with-lapack=-llapack
}
if {![variant_isset accelerate] && ![variant_isset openblas] && ![variant_isset atlas] } {
default_variants-append +accelerate
}
if {![variant_isset accelerate] && ![variant_isset openblas] && ![variant_isset atlas] } {
ui_error "\n\nYou must select either the +accelerate, +atlas, or +openblas variant.\n"
return -code error "Invalid variant selection"
}
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
if { ${subport} eq "octave-devel-rc" || ${subport} eq "octave-devel-release" } {
configure.args-replace --disable-gui --enable-gui
} else {
configure.args-replace --without-qt --with-qt
}
}
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_${version}.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
}
if { ${subport} eq "octave-devel-rc" || ${subport} eq "octave-devel-release" } {
# 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}
}
}
}
# remove or rename conflicting files
post-destroot {
foreach bin {mkoctfile octave octave-cli octave-config} {
# delete since just a link to versioned name
file delete ${destroot}${prefix}/bin/${bin}
if { [variant_isset docs] } {
# put version number in man file to avoid conflict
move ${destroot}${prefix}/share/man/man1/${bin}.1 ${destroot}${prefix}/share/man/man1/${bin}-${version}.1
}
}
# 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
# move appdata and icons into a versioned directory
xinstall -d -m 0755 ${destroot}${prefix}/share/octave/${version}/appdata
move \
${destroot}${prefix}/share/appdata/www.octave.org-octave.appdata.xml \
${destroot}${prefix}/share/octave/${version}/appdata/
foreach num {16 22 24 32 48 64 128 256 512} {
xinstall -d -m 0755 ${destroot}${prefix}/share/octave/${version}/icons/hicolor/${num}x${num}/apps
move \
${destroot}${prefix}/share/icons/hicolor/${num}x${num}/apps/octave.png \
${destroot}${prefix}/share/octave/${version}/icons/hicolor/${num}x${num}/apps/octave.png
}
xinstall -d -m 0755 ${destroot}${prefix}/share/octave/${version}/icons/hicolor/scalable/apps
move \
${destroot}${prefix}/share/icons/hicolor/scalable/apps/octave.svg \
${destroot}${prefix}/share/octave/${version}/icons/hicolor/scalable/apps/octave.svg
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
livecheck.type regexm
livecheck.url http://hg.savannah.gnu.org/hgweb/octave/tags
livecheck.version ${hg.tag}