kdePackages.extra-cmake-modules: hack search paths into ECMFindQtModule

This commit is contained in:
K900
2026-03-14 10:33:46 +03:00
parent add63bd0f4
commit beb319d36d
3 changed files with 22 additions and 0 deletions
@@ -7,6 +7,10 @@ mkKdeDerivation {
outputs = [ "out" ];
patches = [
./search-qml.patch
];
# Packages that have an Android APK (e.g. KWeather) require Python3 at build time.
# See: https://invent.kde.org/frameworks/extra-cmake-modules/-/blob/v6.1.0/modules/ECMAddAndroidApk.cmake?ref_type=tags#L57
propagatedNativeBuildInputs = [
@@ -5,6 +5,9 @@
ecmEnvHook() {
addToSearchPath XDG_DATA_DIRS "$1/share"
addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg"
if [ -n "${qtQmlPrefix-}" ]; then
addToSearchPath NIXPKGS_QML_SEARCH_PATHS "$1/$qtQmlPrefix"
fi
}
addEnvHooks "$hostOffset" ecmEnvHook
@@ -0,0 +1,15 @@
diff --git a/modules/ECMFindQmlModule.cmake.in b/modules/ECMFindQmlModule.cmake.in
index 7db160c1..03fa6916 100644
--- a/modules/ECMFindQmlModule.cmake.in
+++ b/modules/ECMFindQmlModule.cmake.in
@@ -15,8 +15,8 @@ if (QT_MAJOR_VERSION EQUAL "6")
include(${ECM_MODULE_DIR}/ECMQmlModule.cmake)
# Get the qmldir file
_ecm_qmlmodule_uri_to_path(MODULEDIR "@MODULE_NAME@" "@VERSION@")
- set(KDE_QMLDIR "${KDE_INSTALL_FULL_QMLDIR}/${MODULEDIR}")
- find_file(QMLDIR_FILE qmldir ${KDE_QMLDIR} NO_CACHE)
+ find_file(QMLDIR_FILE qmldir PATHS ENV NIXPKGS_QML_SEARCH_PATHS PATH_SUFFIXES ${MODULEDIR} NO_CACHE NO_DEFAULT_PATHS)
+ cmake_path(GET QMLDIR_FILE PARENT_PATH KDE_QMLDIR)
if (NOT QMLDIR_FILE) # Check the install destination, the QT_PLUGIN_PATH might not be set up correctly at this point
# Check the Qt installation
ecm_query_qt(qt_qml_dir QT_INSTALL_QML)