diff --git a/.gitignore b/.gitignore index e69de29..798e7a7 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +/7kaa-2.14.5.tar.xz +/7kaa-formatSecurity.patch diff --git a/7kaa-formatSecurity.patch b/7kaa-formatSecurity.patch new file mode 100644 index 0000000..7af2331 --- /dev/null +++ b/7kaa-formatSecurity.patch @@ -0,0 +1,75 @@ +diff -up ./src/client/ORACERES.cpp.libintl ./src/client/ORACERES.cpp +--- ./src/client/ORACERES.cpp.libintl 2015-05-19 11:00:20.000000000 +1000 ++++ ./src/client/ORACERES.cpp 2015-05-31 23:48:19.960448911 +1000 +@@ -27,7 +27,7 @@ + #include + #include + #include +-#include "gettext.h" ++#include + + //---------- #define constant ------------// + +@@ -540,52 +540,52 @@ static void translate_race_adjective(cha + if( strncmp(adjective, "Norman", RaceInfo::ADJECTIVE_LEN) == 0 ) + { + // TRANSLATORS: "the Norman Scroll of Power" +- snprintf( adjective, RaceInfo::ADJECTIVE_LEN+1, pgettext("Race Adjective", "Norman") ); ++ strncpy( adjective, pgettext("Race Adjective", "Norman"), RaceInfo::ADJECTIVE_LEN+1 ); + } + else if( strncmp(adjective, "Mayan", RaceInfo::ADJECTIVE_LEN) == 0 ) + { + // TRANSLATORS: "the Mayan Scroll of Power" +- snprintf( adjective, RaceInfo::ADJECTIVE_LEN+1, pgettext("Race Adjective", "Mayan") ); ++ strncpy( adjective, pgettext("Race Adjective", "Mayan"), RaceInfo::ADJECTIVE_LEN+1 ); + } + else if( strncmp(adjective, "Greek", RaceInfo::ADJECTIVE_LEN) == 0 ) + { + // TRANSLATORS: "the Greek Scroll of Power" +- snprintf( adjective, RaceInfo::ADJECTIVE_LEN+1, pgettext("Race Adjective", "Greek") ); ++ strncpy( adjective, pgettext("Race Adjective", "Greek"), RaceInfo::ADJECTIVE_LEN+1 ); + } + else if( strncmp(adjective, "Viking", RaceInfo::ADJECTIVE_LEN) == 0 ) + { + // TRANSLATORS: "the Viking Scroll of Power" +- snprintf( adjective, RaceInfo::ADJECTIVE_LEN+1, pgettext("Race Adjective", "Viking") ); ++ strncpy( adjective, pgettext("Race Adjective", "Viking"), RaceInfo::ADJECTIVE_LEN+1 ); + } + else if( strncmp(adjective, "Persian", RaceInfo::ADJECTIVE_LEN) == 0 ) + { + // TRANSLATORS: "the Persian Scroll of Power" +- snprintf( adjective, RaceInfo::ADJECTIVE_LEN+1, pgettext("Race Adjective", "Persian") ); ++ strncpy( adjective, pgettext("Race Adjective", "Persian"), RaceInfo::ADJECTIVE_LEN+1 ); + } + else if( strncmp(adjective, "Chinese", RaceInfo::ADJECTIVE_LEN) == 0 ) + { + // TRANSLATORS: "the Chinese Scroll of Power" +- snprintf( adjective, RaceInfo::ADJECTIVE_LEN+1, pgettext("Race Adjective", "Chinese") ); ++ strncpy( adjective, pgettext("Race Adjective", "Chinese"), RaceInfo::ADJECTIVE_LEN+1 ); + } + else if( strncmp(adjective, "Japanese", RaceInfo::ADJECTIVE_LEN) == 0 ) + { + // TRANSLATORS: "the Japanese Scroll of Power" +- snprintf( adjective, RaceInfo::ADJECTIVE_LEN+1, pgettext("Race Adjective", "Japanese") ); ++ strncpy( adjective, pgettext("Race Adjective", "Japanese"), RaceInfo::ADJECTIVE_LEN+1 ); + } + else if( strncmp(adjective, "Egyptian", RaceInfo::ADJECTIVE_LEN) == 0 ) + { + // TRANSLATORS: "the Egyptian Scroll of Power" +- snprintf( adjective, RaceInfo::ADJECTIVE_LEN+1, pgettext("Race Adjective", "Egyptian") ); ++ strncpy( adjective, pgettext("Race Adjective", "Egyptian"), RaceInfo::ADJECTIVE_LEN+1 ); + } + else if( strncmp(adjective, "Mughul", RaceInfo::ADJECTIVE_LEN) == 0 ) + { + // TRANSLATORS: "the Mughul Scroll of Power" +- snprintf( adjective, RaceInfo::ADJECTIVE_LEN+1, pgettext("Race Adjective", "Mughul") ); ++ strncpy( adjective, pgettext("Race Adjective", "Mughul"), RaceInfo::ADJECTIVE_LEN+1 ); + } + else if( strncmp(adjective, "Zulu", RaceInfo::ADJECTIVE_LEN) == 0 ) + { + // TRANSLATORS: "the Zulu Scroll of Power" +- snprintf( adjective, RaceInfo::ADJECTIVE_LEN+1, pgettext("Race Adjective", "Zulu") ); ++ strncpy( adjective, pgettext("Race Adjective", "Zulu"), RaceInfo::ADJECTIVE_LEN+1 ); + } + } + //---------- End of function translate_race_adjective -----------// diff --git a/7kaa.spec b/7kaa.spec new file mode 100644 index 0000000..330bebc --- /dev/null +++ b/7kaa.spec @@ -0,0 +1,183 @@ +%global icon_file 7kaa_icon.png +%global icon_dest_dir %{_datadir}/icons/hicolor/32x32/apps +Name: 7kaa +Version: 2.14.5 +Release: 8%{?dist} +Summary: Seven Kingdoms: Ancient Adversaries + +License: GPLv3+ and GPLv2+ +URL: http://7kfans.com/ +Source0: http://sourceforge.net/projects/skfans/files/%{name}-%{version}.tar.xz +Source1: %{name}.autodlrc +Patch0: http://sf.net/p/skfans/bugs/4/attachment/%{name}-formatSecurity.patch + +BuildRequires: SDL2-devel, SDL2_net-devel +BuildRequires: enet-devel +BuildRequires: openal-soft-devel, autoconf +BuildRequires: gettext-devel +BuildRequires: desktop-file-utils +BuildRequires: ImageMagick +Requires: %{name}-data = %{version}-%{release} + +%description +Seven Kingdoms is a real-time strategy (RTS) computer game developed +by Trevor Chan of Enlight Software. The game enables players to +compete against up to six other kingdoms allowing players to conquer +opponents by defeating them in war (with troops or machines), +capturing their buildings with spies, or offering opponents money +for their kingdom. + +Seven Kingdoms: Ancient Adversaries is a free patch provided by +Interactive Magic and added three new cultures, the Egyptians, the +Mughals and the Zulus, and a new war machine, Unicorn. + +%package data +BuildArch: noarch +Summary: In-Game data Seven Kingdoms: Ancient Adversaries + +Requires: %{name} = %{version}-%{release} +Requires: hicolor-icon-theme + +%description data +In-Game music data Seven Kingdoms: Ancient Adversaries + +%package music +License: Redistributable, no modification permitted +BuildArch: noarch +Summary: In-Game music for Seven Kingdoms: Ancient Adversaries + +Requires: %{name}-data = %{version}-%{release} +Requires: autodownloader, sudo + +%description music +In-Game music for Seven Kingdoms: Ancient Adversaries +Due to license issue, you need to run 7kaa-data-installer install the music. + +%prep +%setup -q +%patch0 -p0 -b .formatSecurity + +%build +%configure +make %{?_smp_mflags} +convert data/image/7k_icon.bmp %{icon_file} + + +%install +%make_install +mkdir -p %{buildroot}%{icon_dest_dir} +install -m 644 %{icon_file} %{buildroot}%{icon_dest_dir} + +### == desktop file +cat>%{name}.desktop<%{data_installer}< /dev/stderr + exit 2 +fi +if ! /usr/share/autodl/AutoDL.py %{prj_music_dir}/%{name}.autodlrc; then + echo "Error on music download" > /dev/stderr + exit 3 +fi +cd /tmp/%{name}-music +tar xjvf /tmp/%{name}-music/%{name}-music.tar.bz2 +sudo install -v -m 644 /tmp/%{name}-music/%{name}-music/music/* /usr/share/%{name}/music +sudo install -v -m 644 /tmp/%{name}-music/%{name}-music/*.txt /usr/share/doc/%{name}-music +echo "Done" +END + +install -m 755 %{data_installer} %{buildroot}%{_bindir}/%{data_installer} +install -m 644 %{SOURCE1} %{buildroot}%{prj_music_dir} + +%post data +/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : + +%postun data +if [ $1 -eq 0 ] ; then + /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null + if [ -x /usr/bin/gtk-update-icon-cache ];then + /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : + fi +fi + +%posttrans data +if [ -x /usr/bin/gtk-update-icon-cache ];then + /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : +fi + +%postun music +rm -fr %{prj_music_dir} + +%files +%doc README +%license COPYING +%{_bindir}/%{name} +%{_datadir}/applications/%{name}.desktop + +%files data +%dir %{_datadir}/%{name} +%{_datadir}/%{name}/[^m]* +%{icon_dest_dir}/%{icon_file} + +%files music +%{_bindir}/%{data_installer} +%dir %{prj_music_dir} +%{prj_music_dir}/%{name}.autodlrc +%dir %{_docdir}/%{name}-music + +%changelog +* Fri Jun 26 2015 Ding-Yi Chen 2.14.5-8 +- Use name macro whenever possible. + +* Wed Jun 24 2015 Ding-Yi Chen 2.14.5-7 +- Fix the .desktop file. + +* Tue Jun 23 2015 Ding-Yi Chen 2.14.5-6 +- Requires: hicolor-icon-theme +- License become GPLv3+ and GPLv2+ as "gettext.h" is GPLv3 + +* Wed Jun 17 2015 Ding-Yi Chen 2.14.5-5 +- Fix for Review Request Comment #11 + +* Tue Jun 16 2015 Ding-Yi Chen 2.14.5-4 +- Fix for Review Request Comment #10 + +* Tue Jun 02 2015 Ding-Yi Chen 2.14.5-3 +- Fix for Review Request Comment #8 + +* Mon Jun 01 2015 Ding-Yi Chen 2.14.5-2 +- Fix for Review Request Comment #6 + +* Sun May 31 2015 Ding-Yi Chen 2.14.5-1 +- Upstream update to 2.14.5 +- BuildRequires: add enet-devel +- Use autodownloader to download music. + +* Wed May 27 2015 Ding-Yi Chen 2.14.4-2 +- Remove music. + +* Tue May 05 2015 Ding-Yi Chen 2.14.4-1 +- Initial packaging. + diff --git a/sources b/sources index e69de29..c5acfd1 100644 --- a/sources +++ b/sources @@ -0,0 +1,2 @@ +83152b21973c1b3df8de525bda434be4 7kaa-2.14.5.tar.xz +77c36c99a387bf86d311d5a784395119 7kaa-formatSecurity.patch