diff --git a/libs/qt5/qtbase/0001-Allow-additional-QStandardPaths-data-directories-on-.patch b/libs/qt5/qtbase/0001-Allow-additional-QStandardPaths-data-directories-on-.patch new file mode 100644 index 00000000..0057a2ad --- /dev/null +++ b/libs/qt5/qtbase/0001-Allow-additional-QStandardPaths-data-directories-on-.patch @@ -0,0 +1,190 @@ +From b1f9c05e592ca5d04671e09fa0ead195a87831e9 Mon Sep 17 00:00:00 2001 +From: Alex Richardson +Date: Mon, 3 Sep 2018 10:16:48 +0100 +Subject: [PATCH] Allow additional QStandardPaths data directories on macOS + +On macOS QStandardPaths::GenericDataLocation only contains +"~/Library/Application Support" and "/Library/Application Support". +Package managers such as homebrew or KDE craft install into a custom +prefix and do not/cannot write to either of these directories. This makes +it impossible for them to share the generic data between different +applications. The current workaround used e.g. by homebrew-kde is to create +symlinks for every file/directory that is needed in /usr/local/share/ in +the user's "~/Library/Application Support" directory. However, this causes +issues if you forget to create the appropriate link and makes it difficult +for the user to override a data file from the system-wide installation with +a file in the home directory. + +This commit introduces a ./configure option `-additional-datadir`. +This option can be passed multiple times to create a list of additional +directories that QStandardPaths searches before looking in +"/Library/Application Support". + +[ChangeLog][QtCore][QStandardPaths] Added configure option +-additional-datadir to specify additional data directories. + +Change-Id: I23b046fcc9520181286fe300827645cd608b0201 +--- + config_help.txt | 3 +++ + configure.json | 1 + + configure.pri | 21 +++++++++++++++++++ + src/corelib/io/qstandardpaths_mac.mm | 18 ++++++++++++++++ + .../io/qstandardpaths/qstandardpaths.pro | 2 +- + .../io/qstandardpaths/tst_qstandardpaths.cpp | 21 +++++++++++++++++++ + 6 files changed, 65 insertions(+), 1 deletion(-) + +diff --git a/config_help.txt b/config_help.txt +index 5b32eb183f..e7478e1bcf 100644 +--- a/config_help.txt ++++ b/config_help.txt +@@ -119,6 +119,9 @@ Build options: + through an app store by default, in particular Android, + iOS, tvOS, watchOS, and Universal Windows Platform. [auto] + ++ -additional-datadir ... List of directories that QStandardPaths ++ will search before the system locations (macOS only). ++ + -qtnamespace .. Wrap all Qt library code in 'namespace {...}'. + -qtlibinfix .. Rename all libQt5*.so to libQt5*.so. + +diff --git a/configure.json b/configure.json +index 3702c24f63..a6cf561f1b 100644 +--- a/configure.json ++++ b/configure.json +@@ -57,6 +57,7 @@ + "android-sdk": "string", + "android-toolchain-version": "string", + ++ "additional-datadir": { "type": "addString", "name": "additional_datadirs" }, + "android-style-assets": "boolean", + "appstore-compliant": "boolean", + "avx": "boolean", +diff --git a/configure.pri b/configure.pri +index 64ed6b9ed8..f6018afd63 100644 +--- a/configure.pri ++++ b/configure.pri +@@ -754,6 +754,16 @@ defineTest(qtConfOutput_preparePaths) { + have_hostprefix = true + } + ++ !isEmpty(config.input.additional_datadirs) { ++ # Ensure that all the -additional-datadirs entries are absolute paths ++ extradirs = ++ for (dir, config.input.additional_datadirs) { ++ extradirs += $$absolute_path($$dir, $$OUT_PWD) ++ } ++ config.input.additional_datadirs = $$extradirs ++ export(config.input.additional_datadirs) ++ } ++ + PREFIX_COMPLAINTS = + PREFIX_REMINDER = false + win32: \ +@@ -1207,6 +1217,17 @@ defineReplace(qtConfOutputPostProcess_publicHeader) { + return($$output) + } + ++defineReplace(qtConfOutputPostProcess_privateHeader) { ++ output = $$1 ++ # Add support for additional QStandardPaths::GenericDataLocation on macOS (useful for homebrew, etc.) ++ macos:!isEmpty(config.input.additional_datadirs) { ++ extraDataDirsDefine = $$join(config.input.additional_datadirs, \ ++ "\"), QStringLiteral(\"", "{ QStringLiteral(\"", "\") }") ++ output += "$${LITERAL_HASH}define QT_STANDARDPATHS_ADDITIONAL_DATADIRS $$extraDataDirsDefine" ++ } ++ return($$output) ++} ++ + + # custom reporting + +diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm +index 11b5cc8c37..a9b28f2739 100644 +--- a/src/corelib/io/qstandardpaths_mac.mm ++++ b/src/corelib/io/qstandardpaths_mac.mm +@@ -184,6 +184,24 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) + dirs << writableLocation(PicturesLocation) << QLatin1String("assets-library://"); + #endif + ++#if !defined(QT_BOOTSTRAPPED) && defined(Q_OS_MACOS) ++#ifdef QT_STANDARDPATHS_ADDITIONAL_DATADIRS ++ if (type == AppDataLocation || type == AppLocalDataLocation || type == GenericDataLocation) { ++ QStringList extraDataDirs; ++ // Add the value of -additional-datadir configure argument to the list. ++ // This allows e.g. homebrew to use a Qt build that is configured to search ++ // for generic data in /usr/local/share instead of requiring it to be in ++ // /Library/Application Support which is not writable from the homebrew sandbox. ++ extraDataDirs = QStringList(QT_STANDARDPATHS_ADDITIONAL_DATADIRS); ++ if (type == AppDataLocation || type == AppLocalDataLocation) { ++ for (QString &dir : extraDataDirs) ++ appendOrganizationAndApp(dir); ++ } ++ dirs << extraDataDirs; ++ } ++#endif ++#endif ++ + if (type == GenericDataLocation || type == FontsLocation || type == ApplicationsLocation + || type == AppDataLocation || type == AppLocalDataLocation + || type == GenericCacheLocation || type == CacheLocation) { +diff --git a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro +index 9fd7047405..f7367a1612 100644 +--- a/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro ++++ b/tests/auto/corelib/io/qstandardpaths/qstandardpaths.pro +@@ -1,6 +1,6 @@ + CONFIG += testcase + TARGET = tst_qstandardpaths +-QT = core testlib ++QT = core-private testlib + INCLUDEPATH += ../../../../shared/ + HEADERS += ../../../../shared/emulationdetector.h + SOURCES = tst_qstandardpaths.cpp +diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +index 5cb130f631..cbeabf7dae 100644 +--- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp ++++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +@@ -33,6 +33,7 @@ + #include + #include + #include ++#include + #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE) + # include + #endif +@@ -63,6 +64,7 @@ private slots: + void enableTestMode(); + void testLocateAll(); + void testDataLocation(); ++ void testAdditionalDataDirs(); + void testAppConfigLocation(); + void testFindExecutable_data(); + void testFindExecutable(); +@@ -335,6 +337,25 @@ void tst_qstandardpaths::testDataLocation() + QCoreApplication::setApplicationName(QString()); + } + ++void tst_qstandardpaths::testAdditionalDataDirs() ++{ ++ // If Qt was configured with -additional-datadir, QStandardPaths should return those directories ++#if !defined(QT_STANDARDPATHS_ADDITIONAL_DATADIRS) ++ QSKIP("-additional-datadir not passed to configure"); ++#elif !defined(Q_OS_MACOS) ++ QSKIP("-additional-datadir not supported on current platform"); ++#else ++ const QString writable = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); ++ const QStringList genericDirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); ++ QStringList additionalDataDirs(QT_STANDARDPATHS_ADDITIONAL_DATADIRS); ++ QVERIFY2(!additionalDataDirs.empty(), "Define should not be set if the list is empty"); ++ QVERIFY(genericDirs.size() > additionalDataDirs.size() + 1); ++ // The additional datadirs should be added just after the writable location ++ QCOMPARE(genericDirs.at(0), writable); ++ QCOMPARE(genericDirs.mid(1, additionalDataDirs.size()), additionalDataDirs); ++#endif ++} ++ + void tst_qstandardpaths::testAppConfigLocation() + { + // On all platforms where applications are not sandboxed, +-- +2.19.0.windows.1 + diff --git a/libs/qt5/qtbase/qtbase.py b/libs/qt5/qtbase/qtbase.py index c83d1088..93bb4f35 100644 --- a/libs/qt5/qtbase/qtbase.py +++ b/libs/qt5/qtbase/qtbase.py @@ -1,275 +1,285 @@ # -*- coding: utf-8 -*- import info from Package.Qt5CorePackageBase import * class subinfo(info.infoclass): def registerOptions(self): self.options.dynamic.registerOption("buildCommercial", False) self.options.dynamic.registerOption("buildReleaseAndDebug", False) self.options.dynamic.registerOption("buildDoc", True) self.options.dynamic.registerOption("libInfix", "") def setTargets(self): self.versionInfo.setDefaultValues() for ver in self.versionInfo.tarballs() + self.versionInfo.branches() + self.versionInfo.tags(): qtVer = CraftVersion(ver) if ver == "dev": self.patchToApply[ver] = [] + elif qtVer >= CraftVersion("5.12.0"): + self.patchToApply[ver] = [ + ("qdbus-manager-quit-5.7.patch", 1), # https://phabricator.kde.org/D2545#69186 + ("workaround-mingw-egl.diff", 1), + ("fix_GenericDataLocation_mac.patch", 1), + ("0001-Allow-additional-QStandardPaths-data-directories-on-.patch", 1), + ] elif qtVer >= CraftVersion("5.11.1"): self.patchToApply[ver] = [ ("qdbus-manager-quit-5.7.patch", 1), # https://phabricator.kde.org/D2545#69186 ("workaround-mingw-egl.diff", 1), ("fix_GenericDataLocation_mac.patch", 1), ("qstandardpaths-extra-dirs.patch", 1), ] elif qtVer >= CraftVersion("5.11"): self.patchToApply[ver] = [ ("qdbus-manager-quit-5.7.patch", 1), # https://phabricator.kde.org/D2545#69186 ("0001-Fix-private-headers.patch", 1), # https://bugreports.qt.io/browse/QTBUG-37417 ("workaround-mingw-egl.diff", 1), ("fix_GenericDataLocation_mac.patch", 1), ("qstandardpaths-extra-dirs.patch", 1), ] elif qtVer >= CraftVersion("5.10"): self.patchToApply[ver] = [ ("qdbus-manager-quit-5.7.patch", 1), # https://phabricator.kde.org/D2545#69186 ("0001-Fix-private-headers.patch", 1), # https://bugreports.qt.io/browse/QTBUG-37417 ("workaround-mingw-egl.diff", 1), ("fix_AppDataLocation_mac.patch", 1), #https://bugreports.qt.io/browse/QTBUG-61159 ("fix_GenericDataLocation_mac.patch", 1), ("qstandardpaths-extra-dirs.patch", 1), ] elif qtVer >= CraftVersion("5.9.4") or qtVer == CraftVersion("5.9"): self.patchToApply[ver] = [ ("qdbus-manager-quit-5.7.patch", 1), # https://phabricator.kde.org/D2545#69186 ("0001-Fix-private-headers.patch", 1), # https://bugreports.qt.io/browse/QTBUG-37417 ("workaround-mingw-egl-qt5.9.4.diff", 1), ("0001-Add-APPDIR-data-APPNAME-5.9.4.patch", 1), # https://codereview.qt-project.org/#/c/197855/ ] elif qtVer >= CraftVersion("5.9.3"): self.patchToApply[ver] = [ ("qdbus-manager-quit-5.7.patch", 1), # https://phabricator.kde.org/D2545#69186 ("0001-Fix-private-headers.patch", 1), # https://bugreports.qt.io/browse/QTBUG-37417 ("0001-Add-APPDIR-data-APPNAME-to-the-non-Generic-paths-on-.patch", 1)] # https://codereview.qt-project.org/#/c/197855/ elif qtVer >= CraftVersion("5.9"): self.patchToApply[ver] = [ ("fix-angle-mingw.patch", 1), ("qtbase-5.8.patch", 1), # https://codereview.qt-project.org/#/c/149550/ ("qdbus-manager-quit-5.7.patch", 1), # https://phabricator.kde.org/D2545#69186 ("hack-fix-syncqt.patch", 1), ("0001-Fix-private-headers.patch", 1), # https://bugreports.qt.io/browse/QTBUG-37417 ("0001-Add-APPDIR-data-APPNAME-to-the-non-Generic-paths-on-.patch", 1)] # https://codereview.qt-project.org/#/c/197855/ elif qtVer >= CraftVersion("5.8"): self.patchToApply[ver] = [ ("fix-angle-mingw.patch", 1), ("qtbase-5.8.patch", 1), # https://codereview.qt-project.org/#/c/141254/ # https://codereview.qt-project.org/#/c/149550/ ("qdbus-manager-quit-5.7.patch", 1) # https://phabricator.kde.org/D2545#69186 ] elif qtVer >= CraftVersion("5.7"): self.patchToApply[ver] = [ ("fix-angle-mingw.patch", 1), ("qtbase-5.7.patch", 1), # https://codereview.qt-project.org/#/c/141254/ # https://codereview.qt-project.org/#/c/149550/ ("do-not-spawn-console-qprocess-startdetached.patch", 1), # https://codereview.qt-project.org/#/c/162585/ ("qdbus-manager-quit-5.7.patch", 1) # https://phabricator.kde.org/D2545#69186 ] else: self.patchToApply[ver] = [ ("qmake-fix-install-root.patch", 1), ("qtbase-5.6.patch", 1), # https://codereview.qt-project.org/#/c/141254/ # https://codereview.qt-project.org/#/c/149550/ ("do-not-spawn-console-qprocess-startdetached.patch", 1), # https://codereview.qt-project.org/#/c/162585/ ("fix-angle-mingw-5.6.2-20161027.diff", 1), ("qdbus-manager-quit-5.7.patch", 1) # https://phabricator.kde.org/D2545#69186 ] self.patchToApply["5.11.2"] += [ ("0001-Export-qt_open64-from-QtCore.patch", 1), # fix 32 bit unix builds, backport of 4fc4f7b0ce0e6ee186a7d7fe9b5dd20e94efe432 ] self.patchLevel["5.9.4"] = 3 self.patchLevel["5.11.0"] = 2 self.patchLevel["5.11.2"] = 3 self.description = "a cross-platform application framework" def setDependencies(self): if CraftCore.settings.getboolean("Packager", "UseCache") and not CraftCore.settings.getboolean("QtSDK", "Enabled", False): self.buildDependencies["dev-utils/qtbinpatcher"] = None self.runtimeDependencies["virtual/base"] = None self.buildDependencies["dev-utils/perl"] = None self.buildDependencies["dev-utils/flexbison"] = None if not self.options.buildStatic: if CraftVersion(self.buildTarget) < CraftVersion("5.10") or CraftCore.settings.getboolean("QtSDK", "Enabled", False): self.runtimeDependencies["libs/openssl"] = None else: self.runtimeDependencies["libs/openssl"] = "1.1" self.runtimeDependencies["libs/dbus"] = None self.runtimeDependencies["binary/mysql"] = None self.runtimeDependencies["libs/icu"] = None self.runtimeDependencies["libs/zlib"] = None class QtPackage(Qt5CorePackageBase): def __init__(self, **args): Qt5CorePackageBase.__init__(self) def configure(self, unused1=None, unused2=""): with self.getQtBaseEnv(): if CraftCore.compiler.isMinGW() and "DXSDK_DIR" not in os.environ: CraftCore.log.critical("Failed to detec a DirectX SDK") CraftCore.log.critical( "Please visite https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source/Windows#Direct_X_SDK for instructions") return False self.enterBuildDir() if OsUtils.isWin(): configure = OsUtils.toUnixPath(os.path.join(self.sourceDir(), "configure.bat")) if self.qtVer < CraftVersion("5.10"): # not needed anymore as we don't patch configure anymore if not os.path.exists(os.path.join(self.sourceDir(), ".gitignore")): # force bootstrap of configure.exe with open(os.path.join(self.sourceDir(), ".gitignore"), "wt+") as bootstrap: bootstrap.write("Force Bootstrap") if os.path.exists(os.path.join(self.sourceDir(), "configure.exe")): os.remove(os.path.join(self.sourceDir(), "configure.exe")) elif OsUtils.isUnix(): configure = os.path.join(self.sourceDir(), "configure") command = f"{configure} -confirm-license -prefix {CraftStandardDirs.craftRoot()} -platform {self.platform} " command += "-opensource " if not self.subinfo.options.dynamic.buildCommercial else "-commercial " if self.subinfo.options.dynamic.libInfix: command += f"-qtlibinfix {self.subinfo.options.dynamic.libInfix} " - command += "-headerdir %s " % os.path.join(CraftStandardDirs.craftRoot(), "include", "qt5") + command += f"-headerdir {os.path.join(CraftStandardDirs.craftRoot(), 'include', 'qt5')} " + command += f"-libdir {os.path.join(CraftStandardDirs.craftRoot(), 'lib', 'qt5')} " command += "-qt-libpng " command += "-qt-libjpeg " # can we drop that in general? if self.qtVer <= "5.6": command += "-c++11 " if self.qtVer >= "5.8": command += "-mp " else: command += "-qt-pcre " - if OsUtils.isMac() and self.qtVer >= "5.10": - command += f"-macos-additional-datadirs \"{CraftStandardDirs.craftRoot()}/share\" " + if self.qtVer >= "5.12": + command += f"-additional-datadir \"{CraftCore.standardDirs.locations.data}\" " + elif CraftCore.compiler.isMacOS and self.qtVer >= "5.10": + command += f"-macos-additional-datadirs \"{CraftCore.standardDirs.locations.data}\" " if OsUtils.isWin(): command += "-opengl dynamic " command += "-plugin-sql-odbc " # if not (OsUtils.isFreeBSD() or compiler.isMinGW()):#currently breaks unmaintained modules like qtscript and webkit # command += "-ltcg " if self.subinfo.options.dynamic.buildReleaseAndDebug: command += "-debug-and-release " elif self.buildType() == "Debug": command += "-debug " else: command += "-release " if self.buildType() == "RelWithDebInfo": command += "-force-debug-info " if not self.subinfo.options.buildStatic: command += "-I \"%s\" -L \"%s\" " % ( os.path.join(CraftStandardDirs.craftRoot(), "include"), os.path.join(CraftStandardDirs.craftRoot(), "lib")) if self.subinfo.options.isActive("libs/openssl"): command += " -openssl-linked " if self.qtVer >= CraftVersion("5.10"): opensslIncDir = os.path.join(CraftCore.standardDirs.craftRoot(), "include", "openssl") command += f" OPENSSL_INCDIR=\"{opensslIncDir}\"" if CraftCore.compiler.isWindows: command += f" OPENSSL_LIBS=\"-llibssl -llibcrypto\" " else: command += f" OPENSSL_LIBS=\"-lssl -lcrypto\" " if self.subinfo.options.isActive("binary/mysql"): command += " -sql-mysql " if self.subinfo.options.isActive("libs/dbus"): command += " -qdbus -dbus-runtime -I \"%s\" -I \"%s\" " % ( os.path.join(CraftStandardDirs.craftRoot(), "include", "dbus-1.0"), os.path.join(CraftStandardDirs.craftRoot(), "lib", "dbus-1.0", "include")) else: command += " -no-dbus " if self.subinfo.options.isActive("libs/icu"): command += " -icu " else: command += " -no-icu " if self.subinfo.options.isActive("libs/zlib"): command += " -system-zlib " if CraftCore.compiler.isMSVC(): command += " ZLIB_LIBS=zlib.lib " else: command += " -static -static-runtime " command += "-nomake examples " command += "-nomake tests " if (CraftCore.compiler.isMSVC() and CraftCore.compiler.isClang()) or OsUtils.isUnix() or self.supportsCCACHE: command += "-no-pch " if CraftCore.compiler.isLinux: command += """-R "../lib" """ if CraftCore.compiler.isMinGW() and self.qtVer < "5.10": command += """ "QMAKE_CXXFLAGS += -Wa,-mbig-obj" """ return utils.system(command) def make(self): with self.getQtBaseEnv(): return super().make() def install(self): with self.getQtBaseEnv(): if not Qt5CorePackageBase.install(self): return False parser = configparser.ConfigParser() parser.optionxform = str parser.read(os.path.join(self.buildDir(), "bin", "qt.conf")) parser.remove_section("EffectiveSourcePaths") with open(os.path.join(self.imageDir(), "bin", "qt.conf"), "wt") as out: parser.write(out) # install msvc debug files if available if CraftCore.compiler.isMSVC(): srcdir = os.path.join(self.buildDir(), "lib") destdir = os.path.join(self.installDir(), "lib") filelist = os.listdir(srcdir) for file in filelist: if file.endswith(".pdb"): utils.copyFile(os.path.join(srcdir, file), os.path.join(destdir, file)) return True def postInstall(self): if CraftCore.compiler.isWindows and CraftCore.settings.getboolean("Packager", "UseCache"): return utils.system(["qtbinpatcher", "--nobackup", f"--qt-dir={self.installDir()}", f"--new-dir={CraftStandardDirs.craftRoot()}"]) else: return self.patchInstallPrefix([os.path.join(self.installDir(), "bin", "qt.conf")], self.subinfo.buildPrefix, CraftCore.standardDirs.craftRoot()) def getQtBaseEnv(self): envs = {} envs["PATH"] = os.pathsep.join([os.path.join(self.buildDir(), "bin"), os.environ["PATH"]]) if self.qtVer < "5.9": # so that the mkspecs can be found, when -prefix is set envs["QMAKEPATH"] = self.sourceDir() if self.qtVer < "5.8": envs["QMAKESPEC"] = os.path.join(self.sourceDir(), 'mkspecs', self.platform) else: envs["QMAKESPEC"] = None return utils.ScopedEnv(envs) class Package(Qt5CoreSdkPackageBase): def __init__(self): Qt5CoreSdkPackageBase.__init__(self, classA=QtPackage) diff --git a/libs/qt5/version-5.10.ini b/libs/qt5/version-5.10.ini index 8ae611dd..e3d9711c 100644 --- a/libs/qt5/version-5.10.ini +++ b/libs/qt5/version-5.10.ini @@ -1,7 +1,7 @@ [General] -branches = 5.10;5.11 -tarballs = 5.10.0;5.10.1;5.11.0;5.11.1;5.11.2;5.11.3 +branches = 5.10;5.11;5.12 +tarballs = 5.10.0;5.10.1;5.11.0;5.11.1;5.11.2;5.11.3;5.12.0 tarballUrl = https://download.qt.io/official_releases/qt/${VERSION_MAJOR}.${VERSION_MINOR}/${VERSION}/submodules/${PACKAGE_NAME}-everywhere-src-${VERSION}.tar.xz tarballDigestUrl = https://download.qt.io/official_releases/qt/${VERSION_MAJOR}.${VERSION_MINOR}/${VERSION}/submodules/${PACKAGE_NAME}-everywhere-src-${VERSION}.tar.xz.sha256 tarballInstallSrc = ${PACKAGE_NAME}-everywhere-src-${VERSION} gitUrl = https://code.qt.io/qt/${PACKAGE_NAME}.git