File jstest-gtk.spec of Package jstest-gtk-git

#
# spec file for package jstest-gtk
#
# Copyright (c) 2020 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:           jstest-gtk
# Version is set/replaced by OBS by a timestamp when using git
Version:        20220920T193535
Release:        0
Summary:        Small tool to test and calibrate joysticks
Group:          Hardware/Joystick
License:        GPL-3.0
URL:            https://github.com/Grumbel/jstest-gtk/
BuildRequires: gcc-c++
BuildRequires: expat
BuildRequires: hicolor-icon-theme
BuildRequires: xorg-x11-libX11-devel
BuildRequires: libexpat-devel
BuildRequires: libsigc++2-devel
BuildRequires: cmake
BuildRequires: pkg-config
BuildRequires: pkgconfig(gtkmm-3.0)
BuildRequires: update-desktop-files
%if 0%{?suse_version} <= 1210
# Only needed for openSUSE <= 12.1; later it is pulled in by rpm-build.
BuildRequires: xz
%endif
Recommends:    input-utils

Source:   %{name}-%{version}.tar.xz
#Source1:  %{name}.desktop
# Build patches are from Debian (debianized by Miriam Ruiz)
#Patch0:   %{name}-flags-from-env.patch
Patch1:   jstest-gtk-use-datadir.patch

%description
Jstest-gtk is a simple joystick tester based on Gtk+. It provides you
with a list of attached joysticks, a way to display which buttons and
axis are pressed, a way to remap axis and buttons and a way to
calibrate your joystick.

Even when your joystick is working mostly fine, you might want to
give it a try, as the calibration lets you get rid of overlarge
default deadzones that many joysticks use and which are a noticeable
problem in some games.

Using appropriate apps in addition to this one will allow
you to store your calibration settings and mappings and have the
automatically restored.

%prep
%setup -q
# Specify full path for joystick icon
%__sed -i 's|datadir("data/")|datadir("%{_datadir}/%{name}/")|' src/main.cpp

%build
cmake \
    -DCMAKE_INSTALL_PREFIX="%{_prefix}" \
    -DCMAKE_INSTALL_BINDIR="%{_bindir}" \
    -DCMAKE_INSTALL_LIBEXECDIR="%{_libexecdir}" \
    -DCMAKE_INSTALL_DATADIR="%{_datadir}" \
    -DCMAKE_INSTALL_MANDIR="%{_mandir}"
make %{?_smp_mflags}

%install
#make install
%__install -D -m 755 %{name} %{buildroot}%{_bindir}/%{name}
%__install -d %{buildroot}%{_datadir}/{%{name},icons/hicolor/scalable/apps,metainfo}
%__install -m 644 data/* %{buildroot}%{_datadir}/%{name}/
%__install -D -m 644 %{name}.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
%__install -D -m 644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
%__install -m 644 %{name}.appdata.xml %{buildroot}%{_datadir}/metainfo/%{name}.appdata.xml
%__install -D -m 644 %{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
#%__ln_s -T %{_datadir}/%{name}/data/generic.png %{buildroot}%{_datadir}/pixmaps/%{name}.png
%suse_update_desktop_file -r -G "Joystick testing and configuration tool" %{name} GTK Settings HardwareSettings

%files
#define the files that actually get included in the rpm
%defattr(-,root,root)
%doc COPYING NEWS README.md
%{_bindir}/js*
%{_mandir}/man?/js*
#{_libexecdir}/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/applications/%{name}.desktop
%dir %{_datadir}/metainfo/
%{_datadir}/metainfo/%{name}.appdata.xml

%changelog
openSUSE Build Service is sponsored by