File libwacom.spec of Package libwacom

%define realname libwacom
%define srcext   tar.bz2

%define so_ver   2

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

%if ! %{defined _udevrulesdir}
%define _udevrulesdir /etc/udev/rules.d
%endif

# Common info
Name:          %{realname}%{?so_ver}
Version:       0
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: autoconf automake libtool
BuildRequires: pkg-config
BuildRequires: pkgconfig(glib-2.0) pkgconfig(gudev-1.0)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(librsvg-2.0)
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: doxygen
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://sourceforge.net/projects/linuxwacom/files/libwacom/%{realname}-%{version}%{?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}-%{version}%{?extraver}
# Disable tests
%{__sed} -i '/^SUBDIRS/ s/ test//' Makefile.am
test -x configure || autoreconf --install

%build
%configure \
 --disable-static \
 --with-udev-dir=$(dirname %{_udevrulesdir}) \
 CFLAGS="%{optflags} %{?gcc_lto}" \
 LDFLAGS="-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,now -Wl,-z,relro %{?gcc_lto}"
%{__make} %{?_smp_mflags}

%install
%{__make} install DESTDIR=%{buildroot}

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

%files
%defattr(-,root,root)
%doc COPYING NEWS README.md
%{_libdir}/%{realname}.so.%{?so_ver}*
%{_udevrulesdir}/65-libwacom.rules

# Data
%files -n %{realname}-data
%defattr(-,root,root)
%doc COPYING NEWS README.md
%dir %{_datadir}/%{realname}/
%{_datadir}/%{realname}/*

# Development stuff
%files -n %{realname}-devel
%defattr(-,root,root)
%doc COPYING 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)
%doc COPYING NEWS README.md
%{_bindir}/libwacom-list-local-devices
%{_mandir}/man1/libwacom-list-local-devices.1*

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%changelog