diff options
Diffstat (limited to 'var/spack/repos/builtin/packages/qt-base/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/qt-base/package.py | 120 |
1 files changed, 86 insertions, 34 deletions
diff --git a/var/spack/repos/builtin/packages/qt-base/package.py b/var/spack/repos/builtin/packages/qt-base/package.py index e83ccafb22..0f069807e3 100644 --- a/var/spack/repos/builtin/packages/qt-base/package.py +++ b/var/spack/repos/builtin/packages/qt-base/package.py @@ -4,24 +4,96 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os +import re import shutil import sys +import llnl.util.tty as tty + from spack.operating_systems.mac_os import macos_version from spack.package import * MACOS_VERSION = macos_version() if sys.platform == "darwin" else None -class QtBase(CMakePackage): - """Qt Base (Core, Gui, Widgets, Network, ...)""" +class QtPackage(CMakePackage): + """Base package for Qt6 components""" homepage = "https://www.qt.io" - url = "https://github.com/qt/qtbase/archive/refs/tags/v6.3.1.tar.gz" - list_url = "https://github.com/qt/qtbase/tags" + + @staticmethod + def get_url(qualname): + _url = "https://github.com/qt/{}/archive/refs/tags/v6.2.3.tar.gz" + return _url.format(qualname.lower()) + + @staticmethod + def get_list_url(qualname): + _list_url = "https://github.com/qt/{}/tags" + return _list_url.format(qualname.lower()) + + generator = "Ninja" maintainers("wdconinc", "sethrj") + # Default dependencies for all qt-* components + depends_on("cmake@3.16:", type="build") + depends_on("ninja", type="build") + depends_on("pkgconfig", type="build") + depends_on("python", type="build") + + # List of unnecessary directories in src/3rdparty + vendor_deps_to_remove = [] + + @run_after("patch") + def remove_vendor_deps(self, vendor_dir, vendor_deps_to_remove): + """Remove src/3rdparty libraries that are provided by spack""" + vendor_dir = join_path(self.stage.source_path, "src", "3rdparty") + with working_dir(vendor_dir): + for dep in os.listdir(): + if os.path.isdir(dep): + if dep in vendor_deps_to_remove: + shutil.rmtree(dep) + + def cmake_args(self): + # Start with upstream cmake_args + args = super().cmake_args() + + # Qt components typically install cmake config files in a single prefix, + # so we have to point them to the cmake config files of dependencies + qt_prefix_path = [] + re_qt = re.compile("qt-.*") + for dep in self.spec.dependencies(): + if re_qt.match(dep.name): + qt_prefix_path.append(self.spec[dep.name].prefix) + + # Now append all qt-* dependency prefixex into a prefix path + args.append(self.define("QT_ADDITIONAL_PACKAGES_PREFIX_PATH", ":".join(qt_prefix_path))) + + return args + + @run_after("install") + def install_config_summary(self): + """Copy the config.summary into the prefix""" + + # Copy to package-name-prefixed file to avoid clashes in views + with working_dir(self.build_directory): + copy("config.summary", self.name + ".config.summary") + install(self.name + ".config.summary", self.prefix) + + # Warn users that this config summary is only for info purpose, + # and should not be relied upon for downstream parsing. + tty.warn("config.summary in prefix is a temporary feature only") + + +class QtBase(QtPackage): + """Qt Base (Core, Gui, Widgets, Network, ...)""" + + url = QtPackage.get_url(__qualname__) + list_url = QtPackage.get_list_url(__qualname__) + + version("6.4.2", sha256="c138ae734cfcde7a92a7efd97a902e53f3cd2c2f89606dfc482d0756f60cdc23") + version("6.4.1", sha256="0ef6db6b3e1074e03dcae7e689144af66fd51b95a6efe949d40281cc43e6fecf") + version("6.4.0", sha256="fbc462816bf5b87d521e9f69cebe0ce331de2258396e0932fa580283f07fce0c") version("6.3.2", sha256="95b78830a99f417ff34ee784ab78f5eeb7bb12adb16d137c3026434c44a904dd") version("6.3.1", sha256="4393e8cea0c58b1e0e901735fcffad141261576a0fa414ed6309910ac3d49df9") version("6.3.0", sha256="c50dc73f633e6c0f6ee3f51980c698800f1a0cadb423679bcef18e446ac72138") @@ -45,13 +117,6 @@ class QtBase(CMakePackage): variant("opengl", default=False, when="+gui", description="Build with OpenGL support.") variant("widgets", default=True, when="+gui", description="Build with widgets.") - generator = "Ninja" - - depends_on("cmake@3.16:", type="build") - depends_on("ninja", type="build") - depends_on("pkgconfig", type="build") - depends_on("python", type="build") - # Dependencies, then variant- and version-specific dependencies depends_on("double-conversion") depends_on("icu4c") @@ -93,32 +158,19 @@ class QtBase(CMakePackage): for filename in ["CMakeCache.txt", "config.summary"] ] - def patch(self): - vendor_dir = join_path(self.stage.source_path, "src", "3rdparty") - vendor_deps_to_keep = [ - "blake2", - "easing", - "forkfd", - "freebsd", - "icc", - "md4", - "md4c", - "md5", - "rfc6234", - "sha1", - "sha3", - "tinycbor", - "VulkanMemoryAllocator", - ] - with working_dir(vendor_dir): - for dep in os.listdir(): - if os.path.isdir(dep): - if dep not in vendor_deps_to_keep: - shutil.rmtree(dep) + vendor_deps_to_remove = [ + "double-conversion", + "freetype", + "harfbuzz-ng", + "libjpeg", + "libpng", + "libpsl", + ] def cmake_args(self): spec = self.spec - args = [] + + args = super().cmake_args() def define(cmake_var, value): args.append(self.define(cmake_var, value)) |