# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1404763156 18000
#      Mon Jul 07 14:59:16 2014 -0500
# Node ID 5d2c90956c32190b9e4f0a2d45a673f47fcf7dce
# Parent  032adbe3450af4a8ad9d23d15ca8787e8b30aef9
octave: update to 3.8.1

diff --git a/dports/math/octave/Portfile b/dports/math/octave/Portfile
--- a/dports/math/octave/Portfile
+++ b/dports/math/octave/Portfile
@@ -9,12 +9,11 @@ PortGroup           compilers 1.0
 compilers.choose    fc f77 f90
 compilers.setup     require_fortran
 
 name                octave
 
-version             3.6.4
-revision            14
+version             3.8.1
 #conflicts           octave-devel
 categories          math science
 maintainers         michaelld openmaintainer
 license             GPL-3
 platforms           darwin
@@ -31,40 +30,21 @@ homepage            http://www.gnu.org/s
 dist_subdir         octave
 distname            octave-${version}
 master_sites        gnu:octave
 use_bzip2           yes
 
-checksums \
-    rmd160  b0356f0c5d9366b8129d72ac58bbde837fee1a95 \
-    sha256  fa185df9591f5d740f4d37ff6eaf06db576fdd3e0ddd9d0737365799e5d1c962
-
-# temporary patches; these are already, or will be, fixed upstream.
-
-patchfiles-append \
-    patch-liboctave-eigs-base.cc.diff \
-    patch-liboctave-regexp.h.diff \
-    patch-configure.diff \
-    texinfo5.patch
-
-if {${os.major} >= 11} {
-
-    # 10.7 and newer requires an extra patch; this patch will
-    # break the build on 10.6 and prior.
-
-    patchfiles-append patch-src-display.cc.diff
-
-}
+checksums           rmd160  a76587b29a964791982bd9c803b0394411b9f874 \
+                    sha256  d6762ed2ad4a042243a095fb44c7a1d3a91c635b6dca37fcef15a5efdffa9bbd
 
 depends_build-append \
                     port:bison \
                     port:flex \
                     port:gperf \
                     path:bin/perl:perl5 \
                     port:pkgconfig
 
 depends_lib-append \
-                    path:lib/libgcc/libgcc_s.1.dylib:libgcc \
                     port:arpack \
                     port:curl \
                     port:fftw-3 \
                     port:fftw-3-single \
                     port:gawk \
@@ -89,14 +69,16 @@ depends_run-append  port:epstool \
                     port:pstoedit
 
 universal_variant   no
 
 # common configure arguments
-
 configure.args \
     --disable-dependency-tracking \
-    --with-umfpack="-lumfpack -lSuiteSparse"
+    --with-umfpack="-lumfpack -lSuiteSparse" \
+    --disable-java \
+    --with-opengl \
+    --with-framework-opengl
 
 # 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
@@ -208,22 +190,32 @@ if {[variant_isset x11]} {
 
     configure.args-append --without-x
 
 }
 
-variant fltk description {Enable FLTK as a graphical front-end} {}
+variant gui description {Enable experimental gui} {}
 
-if {[variant_isset fltk]} {
+if {[variant_isset gui]} {
 
-    depends_lib-append path:lib/libfltk.dylib:fltk \
-                       port:fontconfig \
-                       port:freetype
-    configure.args-append --with-opengl
+    depends_lib-append port:qt4-mac
+    configure.args-append --enable-gui
 
 } else {
 
-    configure.args-append --without-opengl
+    configure.args-append --disable-gui
+
+}
+
+variant jit description {Enable experimental JIT compiler} {}
+
+if {[variant_isset jit]} {
+
+    configure.args-append --enable-jit
+
+} else {
+
+    configure.args-append --disable-jit
 
 }
 
 variant metis description {Use SuiteSparse + Metis for graph partitioning} {
     pre-fetch {
@@ -246,30 +238,39 @@ if {[variant_isset metis]} {
     # make sure SuiteSparse is installed without +metis
     require_active_variants SuiteSparse {} metis
 
 }
 
-pre-fetch {
+# 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).
 
-    # 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} {
-            ui_msg "\nWARNING: Dependency 'arpack' is installed with the +accelerate variant, using Apple's Vector Libraries which have known bugs that can cause Octave to crash if using certain functions in arpack.  The +atlas variant does not have these issues with Octave, and is considered by Octave developers a better way to go.\n"
-        }
-    }
-
-    if {[variant_isset accelerate]} {
-        ui_msg "\nWARNING: The +accelerate variant has been selected, using Apple's Vector Libraries which have known bugs that can cause Octave to crash.  The +atlas variant does not have these issues with Octave, and is considered by Octave developers a better way to go.\n"
+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 known bugs that can cause Octave to crash if using certain functions in arpack.  The +atlas variant does not have these issues with Octave, and is considered by Octave developers a better way to go.\n"
     }
 }
 
-# https://trac.macports.org/ticket/41582
+if {[variant_isset accelerate]} {
+    notes-append "\nWARNING: The +accelerate variant has been selected, using Apple's Vector Libraries which have known bugs that can cause Octave to crash.  The +atlas variant does not have these issues with Octave, and is considered by Octave developers a better way to go.\n"
+}
 
-use_parallel_build  no
+post-destroot {
+    system "echo 'graphics_toolkit(\"gnuplot\");' >> ${destroot}${prefix}/share/octave/site/m/startup/octaverc"
+
+    if {[variant_isset gui]} {
+        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
+    }
+}
 
 livecheck.type      regex
 livecheck.url       http://www.gnu.org/software/octave/download.html
 livecheck.regex     GNU Octave (\[\^\ \]*) was
