File libinput.spec of Package libinput

%define realname libinput
%define realver  1.22.0
%define srcext   tar.bz2

%define so_ver   10

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

# Common info
Name:          %{realname}%{?so_ver}
Version:       %{realver}
Release:       %{?extraver:0.}1%{?dist}
License:       MIT
Group:         System/Libraries
URL:           https://www.freedesktop.org/wiki/Software/libinput/
Summary:       Input device management and event handling library

# Install-time parameters
Requires:      udev

# Build-time parameters
BuildRequires: meson ninja
BuildRequires: gcc-c++
BuildRequires: pkg-config
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(mtdev) >= 1.1.0
BuildRequires: pkgconfig(libevdev) >= 0.4
BuildRequires: pkgconfig(libwacom) >= 0.20
# For GUI event viewer
BuildRequires: pkgconfig(gtk+-3.0) >= 3.20
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(glib-2.0)
# Package 'libbrotlidec' is required by 'FreeType 2'
BuildRequires: pkgconfig(libbrotlidec)
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://gitlab.freedesktop.org/libinput/libinput/-/archive/%{realver}%{?extraver}/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
libinput is a library to handle input devices in Wayland compositors and to
provide a generic X.Org input driver. It provides device detection, device
handling, input device event processing and abstraction so minimize the amount
of custom input code compositors need to provide the common set of functionality
that users expect.

%package -n %{realname}-devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{name} = %{version}
Provides:      %{name}-devel = %{version}

%description -n %{realname}-devel
Development files for %{name}

%package -n %{realname}-tools
Group:         Hardware/Other
Summary:       Diagnostic tools for %{realname}

%description -n %{realname}-tools
libinput is a library to handle input devices in Wayland compositors and to
provide a generic X.Org input driver. It provides device detection, device
handling, input device event processing and abstraction so minimize the amount
of custom input code compositors need to provide the common set of functionality
that users expect.

This package provides diagnostic tools.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}

%build
export CFLAGS="%{optflags} %{?gcc_lto}"
export CXXFLAGS="%{optflags} %{?gcc_lto}"
export LDFLAGS="-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}"
meson \
 --prefix=%{_prefix} \
 --libexecdir=%{_libexecdir} \
 -Ddocumentation=false \
 -Dtests=false \
 builddir/
ninja -C builddir/

%install
DESTDIR=%{buildroot} \
 ninja -C builddir/ install
%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/libinput
# Fix shebang
[ "%{buildroot}" != "/" ] && %{__sed} -ri '1 s|/usr/bin/env python3|/usr/bin/python3|' %{buildroot}%{_libexecdir}/libinput/libinput-*

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

%files
%defattr(-,root,root)
%doc COPYING README.md
%{_libdir}/libinput.so.%{?so_ver}*
%dir /usr/lib/udev/rules.d
%dir /usr/lib/udev
/usr/lib/udev/rules.d/*.rules
/usr/lib/udev/libinput-*

# Development stuff
%files -n %{realname}-devel
%defattr(-,root,root)
%doc COPYING README.md
%{_libdir}/pkgconfig/libinput.pc
%{_includedir}/libinput.h
%{_libdir}/libinput.so

# Tools
%files -n %{realname}-tools
%defattr(-,root,root)
%doc COPYING README.md
%dir %{_sysconfdir}/libinput
%ghost %config(noreplace) %{_sysconfdir}/libinput/local-overrides.quirks
%{_bindir}/libinput*
%dir %{_libexecdir}/libinput
%{_libexecdir}/libinput/*
%dir %{_datadir}/libinput
%{_datadir}/libinput/*.quirks
%doc %{_mandir}/man1/*
# zsh pompletion ?
%dir %{_datadir}/zsh/site-functions
%dir %{_datadir}/zsh
%{_datadir}/zsh/site-functions/_libinput

%post
/sbin/ldconfig
udevadm control --reload

%postun
/sbin/ldconfig
udevadm control --reload

%changelog
openSUSE Build Service is sponsored by