File 0ad.spec of Package 0ad

#
# spec file for package 0ad
#
# Copyright (c) 2017 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:           0ad
Version:        0.0.21
Release:        0
Summary:        A real-time strategy game of ancient warfare
License:        GPL-2.0+ and LGPL-3.0+ and CC-BY-SA-3.0 and MIT and ISC and MPL-2.0 and BSD-3-Clause
Group:          Amusements/Games/Strategy/Real Time
Url:            http://play0ad.com/
Source:         http://sourceforge.net/projects/zero-ad/files/releases/%{name}-%{version}-alpha-unix-build.tar.xz
Source99:       %{name}.changes
# PATCH-FEATURE-UPSTREAM system-tinygettext.patch -- http://trac.wildfiregames.com/ticket/4192
Patch1:         system-tinygettext.patch
# PATCH-RPMLINT-ERROR 0ad-desktopt.patch -- invalid key URL
Patch2:         %{name}-desktop.patch
BuildRequires:  boost-devel
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  libXcursor-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libminiupnpc-devel
BuildRequires:  libpng-devel
BuildRequires:  mozilla-nspr-devel
BuildRequires:  nasm
BuildRequires:  pkgconfig
BuildRequires:  python
BuildRequires:  update-desktop-files
BuildRequires:  wxWidgets-3_0-devel
BuildRequires:  pkgconfig(IL)
BuildRequires:  pkgconfig(gloox)
BuildRequires:  pkgconfig(icu-i18n)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libenet)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(tinygettext)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(zlib)
Requires:       0ad-data = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
0 A.D. (pronounced "zero ey-dee") is a real-time strategy (RTS) game
of ancient warfare. 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 contains 3D graphics, detailed artwork, sound, and a
flexible game engine.

%prep
%setup -q -n %{name}-%{version}-alpha
%patch1 -p1
%patch2 -p1

# Fix usage of __DATE__ and __TIME__ macros
modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{SOURCE99}")"
DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
TIME="\"$(date -d "${modified}" "+%%T")\""
find . "(" -name '*.[ch]' -o -name '*.cpp' ")" -exec sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g" \{\} +

%build
export CFLAGS="%{optflags}"
export CPPFLAGS="%{optflags} -fpermissive"
build/workspaces/update-workspaces.sh \
    %{?_smp_mflags} \
    --bindir=%{_bindir} \
    --datadir=%{_datadir}/%{name} \
    --libdir=%{_libdir}/%{name} \
	--with-system-tinygettext

pushd build/workspaces/gcc
make verbose=1 %{?_smp_mflags}
popd

%install
install -Dm 0755 binaries/system/ActorEditor %{buildroot}%{_bindir}/ActorEditor
install -Dm 0755 binaries/system/pyrogenesis %{buildroot}%{_bindir}/pyrogenesis
install -Dm 0755 binaries/system/libCollada.so %{buildroot}%{_libdir}/%{name}/libCollada.so
install -Dm 0755 binaries/system/libAtlasUI.so %{buildroot}%{_libdir}/%{name}/libAtlasUI.so
install -Dm 0755 binaries/system/libmozjs38-ps-release.so %{buildroot}%{_libdir}/%{name}/libmozjs38-ps-release.so
install -Dm 0755 binaries/system/libnvcore.so %{buildroot}%{_libdir}/%{name}/libnvcore.so
install -Dm 0755 binaries/system/libnvimage.so %{buildroot}%{_libdir}/%{name}/libnvimage.so
install -Dm 0755 binaries/system/libnvmath.so %{buildroot}%{_libdir}/%{name}/libnvmath.so
install -Dm 0755 binaries/system/libnvtt.so %{buildroot}%{_libdir}/%{name}/libnvtt.so

install -Dm 0644 build/resources/0ad.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
install -Dm 0644 build/resources/0ad.appdata.xml %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml
install -Dm 0644 build/resources/0ad.png %{buildroot}%{_datadir}/pixmaps/%{name}.png

%suse_update_desktop_file %{name}

install -Dm 0755 build/resources/0ad.sh %{buildroot}%{_bindir}/0ad

mkdir -p %{buildroot}%{_libdir}/%{name}
mkdir -p %{buildroot}%{_datadir}/%{name}

%files
%defattr(-,root,root)
%doc README.txt
%if ( 0%{?suse_version} == 1315 && 0%{?sle_version} == 120100 ) || ! 0%{?is_opensuse}
# Fix for Leap 42.1 or SLE (TODO: Drop if 42.1 is out of maintenance)
%doc LICENSE.txt license_gpl-2.0.txt license_lgpl-2.1.txt license_mit.txt
%dir %{_datadir}/appdata
%else
%license LICENSE.txt license_gpl-2.0.txt license_lgpl-2.1.txt license_mit.txt
%endif
%{_bindir}/0ad
%{_bindir}/pyrogenesis
%{_bindir}/ActorEditor
%{_libdir}/%{name}/libCollada.so
%{_libdir}/%{name}/libAtlasUI.so
%{_libdir}/%{name}/libmozjs38-ps-release.so
%{_libdir}/%{name}/libnvcore.so
%{_libdir}/%{name}/libnvimage.so
%{_libdir}/%{name}/libnvmath.so
%{_libdir}/%{name}/libnvtt.so
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%dir %{_libdir}/%{name}
%dir %{_datadir}/%{name}

%changelog
openSUSE Build Service is sponsored by