diff --git a/local/recipes/qt/qtdeclarative/patch-resource.py b/local/recipes/qt/qtdeclarative/patch-resource.py new file mode 100644 index 0000000000..ae89a1dc13 --- /dev/null +++ b/local/recipes/qt/qtdeclarative/patch-resource.py @@ -0,0 +1,21 @@ +import os +import sys +from pathlib import Path + +source = os.environ.get("COOKBOOK_SOURCE", ".") +path = Path(source) / "src/qmltyperegistrar/CMakeLists.txt" + +if not path.exists(): + print(f"File not found: {path}", file=sys.stderr) + sys.exit(1) + +text = path.read_text() +old = 'qt_internal_add_resource(QmlTypeRegistrarPrivate "jsRootMetaTypes"' +new = 'qt_internal_add_resource(QmlTypeRegistrarPrivate "jsRootMetaTypes"\n OPTIONS\n --no-compress' + +if old in text: + text = text.replace(old, new) + path.write_text(text) + print("Patched qmltyperegistrar/CMakeLists.txt") +else: + print("Pattern not found, may already be patched") diff --git a/local/recipes/qt/qtdeclarative/recipe.toml b/local/recipes/qt/qtdeclarative/recipe.toml index 64fd38b37f..37bfe8e647 100644 --- a/local/recipes/qt/qtdeclarative/recipe.toml +++ b/local/recipes/qt/qtdeclarative/recipe.toml @@ -132,16 +132,7 @@ rm -rf CMakeFiles # Fix: qt_internal_add_resource creates empty targets in cross-compilation # We patch the qmltyperegistrar CMakeLists to add OPTIONS --no-compress -python - <<'PY' -import os -from pathlib import Path -path = Path(os.environ["COOKBOOK_SOURCE"]) / "src/qmltyperegistrar/CMakeLists.txt" -text = path.read_text() -old = 'qt_internal_add_resource(QmlTypeRegistrarPrivate "jsRootMetaTypes"' -new = 'qt_internal_add_resource(QmlTypeRegistrarPrivate "jsRootMetaTypes"\n OPTIONS\n --no-compress' -text = text.replace(old, new) -path.write_text(text) -PY +python "${COOKBOOK_RECIPE}/patch-resource.py" redbear_qt_link_sysroot_dirs "${COOKBOOK_SYSROOT}" plugins mkspecs metatypes modules