File frogatto.spec of Package frogatto

#
# spec file for package frogatto
#
# Copyright (c) 2018 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 http://bugs.opensuse.org/
#


Name:           frogatto
Version:        1.3.1
Release:        0
Summary:        Action-adventure game starring a certain quixotic frog
License:        GPL-3.0+
Group:          Amusements/Games/Action/Arcade
Url:            http://www.frogatto.com
Source:         https://github.com/frogatto/frogatto/archive/1.3.1.zip
Patch0:         fix-makefile.patch
BuildRequires:  ImageMagick
%if 0%{?suse_version} > 1330
BuildRequires:  libboost_headers-devel
BuildRequires:  libboost_iostreams-devel
BuildRequires:  libboost_regex-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libboost_thread-devel
%else
BuildRequires:  boost-devel
%endif
BuildRequires:  fdupes
BuildRequires:  fontpackages-devel
BuildRequires:  freeglut-devel
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
BuildRequires:  ubuntu-fonts
BuildRequires:  unzip
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(SDL_image)
BuildRequires:  pkgconfig(SDL_mixer)
BuildRequires:  pkgconfig(SDL_ttf)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(sdl)
BuildRequires:  pkgconfig(zlib)
Requires:       frogatto-data
Requires:       ubuntu-fonts
Recommends:     frogatto-lang

%description
Frogatto is a "platformer" game, which means you are given a cross-section view into the world,
and you help a small green fellow named Frogatto walk and jump between solid footholds
whilst you lead him through his story.

%package data
Summary:        Data files for the frogatto action-adventure game
License:        SUSE-Freeware
Group:          Amusements/Games/Action/Arcade
BuildArch:      noarch

%description data
Frogatto is a "platformer" game, which means you are given a cross-section view into the world,
and you help a small green fellow named Frogatto walk and jump between solid footholds
whilst you lead him through his story.

This package contains the game data (music, images, etc.) which are distributed under a different
license than the game engine.

%lang_package

%prep
%setup -q
%patch0 -p1

rm -rf */MacOS*
rm -rf */modules/cube_trains/*
rm -rf */modules/frogatto/utils
find . -name music_aac -o -name music_aac_mini -o -name sounds_wav \
	-exec rm -R "{}" +

%build
export CXXFLAGS="%{optflags}"
make %{?_smp_mflags} game server

%install
%suse_update_desktop_file -c %{name} "Frogatto" "Arcade Game" %{name} %{name} Game ArcadeGame
for res in 256 128 96 64 32 24 16; do
    mkdir -p "%{buildroot}%{_datadir}/icons/hicolor/$res"x"$res/apps"
    convert modules/frogatto/images/os/frogatto-icon.png -resize "$res"x"$res" "%{buildroot}%{_datadir}/icons/hicolor/$res"x"$res/apps/%{name}.png"
done

# data
mkdir -p %{buildroot}%{_datadir}/frogatto/modules
mv modules/frogatto %{buildroot}%{_datadir}/frogatto/modules
mv data images music %{buildroot}%{_datadir}/frogatto
find %{buildroot}%{_datadir}/%{name} -type f -exec chmod 0644 \{\} +

# replace with system fonts
for file in UbuntuMono*ttf; do
    ln -s "%{_ttfontsdir}/$file" "%{buildroot}%{_datadir}/%{name}/$file"
done

# binaries
install -Dm 755 game %{buildroot}%{_libexecdir}/frogatto/game
install -Dm 755 server %{buildroot}%{_bindir}/frogatto-server

# wrapper script
cat >> %{buildroot}%{_bindir}/frogatto <<EOF
#!/bin/sh
cd %{_datadir}/%{name}
exec %{_libexecdir}/frogatto/game
EOF
chmod +x %{buildroot}%{_bindir}/frogatto

%fdupes %{buildroot}%{_datadir}/frogatto

%find_lang %{name}

# Remove Transifex configuration files
rm -rf %{buildroot}%{_datadir}/frogatto/modules/frogatto/.tx

%if 0%{?suse_version} < 1500
%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun
%endif

%files
%defattr(-,root,root)
%doc README LICENSE
%{_bindir}/frogatto*
%{_libexecdir}/frogatto/
%{_datadir}/frogatto/*ttf
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png

%files data
%defattr(-,root,root)
%dir %{_datadir}/frogatto
%{_datadir}/frogatto/data
%{_datadir}/frogatto/images
%{_datadir}/frogatto/music
%{_datadir}/frogatto/modules
%exclude %{_datadir}/frogatto/modules/frogatto/locale/*/*/*

%files lang -f %{name}.lang
%defattr(-,root,root)

%changelog
openSUSE Build Service is sponsored by