Blob Blame History Raw
%global warsow_libdir %{_prefix}/lib/warsow

%global nodotver %%(echo %{version} | sed 's/\\.//')

Name:           warsow
Version:        2.1
Release:        2%{?dist}
Summary:        Fast paced 3D first person shooter

License:        GPLv2+
URL:            https://www.warsow.gg
Source0:        http://update.warsow.gg/mirror/warsow_%{nodotver}_sdk.tar.gz
Source1:        warsow.desktop
# Downstream patch to look for data files and libs installed in /usr
Patch0:         warsow-paths.patch
# Downstream patch to use our optimization flags
Patch1:         warsow-build.patch

# Warsow is only ported to these architectures
ExclusiveArch:  %{ix86} x86_64 %{arm}

BuildRequires:  cmake
BuildRequires:  curl-devel
BuildRequires:  freetype-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libtheora-devel
BuildRequires:  libvorbis-devel
BuildRequires:  libX11-devel
BuildRequires:  libXinerama-devel
BuildRequires:  libXrandr-devel
BuildRequires:  libXxf86dga-devel
BuildRequires:  libXxf86vm-devel
BuildRequires:  mesa-libGL-devel
BuildRequires:  openal-devel
BuildRequires:  openssl-devel
BuildRequires:  SDL2-devel
BuildRequires:  /usr/bin/convert
BuildRequires:  /usr/bin/desktop-file-install
BuildRequires:  /usr/bin/dos2unix
Requires:       hicolor-icon-theme
Requires:       warsow-data = %{version}

# Filter private libraries from provides
%global __provides_exclude_from ^%{warsow_libdir}/.*\\.so$

%description
Warsow is a fast paced first person shooter consisting of cel-shaded
cartoon-like graphics with dark, flashy and dirty textures. Warsow is based on
the E-novel "Chasseur de bots" ("Bots hunter" in English) by Fabrice Demurger.
Warsow's codebase is built upon Qfusion, an advanced modification of the Quake
II engine.

This package installs the client to play Warsow.


%package server
Summary:        Dedicated server for Warsow
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description server
Warsow is a fast paced first person shooter consisting of cel-shaded
cartoon-like graphics with dark, flashy and dirty textures. Warsow is based on
the E-novel "Chasseur de bots" ("Bots hunter" in English) by Fabrice Demurger.
Warsow's codebase is built upon Qfusion, an advanced modification of the Quake
II engine.

This package installs the standalone server and TV server for Warsow.


%prep
%setup -q -n warsow_%{nodotver}_sdk
%patch0 -p1 -b .paths
%patch1 -p1 -b .build

# Remove bundled libs
pushd source/libsrcs
rm -rf libcurl libfreetype libjpeg libogg libpng libtheora libvorbis OpenAL-MOB openssl SDL2 zlib
popd

# Convert to utf-8 and Unix line breaks
dos2unix docs/license.txt


%build
mkdir -p source/source/cmake_build
pushd source/source/cmake_build

%cmake \
  -DQFUSION_GAME=Warsow \
  -DUSE_SDL2=YES \
  ..
make %{?_smp_mflags}

popd


%install
pushd source/source/build

# Install executables to bindir
install -Dm 755 warsow.* $RPM_BUILD_ROOT%{_bindir}/warsow
install -Dm 755 wsw_server.* $RPM_BUILD_ROOT%{_bindir}/warsow-server
install -Dm 755 wswtv_server.* $RPM_BUILD_ROOT%{_bindir}/warsow-tv-server

# Install private libraries to a private directory
install -d $RPM_BUILD_ROOT%{warsow_libdir}/libs
install -m 755 libs/*.so $RPM_BUILD_ROOT%{warsow_libdir}/libs/

# Install icons and the desktop file
convert -strip ../../icons/warsow256x256.xpm warsow.png
install -D -m 0644 warsow.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/256x256/apps/warsow.png
desktop-file-install %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/applications/warsow.desktop

popd


%post
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files
%license docs/license.txt
%{_bindir}/warsow
%{_datadir}/icons/hicolor/*/apps/warsow.png
%{_datadir}/applications/warsow.desktop
%{warsow_libdir}/

%files server
%{_bindir}/warsow-server
%{_bindir}/warsow-tv-server


%changelog
* Wed Feb 01 2017 Pete Walter <pwalter@fedoraproject.org> - 2.1-2
- Add ExclusiveArch

* Wed Jun 08 2016 Pete Walter <pwalter@fedoraproject.org> - 2.1-1
- Initial Fedora package