%global icon_file 7kaa_icon.png
%global icon_dest_dir %{_datadir}/pixmaps/%{name}.png
#%%global icon_dest_dir %%{_datadir}/icons/hicolor/32x32/apps

Name:           7kaa
Version:        2.15.3
Release:        103
Summary:        Seven Kingdoms: Ancient Adversaries
License:        GPLv2+
Group:          Amusements/Games/Strategy/Real Time
Url:            http://7kfans.com/
Source0:        https://github.com/the3dfxdude/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.xz

BuildRequires:  curl-devel
BuildRequires:  enet-devel
BuildRequires:  gcc-c++
BuildRequires:  openal-soft-devel
BuildRequires:  pkgconfig
BuildRequires: ImageMagick
BuildRequires:  pkgconfig(sdl2)
Recommends:     %{name}-music

%description
Seven Kingdoms made departures from the traditional real-time strategy models
of "gather resources, build a base and army, and attack". The economic model
bears more resemblance to a turn-based strategy game. It features an espionage
system that allows players to train and control spies individually, who each
have a spying skill that increases over time. The player is also responsible
for catching spies in their own kingdom. Inns built within the game allow
players to hire mercenaries of various occupations, skill levels, and races.
Skilled spies of enemy races are essential to a well-conducted espionage
program, and the player can bolster his forces by grabbing a skilled fighter
or give ones own factories, mines, and towers of science, a boost by hiring a
skilled professional.

Enlight Software decided to release the game to the Open Source community
in August 2009. At that time everything, but the music, was released under
the GPL v2.

%prep
%setup -q

%build
export CXXFLAGS="%{optflags} -fno-strict-aliasing"
%configure --docdir=%{_docdir}/%{name}
make %{?_smp_mflags}
convert data/IMAGE/7K_ICON.BMP %{icon_file}

%install
%make_install

# install icon

mkdir -p %{buildroot}%{icon_dest_dir}
install -m 644 %{icon_file} %{buildroot}%{icon_dest_dir}

### == desktop file
cat>%{name}.desktop<<END
[Desktop Entry]
Name=%{name}
GenericName=Seven Kingdoms: Ancient Adversaries
Comment=A real-time strategy (RTS) computer game
Exec=/usr/bin/%{name}
Icon=%{name}
Terminal=false
Type=Application
Categories=Game;StrategyGame
END

# desktop-file-install --dir=%%{buildroot}%%{_datadir}/applications %%{name}.desktop

# install Desktop file
install -Dm 0644 %{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop

%find_lang %{name}

%files -f %{name}.lang
%doc COPYING README
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/%{name}

%changelog
* Sat Mar 28 2020 Paul Dufresne <dufesnep@zoho.com> 2.15.3-103
- Initial release