summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartchus2017-08-09 22:24:26 +0200
committerMartchus2017-08-09 22:24:26 +0200
commitf06a161bf2daa014a475878a7f98ae95a9f7fd9e (patch)
treee5f1f9908f88e175002d30c223aa1b131c6f2b9a
downloadaur-apple-darwin-qt5-base.tar.gz
Initial import
-rw-r--r--.SRCINFO41
-rw-r--r--0001-Enable-cross-compilation-with-osxcross.patch76
-rw-r--r--0002-Allow-overriding-stdlib-under-MacOS.patch39
-rw-r--r--0003-Remove-error-handling-for-Xcode-detection.patch59
-rw-r--r--0004-Fix-build-errors-under-32-bit-MacOS.patch41
-rw-r--r--0005-Prevent-debug-library-names-in-pkg-config-files.patch33
-rw-r--r--0006-Pull-dependencies-of-static-libraries-in-CMake-modul.patch274
-rw-r--r--0007-Fix-finding-gl.h-when-cross-compiling-with-osxcross.patch41
-rw-r--r--0008-Prevent-error-when-qmlimportscanner-not-available.patch35
-rw-r--r--PKGBUILD200
10 files changed, 839 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..895ba66ca31e
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,41 @@
+# Generated by mksrcinfo v8
+# Wed Aug 9 20:24:26 UTC 2017
+pkgbase = apple-darwin-qt5-base
+ pkgdesc = A cross-platform application and UI framework (apple-darwin)
+ pkgver = 5.9.1
+ pkgrel = 1
+ url = https://www.qt.io/
+ arch = i686
+ arch = x86_64
+ groups = apple-darwin-qt5
+ license = GPL3
+ license = LGPL3
+ license = FDL
+ license = custom
+ makedepends = clang
+ depends = apple-darwin-osxcross
+ options = !strip
+ options = !buildflags
+ options = staticlibs
+ options = !emptydirs
+ source = https://download.qt.io/official_releases/qt/5.9/5.9.1/submodules/qtbase-opensource-src-5.9.1.tar.xz
+ source = 0001-Enable-cross-compilation-with-osxcross.patch
+ source = 0002-Allow-overriding-stdlib-under-MacOS.patch
+ source = 0003-Remove-error-handling-for-Xcode-detection.patch
+ source = 0004-Fix-build-errors-under-32-bit-MacOS.patch
+ source = 0005-Prevent-debug-library-names-in-pkg-config-files.patch
+ source = 0006-Pull-dependencies-of-static-libraries-in-CMake-modul.patch
+ source = 0007-Fix-finding-gl.h-when-cross-compiling-with-osxcross.patch
+ source = 0008-Prevent-error-when-qmlimportscanner-not-available.patch
+ sha256sums = bc9a21e9f6fff9629019fdf9f989f064751d5073c3a28dc596def92f4d4275c6
+ sha256sums = f5b474fc11f929c8e1563136c6b53d09c9e405ebf5a7940a63dc13f00d3e2bbd
+ sha256sums = a51749efb16b81f5e272a0864a6e2583942998bca1fe397c0e4205b269c97ae4
+ sha256sums = 73d314dad7a93073140ee9d868e1071a107b1afdecc67cb67d85a91391452a82
+ sha256sums = 96db51e0cac5ee455931f404fd72ff13b1bab6174034f0dd9460d43d94e970f0
+ sha256sums = b665c7ee5b4bf603dd7a224d5d72d2fb669d9c7ec40b47cebe3ab3392c523b36
+ sha256sums = 571acd36daf587c44af728e0d63531ceb44e987b572c37bf98a379af13a77b84
+ sha256sums = f0e75b20c059af982091093a3e7f13e9099e6568210bf753c3cc84fa9181a4f1
+ sha256sums = 56b75af151978d8a25c658a6accded13d3ddc16b21a3524abb08e40a52cbe113
+
+pkgname = apple-darwin-qt5-base
+
diff --git a/0001-Enable-cross-compilation-with-osxcross.patch b/0001-Enable-cross-compilation-with-osxcross.patch
new file mode 100644
index 000000000000..03cef8d7ac0c
--- /dev/null
+++ b/0001-Enable-cross-compilation-with-osxcross.patch
@@ -0,0 +1,76 @@
+From 83b2cce640be5314e768d121fd0b407245325c0d Mon Sep 17 00:00:00 2001
+From: Martchus <martchus@gmx.net>
+Date: Sun, 30 Jul 2017 02:00:34 +0200
+Subject: [PATCH 1/8] Enable cross compilation with osxcross
+
+Change-Id: I1d4044991b34165314acaf729ec503f83ca9d5ab
+---
+ mkspecs/common/clang.conf | 4 ++--
+ mkspecs/common/g++-base.conf | 4 ++--
+ mkspecs/common/mac.conf | 16 ++++++++++------
+ 3 files changed, 14 insertions(+), 10 deletions(-)
+
+diff --git a/mkspecs/common/clang.conf b/mkspecs/common/clang.conf
+index e003b947aa..0fb84bc1b3 100644
+--- a/mkspecs/common/clang.conf
++++ b/mkspecs/common/clang.conf
+@@ -4,8 +4,8 @@
+
+ QMAKE_COMPILER = gcc clang llvm # clang pretends to be gcc
+
+-QMAKE_CC = clang
+-QMAKE_CXX = clang++
++QMAKE_CC = $${CROSS_COMPILE}clang
++QMAKE_CXX = $${CROSS_COMPILE}clang++
+
+ QMAKE_LINK_C = $$QMAKE_CC
+ QMAKE_LINK_C_SHLIB = $$QMAKE_CC
+diff --git a/mkspecs/common/g++-base.conf b/mkspecs/common/g++-base.conf
+index c42c46b0ec..5b584e4fd5 100644
+--- a/mkspecs/common/g++-base.conf
++++ b/mkspecs/common/g++-base.conf
+@@ -10,12 +10,12 @@
+
+ QMAKE_COMPILER = gcc
+
+-QMAKE_CC = gcc
++QMAKE_CC = $${CROSS_COMPILE}gcc
+
+ QMAKE_LINK_C = $$QMAKE_CC
+ QMAKE_LINK_C_SHLIB = $$QMAKE_CC
+
+-QMAKE_CXX = g++
++QMAKE_CXX = $${CROSS_COMPILE}g++
+
+ QMAKE_LINK = $$QMAKE_CXX
+ QMAKE_LINK_SHLIB = $$QMAKE_CXX
+diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
+index 5208379f9a..b237530775 100644
+--- a/mkspecs/common/mac.conf
++++ b/mkspecs/common/mac.conf
+@@ -33,12 +33,16 @@ QMAKE_LIBS_DYNLOAD =
+ QMAKE_LIBS_OPENGL = -framework OpenGL -framework AGL
+ QMAKE_LIBS_THREAD =
+
+-QMAKE_ACTOOL = actool
++QMAKE_ACTOOL = $${CROSS_COMPILE}actool
+
+-QMAKE_DSYMUTIL = dsymutil
+-QMAKE_STRIP = strip
++QMAKE_DSYMUTIL = $${CROSS_COMPILE}dsymutil
++QMAKE_STRIP = $${CROSS_COMPILE}strip
+ QMAKE_STRIPFLAGS_LIB += -S -x
+
+-QMAKE_AR = ar cq
+-QMAKE_RANLIB = ranlib -s
+-QMAKE_NM = nm -P
++QMAKE_AR = $${CROSS_COMPILE}ar cq
++QMAKE_RANLIB = $${CROSS_COMPILE}ranlib -s
++QMAKE_NM = $${CROSS_COMPILE}nm -P
++
++!isEmpty(CROSS_COMPILE_CFLAGS) {
++ QMAKE_CXXFLAGS += -fpch-preprocess
++}
+--
+2.13.4
+
diff --git a/0002-Allow-overriding-stdlib-under-MacOS.patch b/0002-Allow-overriding-stdlib-under-MacOS.patch
new file mode 100644
index 000000000000..7b1329c46805
--- /dev/null
+++ b/0002-Allow-overriding-stdlib-under-MacOS.patch
@@ -0,0 +1,39 @@
+From be78c416c070a8a87fe8f449a717c5a7b800f683 Mon Sep 17 00:00:00 2001
+From: Martchus <martchus@gmx.net>
+Date: Sun, 30 Jul 2017 21:17:41 +0200
+Subject: [PATCH 2/8] Allow overriding stdlib under MacOS
+
+---
+ mkspecs/common/clang-mac.conf | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/mkspecs/common/clang-mac.conf b/mkspecs/common/clang-mac.conf
+index cbae2e6262..bdf855fed2 100644
+--- a/mkspecs/common/clang-mac.conf
++++ b/mkspecs/common/clang-mac.conf
+@@ -6,8 +6,20 @@ QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+
+ QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvm.clang.1_0
+
+-QMAKE_CXXFLAGS += -stdlib=libc++
+-QMAKE_LFLAGS += -stdlib=libc++
++# Use libc++ by default under MacOS/Clang
++isEmpty(QMAKE_MACOSX_STDLIB) {
++ QMAKE_MACOSX_STDLIB = libc++
++}
++isEqual(QMAKE_MACOSX_STDLIB, libstdc++) {
++ # To enable libstdc++, passing -stdlib=XXX is not enough - at least under osxcross the stdheaders are otherwise not found
++ # It is also required to disable GCC extensions by defining __STRICT_ANSI__ because not all GCC extensions are supported by Clang
++ QMAKE_CXXFLAGS += -D__STRICT_ANSI__ -foc-use-gcc-libstdc++
++ QMAKE_LFLAGS += -D__STRICT_ANSI__ -foc-use-gcc-libstdc++
++} else {
++ QMAKE_CXXFLAGS += -stdlib=$${QMAKE_MACOSX_STDLIB}
++ QMAKE_LFLAGS += -stdlib=$${QMAKE_MACOSX_STDLIB}
++}
++
+ QMAKE_AR_LTCG = libtool -static -o
+
+ QMAKE_CFLAGS_APPLICATION_EXTENSION = -fapplication-extension
+--
+2.13.4
+
diff --git a/0003-Remove-error-handling-for-Xcode-detection.patch b/0003-Remove-error-handling-for-Xcode-detection.patch
new file mode 100644
index 000000000000..ad98c8842703
--- /dev/null
+++ b/0003-Remove-error-handling-for-Xcode-detection.patch
@@ -0,0 +1,59 @@
+From 5ea2e056ca85c35e717279d3ea15678f8f569ee0 Mon Sep 17 00:00:00 2001
+From: Martchus <martchus@gmx.net>
+Date: Sun, 30 Jul 2017 22:26:38 +0200
+Subject: [PATCH 3/8] Remove error handling for Xcode detection
+
+* Don't know where this Xcode stuff under osxcross is
+* So just get rid of the error messages by removing
+ the error handling
+* Let's see what this will break :-)
+---
+ mkspecs/features/mac/default_pre.prf | 32 --------------------------------
+ 1 file changed, 32 deletions(-)
+
+diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
+index e21e749ee9..1157a6ae05 100644
+--- a/mkspecs/features/mac/default_pre.prf
++++ b/mkspecs/features/mac/default_pre.prf
+@@ -1,38 +1,6 @@
+ CONFIG = asset_catalogs rez $$CONFIG
+ load(default_pre)
+
+-isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
+- # Get path of Xcode's Developer directory
+- QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
+- isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
+- error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
+-
+- # Make sure Xcode path is valid
+- !exists($$QMAKE_XCODE_DEVELOPER_PATH): \
+- error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
+-
+- # Make sure Xcode is set up properly
+- isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))): \
+- error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.")
+-}
+-
+-isEmpty(QMAKE_XCODE_VERSION) {
+- # Extract Xcode version using xcodebuild
+- xcode_version = $$system("/usr/bin/xcodebuild -version")
+- QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
+- isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
+- unset(xcode_version)
+-}
+-
+-isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
+- QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist
+- exists($$QMAKE_XCODE_PREFERENCES_FILE): \
+- QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null")
+-
+- !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
+- cache(QMAKE_TARGET_BUNDLE_PREFIX)
+-}
+-
+ QMAKE_ASSET_CATALOGS_APP_ICON = AppIcon
+
+ # Make the default debug info format for static debug builds
+--
+2.13.4
+
diff --git a/0004-Fix-build-errors-under-32-bit-MacOS.patch b/0004-Fix-build-errors-under-32-bit-MacOS.patch
new file mode 100644
index 000000000000..c3281ccf9da2
--- /dev/null
+++ b/0004-Fix-build-errors-under-32-bit-MacOS.patch
@@ -0,0 +1,41 @@
+From 9301437563029764ce405330fe148b759769b27c Mon Sep 17 00:00:00 2001
+From: Martchus <martchus@gmx.net>
+Date: Tue, 1 Aug 2017 00:34:32 +0200
+Subject: [PATCH 4/8] Fix build errors under 32-bit MacOS
+
+Fix build errors like
+ `no known conversion from 'CGRect' to 'const _NSRect &'`
+under 32-bit MacOS
+---
+ src/plugins/platforms/cocoa/cocoa.pro | 2 ++
+ src/widgets/styles/styles.pri | 1 +
+ 2 files changed, 3 insertions(+)
+
+diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro
+index 62935210be..ce4795fb0e 100644
+--- a/src/plugins/platforms/cocoa/cocoa.pro
++++ b/src/plugins/platforms/cocoa/cocoa.pro
+@@ -104,6 +104,8 @@ qtHaveModule(widgets) {
+ QT += widgets-private printsupport-private
+ }
+
++DEFINES += NS_BUILD_32_LIKE_64
++
+ OTHER_FILES += cocoa.json
+
+ # Acccessibility debug support
+diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri
+index 481123f0d4..c72d75b407 100644
+--- a/src/widgets/styles/styles.pri
++++ b/src/widgets/styles/styles.pri
+@@ -43,6 +43,7 @@ qtConfig(style-mac) {
+ styles/qmacstyle_mac_p_p.h
+ OBJECTIVE_SOURCES += styles/qmacstyle_mac.mm
+ LIBS_PRIVATE += -framework Carbon
++ DEFINES += NS_BUILD_32_LIKE_64
+ }
+
+ qtConfig(style-windowsvista) {
+--
+2.13.4
+
diff --git a/0005-Prevent-debug-library-names-in-pkg-config-files.patch b/0005-Prevent-debug-library-names-in-pkg-config-files.patch
new file mode 100644
index 000000000000..f8f94f18baf4
--- /dev/null
+++ b/0005-Prevent-debug-library-names-in-pkg-config-files.patch
@@ -0,0 +1,33 @@
+From a39d7239989f1efeba81a608ada1a028c3e73c46 Mon Sep 17 00:00:00 2001
+From: Martchus <martchus@gmx.net>
+Date: Sun, 18 Sep 2016 14:01:14 +0200
+Subject: [PATCH 5/8] Prevent debug library names in pkg-config files
+
+qmake generates the pkgconfig .pc files two times, once for the
+release build and once for the debug build (which we're not actually
+building in this package). For both generations the exact same
+pkgconfig file name is used. This causes references to the debug
+build ending up in the .pc files which are unwanted
+Prevent this from happening by giving the pkgconfig .pc
+files for the debug build an unique file name.
+---
+ qmake/generators/makefile.cpp | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
+index a1f3352aa3..56f0a3b703 100644
+--- a/qmake/generators/makefile.cpp
++++ b/qmake/generators/makefile.cpp
+@@ -3160,6 +3160,9 @@ MakefileGenerator::pkgConfigFileName(bool fixify)
+ if (dot != -1)
+ ret = ret.left(dot);
+ }
++ if (project->isActiveConfig("debug")) {
++ ret += "d";
++ }
+ ret += Option::pkgcfg_ext;
+ QString subdir = project->first("QMAKE_PKGCONFIG_DESTDIR").toQString();
+ if(!subdir.isEmpty()) {
+--
+2.13.4
+
diff --git a/0006-Pull-dependencies-of-static-libraries-in-CMake-modul.patch b/0006-Pull-dependencies-of-static-libraries-in-CMake-modul.patch
new file mode 100644
index 000000000000..38db3fe1945a
--- /dev/null
+++ b/0006-Pull-dependencies-of-static-libraries-in-CMake-modul.patch
@@ -0,0 +1,274 @@
+From c54e1cb52eab4c008cc7301d56e2dcb3b314819d Mon Sep 17 00:00:00 2001
+From: Martchus <martchus@gmx.net>
+Date: Sun, 18 Sep 2016 18:32:00 +0200
+Subject: [PATCH 6/8] Pull dependencies of static libraries in CMake modules
+
+When doing a static build of Qt, the dependencies of the Qt
+libraries and plugins itself must be specified when linking
+the final application.
+---
+ .../features/data/cmake/Qt5BasicConfig.cmake.in | 149 ++++++++++++++++-----
+ .../features/data/cmake/Qt5PluginTarget.cmake.in | 11 +-
+ qmake/generators/makefile.cpp | 7 +
+ 3 files changed, 129 insertions(+), 38 deletions(-)
+
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index 17da8b979e..f11d17b94b 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -55,35 +55,52 @@ but not all the files it references.
+ endmacro()
+
+ !!IF !equals(TEMPLATE, aux)
+-macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
+- set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
++macro(_populate_$${CMAKE_MODULE_NAME}_target_properties TARGET_CONFIG LIB_LOCATION IMPLIB_LOCATION)
++ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${TARGET_CONFIG})
+
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+ set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ELSE
+ set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
++
+ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
++
++!!IF !isEmpty(CMAKE_STATIC_TYPE)
++ if (_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES)
++ set(_list_sep \";\")
++ endif()
++ set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
++ \"INTERFACE_LINK_LIBRARIES_${TARGET_CONFIG}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}${_list_sep}${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${TARGET_CONFIG}_LIB_DEPENDENCIES}\"
++ \"IMPORTED_LOCATION_${TARGET_CONFIG}\" ${imported_location}
++!!IF !isEmpty(CMAKE_LIB_SONAME)
++ \"IMPORTED_SONAME_${TARGET_CONFIG}\" \"$${CMAKE_LIB_SONAME}\"
++!!ENDIF
++ # For backward compatibility with CMake < 2.8.12
++ \"IMPORTED_LINK_INTERFACE_LIBRARIES_${TARGET_CONFIG}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}${_list_sep}${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${TARGET_CONFIG}_LIB_DEPENDENCIES}\"
++ )
++!!ELSE
+ set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+- \"INTERFACE_LINK_LIBRARIES\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
+- \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
++ \"INTERFACE_LINK_LIBRARIES_${TARGET_CONFIG}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
++ \"IMPORTED_LOCATION_${TARGET_CONFIG}\" ${imported_location}
+ !!IF !isEmpty(CMAKE_LIB_SONAME)
+- \"IMPORTED_SONAME_${Configuration}\" \"$${CMAKE_LIB_SONAME}\"
++ \"IMPORTED_SONAME_${TARGET_CONFIG}\" \"$${CMAKE_LIB_SONAME}\"
+ !!ENDIF
+ # For backward compatibility with CMake < 2.8.12
+- \"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
++ \"IMPORTED_LINK_INTERFACE_LIBRARIES_${TARGET_CONFIG}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
+ )
++!!ENDIF
+
+ !!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+ set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+- set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
++ set(imported_implib \"IMPORTED_IMPLIB_${TARGET_CONFIG}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
+ if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
+ set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+- \"IMPORTED_IMPLIB_${Configuration}\" ${imported_implib}
++ \"IMPORTED_IMPLIB_${TARGET_CONFIG}\" ${imported_implib}
+ )
+ endif()
+ !!ENDIF
+@@ -227,13 +244,48 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ !!IF !isEmpty(CMAKE_STATIC_TYPE)
+ add_library(Qt5::$${CMAKE_MODULE_NAME} STATIC IMPORTED)
+ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES "CXX")
++ macro(_process_prl_file PRL_FILE_LOCATION CONFIGURATION)
++ if (EXISTS \"${PRL_FILE_LOCATION}\")
++ file(STRINGS \"${PRL_FILE_LOCATION}\" prl_strings REGEX \"QMAKE_PRL_LIBS_FOR_CMAKE\")
++ string(REGEX REPLACE \"QMAKE_PRL_LIBS_FOR_CMAKE *= *([^\\n]*)\" \"\\\\1\" static_depends ${prl_strings})
++ string(REGEX REPLACE \"\\\\$\\\\$\\\\[QT_INSTALL_LIBS\\\\]\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/lib\" static_depends \"${static_depends}\")
++ string(REPLACE \"-framework;\" \"-framework \" static_depends \"${static_depends}\")
++ if (_Qt5$${CMAKE_MODULE_NAME}_STATIC_${CONFIGURATION}_LIB_DEPENDENCIES)
++ set(_list_sep \";\")
++ endif()
++ set(_Qt5$${CMAKE_MODULE_NAME}_STATIC_${CONFIGURATION}_LIB_DEPENDENCIES \"${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${CONFIGURATION}_LIB_DEPENDENCIES}${_list_sep}${static_depends}\")
++ endif()
++ endmacro()
++
++ macro(_process_plugin_prl_file PRL_FILE_LOCATION CONFIGURATION LIB_DIRECTORY LIB_LOCATION)
++ # First add the (static) plugin itself ...
++ if (_Qt5$${CMAKE_MODULE_NAME}_STATIC_${CONFIGURATION}_LIB_DEPENDENCIES)
++ set(_list_sep \";\")
++ endif()
++ set(_Qt5$${CMAKE_MODULE_NAME}_STATIC_${CONFIGURATION}_LIB_DEPENDENCIES \"${_Qt5$${CMAKE_MODULE_NAME}_STATIC_${CONFIGURATION}_LIB_DEPENDENCIES}${_list_sep}${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/${LIB_DIRECTORY}/${LIB_LOCATION}\")
++ # .. then its dependencies.
++ _process_prl_file(${PRL_FILE_LOCATION} ${CONFIGURATION})
++ endmacro()
++
++!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
++ _process_prl_file(\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_DEBUG}\" DEBUG)
+ !!ELSE
++ _process_prl_file(\"$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_DEBUG}\" DEBUG)
++!!ENDIF
++!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
++ _process_prl_file(\"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_RELEASE}\" RELEASE)
++!!ELSE
++ _process_prl_file(\"$${CMAKE_LIB_DIR}$${CMAKE_PRL_FILE_LOCATION_RELEASE}\" RELEASE)
++!!ENDIF
++
++!!ELSE // !isEmpty(CMAKE_STATIC_TYPE)
+ !!IF equals(TEMPLATE, aux)
+ add_library(Qt5::$${CMAKE_MODULE_NAME} INTERFACE IMPORTED)
+ !!ELSE
+ add_library(Qt5::$${CMAKE_MODULE_NAME} SHARED IMPORTED)
+ !!ENDIF
+-!!ENDIF
++!!ENDIF // !isEmpty(CMAKE_STATIC_TYPE)
++
+ !!IF !equals(TEMPLATE, aux)
+ !!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
+ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY FRAMEWORK 1)
+@@ -245,6 +297,56 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY
+ INTERFACE_COMPILE_DEFINITIONS $${MODULE_DEFINE})
+
++ # Find plugin targets
++ file(GLOB pluginTargetsMaybe \"${CMAKE_CURRENT_LIST_DIR}/*Qt5$${CMAKE_MODULE_NAME}_*.cmake\")
++ unset(pluginTargets)
++ if(pluginTargetsMaybe)
++ foreach(pluginTarget ${pluginTargetsMaybe})
++ file(STRINGS ${pluginTarget} matched REGEX Qt5$${CMAKE_MODULE_NAME}_PLUGINS)
++ if(matched)
++ list(APPEND pluginTargets ${pluginTarget})
++ endif()
++ endforeach()
++ endif()
++
++ macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties TARGET_NAME PLUGIN_TARGET_NAME PLUGIN_NAME CONFIG PLUGIN_LOCATION)
++ set_property(TARGET ${PLUGIN_TARGET_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${CONFIG})
++
++!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
++ set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++!!ELSE
++ set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++!!ENDIF
++ _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
++ set_target_properties(${PLUGIN_TARGET_NAME} PROPERTIES
++ \"IMPORTED_LOCATION_${CONFIG}\" ${imported_location}
++ )
++!!IF !isEmpty(CMAKE_STATIC_TYPE)
++ set_property(TARGET ${TARGET_NAME} APPEND PROPERTY STATIC_PLUGINS ${PLUGIN_NAME})
++ get_filename_component(_PLUGIN_DIR ${PLUGIN_LOCATION} PATH)
++ get_filename_component(_PLUGIN_DIR_NAME ${_PLUGIN_DIR} NAME)
++ get_filename_component(_PLUGIN_NAME ${PLUGIN_LOCATION} NAME)
++ string(REGEX REPLACE \"^lib(.*)\\\\.a\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/lib/qt/plugins/${_PLUGIN_DIR_NAME}/\\\\1.prl\" PLUGIN_PRL_FILE_LOCATION ${_PLUGIN_NAME})
++ if(NOT EXISTS ${PLUGIN_PRL_FILE_LOCATION})
++ string(REGEX REPLACE \"^lib(.*)\\\\.a\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/lib/qt/plugins/${_PLUGIN_DIR_NAME}/\\\\1.static.prl\" PLUGIN_PRL_FILE_LOCATION ${_PLUGIN_NAME})
++ endif()
++ if(NOT EXISTS ${PLUGIN_PRL_FILE_LOCATION})
++ string(REGEX REPLACE \"^lib(.*)\\\\.a\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/lib/qt/plugins/${_PLUGIN_DIR_NAME}/lib\\\\1.prl\" PLUGIN_PRL_FILE_LOCATION ${_PLUGIN_NAME})
++ endif()
++ if(NOT EXISTS ${PLUGIN_PRL_FILE_LOCATION})
++ message(FATAL_ERROR "The prl file containing dependencies of static plugin ${PLUGIN_TARGET_NAME} of ${TARGET_NAME} could not be found.")
++ endif()
++ _process_plugin_prl_file(${PLUGIN_PRL_FILE_LOCATION} ${CONFIG} \"lib/qt/plugins\" ${PLUGIN_LOCATION})
++!!ENDIF
++
++ endmacro()
++
++ if(pluginTargets)
++ foreach(pluginTarget ${pluginTargets})
++ include(${pluginTarget})
++ endforeach()
++ endif()
++
+ set(_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIRS_EXIST TRUE)
+ foreach (_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIR ${Qt5$${CMAKE_MODULE_NAME}_OWN_PRIVATE_INCLUDE_DIRS})
+ if (NOT EXISTS ${_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIR})
+@@ -336,9 +438,11 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ !!ELSE
+ \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ENDIF
+- _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
++ _populate_$${CMAKE_MODULE_NAME}_target_properties(Qt5::$${CMAKE_MODULE_NAME} RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ endif()
++!!ENDIF // CMAKE_STATIC_TYPE
++
++
+ !!ENDIF // CMAKE_RELEASE_TYPE
+ !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
+
+@@ -349,29 +453,6 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ )
+ !!ENDIF // TEMPLATE != aux
+
+- file(GLOB pluginTargets \"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}_*Plugin.cmake\")
+-
+- macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+- set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+-
+-!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
+- set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ELSE
+- set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ENDIF
+- _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+- set_target_properties(Qt5::${Plugin} PROPERTIES
+- \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+- )
+- endmacro()
+-
+- if (pluginTargets)
+- foreach(pluginTarget ${pluginTargets})
+- include(${pluginTarget})
+- endforeach()
+- endif()
+-
+-
+ !!IF !isEmpty(CMAKE_MODULE_EXTRAS)
+ include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5$${CMAKE_MODULE_NAME}ConfigExtras.cmake\")
+ !!ENDIF
+diff --git a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+index 5baf0fdb10..ec5f3cc437 100644
+--- a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+@@ -1,11 +1,14 @@
+-
+-add_library(Qt5::$$CMAKE_PLUGIN_NAME MODULE IMPORTED)
++# Some Qt modules also load plugin target in extra config, so check whether the target already exists
++if(NOT TARGET Qt5::$$CMAKE_PLUGIN_NAME)
++ add_library(Qt5::$$CMAKE_PLUGIN_NAME MODULE IMPORTED)
+
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
++ _populate_$${CMAKE_MODULE_NAME}_plugin_properties(Qt5::$$CMAKE_MODULE_NAME Qt5::$$CMAKE_PLUGIN_NAME $$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
+ !!ENDIF
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
++ _populate_$${CMAKE_MODULE_NAME}_plugin_properties(Qt5::$$CMAKE_MODULE_NAME Qt5::$$CMAKE_PLUGIN_NAME $$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
+ !!ENDIF
+
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
++
++endif()
+diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
+index 56f0a3b703..40af76cc84 100644
+--- a/qmake/generators/makefile.cpp
++++ b/qmake/generators/makefile.cpp
+@@ -998,6 +998,13 @@ MakefileGenerator::writePrlFile(QTextStream &t)
+ for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it)
+ t << qv(project->values((*it).toKey()));
+ t << endl;
++ t << "QMAKE_PRL_LIBS_FOR_CMAKE = ";
++ QString sep;
++ for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it) {
++ t << sep << project->values((*it).toKey()).join(';').replace('\\', "\\\\");
++ sep = ';';
++ }
++ t << endl;
+ }
+ }
+
+--
+2.13.4
+
diff --git a/0007-Fix-finding-gl.h-when-cross-compiling-with-osxcross.patch b/0007-Fix-finding-gl.h-when-cross-compiling-with-osxcross.patch
new file mode 100644
index 000000000000..66b077eee741
--- /dev/null
+++ b/0007-Fix-finding-gl.h-when-cross-compiling-with-osxcross.patch
@@ -0,0 +1,41 @@
+From b9322fe12b92b92853659e43061bce5198a602e2 Mon Sep 17 00:00:00 2001
+From: Martchus <martchus@gmx.net>
+Date: Thu, 3 Aug 2017 11:13:15 +0200
+Subject: [PATCH 7/8] Fix finding gl.h when cross compiling with osxcross
+
+* Make sure find_path ignores the CMAKE_FIND_ROOT_PATH
+ because paths are "sysrootified" in sdk.prf anyways
+* Add directory of gl.h in "MacOSX10.11.sdk" to search
+ paths
+---
+ mkspecs/common/mac.conf | 1 +
+ src/gui/Qt5GuiConfigExtras.cmake.in | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
+index b237530775..6f3b1b2d37 100644
+--- a/mkspecs/common/mac.conf
++++ b/mkspecs/common/mac.conf
+@@ -18,6 +18,7 @@ QMAKE_LIBDIR =
+
+ # sdk.prf will prefix the proper SDK sysroot
+ QMAKE_INCDIR_OPENGL = \
++ /System/Library/Frameworks/OpenGL.framework/Versions/A \
+ /System/Library/Frameworks/OpenGL.framework/Headers \
+ /System/Library/Frameworks/AGL.framework/Headers/
+
+diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
+index 07869efd7d..8c3afe4b51 100644
+--- a/src/gui/Qt5GuiConfigExtras.cmake.in
++++ b/src/gui/Qt5GuiConfigExtras.cmake.in
+@@ -57,6 +57,7 @@ set(Qt5Gui_OPENGL_LIBRARIES Qt5::Gui_GLESv2)
+ set(_GL_INCDIRS $$CMAKE_GL_INCDIRS)
+ find_path(_qt5gui_OPENGL_INCLUDE_DIR $$CMAKE_GL_HEADER_NAME
+ PATHS ${_GL_INCDIRS}
++ NO_CMAKE_FIND_ROOT_PATH
+ )
+ if (NOT _qt5gui_OPENGL_INCLUDE_DIR)
+ message(FATAL_ERROR \"Failed to find \\\"$$CMAKE_GL_HEADER_NAME\\\" in \\\"${_GL_INCDIRS}\\\".\")
+--
+2.13.4
+
diff --git a/0008-Prevent-error-when-qmlimportscanner-not-available.patch b/0008-Prevent-error-when-qmlimportscanner-not-available.patch
new file mode 100644
index 000000000000..0f82bbab1a94
--- /dev/null
+++ b/0008-Prevent-error-when-qmlimportscanner-not-available.patch
@@ -0,0 +1,35 @@
+From 3381229855389d88f3599a4e1f1a42ac0f1b86e5 Mon Sep 17 00:00:00 2001
+From: Martchus <martchus@gmx.net>
+Date: Sun, 6 Aug 2017 20:14:11 +0200
+Subject: [PATCH 8/8] Prevent error when qmlimportscanner not available
+
+When using `make qmake_all` the qmlimportscanner is not
+built when creating Makefiles for targets depending on
+QML so the error must be ignored.
+
+BTW: Using `make qmake_all` is required to fix Makefiles
+using sed because qmake fails to set library search paths
+for host standard library correctly.
+
+Not sure why this error does not occur when cross
+compiling static Qt for Windows.
+---
+ mkspecs/features/qt.prf | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf
+index 3ccbbe7061..c547c89910 100644
+--- a/mkspecs/features/qt.prf
++++ b/mkspecs/features/qt.prf
+@@ -305,7 +305,7 @@ contains(all_qt_module_deps, qml): \
+ #message(run $$QMLIMPORTSCANNER $$_PRO_FILE_PWD_ $$IMPORTPATHS)
+ JSON = $$system($$QMLIMPORTSCANNER $$system_quote($$_PRO_FILE_PWD_) $$IMPORTPATHS)
+
+- parseJson(JSON, IMPORTS)| error("Failed to parse qmlimportscanner output.")
++ parseJson(JSON, IMPORTS)#| error("Failed to parse qmlimportscanner output.")
+
+ !isEmpty(IMPORTS._KEYS_) {
+ # add import plugins to LIBS line
+--
+2.13.4
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..d4efb4f78ae6
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,200 @@
+# Maintainer: Martchus <martchus@gmx.net>
+# All my PKGBUILDs are managed at https://github.com/Martchus/PKGBUILDs where
+# you also find the URL of a binary repository.
+
+# All patches are managed at https://github.com/Martchus/qtbase
+
+pkgname=apple-darwin-qt5-base
+pkgver=5.9.1
+pkgrel=1
+pkgdesc='A cross-platform application and UI framework (apple-darwin)'
+arch=('i686' 'x86_64')
+url='https://www.qt.io/'
+license=('GPL3' 'LGPL3' 'FDL' 'custom')
+depends=('apple-darwin-osxcross')
+groups=('apple-darwin-qt5')
+optdepends=()
+makedepends=('clang')
+options=('!strip' '!buildflags' 'staticlibs' '!emptydirs')
+_pkgfqn="qtbase-opensource-src-${pkgver}"
+source=("https://download.qt.io/official_releases/qt/${pkgver:0:3}/${pkgver}/submodules/${_pkgfqn}.tar.xz"
+ '0001-Enable-cross-compilation-with-osxcross.patch'
+ '0002-Allow-overriding-stdlib-under-MacOS.patch'
+ '0003-Remove-error-handling-for-Xcode-detection.patch'
+ '0004-Fix-build-errors-under-32-bit-MacOS.patch'
+ '0005-Prevent-debug-library-names-in-pkg-config-files.patch'
+ '0006-Pull-dependencies-of-static-libraries-in-CMake-modul.patch'
+ '0007-Fix-finding-gl.h-when-cross-compiling-with-osxcross.patch'
+ '0008-Prevent-error-when-qmlimportscanner-not-available.patch')
+sha256sums=('bc9a21e9f6fff9629019fdf9f989f064751d5073c3a28dc596def92f4d4275c6'
+ 'f5b474fc11f929c8e1563136c6b53d09c9e405ebf5a7940a63dc13f00d3e2bbd'
+ 'a51749efb16b81f5e272a0864a6e2583942998bca1fe397c0e4205b269c97ae4'
+ '73d314dad7a93073140ee9d868e1071a107b1afdecc67cb67d85a91391452a82'
+ '96db51e0cac5ee455931f404fd72ff13b1bab6174034f0dd9460d43d94e970f0'
+ 'b665c7ee5b4bf603dd7a224d5d72d2fb669d9c7ec40b47cebe3ab3392c523b36'
+ '571acd36daf587c44af728e0d63531ceb44e987b572c37bf98a379af13a77b84'
+ 'f0e75b20c059af982091093a3e7f13e9099e6568210bf753c3cc84fa9181a4f1'
+ '56b75af151978d8a25c658a6accded13d3ddc16b21a3524abb08e40a52cbe113')
+_osxcrossprefix='/opt/osxcross'
+
+# Disable 32-bit build ...
+#_architectures='x86_64-apple-darwin15 i386-apple-darwin15'
+_architectures='x86_64-apple-darwin15'
+
+# ... because it fails to compile "src/plugins/platforms/cocoa/qcocoahelpers.mm":
+# /opt/osxcross/bin/i386-apple-darwin15-clang++ -c -pipe -D__STRICT_ANSI__ -foc-use-gcc-libstdc++ -g -Og -fPIC -std=c++1y -arch i386 -isysroot /opt/osxcross/bin/../SDK/MacOSX10.11.sdk -mmacosx-version-min=10.5 -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -fPIC -DNS_BUILD_32_LIKE_64 -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_STATICPLUGIN -DQT_PLUGIN -DQT_ACCESSIBILITY_SUPPORT_LIB -DQT_THEME_SUPPORT_LIB -DQT_FONTDATABASE_SUPPORT_LIB -DQT_GRAPHICS_SUPPORT_LIB -DQT_CLIPBOARD_SUPPORT_LIB -DQT_CGL_SUPPORT_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/src/plugins/platforms/cocoa -I. -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtAccessibilitySupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtAccessibilitySupport/5.9.1 -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtAccessibilitySupport/5.9.1/QtAccessibilitySupport -I../../../../include -I../../../../include/QtAccessibilitySupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtThemeSupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtThemeSupport/5.9.1 -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtThemeSupport/5.9.1/QtThemeSupport -I../../../../include/QtThemeSupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtFontDatabaseSupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtFontDatabaseSupport/5.9.1 -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtFontDatabaseSupport/5.9.1/QtFontDatabaseSupport -I../../../../include/QtFontDatabaseSupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtGraphicsSupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtGraphicsSupport/5.9.1 -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtGraphicsSupport/5.9.1/QtGraphicsSupport -I../../../../include/QtGraphicsSupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtPrintSupport/5.9.1 -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtPrintSupport/5.9.1/QtPrintSupport -I../../../../include/QtPrintSupport/5.9.1 -I../../../../include/QtPrintSupport/5.9.1/QtPrintSupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtWidgets/5.9.1 -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtWidgets/5.9.1/QtWidgets -I../../../../include/QtWidgets/5.9.1 -I../../../../include/QtWidgets/5.9.1/QtWidgets -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtGui/5.9.1 -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtGui/5.9.1/QtGui -I../../../../include/QtGui/5.9.1 -I../../../../include/QtGui/5.9.1/QtGui -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtClipboardSupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtClipboardSupport/5.9.1 -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtClipboardSupport/5.9.1/QtClipboardSupport -I../../../../include/QtClipboardSupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtCglSupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtCglSupport/5.9.1 -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtCglSupport/5.9.1/QtCglSupport -I../../../../include/QtCglSupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtPrintSupport -I../../../../include/QtPrintSupport -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtWidgets -I../../../../include/QtWidgets -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtGui -I../../../../include/QtGui -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtCore/5.9.1 -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtCore/5.9.1/QtCore -I../../../../include/QtCore/5.9.1 -I../../../../include/QtCore/5.9.1/QtCore -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/include/QtCore -I../../../../include/QtCore -I.moc/debug -I/opt/osxcross/SDK/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/opt/osxcross/SDK/MacOSX10.11.sdk/System/Library/Frameworks/AGL.framework/Headers -I/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/mkspecs/macx-clang -o .obj/debug/qcocoahelpers.o /build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/src/plugins/platforms/cocoa/qcocoahelpers.mm
+# /build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/src/plugins/platforms/cocoa/qcocoahelpers.mm:312:9: error: use of undeclared identifier
+# '_okButton'
+# _okButton.target = panelDelegate;
+# ^
+#/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/src/plugins/platforms/cocoa/qcocoahelpers.mm:314:9: error: use of undeclared identifier
+# '_cancelButton'
+# _cancelButton = [self createButtonWithTitle:"Cancel"];
+# ^
+#/build/apple-darwin-qt5-base/src/qtbase-opensource-src-5.9.1/src/plugins/platforms/cocoa/qcocoahelpers.mm:315:9: error: use of undeclared identifier
+# '_cancelButton'; did you mean 'NSCancelButton'?
+# _cancelButton.action = @selector(onCancelClicked);
+# ^~~~~~~~~~~~~
+# NSCancelButton
+
+patch() {
+ local input_found=
+ local patch_file=
+ for arg in $@; do
+ if [[ $input_found ]]; then
+ patch_file="$arg"
+ break
+ fi
+ [[ $arg == -i ]] && input_found=1
+ done
+ msg2 "Applying patch $patch_file"
+ /usr/bin/patch $@
+}
+
+prepare() {
+ cd "${srcdir}/${_pkgfqn}"
+
+ # Apply patches; further descriptions can be found in patch files itself
+ for patch in "$srcdir/"*.patch; do
+ patch -p1 -i "$patch"
+ done
+
+ # Some Xcode tools for SDK detection are not available under osxcross (at least I don't know where to get them)
+ # Hence the SDK info must be provided manually
+ msg2 "Setting SDK info"
+ sed -i '1s;^;QMAKE_MAC_SDK.macosx.Path = '"$(${_osxcrossprefix}/bin/xcrun --sdk macosx --show-sdk-path)"'\
+QMAKE_MAC_SDK.macosx.SDKVersion = '"$(${_osxcrossprefix}/bin/xcrun --sdk macosx --show-sdk-version)"'\
+QMAKE_MAC_SDK.macosx.PlatformPath = '"${_osxcrossprefix}"'\n;' 'mkspecs/features/mac/sdk.prf'
+}
+
+init_osxcross() {
+ # add osxcross toolchain to path
+ export PATH="${_osxcrossprefix}/bin:$PATH"
+ # enable use of ccache (if installed)
+ [[ -f /usr/bin/ccache ]] && \
+ export PATH="${_osxcrossprefix}/lib/ccache/bin:$PATH"
+}
+
+build() {
+ cd "${srcdir}/${_pkgfqn}"
+
+ # Do not set any flags here, flags are configured via mkspec
+ # Setting flags here is not appropriate as it does not allow to
+ # distinguish between flags for native compiler and cross compiler
+ unset CFLAGS
+ unset CXXFLAGS
+ unset LDFLAGS
+ unset PKG_CONFIG_PATH
+
+ init_osxcross
+
+ for _arch in ${_architectures}; do
+ # To prevent conflicts with the mingw-w64-qt4 package we have
+ # to put tools in a dedicated folder
+
+ # The last device option allows using ccache though the use of
+ # pre-compile header
+ # (sloppiness must be set to pch_defines,time_macros in ccache config)
+
+ # For simplicity, this package only includes a static build so far
+ # (no 2 variants like mingw-w64-qt5-base/mingw-w64-qt5-base-static available)
+
+ # It uses the native MacOS API ("-securetransport") rather than OpenSSL
+
+ # MySQL and PostgreSQL are disabled, because needed packages are not available
+ # yet, for the same reason bundled freetype2 and harfbuzz are used
+
+ local qt_configure_args="\
+ -static \
+ -xplatform macx-clang \
+ -securetransport \
+ -optimized-qmake \
+ -verbose \
+ -opensource \
+ -confirm-license \
+ -force-debug-info \
+ -sql-sqlite \
+ -no-glib \
+ -no-icu \
+ -nomake examples \
+ -make tools \
+ -hostprefix ${_osxcrossprefix}/${_arch} \
+ -hostdatadir ${_osxcrossprefix}/${_arch}/lib/qt \
+ -hostbindir ${_osxcrossprefix}/${_arch}/lib/qt/bin \
+ -prefix ${_osxcrossprefix}/${_arch} \
+ -bindir ${_osxcrossprefix}/${_arch}/bin \
+ -archdatadir ${_osxcrossprefix}/${_arch}/lib/qt \
+ -datadir ${_osxcrossprefix}/${_arch}/share/qt \
+ -docdir ${_osxcrossprefix}/${_arch}/share/doc/qt \
+ -examplesdir ${_osxcrossprefix}/${_arch}/share/qt/examples \
+ -headerdir ${_osxcrossprefix}/${_arch}/include/qt \
+ -libdir ${_osxcrossprefix}/${_arch}/lib \
+ -plugindir ${_osxcrossprefix}/${_arch}/lib/qt/plugins \
+ -sysconfdir ${_osxcrossprefix}/${_arch}/etc \
+ -translationdir ${_osxcrossprefix}/${_arch}/share/qt/translations \
+ QMAKE_APPLE_DEVICE_ARCHS=${_arch%%-*} \
+ QMAKE_MACOSX_DEPLOYMENT_TARGET=10.5 \
+ -device-option CROSS_COMPILE=${_arch}- \
+ -device-option QMAKE_MACOSX_STDLIB=libstdc++ \
+ -device-option CROSS_COMPILE_CFLAGS=-fpch-preprocess"
+
+ # Disable debug build (unless APPLE_DARWIN_QT_DEBUG_BUILD is defined)
+ [[ $APPLE_DARWIN_QT_DEBUG_BUILD ]] \
+ && qt_configure_args+=' -debug_and_release' \
+ || qt_configure_args+=' -release'
+
+ mkdir -p ../build-${_arch} && pushd ../build-${_arch}
+ ../${_pkgfqn}/configure $qt_configure_args
+ make
+ popd
+ done
+}
+
+package() {
+ init_osxcross
+
+ for _arch in ${_architectures}; do
+ cd "$srcdir/${_pkgfqn}"
+ make install -C ../build-${_arch} INSTALL_ROOT="${pkgdir}"
+
+ # Create symlinks for tools
+ mkdir -p "${pkgdir}/${_osxcrossprefix}/bin"
+ for tool in qmake moc rcc uic qdbuscpp2xml qdbusxml2cpp qdoc syncqt.pl; do
+ ln -s "../${_arch}/lib/qt/bin/${tool}" "${pkgdir}/${_osxcrossprefix}/bin/${_arch}-${tool}-qt5"
+ done
+
+ # Remove doc
+ rm -rf "${pkgdir}/${_osxcrossprefix}/${_arch}/share"
+
+ # Strip the binaries, remove debug libraries
+ strip --strip-all "${pkgdir}/${_osxcrossprefix}/${_arch}/lib/qt/bin/"*[!.pl]
+ strip -g "${pkgdir}/${_osxcrossprefix}/${_arch}/lib/libQt5Bootstrap.a"
+ # TODO: Still not sure which kind of binaries (shared/static lib, application) should be stripped how
+ find "${pkgdir}/${_osxcrossprefix}" -name "*.dylib" -a -not -iname '*_debug*' -exec ${_osxcrossprefix}/bin/${_arch}-strip -S -x {} \;
+ find "${pkgdir}/${_osxcrossprefix}" -name '*.a' -a -not -iname '*_debug.a' -a -not -iname '*DevTools.a' -a -not -iname '*Bootstrap.a' -exec ${_osxcrossprefix}/bin/${_arch}-strip -S -x {} \;
+ [[ $APPLE_DARWIN_QT_DEBUG_BUILD ]] || find "${pkgdir}/${_osxcrossprefix}" -iname '*_debug*' -exec rm {} \;
+ done
+
+ # Drop QMAKE_PRL_BUILD_DIR because reference the build dir
+ find "$pkgdir/${_osxcrossprefix}" -type f -name '*.prl' -exec sed -i -e '/^QMAKE_PRL_BUILD_DIR/d' {} \;
+}