File childsplay.spec of Package childsplay

# spec file for package childsplay
# Copyright (c) 2012 Lars Vogdt <>
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           childsplay
Version:        1.6
Release:        1
License:        GPL-3.0+
%define         realname childsplay_sp
Summary:        A suite of educational games for young children
Group:          Amusements/Teaching/Other
Source0:        %{name}-%{version}.tar.bz2
Source1:        childsplay.desktop
Source2:        childsplay.xpm
Source3:        childsplay-admin.desktop
Source4:        childsplay-rpmlintrc
Patch1:         childsplay-locale.patch
Patch2:         childsplay-missing_exceptions_module.patch
BuildRequires:  SDL_image-devel
BuildRequires:  SDL_mixer-devel
BuildRequires:  SDL_ttf-devel
BuildRequires:  libogg-devel
BuildRequires:  python-devel
## BuildArch:      noarch
Requires:       SDL
Requires:       python-pysqlite
Requires:       python-xml
Provides:       childsplay_sp = %{version}
Provides:       childsplay_plugins = %{version}
Obsoletes:      childsplay_plugins <= 0.90
Provides:       childsplay_plugins_lfc = %{version}
Obsoletes:      childsplay_plugins_lfc <= 0.90
# openSUSE specials
%if 0%{?suse_version}
BuildRequires:  dejavu
BuildRequires:  fdupes
BuildRequires:  gettext-runtime
BuildRequires:  python-gtk
BuildRequires:  python-numpy
BuildRequires:  python-pygame
BuildRequires:  python-pysqlite
BuildRequires:  python-sqlalchemy
BuildRequires:  update-desktop-files
Requires:       dejavu
Requires:       python-gtk
Requires:       python-numpy
Requires:       python-pygame
Requires:       python-sqlalchemy
Recommends:     childsplay-languagepack
# Mandriva specials
%if 0%{?mandriva_version}
BuildRequires:  fonts-ttf-dejavu
BuildRequires:  gettext-base
#BuildRequires:  pygame
BuildRequires:  pygtk2.0
BuildRequires:  python-numpy
BuildRequires:  python-sqlite2
Requires:       fonts-ttf-dejavu
Requires:       gettext-base
Requires:       pygame
Requires:       pygtk2.0
Requires:       python-numpy
Requires:       python-sqlalchemy
#BuildRequires:  python-sqlalchemy
# Fedora specials
%if 0%{?fedora_version}
BuildRequires:  atlas
#BuildRequires:  dejavu-fonts
BuildRequires:  gettext
BuildRequires:  pygame
BuildRequires:  pygtk2
BuildRequires:  python-sqlalchemy
BuildRequires:  python-sqlite2
Requires:       dejavu-fonts
Requires:       gettext
Requires:       pygame
Requires:       pygtk2
Requires:       python-sqlalchemy
Requires:       python26-numpy
#BuildRequires:  python26-numpy

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%define python_sitedir %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")

Childsplay is a suite of educational games for young children. It's written in
Python and uses the SDL-libraries. The aim is to be educational and at the same
time be fun to play.

Some activities make use of language dependent voice samples, these sounds are
shared with gcompris. For those you'll have to install the gcompris-sound
package for the languages you intend to use. For example gcompris-sound-en.

%setup -q
%patch1 -p0
%patch2 -p1
sed -i "s!/usr/bin/env python!%{_bindir}/python!" bin/%{name}

# is not usable for our needs
cat > << EOF
# This module holds all the paths needed for childsplay_sp.

DOCDIR = '%{_defaultdocdir}/%{realname}'
PYTHONCPDIR = '%{py_sitedir}/%{realname}'
BASEDIR = '%{_datadir}/%{realname}'
SHARELIBDATADIR = '%{_datadir}/%{realname}'
ALPHABETDIR = '%{_datadir}/alphabet_sounds'
LOCALEDIR = '%{_datadir}/locale'

# regenerate the .mo files from the .po files
rm -rf locale
mkdir -p locale
pushd po >/dev/null
for i in *.po; do
	longlang=$(basename ${i/childsplay_sp_/} .po);
	mkdir -p ../locale/$lang/LC_MESSAGES
	msgfmt $i -o ../locale/$lang/LC_MESSAGES/
popd >/dev/null

mkdir -p %{buildroot}
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{py_sitedir}/%{realname}/lib
mkdir -p %{buildroot}%{_datadir}/locale
mkdir -p %{buildroot}%{_datadir}/%{realname}
install -m755 bin/%{name}  %{buildroot}%{_bindir}/

cp -a lib/CPData %{buildroot}%{_datadir}/%{realname}/
cp -a lib/SPData %{buildroot}%{_datadir}/%{realname}/
cp -a alphabetsounds/* %{buildroot}%{_datadir}/alphabet_sounds/
cp -a locale/* %{buildroot}%{_datadir}/locale/

cp -a *.py %{buildroot}%{py_sitedir}/%{realname}
cp -a gui %{buildroot}%{py_sitedir}/%{realname}
cp -a lib/*.py %{buildroot}%{py_sitedir}/%{realname}/lib
cp -a ocempgui %{buildroot}%{py_sitedir}/%{realname}
# below is the desktop file and icon stuff.
install -Dm 644 %{SOURCE1} %{buildroot}%{_datadir}/applications/childsplay.desktop
install -Dm 644 %{SOURCE2} %{buildroot}%{_datadir}/pixmaps/childsplay.xpm
install -m 644  %{SOURCE3} %{buildroot}%{_datadir}/applications/childsplay-admin.desktop
%if 0%{?suse_version}
  %suse_update_desktop_file -n -N Childsplay -G "Educational games for young children" childsplay
  %suse_update_desktop_file -n -N Childsplay -G "Childsplay Administration" childsplay-admin System SystemSetup
# docu
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}
cp -a doc/* %{buildroot}%{_defaultdocdir}/%{name}
install -m644 COPYING README Changelog %{buildroot}%{_defaultdocdir}/%{name}/
sed -i "s|||" %{buildroot}%{_defaultdocdir}/%{name}/*
# link the font into the right directory
if [ -f "%{_datadir}/fonts/truetype/DejaVuSansCondensed-Bold.ttf" ]; then
  for file in DejaVuSansCondensed-Bold.ttf SPData/DejaVu-ttf.copyright; do
	test -f "%{buildroot}%{_datadir}/%{realname}/SPData/$file" && rm "%{buildroot}%{_datadir}/%{realname}/SPData/$file"
  ln -s "%{_datadir}/fonts/truetype/DejaVuSansCondensed-Bold.ttf" "%{buildroot}%{_datadir}/%{realname}/SPData/DejaVuSansCondensed-Bold.ttf"
%if 0%{?suse_version}
  # save space
  %fdupes -s %{buildroot}
%find_lang %{realname}

rm -rf %{buildroot}

%files -f %{realname}.lang
%defattr(-, root, root, -)
%doc %{_defaultdocdir}/%name
%dir %{_datadir}/alphabet_sounds

openSUSE Build Service is sponsored by