File openra.spec of Package development

#
# spec file for package openra
#
# 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:           openra
Version:        20210131
Release:        0
Url:            http://www.openra.net
Summary:        Recreation of the early Command & Conquer games
License:        GPL-3.0+
Group:          Amusements/Games/Strategy/Real Time
Source0:        https://github.com/Unrud/OpenRA/archive/make-version-fail.tar.gz
Source1:        https://github.com/OpenRA/GeoIP-Database/releases/download/monthly/IP2LOCATION-LITE-DB1.IPV6.BIN.ZIP
Source2:        https://raw.githubusercontent.com/wiki/OpenRA/OpenRA/Changelog.md
Source3:        nuget.config
Source4:        https://www.nuget.org/api/v2/package/StyleCop.Analyzers/1.1.118#/stylecop.analyzers.1.1.118.nupkg
Source5:        https://www.nuget.org/api/v2/package/SharpZipLib/1.2.0#/sharpziplib.1.2.0.nupkg
Source6:        https://www.nuget.org/api/v2/package/NUnit/3.12.0#/nunit.3.12.0.nupkg
Source7:        https://www.nuget.org/api/v2/package/NUnit.Console/3.11.1#/nunit.console.3.11.1.nupkg
Source8:        https://www.nuget.org/api/v2/package/NUnit.ConsoleRunner/3.11.1#/nunit.consolerunner.3.11.1.nupkg
Source9:        https://www.nuget.org/api/v2/package/NUnit.Extension.NUnitProjectLoader/3.6.0#/nunit.extension.nunitprojectloader.3.6.0.nupkg
Source10:       https://www.nuget.org/api/v2/package/NUnit.Extension.VSProjectLoader/3.8.0#/nunit.extension.vsprojectloader.3.8.0.nupkg
Source11:       https://www.nuget.org/api/v2/package/NUnit.Extension.NUnitV2ResultWriter/3.6.0#/nunit.extension.nunitv2resultwriter.3.6.0.nupkg
Source12:       https://www.nuget.org/api/v2/package/NUnit.Extension.NUnitV2Driver/3.8.0#/nunit.extension.nunitv2driver.3.8.0.nupkg
Source13:       https://www.nuget.org/api/v2/package/NUnit.Extension.TeamCityEventListener/1.0.7#/nunit.extension.teamcityeventlistener.1.0.7.nupkg
Source14:       https://www.nuget.org/api/v2/package/NUnit3TestAdapter/3.16.1#/nunit3testadapter.3.16.1.nupkg
Source15:       https://www.nuget.org/api/v2/package/OpenRA-Freetype6/1.0.4#/openra-freetype6.1.0.4.nupkg
Source16:       https://www.nuget.org/api/v2/package/OpenRA-OpenAL-CS/1.0.16#/openra-openal-cs.1.0.16.nupkg
Source17:       https://www.nuget.org/api/v2/package/OpenRA-SDL2-CS/1.0.28#/openra-sdl2-cs.1.0.28.nupkg
Source18:       https://www.nuget.org/api/v2/package/OpenRA-Eluant/1.0.17#/openra-eluant.1.0.17.nupkg
Source19:       https://www.nuget.org/api/v2/package/OpenRA-Open.NAT/1.0.0#/openra-open.nat.1.0.0.nupkg
Source20:       https://www.nuget.org/api/v2/package/OpenRA-FuzzyLogicLibrary/1.0.1#/openra-fuzzylogiclibrary.1.0.1.nupkg
Source21:       https://www.nuget.org/api/v2/package/DiscordRichPresence/1.0.150#/discordrichpresence.1.0.150.nupkg
Source22:       https://www.nuget.org/api/v2/package/rix0rrr.BeaconLib/1.0.2#/rix0rrr.beaconlib.1.0.2.nupkg
Source23:       https://www.nuget.org/api/v2/package/Microsoft.NETFramework.ReferenceAssemblies/1.0.0#/microsoft.netframework.referenceassemblies.1.0.0.nupkg
Source24:       https://www.nuget.org/api/v2/package/Microsoft.NETFramework.ReferenceAssemblies.NET472/1.0.0#/microsoft.netframework.referenceassemblies.net472.1.0.0.nupkg
Source25:       https://www.nuget.org/api/v2/package/Newtonsoft.Json/12.0.2#/newtonsoft.json.12.0.2.nupkg
Source26:       https://www.nuget.org/api/v2/package/NuGet.CommandLine/4.4.1#/nuget.commandline.4.4.1.nupkg
BuildRequires:  desktop-file-utils
BuildRequires:  dos2unix
BuildRequires:  git
BuildRequires:  hicolor-icon-theme
BuildRequires:  shared-mime-info
BuildRequires:  pkgconfig(mono)
BuildRequires:  msbuild
BuildRequires:  SDL2
BuildRequires:  openal-soft
BuildRequires:  freetype2
%if 0%{?suse_version}
BuildRequires:  fdupes
BuildRequires:  lua51
BuildRequires:  lua51-libs
%endif
%if 0%{?fedora_version}
BuildRequires:  lua = 5.1
%endif
Requires:       xdg-utils
Requires:       zenity
# don't provide the bundled dependencies to other packages
AutoReqProv:    no
# which means we have to define them manually
Requires:       SDL2
Requires:       openal-soft
Requires:       freetype2
Requires:       mono-core
%if 0%{?suse_version} >= 1330
Requires(pre):  group(games)
Requires(pre):  user(games)
%endif

%description
OpenRA is an Open Source, Real Time Strategy game engine.
Its primary focus is on creating an extendable platform
to recreate games in the style of the early Westwood games.
It ships mods that reimagine Command & Conquer: Tiberian Dawn,
Red Alert as well as Dune 2000 if the original game files are
provided.

%prep
%autosetup -n OpenRA-make-version-fail

cp %{SOURCE1} .
cp %{SOURCE2} .
cp %{SOURCE3} .

dos2unix Changelog.md

mkdir LocalNugetPackages
pushd LocalNugetPackages
cp %{SOURCE4} .
cp %{SOURCE5} .
cp %{SOURCE6} .
cp %{SOURCE7} .
cp %{SOURCE8} .
cp %{SOURCE9} .
cp %{SOURCE10} .
cp %{SOURCE11} .
cp %{SOURCE12} .
cp %{SOURCE13} .
cp %{SOURCE14} .
cp %{SOURCE15} .
cp %{SOURCE16} .
cp %{SOURCE17} .
cp %{SOURCE18} .
cp %{SOURCE19} .
cp %{SOURCE20} .
cp %{SOURCE21} .
cp %{SOURCE22} .
cp %{SOURCE23} .
cp %{SOURCE24} .
cp %{SOURCE25} .
cp %{SOURCE26} .
popd

make version VERSION="playtest-%{version}"

%build
make RUNTIME=mono DEBUG=true

./utility.sh all --man-page > openra.6

%install
make DESTDIR=%{buildroot} prefix=%{_prefix} install
make DESTDIR=%{buildroot} prefix=%{_prefix} install-linux-shortcuts
make DESTDIR=%{buildroot} prefix=%{_prefix} install-linux-appdata

install -Dm0644 openra.6 %{buildroot}%{_mandir}/man6/openra.6

%if 0%{?suse_version}
%fdupes %{buildroot}%{_prefix}/lib
%endif

mkdir -p %{buildroot}%{_localstatedir}/games/openra/ModMetadata/

%check
make check
make check-scripts
make test

%preun
mono %{_prefix}/lib/openra/OpenRA.Utility.exe ra --unregister-mod system
mono %{_prefix}/lib/openra/OpenRA.Utility.exe cnc --unregister-mod system
mono %{_prefix}/lib/openra/OpenRA.Utility.exe d2k --unregister-mod system

%posttrans
mono %{_prefix}/lib/openra/OpenRA.Utility.exe ra --register-mod %{_bindir}/openra-ra system
mono %{_prefix}/lib/openra/OpenRA.Utility.exe cnc --register-mod %{_bindir}/openra-cnc system
mono %{_prefix}/lib/openra/OpenRA.Utility.exe d2k --register-mod %{_bindir}/openra-d2k system

%files
%defattr(-,root,root)
%doc Changelog.md README.md
%license COPYING
%{_bindir}/openra-*
%{_prefix}/lib/openra/
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/metainfo/*.metainfo.xml
%{_mandir}/man6/openra.*
%{_datadir}/mime/packages/openra-*.xml
%attr(0775,games,games) %dir %{_localstatedir}/games/%{name}
%ghost %{_localstatedir}/games/openra/ModMetadata/

%changelog
openSUSE Build Service is sponsored by