c640f19
Name: colobot
41888d3
%global orgname info.colobot.Colobot
41888d3
f11ee2f
Version: 0.2.0
6fdd213
Release: 4%{?dist}
5f538b5
Summary: A video game that teaches programming in a fun way
5f538b5
5f538b5
License: GPLv3
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
5f538b5
5f538b5
# Music files are licensed under GPLv3, like the rest of the game.
5f538b5
# They are not kept in the colobot-data repo, and by default are downloaded during the build.
5f538b5
# Since Fedora builders have net-access disabled, we need to download them beforehand.
5f538b5
%global musicurl https://colobot.info/files/music
5f538b5
Source100: %{musicurl}/Intro1.ogg
5f538b5
Source101: %{musicurl}/Intro2.ogg
5f538b5
Source102: %{musicurl}/music002.ogg
5f538b5
Source103: %{musicurl}/music003.ogg
5f538b5
Source104: %{musicurl}/music004.ogg
5f538b5
Source105: %{musicurl}/music005.ogg
5f538b5
Source106: %{musicurl}/music006.ogg
5f538b5
Source107: %{musicurl}/music007.ogg
5f538b5
Source108: %{musicurl}/music008.ogg
5f538b5
Source109: %{musicurl}/music009.ogg
5f538b5
Source110: %{musicurl}/music010.ogg
5f538b5
Source111: %{musicurl}/music011.ogg
5f538b5
Source112: %{musicurl}/music012.ogg
5f538b5
Source113: %{musicurl}/music013.ogg
5f538b5
Source114: %{musicurl}/Constructive.ogg
5f538b5
Source115: %{musicurl}/Humanitarian.ogg
5f538b5
Source116: %{musicurl}/Hv2.ogg
5f538b5
Source117: %{musicurl}/Quite.ogg
5f538b5
Source118: %{musicurl}/Infinite.ogg
5f538b5
Source119: %{musicurl}/Proton.ogg
5f538b5
Source120: %{musicurl}/Prototype.ogg
5f538b5
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
5f538b5
rm -rf ./data
5f538b5
cp %{SOURCE1} ./data.tgz
5f538b5
tar xzf ./data.tgz
5f538b5
rm ./data.tgz
5f538b5
mv ./colobot-data-%{gittag} ./data
5f538b5
5f538b5
cp -a %{SOURCE100} data/music/
5f538b5
cp -a %{SOURCE101} data/music/
5f538b5
cp -a %{SOURCE102} data/music/
5f538b5
cp -a %{SOURCE103} data/music/
5f538b5
cp -a %{SOURCE104} data/music/
5f538b5
cp -a %{SOURCE105} data/music/
5f538b5
cp -a %{SOURCE106} data/music/
5f538b5
cp -a %{SOURCE107} data/music/
5f538b5
cp -a %{SOURCE108} data/music/
5f538b5
cp -a %{SOURCE109} data/music/
5f538b5
cp -a %{SOURCE110} data/music/
5f538b5
cp -a %{SOURCE111} data/music/
5f538b5
cp -a %{SOURCE112} data/music/
5f538b5
cp -a %{SOURCE113} data/music/
5f538b5
cp -a %{SOURCE114} data/music/
5f538b5
cp -a %{SOURCE115} data/music/
5f538b5
cp -a %{SOURCE116} data/music/
5f538b5
cp -a %{SOURCE117} data/music/
5f538b5
cp -a %{SOURCE118} data/music/
5f538b5
cp -a %{SOURCE119} data/music/
5f538b5
cp -a %{SOURCE120} data/music/
5f538b5
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 \
0c62732
	-DTESTS=%{with_tests} \
f11ee2f
	./
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
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