Index: Portfile
===================================================================
--- Portfile	(revision 114358)
+++ Portfile	(working copy)
@@ -7,9 +7,75 @@
 
 name                octave
 
-version             3.6.4
-revision            10
-#conflicts           octave-devel
+if {${subport} eq ${name}} {
+
+    version             3.6.4
+    revision            10
+    conflicts           octave-next octave-devel
+    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
+
+    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
+
+    }
+
+    livecheck.type      regex
+    livecheck.url       http://www.gnu.org/software/octave/download.html
+    livecheck.regex     GNU Octave (\[\^\ \]*) was
+
+}
+
+subport octave-next {
+
+    # https://trac.macports.org/ticket/41155
+
+    version             3.8.0-rc1
+    conflicts           octave-devel octave
+    master_sites        ftp://alpha.gnu.org/gnu/octave/
+    checksums           rmd160 417a9da77f4003df2f6f495541a55270014d6e56 \
+                        sha256 96a23b25f38d518bee3f15d381a93c2ff94d2e0ed242934856f4e22e08981b8d
+
+    patchfiles-append   patch-libgui_src_m-editor_file-editor-tab.cc.diff
+
+    depends_lib-append  port:qscintilla
+#                        port:gl2ps
+
+    configure.args-append --disable-java
+
+    variant jit description "Enable just-in-time compiler for loops via LLVM (EXPERIMENTAL)" {
+
+        # make sure compiler is macports-clang of some sort
+
+        compiler.blacklist-append *gcc* clang dragonegg* llvm*
+
+        configure.args-append --enable-jit
+
+        set llvm_version [strsed ${configure.compiler} "s@\[^0-9\]*@@"]
+
+        depends_lib-append  port:llvm-${llvm_version}
+
+        configure.env-append \
+            LLVM_CONFIG=${prefix}/bin/llvm-config-mp-${llvm_version}
+
+    }
+}
+
 categories          math science
 maintainers         michaelld openmaintainer
 license             GPL-3
@@ -26,29 +92,7 @@
 homepage            http://www.gnu.org/software/octave/
 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
-
-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
-
-}
-
 depends_build-append \
                     port:bison \
                     port:flex \
@@ -87,7 +131,7 @@
 
 # common configure arguments
 
-configure.args \
+configure.args-append \
     --disable-dependency-tracking \
     --with-umfpack="-lumfpack -lSuiteSparse"
 
@@ -346,7 +390,3 @@
 # https://trac.macports.org/ticket/41582
 
 use_parallel_build  no
-
-livecheck.type      regex
-livecheck.url       http://www.gnu.org/software/octave/download.html
-livecheck.regex     GNU Octave (\[\^\ \]*) was
Index: files/patch-libgui_src_m-editor_file-editor-tab.cc.diff
===================================================================
--- files/patch-libgui_src_m-editor_file-editor-tab.cc.diff	(revision 0)
+++ files/patch-libgui_src_m-editor_file-editor-tab.cc.diff	(working copy)
@@ -0,0 +1,122 @@
+--- libgui/src/m-editor/file-editor-tab.cc.orig	2013-12-05 21:23:49.000000000 -0500
++++ libgui/src/m-editor/file-editor-tab.cc	2013-12-05 21:24:41.000000000 -0500
+@@ -258,118 +258,7 @@
+ void
+ file_editor_tab::update_lexer ()
+ {
+-  if (_lexer_apis)
+-    _lexer_apis->cancelPreparation ();  // stop preparing if apis exists
+-
+-  QsciLexer *lexer = _edit_area->lexer ();
+-  delete lexer;
+-  lexer = 0;
+-
+-  if (_file_name.endsWith (".m")
+-      || _file_name.endsWith ("octaverc"))
+-    {
+-#if defined (HAVE_LEXER_OCTAVE)
+-      lexer = new QsciLexerOctave ();
+-#elif defined (HAVE_LEXER_MATLAB)
+-      lexer = new QsciLexerMatlab ();
+-#endif
+-    }
+-
+-  if (! lexer)
+-    {
+-      if (_file_name.endsWith (".c")
+-          || _file_name.endsWith (".cc")
+-          || _file_name.endsWith (".cpp")
+-          || _file_name.endsWith (".cxx")
+-          || _file_name.endsWith (".c++")
+-          || _file_name.endsWith (".h")
+-          || _file_name.endsWith (".hh")
+-          || _file_name.endsWith (".hpp")
+-          || _file_name.endsWith (".h++"))
+-        {
+-          lexer = new QsciLexerCPP ();
+-        }
+-      else if (_file_name.endsWith (".pl"))
+-        {
+-          lexer = new QsciLexerPerl ();
+-        }
+-      else if (_file_name.endsWith (".bat"))
+-        {
+-          lexer = new QsciLexerBatch ();
+-        }
+-      else if (_file_name.endsWith (".diff"))
+-        {
+-          lexer = new QsciLexerDiff ();
+-        }
+-      else if (! valid_file_name ())
+-        {
+-          // new, no yet named file: let us assume it is octave
+-#if defined (HAVE_LEXER_OCTAVE)
+-          lexer = new QsciLexerOctave ();
+-#elif defined (HAVE_LEXER_MATLAB)
+-          lexer = new QsciLexerMatlab ();
+-#else
+-          lexer = new QsciLexerBash ();
+-#endif
+-        }
+-      else
+-        {
+-          // other or no extension
+-          lexer = new QsciLexerBash ();
+-        }
+-    }
+-
+-  _lexer_apis = new QsciAPIs(lexer);
+-  if (_lexer_apis)
+-    {
+-      // get path to prepared api info
+-      QDesktopServices desktopServices;
+-      QString prep_apis_path
+-        = desktopServices.storageLocation (QDesktopServices::HomeLocation)
+-          + "/.config/octave/"  + QString(OCTAVE_VERSION) + "/qsci/";
+-      _prep_apis_file = prep_apis_path + lexer->lexer () + ".pap";
+-
+-      if (!_lexer_apis->loadPrepared (_prep_apis_file))
+-        {
+-          // no prepared info loaded, prepare and save if possible
+-
+-          // create raw apis info
+-          QString keyword;
+-          QStringList keyword_list;
+-          int i,j;
+-          for (i=1; i<=3; i++) // test the first 5 keyword sets
+-            {
+-              keyword = QString(lexer->keywords (i));           // get list
+-              keyword_list = keyword.split (QRegExp ("\\s+"));  // split
+-              for (j = 0; j < keyword_list.size (); j++)        // add to API
+-                _lexer_apis->add (keyword_list.at (j));
+-            }
+-
+-          // dsiconnect slot for saving prepared info if already connected
+-          disconnect (_lexer_apis, SIGNAL (apiPreparationFinished ()), 0, 0);
+-          // check whether path for prepared info exists or can be created
+-          if (QDir("/").mkpath (prep_apis_path))
+-            {
+-              // path exists, apis info can be saved there
+-              connect (_lexer_apis, SIGNAL (apiPreparationFinished ()),
+-                       this, SLOT (save_apis_info ()));
+-            }
+-          _lexer_apis->prepare ();  // prepare apis info
+-        }
+-    }
+-
+-  QSettings *settings = resource_manager::get_settings ();
+-  if (settings)
+-    lexer->readSettings (*settings);
+-
+-  _edit_area->setLexer (lexer);
+-
+-  // fix line number width with respect to the font size of the lexer
+-  if (settings->value ("editor/showLineNumbers", true).toBool ())
+-    auto_margin_width ();
+-  else
+-    _edit_area->setMarginWidth (2,0);
+-
++  _edit_area->setLexer ();
+ }
+ 
+ void
