190 lines
7.3 KiB
TOML
190 lines
7.3 KiB
TOML
# KIO — real KIOCore/KIOGui/KIOWidgets build for Red Bear OS.
|
|
#
|
|
# Honesty boundary:
|
|
# - BUILD_WITH_QML=OFF stays intentional.
|
|
# - USE_DBUS=ON is now enabled to expose more real KIOCore functionality.
|
|
# - 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 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"
|
|
|
|
[build]
|
|
template = "custom"
|
|
dependencies = [
|
|
"qtbase",
|
|
"qtdeclarative",
|
|
"kf6-extra-cmake-modules",
|
|
"kf6-kcoreaddons",
|
|
"kf6-kconfig",
|
|
"kf6-ki18n",
|
|
"kf6-kdbusaddons",
|
|
"kf6-kjobwidgets",
|
|
"kf6-kservice",
|
|
"kf6-kbookmarks",
|
|
"kf6-kcompletion",
|
|
"kf6-kwidgetsaddons",
|
|
"kf6-kwindowsystem",
|
|
"kf6-kiconthemes",
|
|
"kf6-kitemviews",
|
|
"kf6-kxmlgui",
|
|
"kf6-knotifications",
|
|
"kf6-kcrash",
|
|
"kf6-solid",
|
|
]
|
|
script = """
|
|
DYNAMIC_INIT
|
|
|
|
HOST_BUILD="${COOKBOOK_ROOT}/build/qt-host-build"
|
|
|
|
mkdir -p "${HOST_BUILD}/bin"
|
|
for tool in moc rcc uic qdbuscpp2xml qdbusxml2cpp wayland-scanner; do
|
|
if [ -f "/usr/bin/${tool}" ] && [ ! -e "${HOST_BUILD}/bin/${tool}" ]; then
|
|
ln -sf "/usr/bin/${tool}" "${HOST_BUILD}/bin/${tool}"
|
|
fi
|
|
done
|
|
|
|
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
|
|
|
|
# workerinterface.cpp calls KIO::HostInfo::lookupHost which needs
|
|
# 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
|
|
|
|
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_PREFIX_PATH="${COOKBOOK_SYSROOT}" \
|
|
-DBUILD_TESTING=OFF \
|
|
-DBUILD_QCH=OFF \
|
|
-DBUILD_DESIGNERPLUGIN=OFF \
|
|
-DQT_SKIP_AUTO_PLUGIN_INCLUSION=ON \
|
|
-DBUILD_WITH_QML=OFF \
|
|
-DUSE_DBUS=ON \
|
|
-DWITH_X11=OFF \
|
|
-DWITH_WAYLAND=OFF \
|
|
-Wno-dev
|
|
|
|
cmake --build . -j${COOKBOOK_MAKE_JOBS}
|
|
cmake --install . --prefix "${COOKBOOK_STAGE}/usr"
|
|
|
|
for lib in "${COOKBOOK_STAGE}/usr/lib/"libKF6*.so.*; do
|
|
[ -f "${lib}" ] || continue
|
|
patchelf --remove-rpath "${lib}" 2>/dev/null || true
|
|
done
|
|
"""
|