File weston.spec of Package weston

%define realname weston
%define realver  13.0.0
%define srcext   tar.xz

# See: grep -F dep_wayland_ meson.build
%define waylandminver 1.22.0

# See: grep ^libweston_major meson.build
%define gen      %(awk -F. '{print $1}' <<< %{realver})
%define lib_gen  -%{gen}-
%define so_ver   0

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       wiz%{?extraver:0.}1%{?dist}
License:       MIT
Group:         System/X11/Servers/XF86_4
URL:           https://wayland.freedesktop.org/
Summary:       Reference implementation of a Wayland compositor

# Build-time parameters
BuildRequires: pkg-config
BuildRequires: meson >= 0.63
BuildRequires: ninja
# Basic deps
BuildRequires: pkgconfig(xkbcommon) >= 0.5.0
BuildRequires: pkgconfig(wayland-server) >= %{waylandminver}
BuildRequires: pkgconfig(wayland-client) >= %{waylandminver}
BuildRequires: pkgconfig(pixman-1) >= 0.25.2
BuildRequires: pkgconfig(libinput) >= 1.2.0 pkgconfig(libevdev)
BuildRequires: pkgconfig(libdrm) >= 2.4.108
BuildRequires: pkgconfig(lcms2) >= 2.9
# protocol
BuildRequires: pkgconfig(wayland-protocols) >= 1.31
# shared
BuildRequires: pkgconfig(cairo) pkgconfig(pangocairo)
BuildRequires: pkgconfig(glib-2.0) >= 2.36
BuildRequires: pkgconfig(libpng) pkgconfig(libjpeg) pkgconfig(libwebp)
# libweson
BuildRequires: pkgconfig(egl)
BuildRequires: pkgconfig(libseat) >= 0.4
BuildRequires: pkgconfig(libsystemd) >= 209
BuildRequires: pkgconfig(dbus-1) >= 1.6
BuildRequires: pkgconfig(libudev) >= 136
BuildRequires: pam-devel
# libweson/renderer-gl
BuildRequires: pkgconfig(glesv2)
BuildRequires: libglvnd-compat-devel
# libweson/backend-drm
BuildRequires: pkgconfig(gbm) >= 21.1.1
BuildRequires: pkgconfig(libva) >= 0.34.0 pkgconfig(libva-drm) >= 0.34.0
# libweson/backend-pipewire
BuildRequires: pkgconfig(libpipewire-0.3) pkgconfig(libspa-0.2)
# libweson/backend-rdp
BuildRequires: pkgconfig(freerdp2) >= 2.3.0 pkgconfig(freerdp-server2) >= 2.3.0
BuildRequires: pkgconfig(winpr2) >= 2.3.0
# libweson/backend-vnc
### BuildRequires: pkgconfig(neatvnc) >= 0.7.0 pkgconfig(neatvnc) < 0.8.0
### BuildRequires: pkgconfig(aml) >= 0.3.0 pkgconfig(aml) < 0.4.0
# libweson/backend-wayland
BuildRequires: pkgconfig(wayland-egl) pkgconfig(wayland-cursor)
# libweson/backend-x11
BuildRequires: pkgconfig(xcb) >= 1.8
BuildRequires: pkgconfig(xcb-shm) pkgconfig(x11) pkgconfig(x11-xcb)
BuildRequires: pkgconfig(xcb-xkb) >= 1.9
# xwayland
BuildRequires: pkgconfig(xcb-composite) pkgconfig(xcb-shape) pkgconfig(xcb-xfixes)
BuildRequires: pkgconfig(xcursor) pkgconfig(cairo-xcb)
# compositor
BuildRequires: pkgconfig(lcms2)
# remoting
BuildRequires: pkgconfig(gstreamer-1.0) pkgconfig(gstreamer-allocators-1.0)
BuildRequires: pkgconfig(gstreamer-app-1.0) pkgconfig(gstreamer-video-1.0)
BuildRequires: pkgconfig(gobject-2.0)
# pipewire
#BuildRequires: pkgconfig(libpipewire-0.3) pkgconfig(libspa-0.2)
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://gitlab.freedesktop.org/wayland/weston/-/releases/%{realver}/downloads/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
Weston is the reference implementation of a Wayland compositor, and a
useful compositor in its own right.  Weston has various backends that
lets it run on Linux kernel modesetting and evdev input as well as
under X11.  Weston ships with a few example clients, from simple
clients that demonstrate certain aspects of the protocol to more
complete clients and a simplistic toolkit.  There is also a quite
capable terminal emulator (weston-terminal) and an toy/example desktop
shell.  Finally, weston also provides integration with the Xorg server
and can pull X clients into the Wayland desktop and act as an X window
manager.

%package -n libweston%{?lib_gen}%{?so_ver}
Group:         System/Libraries
Summary:       Re-usable parts of Weston

%description -n libweston%{?lib_gen}%{?so_ver}
Libweston is an effort to separate the re-usable parts of Weston into
a library. Libweston provides most of the boring and tedious bits of
correctly implementing core Wayland protocols and interfacing with
input and output systems, so that people who just want to write a new
"Wayland window manager" (WM) or a small desktop environment (DE) can
focus on the WM part.

%package clients
Group:         System/X11/Utilities
Summary:       Demo clients for Weston
Requires:      %{name} = %{version}

%description clients
Demo clients for Weston

%package devel
Group:         Development/Languages/C and C++
Summary:       Files needed for development using Weston libraries
Requires:      libweston%{?lib_gen}%{?so_ver} = %{version}
Requires:      libweston-desktop%{?lib_gen}%{?so_ver} = %{version}
Provides:      libweston-devel = %{version}
Provides:      libweston-desktop-devel = %{version}

%description devel
Files needed for development using Weston libraries

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
## %{__sed} -i 's|fcntl\.h|linux/fcntl.h|' shared/os-compatibility.c
# Disable tests
%{__sed} -i '/^subdir.*tests/d' meson.build

%build
_CFLAGS='%{optflags}'
_LDFLAGS='-Wl,--strip-all -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro'
meson setup build \
 --buildtype=release \
 --strip \
 --optimization=2 \
 \
 --prefix=%{_prefix} \
 --libexecdir=%{_libexecdir} \
 --default-library=shared \
 \
 -Dbackend-vnc=false \
 -Dsimple-clients="[ 'damage', 'im', 'egl', 'shm', 'touch', 'dmabuf-v4l', 'dmabuf-egl' ]" \
 -Dtest-junit-xml=false \
 -Ddoc=false \
 \
 -Db_lto=%{?gcc_lto:true}%{!?gcc_lto:false} \
 -Db_ndebug=if-release \
 -Dc_args="$_CFLAGS" \
 -Dc_link_args="$_LDFLAGS"
ninja -v -C build %{?_smp_mflags}

%install
DESTDIR=%{buildroot} ninja -C build install

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc COPYING README.md
# compositor
%{_bindir}/weston
# wcap
%{_bindir}/wcap-decode
# clients - tools
%{_bindir}/weston-calibrator
%{_bindir}/weston-debug
%{_bindir}/weston-terminal
%{_bindir}/weston-touch-calibrator
%dir %{_libdir}/weston
%{_libdir}/weston/*.so
%{_libdir}/weston/libexec_weston.so.%{?so_ver}*
# shell-desktop
%{_libexecdir}/weston-keyboard
%{_libexecdir}/weston-desktop-shell
# shell-ivi
%{_libexecdir}/weston-ivi-shell-user-interface
%dir %{_datadir}/wayland-sessions
%{_datadir}/wayland-sessions/weston.desktop
%dir %{_datadir}/weston
%{_datadir}/weston/*
%doc %{_mandir}/man1/weston.1*
%doc %{_mandir}/man1/weston-debug.1*
%doc %{_mandir}/man5/weston.ini.5*
%doc %{_mandir}/man7/weston-bindings.7*
%doc %{_mandir}/man7/weston-drm.7*
%doc %{_mandir}/man7/weston-rdp.7*

%files -n libweston%{?lib_gen}%{?so_ver}
%defattr(-,root,root)
%doc COPYING README.md
%{_libdir}/libweston-%{gen}.so.%{?so_ver}*
%dir %{_libdir}/libweston-%{gen}
%dir %{_datadir}/libweston-%{gen}
%{_libdir}/libweston-%{gen}/*.so
%{_datadir}/libweston-%{gen}/protocols/*.xml

%files clients
%defattr(-,root,root)
%doc COPYING README.md
# simple-clients
%{_bindir}/weston-simple-damage
%{_bindir}/weston-simple-dmabuf-egl
%{_bindir}/weston-simple-dmabuf-v4l
%{_bindir}/weston-simple-egl
%{_bindir}/weston-simple-shm
%{_bindir}/weston-simple-touch
%{_libexecdir}/weston-simple-im
# demo-clients
%{_bindir}/weston-clickdot
%{_bindir}/weston-cliptest
%{_bindir}/weston-content_protection
%{_bindir}/weston-constraints
%{_bindir}/weston-dnd
%{_bindir}/weston-editor
%{_bindir}/weston-eventdemo
%{_bindir}/weston-flower
%{_bindir}/weston-fullscreen
%{_bindir}/weston-image
%{_bindir}/weston-multi-resource
%{_bindir}/weston-presentation-shm
%{_bindir}/weston-resizor
%{_bindir}/weston-scaler
%{_bindir}/weston-smoke
%{_bindir}/weston-stacking
%{_bindir}/weston-subsurfaces
%{_bindir}/weston-tablet
%{_bindir}/weston-transformed
# shell-desktop
%{_bindir}/weston-screenshooter

%files devel
%defattr(-,root,root)
%doc COPYING README.md
%{_libdir}/pkgconfig/*.pc
%{_datadir}/pkgconfig/*.pc
%dir %{_includedir}/libweston-%{gen}/libweston
%dir %{_includedir}/libweston-%{gen}
%dir %{_includedir}/weston
%{_includedir}/libweston-%{gen}/libweston/*.h
%{_includedir}/weston/*.h
%{_libdir}/*.so
%{_datadir}/libweston-%{gen}/protocols/weston-debug.xml

%post   -n libweston%{?lib_gen}%{?so_ver} -p /sbin/ldconfig
%postun -n libweston%{?lib_gen}%{?so_ver} -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by