File stepmania.spec of Package stepmania

#
# spec file for package stepmania
#
# Copyright (c) 2019 SUSE LINUX 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 https://bugs.opensuse.org/
#


%define vers 5.1.0
%define subversion b2
Name:           stepmania
Version:        %{vers}%{subversion}
Release:        0
Summary:        Music/rhythm game
License:        MIT
Group:          Amusements/Games/Action/Arcade
URL:            https://www.stepmania.com/
Source:         https://github.com/stepmania/stepmania/archive/v%{version}/%{name}-%{vers}-%{subversion}.tar.gz
# PATCH-FIX-OPENSUSE: Fixes cmake for using only system libraries, fix datadir and buildversion
Patch0:         PATCH-FIX-OPENSUSE-cmake.patch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  glu-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libudev-devel
BuildRequires:  pkgconfig
BuildRequires:  yasm
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(bzip2)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(jack)
BuildRequires:  pkgconfig(libpng16)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libva)
BuildRequires:  pkgconfig(mad)
BuildRequires:  pkgconfig(ogg)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(xrandr)
BuildRequires:  pkgconfig(zlib)
Requires:       %{name}-data = %{version}
%if 0%{?suse_version}
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
Requires(post): update-desktop-files
Requires(postun): update-desktop-files
%endif

%description
StepMania is a music/rhythm game. The player presses different buttons
in time to the music and to note patterns that scroll across the screen.
Features 3D graphics, visualizations, support for gamepads/dance pads,
a step recording mode, and more!

%package        data
Summary:        Data files for StepMania
BuildArch:      noarch

%description    data
This package contains arch-independent data files to be used with StepMania.

%prep
%setup -q -n %{name}-%{vers}-%{subversion}
%patch0 -p1
# Make sure to use system libraries
rm -rf extern/{glew-1.5.8,ffmpeg,libjpeg,libpng,mad-0.15.1b,newogg,newvorbis,zlib}

%build
mkdir build && cd build
# NOTE that %%cmake macro breaks linking.
cmake .. \
    -DWITH_FULL_RELEASE=ON \
    -DWITH_FFMPEG=OFF \
    -DWITH_PARALLEL_PORT=ON \
    -DWITH_LTO=ON \
    -DWITH_MP3=ON \
    -DWITH_SYSTEM_GLEW=ON
make %{?_smp_mflags}

%install
install -D -m 0755 %{name} %{buildroot}%{_bindir}/%{name}
install -D -m 0755 GtkModule.so %{buildroot}%{_libdir}/%{name}-GtkModule.so

# Data
mkdir -p %{buildroot}%{_datadir}/%{name}/{Announcers,BackgroundTransitions,Characters,Data,NoteSkins,Songs,Themes,BackgroundEffects,BGAnimations,Courses,Scripts,Packages}
cp -a Announcers BackgroundTransitions Characters Data NoteSkins Songs Themes \
      BackgroundEffects BGAnimations Courses Scripts \
      %{buildroot}%{_datadir}/%{name}/
%fdupes %{buildroot}%{_datadir}/%{name}

# Icons
install -d %{buildroot}/%{_datadir}/icons
cp -a icons/hicolor %{buildroot}%{_datadir}/icons

# Desktop entry
install -d %{buildroot}%{_datadir}/applications
cat << EOF > %{buildroot}%{_datadir}/applications/%{name}.desktop
[Desktop Entry]
Name=StepMania
GenericName=Rhythm game
Comment=%{summary}
Exec=%{name}
Icon=%{name}-ssc
Categories=Game;ArcadeGame;
Type=Application
EOF

%suse_update_desktop_file %{name} Game ArcadeGame

%if 0%{?is_opensuse} && 0%{?sle_version} <= 120300
%post
%desktop_database_post
%endif

%if 0%{?is_opensuse} && 0%{?sle_version} <= 120300
%postun
%desktop_database_postun
%endif

%files
%license Docs/Licenses.txt
%doc README.md Manual/ Docs/{credits.txt,CommandLineArgs.txt,Changelog_sm5.txt}
%{_bindir}/%{name}
%{_libdir}/%{name}-GtkModule.so
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}-ssc.*

%files data
%{_datadir}/%{name}/

%changelog
openSUSE Build Service is sponsored by