5602e26
%global icon_file 7kaa_icon.png
5602e26
%global icon_dest_dir %{_datadir}/icons/hicolor/32x32/apps
4456d99
Name:     7kaa
a3c0213
Version:  2.14.7
9c11cd7
Release:  3%{?dist}
5602e26
Summary:  Seven Kingdoms: Ancient Adversaries
5602e26
5602e26
License:  GPLv3+ and GPLv2+
4456d99
URL:      http://7kfans.com/
5602e26
Source0:  http://sourceforge.net/projects/skfans/files/%{name}-%{version}.tar.xz
5602e26
Source1:  %{name}.autodlrc
5602e26
5602e26
BuildRequires: SDL2-devel, SDL2_net-devel
5602e26
BuildRequires: enet-devel
5602e26
BuildRequires: openal-soft-devel, autoconf
5602e26
BuildRequires: gettext-devel
5602e26
BuildRequires: desktop-file-utils
5602e26
BuildRequires: ImageMagick
a3c0213
BuildRequires: libcurl-devel
a3c0213
5602e26
Requires: %{name}-data = %{version}-%{release}
a3c0213
Requires: libcurl
5602e26
5602e26
%description
5602e26
Seven Kingdoms is a real-time strategy (RTS) computer game developed
5602e26
by Trevor Chan of Enlight Software. The game enables players to
5602e26
compete against up to six other kingdoms allowing players to conquer
5602e26
opponents by defeating them in war (with troops or machines),
4456d99
capturing their buildings with spies, or offering opponents money
5602e26
for their kingdom.
5602e26
5602e26
Seven Kingdoms: Ancient Adversaries is a free patch provided by
5602e26
Interactive Magic and added three new cultures, the Egyptians, the
4456d99
Mughals and the Zulus, and a new war machine, Unicorn.
5602e26
5602e26
%package data
5602e26
BuildArch: noarch
5602e26
Summary: In-Game data Seven Kingdoms: Ancient Adversaries
5602e26
5602e26
Requires: %{name} = %{version}-%{release}
5602e26
Requires: hicolor-icon-theme
5602e26
5602e26
%description data
5602e26
In-Game music data Seven Kingdoms: Ancient Adversaries
5602e26
5602e26
%package music
5602e26
License: Redistributable, no modification permitted
5602e26
BuildArch: noarch
5602e26
Summary: In-Game music for Seven Kingdoms: Ancient Adversaries
5602e26
5602e26
Requires: %{name}-data = %{version}-%{release}
5602e26
Requires: autodownloader, sudo
5602e26
5602e26
%description music
5602e26
In-Game music for Seven Kingdoms: Ancient Adversaries
5602e26
Due to license issue, you need to run 7kaa-data-installer install the music.
5602e26
5602e26
%prep
5602e26
%setup -q
5602e26
5602e26
%build
b16d80e
# https://bugzilla.redhat.com/show_bug.cgi?id=1306226
b16d80e
export CXXFLAGS="%{optflags} -fsigned-char"
5602e26
%configure
5602e26
make %{?_smp_mflags}
5602e26
convert data/image/7k_icon.bmp %{icon_file}
5602e26
5602e26
5602e26
%install
5602e26
%make_install
5602e26
mkdir -p %{buildroot}%{icon_dest_dir}
5602e26
install -m 644 %{icon_file} %{buildroot}%{icon_dest_dir}
5602e26
5602e26
### == desktop file
5602e26
cat>%{name}.desktop<
5602e26
[Desktop Entry]
5602e26
Name=%{name}
5602e26
GenericName=Seven Kingdoms: Ancient Adversaries
5602e26
Comment=A real-time strategy (RTS) computer game
5602e26
Exec=/usr/bin/%{name}
5602e26
Icon=%{name}_icon
5602e26
Terminal=false
5602e26
Type=Application
5602e26
Categories=Game;StrategyGame
5602e26
END
5602e26
5602e26
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{name}.desktop
5602e26
5602e26
### == music autodownload
5602e26
%global data_installer %{name}-data-installer
5602e26
%global prj_music_dir %{_datadir}/%{name}/music
5602e26
mkdir -p %{buildroot}%{prj_music_dir}
5602e26
mkdir -p %{buildroot}/usr/share/doc/%{name}-music
5602e26
5602e26
### === Downloader
5602e26
cat >%{data_installer}<
5602e26
#!/bin/bash
5602e26
echo "This program will download necessary data files."
5602e26
if [ -r %{prj_music_dir}/win.wav ];then
5602e26
   echo "music already downloaded" > /dev/stderr
5602e26
   exit 2
5602e26
fi
5602e26
if ! /usr/share/autodl/AutoDL.py %{prj_music_dir}/%{name}.autodlrc; then
5602e26
    echo "Error on music download" > /dev/stderr
5602e26
    exit 3
5602e26
fi
5602e26
cd /tmp/%{name}-music
5602e26
tar xjvf /tmp/%{name}-music/%{name}-music.tar.bz2
5602e26
sudo install -v -m 644 /tmp/%{name}-music/%{name}-music/music/* /usr/share/%{name}/music
5602e26
sudo install -v -m 644 /tmp/%{name}-music/%{name}-music/*.txt /usr/share/doc/%{name}-music
5602e26
echo "Done"
5602e26
END
5602e26
5602e26
install -m 755 %{data_installer} %{buildroot}%{_bindir}/%{data_installer}
5602e26
install -m 644 %{SOURCE1} %{buildroot}%{prj_music_dir}
5602e26
7b925ab
rm -f %{buildroot}%{_docdir}/%{name}/COPYING
7b925ab
5602e26
%postun music
cc54ba1
if [ $1 -eq 0 ] ; then
cc54ba1
## When Uninstall
cc54ba1
    rm -fr %{prj_music_dir}
cc54ba1
fi
5602e26
5602e26
%files
5602e26
%doc README
5602e26
%license COPYING
5602e26
%{_bindir}/%{name}
5602e26
%{_datadir}/applications/%{name}.desktop
5602e26
5602e26
%files data
5602e26
%dir %{_datadir}/%{name}
5602e26
%{_datadir}/%{name}/[^m]*
5602e26
%{icon_dest_dir}/%{icon_file}
5602e26
5602e26
%files music
5602e26
%{_bindir}/%{data_installer}
5602e26
%dir %{prj_music_dir}
5602e26
%{prj_music_dir}/%{name}.autodlrc
5602e26
%dir %{_docdir}/%{name}-music
5602e26
5602e26
%changelog
9c11cd7
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.14.7-3
9c11cd7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
9c11cd7
bc566bb
* Sun Jan 07 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.14.7-2
bc566bb
- Remove obsolete scriptlets
bc566bb
a3c0213
* Thu Dec 07 2017 Ding-Yi Chen <dchen@redhat.com> - 2.14.7-1
a3c0213
- Upstream update to 2.14.7
a3c0213
  Fixes Bug 1458610 - 7kaa-2.14.7 is available
a3c0213
- Add Requires and BuildRequires libcurl
a3c0213
0c212a4
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.14.6-4
0c212a4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
0c212a4
e9e5dc4
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.14.6-3
e9e5dc4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
e9e5dc4
54cbaae
* Sat Mar 11 2017 Raphael Groner <projects.rg@smart.ms> - 2.14.6-2
54cbaae
- rebuilt due to branching
54cbaae
4456d99
* Wed Mar 01 2017 Ding-Yi Chen <dchen@redhat.com> 2.14.6-1
4456d99
- Upstream update to 2.14.6
4456d99
b94e190
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.14.5-13
b94e190
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
b94e190
b16d80e
* Mon Mar 07 2016 Yaakov Selkowitz <yselkowi@redhat.com> - 2.14.5-12
b16d80e
- Build with -fsigned-char to fix FTBFS with GCC 6 (#1306226)
b16d80e
43158fa
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.14.5-11
43158fa
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
43158fa
7b925ab
* Tue Oct 20 2015 Ding-Yi Chen <dchen@redhat.com> 2.14.5-10
cc54ba1
- music won't get uninstall when upgrading.
7b925ab
- Remove /usr/share/doc/COPYING as it is already installed.
cc54ba1
5602e26
* Fri Jun 26 2015 Ding-Yi Chen <dchen@redhat.com> 2.14.5-8
5602e26
- Use name macro whenever possible.
5602e26
5602e26
* Wed Jun 24 2015 Ding-Yi Chen <dchen@redhat.com> 2.14.5-7
5602e26
- Fix the .desktop file.
5602e26
5602e26
* Tue Jun 23 2015 Ding-Yi Chen <dchen@redhat.com> 2.14.5-6
5602e26
- Requires: hicolor-icon-theme
5602e26
- License become GPLv3+ and GPLv2+ as "gettext.h" is GPLv3
5602e26
5602e26
* Wed Jun 17 2015 Ding-Yi Chen <dchen@redhat.com> 2.14.5-5
5602e26
- Fix for Review Request Comment #11
5602e26
5602e26
* Tue Jun 16 2015 Ding-Yi Chen <dchen@redhat.com> 2.14.5-4
5602e26
- Fix for Review Request Comment #10
5602e26
5602e26
* Tue Jun 02 2015 Ding-Yi Chen <dchen@redhat.com> 2.14.5-3
5602e26
- Fix for Review Request Comment #8
5602e26
5602e26
* Mon Jun 01 2015 Ding-Yi Chen <dchen@redhat.com> 2.14.5-2
5602e26
- Fix for Review Request Comment #6
5602e26
5602e26
* Sun May 31 2015 Ding-Yi Chen <dchen@redhat.com> 2.14.5-1
5602e26
- Upstream update to 2.14.5
5602e26
- BuildRequires: add enet-devel
5602e26
- Use autodownloader to download music.
5602e26
5602e26
* Wed May 27 2015 Ding-Yi Chen <dchen@redhat.com> 2.14.4-2
5602e26
- Remove music.
5602e26
5602e26
* Tue May 05 2015 Ding-Yi Chen <dchen@redhat.com> 2.14.4-1
5602e26
- Initial packaging.
5602e26