# include fallback defs for _ggz_config, _ggz_datadir macros
# feel free to drop when ggz-client-lib including these is deployed everywhere
%{!?_ggz_config:%define _ggz_config %{_bindir}/ggz-config}
%{!?_ggz_datadir:%define _ggz_datadir %(%{_ggz_config} --datadir >& /dev/null ||:)}

Name:           freeciv
Version:        2.2.5
Release:        3%{?_dist_release}
Summary:        A multi-player strategy game
Summary(ja):    多人数戦略ゲーム

Group:          Applications/Games
License:        GPLv2+
URL:            http://freeciv.wikia.com/index.php/Freeciv
Source0:        http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
Source1:	freeciv-2.2.5-fixed-tutorial_ja.po
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

##Fix DSO patch
Patch10:	freeciv-client-fix-DSO.patch

BuildRequires:	gtk2-devel
BuildRequires:	readline-devel
BuildRequires:	zlib-devel
BuildRequires:	SDL_mixer-devel
BuildRequires:	ncurses-devel
BuildRequires:	ggz-client-libs-devel
BuildRequires:	desktop-file-utils
BuildRequires:	gettext

Requires(post): ggz-client-libs
Requires(preun): ggz-client-libs

Vendor: Project Vine
Distribution: Vine Linux
Packager: iwaim

%description
Freeciv is a turn-based, multi-player, X based strategy game. Freeciv
is generally comparable to, and has compatible rules with, the
Civilization II(R) game by Microprose(R). In Freeciv, each player is
the leader of a civilization, and is competing with the other players
in order to become the leader of the greatest civilization.


%prep
%setup -q -n %{name}-%{version}
%patch10 -p0
%__rm -f po/ja.{po,gmo}
%__cp -p %{SOURCE1} po/ja.po

%build
%configure --enable-client=gtk --disable-static
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%find_lang %{name}

desktop-file-install --vendor vine --delete-original	\
	--dir $RPM_BUILD_ROOT%{_datadir}/applications	\
	$RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop

desktop-file-install --vendor vine --delete-original \
	--dir $RPM_BUILD_ROOT%{_datadir}/applications  	\
	$RPM_BUILD_ROOT%{_datadir}/applications/%{name}-server.desktop

# Remove civmanual
rm $RPM_BUILD_ROOT%{_bindir}/civmanual
# ggz config
# omit ggz.modules, to register at install, not build, time.
if [ -e $RPM_BUILD_ROOT%{_sysconfdir}/ggz.modules ]; then
rm $RPM_BUILD_ROOT%{_sysconfdir}/ggz.modules
fi
# include .dsc files
install -p -D -m644 data/civclient.dsc $RPM_BUILD_ROOT%{_ggz_datadir}/civclient.dsc
find $RPM_BUILD_ROOT -name '*.la' -delete
find $RPM_BUILD_ROOT -name '*.a' -delete

%clean
rm -rf $RPM_BUILD_ROOT

%post
%{_ggz_config} --install --force --modfile=%{_ggz_datadir}/civclient.dsc || :
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%preun
if [ $1 -eq 0 ]; then
%{_ggz_config} --remove --modfile=%{_ggz_datadir}/civclient.dsc || :
fi

%postun
touch --no-create %{_datadir}/icons/hicolor
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi


%files -f %{name}.lang
%defattr(-,root,root)
%doc COPYING NEWS doc/BUGS doc/HOWTOPLAY doc/README
%doc doc/README.AI doc/README.agents doc/README.attributes doc/README.cma
%doc doc/README.delta doc/README.effects doc/README.ftwl doc/HACKING
%doc doc/README.scorelog doc/TODO
%doc doc/README.graphics doc/README.sound
%{_bindir}/freeciv-server
%{_bindir}/freeciv-gtk2
%{_datadir}/%{name}/
%{_datadir}/applications/vine-*.desktop
%{_datadir}/icons/hicolor/*/apps/*.png
%{_datadir}/pixmaps/%{name}-client.png
%{_mandir}/man6/freeciv*6*
%{_ggz_datadir}/civclient.dsc


%changelog
* Sun Aug 02 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.2.5-3
- rebuild with readline-6.3
- remove BuildRequires:	esound-devel

* Sun Nov  2 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 2.2.5-2
- moved to Applications/Games

* Thu Apr  7 2011 IWAI, Masaharu <iwai@alib.jp> 2.2.5-1
- new upstream release
- update ja.po (Source1): fixed upstream ja.po bug

* Tue Dec 28 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.2.3-2
- rebuild with SDL_mixer-1.2.11-2

* Fri Sep 17 2010 IWAI, Masaharu <iwai@alib.jp> 2.2.3-1
- new upstream release
- update ja.po (Source1): fixed upstream ja.po

* Wed Sep  1 2010 IWAI, Masaharu <iwai@alib.jp> 2.2.2-1
- build for Vine Linux: from Fedora 2.2.2-1
 - change BuildRequires: ggz-gtk-client-devel to gz-client-libs-devel
- add ja.po (Source1) from http://loda.jp/freeciv/?id=81

* Mon Aug 02 2010 Thomas Janssen <thomasj@fedoraproject.org> 2.2.2-1
- security fix https://www.redhat.com/security/data/cve/CVE-2010-2445.html
- fixes #612296

* Sun Jun 06 2010 Thomas Janssen <thomasj@fedoraproject.org> 2.2.0-2
- security fix http://gna.org/bugs/?15624
- #600742 #600743 #600744

* Tue Mar 02 2010 Thomas Janssen <thomasj@fedoraproject.org> 2.2.0-1
- New upstream source 2.2.0

* Fri Jan 29 2010 Brian Pepple <bpepple@fedoraproject.org> - 2.1.11-1
- Update to 2.1.11.

* Fri Dec 11 2009 Brian Pepple <bpepple@fedoraproject.org> - 2.1.10-1
- Update to 2.1.10.

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sun Apr  5 2009 Brian Pepple <bpepple@fedoraproject.org> - 2.1.9-1
- Update to 2.1.9.

* Mon Mar 09 2009 Adam Tkac <atkac redhat com> - 2.1.8-3
- drop bind-devel BuildReq, it is not needed

* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Thu Dec  4 2008 Brian Pepple <bpepple@fedoraproject.org> - 2.1.8-1
- Update to 2.1.8.

* Wed Nov 26 2008 Brian Pepple <bpepple@fedoraproject.org> - 2.1.7-1
- Update to 2.1.7.

* Sat Nov 22 2008 Brian Pepple <bpepple@fedoraproject.org> - 2.1.6-2
- Simplify summary.

* Sat Aug 23 2008 Brian Pepple <bpepple@fedoraproject.org> - 2.1.6-1
- Update to 2.1.6.

* Thu Jun 19 2008 Brian Pepple <bpepple@fedoraproject.org> - 2.1.5-1
- Update to 2.1.5.

* Tue Apr 29 2008 Brian Pepple <bpepple@fedoraproject.org> - 2.1.4-1
- Update to 2.1.4.

* Sat Feb  9 2008 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 2.1.3-4
- Fix up typo.

* Fri Feb  8 2008 Rex Dieter <rdieter@fedoraproject.org> 2.1.3-3
- fixup ggz integration (#431726)

* Mon Feb  4 2008 Brian Pepple <bpepple@fedoraproject.org> - 2.1.3-2
- Add ggz gaming support.

* Sat Jan 26 2008 Brian Pepple <bpepple@fedoraproject.org> - 2.1.3-1
- Update to 2.1.3.

* Tue Dec 25 2007 Brian Pepple <bpepple@fedoraproject.org> - 2.1.2-1
- Update to 2.1.2.

* Thu Nov 29 2007 Brian Pepple <bpepple@fedoraproject.org> - 2.1.1-1
- Update to 2.1.1.
- Drop buffer overflow patch. fixed upstream.
- Drop open file patch. fixed upstream.

* Sat Nov 24 2007 Brian Pepple <bpepple@fedoraproject.org> - 2.1.0-2
- Add patch to fix buffer overflow. (#397531)

* Sun Oct 28 2007 Brian Pepple <bpepple@fedoraproject.org> - 2.1.0-1
- Update to 2.1.0.
- Update urls.
- Update aifill & open patches.
- Remove old freeciv pixmap.
- Remove desktop patch.

* Sun Sep 16 2007 Brian Pepple <bpepple@fedoraproject.org> - 2.0.9-4
- Add patch to fix open function build bug.

* Tue Aug 21 2007 Brian Pepple <bpepple@fedoraproject.org> - 2.0.9-3
- Rebuild.

* Thu Aug  2 2007 Brian Pepple <bpepple@fedoraproject.org> - 2.0.9-2
- Update license tag.

* Tue Feb 13 2007 Brian Pepple <bpepple@fedoraproject.org> - 2.0.9-1
- Update to 2.0.9.
- Drop button patch, fixed upstream.
- Drop security patch, fixed upstream.
- Drop X-Fedora category from desktop files.

* Thu Sep  7 2006 Brian Pepple <bpepple@fedoraproject.org> - 2.0.8-7
- Rebuild for FC6.

* Wed Aug  2 2006 Brian Pepple <bpepple@fedoraproject.org> - 2.0.8-6
- Update security patch.
- Add patch to fix turn done buttons style.

* Tue Aug  1 2006 Brian Pepple <bpepple@fedoraproject.org> - 2.0.8-5
- Add patch to fix CVE-2006-3913 vulnerability. (#200545)
- Replace desktop file category 'Strategy' with 'StrategyGame'. (#198086)

* Mon Mar  6 2006 Brian Pepple <bdpepple@ameritech.net> - 2.0.8-2
- Update to 2.0.8.

* Thu Feb 16 2006 Brian Pepple <bdpepple@ameritech.net> - 2.0.7-6
- Remove unnecessary BR (alsa-lib-devel & SDL-devel).

* Mon Feb 13 2006 Brian Pepple <bdpepple@ameritech.net> - 2.0.7-5
- rebuilt for new gcc4.1 snapshot and glibc changes

* Sun Dec  4 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.7-4
- Rebuild for new bind.

* Sun Nov  6 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.7-3
- Update to 2.0.7.
- Modify desktop patch for upstream fixes.
- Drop the %%config from .desktop files.

* Mon Sep 26 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.6-3
- Update to 2.0.6.

* Fri Sep  2 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.5-3
- Update to 2.0.5.
- Enable debug info.

* Tue Aug 16 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.4-4
- Rebuild for cairo dep.

* Thu Jul 28 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.4-2
- Update to 2.0.4.
- Use new stdsounds.

* Fri Jul 15 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.3-2
- Bump release.

* Thu Jul 14 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.3-1
- Update to 2.0.3.

* Tue Jun 14 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.2-1
- Update to 2.0.2.
- Add dist tag.

* Tue Apr 26 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.1-1.fc4
- Update to 2.0.1.

* Mon Apr 18 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.0-3.fc4
- Re-add patch to set aifill to 5 on new servers to get some opponents.

* Mon Apr 18 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.0-2.fc4
- remove redundant --dir* options in %%configure & %%makeinstall.

* Mon Apr 18 2005 Brian Pepple <bdpepple@ameritech.net> - 2.0.0-1.fc4
- Update to 2.0.0.
- Drop 1.14 patches.
- Add new BR's for 2.0.0.

* Sat Mar 26 2005 Brian Pepple <bdpepple@ameritech.net> - 1.14.2-7
- Fixed typos.

* Sat Mar 26 2005 Brian Pepple <bdpepple@ameritech.net> - 1.14.2-6
- Added more macros.
- Replaced BuildPrereq with BuildRequires.
- Drop version of gtk2-devel, since FC3 & later meet minimum needed.

* Wed Mar 23 2005 Brian Pepple <bdpepple@ameritech.net> - 1.14.2-5
- Changed X-Red-Hat-Extra to X-Fedora.
- Added URL.
- Changed BuildRoot to preferred value.
- Removed period from summary.

* Wed Jan 12 2005 Tim Waugh <twaugh@redhat.com> 1.14.2-4
- Rebuilt for new readline.

* Tue Oct 26 2004 Daniel Reed <djr@redhat.com> 1.14.2-3
- [136921] Try a little harder to run as nobody

* Mon Oct 25 2004 Daniel Reed <djr@redhat.com> 1.14.2-2
- [136921] Provide the user with the opportunity to run FreeCiv as root if unable to su to nobody, and throw up an error message if everything fails

* Mon Sep 13 2004 Karsten Hopp <karsten@redhat.de> 1.14.2-1 
- update to latest stable version

* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt

* Mon Feb 23 2004 Karsten Hopp <karsten@redhat.de> 1.14.1-3
- rebuild with new chown syntax

* Mon Feb 23 2004 Tim Waugh <twaugh@redhat.com>
- Use ':' instead of '.' as separator for chown.

* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt

* Wed Dec 03 2003 Karsten Hopp <karsten@redhat.de> 1.14.1-1
- update to bugfix release 1.14.1

* Wed Jun 04 2003 Elliot Lee <sopwith@redhat.com>
- rebuilt

* Thu May 08 2003 Karsten Hopp <karsten@redhat.de> 1.14.0-1
- update

* Thu Feb 20 2003 Karsten Hopp <karsten@redhat.de> 1.13.0-6
- remove last patch (obsolete)

* Wed Feb 19 2003 Karsten Hopp <karsten@redhat.de>
- fix message translation (#84599)

* Wed Jan 22 2003 Tim Powers <timp@redhat.com>
- rebuilt

* Thu Nov 07 2002 Karsten Hopp <karsten@redhat.de>
- spelling fix (#75021)
- set aifill to 5 on new servers to get some opponents (#72586)

* Thu Aug 01 2002 Karsten Hopp <karsten@redhat.de>
- desktop fixes (#69391)

* Wed Jul 24 2002 Karsten Hopp <karsten@redhat.de>
- 0.1.13
- s/Games/Game in desktop-file-install
- fix URL
- add standard sounds 

* Wed Jul 17 2002 Karsten Hopp <karsten@redhat.de> 1.12.0-6
- fix path to datafiles if FREECIV_PATH is not set (#67922)
- fix desktop files (#67920)
- use desktop-file-install

* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Thu May 23 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Thu Jan 24 2002 Bernhard Rosenkraenzer <bero@redhat.com> 1.12.0-2
- Rebuild in current environment

* Thu Aug 23 2001 Bernhard Rosenkraenzer <bero@redhat.com> 1.12.0-1
- 1.12.0 (non-beta)

* Tue Jul 31 2001 Bernhard Rosenkraenzer <bero@redhat.com> 1.11.4-9
- Rebuild - the fix for #49442 didn't seem to get in last time.

* Mon Jul 30 2001 Bernhard Rosenkraenzer <bero@redhat.com> 1.11.4-8
- Fix up demographics (#50119)

* Wed Jun 27 2001 Than Ngo <than@redhat.com>
- support new gettext
- add patch to build against new libtool

* Tue Mar 20 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- use gtk-config instead of glib-config

* Sun Feb 25 2001 Bernhard Rosenkraenzer <bero@redhat.com>
- Fix up civclient-wrapper so it doesn't fail silently when started as
  potentially harmful user (Bug #28928)

* Tue Aug  1 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Fix warning in civclient-wrapper (Bug 14860)

* Fri Jul 21 2000 Trond Eivind Glomsrød <teg@redhat.com>
- 1.11.4
- move to /usr/bin and /usr/share/freeciv (no more /usr/games)

* Wed Jul 12 2000 Trond Eivind Glomsrød <teg@redhat.com>
- remove icon, glint is obsoleted
- don't use find to build file lists, it claimed to own
  lots of directories
- use %%{_tmppath}

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Mon Jul 10 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 1.11.0 (Bug #13610)
- Add .desktop files (Bug #13610)
- Add BuildPrereq: lines
- fix build

* Thu Jun  8 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- move to dist
- update
- clean up the spec file
- fix build with gcc 2.96
- make the gtk client default; it's better than the Xaw one by now.

* Thu Feb 24 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 1.10.0

* Fri Feb  4 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 1.9.2
- use the configure macro

* Sun Nov  7 1999 Bernhard Rosenkraenzer <bero@redhat.com>
- redo RPM for 1.9.0 (many changes to build/install procedure)
