--- /opt/local/var/macports/sources/svn.macports.org/trunk/dports/devel/qtscriptgenerator/Portfile	2015-01-12 12:42:58.000000000 +0100
+++ /opt/local/site-ports/devel/qtscriptgenerator/Portfile	2015-10-30 19:14:08.000000000 +0100
@@ -6,6 +6,7 @@
 
 name                qtscriptgenerator
 version             0.2.0
+revision            1
 categories          devel kde4
 license             LGPL-2.1
 maintainers         michaelld openmaintainer
@@ -28,6 +29,9 @@
                     patch-qtbindings.diff \
                     patch-generator_typesystem_phonon-qtscript.xml.diff \
                     patch-generator_typesystem_phonon.xml.diff
+patchfiles-append   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 +53,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 +81,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 {
