Blob Blame History Raw
# spec file for package 0ad
# Copyright (c) 2022 SUSE LLC
# 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

# Enable NVTT only on arch supported by nvidia-texture-tools
%ifarch %{ix86} x86_64 ppc
%bcond_without nvtt
%bcond_with nvtt
# We can use the system mozjs on Tumbleweed and Leap 15.4.
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150400
%bcond_without system_mozjs
%bcond_with system_mozjs
# Use provided library
%bcond_without system_nvtt
Name:           0ad
Version:        0.0.25b
Release:        0
Summary:        A real-time strategy game of ancient warfare
License:        BSD-3-Clause AND CC-BY-SA-3.0 AND GPL-2.0-or-later AND LGPL-3.0-or-later AND MIT AND ISC AND MPL-2.0
Group:          Amusements/Games/Strategy/Real Time
Patch0:         avoid_duplicate_global_symbol_from_asm.patch
# PATCH-FIX-OPENSUSE -- Disable the mozjs version check
Patch1:         no-version-check.patch
# PATCH-FIX-OPENSUSE -- Use the newer variant of this function (related to mozjs78 upgrade)
Patch2:         PrepareZoneForGC.patch
# PATCH-FIX-UPSTREAM -- Don't define M_PIf if glibc already provides it
Patch3:         glibc-2.35.patch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  libXcursor-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libminiupnpc-devel
BuildRequires:  libpng-devel
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  wxWidgets-3_0-nostl-devel
BuildRequires:  pkgconfig(IL)
BuildRequires:  pkgconfig(fmt)
BuildRequires:  pkgconfig(gloox)
BuildRequires:  pkgconfig(gnutls)
BuildRequires:  pkgconfig(icu-i18n)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libenet)
BuildRequires:  pkgconfig(libidn)
BuildRequires:  pkgconfig(libsodium) >= 1.0.13
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(zlib)
Requires:       0ad-data = %{version}
%if %{with nvtt} && %{with system_nvtt}
BuildRequires:  nvidia-texture-tools >= 2.1
%if %{with system_mozjs}
#FIXME: Depends on source/scriptinterface/ScriptTypes.h
# This is "fixed" by disabling the version check.
BuildRequires:  pkgconfig(mozjs-78) >= 78.7
BuildRequires:  cargo
BuildRequires:  rust

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.

%setup -q -n %{name}-%{version}-alpha
%patch0 -p1
%patch3 -p1
%if %{with system_mozjs}
%patch1 -p1
%patch2 -p1

export CFLAGS="%{optflags}"
# bundled Collada uses CCFLAGS
export CCFLAGS="%{optflags}"
export CPPFLAGS="%{optflags} -fpermissive"
build/workspaces/ \
    %{?_smp_mflags} \
    --bindir=%{_bindir} \
    --datadir=%{_datadir}/%{name} \
    --libdir=%{_libdir}/%{name} \
    --without-tests \
%if %{with nvtt}
%if %{with system_nvtt}
    --with-system-nvtt \
    --without-nvtt \
%if %{with system_mozjs}

pushd build/workspaces/gcc
%make_build verbose=1

mkdir -p %{buildroot}%{_libdir}/%{name}
mkdir -p %{buildroot}%{_datadir}/%{name}
# Install binaries and wrapper
install -Dm 0755 binaries/system/ActorEditor %{buildroot}%{_bindir}/ActorEditor
install -Dm 0755 binaries/system/pyrogenesis %{buildroot}%{_bindir}/pyrogenesis
install -Dm 0755 build/resources/ %{buildroot}%{_bindir}/0ad
# Install game libraries
install -m 0644 binaries/system/ %{buildroot}%{_libdir}/%{name}/
install -m 0644 binaries/system/ %{buildroot}%{_libdir}/%{name}/
# If without system mozjs we need to install the bundled one
%if %{without system_mozjs}
install -m 0644 binaries/system/libmozjs* %{buildroot}%{_libdir}/%{name}/
# Install appdata
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}

%doc README.txt
%license LICENSE.txt license_gpl-2.0.txt license_lgpl-2.1.txt license_mit.txt
%dir %{_datadir}/%{name}