File planets.spec of Package planets

#
# spec file for package planets
#
# Copyright © 2002 Yaron M. Minsky <yminsky@cs.cornell.edu>
# Copyright © 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright © 2018–2019 Markus S. <kamikazow@opensuse.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

Name:             planets
Version:          0.1.13
Release:          0
Summary:          A simple and fun planetary simulator
License:          GPL-2.0-or-later
Group:            System/GUI/Other
Url:              https://github.com/yminsky/planets
Source0:          %{name}-%{version}.tar.bz2
# https://gitlab.com/KAMiKAZOW/planets-icon/
Source1:          planets_icon_by_KMi_CC-BY-SA-4.0.svg
# PATCH-FIX-DEBIAN -- Fix buildflags
Patch0:           planets-0.1.13-buildflags.patch
# PATCH-FIX-DEBIAN -- Fix random_bodies string
Patch1:           planets-0.1.13-string_random_bodies.patch
# PATCH-FIX-DEBIAN -- Add German translation
Patch2:           planets-0.1.13-german_translation.patch
# PATCH-FIX-DEBIAN -- Fix Ocaml4 typing
Patch3:           planets-0.1.13-ocaml4_typing.patch
# PATCH-FIX-OPENSUSE -- Add missing entries to .desktop file
Patch4:           planets-0.1.13-desktop_file.patch
# PATCH-FIX-FEDORA -- Bytes.to_string
Patch5:           planets-0.1.13-bytes.patch
# PATCH-FIX-FEDORA -- camlp5o instead of camlp4o
Patch6:           planets-0.1.13-camlp5o.patch
BuildRequires:    hicolor-icon-theme
BuildRequires:    ocaml
BuildRequires:    ocaml-camlp5
BuildRequires:    ocaml-labltk-devel
BuildRequires:    tcl-devel
BuildRequires:    tk-devel
BuildRequires:    xorg-x11-devel
Requires:         hicolor-icon-theme

%description
Planets is a simple interactive program for playing with
simulations of planetary systems. The user interface is
aimed at being simple enough that a fairly young kid can get
some joy out of it but it is probably as much if not more
fun for adults.

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p0

%build
make %{?_smp_mflags} all

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/{applications,pixmaps}
mkdir -p %{buildroot}%{_mandir}/man1
%makeinstall PREFIX=%{buildroot}%{_prefix}
mkdir -p %{buildroot}/%_defaultdocdir/%{name}/examples/
install -m 644 uni.9 %{buildroot}%_defaultdocdir/%{name}/examples/
install -m 644 CHANGES codeguide.txt COPYING CREDITS getting_started.html KEYBINDINGS.txt LICENSE README* TODO VERSION %{buildroot}%_defaultdocdir/%{name}/

# Remove low quality icon
rm -rf %{buildroot}%{_datadir}/pixmaps

# Install SVG icon
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps
install -Dm 755 %{S:1} "%{buildroot}/%{_datadir}/icons/hicolor/scalable/apps/planets.svg"

find %{buildroot}%{_datadir} -type f -exec chmod 644 {} \;
chmod 644 %{buildroot}%{_mandir}/man1/*

%files
%defattr(-,root,root)
%doc %_defaultdocdir/%{name}/
%doc %{_mandir}/man1/*
%{_bindir}/*
%{_datadir}/applications/*
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg

%changelog
openSUSE Build Service is sponsored by