File freeminer.spec of Package freeminer
#
# spec file for package freeminer
#
# Copyright (c) 2021 SUSE LLC
#
# 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 freemineruser %{name}
%define freeminergroup %{name}
%define _lto_cflags -flto=thin\ -fuse-ld=gold
%bcond_without leveldb
%bcond_without redis
Name: freeminer
Version: 0.4.14.8+git20210402
Release: 0
Summary: Sandbox game inspired by Minecraft
License: CC-BY-SA-3.0 AND GPL-3.0-or-later
Group: Amusements/Games/3D/Simulation
URL: https://freeminer.org/
Source: %{name}-%{version}.tar.xz
Source1: freeminer@.service
BuildRequires: binutils-gold
BuildRequires: clang
BuildRequires: cmake
BuildRequires: desktop-file-utils
BuildRequires: doxygen
BuildRequires: fdupes
BuildRequires: gettext-tools
BuildRequires: gmp-devel
BuildRequires: hicolor-icon-theme
BuildRequires: irrlicht-devel
BuildRequires: libXxf86vm-devel
BuildRequires: libjpeg-devel
BuildRequires: llvm-gold
BuildRequires: ncurses-devel
BuildRequires: pkgconfig
BuildRequires: snappy-devel
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(libenet)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(libspatialindex)
BuildRequires: pkgconfig(luajit)
BuildRequires: pkgconfig(msgpack) >= 2
BuildRequires: pkgconfig(openal)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(vorbis)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(zlib)
Requires: %{name}-data = %{version}
Requires(pre): %{_sbindir}/groupadd
Requires(pre): %{_sbindir}/useradd
Recommends: %{name}-lang
Recommends: freeminer-default
Recommends: freeminer-pixture
%if %{with leveldb}
BuildRequires: leveldb-devel
%endif
%if %{with redis}
BuildRequires: pkgconfig(hiredis)
%endif
%description
Freeminer is based on Minetest. It aims to make the game fun while trading off some bits of perfectionism.
%package -n %{name}server
Summary: Freeminer server
Group: Amusements/Games/3D/Simulation
Requires: %{name}-data = %{version}
%{?systemd_requires}
%description -n %{name}server
Freeminer is based on Minetest. It aims to make the game fun while trading off some bits of perfectionism.
This package contains a freeminer server.
%package data
Summary: Freeminer shared data
Group: Amusements/Games/3D/Simulation
BuildArch: noarch
%description data
Freeminer is based on Minetest. It aims to make the game fun while trading off some bits of perfectionism.
This package contains data for %{name} and %{name}server.
%lang_package
%prep
%setup -q
%build
%cmake \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SERVER=ON \
-DRUN_IN_PLACE=OFF \
-DENABLE_GETTEXT=ON \
-DENABLE_FREETYPE=ON \
-DENABLE_SYSTEM_JSONCPP=ON \
-DENABLE_SYSTEM_MSGPACK=ON \
%if %{with leveldb}
-DENABLE_LEVELDB=1 \
%endif
%if %{with redis}
-DENABLE_REDIS=1 \
%endif
-DCUSTOM_LOCALEDIR=%{_datadir}/locale
make %{?_smp_mflags} VERBOSE=1
%install
%cmake_install
%suse_update_desktop_file -r %{name} Game Simulation
# Clean up
rm -rf %{buildroot}%{_datadir}/minetest/client/serverlist/.gitignore
%fdupes %{buildroot}%{_datadir}
install -m 0644 -D %{SOURCE1} %{buildroot}%{_unitdir}/%{name}@.service
install -m 0644 -D %{name}.conf.example %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf.example
install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name}
%find_lang %{name}
%files lang -f %{name}.lang
%pre -n %{name}server
getent group %{name} >/dev/null || %{_sbindir}/groupadd -r %{freeminergroup}
getent passwd %{name} >/dev/null || %{_sbindir}/useradd -r -g %{freeminergroup} -d %{_localstatedir}/lib/%{name} -s /sbin/nologin -c "user for %{name}server" %{freemineruser}
%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}
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/128x128/apps/freeminer.png
%{_datadir}/icons/hicolor/scalable/apps/freeminer.svg
%{_mandir}/man6/%{name}.6%{?ext_man}
%files -n %{name}server
%{_bindir}/%{name}server
%attr(0755,%{freemineruser},%{freeminergroup}) %{_localstatedir}/lib/%{name}/
%{_mandir}/man6/%{name}server.6%{?ext_man}
%dir %{_sysconfdir}/%{name}
%config %{_sysconfdir}/%{name}/%{name}.conf.example
%{_unitdir}/%{name}@.service
%files data
%{_datadir}/%{name}/
%{_datadir}/doc/%{name}/
%changelog