diff -ru qt-everywhere-opensource-src-4.8.7.orig/config.tests/unix/compile.test qt-everywhere-opensource-src-4.8.7/config.tests/unix/compile.test
--- qt-everywhere-opensource-src-4.8.7.orig/config.tests/unix/compile.test	2015-05-07 10:14:42.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/config.tests/unix/compile.test	2015-10-12 21:20:48.000000000 -0400
@@ -73,7 +73,7 @@
 rm -f "$EXE" "${EXE}.exe"
 
 echo "QT_BUILD_TREE = $OUTDIR" > "$OUTDIR/$TEST/.qmake.cache"
-"$OUTDIR/bin/qmake" -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
+"$OUTDIR/bin/qmake" -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release app_bundle" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CFLAGS*=$CXXFLAGS" "QMAKE_CFLAGS+=$MAC_ARCH_CXXFLAGS" "QMAKE_OBJECTIVE_CFLAGS*=$CXXFLAGS" "QMAKE_OBJECTIVE_CFLAGS+=$MAC_ARCH_CXXFLAGS" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
 
 if [ "$VERBOSE" = "yes" ]; then
     $MAKE
diff -ru qt-everywhere-opensource-src-4.8.7.orig/config.tests/unix/gnu-libiconv/gnu-libiconv.cpp qt-everywhere-opensource-src-4.8.7/config.tests/unix/gnu-libiconv/gnu-libiconv.cpp
--- qt-everywhere-opensource-src-4.8.7.orig/config.tests/unix/gnu-libiconv/gnu-libiconv.cpp	2015-05-07 10:14:42.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/config.tests/unix/gnu-libiconv/gnu-libiconv.cpp	2015-10-12 21:20:48.000000000 -0400
@@ -48,7 +48,7 @@
 {
     iconv_t x = iconv_open("", "");
 
-    const char *inp;
+    char *inp;
     char *outp;
     size_t inbytes, outbytes;
     iconv(x, &inp, &inbytes, &outp, &outbytes);
diff -ru qt-everywhere-opensource-src-4.8.7.orig/config.tests/unix/precomp.test qt-everywhere-opensource-src-4.8.7/config.tests/unix/precomp.test
--- qt-everywhere-opensource-src-4.8.7.orig/config.tests/unix/precomp.test	2015-05-07 10:14:42.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/config.tests/unix/precomp.test	2015-10-12 21:20:48.000000000 -0400
@@ -27,7 +27,7 @@
     rm -f header.pchi header.o source.o
     ;;
 
-*g++*|c++|*qcc*)
+*g++*|c++|*qcc*|*gcc*|cc)
     case `"$COMPILER" -dumpversion 2>/dev/null` in
     3.*)
         ;;
diff -ru qt-everywhere-opensource-src-4.8.7.orig/configure qt-everywhere-opensource-src-4.8.7/configure
--- qt-everywhere-opensource-src-4.8.7.orig/configure	2015-05-07 10:14:56.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/configure	2015-10-12 21:20:48.000000000 -0400
@@ -5014,7 +5014,7 @@
                 ;;
             *)
                 # For all other configurations require a minimum of 10.5
-                echo "export MACOSX_DEPLOYMENT_TARGET = 10.5" >> "$mkfile"
+                echo "export MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@" >> "$mkfile"
                 ;;
             esac
 
@@ -5026,19 +5026,12 @@
             EXTRA_OBJS="qsettings_mac.o qcore_mac.o"
             EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\""
 	    if echo "$CFG_MAC_ARCHS" | grep x86 > /dev/null 2>&1; then # matches both x86 and x86_64
-		X86_CFLAGS="-arch i386"
-		X86_LFLAGS="-arch i386"
+		X86_CFLAGS="-arch @FINK_ARCH@"
+		X86_LFLAGS="-arch @FINK_ARCH@"
 		EXTRA_CFLAGS="$X86_CFLAGS $EXTRA_CFLAGS"
 		EXTRA_CXXFLAGS="$X86_CFLAGS $EXTRA_CXXFLAGS"
                 EXTRA_LFLAGS="$EXTRA_LFLAGS $X86_LFLAGS"
             fi
-	    if echo "$CFG_MAC_ARCHS" | grep ppc > /dev/null 2>&1; then # matches both ppc and ppc64
-		PPC_CFLAGS="-arch ppc"
-		PPC_LFLAGS="-arch ppc"
-		EXTRA_CFLAGS="$PPC_CFLAGS $EXTRA_CFLAGS"
-		EXTRA_CXXFLAGS="$PPC_CFLAGS $EXTRA_CXXFLAGS"
-                EXTRA_LFLAGS="$EXTRA_LFLAGS $PPC_LFLAGS"
-            fi
 	    if [ '!' -z "$CFG_SDK" ]; then
 		echo "SDK_LFLAGS =-Wl,-syslibroot,$CFG_SDK" >>"$mkfile"
 		echo "SDK_CFLAGS =-isysroot $CFG_SDK" >>"$mkfile"
@@ -7230,7 +7223,7 @@
     ;;
 macx*,yes)
     # Cocoa
-    QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.5
+    QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET @MACOSX_DEPLOYMENT_TARGET@
     ;;
 macx*,no)
     # gcc, Carbon
@@ -7998,10 +7991,10 @@
             QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=10.4"
         fi
         if echo "$CFG_MAC_ARCHS" | grep '\<x86_64\>' > /dev/null 2>&1; then
-            QMakeVar add QMAKE_CFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
-            QMakeVar add QMAKE_CXXFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
-            QMakeVar add QMAKE_LFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
-            QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86_64 "-arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5"
+            QMakeVar add QMAKE_CFLAGS "-Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
+            QMakeVar add QMAKE_CXXFLAGS "-Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
+            QMakeVar add QMAKE_LFLAGS "-Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
+            QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86_64 "-arch x86_64 -Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
         fi
         if echo "$CFG_MAC_ARCHS" | grep '\<ppc64\>' > /dev/null 2>&1; then
             QMakeVar add QMAKE_CFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
diff -ru qt-everywhere-opensource-src-4.8.7.orig/mkspecs/common/g++-macx.conf qt-everywhere-opensource-src-4.8.7/mkspecs/common/g++-macx.conf
--- qt-everywhere-opensource-src-4.8.7.orig/mkspecs/common/g++-macx.conf	2015-05-07 10:14:42.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/mkspecs/common/g++-macx.conf	2015-10-12 21:20:48.000000000 -0400
@@ -15,9 +15,11 @@
 QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += -g $$QMAKE_CFLAGS_DWARF2
 
 QMAKE_LFLAGS_STATIC_LIB += -all_load
+QMAKE_LFLAGS_PLUGIN -= -dynamiclib
+QMAKE_LFLAGS_PLUGIN += -bundle
 
-QMAKE_CFLAGS_X86_64 += -Xarch_x86_64 -mmacosx-version-min=10.5
-QMAKE_CFLAGS_PPC_64 += -Xarch_ppc64 -mmacosx-version-min=10.5
+QMAKE_CFLAGS_X86_64 += -Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@
+QMAKE_CFLAGS_PPC_64 += -Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@
 
 QMAKE_CXXFLAGS_X86_64         = $$QMAKE_CFLAGS_X86_64
 QMAKE_CXXFLAGS_PPC_64         = $$QMAKE_CFLAGS_PPC_64
diff -ru qt-everywhere-opensource-src-4.8.7.orig/mkspecs/common/mac.conf qt-everywhere-opensource-src-4.8.7/mkspecs/common/mac.conf
--- qt-everywhere-opensource-src-4.8.7.orig/mkspecs/common/mac.conf	2015-05-07 10:14:42.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/mkspecs/common/mac.conf	2015-10-12 21:20:48.000000000 -0400
@@ -5,6 +5,7 @@
 QMAKE_RESOURCE		= /Developer/Tools/Rez
 
 QMAKE_EXTENSION_SHLIB	= dylib
+QMAKE_EXTENSION_PLUGIN = so
 
 QMAKE_LIBDIR		=
 QMAKE_INCDIR_QT		= $$[QT_INSTALL_HEADERS]
@@ -38,7 +39,11 @@
 QMAKE_DEL_DIR		= rmdir
 QMAKE_CHK_DIR_EXISTS	= test -d
 QMAKE_MKDIR		= mkdir -p
-QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 # overridden to 10.5 for Cocoa on the compiler command line
+QMAKE_MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
 
+# allow CC and CXX to use CCACHE;
+# use "make CCACHE=ccache" when building
+QMAKE_CC = $(CCACHE) $$QMAKE_CC
+QMAKE_CXX = $(CCACHE) $$QMAKE_CXX
 
 include(unix.conf)
diff -ru qt-everywhere-opensource-src-4.8.7.orig/mkspecs/features/moc.prf qt-everywhere-opensource-src-4.8.7/mkspecs/features/moc.prf
--- qt-everywhere-opensource-src-4.8.7.orig/mkspecs/features/moc.prf	2015-05-07 10:14:42.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/mkspecs/features/moc.prf	2015-10-12 21:20:48.000000000 -0400
@@ -83,8 +83,13 @@
 #make sure we can include these files
 moc_dir_short = $$MOC_DIR
 contains(QMAKE_HOST.os,Windows):moc_dir_short ~= s,^.:,/,
-contains(moc_dir_short, ^[/\\\\].*):INCLUDEPATH += $$MOC_DIR
-else:INCLUDEPATH += $$OUT_PWD/$$MOC_DIR
+
+# order the local moc path -before- the others, since its headers
+# should -always be found locally so we want that path first.
+contains(moc_dir_short, ^[/\\\\].*):INCLUDEPATH = $$MOC_DIR $$INCLUDEPATH
+else:INCLUDEPATH = $$OUT_PWD/$$MOC_DIR $$INCLUDEPATH
+
+# message(MOC_DIR is $$MOC_DIR)
 
 # Backwards compatibility: Make shadow builds with default MOC_DIR work
 # if the user did not add the source dir explicitly.
diff -ru qt-everywhere-opensource-src-4.8.7.orig/mkspecs/features/qt.prf qt-everywhere-opensource-src-4.8.7/mkspecs/features/qt.prf
--- qt-everywhere-opensource-src-4.8.7.orig/mkspecs/features/qt.prf	2015-05-07 10:14:42.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/mkspecs/features/qt.prf	2015-10-12 21:20:48.000000000 -0400
@@ -145,7 +145,15 @@
 #specific module settings
 !isEmpty(QT_BUILD_TREE):QMAKE_LIBDIR = $$QT_BUILD_TREE/lib $$QMAKE_LIBDIR #as above, prepending prevents us from picking up "stale" libs
 QMAKE_LIBDIR += $$QMAKE_LIBDIR_QT
+
 for(QTLIB, $$list($$lower($$unique(QT)))) {
+
+#   message(qt: 'LIBS' qt before $$QTLIB is '$${LIBS}')
+#   message(qt: 'INCLUDEPATH' qt before $$QTLIB is '$${INCLUDEPATH}')
+#   message(qt: 'QMAKE_LFLAGS' qt before $$QTLIB is '$${QMAKE_LFLAGS}')
+#   message(qt: 'QMAKE_CFLAGS' qt before $$QTLIB is '$${QMAKE_CFLAGS}')
+#   message(qt: 'QMAKE_CXXFLAGS' qt before $$QTLIB is '$${QMAKE_CXXFLAGS}')
+
    unset(qlib_style)
    !qt_debug:!qt_release {
       CONFIG(debug, debug|release):qlib_style = debug
@@ -206,8 +214,43 @@
      qtAddLibrary($$qlib)
       }
    }
+#   message(qt: 'LIBS' qt after $$QTLIB is '$${LIBS}')
+#   message(qt: 'INCLUDEPATH' qt after $$QTLIB is '$${INCLUDEPATH}')
+#   message(qt: 'QMAKE_LFLAGS' qt after $$QTLIB is '$${QMAKE_LFLAGS}')
+#   message(qt: 'QMAKE_CFLAGS' qt after $$QTLIB is '$${QMAKE_CFLAGS}')
+#   message(qt: 'QMAKE_CXXFLAGS' qt after $$QTLIB is '$${QMAKE_CXXFLAGS}')
+}
+
+# remove Qt's libdir from various flags; it is already part of LIBS,
+# and should be used only to find Qt's libraries.  Qt puts LIBDIR
+# before all other paths, so it is critical that this variable not
+# contain anything questionable.
+QMAKE_LIBDIR -= $$QMAKE_LIBDIR_QT
+QMAKE_LFLAGS -= -L$$QMAKE_LIBDIR_QT
+!isEqual($$QMAKE_LIBDIR_QT, $$[QT_INSTALL_PREFIX]/lib) {
+  QMAKE_LFLAGS -= -L$$[QT_INSTALL_PREFIX]/lib
+}
+
+# remove Qt's incdir from various flags; it is already part of
+# INCLUDEPATH.  C*FLAGS come before the INCPATH build from
+# INCLUDEPATH, so they should never have this -I in it (or, reall, any
+# other -I but instead just remove the the obvious choices)
+QMAKE_CFLAGS -= -I$$QMAKE_INCDIR_QT
+QMAKE_CXXFLAGS -= -I$$QMAKE_INCDIR_QT
+QMAKE_OBJECTIVE_CFLAGS -= -I$$QMAKE_INCDIR_QT
+QMAKE_OBJECTIVE_CXXFLAGS -= -I$$QMAKE_INCDIR_QT
+!isEqual($$QMAKE_INCDIR_QT, $$[QT_INSTALL_PREFIX]/include) {
+  QMAKE_CFLAGS -= -I$$[QT_INSTALL_PREFIX]/include
+  QMAKE_CXXFLAGS -= -I$$[QT_INSTALL_PREFIX]/include
+  QMAKE_OBJECTIVE_CFLAGS -= -I$$[QT_INSTALL_PREFIX]/include
+  QMAKE_OBJECTIVE_CXXFLAGS -= -I$$[QT_INSTALL_PREFIX]/include
 }
 
+#message(qt: QMAKE_CFLAGS at end is $${QMAKE_CFLAGS})
+#message(qt: QMAKE_CXXFLAGS at end is $${QMAKE_CXXFLAGS})
+#message(qt: QMAKE_OBJECTIVE_CFLAGS at end is $${QMAKE_OBJECTIVE_CFLAGS})
+#message(qt: QMAKE_OBJECTIVE_CXXFLAGS at end is $${QMAKE_OBJECTIVE_CXXFLAGS})
+
 qt_compat {
    !qt_compat_no_warning:QTDIR_build:warning(***USE of COMPAT inside of QTDIR!**) #just for us
    INCLUDEPATH *= $$QMAKE_INCDIR_QT/Qt
diff -ru qt-everywhere-opensource-src-4.8.7.orig/mkspecs/macx-g++/qmake.conf qt-everywhere-opensource-src-4.8.7/mkspecs/macx-g++/qmake.conf
--- qt-everywhere-opensource-src-4.8.7.orig/mkspecs/macx-g++/qmake.conf	2015-05-07 10:14:41.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/mkspecs/macx-g++/qmake.conf	2015-10-12 21:20:48.000000000 -0400
@@ -9,7 +9,7 @@
 MAKEFILE_GENERATOR	= UNIX
 TARGET_PLATFORM		= macx
 TEMPLATE		= app
-CONFIG			+= qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl
+CONFIG			+= qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl absolute_library_soname
 QT			+= core gui
 QMAKE_INCREMENTAL_STYLE = sublib
 
diff -ru qt-everywhere-opensource-src-4.8.7.orig/qmake/project.cpp qt-everywhere-opensource-src-4.8.7/qmake/project.cpp
--- qt-everywhere-opensource-src-4.8.7.orig/qmake/project.cpp	2015-05-07 10:14:42.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/qmake/project.cpp	2015-10-12 21:20:48.000000000 -0400
@@ -596,14 +596,17 @@
             }
         }
     }
-    for(QStringList::Iterator concat_it = concat.begin();
-        concat_it != concat.end(); ++concat_it)
+    QByteArray qmake_no_defaults = qgetenv("QMAKE_NO_DEFAULTS");
+    if (qmake_no_defaults.isNull()) {
+      for(QStringList::Iterator concat_it = concat.begin();
+	  concat_it != concat.end(); ++concat_it)
         feature_roots << (QLibraryInfo::location(QLibraryInfo::PrefixPath) +
                           mkspecs_concat + (*concat_it));
-    for(QStringList::Iterator concat_it = concat.begin();
-        concat_it != concat.end(); ++concat_it)
+      for(QStringList::Iterator concat_it = concat.begin();
+	  concat_it != concat.end(); ++concat_it)
         feature_roots << (QLibraryInfo::location(QLibraryInfo::DataPath) +
                           mkspecs_concat + (*concat_it));
+    }
     return feature_roots;
 }
 
@@ -617,8 +620,10 @@
         for(QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
             ret << ((*it) + concat);
     }
-    ret << QLibraryInfo::location(QLibraryInfo::DataPath) + concat;
-
+    QByteArray qmake_no_defaults = qgetenv("QMAKE_NO_DEFAULTS");
+    if (qmake_no_defaults.isNull()) {
+      ret << QLibraryInfo::location(QLibraryInfo::DataPath) + concat;
+    }
     return ret;
 }
 
diff -ru qt-everywhere-opensource-src-4.8.7.orig/qmake/qmake.pri qt-everywhere-opensource-src-4.8.7/qmake/qmake.pri
--- qt-everywhere-opensource-src-4.8.7.orig/qmake/qmake.pri	2015-05-07 10:14:42.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/qmake/qmake.pri	2015-10-12 21:20:48.000000000 -0400
@@ -135,7 +135,7 @@
         SOURCES += qfilesystemengine_unix.cpp qfilesystemiterator_unix.cpp qfsfileengine_unix.cpp
         mac {
           SOURCES += qcore_mac.cpp qsettings_mac.cpp
-          QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported)
+          QMAKE_MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
           LIBS += -framework ApplicationServices
         }
     } else:win32 {
diff -ru qt-everywhere-opensource-src-4.8.7.orig/src/corelib/tools/qelapsedtimer_mac.cpp qt-everywhere-opensource-src-4.8.7/src/corelib/tools/qelapsedtimer_mac.cpp
--- qt-everywhere-opensource-src-4.8.7.orig/src/corelib/tools/qelapsedtimer_mac.cpp	2015-05-07 10:14:48.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/src/corelib/tools/qelapsedtimer_mac.cpp	2015-10-12 21:20:48.000000000 -0400
@@ -62,7 +62,7 @@
 {
     if (info.denom == 0)
         mach_timebase_info(&info);
-    qint64 nsecs = cpuTime * info.numer / info.denom;
+    qint64 nsecs = (qint64)(((double) cpuTime) * ((double) info.numer) / ((double) info.denom));
     return nsecs;
 }
 
diff -ru qt-everywhere-opensource-src-4.8.7.orig/src/gui/dialogs/qfontdialog_mac.mm qt-everywhere-opensource-src-4.8.7/src/gui/dialogs/qfontdialog_mac.mm
--- qt-everywhere-opensource-src-4.8.7.orig/src/gui/dialogs/qfontdialog_mac.mm	2015-05-07 10:14:43.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/src/gui/dialogs/qfontdialog_mac.mm	2015-10-12 21:20:48.000000000 -0400
@@ -511,7 +511,7 @@
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
     if (qstrcmp(fe->name(), "CoreText") == 0) {
-        nsFont = reinterpret_cast<const NSFont *>(static_cast<QCoreTextFontEngineMulti *>(fe)->ctfont);
+        nsFont = const_cast<NSFont *>(reinterpret_cast<const NSFont *>(static_cast<QCoreTextFontEngineMulti *>(fe)->ctfont));
     } else
 #endif
     {
diff -ru qt-everywhere-opensource-src-4.8.7.orig/src/gui/kernel/qcocoamenuloader_mac.mm qt-everywhere-opensource-src-4.8.7/src/gui/kernel/qcocoamenuloader_mac.mm
--- qt-everywhere-opensource-src-4.8.7.orig/src/gui/kernel/qcocoamenuloader_mac.mm	2015-05-07 10:14:43.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/src/gui/kernel/qcocoamenuloader_mac.mm	2015-10-12 21:20:48.000000000 -0400
@@ -70,7 +70,7 @@
     showAllItem = [[appMenu itemWithTitle:@"Show All"] retain];
 
     // Get the names in the nib to match the app name set by Qt.
-    const NSString *appName = reinterpret_cast<const NSString*>(QCFString::toCFStringRef(qAppName()));
+    const NSString *appName = const_cast<NSString *>(reinterpret_cast<const NSString*>(QCFString::toCFStringRef(qAppName())));
     [quitItem setTitle:[[quitItem title] stringByReplacingOccurrencesOfString:@"NewApplication"
                                                                    withString:const_cast<NSString *>(appName)]];
     [hideItem setTitle:[[hideItem title] stringByReplacingOccurrencesOfString:@"NewApplication"
diff -ru qt-everywhere-opensource-src-4.8.7.orig/src/gui/painting/qpaintengine_mac.cpp qt-everywhere-opensource-src-4.8.7/src/gui/painting/qpaintengine_mac.cpp
--- qt-everywhere-opensource-src-4.8.7.orig/src/gui/painting/qpaintengine_mac.cpp	2015-05-07 10:14:43.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/src/gui/painting/qpaintengine_mac.cpp	2015-10-12 21:24:05.000000000 -0400
@@ -341,12 +341,7 @@
 
     // Get the color space from the display profile.
     CGColorSpaceRef colorSpace = 0;
-    CMProfileRef displayProfile = 0;
-    CMError err = CMGetProfileByAVID((CMDisplayIDType)displayID, &displayProfile);
-    if (err == noErr) {
-        colorSpace = CGColorSpaceCreateWithPlatformColorSpace(displayProfile);
-        CMCloseProfile(displayProfile);
-    }
+    colorSpace = CGDisplayCopyColorSpace(displayID);
 
     // Fallback: use generic DeviceRGB
     if (colorSpace == 0)
diff -ru qt-everywhere-opensource-src-4.8.7.orig/src/plugins/qpluginbase.pri qt-everywhere-opensource-src-4.8.7/src/plugins/qpluginbase.pri
--- qt-everywhere-opensource-src-4.8.7.orig/src/plugins/qpluginbase.pri	2015-05-07 10:14:48.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/src/plugins/qpluginbase.pri	2015-10-12 21:20:48.000000000 -0400
@@ -5,6 +5,9 @@
    VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
 }
 CONFIG += qt plugin
+QMAKE_LFLAGS_PLUGIN -= -dynamiclib
+QMAKE_LFLAGS_PLUGIN += -bundle
+QMAKE_EXTENSION_PLUGIN = so
 
 win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
 TARGET = $$qtLibraryTarget($$TARGET)
diff -ru qt-everywhere-opensource-src-4.8.7.orig/src/qbase.pri qt-everywhere-opensource-src-4.8.7/src/qbase.pri
--- qt-everywhere-opensource-src-4.8.7.orig/src/qbase.pri	2015-05-07 10:14:43.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/src/qbase.pri	2015-10-12 21:20:48.000000000 -0400
@@ -137,14 +137,14 @@
 
 unix|win32-g++*:!symbian {
    CONFIG += create_pc
-   QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS]
+   QMAKE_PKGCONFIG_LIBDIR = $$target.path
    QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
    QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
    QMAKE_PKGCONFIG_DESTDIR = pkgconfig
    include_replace.match = $$QMAKE_INCDIR_QT
    include_replace.replace = $$[QT_INSTALL_HEADERS]
    lib_replace.match = $$QMAKE_LIBDIR_QT
-   lib_replace.replace = $$[QT_INSTALL_LIBS]
+   lib_replace.replace = $$target.path
    prefix_replace.match = $$QT_BUILD_TREE
    prefix_replace.replace = $$[QT_INSTALL_PREFIX]
    QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace prefix_replace
@@ -152,8 +152,8 @@
 
 unix:!symbian {
    CONFIG += create_libtool explicitlib
-   QMAKE_LIBTOOL_LIBDIR = $$[QT_INSTALL_LIBS]
-   QMAKE_PRL_LIBDIR = $$[QT_INSTALL_LIBS]
+   QMAKE_LIBTOOL_LIBDIR = $$target.path
+   QMAKE_PRL_LIBDIR = $$target.path
    QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace
    QMAKE_LIBTOOL_INSTALL_REPLACE += include_replace lib_replace
 }
diff -ru qt-everywhere-opensource-src-4.8.7.orig/src/tools/bootstrap/bootstrap.pro qt-everywhere-opensource-src-4.8.7/src/tools/bootstrap/bootstrap.pro
--- qt-everywhere-opensource-src-4.8.7.orig/src/tools/bootstrap/bootstrap.pro	2015-05-07 10:14:44.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/src/tools/bootstrap/bootstrap.pro	2015-10-12 21:20:48.000000000 -0400
@@ -103,7 +103,7 @@
 else:win32:SOURCES += ../../corelib/tools/qlocale_win.cpp
 
 macx: {
-   QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported)
+   QMAKE_MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
    SOURCES += ../../corelib/kernel/qcore_mac.cpp
    LIBS += -framework CoreServices -framework ApplicationServices
 }
diff -ru qt-everywhere-opensource-src-4.8.7.orig/tools/assistant/lib/fulltextsearch/fulltextsearch.pro qt-everywhere-opensource-src-4.8.7/tools/assistant/lib/fulltextsearch/fulltextsearch.pro
--- qt-everywhere-opensource-src-4.8.7.orig/tools/assistant/lib/fulltextsearch/fulltextsearch.pro	2015-05-07 10:14:40.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/tools/assistant/lib/fulltextsearch/fulltextsearch.pro	2015-10-12 21:20:48.000000000 -0400
@@ -6,9 +6,9 @@
 mac:!static:contains(QT_CONFIG, qt_framework) { 
    CONFIG(debug, debug|release) { 
       !build_pass:CONFIG += build_all 
-   } 
+   }
 }
-QT_CONFIG -= qt_framework 
+# QT_CONFIG -= qt_framework 
 QT -= gui
 TEMPLATE = lib
 TARGET = QtCLucene
diff -ru qt-everywhere-opensource-src-4.8.7.orig/tools/assistant/lib/lib.pro qt-everywhere-opensource-src-4.8.7/tools/assistant/lib/lib.pro
--- qt-everywhere-opensource-src-4.8.7.orig/tools/assistant/lib/lib.pro	2015-05-07 10:14:40.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/tools/assistant/lib/lib.pro	2015-10-12 21:20:48.000000000 -0400
@@ -12,16 +12,15 @@
     application \
     framework.
 DEFINES -= QT_ASCII_CAST_WARNINGS
-qclucene = QtCLucene$${QT_LIBINFIX}
-if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { 
-    mac:qclucene = $${qclucene}_debug
-    win32:qclucene = $${qclucene}d
-}
-linux-lsb-g++:LIBS_PRIVATE += --lsb-shared-libs=$$qclucene
+
+qtAddLibrary(QtCLucene)
+
 unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES += QtNetwork \
     QtSql \
-    QtXml
-LIBS_PRIVATE += -l$$qclucene
+    QtGui \
+    QtCore \
+    QtCLucene
+
 RESOURCES += helpsystem.qrc
 SOURCES += qhelpenginecore.cpp \
     qhelpengine.cpp \
diff -ru qt-everywhere-opensource-src-4.8.7.orig/tools/designer/src/lib/lib.pro qt-everywhere-opensource-src-4.8.7/tools/designer/src/lib/lib.pro
--- qt-everywhere-opensource-src-4.8.7.orig/tools/designer/src/lib/lib.pro	2015-05-07 10:14:40.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/tools/designer/src/lib/lib.pro	2015-10-12 21:20:48.000000000 -0400
@@ -13,8 +13,6 @@
    VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
 }
 
-unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES += QtXml
-
 include(../../../../src/qt_targets.pri)
 QMAKE_TARGET_PRODUCT = Designer
 QMAKE_TARGET_DESCRIPTION = Graphical user interface designer.
diff -ru qt-everywhere-opensource-src-4.8.7.orig/tools/designer/src/uitools/uitools.pro qt-everywhere-opensource-src-4.8.7/tools/designer/src/uitools/uitools.pro
--- qt-everywhere-opensource-src-4.8.7.orig/tools/designer/src/uitools/uitools.pro	2015-05-07 10:14:40.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/tools/designer/src/uitools/uitools.pro	2015-10-12 21:20:48.000000000 -0400
@@ -1,7 +1,7 @@
 TEMPLATE = lib
 TARGET = QtUiTools
 QT += xml
-CONFIG += qt staticlib
+CONFIG += qt qt_install_headers
 DESTDIR = ../../../../lib
 DLLDESTDIR = ../../../../bin
 
diff -ru qt-everywhere-opensource-src-4.8.7.orig/tools/macdeployqt/macdeployqt/main.cpp qt-everywhere-opensource-src-4.8.7/tools/macdeployqt/macdeployqt/main.cpp
--- qt-everywhere-opensource-src-4.8.7.orig/tools/macdeployqt/macdeployqt/main.cpp	2015-05-07 10:14:40.000000000 -0400
+++ qt-everywhere-opensource-src-4.8.7/tools/macdeployqt/macdeployqt/main.cpp	2015-10-12 21:20:48.000000000 -0400
@@ -127,7 +127,7 @@
 
     if (plugins) {
         if (deploymentInfo.qtPath.isEmpty())
-            deploymentInfo.pluginPath = "/Developer/Applications/Qt/plugins"; // Assume binary package.
+            deploymentInfo.pluginPath = "@QT_PLUGINS_DIR@"; // Assume binary package.
         else
             deploymentInfo.pluginPath = deploymentInfo.qtPath + "/plugins";
 
