b8284a1
# http://trac.wildfiregames.com/wiki/BuildInstructions#Linux
b8284a1
879053e
# enable special maintainer debug build ?
879053e
%define		with_debug		0
879053e
%if %{with_debug}
879053e
%define		config			debug
879053e
%define		dbg			_dbg
879053e
%else
879053e
%define		config			release
879053e
%define		dbg			%{nil}
879053e
%endif
879053e
b8284a1
# Remember to rerun licensecheck after every update:
b8284a1
#	https://bugzilla.redhat.com/show_bug.cgi?id=818401#c46
b8284a1
#	http://trac.wildfiregames.com/ticket/1682
b8284a1
b8284a1
# conditionals left for the sake of users building from source, but
b8284a1
# nvtt (due to s3tc patented code) is not supported and not built.
b8284a1
%global		with_system_nvtt	0
b8284a1
%global		without_nvtt		1
b8284a1
b8284a1
%if 0%{?fedora} <= 16
b8284a1
%global		with_system_enet	0
b8284a1
%else
b8284a1
%global		with_system_enet	1
b8284a1
%endif
b8284a1
b8284a1
Name:		0ad
93b350a
Version:	0.0.12
93b350a
Release:	1%{?dist}
b8284a1
# BSD License:
b8284a1
#	build/premake/*
b8284a1
#	libraries/valgrind/*		(not built/used)
b8284a1
# MIT License:
b8284a1
#	libraries/enet/*
b8284a1
#	libraries/fcollada/*
b8284a1
#	source/third_party/*
b8284a1
# LGPLv2+
b8284a1
#	libraries/cxxtest/*		(not built/used)
b8284a1
# GPLv2+
b8284a1
#	source/*
b8284a1
# IBM
b8284a1
#	source/tools/fontbuilder2/Packer.py
b8284a1
# MPL-1.1
b8284a1
#	libraries/spidermonkey/*	(not built/used)
b8284a1
License:	GPLv2+ and BSD and MIT and IBM
b8284a1
Group:		Amusements/Games
b8284a1
Summary:	Cross-Platform RTS Game of Ancient Warfare
b8284a1
Url:		http://wildfiregames.com/0ad/
b8284a1
b8284a1
%if %{without_nvtt}
b8284a1
# wget http://releases.wildfiregames.com/%%{name}-%%{version}-alpha-unix-build.tar.xz
b8284a1
# tar Jxf %%{name}-%%{version}-alpha-unix-build.tar.xz
b8284a1
# rm -fr %%{name}-%%{version}-alpha/libraries/nvtt
b8284a1
# rm -f %%{name}-%%{version}-alpha-unix-build.tar.xz
b8284a1
# tar Jcf %%{name}-%%{version}-alpha-unix-build.tar.xz %%{name}-%%{version}-alpha
b8284a1
Source0:	%{name}-%{version}-alpha-unix-build.tar.xz
b8284a1
%else
b8284a1
Source0:	http://releases.wildfiregames.com/%{name}-%{version}-alpha-unix-build.tar.xz
b8284a1
%endif
b8284a1
93b350a
# Simplify checking differences when updating the package
93b350a
# (also to validate one did not forget to remake the tarball if
93b350a
# %{without_nvtt} is enabled) Create it with:
93b350a
# cd BUILD/%{name}-%{version}-alpha
93b350a
# licensecheck -r . > ../../SOURCES/%{name}-licensecheck.txt
93b350a
Source1:	%{name}-licensecheck.txt
93b350a
b8284a1
# adapted from binaries/system/readme.txt
b8284a1
# It is advisable to review this file at on newer versions, to update the
b8284a1
# version field and check for extra options. Note that windows specific,
b8284a1
# and disabled options were not added to the manual page.
93b350a
Source2:	%{name}.6
93b350a
Requires:	%{name}-data = %{version}
b8284a1
BuildRequires:	boost-devel
b8284a1
BuildRequires:	cmake
b8284a1
BuildRequires:	desktop-file-utils
b8284a1
BuildRequires:	DevIL-devel
b8284a1
%if %{with_system_enet}
b8284a1
BuildRequires:	enet-devel
b8284a1
%endif
b8284a1
BuildRequires:	gamin-devel
b8284a1
BuildRequires:	js-devel
b8284a1
BuildRequires:	libcurl-devel
b8284a1
BuildRequires:	libdnet-devel
b8284a1
BuildRequires:	libjpeg-turbo-devel
b8284a1
BuildRequires:	libpng-devel
b8284a1
BuildRequires:	libvorbis-devel
b8284a1
BuildRequires:	libxml2-devel
b8284a1
BuildRequires:	libzip-devel
b8284a1
BuildRequires:	nasm
b8284a1
%if %{with_system_nvtt}
b8284a1
BuildRequires:	nvidia-texture-tools
b8284a1
%endif
b8284a1
BuildRequires:	openal-soft-devel
b8284a1
BuildRequires:	openjpeg-devel
b8284a1
BuildRequires:	pkgconfig
b8284a1
BuildRequires:	python
b8284a1
BuildRequires:	SDL-devel
b8284a1
BuildRequires:	subversion
b8284a1
BuildRequires:	wxGTK-devel
b8284a1
b8284a1
# http://trac.wildfiregames.com/ticket/1421
93b350a
Patch0:		%{name}-rpath.patch
b8284a1
879053e
# Display more clear error messages when creating custom scenarios
879053e
# The suggested usage is:
879053e
#	$ sudo mkdir /usr/share/0ad/public/maps
879053e
#	$ sudo chmod 7777 /usr/share/0ad/public/maps
879053e
#	$ 0ad -editor
879053e
# Supposing saved the map as mymap, can test it with:
879053e
#	$ 0ad -autostart=mymap
93b350a
Patch1:		%{name}-saveas.patch
879053e
879053e
# Only do fcollada debug build with enabling debug maintainer mode
879053e
# It also prevents assumption there that it is building in x86
93b350a
Patch2:		%{name}-debug.patch
879053e
b8284a1
%description
b8284a1
0 A.D. (pronounced "zero ey-dee") is a free, open-source, cross-platform
b8284a1
real-time strategy (RTS) game of ancient warfare. In short, it is a
b8284a1
historically-based war/economy game that allows players to relive or rewrite
b8284a1
the history of Western civilizations, focusing on the years between 500 B.C.
b8284a1
and 500 A.D. The project is highly ambitious, involving state-of-the-art 3D
b8284a1
graphics, detailed artwork, sound, and a flexible and powerful custom-built
b8284a1
game engine.
b8284a1
b8284a1
The game has been in development by Wildfire Games (WFG), a group of volunteer,
b8284a1
hobbyist game developers, since 2001.
b8284a1
b8284a1
#-----------------------------------------------------------------------
b8284a1
%prep
b8284a1
%setup -q -n %{name}-%{version}-alpha
b8284a1
%patch0 -p1
b8284a1
%patch1 -p1
879053e
%if !%{with_debug}
879053e
# disable debug build, and "int 0x3" to trap to debugger (x86 only)
93b350a
%patch2 -p1
879053e
%endif
b8284a1
b8284a1
#-----------------------------------------------------------------------
b8284a1
%build
b8284a1
export CFLAGS="%{optflags}"
b8284a1
# avoid warnings with gcc 4.7 due to _FORTIFY_SOURCE in CPPFLAGS
b8284a1
export CPPFLAGS="`echo %{optflags} | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//'`"
b8284a1
build/workspaces/update-workspaces.sh	\
b8284a1
    --bindir %{_bindir}			\
b8284a1
    --datadir %{_datadir}/%{name}	\
b8284a1
    --libdir %{_libdir}/%{name}		\
b8284a1
%if %{with_system_enet}
b8284a1
    --with-system-enet			\
b8284a1
%endif
b8284a1
    --with-system-mozjs185		\
b8284a1
%if %{with_system_nvtt}
b8284a1
    --with-system-nvtt			\
b8284a1
%endif
b8284a1
%if %{without_nvtt}
b8284a1
    --without-nvtt			\
b8284a1
%endif
b8284a1
    %{?_smp_mflags}
b8284a1
879053e
make %{?_smp_mflags} -C build/workspaces/gcc config=%{config} verbose=1
b8284a1
b8284a1
#-----------------------------------------------------------------------
b8284a1
# Depends on availablity of nvtt
b8284a1
%if !%{without_nvtt}
b8284a1
%check
879053e
LD_LIBRARY_PATH=binaries/system binaries/system/test%{dbg} -libdir binaries/system
b8284a1
%endif
b8284a1
b8284a1
#-----------------------------------------------------------------------
b8284a1
%install
b8284a1
install -d -m 755 %{buildroot}%{_bindir}
879053e
install -p -m 755 binaries/system/pyrogenesis%{dbg} %{buildroot}%{_bindir}/pyrogenesis%{dbg}
b8284a1
b8284a1
install -d -m 755 %{buildroot}%{_libdir}/%{name}
879053e
for name in AtlasUI%{dbg} Collada%{dbg}; do
b8284a1
    install -p -m 755 binaries/system/lib${name}.so %{buildroot}%{_libdir}/%{name}/lib${name}.so
b8284a1
done
b8284a1
b8284a1
%if !%{with_system_enet}
b8284a1
    install -p -m 755 binaries/system/libenet.so.1 %{buildroot}%{_libdir}/%{name}/libenet.so.1
b8284a1
%endif
b8284a1
b8284a1
%if !%{without_nvtt} && !%{with_system_nvtt}
b8284a1
for name in nvcore nvimage nvmath nvtt; do
b8284a1
    install -p -m 755 binaries/system/lib${name}.so %{buildroot}%{_libdir}/%{name}/lib${name}.so
b8284a1
done
b8284a1
%endif
b8284a1
b8284a1
install -d -m 755 %{buildroot}%{_datadir}/applications
b8284a1
install -p -m 644 build/resources/0ad.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
b8284a1
b8284a1
install -d -m 755 %{buildroot}%{_datadir}/pixmaps
b8284a1
install -p -m 644 build/resources/0ad.png %{buildroot}%{_datadir}/pixmaps/%{name}.png
b8284a1
b8284a1
install -d -m 755 %{buildroot}%{_datadir}/%{name}
b8284a1
cp -a binaries/data/* %{buildroot}%{_datadir}/%{name}
b8284a1
b8284a1
install -d -m 755 %{buildroot}%{_mandir}/man6
93b350a
install -p -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man6/%{name}.6
b8284a1
ln -sf %{name}.6 %{buildroot}%{_mandir}/man6/pyrogenesis.6
b8284a1
b8284a1
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
b8284a1
b8284a1
cat > %{buildroot}%{_bindir}/0ad <
b8284a1
#!/bin/sh
b8284a1
b8284a1
cd %{_datadir}/0ad
879053e
LD_LIBRARY_PATH=%{_libdir}/0ad %{_bindir}/pyrogenesis%{dbg} "\$@"
b8284a1
EOF
b8284a1
chmod +x %{buildroot}%{_bindir}/0ad
b8284a1
879053e
%if %{with_debug}
879053e
export STRIP=/bin/true
879053e
%endif
879053e
b8284a1
#-----------------------------------------------------------------------
b8284a1
%files
b8284a1
%doc README.txt LICENSE.txt
b8284a1
%doc license_gpl-2.0.txt license_lgpl-2.1.txt
b8284a1
%{_bindir}/0ad
879053e
%{_bindir}/pyrogenesis%{dbg}
b8284a1
%{_libdir}/%{name}
b8284a1
%{_datadir}/pixmaps/%{name}.png
b8284a1
%{_datadir}/applications/%{name}.desktop
b8284a1
%{_datadir}/%{name}
b8284a1
%{_mandir}/man6/*.6*
b8284a1
b8284a1
%changelog
93b350a
* Tue Dec 18 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 0.0.11-1
93b350a
- Update to latest upstream release
93b350a
- Remove no longer required gamin patch
93b350a
- Rediff rpath patch
93b350a
- Remove libxml2 patch already applied upstream
93b350a
- Update 0ad manpage for newer options and release information
93b350a
- Add versioned requires to data files
93b350a
- Add 0ad licensecheck text file to simplify checking changes
93b350a
879053e
* Sat Nov 3 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 0.0.11-4
879053e
- Add %%with_debug maintainer mode build
879053e
- Disable fcollada debug build if %%with_debug is false
879053e
- Add patch to not crash and display helful messages in editor (#872801)
879053e
b8284a1
* Tue Sep 11 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 0.0.11-3
b8284a1
- Clarify source tree licenses information in spec (#818401)
b8284a1
- Preserve time stamp of installed files (#818401)
b8284a1
b8284a1
* Sat Sep 8 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 0.0.11-2
b8284a1
- Correct manpage group and symlink 0ad manual to pyrogenesis manual (#818401)
b8284a1
- Correct some typos and wrong information in 0ad.6
b8284a1
b8284a1
* Sat Sep 8 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 0.0.11-1
b8284a1
- Update to latest upstream release
b8284a1
- Switch to new versioning pattern
b8284a1
- Remove rpath patch already applied upstream
b8284a1
- Remove without-nvtt patch already applied upstream
b8284a1
- Remove boost patch already applied upstream
b8284a1
- Remake rpath patch to avoid package build special conditions
b8284a1
b8284a1
* Thu Sep 6 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-6
b8284a1
- Repackage tarball to not redistribute patented s3tc implementation (#818401)
b8284a1
- Add patch to rebuild with newer libxml2.
b8284a1
- Add upstream trac patch for build with newer boost.
b8284a1
- Rename patches to remove %%version and use %%name in source files.
b8284a1
b8284a1
* Fri Jul 13 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-5
b8284a1
- Clearly state nvtt is not mean't to be used (unless user build from sources).
b8284a1
- Update to use patch in wildfire trac instead of my patch to remove rpath.
b8284a1
b8284a1
* Fri Jun  1 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-4
b8284a1
- Actually remove %%defattr.
b8284a1
- Correct wrong fedora release check for enet-devel build requires.
b8284a1
b8284a1
* Sat May 26 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-4
b8284a1
- Make package build in Fedora 16 (rpmfusion #2342).
b8284a1
- Add conditionals to build with or without system nvtt or disable nvtt.
b8284a1
b8284a1
* Tue May 22 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-3
b8284a1
- Remove %%defattr from spec (#823096).
b8284a1
- Run desktop-file-validate (#823096).
b8284a1
b8284a1
* Mon May 21 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-2
b8284a1
- Disable dependency on nvidia-texture-tools (#823096).
b8284a1
- Disable %%check as it requires nvtt.
b8284a1
- Add manual page.
b8284a1
b8284a1
* Sat May 19 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11863-1
b8284a1
- Correct package license.
b8284a1
- Update to latest upstream release.
b8284a1
- Remove license_dbghelp.txt as dbghelp.dll is not in sources neither installed.
b8284a1
b8284a1
* Tue May 1 2012 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - r11339-1
b8284a1
- Initial 0ad spec.