--- Portfile.orig	2015-12-02 10:16:15.000000000 -0600
+++ Portfile	2015-12-02 12:58:28.000000000 -0600
@@ -1,5 +1,5 @@
 # -*- 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 142558 2015-11-15 17:24:00Z mmoll@macports.org $
+# $Id: Portfile 139469 2015-08-18 01:10:17Z jmr@macports.org $
 
 PortSystem          1.0
 PortGroup           active_variants 1.1
@@ -8,8 +8,7 @@
 
 name                octave
 
-version             3.8.2
-revision            14
+version             4.0.0
 #conflicts           octave-devel
 categories          math science
 maintainers         michaelld openmaintainer
@@ -28,18 +27,23 @@
 dist_subdir         octave
 distname            octave-${version}
 master_sites        gnu:octave
-use_bzip2           yes
+use_xz              yes
 
-checksums           rmd160  60201b29d368d0c935a34288c227d202ae286c6c \
-                    sha256  83bbd701aab04e7e57d0d5b8373dd54719bebb64ce0a850e69bf3d7454f33bae
+checksums           rmd160  57a4c6a90fbe49ad5268b257a4847788061daa49 \
+                    sha256  cf6be2fac6796fda68971e249c96d026ce4a1b0ed074ce49a5791365a958c474
 
 compilers.choose    fc f77 f90
 compilers.setup     require_fortran
 
 depends_build-append \
+                    port:autoconf \
+                    port:automake \
                     port:bison \
                     port:flex \
                     port:gperf \
+                    port:icoutils \
+                    port:librsvg \
+                    port:libtool \
                     path:bin/perl:perl5 \
                     port:pkgconfig
 
@@ -49,6 +53,8 @@
                     port:fftw-3 \
                     port:fftw-3-single \
                     port:gawk \
+                    port:ghostscript \
+                    port:gl2ps \
                     port:glpk \
                     port:gnuplot \
                     port:GraphicsMagick \
@@ -66,7 +72,6 @@
                     port:texinfo
 
 depends_run-append  port:epstool \
-                    port:ghostscript \
                     port:transfig \
                     port:pstoedit
 
@@ -74,38 +79,19 @@
 
 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
+# Use rollup patch file from Homebrew
+patchfiles-append   patch-rollup.diff \
+                    osmesa.patch.diff
 
 # common configure arguments
 
 configure.args \
+    --disable-bounds-check \
     --disable-dependency-tracking \
     --with-umfpack="-lumfpack -lSuiteSparse" \
-    --enable-docs \
-    --enable-strict-warning-flags \
-    --disable-silent-rules
+    --disable-jit \
+    --enable-link-all-dependencies \
+    --enable-docs
 
 # when using "hdf5 +mpich", have to manually include
 # "/opt/local/include/mpich-mp". See also:
@@ -153,7 +139,7 @@
 # See also < http://llvm.org/bugs/show_bug.cgi?id=8971 >
 #          < https://trac.macports.org/ticket/40250 >.
 
-compiler.blacklist-append { clang <= 318.0.61 }
+compiler.blacklist-append { clang <= 318.0.61 } macports-clang-2.9
 
 platform darwin {
     if {${os.major} >= 12} {
@@ -233,17 +219,8 @@
 
 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 \
+    depends_lib-append path:lib/libfltk.dylib:fltk \
+                       port:fontconfig \
                        port:freetype \
                        port:gl2ps
 
@@ -251,7 +228,8 @@
 
 if {[variant_isset glgui]} {
 
-    configure.args-append --with-opengl
+    configure.args-append --with-opengl \
+                          --with-framework-opengl
 
 } else {
 
@@ -261,11 +239,12 @@
 
 variant gui requires qtgui description {Legacy variant} {}
 
-variant qtgui description {Enable experimental Qt GUI Application} {
+variant qtgui description {Enable Qt GUI Application} {
 
-    PortGroup qt4 1.0
+    PortGroup          qt4 1.0
     depends_lib-append port:qscintilla
 
+patchfiles-append      patch-libgui-src-octave-dock-widget.cc.diff
 }
 
 if {[variant_isset qtgui]} {
