Refresh Qt and Wayland recipes
Red Bear OS Team
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
[source]
|
||||
path = "source"
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"qtbase",
|
||||
"qtwayland",
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
|
||||
for qtdir in plugins mkspecs metatypes modules; do
|
||||
if [ -d "${COOKBOOK_SYSROOT}/usr/${qtdir}" ] && [ -d "${COOKBOOK_SYSROOT}/${qtdir}" ] && [ ! -L "${COOKBOOK_SYSROOT}/${qtdir}" ]; then
|
||||
rm -rf "${COOKBOOK_SYSROOT}/${qtdir}"
|
||||
fi
|
||||
if [ -d "${COOKBOOK_SYSROOT}/usr/${qtdir}" ] && [ ! -e "${COOKBOOK_SYSROOT}/${qtdir}" ]; then
|
||||
ln -s "usr/${qtdir}" "${COOKBOOK_SYSROOT}/${qtdir}"
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f CMakeCache.txt
|
||||
rm -rf CMakeFiles
|
||||
|
||||
cmake "${COOKBOOK_SOURCE}" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}" \
|
||||
-DQT_NO_PRIVATE_MODULE_WARNING=ON \
|
||||
-Wno-dev
|
||||
|
||||
cmake --build . -j${COOKBOOK_MAKE_JOBS}
|
||||
cmake --install . --prefix "${COOKBOOK_STAGE}/usr"
|
||||
|
||||
for lib in "${COOKBOOK_STAGE}/usr/lib/"lib*.so.*; do
|
||||
[ -f "${lib}" ] || continue
|
||||
patchelf --remove-rpath "${lib}" 2>/dev/null || true
|
||||
done
|
||||
"""
|
||||
|
||||
[package.files]
|
||||
"/usr/bin/qt6-wayland-smoke" = "qt6-wayland-smoke"
|
||||
"/usr/bin/qt6-bootstrap-check" = "qt6-bootstrap-check"
|
||||
"/usr/bin/qt6-plugin-check" = "qt6-plugin-check"
|
||||
@@ -0,0 +1,47 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(qt6-wayland-smoke LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Gui Core)
|
||||
|
||||
qt_add_executable(qt6-wayland-smoke
|
||||
main.cpp
|
||||
)
|
||||
|
||||
qt_add_executable(qt6-bootstrap-check
|
||||
bootstrap.cpp
|
||||
)
|
||||
|
||||
qt_add_executable(qt6-plugin-check
|
||||
plugincheck.cpp
|
||||
)
|
||||
|
||||
target_compile_options(qt6-wayland-smoke PRIVATE -fcf-protection=none)
|
||||
target_compile_options(qt6-bootstrap-check PRIVATE -fcf-protection=none)
|
||||
target_compile_options(qt6-plugin-check PRIVATE -fcf-protection=none)
|
||||
|
||||
target_link_options(qt6-wayland-smoke PRIVATE -fcf-protection=none)
|
||||
target_link_options(qt6-bootstrap-check PRIVATE -fcf-protection=none)
|
||||
target_link_options(qt6-plugin-check PRIVATE -fcf-protection=none)
|
||||
|
||||
target_link_libraries(qt6-wayland-smoke PRIVATE
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
)
|
||||
|
||||
target_link_libraries(qt6-bootstrap-check PRIVATE
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
)
|
||||
|
||||
target_link_libraries(qt6-plugin-check PRIVATE
|
||||
Qt6::Core
|
||||
)
|
||||
|
||||
install(TARGETS qt6-wayland-smoke RUNTIME DESTINATION bin)
|
||||
install(TARGETS qt6-bootstrap-check RUNTIME DESTINATION bin)
|
||||
install(TARGETS qt6-plugin-check RUNTIME DESTINATION bin)
|
||||
install(FILES qt.conf DESTINATION bin)
|
||||
@@ -0,0 +1,47 @@
|
||||
#include <QByteArray>
|
||||
#include <QGuiApplication>
|
||||
|
||||
#include <array>
|
||||
#include <cstdio>
|
||||
|
||||
static void dumpPluginElfHeader(const char *path) {
|
||||
std::fprintf(stderr, "qt6-bootstrap-check inspecting %s\n", path);
|
||||
FILE *file = std::fopen(path, "rb");
|
||||
if (!file) {
|
||||
std::perror("fopen");
|
||||
return;
|
||||
}
|
||||
|
||||
std::array<unsigned char, 64> hdr{};
|
||||
const size_t n = std::fread(hdr.data(), 1, hdr.size(), file);
|
||||
std::fclose(file);
|
||||
|
||||
std::fprintf(stderr, "qt6-bootstrap-check read %zu bytes\n", n);
|
||||
std::fprintf(stderr, "qt6-bootstrap-check ELF header bytes:");
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
std::fprintf(stderr, " %02x", hdr[i]);
|
||||
}
|
||||
std::fprintf(stderr, "\n");
|
||||
|
||||
if (n >= 58) {
|
||||
const unsigned phentsize = unsigned(hdr[54]) | (unsigned(hdr[55]) << 8);
|
||||
const unsigned phnum = unsigned(hdr[56]) | (unsigned(hdr[57]) << 8);
|
||||
std::fprintf(stderr,
|
||||
"qt6-bootstrap-check decoded ELF phentsize=%u phnum=%u\n",
|
||||
phentsize,
|
||||
phnum);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const QByteArray platform = qEnvironmentVariableIsSet("QT_QPA_PLATFORM")
|
||||
? qgetenv("QT_QPA_PLATFORM")
|
||||
: QByteArray("minimal");
|
||||
|
||||
qputenv("QT_QPA_PLATFORM", platform);
|
||||
std::fprintf(stderr, "qt6-bootstrap-check before QGuiApplication platform=%s\n", platform.constData());
|
||||
dumpPluginElfHeader("/usr/plugins/platforms/libqminimal.so");
|
||||
QGuiApplication app(argc, argv);
|
||||
std::fprintf(stderr, "qt6-bootstrap-check after QGuiApplication platform=%s\n", platform.constData());
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#include <QByteArray>
|
||||
#include <QCoreApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const QByteArray platform = qEnvironmentVariableIsSet("QT_QPA_PLATFORM")
|
||||
? qgetenv("QT_QPA_PLATFORM")
|
||||
: QByteArray("wayland");
|
||||
|
||||
qputenv("QT_QPA_PLATFORM", platform);
|
||||
std::fprintf(stderr, "qt6-wayland-smoke before QGuiApplication platform=%s\n", platform.constData());
|
||||
|
||||
QGuiApplication app(argc, argv);
|
||||
std::fprintf(stderr, "qt6-wayland-smoke after QGuiApplication platform=%s\n", platform.constData());
|
||||
|
||||
qInfo() << "qt6-wayland-smoke platform" << QGuiApplication::platformName();
|
||||
|
||||
QTimer::singleShot(1000, &app, &QCoreApplication::quit);
|
||||
return app.exec();
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <QPluginLoader>
|
||||
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
|
||||
static constexpr const char *PhaseFile = "/home/root/.qt6-plugin-check.phase";
|
||||
|
||||
static void mark(const char *value) {
|
||||
std::ofstream out(PhaseFile, std::ios::trunc);
|
||||
out << value << '\n';
|
||||
out.flush();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
mark("before-qcoreapplication");
|
||||
std::fprintf(stderr, "qt6-plugin-check before QCoreApplication\n");
|
||||
std::fflush(stderr);
|
||||
QCoreApplication app(argc, argv);
|
||||
mark("after-qcoreapplication");
|
||||
std::fprintf(stderr, "qt6-plugin-check after QCoreApplication\n");
|
||||
std::fflush(stderr);
|
||||
|
||||
const QString plugin = argc > 1
|
||||
? QString::fromLocal8Bit(argv[1])
|
||||
: QStringLiteral("/usr/plugins/platforms/libqminimal.so");
|
||||
|
||||
QPluginLoader loader(plugin);
|
||||
mark("before-metadata");
|
||||
std::fprintf(stderr, "qt6-plugin-check before metadata\n");
|
||||
std::fflush(stderr);
|
||||
qInfo() << "qt6-plugin-check file" << plugin;
|
||||
qInfo() << "qt6-plugin-check metaData" << loader.metaData();
|
||||
|
||||
mark("before-load");
|
||||
std::fprintf(stderr, "qt6-plugin-check before load\n");
|
||||
std::fflush(stderr);
|
||||
if (!loader.load()) {
|
||||
mark("load-failed");
|
||||
qWarning() << "qt6-plugin-check load failed" << loader.errorString();
|
||||
return 1;
|
||||
}
|
||||
|
||||
QObject *instance = loader.instance();
|
||||
if (!instance) {
|
||||
mark("instance-failed");
|
||||
qWarning() << "qt6-plugin-check instance failed" << loader.errorString();
|
||||
return 2;
|
||||
}
|
||||
|
||||
mark("instance-ok");
|
||||
std::fprintf(stderr, "qt6-plugin-check instance ok\n");
|
||||
std::fflush(stderr);
|
||||
qInfo() << "qt6-plugin-check instance ok" << instance->metaObject()->className();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
[Paths]
|
||||
Prefix=/usr
|
||||
Plugins=/usr/plugins
|
||||
QmlImports=/usr/qml
|
||||
Reference in New Issue
Block a user