[144442] trunk/dports/aqua/qt5

mcalhoun at macports.org mcalhoun at macports.org
Fri Jan 8 15:50:05 PST 2016


Revision: 144442
          https://trac.macports.org/changeset/144442
Author:   mcalhoun at macports.org
Date:     2016-01-08 15:50:05 -0800 (Fri, 08 Jan 2016)
Log Message:
-----------
qt5-qtbase: respect macosx_deployment_target and configure.cxx_stdlib values in build

Modified Paths:
--------------
    trunk/dports/aqua/qt5/Portfile

Added Paths:
-----------
    trunk/dports/aqua/qt5/files/patch-mkspecs.diff

Modified: trunk/dports/aqua/qt5/Portfile
===================================================================
--- trunk/dports/aqua/qt5/Portfile	2016-01-08 23:45:11 UTC (rev 144441)
+++ trunk/dports/aqua/qt5/Portfile	2016-01-08 23:50:05 UTC (rev 144442)
@@ -30,6 +30,10 @@
     incr revision 1
 }
 
+if { ${version} eq "5.5.1" && ${subport} eq "qt5-qtbase" } {
+    incr revision 1
+}
+
 # generate documentation from complete code base
 # generate modules from separate downloads
 if { ${subport} ne "${name}-docs" } {
@@ -832,6 +836,7 @@
 
     # special case
     if { ${subport} ne "${name}-docs" } {
+
         # https://codereview.qt-project.org/#/c/141654/
         patchfiles-append patch-add_sdk.diff
 
@@ -850,6 +855,64 @@
 
         #https://codereview.qt-project.org/#/c/138349
         patchfiles-append patch-rpath.diff
+
+        #-----------------------------------------------------------------------------
+        # qtbase is used for:
+        #    1) building qtbase
+        #    2) building MacPorts projects via qmake
+        #    3) building end-user projects
+        #
+        # 1 & 2 require consistency with the MacPorts environment
+        # 3 requires consistency with the default Qt installation
+        #
+        # 2 can be achieved via environment variables
+        #    (e.g. QMAKE_MACOSX_DEPLOYMENT_TARGET=${macosx_deployment_target})
+        #
+        # the only way 3 can be achieved is if no changes are made to the build system
+        #
+        # the following is an attempt to achieve 1 without destroying 3
+        #-----------------------------------------------------------------------------
+
+        # save default spec files
+        post-extract {
+            copy ${worksrcpath}/mkspecs ${worksrcpath}/mkspecs-save
+        }
+
+        # change default compiler flags for the purpose of building qtbase
+        patchfiles-append patch-mkspecs.diff
+        post-patch {
+            global qt_save_cxx_stdlib
+
+            reinplace \
+                "s|__MACPORTS__CXX_STDLIB__|${qt_save_cxx_stdlib}|g" \
+                ${worksrcpath}/mkspecs/common/clang-mac.conf
+
+            foreach spec {macx-clang macx-clang-32} {
+                reinplace \
+                    "s|__MACPORTS_DEPLOYMENT_TARGET__|${macosx_deployment_target}|g" \
+                    ${worksrcpath}/mkspecs/${spec}/qmake.conf
+            }
+        }
+
+        # return modified spec files to the default values
+        post-build {
+            if { [variant_exists universal] && [variant_isset universal] } {
+                foreach arch ${universal_archs_to_use} {
+                    move -force ${worksrcpath}-${arch}/mkspecs-save/common/clang-mac.conf ${worksrcpath}-${arch}/mkspecs/common/clang-mac.conf
+
+                    foreach spec {macx-clang macx-clang-32} {
+                        move -force ${worksrcpath}-${arch}/mkspecs-save/${spec}/qmake.conf ${worksrcpath}-${arch}/mkspecs/${spec}/qmake.conf
+                    }
+                }
+            } else {
+                move -force ${worksrcpath}/mkspecs-save/common/clang-mac.conf ${worksrcpath}/mkspecs/common/clang-mac.conf
+
+                foreach spec {macx-clang macx-clang-32} {
+                    move -force ${worksrcpath}/mkspecs-save/${spec}/qmake.conf ${worksrcpath}/mkspecs/${spec}/qmake.conf
+                }
+            }
+        }
+        #-----------------------------------------------------------------------------
     }
 
     if { [variant_isset tests] } {
@@ -1000,6 +1063,10 @@
     # Qt builds part of the system using environment provided my MacPorts.
     # It builds the rest using its own internal environment.
     # For consistency, clear MacPorts environment.
+
+    # configure.cxx_stdlib value is needed later in a post-patch
+    set qt_save_cxx_stdlib ${configure.cxx_stdlib}
+
     configure.cxx_stdlib
     configure.sdkroot
     configure.cc_archflags

Added: trunk/dports/aqua/qt5/files/patch-mkspecs.diff
===================================================================
--- trunk/dports/aqua/qt5/files/patch-mkspecs.diff	                        (rev 0)
+++ trunk/dports/aqua/qt5/files/patch-mkspecs.diff	2016-01-08 23:50:05 UTC (rev 144442)
@@ -0,0 +1,31 @@
+--- .//mkspecs/common/clang-mac.conf.orig	2016-01-08 05:58:40.000000000 -0700
++++ .//mkspecs/common/clang-mac.conf	2016-01-08 06:01:16.000000000 -0700
+@@ -6,5 +6,5 @@
+ 
+ QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvm.clang.1_0
+ 
+-QMAKE_CXXFLAGS_CXX11 += -stdlib=libc++
+-QMAKE_LFLAGS_CXX11   += -stdlib=libc++
++QMAKE_CXXFLAGS += -stdlib=__MACPORTS__CXX_STDLIB__
++QMAKE_LFLAGS   += -stdlib=__MACPORTS__CXX_STDLIB__
+--- mkspecs/macx-clang/qmake.conf.orig	2016-01-08 05:56:17.000000000 -0700
++++ mkspecs/macx-clang/qmake.conf	2016-01-08 06:02:29.000000000 -0700
+@@ -11,6 +11,6 @@
+ include(../common/clang.conf)
+ include(../common/clang-mac.conf)
+ 
+-QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
++QMAKE_MACOSX_DEPLOYMENT_TARGET = __MACPORTS_DEPLOYMENT_TARGET__
+ 
+ load(qt_config)
+--- .//mkspecs/macx-clang-32/qmake.conf.orig	2016-01-08 05:56:36.000000000 -0700
++++ .//mkspecs/macx-clang-32/qmake.conf	2016-01-08 06:02:20.000000000 -0700
+@@ -11,7 +11,7 @@
+ include(../common/clang.conf)
+ include(../common/clang-mac.conf)
+ 
+-QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
++QMAKE_MACOSX_DEPLOYMENT_TARGET = __MACPORTS_DEPLOYMENT_TARGET__
+ 
+ QMAKE_CFLAGS           += -arch i386
+ QMAKE_OBJECTIVE_CFLAGS += -arch i386
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160108/87e01f57/attachment-0001.html>


More information about the macports-changes mailing list