Blob Blame History Raw
# http://trac.wildfiregames.com/wiki/BuildInstructions#Linux

# Remember to rerun licensecheck after every update:
#	https://bugzilla.redhat.com/show_bug.cgi?id=818401#c46
#	http://trac.wildfiregames.com/ticket/1682

# conditionals left for the sake of users building from source, but
# nvtt (due to s3tc patented code) is not supported and not built.
%global		with_system_nvtt	0
%global		without_nvtt		1

%if 0%{?fedora} <= 16
%global		with_system_enet	0
%else
%global		with_system_enet	1
%endif

Name:		0ad
Version:	0.0.11
Release:	3%{?dist}
# BSD License:
#	build/premake/*
#	libraries/valgrind/*		(not built/used)
# MIT License:
#	libraries/enet/*
#	libraries/fcollada/*
#	source/third_party/*
# LGPLv2+
#	libraries/cxxtest/*		(not built/used)
# GPLv2+
#	source/*
# IBM
#	source/tools/fontbuilder2/Packer.py
# MPL-1.1
#	libraries/spidermonkey/*	(not built/used)
License:	GPLv2+ and BSD and MIT and IBM
Group:		Amusements/Games
Summary:	Cross-Platform RTS Game of Ancient Warfare
Url:		http://wildfiregames.com/0ad/

%if %{without_nvtt}
# wget http://releases.wildfiregames.com/%%{name}-%%{version}-alpha-unix-build.tar.xz
# tar Jxf %%{name}-%%{version}-alpha-unix-build.tar.xz
# rm -fr %%{name}-%%{version}-alpha/libraries/nvtt
# rm -f %%{name}-%%{version}-alpha-unix-build.tar.xz
# tar Jcf %%{name}-%%{version}-alpha-unix-build.tar.xz %%{name}-%%{version}-alpha
Source0:	%{name}-%{version}-alpha-unix-build.tar.xz
%else
Source0:	http://releases.wildfiregames.com/%{name}-%{version}-alpha-unix-build.tar.xz
%endif

# adapted from binaries/system/readme.txt
# It is advisable to review this file at on newer versions, to update the
# version field and check for extra options. Note that windows specific,
# and disabled options were not added to the manual page.
Source1:	%{name}.6
Requires:	%{name}-data
BuildRequires:	boost-devel
BuildRequires:	cmake
BuildRequires:	desktop-file-utils
BuildRequires:	DevIL-devel
%if %{with_system_enet}
BuildRequires:	enet-devel
%endif
BuildRequires:	gamin-devel
BuildRequires:	js-devel
BuildRequires:	libcurl-devel
BuildRequires:	libdnet-devel
BuildRequires:	libjpeg-turbo-devel
BuildRequires:	libpng-devel
BuildRequires:	libvorbis-devel
BuildRequires:	libxml2-devel
BuildRequires:	libzip-devel
BuildRequires:	nasm
%if %{with_system_nvtt}
BuildRequires:	nvidia-texture-tools
%endif
BuildRequires:	openal-soft-devel
BuildRequires:	openjpeg-devel
BuildRequires:	pkgconfig
BuildRequires:	python
BuildRequires:	SDL-devel
BuildRequires:	subversion
BuildRequires:	wxGTK-devel

# FAMMonitorDirectory fails if passing a relative directory
# Use FAMNoExists (gamin specific to speed up a little bit initialization
# as commented in the source)
Patch0:		%{name}-gamin.patch

# http://trac.wildfiregames.com/ticket/1421
Patch1:		%{name}-rpath.patch

# Build with newer libxml2
Patch2:		%{name}-libxml2.patch

%description
0 A.D. (pronounced "zero ey-dee") is a free, open-source, cross-platform
real-time strategy (RTS) game of ancient warfare. In short, it is a
historically-based war/economy game that allows players to relive or rewrite
the history of Western civilizations, focusing on the years between 500 B.C.
and 500 A.D. The project is highly ambitious, involving state-of-the-art 3D
graphics, detailed artwork, sound, and a flexible and powerful custom-built
game engine.

The game has been in development by Wildfire Games (WFG), a group of volunteer,
hobbyist game developers, since 2001.

#-----------------------------------------------------------------------
%prep
%setup -q -n %{name}-%{version}-alpha
%patch0 -p1
%patch1 -p1
%if 0%{?fedora} > 18
# 0ad <= 0.0.11 && libxml2 >= 2.9
%patch2 -p1
%endif

#-----------------------------------------------------------------------
%build
export CFLAGS="%{optflags}"
# avoid warnings with gcc 4.7 due to _FORTIFY_SOURCE in CPPFLAGS
export CPPFLAGS="`echo %{optflags} | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//'`"
build/workspaces/update-workspaces.sh	\
    --bindir %{_bindir}			\
    --datadir %{_datadir}/%{name}	\
    --libdir %{_libdir}/%{name}		\
%if %{with_system_enet}
    --with-system-enet			\
%endif
    --with-system-mozjs185		\
%if %{with_system_nvtt}
    --with-system-nvtt			\
%endif
%if %{without_nvtt}
    --without-nvtt			\
%endif
    %{?_smp_mflags}

make %{?_smp_mflags} -C build/workspaces/gcc config=release verbose=1

#-----------------------------------------------------------------------
# Depends on availablity of nvtt
%if !%{without_nvtt}
%check
LD_LIBRARY_PATH=binaries/system binaries/system/test -libdir binaries/system
%endif

#-----------------------------------------------------------------------
%install
install -d -m 755 %{buildroot}%{_bindir}
install -p -m 755 binaries/system/pyrogenesis %{buildroot}%{_bindir}/pyrogenesis

install -d -m 755 %{buildroot}%{_libdir}/%{name}
for name in AtlasUI Collada; do
    install -p -m 755 binaries/system/lib${name}.so %{buildroot}%{_libdir}/%{name}/lib${name}.so
done

%if !%{with_system_enet}
    install -p -m 755 binaries/system/libenet.so.1 %{buildroot}%{_libdir}/%{name}/libenet.so.1
%endif

%if !%{without_nvtt} && !%{with_system_nvtt}
for name in nvcore nvimage nvmath nvtt; do
    install -p -m 755 binaries/system/lib${name}.so %{buildroot}%{_libdir}/%{name}/lib${name}.so
done
%endif

install -d -m 755 %{buildroot}%{_datadir}/applications
install -p -m 644 build/resources/0ad.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop

install -d -m 755 %{buildroot}%{_datadir}/pixmaps
install -p -m 644 build/resources/0ad.png %{buildroot}%{_datadir}/pixmaps/%{name}.png

install -d -m 755 %{buildroot}%{_datadir}/%{name}
cp -a binaries/data/* %{buildroot}%{_datadir}/%{name}

install -d -m 755 %{buildroot}%{_mandir}/man6
install -p -m 644 %{SOURCE1} %{buildroot}%{_mandir}/man6/%{name}.6
ln -sf %{name}.6 %{buildroot}%{_mandir}/man6/pyrogenesis.6

desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop

cat > %{buildroot}%{_bindir}/0ad <<EOF
#!/bin/sh

cd %{_datadir}/0ad
LD_LIBRARY_PATH=%{_libdir}/0ad %{_bindir}/pyrogenesis "\$@"
EOF
chmod +x %{buildroot}%{_bindir}/0ad

#-----------------------------------------------------------------------
%files
%doc README.txt LICENSE.txt
%doc license_gpl-2.0.txt license_lgpl-2.1.txt
%{_bindir}/0ad
%{_bindir}/pyrogenesis
%{_libdir}/%{name}
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/applications/%{name}.desktop
%{_datadir}/%{name}
%{_mandir}/man6/*.6*

%changelog
* Tue Sep 11 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 0.0.11-3
- Clarify source tree licenses information in spec (#818401)
- Preserve time stamp of installed files (#818401)

* Sat Sep 8 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 0.0.11-2
- Correct manpage group and symlink 0ad manual to pyrogenesis manual (#818401)
- Correct some typos and wrong information in 0ad.6

* Sat Sep 8 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 0.0.11-1
- Update to latest upstream release
- Switch to new versioning pattern
- Remove rpath patch already applied upstream
- Remove without-nvtt patch already applied upstream
- Remove boost patch already applied upstream
- Remake rpath patch to avoid package build special conditions

* Thu Sep 6 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-6
- Repackage tarball to not redistribute patented s3tc implementation (#818401)
- Add patch to rebuild with newer libxml2.
- Add upstream trac patch for build with newer boost.
- Rename patches to remove %%version and use %%name in source files.

* Fri Jul 13 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-5
- Clearly state nvtt is not mean't to be used (unless user build from sources).
- Update to use patch in wildfire trac instead of my patch to remove rpath.

* Fri Jun  1 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-4
- Actually remove %%defattr.
- Correct wrong fedora release check for enet-devel build requires.

* Sat May 26 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-4
- Make package build in Fedora 16 (rpmfusion #2342).
- Add conditionals to build with or without system nvtt or disable nvtt.

* Tue May 22 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-3
- Remove %%defattr from spec (#823096).
- Run desktop-file-validate (#823096).

* Mon May 21 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-2
- Disable dependency on nvidia-texture-tools (#823096).
- Disable %%check as it requires nvtt.
- Add manual page.

* Sat May 19 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-1
- Correct package license.
- Update to latest upstream release.
- Remove license_dbghelp.txt as dbghelp.dll is not in sources neither installed.

* Tue May 1 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11339-1
- Initial 0ad spec.