[packages/cage] add system_wlroots bcond (disabled by default); rel 2
atler
atler at pld-linux.org
Sat Jun 29 03:06:04 CEST 2024
commit afcdb3a7743ac62e3fc103ae3afcd1c7c9e3f0c5
Author: Jan Palus <atler at pld-linux.org>
Date: Sat Jun 29 01:11:44 2024 +0200
add system_wlroots bcond (disabled by default); rel 2
cage notoriously lags behind with wlroots compatibility blocking all
other projects ready for upgrade. let's just add bcond for linking
compatible wlroots version statically.
cage.spec | 66 +++++++++++++++++++++++++++++++++++++++++----
wlroots-gcc14.patch | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++
wlroots-version.patch | 11 ++++++++
wlroots-x32.patch | 14 ++++++++++
4 files changed, 161 insertions(+), 5 deletions(-)
---
diff --git a/cage.spec b/cage.spec
index 8866fab..a596400 100644
--- a/cage.spec
+++ b/cage.spec
@@ -1,11 +1,21 @@
+# Conditional build:
+%bcond_with system_wlroots # Link with system wlroots
+
+%define wlroots_ver 0.16.2
+
Summary: A Wayland kiosk
Name: cage
Version: 0.1.5
-Release: 1
+Release: 2
License: MIT
Group: Applications
Source0: https://github.com/cage-kiosk/cage/releases/download/v%{version}/%{name}-%{version}.tar.gz
# Source0-md5: 616bde2178a3c88f3238d9d26446a259
+Source1: https://gitlab.freedesktop.org/wlroots/wlroots/-/releases/%{wlroots_ver}/downloads/wlroots-%{wlroots_ver}.tar.gz
+# Source1-md5: cea876a8833d60ab65548ef60aae14b7
+Patch0: wlroots-version.patch
+Patch1: wlroots-x32.patch
+Patch2: wlroots-gcc14.patch
URL: https://www.hjdskes.nl/projects/cage/
BuildRequires: meson >= 0.58.1
BuildRequires: ninja
@@ -15,10 +25,39 @@ BuildRequires: rpmbuild(macros) >= 1.736
BuildRequires: scdoc >= 1.9.2
BuildRequires: wayland-devel
BuildRequires: wayland-protocols >= 1.14
-BuildRequires: wlroots-devel >= 0.16.0
BuildRequires: xorg-lib-libxkbcommon-devel
-Requires: wlroots >= 0.16.0
+%if %{with system_wlroots}
+BuildRequires: wlroots-devel >= 0.16.0
+BuildRequires: wlroots-devel < 0.17.0
+%else
+BuildRequires: EGL-devel
+BuildRequires: Mesa-libgbm-devel >= 21.1.0
+BuildRequires: OpenGLESv2-devel
+BuildRequires: Vulkan-Loader-devel >= 1.2.182
+BuildRequires: glslang >= 11.0.0
+BuildRequires: hwdata >= 0.364
+BuildRequires: libdrm-devel >= 2.4.113
+BuildRequires: libinput-devel >= 1.19.0
+BuildRequires: libseat-devel >= 0.2.0
+BuildRequires: libxcb-devel
+BuildRequires: pixman-devel
+BuildRequires: udev-devel
+BuildRequires: wayland-protocols >= 1.27
+BuildRequires: xcb-util-errors-devel
+BuildRequires: xcb-util-renderutil-devel
+BuildRequires: xcb-util-wm-devel
+BuildRequires: xorg-xserver-Xwayland-devel
+%endif
+%{?with_system_wlroots:Requires: wlroots >= 0.16.0}
Requires: xorg-xserver-Xwayland
+%if %{without system_wlroots}
+Requires: Mesa-libgbm >= 21.1.0
+Requires: Vulkan-Loader >= 1.2.182
+Requires: libdrm >= 2.4.113
+Requires: libinput >= 1.19.0
+Requires: libseat >= 0.2.0
+Requires: wayland >= 1.21
+%endif
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
@@ -30,11 +69,24 @@ kiosk compositor displays a single maximized application at a time and
prevents the user from interacting with anything but this application.
%prep
-%setup -q
+%setup -q %{!?with_system_wlroots:-a1}
+
+%patch0 -p1
+
+%if %{without system_wlroots}
+%{__mkdir} subprojects
+%{__mv} wlroots-%{wlroots_ver} subprojects/wlroots
+%patch1 -p1 -d subprojects/wlroots
+%patch2 -p1 -d subprojects/wlroots
+%endif
%build
%meson build \
- -Dxwayland=true
+ -Dxwayland=true \
+%if %{without system_wlroots}
+ -Dwlroots:default_library=static \
+ -Dwlroots:examples=false
+%endif
%ninja_build -C build
@@ -43,6 +95,10 @@ rm -rf $RPM_BUILD_ROOT
%ninja_install -C build
+%if %{without system_wlroots}
+%{__rm} -r $RPM_BUILD_ROOT{%{_includedir}/wlr,%{_libdir}/libwlroots.a,%{_pkgconfigdir}/wlroots.pc}
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
diff --git a/wlroots-gcc14.patch b/wlroots-gcc14.patch
new file mode 100644
index 0000000..2e8158d
--- /dev/null
+++ b/wlroots-gcc14.patch
@@ -0,0 +1,75 @@
+diff -ur wlroots.orig/backend/libinput/tablet_pad.c wlroots/backend/libinput/tablet_pad.c
+--- wlroots.orig/backend/libinput/tablet_pad.c 2023-02-10 23:29:59.000000000 +0100
++++ wlroots/backend/libinput/tablet_pad.c 2024-06-28 23:27:34.499124855 +0200
+@@ -34,7 +34,7 @@
+ ++group->ring_count;
+ }
+ }
+- group->rings = calloc(sizeof(unsigned int), group->ring_count);
++ group->rings = calloc(group->ring_count, sizeof(unsigned int));
+ if (group->rings == NULL) {
+ goto group_fail;
+ }
+@@ -51,7 +51,7 @@
+ ++group->strip_count;
+ }
+ }
+- group->strips = calloc(sizeof(unsigned int), group->strip_count);
++ group->strips = calloc(group->strip_count, sizeof(unsigned int));
+ if (group->strips == NULL) {
+ goto group_fail;
+ }
+@@ -67,7 +67,7 @@
+ ++group->button_count;
+ }
+ }
+- group->buttons = calloc(sizeof(unsigned int), group->button_count);
++ group->buttons = calloc(group->button_count, sizeof(unsigned int));
+ if (group->buttons == NULL) {
+ goto group_fail;
+ }
+diff -ur wlroots.orig/backend/wayland/output.c wlroots/backend/wayland/output.c
+--- wlroots.orig/backend/wayland/output.c 2023-02-10 23:29:59.000000000 +0100
++++ wlroots/backend/wayland/output.c 2024-06-28 23:27:34.495791624 +0200
+@@ -521,7 +521,7 @@
+ }
+
+ struct wlr_wl_output *output;
+- if (!(output = calloc(sizeof(struct wlr_wl_output), 1))) {
++ if (!(output = calloc(1, sizeof(struct wlr_wl_output)))) {
+ wlr_log(WLR_ERROR, "Failed to allocate wlr_wl_output");
+ return NULL;
+ }
+diff -ur wlroots.orig/examples/tablet.c wlroots/examples/tablet.c
+--- wlroots.orig/examples/tablet.c 2023-02-10 23:29:59.000000000 +0100
++++ wlroots/examples/tablet.c 2024-06-28 23:27:34.492458394 +0200
+@@ -309,7 +309,7 @@
+ xkb_context_unref(context);
+ break;
+ case WLR_INPUT_DEVICE_TABLET_PAD:;
+- struct tablet_pad_state *pstate = calloc(sizeof(struct tablet_pad_state), 1);
++ struct tablet_pad_state *pstate = calloc(1, sizeof(struct tablet_pad_state));
+ pstate->wlr_tablet_pad = wlr_tablet_pad_from_input_device(device);
+ pstate->sample = sample;
+ pstate->destroy.notify = tablet_pad_destroy_notify;
+@@ -327,7 +327,7 @@
+ sample->height_mm = tablet->height_mm == 0 ?
+ 10 : tablet->height_mm;
+
+- struct tablet_tool_state *tstate = calloc(sizeof(struct tablet_tool_state), 1);
++ struct tablet_tool_state *tstate = calloc(1, sizeof(struct tablet_tool_state));
+ tstate->wlr_tablet = tablet;
+ tstate->sample = sample;
+ tstate->destroy.notify = tablet_tool_destroy_notify;
+diff -ur wlroots.orig/examples/touch.c wlroots/examples/touch.c
+--- wlroots.orig/examples/touch.c 2023-02-10 23:29:59.000000000 +0100
++++ wlroots/examples/touch.c 2024-06-28 23:27:34.489125164 +0200
+@@ -220,7 +220,7 @@
+ xkb_context_unref(context);
+ break;
+ case WLR_INPUT_DEVICE_TOUCH:;
+- struct touch_state *tstate = calloc(sizeof(struct touch_state), 1);
++ struct touch_state *tstate = calloc(1, sizeof(struct touch_state));
+ tstate->wlr_touch = wlr_touch_from_input_device(device);
+ tstate->sample = sample;
+ tstate->destroy.notify = touch_destroy_notify;
diff --git a/wlroots-version.patch b/wlroots-version.patch
new file mode 100644
index 0000000..dab9f0b
--- /dev/null
+++ b/wlroots-version.patch
@@ -0,0 +1,11 @@
+--- cage-0.1.5/meson.build.orig 2023-07-28 16:46:37.000000000 +0200
++++ cage-0.1.5/meson.build 2024-06-28 23:10:30.722351855 +0200
+@@ -35,7 +35,7 @@
+ )
+ endif
+
+-wlroots = dependency('wlroots', version: '>= 0.16.0', fallback: ['wlroots', 'wlroots'])
++wlroots = dependency('wlroots', version: ['>= 0.16.0', '< 0.17.0'], fallback: ['wlroots', 'wlroots'])
+ wayland_protos = dependency('wayland-protocols', version: '>=1.14')
+ wayland_server = dependency('wayland-server')
+ xkbcommon = dependency('xkbcommon')
diff --git a/wlroots-x32.patch b/wlroots-x32.patch
new file mode 100644
index 0000000..4ac71cb
--- /dev/null
+++ b/wlroots-x32.patch
@@ -0,0 +1,14 @@
+--- wlroots-0.12.0/util/log.c.orig 2020-11-08 15:01:44.000000000 +0100
++++ wlroots-0.12.0/util/log.c 2021-02-03 10:32:04.394433021 +0100
+@@ -47,7 +47,11 @@
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ timespec_sub(&ts, &ts, &start_time);
+
++#if defined(__x86_64__) && defined(__ILP32__)
++ fprintf(stderr, "%02d:%02d:%02d.%03lld ", (int)(ts.tv_sec / 60 / 60),
++#else
+ fprintf(stderr, "%02d:%02d:%02d.%03ld ", (int)(ts.tv_sec / 60 / 60),
++#endif
+ (int)(ts.tv_sec / 60 % 60), (int)(ts.tv_sec % 60),
+ ts.tv_nsec / 1000000);
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/cage.git/commitdiff/afcdb3a7743ac62e3fc103ae3afcd1c7c9e3f0c5
More information about the pld-cvs-commit
mailing list