qtdeclarative: use external Python script for CMakeLists patch
This commit is contained in:
@@ -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")
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user