kde: kf6-syntaxhighlighting — build the host katehighlightingindexer correctly

katehighlightingindexer is a Qt6::Core-only HOST code generator (indexes syntax
.xml -> the highlighting index embedded into the cross-compiled library). The
recipe's host build was broken three ways, all masked by 2>/dev/null:
- it used the redox cross-compiler (redoxer env sets CC/CXX) and linked the host
  libQt6Core (glibc) with the redox linker -> every glibc symbol undefined. Force
  host gcc/g++ and clear the redox toolchain env for the host pass.
- it never put the host Qt on CMAKE_PREFIX_PATH, so Qt6 wasn't found.
- the host Qt has no QtNetwork (the target library's definitiondownloader uses
  it); build the indexer from a source COPY with Network dropped, leaving the
  real source (and the target build) with Network intact.
- KATEHIGHLIGHTINGINDEXER_EXECUTABLE pointed at src/indexer/ but KDE emits the
  binary to bin/. Errors are no longer suppressed so a broken host tool fails
  loudly instead of silently breaking the target's index generation.
This commit is contained in:
2026-08-01 15:44:35 +03:00
parent 0d633739a7
commit 5838dcd36a
@@ -39,21 +39,48 @@ sed -i 's/find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE QUIET OPTIONAL_COMPO
ECM_DIR="${COOKBOOK_SYSROOT}/usr/share/ECM/cmake"
HOST_INDEXER_DIR="${COOKBOOK_RECIPE}/target/host-indexer"
rm -rf "${HOST_INDEXER_DIR}"
mkdir -p "${HOST_INDEXER_DIR}"
# katehighlightingindexer is a Qt6::Core-only HOST code generator: it indexes the
# syntax .xml files into data/index.katesyntax during the target build. Build it
# against the host Qt (QT_HOST_PATH = ${HOST_BUILD}, must be on CMAKE_PREFIX_PATH
# or Qt6 is not found). The host Qt ships only QtCore, not QtNetwork (the TARGET
# library's definitiondownloader uses Network) — so build from a COPY of the
# source with Network dropped from the top-level find and the library link. The
# real source is left untouched, keeping Network for the target build. Errors are
# NOT suppressed: a missing host indexer must fail loudly, not silently break the
# target's "No rule to make ... katehighlightingindexer" link.
HOST_INDEXER_SRC="${HOST_INDEXER_DIR}/src-copy"
cp -a "${COOKBOOK_SOURCE}" "${HOST_INDEXER_SRC}"
sed -i 's/NO_MODULE REQUIRED COMPONENTS Core Network)/NO_MODULE REQUIRED COMPONENTS Core)/' \
"${HOST_INDEXER_SRC}/CMakeLists.txt"
sed -i '/^[[:space:]]*Qt6::Network[[:space:]]*$/d' \
"${HOST_INDEXER_SRC}/src/lib/CMakeLists.txt"
cd "${HOST_INDEXER_DIR}"
# CRITICAL: build with the real HOST compiler, not the redox cross-compiler that
# `redoxer env` injects via CC/CXX/CFLAGS. Otherwise cmake picks
# x86_64-unknown-redox-g++ and links the host libQt6Core (glibc) with the redox
# linker, so every glibc symbol (mmap64, clock_gettime, ...) is undefined. Clear
# the redox toolchain env and force host gcc/g++.
env -u CC -u CXX -u CPP -u CFLAGS -u CXXFLAGS -u CPPFLAGS -u LDFLAGS \
-u AR -u RANLIB -u STRIP -u PKG_CONFIG_SYSROOT_DIR -u PKG_CONFIG_LIBDIR \
cmake "${HOST_INDEXER_SRC}" \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DKF_SKIP_PO_PROCESSING=ON \
-DCMAKE_INSTALL_PREFIX="${HOST_INDEXER_DIR}/install" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-DBUILD_QCH=OFF \
-DKSYNTAXHIGHLIGHTING_USE_GUI=OFF \
-DCMAKE_PREFIX_PATH="${HOST_BUILD}" \
-DECM_DIR="${ECM_DIR}" \
-Wno-dev
cmake "${COOKBOOK_SOURCE}" \
-DKF_SKIP_PO_PROCESSING=ON \
-DCMAKE_INSTALL_PREFIX="${HOST_INDEXER_DIR}/install" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-DBUILD_QCH=OFF \
-DKSYNTAXHIGHLIGHTING_USE_GUI=OFF \
-DECM_DIR="${ECM_DIR}" \
-Wno-dev 2>/dev/null || true
make -j"${COOKBOOK_MAKE_JOBS}" katehighlightingindexer 2>/dev/null || \
make -C src/indexer -j"${COOKBOOK_MAKE_JOBS}" 2>/dev/null || true
env -u CC -u CXX -u CPP -u CFLAGS -u CXXFLAGS -u CPPFLAGS -u LDFLAGS \
make -j"${COOKBOOK_MAKE_JOBS}" katehighlightingindexer
cd "${COOKBOOK_BUILD}"
sed -i 's/find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED COMPONENTS Core Network Test)/find_package(Qt6 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED COMPONENTS Core Network)/' \
@@ -73,7 +100,7 @@ cmake "${COOKBOOK_SOURCE}" \
-DBUILD_TESTING=OFF \
-DBUILD_QCH=OFF \
-DKSYNTAXHIGHLIGHTING_USE_GUI=OFF \
-DKATEHIGHLIGHTINGINDEXER_EXECUTABLE="${HOST_INDEXER_DIR}/src/indexer/katehighlightingindexer" \
-DKATEHIGHLIGHTINGINDEXER_EXECUTABLE="${HOST_INDEXER_DIR}/bin/katehighlightingindexer" \
-Wno-dev
cmake --build . -j${COOKBOOK_MAKE_JOBS}
cmake --install . --prefix "${COOKBOOK_STAGE}/usr"