fix: make Qt Redox CMake imports relocatable
This commit is contained in:
@@ -39,6 +39,7 @@ rm -f CMakeCache.txt
|
||||
rm -rf CMakeFiles
|
||||
|
||||
cmake "${COOKBOOK_SOURCE}" \
|
||||
-G Ninja \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \
|
||||
-DQT_HOST_PATH="${HOST_BUILD}" \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
@@ -100,6 +101,21 @@ SYSROOT="${COOKBOOK_SYSROOT}"
|
||||
if [ -d "${COOKBOOK_STAGE}/usr/lib/cmake" ]; then
|
||||
find "${COOKBOOK_STAGE}/usr/lib/cmake" -name '*.cmake' -exec sed -i \
|
||||
"s|/usr/include|${SYSROOT}/include|g" {} + 2>/dev/null || true
|
||||
python3 - <<'PY' "${COOKBOOK_STAGE}/usr/lib/cmake" "${SYSROOT}"
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
cmake_dir = Path(sys.argv[1])
|
||||
sysroot = sys.argv[2]
|
||||
for path in cmake_dir.rglob('*.cmake'):
|
||||
text = path.read_text()
|
||||
text = text.replace('${_IMPORT_PREFIX}/lib/', '${PACKAGE_PREFIX_DIR}/lib/')
|
||||
text = text.replace(f'{sysroot}/lib/', '${PACKAGE_PREFIX_DIR}/lib/')
|
||||
text = text.replace(f'{sysroot}/include', '${PACKAGE_PREFIX_DIR}/include')
|
||||
text = text.replace('"/usr/lib/libQt6', '"${PACKAGE_PREFIX_DIR}/lib/libQt6')
|
||||
text = text.replace('"/usr/include', '"${PACKAGE_PREFIX_DIR}/include')
|
||||
path.write_text(text)
|
||||
PY
|
||||
fi
|
||||
if [ -d "${COOKBOOK_STAGE}/usr/include" ]; then
|
||||
mkdir -p "${SYSROOT}/include"
|
||||
|
||||
Reference in New Issue
Block a user