c640f19
Name: colobot
41888d3
%global orgname info.colobot.Colobot
41888d3
17848ae
Version: 0.2.1
ec791c2
Release: 5%{?dist}
5f538b5
Summary: A video game that teaches programming in a fun way
5f538b5
2807b7a
License: GPL-3.0-only
5f538b5
URL: https://colobot.info
5f538b5
5f538b5
%global giturl https://github.com/colobot
5f538b5
%global gittag colobot-gold-%{version}-alpha
5f538b5
Source0: %{giturl}/colobot/archive/%{gittag}/colobot-%{gittag}.tar.gz
5f538b5
Source1: %{giturl}/colobot-data/archive/%{gittag}/colobot-data-%{gittag}.tar.gz
17848ae
Source2: https://colobot.info/files/music/colobot-music_ogg_%{version}-alpha.tar.gz
709f14f
ad8b089
# The game uses the translated string "Player" as the default player name
ad8b089
# yet it does not properly handle UTF-8 in player names,
ad8b089
# so non-English speakers may have the game always crash when putting in the player name.
ad8b089
#
ad8b089
# See: https://github.com/colobot/colobot/issues/1268 
f11ee2f
Patch0: 0000-do-not-translate-default-player-name.patch
ad8b089
f11ee2f
# Fix test compilation failure due to C++ "One Definition Rule" violation
f11ee2f
Patch1: 0001-fix-test-compile-failure.patch
ad8b089
6fdd213
# Fix compilation failures due to GCC12 -Wrestrict warnings
6fdd213
# See: https://bugzilla.redhat.com/show_bug.cgi?id=2047428
6fdd213
Patch2: 0002-fix-gcc12-memcpy-restrict-warnings.patch
1b541e3
0c62732
# Tests fail on ARM architectures. Needs some investigation.
0c62732
%ifarch %{arm} aarch64
0c62732
%global with_tests 0
0c62732
%else
0c62732
%global with_tests 1
0c62732
%endif
0c62732
5f538b5
BuildRequires: cmake >= 2.8
5f538b5
BuildRequires: desktop-file-utils
5f538b5
BuildRequires: gcc-c++
f11ee2f
BuildRequires: libappstream-glib
f11ee2f
BuildRequires: po4a
f11ee2f
BuildRequires: xmlstarlet
f11ee2f
BuildRequires: %{_bindir}/pod2man
f11ee2f
BuildRequires: %{_bindir}/rsvg-convert
f11ee2f
f11ee2f
BuildRequires: boost-devel >= 1.51
f11ee2f
BuildRequires: boost-filesystem >= 1.51
f11ee2f
BuildRequires: boost-regex >= 1.51
5f538b5
BuildRequires: gettext-devel >= 0.18
5f538b5
BuildRequires: glew-devel >= 1.8.0
0c62732
%if %{with_tests}
f11ee2f
BuildRequires: gtest-devel
0c62732
%endif
5f538b5
BuildRequires: libogg-devel >= 1.3.0
5f538b5
BuildRequires: libpng-devel >= 1.2
5f538b5
BuildRequires: libsndfile-devel >= 1.0.25
5f538b5
BuildRequires: libvorbis >= 1.3.2
5f538b5
BuildRequires: openal-soft-devel >= 1.13
5f538b5
BuildRequires: physfs-devel
2d3fea4
BuildRequires: python3-devel
f11ee2f
BuildRequires: SDL2-devel
f11ee2f
BuildRequires: SDL2_image-devel
f11ee2f
BuildRequires: SDL2_ttf-devel
5f538b5
5f538b5
Requires: colobot-data = %{version}-%{release}
5f538b5
Requires: colobot-music = %{version}-%{release}
5f538b5
Requires: hicolor-icon-theme
5f538b5
5f538b5
%description
5f538b5
Colobot: Gold Edition is a real-time strategy game, where you can program
5f538b5
your units (bots) in a language called CBOT, which is similar to C++ and Java.
5f538b5
Your mission is to find a new planet to live and survive.
5f538b5
You can save the humanity and get programming skills!
5f538b5
5f538b5
5f538b5
%package data
5f538b5
Summary: Data files for Colobot: Gold Edition
5f538b5
BuildArch: noarch
5f538b5
5f538b5
%description data
5f538b5
Data files (graphics, sounds, levels) required to run Colobot Gold.
5f538b5
5f538b5
5f538b5
%package music
5f538b5
Summary: Music for Colobot: Gold Edition
5f538b5
BuildArch: noarch
5f538b5
5f538b5
%description music
5f538b5
Music files used by Colobot Gold.
5f538b5
5f538b5
5f538b5
%prep
6fdd213
%autosetup -n colobot-%{gittag} -p1
5f538b5
17848ae
# Unpack the -data tarball
5f538b5
rm -rf ./data
17848ae
tar xzf %{SOURCE1}
5f538b5
mv ./colobot-data-%{gittag} ./data
5f538b5
17848ae
# Unpack the -music tarball
17848ae
pushd data/music
17848ae
tar xzf %{SOURCE2}
17848ae
popd
5f538b5
17848ae
# Fix install paths
5f538b5
sed \
f11ee2f
	-e 's|set(COLOBOT_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/games |set(COLOBOT_INSTALL_BIN_DIR %{_bindir}/ |' \
f11ee2f
	-e 's|set(COLOBOT_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib/colobot |set(COLOBOT_INSTALL_LIB_DIR %{_libdir}/colobot |' \
f11ee2f
	-e 's|set(COLOBOT_INSTALL_DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/games/colobot |set(COLOBOT_INSTALL_DATA_DIR %{_datadir}/colobot |' \
f11ee2f
	-e 's|set(COLOBOT_INSTALL_I18N_DIR ${CMAKE_INSTALL_PREFIX}/share/locale |set(COLOBOT_INSTALL_I18N_DIR %{_datadir}/locale |' \
f11ee2f
	-e 's|set(COLOBOT_INSTALL_DOC_DIR ${CMAKE_INSTALL_PREFIX}/share/doc/colobot |set(COLOBOT_INSTALL_DOC_DIR %{_datadir}/doc/colobot |' \
f11ee2f
	-i CMakeLists.txt
5f538b5
5f538b5
5f538b5
%build
f11ee2f
%cmake \
f11ee2f
	-DCMAKE_BUILD_TYPE=Release \
f11ee2f
	-DDESKTOP=ON \
f11ee2f
	-DPORTABLE=OFF \
f11ee2f
	-DPYTHON_EXECUTABLE=%{__python3} \
f11ee2f
	-DUSE_RELATIVE_PATHS=OFF \
f918fc7
	-DTESTS=%{with_tests}
c640f19
%cmake_build
5f538b5
5f538b5
5f538b5
%install
c640f19
%cmake_install
41888d3
41888d3
# Change the .desktop file name to match the .appdata.xml file name
41888d3
mv %{buildroot}%{_datadir}/applications/%{name}.desktop %{buildroot}%{_datadir}/applications/%{orgname}.desktop
41888d3
sed -e 's|%{name}.desktop|%{orgname}.desktop|' -i %{buildroot}%{_metainfodir}/%{orgname}.appdata.xml
41888d3
5f538b5
%find_lang %{name} --with-man
5f538b5
5f538b5
5f538b5
%check
0c62732
%if %{with_tests}
f11ee2f
# Run unit tests. The test suite includes tests for parsing the .ini file,
f11ee2f
# hence the test runner requires a colobot.ini file to read.
f11ee2f
mkdir test-run-dir
6fdd213
cp -a --target-directory ./test-run-dir \
f11ee2f
	test/unit/common/colobot.ini \
6fdd213
	%{_vpath_builddir}/colobot_ut
f11ee2f
pushd test-run-dir
f11ee2f
	./colobot_ut
f11ee2f
popd
0c62732
%endif
f11ee2f
41888d3
desktop-file-validate %{buildroot}%{_datadir}/applications/%{orgname}.desktop
41888d3
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/%{orgname}.appdata.xml
5f538b5
5f538b5
5f538b5
%files -f %{name}.lang
5f538b5
%license LICENSE.txt
5f538b5
%{_bindir}/%{name}
5f538b5
%{_libdir}/%{name}/
5f538b5
41888d3
%{_datadir}/applications/%{orgname}.desktop
41888d3
%{_metainfodir}/%{orgname}.appdata.xml
41888d3
5f538b5
%{_datadir}/icons/hicolor/**/apps/%{name}.png
5f538b5
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
5f538b5
%{_mandir}/man6/%{name}.6*
5f538b5
5f538b5
5f538b5
%files data
5f538b5
%license LICENSE.txt
5f538b5
%{_datadir}/%{name}/
5f538b5
%exclude %{_datadir}/%{name}/music
5f538b5
5f538b5
5f538b5
%files music
5f538b5
%license LICENSE.txt
5f538b5
%dir %{_datadir}/%{name}/
5f538b5
%{_datadir}/%{name}/music/
5f538b5
5f538b5
5f538b5
%changelog
ec791c2
* Mon Jan 29 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.1-5
ec791c2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
ec791c2
c4f70f9
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.1-4
c4f70f9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
c4f70f9
7225ff5
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.1-3
7225ff5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
7225ff5
e5325fa
* Thu Jan 18 2024 Jonathan Wakely <jwakely@redhat.com> - 0.2.1-2
e5325fa
- Rebuilt for Boost 1.83
e5325fa
17848ae
* Mon Aug 07 2023 Artur Frenszek-Iwicki <fedora@svgames.pl> - 0.2.1-1
17848ae
- Update to v0.2.1
17848ae
- Drop Patch3 (missing <cstdint> includes - submitted and merged upstream)
17848ae
8602f9f
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-11
8602f9f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
8602f9f
82f8061
* Mon Feb 20 2023 Jonathan Wakely <jwakely@redhat.com> - 0.2.0-10
82f8061
- Rebuilt for Boost 1.81
82f8061
d1a7899
* Thu Jan 19 2023 Artur Frenszek-Iwicki <fedora@svgames.pl> - 0.2.0-9
d1a7899
- Add a patch to fix build failures with GCC13
d1a7899
99959ea
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-8
99959ea
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
99959ea
2807b7a
* Tue Dec 27 2022 msuchy <msuchy@redhat.com> - 0.2.0-7
2807b7a
- migrate to SPDX license
2807b7a
a31e0ef
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-6
a31e0ef
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
a31e0ef
b8927e2
* Wed May 04 2022 Thomas Rodgers <trodgers@redhat.com> - 0.2.0-5
b8927e2
- Rebuilt for Boost 1.78
b8927e2
6fdd213
* Sun Feb 20 2022 Artur Frenszek-Iwicki <fedora@svgames.pl> - 0.2.0-4
6fdd213
- Add a patch to fix build failures with gcc-12
6fdd213
66ec2ce
* Thu Feb 10 2022 Orion Poplawski <orion@nwra.com> - 0.2.0-3
66ec2ce
- Rebuild for glew 2.2
66ec2ce
747a4d8
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.0-2
747a4d8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
747a4d8
f11ee2f
* Sun Aug 22 2021 Artur Frenszek-Iwicki <fedora@svgames.pl> - 0.2.0-1
f11ee2f
- Update to v0.2.0
f11ee2f
- Drop Patch1 (missing includes - accepted upstream)
f11ee2f
- Drop Patch2 (potential NULL casts - accepted upstream)
f11ee2f
- Explicitly set some CMake options instead of relying on upstream defaults
f11ee2f
- Build tests and run them in %%check
f11ee2f
decb09a
* Fri Aug 06 2021 Jonathan Wakely <jwakely@redhat.com> - 0.1.12-14
decb09a
- Rebuilt for Boost 1.76
decb09a
76a4666
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.12-13
76a4666
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
76a4666
2a983fa
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.12-12
2a983fa
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
2a983fa
f4468d5
* Fri Jan 22 2021 Jonathan Wakely <jwakely@redhat.com> - 0.1.12-11
f4468d5
- Rebuilt for Boost 1.75
f4468d5
1b541e3
* Thu Sep 03 2020 Jeff Law <law@redhat.com> - 0.1.12-10
1b541e3
- Fix dynamic casts to avoid gcc-11 diagnostics
1b541e3
c640f19
* Tue Jul 28 2020 Artur Iwicki <fedora@svgames.pl> - 0.1.12-9
c640f19
- Update spec to use the new cmake_build and cmake_install macros
c640f19
3d093de
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.12-8
3d093de
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
3d093de
50a53e7
* Tue Jun 23 2020 Artur Iwicki <fedora@svgames.pl> - 0.1.12-7
50a53e7
- Edit Patch1 (missing includes) - fix build failures on Rawhide
50a53e7
477e1f8
* Fri Feb 07 2020 Artur Iwicki <fedora@svgames.pl> - 0.1.12-6
477e1f8
- Add a patch to fix build failures in Rawhide
477e1f8
a06de6f
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.12-5
a06de6f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
a06de6f
ad8b089
* Mon Oct 07 2019 Artur Iwicki <fedora@svgames.pl> - 0.1.12-4
ad8b089
- Make the game always use "Player" as the default player name
ad8b089
  (fixes the game crashing under certain system locale settings)
41888d3
- Rename the .desktop file to match the .appdata.xml file name
ad8b089
8f2c8b4
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.12-3
8f2c8b4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
8f2c8b4
2d3fea4
* Sun Feb 24 2019 Artur Iwicki <fedora@svgames.pl> - 0.1.12-2
2d3fea4
- Replace python3 BR with python3-devel
2d3fea4
- Move music files to the fepdkg lookaside cache
2d3fea4
2d3fea4
* Sun Feb 24 2019 Artur Iwicki <fedora@svgames.pl> - 0.1.12-1
1e5b30c
- Update to newest upstream release
1e5b30c
- Drop Patch0 (appdata.xml file) - merged upstream
1e5b30c
- Drop Patch1 (use snprintf() instead of sprintf()) - issue fixed upstream
1e5b30c
- Drop Patch2 (strncpy() fix) - merged upstream
1e5b30c
709f14f
* Sat Feb 02 2019 Artur Iwicki <fedora@svgames.pl> - 0.1.11.1-8
709f14f
- Add a patch for strncpy() usages
709f14f
ab5c9d6
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.11.1-8
ab5c9d6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
ab5c9d6
18b47ee
* Mon Nov 19 2018 Miro HronĨok <miro@hroncok.cz> - 0.1.11.1-7
18b47ee
- Use python3 during build instead of python2
18b47ee
5f538b5
* Tue Nov 13 2018 Artur Iwicki <fedora@svgames.pl> - 0.1.11.1-6
5f538b5
- Use %%find_lang for .mo files and man pages
5f538b5
5f538b5
* Thu Nov 08 2018 Artur Iwicki <fedora@svgames.pl> - 0.1.11.1-5
5f538b5
- Change the Summary: to something more descriptive
5f538b5
- Add a comment on music files
5f538b5
- Preserve timestamps on music files
5f538b5
5f538b5
* Thu Nov 08 2018 Artur Iwicki <fedora@svgames.pl> - 0.1.11.1-4
5f538b5
- Add a Requires: for hicolor-icon-theme
5f538b5
- Validate the desktop and appdata file
5f538b5
5f538b5
* Sun Nov 04 2018 Artur Iwicki <fedora@svgames.pl> - 0.1.11.1-3
5f538b5
- Fix build failures on F28 and later
5f538b5
5f538b5
* Mon Oct 29 2018 Artur Iwicki <fedora@svgames.pl> - 0.1.11.1-2
5f538b5
- Add an Appdata XML file
5f538b5
- Move music into a separate subpackage
5f538b5
5f538b5
* Tue Oct 16 2018 Artur Iwicki <fedora@svgames.pl> - 0.1.11.1-1
5f538b5
- Initial packaging