%global buildno 20 %global buildid build%{buildno} %define app_id org.widelands.Widelands %define dir_appdata metainfo %if 0%{?rhel}%{?fedora} %if 0%{?rhel} %if 0%{?rhel} <= 7 %define dir_appdata appdata %endif %endif %endif %if 0%{!?_metainfodir:1} %define _metainfodir %{_datadir}/%{dir_appdata} %endif %define dir_metainfo %( echo "%{_metainfodir}" | xargs -I{} basename '{}' ) Name: widelands Version: 0 Release: 0.74.%{buildid}%{?dist} Group: Amusements/Games License: GPLv2+ URL: https://www.widelands.org Summary: Open source realtime-strategy game Source0: https://launchpad.net/widelands/%{buildid}/%{buildid}/+download/widelands-%{buildid}.tar.bz2 Source1: %{name}.svg %global PATCH0_desc Fix build on PPC64LE Patch0: widelands-build19-ppc64le.patch %global PATCH1_desc Fix build on GCC 9.1 Patch1: widelands-build20-gcc91.patch %global PATCH2_desc Fix undefined reference to glReadPixels Patch2: widelands-build20-gl.patch %global PATCH3_desc Update translations Patch3: widelands-build20-xdg-translations.patch # https://github.com/widelands/widelands/pull/3547 %global PATCH4_desc Move XDG-related stuff from debian/rules to xdg/CMakeLists.txt Patch4: widelands-build20-xdg-cmake.patch BuildRequires: coreutils findutils BuildRequires: bash BuildRequires: sed # gtk-update-icon-cache BuildRequires: gtk-update-icon-cache # appstream-util BuildRequires: libappstream-glib # convert BuildRequires: ImageMagick # xsltproc #BuildRequires: libxslt # xmllint #BuildRequires: libxml2 BuildRequires: xmlstarlet BuildRequires: git BuildRequires: SDL2-devel BuildRequires: SDL2_image-devel BuildRequires: SDL2_mixer-devel BuildRequires: SDL2_net-devel BuildRequires: SDL2_ttf-devel BuildRequires: boost-devel >= 1.48.0 BuildRequires: cmake BuildRequires: ctags BuildRequires: desktop-file-utils BuildRequires: gettext BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: glew-devel BuildRequires: libpng-devel BuildRequires: libicu-devel Requires: hicolor-icon-theme # The game contains a copy of these fonts, we replaces these with system fonts Requires: amiri-fonts Requires: dejavu-serif-fonts Requires: dejavu-sans-fonts Requires: dejavu-sans-mono-fonts Requires: drehatlas-widelands-fonts Requires: lklug-fonts Requires: wqy-microhei-fonts # https://fedoraproject.org/wiki/Packaging:Scriptlets # https://fedoraproject.org/wiki/PackagingDrafts/ScriptletSnippets Requires(post): coreutils Requires(postun): coreutils Requires(posttrans): coreutils # gtk-update-icon-cache #Requires(post): gtk-update-icon-cache Requires(postun): gtk-update-icon-cache Requires(posttrans): gtk-update-icon-cache # update-mime-database #Requires(post): shared-mime-info #Requires(postun): shared-mime-info #Requires(posttrans): shared-mime-info # update-desktop-database #Requires(post): desktop-file-utils #Requires(postun): desktop-file-utils #Requires(posttrans): desktop-file-utils # glib-compile-schemas #Requires(post): glib2 #Requires(postun): glib2 #Requires(posttrans): glib2 # ldconfig #Requires(post): glibc /sbin/ldconfig #Requires(postun): glibc /sbin/ldconfig #Requires(posttrans): glibc /sbin/ldconfig %description Widelands is an open source (GPLed), realtime-strategy game, using SDL and other free libraries, which is still under development. Widelands is inspired by Settlers II (Bluebyte) and is partly similar to it, so if you know it, you perhaps will have a thought, what Widelands is all about. %prep #%%autosetup -p1 -n "widelands-%{buildid}" %setup -q -n "widelands-%{buildid}" %global _default_patch_fuzz 2 %{__git} init %{__git} config user.email "widelands-owner@fedoraproject.org" %{__git} config user.name "Widelands owners" %{__git} add . %{__git} commit -m "base" -q %patch0 -p1 %{__git} commit -m "%PATCH0_desc" -a %patch1 -p1 %{__git} commit -m "%PATCH1_desc" -a %patch2 -p1 %{__git} commit -m "%PATCH2_desc" -a %{__git} apply %PATCH3 %{__git} commit -m "%PATCH3_desc" -a %{__git} apply %PATCH4 %{__git} commit -m "%PATCH4_desc" -a %{__cp} "%{SOURCE1}" "%{name}.svg" %build %{__mkdir} "build" pushd "build" LDFLAGS="-lGL" %{cmake} \ -DCMAKE_BUILD_TYPE="Release" \ -DCMAKE_INSTALL_PREFIX="%{_bindir}" \ -DWL_INSTALL_BASEDIR="%{_prefix}/share/%{name}" \ -DWL_INSTALL_DATADIR="%{_prefix}/share/%{name}" \ -DOPTION_BUILD_WEBSITE_TOOLS="OFF" \ .. %{__make} %{?_smp_mflags} popd # Create icons icon="%{name}.svg" %{__mkdir_p} "rpm_icons" for s in {16,22,24,32,48,64,72,96,128,192,256,512}; do size="${s}x${s}" %{__mkdir_p} "rpm_icons/${size}" convert -background none -density 1024 -resize "${size}" "${icon}" "rpm_icons/${size}/%{name}.png" done %install pushd "build" %{make_install} popd %if "%{dir_metainfo}" != "metainfo" [[ -d "%{buildroot}%{_metainfodir}" ]] || %{__mv} "%{buildroot}%{_datadir}/metainfo" "%{buildroot}%{_metainfodir}" %endif # https://github.com/hughsie/appstream-glib/pull/272#issuecomment-439812546 # https://bugs.launchpad.net/widelands/+bug/1807625 xmlstarlet ed --inplace -d '/component/releases/release[position()>1]' "%{buildroot}%{_metainfodir}/%{app_id}.appdata.xml" pushd "%{buildroot}" # Replace fonts with system fonts %{__rm} -r "usr/share/%{name}/i18n/fonts/amiri" %{__rm} -r "usr/share/%{name}/i18n/fonts/DejaVu" %{__rm} -r "usr/share/%{name}/i18n/fonts/MicroHei" %{__rm} -r "usr/share/%{name}/i18n/fonts/Sinhala" %{__rm} -r "usr/share/%{name}/i18n/fonts/Widelands"/* %{__ln_s} "/usr/share/fonts/amiri" "usr/share/%{name}/i18n/fonts/amiri" %{__ln_s} "/usr/share/fonts/dejavu" "usr/share/%{name}/i18n/fonts/DejaVu" %{__ln_s} "/usr/share/fonts/wqy-microhei" "usr/share/%{name}/i18n/fonts/MicroHei" %{__ln_s} "/usr/share/fonts/lklug" "usr/share/%{name}/i18n/fonts/Sinhala" %{__ln_s} "/usr/share/fonts/drehatlas-widelands/Widelands.otf" "usr/share/%{name}/i18n/fonts/Widelands/Widelands.ttf" # Scripting magic to add proper %%lang() markings to the locale files find "usr/share/widelands/locale/" -maxdepth 1 -type d -name \*_\* | %{__sed} -n 's#\(usr/share/widelands/locale/\(.*\)_.*\)#%lang(\2) /\1#p' > "%{_builddir}/widelands-%{buildid}/%{name}.files" find "usr/share/widelands/locale/" -maxdepth 1 -type d ! -name "*_*" | %{__sed} -n -e 's#\(usr/share/widelands/locale/\(.\+\)\)#%lang(\2) /\1#p' >> "%{_builddir}/widelands-%{buildid}/%{name}.files" find "usr/share/widelands/" -mindepth 1 -maxdepth 1 -not -name locale | %{__sed} -n 's#\(usr/share/widelands/*\)#/\1#p' >> "%{_builddir}/widelands-%{buildid}/%{name}.files" popd # Install icons find "rpm_icons" -mindepth 2 -maxdepth 2 -type f -name '%{name}.png' | sort -V | xargs -I{} dirname '{}' | xargs -I{} basename '{}' | while read -r size ; do %{__install} -p -D -m 0644 "rpm_icons/${size}/%{name}.png" "%{buildroot}%{_datadir}/icons/hicolor/${size}/apps/%{app_id}.png" done %{__install} -p -D -m 0644 "%{name}.svg" "%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{app_id}.svg" %check /usr/bin/desktop-file-validate "%{buildroot}/%{_datadir}/applications/%{app_id}.desktop" /usr/bin/appstream-util validate-relax --nonet "%{buildroot}%{_metainfodir}/%{app_id}.appdata.xml" %post /bin/touch --no-create "%{_datadir}/icons/hicolor" &> /dev/null || : #/usr/bin/update-mime-database -n "%{_datadir}/mime" &>/dev/null || : #/usr/bin/update-desktop-database &> /dev/null || : #/sbin/ldconfig %postun #if [[ "${1}" -eq "0" ]] ; then # /usr/bin/glib-compile-schemas "%{_datadir}/glib-2.0/schemas" &> /dev/null || : #fi #/usr/bin/update-desktop-database &> /dev/null || : if [[ "${1}" -eq "0" ]] ; then /bin/touch --no-create "%{_datadir}/icons/hicolor" &> /dev/null || : /usr/bin/gtk-update-icon-cache "%{_datadir}/icons/hicolor" &> /dev/null || : #/usr/bin/update-mime-database -n "%{_datadir}/mime" &>/dev/null || : fi #/sbin/ldconfig %posttrans #/usr/bin/glib-compile-schemas "%{_datadir}/glib-2.0/schemas" &> /dev/null || : /usr/bin/gtk-update-icon-cache "%{_datadir}/icons/hicolor" &> /dev/null || : #/usr/bin/update-mime-database -n "%{_datadir}/mime" &> /dev/null || : %files -f %{name}.files %doc ChangeLog CREDITS %license COPYING %{_bindir}/%{name} %{_datadir}/icons/hicolor/*/apps/*.??g %{_datadir}/applications/%{app_id}.desktop %{_mandir}/man6/%{name}.6* %{_metainfodir}/%{app_id}.appdata.xml %dir %{_datadir}/%{name} %dir %{_datadir}/%{name}/locale %changelog * Sun Oct 20 2019 Tomasz Tomasik - 0-0.74.build20 - Update XDG files * Thu Aug 08 2019 Tomasz Tomasik - 0-0.73.build20 - SPEC file cleanups - Add hi-res icons - Fix desktop and appdata files - Update requirements for EL7 - Rebuilt for EL7 * Sat Jul 27 2019 Fedora Release Engineering - 0-0.72.build20 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild * Sun Jul 14 2019 Hans de Goede - 0-0.71.build20 - Update to new upstream Build20 release * Sun Feb 03 2019 Fedora Release Engineering - 0-0.70.build19 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild * Fri Jan 25 2019 Jonathan Wakely - 0-0.69.build19 - Rebuilt for Boost 1.69 * Wed Jan 23 2019 Pete Walter - 0-0.68.build19 - Rebuild for ICU 63 * Thu Aug 23 2018 Nicolas Chauvet - 0-0.67.build19 - Rebuilt for glew 2.1.0 * Tue Aug 14 2018 Hans de Goede - 0-0.66.build19 - Fix FTBFS (rhbz#1606678) - Add appdata * Sat Jul 14 2018 Fedora Release Engineering - 0-0.65.build19 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild * Tue Jul 10 2018 Pete Walter - 0-0.64.build19 - Rebuild for ICU 62 * Mon Apr 30 2018 Pete Walter - 0-0.63.build19 - Rebuild for ICU 61.1 * Tue Feb 20 2018 Nils Philippsen - 0-0.62.build19 - require gcc, gcc-c++ for building - FTBFS: build with --std=gnu++11 on ppc64le * Thu Feb 08 2018 Hans de Goede - 0-0.61.build19 - Update to new upstream Build19 release (rhbz#1397883) - Strip 2012 and older changelog entries * Thu Jan 18 2018 Igor Gnatenko - 0-0.60.build18 - Remove obsolete scriptlets * Thu Aug 03 2017 Fedora Release Engineering - 0-0.59.build18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild * Thu Jul 27 2017 Fedora Release Engineering - 0-0.58.build18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Mon May 15 2017 Fedora Release Engineering - 0-0.57.build18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild * Sat Feb 11 2017 Fedora Release Engineering - 0-0.56.build18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Fri Jan 27 2017 Jonathan Wakely - 0-0.55.build18 - Rebuilt for Boost 1.63 * Tue Jan 10 2017 Orion Poplawski - 0-0.54.build18 - Rebuild for glew 2.0.0 * Fri Feb 05 2016 Fedora Release Engineering - 0-0.53.build18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild * Sat Jan 16 2016 Jonathan Wakely - 0-0.52.build18 - Rebuilt for Boost 1.60 * Thu Jan 14 2016 Adam Jackson - 0-0.51.build18 - Rebuild for glew 1.13 * Thu Aug 27 2015 Jonathan Wakely - 0-0.50.build18 - Rebuilt for Boost 1.59 * Wed Jul 29 2015 Fedora Release Engineering - 0-0.49.build18 - Rebuilt for https://fedoraproject.org/wiki/Changes/F23Boost159 * Wed Jul 22 2015 David Tardon - 0-0.48.build18 - rebuild for Boost 1.58 * Fri Jun 19 2015 Fedora Release Engineering - 0-0.47.build18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Sat May 02 2015 Kalev Lember - 0-0.46.build18 - Rebuilt for GCC 5 C++11 ABI change * Tue Jan 27 2015 Petr Machata - 0-0.45.build18 - Rebuild for boost 1.57.0 * Mon Aug 18 2014 Fedora Release Engineering - 0-0.44.build18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild * Fri Jun 13 2014 Hans de Goede - 0-0.43.build18 - Update to new upstream Build18 release (rhbz#1085517) - Rebuild for new SDL_gfx * Sun Jun 08 2014 Fedora Release Engineering - 0-0.42.build17 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Fri May 23 2014 Petr Machata - 0-0.41.build17 - Rebuild for boost 1.55.0 * Tue Dec 03 2013 Nils Philippsen - 0-0.40.build17 - use string literals as format strings (#1037384) * Mon Nov 18 2013 Dave Airlie - 0-0.39.build17 - rebuilt for GLEW 1.10 * Sun Aug 04 2013 Hans de Goede - 0-0.38.build17 - Build with compat-lua on f20+ * Sun Aug 04 2013 Fedora Release Engineering - 0-0.37.build17 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild * Tue Jul 30 2013 Petr Machata - 0-0.36.build17 - Rebuild for boost 1.54.0 * Sat Feb 09 2013 Parag Nemade - 0-0.35.build17 - Remove vendor tag from desktop file as per https://fedorahosted.org/fesco/ticket/1077 - Cleanup spec as per recently changed packaging guidelines