File minetest.spec of Package minetest
#
# spec file for package minetest
#
# 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/
#
%define minetestuser %{name}
%define minetestgroup %{name}
%if 0%{?suse_version} >= 1500 || (0%{?sle_version} > 120100 && 0%{?is_opensuse})
%bcond_without leveldb
%bcond_without redis
%bcond_without postgresql
%else
%bcond_with leveldb
%bcond_with redis
%bcond_with postgresql
%endif
Name: minetest
Version: 0.4.17.1
Release: 0
Summary: A InfiniMiner/Minecraft inspired game
License: LGPL-2.1-or-later AND CC-BY-SA-3.0
Group: Amusements/Games/3D/Simulation
URL: https://minetest.net/
Source: https://github.com/minetest/%{name}/archive/%{version}/%{name}-%{version}.tar.gz
Source1: minetest-rpmlintrc
Source2: minetest@.service
# PATCH-FEATURE-OPENSUSE shared_mods.patch -- Search also /usr/share/minetest for mods
Patch0: shared_mods.patch
BuildRequires: cmake
BuildRequires: desktop-file-utils
BuildRequires: doxygen
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: gettext-tools
BuildRequires: gmp-devel
BuildRequires: google-arimo-fonts
BuildRequires: google-cousine-fonts
BuildRequires: google-droid-fonts
BuildRequires: hicolor-icon-theme
BuildRequires: irrlicht-devel
BuildRequires: libjpeg-devel
BuildRequires: ncurses-devel
BuildRequires: pkgconfig
BuildRequires: systemd-rpm-macros
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(bzip2)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(gl)
BuildRequires: pkgconfig(jsoncpp)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(luajit)
BuildRequires: pkgconfig(openal)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(vorbis)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(zlib)
Requires: %{name}-data = %{version}
Requires: opengl-games-utils
Recommends: %{name}-lang
Recommends: minetest-game
%if %{with leveldb}
BuildRequires: leveldb-devel
%endif
%if %{with redis}
%if 0%{?suse_version} >= 1500
BuildRequires: pkgconfig
BuildRequires: pkgconfig(hiredis)
%else
# Workaraund a bug in hiredis dependencies.
BuildRequires: hiredis-devel
%if 0%{?suse_version} <= 1320 && 0%{?sle_version} < 120000
BuildRequires: libhiredis0_10
%endif
%endif
%endif
%if %{with postgresql}
BuildRequires: postgresql-devel
%endif
%description
An infinite-world block sandbox game and a game engine, inspired by
InfiniMiner, Minecraft and the like.
%lang_package
%package -n %{name}server
Summary: Minetest server
License: LGPL-2.1-or-later
Group: Amusements/Games/3D/Simulation
Requires: %{name}-data = %{version}
Requires(pre): shadow
Recommends: minetest-game
%{?systemd_requires}
%description -n %{name}server
An infinite-world block sandbox game and a game engine, inspired by
InfiniMiner, Minecraft and the like.
This package contains a minetest server.
%package data
Summary: Minetest shared data
License: LGPL-2.1-or-later AND CC-BY-SA-3.0
Group: Amusements/Games/3D/Simulation
Requires: google-arimo-fonts
Requires: google-cousine-fonts
Requires: google-droid-fonts
BuildArch: noarch
%description data
An infinite-world block sandbox game and a game engine, inspired by
InfiniMiner, Minecraft and the like.
This package contains data for minetest and minetestserver.
%prep
%setup -q
%patch0 -p1
# Purge bundled jsoncpp and lua.
rm -rf src/json src/lua src/gmp
%build
%cmake \
-DCUSTOM_DOCDIR="%{_docdir}/%{name}" \
-DCUSTOM_LOCALEDIR="%{_datadir}/locale" \
-DCUSTOM_SHAREDIR="%{_datadir}/%{name}" \
-DBUILD_SERVER=ON \
-DRUN_IN_PLACE=OFF \
-DENABLE_GETTEXT=ON \
-DENABLE_FREETYPE=ON \
-DENABLE_SYSTEM_JSONCPP=ON \
-DPNG_PNG_INCLUDE_DIR=$(pkg-config libpng --variable=includedir) \
%if %{with leveldb}
-DENABLE_LEVELDB=ON \
%else
-DENABLE_LEVELDB=OFF \
%endif
%if %{with redis}
-DENABLE_REDIS=ON \
%else
-DENABLE_REDIS=OFF \
%endif
%if %{with postgresql}
-DENABLE_POSTGRESQL=ON
%else
-DENABLE_POSTGRESQL=OFF
%endif
make %{?_smp_mflags} V=1
%install
%cmake_install
# Install the wrapper.
ln -s opengl-game-wrapper.sh %{buildroot}%{_bindir}/%{name}-wrapper
sed -i 's/^Exec=.*$/Exec=%{name}-wrapper/' \
%{buildroot}%{_datadir}/applications/net.minetest.minetest.desktop
%suse_update_desktop_file -r net.minetest.minetest Game Simulation
# Replace fonts with symlinks (we use the system ones).
for font in Arimo-Regular Cousine-Regular DroidSansFallbackFull; do
rm %{buildroot}%{_datadir}/%{name}/fonts/$font.ttf
ln -s %{_datadir}/fonts/truetype/$font.ttf \
%{buildroot}%{_datadir}/%{name}/fonts/$font.ttf
done
# Clean up.
rm %{buildroot}%{_datadir}/minetest/client/serverlist/.gitignore
%fdupes %{buildroot}%{_datadir}/
install -Dpm 0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}@.service
install -Dpm 0644 minetest.conf.example \
%{buildroot}%{_sysconfdir}/%{name}/minetest.conf.example
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/
%find_lang %{name}
%post
desktop-file-validate %{_datadir}/applications/net.minetest.minetest.desktop
%if 0%{?suse_version} < 1500
%desktop_database_post
%icon_theme_cache_post
%endif
%if 0%{?suse_version} < 1500
%postun
%desktop_database_postun
%icon_theme_cache_postun
%endif
%pre -n %{name}server
getent group %{name} > /dev/null || %{_sbindir}/groupadd -r %{minetestgroup}
getent passwd %{name} > /dev/null || \
%{_sbindir}/useradd -r -g %{minetestgroup} -d %{_localstatedir}/lib/%{name} \
-s /sbin/nologin -c "user for %{name}server" %{minetestuser}
%service_add_pre %{name}@.service
%post -n %{name}server
%service_add_post %{name}@.service
%preun -n %{name}server
%service_del_preun %{name}@.service
%postun -n %{name}server
%service_del_postun %{name}@.service
%files
%{_bindir}/%{name}
%{_bindir}/%{name}-wrapper
%{_datadir}/applications/net.minetest.minetest.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%dir %{_datadir}/metainfo/
%{_datadir}/metainfo/*%{name}.appdata.xml
%{_mandir}/man6/%{name}.6%{?ext_man}
%files lang -f %{name}.lang
%files -n %{name}server
%{_bindir}/%{name}server
%attr(0755,%{minetestuser},%{minetestgroup}) %{_localstatedir}/lib/%{name}/
%{_mandir}/man6/%{name}server.6%{?ext_man}
%dir %{_sysconfdir}/%{name}
%config %{_sysconfdir}/%{name}/minetest.conf.example
%{_unitdir}/%{name}@.service
%files data
%doc CONTRIBUTING.md README.txt
%doc %{_docdir}/%{name}/
%{_datadir}/%{name}/
%changelog