File libwacom.spec of Package libwacom
%define realname libwacom
%define realver 2.5.0
%define srcext tar.gz
%define so_ver 9
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
%if ! %{defined _udevrulesdir}
%define _udevrulesdir /etc/udev/rules.d
%endif
%if 0%{?rhel} >= 8
%define python3_pkg platform-python
%define python3 %{_libexecdir}/platform-python
%else
%define python3_pkg python3
%define python3 %{_bindir}/python3
%endif
# Common info
Name: %{realname}%{?so_ver}
Version: %{realver}
Release: wiz%{?extraver:0.}1%{?dist}
License: GPL-2.0
Group: System/Libraries
URL: https://github.com/linuxwacom/libwacom
Summary: Tablet description library
# Install-time parameters
Requires: %{realname}-data
# Build-time parameters
BuildRequires: meson >= 0.51.0 ninja
BuildRequires: %{python3_pkg}
BuildRequires: pkg-config
BuildRequires: pkgconfig(glib-2.0) pkgconfig(gudev-1.0)
BuildRequires: doxygen
BuildRoot: %{_tmppath}/%{name}-root
Source: https://github.com/linuxwacom/libwacom/archive/refs/tags/libwacom-%{version}%{?extraver}.%{srcext}#/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
libwacom is a library to identify Wacom tablets and their model-specific
features. It provides easy access to information such as "is this a built-in
on-screen tablet", "what is the size of this model", etc.
%package -n %{realname}-devel
Group: Development/Languages/C and C++
Summary: Development files for %{name}
Requires: %{name} = %{version}-%{release}
Provides: %{name}-devel = %{version}-%{release}
%description -n %{realname}-devel
Development files for %{name}
%package -n %{realname}-tools
Group: Hardware/Other
Summary: Tools for configuring and running Wacom tablets
%description -n %{realname}-tools
libwacom is a library to identify Wacom tablets and their model-specific
features. It provides easy access to information such as "is this a built-in
on-screen tablet", "what is the size of this model", etc.
This package contains tools to identify and configure Wacom tablets.
%package -n %{realname}-data
Group: Hardware/Other
Summary: Tablets configuration data
BuildArch: noarch
%description -n %{realname}-data
Tablets configuration data
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-libwacom-%{version}%{?extraver}
%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} \
--libdir=%{_libdir} \
--default-library=shared \
\
-Ddocumentation=enabled \
-Dudev-dir=$(dirname %{_udevrulesdir}) \
-Dtests=disabled \
\
-Db_lto=true \
-Db_ndebug=if-release \
-Dc_args="$_CFLAGS" \
-Dc_link_args="$_LDFLAGS"
ninja -v -C build %{?_smp_mflags}
%install
DESTDIR=%{buildroot} ninja -v -C build install
# Fix shebang
%{__sed} -ri '1 s|^#!/usr/bin/env python.*$|#!%{python3}|' %{buildroot}%{_bindir}/libwacom-*
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%license COPYING
%doc NEWS README.md
%{_libdir}/%{realname}.so.%{?so_ver}*
%{_udevrulesdir}/65-libwacom.rules
%{_udevhwdbdir}/65-libwacom.hwdb
# Data
%files -n %{realname}-data
%defattr(-,root,root)
%license COPYING
%doc NEWS README.md
%dir %{_datadir}/%{realname}/
%{_datadir}/%{realname}/*
# Development stuff
%files -n %{realname}-devel
%defattr(-,root,root)
%license COPYING
%doc NEWS README.md
%{_libdir}/pkgconfig/%{realname}.pc
%dir %{_includedir}/%{realname}-1.0/%{realname}
%dir %{_includedir}/%{realname}-1.0
%{_includedir}/%{realname}-1.0/%{realname}/libwacom.h
%{_libdir}/%{realname}.so
%exclude %{_libdir}/*.la
# Tools
%files -n %{realname}-tools
%defattr(-,root,root)
%license COPYING
%doc NEWS README.md
%{_bindir}/libwacom-*
%{_mandir}/man1/libwacom-*
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog