File Minecraft.spec of Package Minecraft

#
# spec file for package Minecraft
#
# Copyright (c) 2016 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:           Minecraft
Version:        latest
Release:        6.1
Summary:        Game Launcher and Downloader
License:        SUSE-NonFree and CC-BY-SA-3.0
Group:          Amusements/Games/3D/Other
Url:            https://minecraft.net
Source0:        http://s3.amazonaws.com/Minecraft.Download/launcher/Minecraft.jar
# https://commons.wikimedia.org/wiki/File:Minecraft_cube.svg
Source1:        Minecraft.svg
# https://account.mojang.com/documents/minecraft_eula
Source3:        LICENSE
BuildRequires:  ImageMagick
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
Requires:       java-1_8_0-openjdk
#Requires:       jre >= 1.7
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Packager:  Alessandro de Oliveira Faria (A.K.A CABELO) <cabelo@opensuse.org>

%description
Minecraft is an open-world, sandbox construction game.
This package only contains the Minecraft Downloader and Launcher,
in order to play the game you need a valid game account.

%prep
cp "%{_sourcedir}/"* .

%build

%install
# Install launcher
install -D -m644 Minecraft.jar "%{buildroot}%{_datadir}/%{name}/Minecraft.jar"

# Install wrapper
cat > %{name} << 'EOF'
#!/bin/sh
java -jar %{_datadir}/%{name}/%{name}.jar \${@}

EOF
install -D -m755 %{name} "%{buildroot}%{_bindir}/%{name}"

# Create and install icons
install -D -m644 %{name}.svg "%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg"
for si in 16 32 64 128 256; do
    pa="%{buildroot}%{_datadir}/icons/hicolor/$si"x"$si/apps/"
    mkdir -p "$pa"
    convert -strip -density 200 "%{name}.svg" -resize "$si"x"$si" -transparent white "$pa/%{name}.png"
done

# Install desktop file
%suse_update_desktop_file -c %{name} Minecraft "Minecraft Launcher" Minecraft Minecraft Game AdventureGame
rm -rf %{buildroot}%{_datadir}/pixmaps

%post
%desktop_database_post
%icon_theme_cache_post

echo "
*** NOTE ***
This package contains the launcher for the full version of Minecraft.
In order to play the game you need a valid account.
If you do not have one, you can create one and buy the game on:

http://minecraft.net

---"

%postun
%desktop_database_postun
%icon_theme_cache_postun

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

%changelog
* Wed Apr  6 2016 bwiedemann@suse.com
- Fix build-compare by dropping timestamp from png
* Tue Mar 22 2016 rpm@fthiessen.de
- Initial package
- Icon from wikimedia commons (Public Domain / CC-BY-SA 3.0)
openSUSE Build Service is sponsored by