--- siputils.py.orig
+++ siputils.py
@@ -298,7 +298,7 @@
             # These require special handling as they are (potentially) a set of
             # space separated values rather than a single value that might
             # contain spaces.
-            if m in ("DEFINES", "CONFIG") or m[:6] in ("INCDIR", "LIBDIR"):
+            if m in ("DEFINES", "CONFIG") or m[:6] in ("INCDIR", "LIBDIR") or m[:12] in ("FRAMEWORKDIR"):
                 val = val.split()
 
             # We also want to treat lists of libraries in the same way so that
@@ -615,6 +615,16 @@
             libdir.extend(libdir_qt)
             rpaths.extend(libdir_qt)
 
+            # projects using SIP may not define FRAMEWORKDIR_QT as a
+            # configuration option, so try to retrieve it and fallback
+            # as necessary to a reasonable default for MacPorts
+            try:
+                frameworkdir_qt = self.optional_list("FRAMEWORKDIR_QT")
+            except:
+                frameworkdir_qt = self.config.qt_dir + "/Library/Frameworks"
+            libdir.extend(frameworkdir_qt)
+            rpaths.extend(frameworkdir_qt)
+
             if qt_version >= 0x040000:
                 # Try and read QT_LIBINFIX from qconfig.pri.
                 qconfig = os.path.join(mkspecs, "qconfig.pri")
@@ -750,7 +760,7 @@
                         if mod == "QAxContainer":
                             incdir.append(os.path.join(qtincdir[0], "ActiveQt"))
                         elif self._is_framework(mod):
-                            idir = libdir_qt[0]
+                            idir = frameworkdir_qt[0]
 
                             if mod == "QtAssistant" and qt_version < 0x040202:
                                 mod = "QtAssistantClient"
@@ -836,7 +846,7 @@
     def _is_framework(self, mod):
         """Return true if the given Qt module is a framework.
         """
-        return (self.config.qt_framework and (self.config.qt_version >= 0x040200 or mod != "QtAssistant"))
+        return (self.config.qt_framework and (self.config.qt_version >= 0x040200 or mod != "QtAssistant") and (mod != "phonon"))
 
     def _qt_module_to_lib(self, mname):
         """Return the name of the Qt library corresponding to a module.
@@ -964,7 +974,7 @@
         if self.generator in ("MSVC", "MSVC.NET", "MSBUILD", "BMAKE"):
             prl_name = os.path.join(self.config.qt_lib_dir, clib + ".prl")
         elif sys.platform == "darwin" and framework:
-            prl_name = os.path.join(self.config.qt_lib_dir, clib + ".framework", clib + ".prl")
+            prl_name = os.path.join(self.config.qt_framework_dir, clib + ".framework", clib + ".prl")
         else:
             prl_name = os.path.join(self.config.qt_lib_dir, "lib" + clib + ".prl")
 
@@ -2510,6 +2520,40 @@
                 lhs = line[:assstart].strip()
                 rhs = line[assend + 1:].strip()
 
+#                print "lhs is", lhs
+#                print "rhs is", rhs
+
+                # check for X = foo $$X (like += but prepending)
+                s_start = rhs.find(lhs)
+                if s_start != -1:
+#                    print "maybe found substr"
+                    s_pre_s = s_start
+                    while s_pre_s >= 0 and rhs[s_pre_s] not in string.whitespace:
+                        s_pre_s -= 1
+                    s_pre_s += 1
+                    s_pre_str = rhs[s_pre_s:s_start]
+                    s_end = s_start
+                    while s_end < len(rhs) and rhs[s_end] not in string.whitespace:
+                        s_end += 1
+                    s_str = rhs[s_start:s_end]
+#                    print "before: s_str =", s_str
+#                    print "befire: s_pre_str =", s_pre_str
+                    if s_pre_str.find("$$") == 0:
+                        # $$ something, maybe; find that something
+                        if len(s_pre_str) == 3:
+#                            print "looking for brackets at end"
+                            # verify termination is a bracket type
+                            if s_str[len(s_str)-1] in "}]":
+                                s_str = s_str[:(len(s_str)-1)]
+#                    print "s_str is", s_str
+                    if len(s_str) == len(lhs):
+#                        print "found match"
+                        # make sure 'lhs' is already in 'raw'
+                        orig_rhs = raw.get(lhs)
+                        if orig_rhs is not None:
+                            rhs = rhs[:s_pre_s] + orig_rhs
+#                            print "new rhs is", rhs
+
                 # Remove the escapes for any quotes.
                 rhs = rhs.replace(r'\"', '"').replace(r"\'", "'")
 
