fix: harden KF6 KIO build surface
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
# KIO — reduced real KIOCore build for Red Bear OS.
|
||||
# KIO — real KIOCore/KIOGui/KIOWidgets build for Red Bear OS.
|
||||
#
|
||||
# Honesty boundary:
|
||||
# - KIOCORE_ONLY=ON and BUILD_WITH_QML=OFF stay intentional.
|
||||
# - BUILD_WITH_QML=OFF stays intentional.
|
||||
# - USE_DBUS=ON is now enabled to expose more real KIOCore functionality.
|
||||
# - QtNetwork is still unavailable on Redox, so KIOCore uses source-local
|
||||
# - The wider build now imports Qt6Network from the target sysroot for
|
||||
# KIOWidgets/KIOGui/workers, while KIOCore still keeps its source-local
|
||||
# Redox compatibility headers for the small QHostInfo/QHostAddress surface it needs.
|
||||
# - This recipe no longer forges QtNetwork headers into the shared sysroot.
|
||||
# - This recipe does not forge QtNetwork headers into the shared sysroot.
|
||||
[source]
|
||||
tar = "https://invent.kde.org/frameworks/kio/-/archive/v6.10.0/kio-v6.10.0.tar.gz"
|
||||
|
||||
@@ -51,14 +52,114 @@ for qtdir in plugins mkspecs metatypes modules; do
|
||||
done
|
||||
|
||||
# workerinterface.cpp calls KIO::HostInfo::lookupHost which needs
|
||||
# hostinfo.cpp — but hostinfo.cpp isn't in the cmake source list for
|
||||
# KIOCORE_ONLY. Replace the call with a direct QHostInfo::fromName.
|
||||
# hostinfo.cpp — but hostinfo.cpp still isn't in the cmake source list.
|
||||
# Replace the call with a direct QHostInfo::fromName.
|
||||
sed -i 's/const QHostInfo info = HostInfo::lookupHost(hostName, 1500);/const QHostInfo info = QHostInfo::fromName(hostName);/' \
|
||||
"${COOKBOOK_SOURCE}/src/core/workerinterface.cpp" 2>/dev/null || true
|
||||
# Also remove the hostinfo.h include — no longer needed
|
||||
sed -i '/#include "hostinfo.h"/d' \
|
||||
"${COOKBOOK_SOURCE}/src/core/workerinterface.cpp" 2>/dev/null || true
|
||||
|
||||
# Full KIO builds link Qt6::Network from multiple subdirectories, but the
|
||||
# top-level Qt6 package import omits the Network component by default.
|
||||
sed -i 's/find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets Concurrent Xml)/find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets Concurrent Xml Network)/' \
|
||||
"${COOKBOOK_SOURCE}/CMakeLists.txt" 2>/dev/null || true
|
||||
|
||||
# KIOGui still reaches KIO::HostInfo; make sure the existing hostinfo.cpp
|
||||
# implementation is actually built into KIOCore.
|
||||
if ! grep -q 'hostinfo.cpp' "${COOKBOOK_SOURCE}/src/core/CMakeLists.txt" 2>/dev/null; then
|
||||
sed -i '/workerinterface.cpp/a\\ hostinfo.cpp' \
|
||||
"${COOKBOOK_SOURCE}/src/core/CMakeLists.txt" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Redox only needs the core/gui/widgets libraries here; skip worker/daemon and
|
||||
# extra runtime/plugin subdirectories that still depend on unsupported Qt SSL,
|
||||
# SysV IPC, and broader runtime surfaces.
|
||||
sed -i '/add_subdirectory(kioworkers)/d; /add_subdirectory(schemehandlers)/d; /add_subdirectory(kiod)/d; /add_subdirectory(kssld)/d; /add_subdirectory(kpasswdserver)/d; /add_subdirectory(kioexec)/d; /add_subdirectory(filewidgets)/d; /add_subdirectory(urifilters)/d' \
|
||||
"${COOKBOOK_SOURCE}/src/CMakeLists.txt" 2>/dev/null || true
|
||||
|
||||
# KIOGui uses QHostInfo in full builds, so import QtNetwork on the GUI target.
|
||||
if ! grep -q 'Qt6::Network' "${COOKBOOK_SOURCE}/src/gui/CMakeLists.txt" 2>/dev/null; then
|
||||
sed -i '/Qt6::Gui/a\\ Qt6::Network' \
|
||||
"${COOKBOOK_SOURCE}/src/gui/CMakeLists.txt" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# PreviewJob's SysV shared-memory fast path is unavailable on Redox.
|
||||
sed -i '17c\\#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_HAIKU) && !defined(Q_OS_REDOX)' \
|
||||
"${COOKBOOK_SOURCE}/src/gui/previewjob.cpp" 2>/dev/null || true
|
||||
|
||||
python - <<'PY'
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
root = Path(os.environ["COOKBOOK_SOURCE"])
|
||||
|
||||
widgets_cmake = root / "src/widgets/CMakeLists.txt"
|
||||
text = widgets_cmake.read_text()
|
||||
for needle in (
|
||||
" ksslcertificatebox.cpp\\n",
|
||||
" ksslinfodialog.cpp\\n",
|
||||
" sslui.cpp\\n",
|
||||
" kdynamicjobtracker.cpp\\n",
|
||||
" KSslCertificateBox\\n",
|
||||
" KSslInfoDialog\\n",
|
||||
):
|
||||
text = text.replace(needle, "")
|
||||
widgets_cmake.write_text(text)
|
||||
|
||||
jobuidelegate = root / "src/widgets/jobuidelegate.cpp"
|
||||
text = jobuidelegate.read_text()
|
||||
text = text.replace("#include <ksslinfodialog.h>\\n", "")
|
||||
jobuidelegate.write_text(text)
|
||||
|
||||
askuser = root / "src/widgets/widgetsaskuseractionhandler.cpp"
|
||||
text = askuser.read_text()
|
||||
text = text.replace("#include <KSslInfoDialog>\\n", "")
|
||||
start_marker = "void KIO::WidgetsAskUserActionHandler::showSslDetails(const QVariantMap &sslErrorData, QWidget *parentWidget)\\n"
|
||||
end_marker = '\\n#include "moc_widgetsaskuseractionhandler.cpp"\\n'
|
||||
new = r'''void KIO::WidgetsAskUserActionHandler::showSslDetails(const QVariantMap &sslErrorData, QWidget *parentWidget)
|
||||
{
|
||||
QString details = i18n("Detailed SSL certificate inspection is unavailable on Redox with the current QtNetwork SSL surface.");
|
||||
const QString hostname = sslErrorData[QLatin1String("hostname")].toString();
|
||||
const QString protocol = sslErrorData[QLatin1String("protocol")].toString();
|
||||
const QString cipher = sslErrorData[QLatin1String("cipher")].toString();
|
||||
const QString sslError = sslErrorData[QLatin1String("sslError")].toString();
|
||||
|
||||
if (!hostname.isEmpty()) {
|
||||
details += QStringLiteral("\\n\\n") + i18n("Host: %1", hostname);
|
||||
}
|
||||
if (!protocol.isEmpty()) {
|
||||
details += QStringLiteral("\\n") + i18n("Protocol: %1", protocol);
|
||||
}
|
||||
if (!cipher.isEmpty()) {
|
||||
details += QStringLiteral("\\n") + i18n("Cipher: %1", cipher);
|
||||
}
|
||||
if (!sslError.isEmpty()) {
|
||||
details += QStringLiteral("\\n\\n") + sslError;
|
||||
}
|
||||
|
||||
QMetaObject::invokeMethod(qGuiApp, [=, this] {
|
||||
auto *dialog = new KMessageDialog(KMessageDialog::Information, details, parentWidget);
|
||||
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->setCaption(i18n("SSL"));
|
||||
dialog->setButtons(KStandardGuiItem::ok());
|
||||
|
||||
QObject::connect(dialog, &QDialog::finished, this, [this, sslErrorData, parentWidget](const int) {
|
||||
askIgnoreSslErrors(sslErrorData, parentWidget);
|
||||
});
|
||||
|
||||
dialog->show();
|
||||
});
|
||||
}
|
||||
'''
|
||||
start = text.find(start_marker)
|
||||
end = text.find(end_marker)
|
||||
if start != -1 and end != -1 and start < end:
|
||||
text = text[:start] + new + text[end:]
|
||||
askuser.write_text(text)
|
||||
PY
|
||||
|
||||
rm -f CMakeCache.txt
|
||||
rm -rf CMakeFiles
|
||||
|
||||
@@ -70,11 +171,12 @@ cmake "${COOKBOOK_SOURCE}" \
|
||||
-DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}" \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DBUILD_QCH=OFF \
|
||||
-DBUILD_DESIGNERPLUGIN=OFF \
|
||||
-DQT_SKIP_AUTO_PLUGIN_INCLUSION=ON \
|
||||
-DKIOCORE_ONLY=ON \
|
||||
-DBUILD_WITH_QML=OFF \
|
||||
-DUSE_DBUS=ON \
|
||||
-DWITH_X11=OFF \
|
||||
-DWITH_WAYLAND=OFF \
|
||||
-Wno-dev
|
||||
|
||||
cmake --build . -j${COOKBOOK_MAKE_JOBS}
|
||||
|
||||
Reference in New Issue
Block a user