270 lines
7.9 KiB
RPMSpec

#
# spec file for package minetest on rpm based distros
#
# Copyright (c) 2022 PICCORO Lenz McKAY
#
Name: minetest
Group: Amusements/Games/3D/Simulation
Version: 5.6.1.9
Release: 0%{?dist}
Summary: minetest voxel game engine with easy modding and game creation
License: CC-BY-SA-3.0 AND LGPL-3-or-later
URL: https://minetest.world
Source0: %{name}_%{version}.orig.tar.gz
%if 0%{?rhel}
ExclusiveArch: %{ix86} x86_64
# LuaJIT arches
ExclusiveArch: %{arm} %{ix86} x86_64 %{mips} aarch64 ppc64le
%endif
BuildRequires: cmake
BuildRequires: pkgconfig systemd
%if 0%{?suse_version} > 1400
BuildRequires: update-desktop-files gettext-tools
%else
BuildRequires: desktop-file-utils
%endif
BuildRequires: doxygen
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: gmp-devel
BuildRequires: hicolor-icon-theme
BuildRequires: luajit-devel
BuildRequires: libXxf86vm-devel
BuildRequires: libpng-devel
%if 0%{?rhel}
BuildRequires: bzip2-devel gettext-devel sqlite-devel libzstd-devel
BuildRequires: libjpeg-turbo-devel mesa-libGL-devel
%else
BuildRequires: libjpeg-devel
%endif
BuildRequires: ncurses-devel
BuildRequires: spatialindex-devel
BuildRequires: systemd-rpm-macros
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(xi)
BuildRequires: pkgconfig(zlib)
BuildRequires: leveldb-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(hiredis)
BuildRequires: postgresql-devel
%if 0%{?suse_version} > 1400
BuildRequires: postgresql-server-devel
%endif
BuildRequires: libcurl-devel libidn-devel
BuildRequires: openssl-devel
Requires: %{name}-data = %{version}
Recommends: minetest-game
Provides: minetest-runtime = %{version}
%description
Minecraft inspired voxel game written from scratch and licensed
under the LGPL (version 2.1 or later). It supports both survival and creative
modes along with multiplayer support, dynamic lighting, and an "infinite" map
generator.
This is the graphics player client with multiprotocol for any minetest engine,
the textures and other graphical files and the standard mods. Use this to
play as singleplayer or to connect to play in multiplayer modes.
This minetest features and permit to use and serve
to both older and newer minetest games
%package %{name}server
Summary: Minetest voxel game engine - server multiplayer
License: LGPL-2.1-or-later
Group: Amusements/Games/3D/Simulation
Requires: %{name}-data = %{version}
%if 0%{?suse_version} > 1400 || 0%{?fedora_version} > 34
Requires(pre): shadow
%endif
Recommends: minetest-game
Provides: minetest-runtime = %{version}
%{?systemd_requires}
%description %{name}server
Minecraft inspired voxel game written from scratch and licensed
under the LGPL (version 2.1 or later). It supports both survival and creative
modes along with multiplayer support, dynamic lighting, and an "infinite" map
generator.
These are the server flavour with multiprotocol for any minetest engine, such as
the textures and other graphical files and the standard mods. Use this to
provide and deploy a service where players can connect over a network.
This minetest features and permit to use and serve
to both older and newer minetest games
%package data
Summary: voxel game engine based on minetest - common data files
License: CC-BY-SA-3.0 AND LGPL-2.1-or-later
Group: Amusements/Games/3D/Simulation
Requires: google-arimo-fonts
Requires: google-cousine-fonts
Requires: google-droid-fonts
BuildArch: noarch
%description data
Minecraft inspired voxel game written from scratch and licensed
under the LGPL (version 2.1 or later). It supports both survival and creative
modes along with multiplayer support, dynamic lighting, and an "infinite" map
generator.
These are the files used by both client and server packages, such as
the textures and other graphical files and the standard mods.
This is a improved upgrade over 5.2 series due 5.X one superset and changed
the protocol of network.
This minetest features and permit to use and serve
to both older and newer minetest games
%if 0%{?fedora_version} > 32
%global debug_package %{nil}
%endif
%define minetestuser %{name}
%define minetestgroup %{name}
%prep
%autosetup -p1
# way to patch only in some version of rmp shit distros
# %if 0%{?sle_version} > 0 && 0%{?sle_version} <= 150400
# %patch0 -p1
# %patch1 -p1
# %endif
# cd lib
# tar -xzf %{SOURCE3}
# mv irrlicht-%{irrlichtmt_version} irrlichtmt
# cd ..
# Purge bundled jsoncpp, lua and gmp libraries.
rm -rf lib/jsoncpp lib/lua lib/gmp
find . -name .gitignore -print -delete
find . -name .travis.yml -print -delete
find . -name .luacheckrc -print -delete
%build
%undefine _hardened_build
%undefine _annotated_build
%undefine _strict_symbol_defs_build
CXXFLAGS="-O3 -fomit-frame-pointer -Wall -ffp-contract=off -fpermissive"
LDFLAGS="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now"
%ifarch aarch64
%define _lto_cflags %{nil}
%endif
%cmake \
%ifarch aarch64
%if 0%{?suse_version} > 1550
-DCMAKE_CXX_FLAGS="%{optflags} -mbranch-protection=none" \
%endif
%endif
-DCUSTOM_DOCDIR="%{_docdir}/%{name}-data" \
-DCUSTOM_LOCALEDIR="%{_datadir}/locale" \
-DCUSTOM_SHAREDIR="%{_datadir}/games/%{name}" \
-DBUILD_SERVER=ON \
-DBUILD_CLIENT=ON \
-DRUN_IN_PLACE=OFF \
-DENABLE_CURL=ON \
-DENABLE_SOUND=ON \
-DENABLE_LUAJIT=ON \
-DENABLE_GETTEXT=ON \
-DENABLE_FREETYPE=ON \
-DENABLE_SYSTEM_GMP=ON \
-DENABLE_SYSTEM_JSONCPP=ON \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DENABLE_SPATIAL=ON \
-DENABLE_LEVELDB=ON \
-DENABLE_REDIS=ON \
-DENABLE_POSTGRESQL=ON \
-DPNG_PNG_INCLUDE_DIR=$(pkg-config libpng --variable=includedir) \
%{nil}
%if 0%{?fedora_version} > 32
%cmake_build
%else
make %{?_smp_mflags} VERBOSE=1
%endif
%install
%if 0%{?fedora_version} > 32
%cmake_install
%else
%make_install
%endif
# Clean up.
%fdupes %{buildroot}%{_datadir}/
install -Dpm 0644 minetest.conf.example %{buildroot}%{_sysconfdir}/%{name}/minetest.conf.example
mkdir -p %{buildroot}%{_localstatedir}/lib/%{name}/
# %find_lang %{name}
%post
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
desktop-file-validate %{_datadir}/applications/net.minetest.minetest.desktop
%postun
if [ $1 -eq 0 ] ; then
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
%pre %{name}server
getent group %{name} > /dev/null || %{_sbindir}/groupadd -r %{minetestgroup}
getent passwd %{name} > /dev/null || %{_sbindir}/useradd -r -g %{minetestgroup} -d %{_localstatedir}/games/%{name} -s /sbin/nologin -c "user for %{name}server" %{minetestuser}
%service_add_pre %{name}@.service
%post %{name}server
%service_add_post %{name}@.service
%preun %{name}server
%service_del_preun %{name}@.service
%postun %{name}server
%service_del_postun %{name}@.service
%files
%{_bindir}/%{name}
%{_datadir}/applications/net.minetest.minetest.desktop
%{_mandir}/man6/%{name}.6%{?ext_man}
%files %{name}server
%{_bindir}/%{name}server
%attr(0755,%{minetestuser},%{minetestgroup}) %{_localstatedir}/games/%{name}/
%{_mandir}/man6/%{name}server.6%{?ext_man}
%dir %{_sysconfdir}/%{name}
%config %{_sysconfdir}/%{name}/minetest.conf.example
%{_unitdir}/%{name}@.service
%{_sysconfdir}/logrotate.d/%{name}
# %config(noreplace) %{_sysconfdir}/rsyslog.d/%{name}.conf
%files data
%license LICENSE.txt
%doc README.*
%doc %{_docdir}/%{name}/
%{_datadir}/games/%{name}
%dir %{_datadir}/icons/hicolor/
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%dir %{_datadir}/metainfo/
%{_datadir}/metainfo/*%{name}.appdata.xml
%changelog