%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

%define gettext_package gnome-games

%define glib2_version 2.34.0
%define gtk3_version 3.6.0
%define desktop_file_utils_version 0.2.90

Summary: GNOME games
Summary(ja): GNOME ゲーム集
Name: gnome-games
%define major 3.6
Version: %{major}.1
Release: 1%{?_dist_release}
License: GPLv2+ and GFDL+
Group: Applications/Games
Source:	ftp://ftp.gnome.org/pub/gnome/sources/%{name}/%{major}/%{name}-%{version}.tar.xz
Patch1: gnome-games-2.19.4-gnometris-rebrand.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
Obsoletes: gnome gnome-games-devel
URL: http://www.gnome.org

Requires(postun,posttrans): desktop-file-utils
Requires(postun,posttrans): glib2

#Requires: pygtk2
Requires: pygobject3
Requires: gnuchess
Requires: hicolor-icon-theme

BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: gtk3-devel >= %{gtk3_version}
BuildRequires: pygobject3-devel
BuildRequires: desktop-file-utils >= %{desktop_file_utils_version}
BuildRequires: librsvg2-devel
BuildRequires: clutter-devel, clutter-gtk-devel
BuildRequires: libcanberra-gtk3-devel
BuildRequires: gobject-introspection-devel
BuildRequires: sqlite3-devel
BuildRequires: mesa-libGLU-devel

BuildRequires: autoconf >= 2.60
BuildRequires: yelp-tools


Provides: gnome-sudoku
Obsoletes: gnome-sudoku

Provides: glchess
Obsoletes: glchess < 2.0

BuildRequires: gcc-c++

Vendor: Project Vine
Distribution: Vine Linux

%description

The gnome-games package includes some small games that come with the
GNOME desktop environment but can be used under any desktop.

%description -l ja

gnome-games パッケージにはいくつかの小さなゲームが入っています。
これらは GNOME に由来するものですが、他のデスクトップ環境でも動きます。

%prep
%setup -q
# rebrand gnometris as some think the name is to similar to a trademark
## %patch1 -p1 -b .rebrand

## sed -i -e 's/Gnometris/GnomeFallingBlocks/g' \
##   -e 's/GNOMEtris/GnomeFallingBlocks/g' \
##   po/*.po gnometris/help/*/*.po gnometris/help/C/gnometris.xml \
##   gnometris/*.cpp gnometris/gnometris.desktop.in.in

%build

autoconf
export CFLAGS="$RPM_OPT_FLAGS -DNO_HOWL"
# swell-foop, lightsoff: remove (vine6)
%configure \
	--localstatedir=/var/lib \
	--enable-games="quadrapassel,gnect,gnomine,gnome-mahjongg,gtali,gnotravex,gnotski,glines,iagno,glchess,gnobots2,gnibbles,gnome-sudoku" 
make 

# strip unneeded translations from .mo files
# ideally intltool (ha!) would do that for us
# http://bugzilla.gnome.org/show_bug.cgi?id=474987
cd po
grep -v ".*[.]desktop[.]in[.]in$\|.*[.]server[.]in[.]in$" POTFILES.in > POTFILES.keep
mv POTFILES.keep POTFILES.in
intltool-update --pot
for p in *.po; do
  msgmerge $p %{gettext_package}.pot > $p.out
  msgfmt -o `basename $p .po`.gmo $p.out
done


%install
rm -rf $RPM_BUILD_ROOT

export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
make install DESTDIR=$RPM_BUILD_ROOT
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL

## mv $RPM_BUILD_ROOT%{_bindir}/gnometris \
##   $RPM_BUILD_ROOT%{_bindir}/gnome-falling-blocks

## things we just don't want in the package

rm -rf $RPM_BUILD_ROOT%{_libdir}/libgdkcardimage.*a

## install desktop files
desktop-file-install --vendor gnome --delete-original       \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications             \
  --remove-category Application				    \
  --remove-category PuzzleGame				    \
  $RPM_BUILD_ROOT%{_datadir}/applications/*

perl -pi -e 's@<default></default>@<default>[Joe,Jim,James]</default>@g' \
     $RPM_BUILD_ROOT%{_sysconfdir}/gconf/schemas/gtali.schemas

%find_lang %{gettext_package} --all-name --with-gnome

%clean
rm -rf $RPM_BUILD_ROOT

%post
touch %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  /usr/bin/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
fi

%postun
touch %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  /usr/bin/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
fi
glib-compile-schemas %{_datadir}/glib-2.0/schemas ||:
update-desktop-database -q &> /dev/null || :

%posttrans 
glib-compile-schemas %{_datadir}/glib-2.0/schemas ||:
update-desktop-database -q &> /dev/null || :



%files -f %{gettext_package}.lang
%defattr(-, root, root)
%doc AUTHORS COPYING README
%{_datadir}/applications/*
#%{_datadir}/gnome-games-common
%{_datadir}/glchess
%{_datadir}/glines
%{_datadir}/gnect
%{_datadir}/gnibbles
%{_datadir}/gnobots2
%{_datadir}/gnome-sudoku
%{_datadir}/gnomine
%{_datadir}/gnotravex
%{_datadir}/gnotski
%{_datadir}/gtali
%{_datadir}/icons/hicolor/*/*/*
%{_datadir}/iagno
%{_datadir}/gnome-mahjongg
%{_datadir}/quadrapassel
%{_mandir}/man6/*
%{_datadir}/glib-2.0/schemas/*.xml
%verify(not md5 size mtime) %config(noreplace) %attr(664, games, games) /var/lib/games/*

#%{python_sitelib}/glchess
%{python_sitelib}/gnome_sudoku

# these are not setgid games
%{_bindir}/gnect
#%{_bindir}/sol
## %{_bindir}blackjack
%{_bindir}/glchess
%{_bindir}/gnome-sudoku

# these are setgid games
%attr(2551, root, games) %{_bindir}/gnomine
%attr(2551, root, games) %{_bindir}/gnome-mahjongg
%attr(2551, root, games) %{_bindir}/gtali
%attr(2551, root, games) %{_bindir}/gnobots2
%attr(2551, root, games) %{_bindir}/quadrapassel
%attr(2551, root, games) %{_bindir}/gnotravex
%attr(2551, root, games) %{_bindir}/gnotski
%attr(2551, root, games) %{_bindir}/gnibbles
%attr(2551, root, games) %{_bindir}/glines
%attr(2551, root, games) %{_bindir}/iagno
## %attr(2551, root, games) %{_bindir}/same-gnome
## %attr(2551, root, games) %{_bindir}/gnome-falling-blocks


%changelog
* Wed Oct 17 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.6.1-1
- new upstream release

* Sun Sep 30 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.6.0.2-1
- new upstream release
- change BuildRequires: yelp-tools instead of gnome-doc-utils
- remove old required packages


* Sun May 20 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.4.2-1
- new upstream release

* Sun Apr 22 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.4.1-1
- new upstream release
- remove Patch2
- add BuildRequires: itstool
- remove BuildRequires: GConf2-devel

* Sun Feb 19 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.2.1-2
- rebuild with python-2.7.2

* Sat Oct 22 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.2.1-1
- new upstream release
- add BuildRequires: GConf2-devel

* Fri Sep 30 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.2.0-1
- new upstream release

* Fri Sep 23 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.1.92-1
- new upstream release

* Sat Sep 03 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.1.90-1
- new upstream release

* Mon Aug 22 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.1.5-1
- new upstream release

* Tue Aug 16 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.1.4-1
- new upstream release
- change BuildRequires: gtk3-devel instead of gtk2-devel
- change BuildRequires: libcanberra-gtk3-devel instead of libcanberra-devel
- add BuildRequires: sqlite3-devel, mesa-libGLU-devel

* Sun Apr 03 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.32.1-3
- add Requires: gnome-python-rsvg

* Sun Apr 03 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.32.1-2
- remove Requires: gnome-python-gnomeprint, seed
- remove swell-foop, lightsoff

* Sat Nov 20 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.32.1-1
- new upstream release

* Thu Oct 07 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.32.0-1
- new upstream release
- remove BuildRequires: gir-repository-devel

* Sat Jun 26 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.30.2-1
- new upstream release

* Thu May 20 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.30.1-2
- add BuildRequires: gobject-introspection-devel, gir-repository-devel
- add Requires: seed
- add Patch2(gnome-games-libs.patch) from FC package
- remove configure option (--disable-introspection)

* Sat May 01 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.30.1-1
- new upstream release

* Sun Apr 11 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.30.0-1
- new upstream release
- add BuildRequires: libcanberra-devel
- drop Patch1

* Thu Feb 04 2010 Shu KONNO <owa@bg.wakwak.com> 2.28.2-2
- rebuilt with python-2.6.4-3

* Mon Dec 28 2009 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.28.2-1
- new upstream release
- add BuildRequires: docbook-dtds

* Fri Dec  4 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.28.1-2
- add BuildRequires: clutter-gtk-devel

* Tue Dec 01 2009 Takemikaduchi <bsyamato@sea.plala.or.jp> 2.28.1-1
- new upstream release
- add BuildRequires: clutter-devel, libSM-devel, check-devel

* Sat Jul 04 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.26.3-1
- new upstream release

* Thu May 28 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.26.2-1
- new upstream release

* Sat Apr 25 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.26.1-1
- new upstream release

* Mon Mar 23 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.26.0-1
- new upstream release

* Sat Jan 17 2009 Shu KONNO <owa@bg.wakwak.com> 2.24.1-3
- rebuilt (with guile-1.8.6)

* Mon Jan 12 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 2.24.1-2
- rebuild with guile-1.8.6

* Wed Oct 28 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.24.1-1
- new upstream release

* Sat Sep 27 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.24.0-1
- new upstream release

* Sun Jul 20 2008 Shu KONNO <owa@bg.wakwak.com> 2.22.1.1-2vl5
- rebuilt with python-2.5.2

* Mon Apr 21 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.22.1.1-1vl5
- new upstream release
- added Patch1
  * Sat Jul 21 2007 Hans de Goede <j.w.r.degoede@hhs.nl> - 1:2.19.4-3
  - Rename / rebrand Gnometris to GnomeFallingBlocks, so that it stays clear of
    the Tetris trademark, and include it (bz 238651)

* Mon Dec 18 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 2.14.13-0vl2
- add BuildRequires: librsvg2-devel

* Sat Sep  2 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.14.3-0vl1
- new upstream release
- changed Group to Applications/Games

* Fri Apr 14 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 2.14.1-0vl1
- new upstream release

* Tue Mar 07 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 2.13.8-0vl1
- new upstream release

* Sat Oct 08 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 2.12.1-0vl1
- new upstream release

* Mon Sep 19 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 2.12.0-0vl2
- fixed gtali schemas

* Mon Sep 19 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 2.12.0-0vl1
- new upstream release

* Mon Mar 28 2005 Daisuke SUZUKI <daisuke@linux.or.jp> 2.10.0-0vl1
- new upstream release

* Thu Nov 11 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 2.8.1-0vl1
- new upstream release

* Wed Sep 29 2004 NISHIMURA Daisuke <nishi@graco.c.u-tokyo.ac.jp> 2.6.2-0vl1
- new upstream release
- Patch: fix the bug which leads to failure in starting Freecell from menu.
- add Japanese description
- correct License
- add docs
- add missing BuildRequires: gcc-c++
- disable libtoolize: version mismatch is bad
- Patch1: Fix typo, causing gconf warning at %%post

* Sun Feb  1 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 2.4.2-0vl2
- fix kanji code in spec file.

* Sat Jan 31 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 2.4.2-0vl1
- new upstream release

* Thu Sep 11 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 2.4.0-0vl1
- new upstream release

* Thu Sep 04 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 2.3.90-0vl2
- add missing files

* Thu Sep 04 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 2.3.90-0vl1
- new upstream release

* Sat Feb 22 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 2.2.0-0vl2
- rebuild with new guile

* Tue Jan 21 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 2.2.0-0vl1
- new upstream release

* Sat Jan  4 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 2.1.5-0vl1
- new upstream release

* Thu Dec 26 2002 Daisuke SUZUKI <daisuke@linux.or.jp> 2.1.4-0vl1
- new upstream release
- build for Vine Linux

* Tue Aug 13 2002 Havoc Pennington <hp@redhat.com>
- add some OnlyShowIn

* Mon Aug 12 2002 Havoc Pennington <hp@redhat.com>
- 2.0.3 from gnome 2.0.1

* Tue Aug  6 2002 Havoc Pennington <hp@redhat.com>
- 2.0.2

* Tue Jul 23 2002 Havoc Pennington <hp@redhat.com>
- gnect doesn't like being setgid games
- obsolete gnome-games-devel

* Fri Jul 12 2002 Havoc Pennington <hp@redhat.com>
- add gnect

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

* Sun Jun 16 2002 Havoc Pennington <hp@redhat.com>
- 2.0.0
- remove noreplace from the .soundlist files
- add missing schemas
- get rid of gnometris again
- use desktop-file-install

* Fri Jun 07 2002 Havoc Pennington <hp@redhat.com>
- rebuild in different environment

* Wed Jun  5 2002 Havoc Pennington <hp@redhat.com>
- 1.93.0
- remove empty NEWS/README
- fix ldconfig in post

* Sun May 26 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Tue May 21 2002 Havoc Pennington <hp@redhat.com>
- rebuild in different environment

* Tue May 21 2002 Havoc Pennington <hp@redhat.com>
- 1.92.0

* Fri May  3 2002 Havoc Pennington <hp@redhat.com>
- 1.91.0

* Fri Apr 19 2002 Havoc Pennington <hp@redhat.com>
- GNOME 2 version
- spec file cleanups
- no devel package
- don't run auto*, just use the "rm from buildroot" approach to lose xbill

* Tue Apr 09 2002 Phil Knirsch <pknirsch@redhat.com>
- Bumped version number for rebuild and relink agains new guile lib

* Tue Aug 14 2001 Jonathan Blandford <jrb@redhat.com>
- Add BuildRequires on ncurses-devel

* Mon Jul 23 2001 Jonathan Blandford <jrb@redhat.com>
- Add BuildRequires

* Sun Jun 24 2001 Elliot Lee <sopwith@redhat.com>
- Bump release + rebuild.

* Fri Apr 20 2001  <jrb@redhat.com>
- New version (1.4.0)

* Tue Apr 17 2001 Jonathan Blandford <jrb@redhat.com>
- New Version.

* Tue Feb 27 2001 Trond Eivind Glomsr藷?<teg@redhat.com>
- use %%{_tmppath}
- langify

* Mon Aug 21 2000 Nalin Dahyabhai <nalin@redhat.com>
- run ldconfig in post and postun (#16589)
- don't put the post and postun scripts in the middle of the files list --
  that tends to break things (oops)

* Fri Aug 11 2000 Jonathan Blandford <jrb@redhat.com>
- Up Epoch and release

* Fri Aug 04 2000 Havoc Pennington <hp@redhat.com>
- Remove .desktop for gturing

* Mon Jul 17 2000 Jonathan Blandford <jrb@redhat.com>
- Mark high-score files as %config(noreplace).

* Thu Jul 13 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Tue Jul 11 2000 Nalin Dahyabhai <nalin@redhat.com>
- rebuild in new environment

* Sat Jul 8 2000 Havoc Pennington <hp@redhat.com>
- Remove Docdir

* Tue Jul 03 2000 Nalin Dahyabhai <nalin@redhat.com>
- rebuild in new environment

* Thu Jun 15 2000 Owen Taylor <otaylor@redhat.com>
- 1.2.0
- remove gnometris, xbill from subdirs since we don't install
  them and they cause problems with new C compiler
- update autoconf stuff
- remove gturing, add gnotski to the file list

* Thu May 11 2000 Matt Wilson <msw@redhat.com>
- 1.1.90

* Thu Feb 10 2000 Preston Brown <pbrown@redhat.com>
- mark sound event files as config files

* Tue Sep 21 1999 Michael Fulbright <drmike@redhat.com>
- fixed gnotravex to not loop infinitely

* Mon Sep 20 1999 Elliot Lee <sopwith@redhat.com>
- Update to 1.0.40

* Sat Apr 10 1999 Jonathan Blandford <jrb@redhat.com>
- added new sol games and a fix for the old ones.

* Mon Mar 29 1999 Michael Fulbright <drmike@redhat.com>
- removed more offending t*tris stuff

* Thu Mar 18 1999 Michael Fulbright <drmike@redhat.com>
- version 1.0.2
- made gnibbles have correct attr since its setgid
- strip binaries

* Sun Mar 14 1999 Michael Fulbright <drmike@redhat.com>
- added score files to file list

* Thu Mar 04 1999 Michael Fulbright <drmike@redhat.com>
- Version 1.0.1

* Fri Feb 19 1999 Michael Fulbright <drmike@redhat.com>
- removed *tris games

* Mon Feb 15 1999 Michael Fulbright <drmike@redhat.com>
- version 0.99.8
- added sound event lists to file list
- touched up file list some more

* Wed Feb 03 1999 Michael Fulbright <drmike@redhat.com>
- added gnibbles data to file list

* Wed Feb 03 1999 Michael Fulbright <drmike@redhat.com>
- updated to 0.99.7

* Wed Feb 03 1999 Michael Fulbright <drmike@redhat.com>
- updated to 0.99.5

* Mon Jan 18 1999 Michael Fulbright <drmike@redhat.com>
- updated to 0.99.3

* Wed Jan 06 1999 Michael Fulbright <drmike@redhat.com>
- updated to 0.99.1

* Thu Dec 16 1998 Michael Fulbright <drmike@redhat.com>
- updated to 0.99.0 in prep for GNOME 1.0

* Sat Nov 21 1998 Michael Fulbright <drmike@redhat.com>
- updated for 0.30 tree

* Fri Nov 20 1998 Pablo Saratxaga <srtxg@chanae.alphanet.ch>
- use --localstatedir=/var/lib in config state (score files for games
  for exemple will go there).

* Mon Mar 16 1998 Marc Ewing <marc@redhat.com>
- Integrate into gnome-games CVS source tree

