Index: Portfile
===================================================================
--- Portfile	(revision 145218)
+++ Portfile	(working copy)
@@ -6,6 +6,7 @@
 
 name                qtscriptgenerator
 version             0.2.0
+revision            1
 categories          devel kde4
 license             LGPL-2.1
 maintainers         michaelld openmaintainer
@@ -14,12 +15,11 @@
     Qt bindings for Qt Script. With the generated bindings you get \
     access to substantial portions of the Qt API from within Qt Script.
 platforms           darwin
-homepage            http://labs.trolltech.com/page/Projects/QtScript/Generator
+homepage            http://qtscriptgenerator.googlecode.com/
 distname            ${name}-src-${version}
 master_sites        http://qtscriptgenerator.googlecode.com/files/
-checksums           md5     9f82b0aa212f7938de37df46cd27165c \
-                    sha1    4c1078f26b196156e857c17c9d11a66cfea66f00 \
-                    rmd160  01c8ce3b4c8e9ebb3bc3c2d7b319846f34baee04 
+checksums           rmd160 01c8ce3b4c8e9ebb3bc3c2d7b319846f34baee04 \
+                    sha256 895feb274470b9272264c7a141e5bd7f90c92e95d37f346f5f95a352541c8e69
 
 depends_build-append port:automoc
 depends_lib-append  port:phonon
@@ -27,7 +27,10 @@
 patchfiles          patch-generator.diff \
                     patch-qtbindings.diff \
                     patch-generator_typesystem_phonon-qtscript.xml.diff \
-                    patch-generator_typesystem_phonon.xml.diff
+                    patch-generator_typesystem_phonon.xml.diff \
+                    patch-remove-QtScriptFutureIterator.diff \
+                    patch-include-everything.diff \
+                    patch-build-system-for-MacPorts.diff
 
 # check for +debug variant of this port, and make sure phonon was
 # installed with +debug as well; if not, error out.  phonon checks to
@@ -49,6 +52,13 @@
     # copy the QMake build script into place
     copy ${filespath}/qtsg.pro ${worksrcpath}
 
+    reinplace "s|@QT_FRAMEWORKS_DIR@|${qt_frameworks_dir}|g" \
+        ${worksrcpath}/generator/main.h
+    reinplace "s|@QT_INCLUDES_DIR@|${qt_includes_dir}|g" \
+        ${worksrcpath}/generator/main.h
+    reinplace "s|@PREFIX@|${prefix}|g" \
+        ${worksrcpath}/generator/main.h
+
     # allow for universal and non-native building if just the
     # qtbinding scripts, not the generator (which is solely used for
     # generating the scripts)
@@ -70,6 +80,11 @@
 configure.args      "-o Makefile qtsg.pro"
 configure.post_args
 configure.universal_args
+configure.env-delete \
+                    QTDIR=${qt_dir}
+build.env-delete    QTDIR=${qt_dir}
+# used by generator/generator:
+build.env-append    QTFRAMEWORKS=${qt_frameworks_dir}
 
 # allow ccache, if specified by the user
 pre-build {
Index: files/patch-build-system-for-MacPorts.diff
===================================================================
--- files/patch-build-system-for-MacPorts.diff	(nonexistent)
+++ files/patch-build-system-for-MacPorts.diff	(working copy)
@@ -0,0 +1,80 @@
+diff --git generator/generator.pri generator/generator.pri
+index daa3e0c..3b62b9b 100644
+--- generator/generator.pri
++++ generator/generator.pri
+@@ -5,6 +5,12 @@ TEMPLATE = app
+ TARGET = generator
+ DEPENDPATH += $$GENERATORPATH tests parser
+ mac:CONFIG -= app_bundle
++
++LIBS *= -L/opt/local/lib
++INCLUDEPATH += /opt/local/include/qt4
++INCLUDEPATH += /opt/local/include/phonon
++INCLUDEPATH += /opt/local/include
++
+ INCLUDEPATH += $$GENERATORPATH/.
+ INCLUDEPATH += $$GENERATORPATH/../common
+ 
+diff --git generator/main.h generator/main.h
+index ebf153d..dd65632 100644
+--- generator/main.h
++++ generator/main.h
+@@ -46,6 +46,7 @@
+ 
+ #include <QFile>
+ #include <QDir>
++#include <QDebug>
+ 
+ struct Preprocess
+ {
+@@ -87,17 +88,24 @@ struct Preprocess
+             includes += commandLineIncludes.split(path_splitter);        
+ 
+         // Include Qt
++        qDebug() << "includes=" << includes;
+         QString qtdir = getenv ("QTDIR");
+         if (qtdir.isEmpty()) {
+ #if defined(Q_OS_MAC)
+             qWarning("QTDIR environment variable not set. Assuming standard binary install using frameworks.");
+-            QString frameworkDir = "/Library/Frameworks";
++            QString frameworkDir = getenv("QTFRAMEWORKS");
++            if (frameworkDir.isEmpty()) {
++                frameworkDir = "@QT_FRAMEWORKS_DIR@";
++            }
+             includes << (frameworkDir + "/QtXml.framework/Headers");
+             includes << (frameworkDir + "/QtNetwork.framework/Headers");
+             includes << (frameworkDir + "/QtCore.framework/Headers");
+             includes << (frameworkDir + "/QtGui.framework/Headers");
+             includes << (frameworkDir + "/QtOpenGL.framework/Headers");
+             includes << frameworkDir;
++            includes << "@QT_INCLUDES_DIR@";
++            includes << "@PREFIX@/include/phonon";
++            includes << "@PREFIX@/include";
+ #else
+             qWarning("QTDIR environment variable not set. This may cause problems with finding the necessary include files.");
+ #endif
+@@ -110,6 +118,7 @@ struct Preprocess
+             includes << (qtdir + "/QtOpenGL");
+             includes << qtdir;
+         }
++        qDebug() << "includes=" << includes;
+ 
+         foreach (QString include, includes)
+             preprocess.push_include_path(QDir::convertSeparators(include).toStdString());        
+diff --git qtbindings/qtbindingsbase.pri qtbindings/qtbindingsbase.pri
+index 54eb9a5..3021b73 100644
+--- qtbindings/qtbindingsbase.pri
++++ qtbindings/qtbindingsbase.pri
+@@ -1,9 +1,12 @@
+ TEMPLATE = lib
+ DEPENDPATH += .
+ INCLUDEPATH += .
++INCLUDEPATH += /opt/local/include/qt4
++INCLUDEPATH += /opt/local/include/phonon
++INCLUDEPATH += /opt/local/include
+ DESTDIR = $$PWD/../plugins/script
+ QT += script
+ CONFIG += @ARCHES@ @BUILD_TYPE@
+ GENERATEDCPP = $$PWD/../generated_cpp
+ TARGET=$$qtLibraryTarget($$TARGET)
+ target.path = $$[QT_INSTALL_PLUGINS]/script
Index: files/patch-include-everything.diff
===================================================================
--- files/patch-include-everything.diff	(nonexistent)
+++ files/patch-include-everything.diff	(working copy)
@@ -0,0 +1,55 @@
+--- generator/orig.qtscript_masterinclude.h	2015-10-30 10:37:09.000000000 +0100
++++ generator/qtscript_masterinclude.h	2015-10-30 10:39:06.000000000 +0100
+@@ -49,15 +49,47 @@
+ 
+ #include <QtUiTools/QtUiTools>
+ 
+-#ifndef QT_NO_XMLPATTERNS
++// #ifndef QT_NO_XMLPATTERNS
+ #  include <QtXmlPatterns/QtXmlPatterns>
+-#endif
++// #endif
+ 
+-#ifndef QT_NO_WEBKIT
++// #ifndef QT_NO_WEBKIT
+ #  include <QtWebKit/QtWebKit>
+-#endif
++// #endif
+ 
+-#  include <phonon/phonon>
++// #  include <phonon/phonon>
++
++#include "phonon/abstractaudiooutput.h"                                                             
++#include "phonon/abstractmediastream.h"                                                             
++#include "phonon/abstractvideooutput.h"                                                             
++#include "phonon/addoninterface.h"                                                                  
++#include "phonon/audiooutput.h"                                                                     
++#include "phonon/audiooutputinterface.h"                                                            
++#include "phonon/backendcapabilities.h"                                                             
++#include "phonon/backendinterface.h"
++#include "phonon/effect.h"
++#include "phonon/effectinterface.h"
++#include "phonon/effectparameter.h"
++#include "phonon/effectwidget.h"
++#include "phonon/mediacontroller.h"
++#include "phonon/medianode.h"
++#include "phonon/mediaobject.h"
++#include "phonon/mediaobjectinterface.h"
++#include "phonon/mediasource.h"
++#include "phonon/objectdescription.h"
++#include "phonon/objectdescriptionmodel.h"
++#include "phonon/path.h"
++#include "phonon/phonondefs.h"
++#include "phonon/phononnamespace.h"
++#include "phonon/platformplugin.h"
++#include "phonon/seekslider.h"
++#include "phonon/streaminterface.h"
++#include "phonon/videoplayer.h"
++#include "phonon/videowidget.h"
++#include "phonon/videowidgetinterface.h"
++#include "phonon/volumefadereffect.h"
++#include "phonon/volumefaderinterface.h"
++#include "phonon/volumeslider.h"
+ 
+ #include "../qtbindings/qtscript_core/qtscriptconcurrent.h"
+ 
Index: files/patch-remove-QtScriptFutureIterator.diff
===================================================================
--- files/patch-remove-QtScriptFutureIterator.diff	(nonexistent)
+++ files/patch-remove-QtScriptFutureIterator.diff	(working copy)
@@ -0,0 +1,62 @@
+--- generator/typesystem_core-common.xml.orig	2015-03-20 18:01:15.000000000 +0100
++++ generator/typesystem_core-common.xml	2015-03-20 18:01:39.000000000 +0100
+@@ -1387,7 +1387,6 @@
+   <object-type name="QFutureIterator" generate="no">
+     <modify-function signature="operator=(const QFuture&amp;)" remove="all" />
+   </object-type>
+-  <object-type name="QtScriptFutureIterator" generic-class="yes" java-name="QFutureIterator" />
+   <object-type name="QRunnable" />
+ 
+ 
+--- generator/typesystem_core-qtscript.xml.orig	2015-03-20 18:01:15.000000000 +0100
++++ generator/typesystem_core-qtscript.xml	2015-03-20 18:01:49.000000000 +0100
+@@ -1115,13 +1115,6 @@
+       <modify-function signature="futures()const" remove="all" />
+   </object-type>
+   
+-  <object-type name="QtScriptFutureIterator">
+-    <modify-function signature="QFutureIterator(const QFuture &amp;)">
+-        <modify-argument index="1">
+-            <replace-type modified-type="QtScriptFuture" />
+-        </modify-argument>
+-    </modify-function>       
+-  </object-type>
+ 
+ 
+   <!-- QXMLStream stream stuff. This was moved from QtXml to QtCore in 4.4 -->
+--- generator/typesystem_core.xml.orig	2015-03-20 18:01:15.000000000 +0100
++++ generator/typesystem_core.xml	2015-03-20 18:01:56.000000000 +0100
+@@ -2452,13 +2452,6 @@
+   <object-type name="QFutureIterator" generate="no">
+     <modify-function signature="operator=(const QFuture&amp;)" remove="all"/>
+   </object-type>
+-  <object-type name="QtScriptFutureIterator" generic-class="yes" java-name="QFutureIterator">
+-    <modify-function signature="QFutureIterator(const QFuture &amp;)">
+-        <modify-argument index="1">
+-            <replace-type modified-type="QtScriptFuture"/>
+-        </modify-argument>
+-    </modify-function>       
+-  </object-type>
+   <object-type name="QRunnable"/>
+ 
+ 
+--- generator/typesystem_phonon.xml.orig	2015-03-20 18:01:15.000000000 +0100
++++ generator/typesystem_phonon.xml	2015-03-20 18:01:15.000000000 +0100
+@@ -130,6 +130,7 @@
+         <modify-function signature="operator!=(Phonon::ObjectDescription)const" remove="all"/>
+         <modify-function signature="fromIndex(int)" remove="all"/> 
+     </value-type>
++    <value-type name="Phonon::DeviceAccessList" java-name="DeviceAccessList" />
+ 
+     <object-type name="Phonon::AbstractAudioOutput" java-name="AbstractAudioOutput"/>
+     <object-type name="Phonon::AbstractMediaStream" java-name="AbstractMediaStream"/>
+--- qtbindings/qtscript_core/qtscriptconcurrent.h.orig	2012-01-23 12:30:03.000000000 +0100
++++ qtbindings/qtscript_core/qtscriptconcurrent.h	2015-03-20 18:01:59.000000000 +0100
+@@ -55,7 +55,6 @@
+ typedef QFuture<QScriptValue> QtScriptFuture;
+ typedef QFutureWatcher<QScriptValue> QtScriptFutureWatcher;
+ typedef QFutureSynchronizer<QScriptValue> QtScriptFutureSynchronizer;
+-typedef QFutureIterator<QScriptValue> QtScriptFutureIterator;
+ 
+ #endif // QT_NO_CONCURRENT
+ 
