File ioquake3.spec of Package ioquake3

#
# spec file for package ioquake3
#
# 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/
#


Name:           ioquake3
Version:        @SERVICE@
Release:        0
Summary:        Quake III
License:        GPL-2.0-or-later
Group:          Amusements/Games/3D/Shoot
URL:            http://ioquake3.org
Source:         %{name}-%{version}.tar.xz
BuildRequires:  Mesa-devel
BuildRequires:  nasm
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(sdl2)

%description
Quake III first person shooter. This package only includes the binary
files, you still need the data files from the original Quake III CD or
the Demo.

%package tools
Summary:        Quake III
License:        ISC
Group:          Development/Tools/Building

%description tools
Quake III development tools for creating mods: q3lcc, q3rcc, q3cpp,
q3asm

%prep
%setup -q
rm -rf code/SDL2 code/libs code/AL

%build
export CFLAGS="%{optflags}"
cat > dobuild <<'EOF'
#!/bin/sh
make %{?_smp_mflags} \
	VERSION=%{version} \
	RELEASE=%{release} \
	OPTIMIZE="%{optflags} -O3 -ffast-math -fno-strict-aliasing" \
	TOOLS_OPTIMIZE="%{optflags} -fno-strict-aliasing" \
	GENERATE_DEPENDENCIES=0 \
	USE_LOCAL_HEADERS=0 \
	V=1 \
	"$@"
EOF
chmod 755 dobuild
./dobuild release

%install
arch=`uname -m`
case $arch in
	i?86) arch=x86 ;;
esac
q3dir=%{buildroot}%{_libexecdir}/%{name}
install -d -m 755 $q3dir/baseq3/vm
install -d -m 755 $q3dir/demoq3
install -d -m 755 $q3dir/missionpack/vm
pushd build/release-linux-$arch/
install -m 755 %{name}.$arch $q3dir/
install -m 755 ioq3ded.$arch $q3dir/
install -m 644 renderer_opengl1_$arch.so $q3dir/
install -m 644 renderer_opengl2_$arch.so $q3dir/
install -m 644 baseq3/*.so $q3dir/baseq3
install -m 644 baseq3/vm/*.qvm $q3dir/baseq3/vm
pushd $q3dir/demoq3
ln -s ../baseq3/*.so .
popd
install -m 644 missionpack/*.so $q3dir/missionpack
install -m 644 missionpack/vm/*.qvm $q3dir/missionpack/vm
popd

# icons and start scripts
install -d -m 755 %{buildroot}%{_bindir}
install -D -m 644 misc/quake3.png -t %{buildroot}%{_datadir}/pixmaps/
install -D -m 644 misc/setup/%{name}.desktop -t %{buildroot}%{_datadir}/applications/
install -m 755 misc/setup/ioq3demo.sh $q3dir/
install -m 755 misc/setup/%{name}.sh $q3dir/
for i in ioq3demo ioquake3; do
	echo -e "#!/bin/sh\nexec %{_libexecdir}/%{name}/$i.sh \"\$@\"" > %{buildroot}%{_bindir}/$i
	chmod 755 %{buildroot}%{_bindir}/$i
done

# devel tools
install -m 755 build/release-linux-$arch/tools/q3{lcc,cpp,rcc,asm} %{buildroot}%{_bindir}
install -m 755 build/release-linux-$arch/tools/lburg/lburg %{buildroot}%{_bindir}
install -D -m 644 code/tools/lcc/doc/{bprint,lcc}.1 -t %{buildroot}%{_mandir}/man1/
install -m 644 code/tools/lcc/lburg/lburg.1 %{buildroot}%{_mandir}/man1/

# Quake 3 Team Arena - Cannot Join SinglePlayer
mv $q3dir/missionpack/vm/qagame.qvm $q3dir/missionpack/vm/_qagame.qvm

%post
echo 'copy pak[0-8].pk3 to %{_libexecdir}/%{name}/baseq3/'

%files
%doc README* id-readme.txt
%doc voip-readme.txt
%{_bindir}/ioq*
%{_libexecdir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/quake3.png
%license COPYING.txt

%files tools
%{_bindir}/q3*
%{_bindir}/lburg
%{_mandir}/man?/*.?%{ext_man}
%license code/tools/lcc/COPYRIGHT

%changelog
openSUSE Build Service is sponsored by