File spnavcfg.spec of Package spnavcfg
#
# spec file for package spnavcfg
#
# Copyright (c) 2018 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: spnavcfg
Version: 0.3
Release: 0
Summary: Spacenav interactive configuration program
Group: Hardware/Joystick
License: GPL-3.0+
URL: http://spacenav.sourceforge.net/
Source0: http://downloads.sourceforge.net/spacenav/%{name}-%{version}.tar.gz
Source1: %{name}.desktop
Source2: %{name}-rpmlintrc
Patch0: %{name}-0.3-icon-link-target.patch
PreReq: permissions
BuildRequires: libX11-devel
BuildRequires: gtk2-devel
BuildRequires: desktop-file-utils
Requires: spacenavd
%description
Spacenav interactive configuration program for spacenavd.
%prep
%setup -q -n %{name}-%{name}-%{version}
%patch0 -p1
%build
export CFLAGS="%{optflags} -fpie" LDFLAGS="-pie"
%configure --prefix=/usr
# Patch makefile to honor CFLAGS
sed -i 's/CFLAGS =/CFLAGS +=/g' Makefile
# Patch makefile to honor LDFLAGS
sed -i 's/LDFLAGS =/LDFLAGS +=/g' Makefile
# Remove -O3 from build flags
sed -i 's/\-O3//g' Makefile
# Patch makefile to fix missing parameter LDFLAGS
sed -i 's/pkg-config --libs gtk+-2.0/pkg-config --libs gtk+-2.0 x11/g' Makefile
make %{?_smp_mflags}
%install
%makeinstall
mkdir -p %{buildroot}%{_datadir}/applications
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
mkdir -p %{buildroot}/etc/permissions.d
cat > %{buildroot}/etc/permissions.d/%{name} << EOF
/usr/bin/spnavcfg root:root 4755
EOF
sed 's/4755/0755/' %{buildroot}/etc/permissions.d/%{name} > \
%{buildroot}/etc/permissions.d/%{name}.paranoid
%post
/bin/touch --no-create %{_datadir}/icons/hicolor >/dev/null 2>&1 || :
/usr/bin/update-desktop-database > /dev/null 2>&1 || :
%set_permissions /usr/bin/spnavcfg
%verifyscript
%verify_permissions -e /usr/bin/spnavcfg
%postun
if [ $1 -eq 0 ] ; then
/bin/touch --no-create %{_datadir}/icons/hicolor >/dev/null 2>&1
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor >/dev/null 2>&1 || :
fi
/usr/bin/update-desktop-database > /dev/null 2>&1 || :
%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor >/dev/null 2>&1 || :
%files
%doc COPYING README
%verify(not mode caps) %attr(4755,root,root) /usr/bin/spnavcfg
/etc/permissions.d/%{name}*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/pixmaps/%{name}-*.png
%changelog