Merge kwayland-server-native package into kwin-native

This commit is contained in:
Andreas Cord-Landwehr
2022-07-12 15:52:43 +02:00
parent bbdd1e6098
commit 4ae96a93c8
7 changed files with 64 additions and 276 deletions

View File

@@ -1,49 +0,0 @@
# SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
# SPDX-FileCopyrightText: 2022 Andreas Cord-Landwehr <cordlandwehr@kde.org>
#
# SPDX-License-Identifier: MIT
DESCRIPTION = "KWayland Server"
HOMEPAGE = "https://invent.kde.org/plasma/kwayland-server/"
LICENSE = "LGPL-2.1"
LIC_FILES_CHKSUM = " \
file://LICENSES/LGPL-2.1-only.txt;md5=fabba2a3bfeb22a6483d44e9ae824d3f \
"
PR = "r0"
inherit cmake_qt5
inherit pkgconfig
# TODO skip inherit of cmake_plasma for now because to leads to build errors for native package
DEPENDS:class-target = " \
qtbase \
qtwayland \
qtwayland-native \
kwayland \
plasma-wayland-protocols \
kwayland-server-native \
wayland \
wayland-protocols \
"
DEPENDS:class-native = " \
qtbase-native \
extra-cmake-modules-native \
"
SRC_URI:append:class-native = " \
file://fake_project_root.patch \
"
OECMAKE_SOURCEPATH:class-native = "${S}/src/tools"
do_install:class-native() {
install -d ${D}/${bindir}
install ${B}/bin/qtwaylandscanner_kde ${D}/${bindir}
}
FILES:${PN}-dev += " \
${datadir}/qlogging-categories5/* \
"
BBCLASSEXTEND = "native"

View File

@@ -1,29 +0,0 @@
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt
index 5eea6e49..b78afb7b 100644
--- a/src/tools/CMakeLists.txt
+++ b/src/tools/CMakeLists.txt
@@ -1,3 +1,24 @@
+cmake_minimum_required(VERSION 3.16)
+set(QT_MIN_VERSION "5.15.0")
+project(QtWaylandScannerKde)
+set(CMAKE_C_STANDARD 99)
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+# ECM setup
+set(KDE_COMPILERSETTINGS_LEVEL "5.82")
+include(FeatureSummary)
+find_package(ECM 5.82 NO_MODULE REQUIRED)
+set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
+
+include(CheckIncludeFile)
+
+include(KDEInstallDirs)
+include(KDECompilerSettings NO_POLICY_SCOPE)
+include(KDECMakeSettings)
+
+find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Concurrent)
+
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
add_executable(qtwaylandscanner_kde qtwaylandscanner.cpp)
target_link_libraries(qtwaylandscanner_kde Qt::Core)

View File

@@ -1,7 +0,0 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0
require ${PN}.inc
SRC_URI = "https://download.kde.org/stable/plasma/5.24.5/kwayland-server-5.24.5.tar.xz"
SRC_URI[sha256sum] = "2ddabe29794489d11096ed831ad4d5c1626130019322d4305d58df84c835b279"

View File

@@ -1,15 +0,0 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0
require ${PN}.inc
SRC_URI = "https://download.kde.org/stable/plasma/5.25.1/kwayland-server-5.25.1.tar.xz"
SRC_URI[sha256sum] = "<!DOCTYPE
<html><head>
<title>404
</head><body>
<h1>Not
<p>The
<hr>
<address>Apache/2.4.41
</body></html>"

View File

@@ -10,9 +10,11 @@ LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://LICENSES/GPL-2.0-only.txt;md5=93e64b4a83c7e441e48bbdeeea05c977"
PR = "r0"
DEPENDS = " \
DEPENDS:class-target = " \
qtdeclarative \
qtsensors \
qtwayland-native \
kpackage-native \
qtscript \
kconfigwidgets \
kcrash \
@@ -20,12 +22,14 @@ DEPENDS = " \
kinit \
knotifications \
kpackage \
kwin-native \
wayland \
wayland-protocols \
plasma-framework \
kwindowsystem \
kiconthemes \
kidletime \
kwayland \
kwayland-server \
kcompletion \
kdeclarative \
kcmutils \
@@ -44,14 +48,32 @@ DEPENDS = " \
libepoxy \
libinput \
pipewire \
libxcvt \
hwdata \
"
DEPENDS:class-native = " \
qtbase-native \
extra-cmake-modules-native \
"
SRC_URI:append = " \
file://0001-Use-a-python-script-to-strip-effect-metadata.patch \
file://kwinrc \
"
inherit cmake_plasma kconfig
SRC_URI:append:class-native = " \
file://0001-Add-install-operation-for-native-build.patch \
"
OECMAKE_SOURCEPATH:class-native = "${S}/src/wayland/tools"
EXTRA_OECMAKE:append:class-target = " -DQTWAYLANDSCANNER_KDE_EXECUTABLE=${STAGING_DIR_NATIVE}/${bindir}/qtwaylandscanner_kde"
inherit kauth
inherit kconfig
inherit kdoctools
inherit cmake_qt5
inherit pkgconfig
# TODO skip inherit of cmake_plasma for now because to leads to build errors for native package
do_install:append() {
# dirty workaround for aurora crash on Wayland
@@ -64,26 +86,36 @@ do_install:append() {
FILES_SOLIBSDEV = ""
FILES:${PN} += " \
${datadir}/config.kcfg/*.kcfg \
${datadir}/icons/hicolor \
${datadir}/kconf_update/* \
${datadir}/knotifications5/*.notifyrc \
${datadir}/knsrcfiles/* \
${datadir}/kpackage \
${datadir}/krunner/dbusplugins/*.desktop \
${datadir}/kservices5/*.desktop \
${datadir}/kservices5/kwin/*.desktop \
${datadir}/kservicetypes5/*.desktop \
${datadir}/kwincompositing/qml/*.qml \
${datadir}/qlogging-categories5 \
${libdir}/kconf_update_bin/kwin5_update_default_rules \
${libdir}/plugins/*.so \
${libdir}/plugins/kf5/org.kde.kidletime.platforms/*.so \
${libdir}/plugins/kpackage/packagestructure/*.so \
${libdir}/plugins/kwin/effects/configs/*.so \
${libdir}/plugins/kwin/plugins/*.so \
${libdir}/plugins/org.kde.kdecoration2/*.so \
${libdir}/plugins/org.kde.kglobalaccel5.platforms/*.so \
${libdir}/plugins/org.kde.kwin.platforms/*.so \
${libdir}/plugins/org.kde.kwin.scenes/*.so \
${libdir}/plugins/org.kde.kwin.waylandbackends/*.so \
${libdir}/plugins/plasma/kcms/systemsettings/*.so \
${libdir}/plugins/plasma/kcms/systemsettings_qwidgets/*.so \
${libdir}/plugins/platforms/*.so \
${libdir}/qml/org/kde/kwin.2/* \
${libdir}/qml/org/kde/kwin/decoration/* \
${libdir}/qml/org/kde/kwin/decorations/plastik/* \
${libdir}/qml/org/kde/kwin/effects/* \
${libdir}/qml/org/kde/kwin/private/effects/* \
${libdir}/qml/org/kde/kwin/private/kdecoration/* \
${libdir}/qml/org/kde/plasma/quicksetting/nightcolor/* \
${libdir}/systemd/user/*.service \
@@ -91,11 +123,14 @@ FILES:${PN} += " \
FILES:${PN}-dev += " \
${libdir}/libkwin*.so \
${datadir}/dbus-1/interfaces/*.xml \
"
RDEPENDS:${PN}:append = " \
RDEPENDS:${PN}:append:class-target = " \
maliit-keyboard-qt5 \
qtwayland-plugins \
xwayland \
perl \
"
BBCLASSEXTEND = "native"

View File

@@ -0,0 +1,24 @@
From 0c28771f3d09794bf549e26a8b13f568812e9634 Mon Sep 17 00:00:00 2001
From: Andreas Cord-Landwehr <cordlandwehr@kde.org>
Date: Sun, 26 Jun 2022 19:55:01 +0200
Subject: [PATCH] Add install operation for native build
---
src/wayland/tools/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/wayland/tools/CMakeLists.txt b/src/wayland/tools/CMakeLists.txt
index 767df3f28..9ea0a1e66 100644
--- a/src/wayland/tools/CMakeLists.txt
+++ b/src/wayland/tools/CMakeLists.txt
@@ -43,6 +43,7 @@ else()
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
add_executable(qtwaylandscanner_kde qtwaylandscanner.cpp)
target_link_libraries(qtwaylandscanner_kde Qt::Core)
+ install(TARGETS qtwaylandscanner_kde ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
include(ECMMarkNonGuiExecutable)
ecm_mark_nongui_executable(qtwaylandscanner_kde)
endif()
--
2.34.1

View File

@@ -1,171 +0,0 @@
From f5554f4ef243e42d8cf5eb1ccbe369a047871f6c Mon Sep 17 00:00:00 2001
From: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Date: Sun, 20 Feb 2022 20:20:52 +0000
Subject: [PATCH] Use a python script to strip effect metadata
This makes it easier to cross-compile KWin since it is no longer necessary
to have all the KWin dependencies on the host machine. This could be
partially addressed by moving the strip-effects-metadata.cpp into a
separate folder than can be built as a top-level project, thereby reducing
the dependencies to just QtCore. However, it still means we have to build
a native binary. Since all this script is doing is removing some JSON keys,
we could also use a python script and avoid the need to compile a
build-time helper program.
---
src/effects/CMakeLists.txt | 21 ++------
src/effects/strip-effect-metadata.cpp | 71 ---------------------------
src/effects/strip-effect-metadata.py | 28 +++++++++++
3 files changed, 33 insertions(+), 87 deletions(-)
delete mode 100644 src/effects/strip-effect-metadata.cpp
create mode 100755 src/effects/strip-effect-metadata.py
diff --git a/src/effects/CMakeLists.txt b/src/effects/CMakeLists.txt
index 9d06969b9..da9998932 100644
--- a/src/effects/CMakeLists.txt
+++ b/src/effects/CMakeLists.txt
@@ -8,26 +8,15 @@ function(kwin_add_effect_config name)
kcoreaddons_add_plugin(${name} INSTALL_NAMESPACE "kwin/effects/configs" SOURCES ${ARGV})
endfunction()
-if (CMAKE_CROSSCOMPILING)
- if (NOT KWIN_HOST_TOOLING)
- message(FATAL_ERROR "Please provide the path to a native build and pass -DKWIN_HOST_TOOLING=path")
- endif()
- find_file(KSEM_EXECUTABLE StripEffectMetadataTargets.cmake
- PATHS ${KWIN_HOST_TOOLING}
- NO_DEFAULT_PATH
- NO_CMAKE_FIND_ROOT_PATH)
- include(${KSEM_EXECUTABLE})
-else()
- add_executable(kwin-strip-effect-metadata strip-effect-metadata.cpp)
- target_link_libraries(kwin-strip-effect-metadata Qt5::Core)
- # Export the kwin-strip-effect-metadata target to a file, so it can be used by another build.
- export(TARGETS kwin-strip-effect-metadata FILE ${CMAKE_BINARY_DIR}/StripEffectMetadataTargets.cmake)
-endif()
+# Add a CMake-time check for python3 to avoid failures during build.
+find_package (Python3 COMPONENTS Interpreter)
+add_feature_info("Python3" Python3_Interpreter_FOUND "Required to strip effects metadata")
+set(KSEM_EXE "${CMAKE_CURRENT_SOURCE_DIR}/strip-effect-metadata.py")
function (kwin_strip_builtin_effect_metadata target metadata)
set(stripped_metadata "${CMAKE_CURRENT_BINARY_DIR}/${metadata}.stripped")
- set(command kwin-strip-effect-metadata --source=${metadata} --output=${stripped_metadata})
+ set(command ${KSEM_EXE} --source=${metadata} --output=${stripped_metadata})
add_custom_command(
OUTPUT ${stripped_metadata}
COMMAND ${command}
diff --git a/src/effects/strip-effect-metadata.cpp b/src/effects/strip-effect-metadata.cpp
deleted file mode 100644
index d882854a0..000000000
--- a/src/effects/strip-effect-metadata.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
-
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include <QCommandLineOption>
-#include <QCommandLineParser>
-#include <QCoreApplication>
-#include <QDebug>
-#include <QFile>
-#include <QJsonObject>
-#include <QJsonDocument>
-#include <QJsonValue>
-
-/**
- * This little helper strips unnecessary information from builtin effect metadata files to
- * reduce the size of kwin executables and json parsing runtime overhead.
- */
-
-static bool stripMetaData(const QString &fileName, const QString &target)
-{
- QFile originalFile(fileName);
- if (!originalFile.open(QFile::ReadOnly)) {
- qWarning("Failed to open %s: %s", qPrintable(fileName), qPrintable(originalFile.errorString()));
- return false;
- }
-
- QJsonDocument fullDocument = QJsonDocument::fromJson(originalFile.readAll());
- if (fullDocument.isNull()) {
- qWarning() << "Invalid metadata in" << fileName;
- return false;
- }
-
- const QJsonObject originalRootObject = fullDocument.object();
-
- QJsonObject kpluginObject;
- kpluginObject["Id"] = originalRootObject["KPlugin"]["Id"];
- kpluginObject["EnabledByDefault"] = originalRootObject["KPlugin"]["EnabledByDefault"];
-
- QJsonObject strippedRootObject;
- strippedRootObject["KPlugin"] = kpluginObject;
-
- QFile targetFile(target);
- if (!targetFile.open(QFile::WriteOnly)) {
- qWarning("Failed to open %s: %s", qPrintable(target), qPrintable(targetFile.errorString()));
- return false;
- }
-
- targetFile.write(QJsonDocument(strippedRootObject).toJson());
- targetFile.close();
-
- return targetFile.error() == QFile::NoError;
-}
-
-int main(int argc, char **argv)
-{
- QCoreApplication app(argc, argv);
-
- QCommandLineParser parser;
- parser.setApplicationDescription("kwin-strip-effect-metadata");
-
- QCommandLineOption inputOption(QStringLiteral("source"), QStringLiteral("input file"), QStringLiteral("path/to/file"));
- parser.addOption(inputOption);
-
- QCommandLineOption outputOption(QStringLiteral("output"), QStringLiteral("output file"), QStringLiteral("path/to/file"));
- parser.addOption(outputOption);
-
- parser.process(app);
- return !stripMetaData(parser.value(inputOption), parser.value(outputOption));
-}
diff --git a/src/effects/strip-effect-metadata.py b/src/effects/strip-effect-metadata.py
new file mode 100755
index 000000000..77f316d26
--- /dev/null
+++ b/src/effects/strip-effect-metadata.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+# SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
+# SPDX-FileCopyrightText: 2022 Alex Richardson <arichardson.kde@gmail.com>
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# This little helper strips unnecessary information from builtin effect metadata files to
+# reduce the size of kwin executables and json parsing runtime overhead.
+
+import argparse
+import json
+
+def main():
+ parser = argparse.ArgumentParser(prog="kwin-strip-effect-metadata")
+ parser.add_argument("--source", help="input file", required=True)
+ parser.add_argument("--output", help="output file", required=True)
+ args = parser.parse_args()
+ stripped_json = dict(KPlugin=dict())
+ with open(args.source, "r") as src:
+ original_json = json.load(src)
+ stripped_json["KPlugin"]["Id"] = original_json["KPlugin"]["Id"]
+ stripped_json["KPlugin"]["EnabledByDefault"] = original_json["KPlugin"]["EnabledByDefault"]
+
+ with open(args.output, "w") as dst:
+ json.dump(stripped_json, dst)
+
+
+if __name__ == "__main__":
+ main()
--
2.32.0