Blob Blame History Raw
%global commit 570ba7a8adc7973327ae612a3d535fd8621c41dd
%global date 20180321
%global shortcommit %(c=%{commit}; echo ${c:0:7})


Name:           openclonk
Summary:        Multiplayer action, tactics and skill game
Version:        8.1
Release:        9.%{date}git%{shortcommit}%{?dist}
URL:            http://www.openclonk.org/
Source0:        https://github.com/openclonk/openclonk/archive/%{commit}/%{name}-%{commit}.tar.gz
License:        ISC and CC-BY-SA

Source1:        %{name}-html.desktop
Source2:        %{name}-docs.png

BuildRequires:  boost-devel
BuildRequires:  cmake, gcc, gcc-c++
BuildRequires:  python2-devel
BuildRequires:  gtest-devel
BuildRequires:  libjpeg-devel
BuildRequires:  tinyxml-devel
BuildRequires:  pkgconfig(sdl2)
BuildRequires:  pkgconfig(SDL2_mixer)
BuildRequires:  pkgconfig(dri)
BuildRequires:  pkgconfig(freealut)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(gtksourceview-3.0)
BuildRequires:  pkgconfig(libpng12)
BuildRequires:  pkgconfig(libupnp)
BuildRequires:  pkgconfig(ogg)
BuildRequires:  pkgconfig(openal)
BuildRequires:  pkgconfig(sdl)
BuildRequires:  pkgconfig(vorbis)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xpm)
BuildRequires:  pkgconfig(xrandr)
BuildRequires:  pkgconfig(xxf86vm)
BuildRequires:  pkgconfig(zlib)
BuildRequires:  pkgconfig(xml2po)
BuildRequires:  qt5-qtbase-devel
BuildRequires:  readline-devel
BuildRequires:  desktop-file-utils
BuildRequires:  libappstream-glib
BuildRequires:  libxslt
BuildRequires:  gettext
BuildRequires:  libxml2-devel
BuildRequires:  gtk3-devel

Requires:       %{name}-data = %{version}-%{release}
Requires:       hicolor-icon-theme
Provides:       bundled(timsort)

%description
Clonk is a multiplayer-action-tactics-skill game.
It is often referred to as a mixture of The Settlers and Worms.
In a simple 2D antfarm-style landscape, the player controls
his crew of Clonks, small but robust humanoid beings.
The game encourages free play but the normal goal is to
either exploit valuable resources from the earth
by building a mine or fight each other on an arena-like map.

%package     data
Summary:     %{summary}
Requires:    %{name} = %{version}
BuildArch:   noarch

%description data
This package contains the data files for openclonk.

%package     doc
Summary:     Documentation for developing programs that will use %{name}
BuildArch:   noarch
Requires:    xdg-utils
Obsoletes:   %{name}-devel-docs < 0:8.1-9

%description doc
This package contains documentation needed for developing with %{name}.

%prep
%autosetup -n %{name}-%{commit}

# remove bundled tinyxml
rm -rf thirdparty/tinyxml
# remove bundled getopt
rm -rf thirdparty/getopt
# remove bundled natupnp
rm -rf thirdparty/natupnp
rm -rf planet/Tests.c4f
# change permission in src and docs folder
find src -type f | xargs chmod -v 644
find docs -type f | xargs chmod -v 644
find docs -type d | xargs chmod -v 755

# change permission due rpmlint W: spurious-executable-perm
chmod a-x README Credits.txt thirdparty/timsort/sort.h \
          COPYING TRADEMARK licenses/*

# Set directory for datafiles
sed -e 's|share/games/openclonk|share/openclonk|g' -i CMakeLists.txt

cp -p planet/COPYING COPYING-planet

%build
mkdir -p build && cd build

# -Werror=format-security/ flag prevents compilation
# https://github.com/openclonk/openclonk/issues/64
export LDFLAGS="$RPM_LD_FLAGS"
SETOPT_FLAGS=$(echo "%{optflags}" | sed -e 's/-Werror=format-security/-Wno-error=format-security/g')
%cmake -Wno-cpp -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_CXX_FLAGS:STRING="$SETOPT_FLAGS" \
 -DCMAKE_EXE_LINKER_FLAGS:STRING="$RPM_LD_FLAGS" \
 -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \
 -DCMAKE_SKIP_RPATH:BOOL=NO -DWITH_AUTOMATIC_UPDATE:BOOL=OFF \
 -DUSE_X11:BOOL=ON -DUSE_GTK:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=NO \
 -DUSE_STATIC_BOOST=OFF -DUSE_SYSTEM_TINYXML=ON \
 -DUSE_GCC_STYLE_LTCG:BOOL=OFF ..
%make_build

# build the English HTML-documentation from the English \
# XML-source files and the translation file
pushd ../docs
%make_build chm/en/Developer.chm
popd

%install
%make_install -C build
mv $RPM_BUILD_ROOT%{_prefix}/games/openclonk $RPM_BUILD_ROOT%{_bindir}/
rm -rf $RPM_BUILD_ROOT%{_prefix}/games

# Move upstream appdata file to metainfo/ directory
mkdir -p $RPM_BUILD_ROOT%{_datadir}/metainfo
mv $RPM_BUILD_ROOT%{_datadir}/appdata/*.appdata.xml $RPM_BUILD_ROOT%{_datadir}/metainfo/
rm -rf $RPM_BUILD_ROOT%{_datadir}/appdata

appstream-util validate-relax --nonet $RPM_BUILD_ROOT%{_datadir}/metainfo/*.appdata.xml

# W: wrong-file-end-of-line-encoding
sed -i 's/\r$//' docs/chm/en/Output.hhp

# HTML desktop files
install -pm 0644  %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/applications/
desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/*.desktop

# Set main desktop file (bz#1454638)
desktop-file-edit --remove-key=Comment[de] \
%if 0%{?fedora} && 0%{?fedora} < 31
 --set-key=Exec --set-value="env WAYLAND_DISPLAY= openclonk" \
%else
 --set-key=Exec --set-value=openclonk \
%endif
$RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop

mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
install -D -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}-docs.png

%files
%doc Version.txt README TRADEMARK Credits.txt
%license COPYING COPYING-planet
%{_bindir}/openclonk
%{_bindir}/c4group
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/applications/%{name}.desktop
%{_datadir}/metainfo/*.appdata.xml

%files data
%{_datadir}/%{name}/

%files doc
%license COPYING COPYING-planet
%doc docs/chm/en
%{_datadir}/applications/%{name}-html.desktop
%{_datadir}/pixmaps/%{name}-docs.png

%changelog
* Wed Jan 29 2020 Antonio Trande <sagitter@fedoraproject.org> - 8.1-9.20180321git570ba7a
- Obsoletes devel-docs sub-package
- Add python2-devel BR

* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 8.1-8.20180321git570ba7a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 8.1-7.20180321git570ba7a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 8.1-6.20180321git570ba7a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Thu Aug 23 2018 Nicolas Chauvet <kwizart@gmail.com> - 8.1-5.20180321git570ba7a
- Rebuilt for glew 2.1.0

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 8.1-4.20180321git570ba7a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Wed Mar 21 2018 Antonio Trande <sagitter@fedoraproject.org> - 8.1-3.20180321git570ba7a
- Update to commit #570ba7a (blake2 no-SSE reloaded) for upstream bug #69

* Sun Mar 18 2018 Antonio Trande <sagitter@fedoraproject.org> - 8.1-2
- ExclusiveArch for upstream bug #69

* Sat Mar 17 2018 Martin Gansser <martinkg@fedoraproject.org> - 8.1-1
- Update to 8.1 (bz#1557656)
- Add BR gcc

* Fri Feb 09 2018 Antonio Trande <sagitter@fedoraproject.org> - 8.0-2
- Set USE_GCC_STYLE_LTCG CMake option

* Fri Feb 09 2018 Martin Gansser <martinkg@fedoraproject.org> - 8.0-1
- Update to version 8.0
- Disable Werror=format-security flag (https://github.com/openclonk/openclonk/issues/64)
- Use appdata file from upstream

* Thu Jan 18 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 7.0-10
- Remove obsolete scriptlets

* Fri Dec 22 2017 Antonio Trande <sagitter@fedoraproject.org> - 7.0-9
- Appdata file moved into metainfo data directory

* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 7.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 7.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Jun 24 2017 Antonio Trande <sagitter@fedoraproject.org> - 7.0-6
- Set main desktop file (bz#1454638)

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 7.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Tue Jan 10 2017 Orion Poplawski <orion@cora.nwra.com> - 7.0-4
- Rebuild for glew 2.0.0

* Tue May 10 2016 Antonio Trande <sagitter@fedoraproject.org> - 7.0-3
- Made sub-package for documentation

* Sun May 08 2016 Antonio Trande <sagitter@fedoraproject.org> - 7.0-2
- Unbundle getopt
- Strip all .png files
- Make an appdata file

* Sat May 07 2016 Antonio Trande <sagitter@fedoraproject.org> - 7.0-1
- First package