30e36e53ec
- QNetworkReply stub header for Redox cross-build - GuiPrivate + Network in find_package - QElapsedTimer include fix - networkAccessManager null stub in icon.cpp - Primitives target links Qt6::Network for headers
110 lines
4.7 KiB
TOML
110 lines
4.7 KiB
TOML
#TODO: Kirigami — builds the C++ core with QML type registration macros as no-ops.
|
|
# Qt6's cmake generates QML_ATTACHED_OFF_OFF_OFF_OFF_OFF_OFF etc. when QML features are
|
|
# disabled at configure time. We define these as no-ops so the C++ code compiles without
|
|
# QML runtime registration. Full QML/Quick support requires the QML JIT gate resolution.
|
|
[source]
|
|
tar = "https://invent.kde.org/frameworks/kirigami/-/archive/v6.10.0/kirigami-v6.10.0.tar.gz"
|
|
blake3 = "d0964890aa6523f7067510bb7e6c784ba77611952d952bfdd6422a58a23664f6"
|
|
|
|
[build]
|
|
template = "custom"
|
|
dependencies = [
|
|
"qtbase",
|
|
"qtdeclarative",
|
|
"qtsvg",
|
|
"qtshadertools",
|
|
"kf6-extra-cmake-modules",
|
|
]
|
|
script = """
|
|
DYNAMIC_INIT
|
|
|
|
HOST_BUILD="${COOKBOOK_ROOT}/build/qt-host-build"
|
|
|
|
for qtdir in plugins mkspecs metatypes modules; do
|
|
if [ -d "${COOKBOOK_SYSROOT}/usr/${qtdir}" ] && [ ! -e "${COOKBOOK_SYSROOT}/${qtdir}" ]; then
|
|
ln -s "usr/${qtdir}" "${COOKBOOK_SYSROOT}/${qtdir}"
|
|
fi
|
|
done
|
|
|
|
# Create a header that defines QML _OFF macros as no-ops.
|
|
# When Qt6 cmake disables QML features, it rewrites QML_ATTACHED(X) as
|
|
# QML_ATTACHED_OFF_OFF_OFF_OFF_OFF_OFF(X) in the source. These macros
|
|
# are never defined by Qt, causing build failures. We define them as empty
|
|
# so the C++ code compiles while QML type registration is silently skipped.
|
|
cat > "${COOKBOOK_BUILD}/qml_off_noop.h" << 'QMLEOF'
|
|
#ifndef REDBEAR_QML_OFF_NOOP_H
|
|
#define REDBEAR_QML_OFF_NOOP_H
|
|
|
|
#define QML_ELEMENT_OFF_OFF_OFF_OFF_OFF_OFF
|
|
#define QML_NAMED_ELEMENT_OFF_OFF_OFF_OFF_OFF_OFF(NAME)
|
|
#define QML_ATTACHED_OFF_OFF_OFF_OFF_OFF_OFF(ATTACHED_TYPE)
|
|
#define QML_UNCREATABLE_OFF_OFF_OFF_OFF_OFF_OFF(REASON)
|
|
#define QML_SINGLETON_OFF_OFF_OFF_OFF_OFF_OFF
|
|
|
|
#endif
|
|
QMLEOF
|
|
|
|
cat > "${COOKBOOK_BUILD}/redbear_network_stub.h" << 'NETEOF'
|
|
#ifndef REDBEAR_NETWORK_STUB_H
|
|
#define REDBEAR_NETWORK_STUB_H
|
|
#include <QObject>
|
|
#include <QUrl>
|
|
#define QNetworkReply QObject
|
|
#define QNetworkRequest struct QNetworkRequestStub { QNetworkRequestStub(const QUrl&) {} void setAttribute(int, int) {} };
|
|
#define QNetworkAccessManager QObject
|
|
enum { QNetworkReply__NoError = 0, QNetworkReply__ContentNotFoundError = 1 };
|
|
#define QNetworkReply__finished destroyed
|
|
#endif
|
|
NETEOF
|
|
|
|
cat > "${COOKBOOK_BUILD}/shader_noop.cmake" << 'EOFCMAKE'
|
|
function(qt6_add_shaders)
|
|
endfunction()
|
|
function(qt_internal_add_shaders)
|
|
endfunction()
|
|
function(qt_add_shaders)
|
|
endfunction()
|
|
EOFCMAKE
|
|
|
|
# Disable translations (requires Qt6LinguistTools which is not in the build)
|
|
sed -i 's/^ecm_install_po_files_as_qm(poqm)/# ecm_install_po_files_as_qm(poqm) -- disabled for Redox cross-build/' "${COOKBOOK_SOURCE}/CMakeLists.txt"
|
|
|
|
# Disable qmllint (requires QML runtime we don't fully have)
|
|
sed -i 's/^configure_file(qmllint.ini.in/# configure_file(qmllint.ini.in -- disabled/' "${COOKBOOK_SOURCE}/CMakeLists.txt"
|
|
sed -i 's/^kde_configure_git_pre_commit_hook/# kde_configure_git_pre_commit_hook -- disabled/' "${COOKBOOK_SOURCE}/CMakeLists.txt"
|
|
|
|
# Add GuiPrivate to Qt6 find_package so the platform module can link it
|
|
sed -i 's/COMPONENTS Core Quick Gui Svg QuickControls2 Concurrent ShaderTools/COMPONENTS Core Quick Gui GuiPrivate Svg QuickControls2 Concurrent ShaderTools/' "${COOKBOOK_SOURCE}/CMakeLists.txt"
|
|
|
|
# Fix missing QElapsedTimer include in toolbarlayout.cpp
|
|
sed -i '/#include <QDeadlineTimer>/a #include <QElapsedTimer>' "${COOKBOOK_SOURCE}/src/layouts/toolbarlayout.cpp"
|
|
|
|
# Add Qt6::Network to KirigamiPrimitives link libraries for QNetworkReply headers
|
|
sed -i 's|target_link_libraries(KirigamiPrimitives PRIVATE Qt6::Quick KirigamiPlatform)|target_link_libraries(KirigamiPrimitives PRIVATE Qt6::Quick Qt6::Network KirigamiPlatform)|' "${COOKBOOK_SOURCE}/src/primitives/CMakeLists.txt"
|
|
|
|
cmake "${COOKBOOK_SOURCE}" \
|
|
-DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \
|
|
-DQT_HOST_PATH="${HOST_BUILD}" \
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_CXX_FLAGS="-DQT_NO_NETWORK -include ${COOKBOOK_BUILD}/qml_off_noop.h -I${COOKBOOK_SOURCE}/stubs/QtNetwork -I${COOKBOOK_SYSROOT}/usr/include/QtQml -I${COOKBOOK_SYSROOT}/usr/include/QtQuick" \
|
|
-DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}:${COOKBOOK_STAGE}/usr/lib/cmake" \
|
|
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="${COOKBOOK_BUILD}/shader_noop.cmake" \
|
|
-DBUILD_TESTING=OFF \
|
|
-DBUILD_QCH=OFF \
|
|
-DBUILD_EXAMPLES=OFF \
|
|
-DUSE_DBUS=OFF \
|
|
-DECM_ENABLE_QT_TRANSLATIONS=OFF \
|
|
-DBUILD_TRANSLATIONS=OFF \
|
|
-D__qt_Gui_always_load_private_module=ON \
|
|
-Wno-dev
|
|
|
|
cmake --build . -j${COOKBOOK_MAKE_JOBS}
|
|
cmake --install . --prefix "${COOKBOOK_STAGE}/usr"
|
|
|
|
for lib in "${COOKBOOK_STAGE}/usr/lib/"libKirigami*.so.* "${COOKBOOK_STAGE}/usr/lib/"libKF6*.so.*; do
|
|
[ -f "${lib}" ] || continue
|
|
patchelf --remove-rpath "${lib}" 2>/dev/null || true
|
|
done
|
|
"""
|