diff --git a/local/recipes/qt/qtdeclarative/recipe.toml b/local/recipes/qt/qtdeclarative/recipe.toml index bba5534b1c..15a740d878 100644 --- a/local/recipes/qt/qtdeclarative/recipe.toml +++ b/local/recipes/qt/qtdeclarative/recipe.toml @@ -22,7 +22,7 @@ HOST_BUILD="${COOKBOOK_ROOT}/build/qt-host-build" DECL_HOST="${COOKBOOK_ROOT}/build/qt-declarative-host" HOST_QTSVG_BUILD="${COOKBOOK_ROOT}/build/qtsvg-host-build" source "${COOKBOOK_ROOT}/local/scripts/lib/qt-sysroot.sh" -source "${COOKBOOK_ROOT}/local/scripts/lib/qt-sysroot.sh" +redbear_qt_ensure_dep_sysroots "${COOKBOOK_ROOT}" "${COOKBOOK_SYSROOT}" # ============================================================ # Step 0: Build host qtsvg into the shared host prefix. diff --git a/local/scripts/lib/qt-sysroot.sh b/local/scripts/lib/qt-sysroot.sh index 5c31aa064d..c92cca4a9b 100644 --- a/local/scripts/lib/qt-sysroot.sh +++ b/local/scripts/lib/qt-sysroot.sh @@ -146,23 +146,26 @@ redbear_qt_ensure_dep_sysroots() { local cmake_dir="${sysroot}/usr/lib/cmake" [ -d "${cmake_dir}" ] || cmake_dir="${sysroot}/lib/cmake" [ -d "${cmake_dir}" ] || return 0 + # Qt cmake macros record absolute sysroot paths during build. When the + # cookbook rebuilds a later recipe, the earlier recipe's sysroot may have + # been cleaned, leaving dangling references. We recreate each missing + # directory as a symlink to the dependency's own stage. grep -roh "${cookbook_root}/local/recipes/[^ \";]*target/x86_64-unknown-redox/sysroot" "${cmake_dir}" 2>/dev/null | sort -u | while read -r dep_sysroot; do - local dep_include="${dep_sysroot}/include/QtQml" - if [ ! -d "${dep_include}" ]; then - if [ -L "${dep_sysroot}/include" ] || [ -e "${dep_sysroot}/include" ]; then - rm -rf "${dep_sysroot}/include" + local dep_target_dir dep_stage_usr + dep_target_dir=$(dirname "${dep_sysroot}") + dep_stage_usr="${dep_target_dir}/stage/usr" + [ -d "${dep_stage_usr}" ] || continue + for qt_dir in include lib metatypes plugins mkspecs modules qml; do + if [ -d "${dep_sysroot}/${qt_dir}" ] && [ ! -L "${dep_sysroot}/${qt_dir}" ]; then + continue fi - if [ -L "${dep_sysroot}/lib" ] || [ -e "${dep_sysroot}/lib" ]; then - rm -rf "${dep_sysroot}/lib" + if [ -L "${dep_sysroot}/${qt_dir}" ] || [ -e "${dep_sysroot}/${qt_dir}" ]; then + rm -f "${dep_sysroot}/${qt_dir}" fi - local dep_target_dir dep_stage_usr - dep_target_dir=$(dirname "${dep_sysroot}") - dep_stage_usr="${dep_target_dir}/stage/usr" - if [ -d "${dep_stage_usr}/include" ]; then + if [ -d "${dep_stage_usr}/${qt_dir}" ]; then mkdir -p "${dep_sysroot}" - ln -sf "${dep_stage_usr}/include" "${dep_sysroot}/include" - ln -sf "${dep_stage_usr}/lib" "${dep_sysroot}/lib" + ln -sf "${dep_stage_usr}/${qt_dir}" "${dep_sysroot}/${qt_dir}" fi - fi + done done }