File childsplay.spec of Package schoolsplay

#
# spec file for package childsplay
#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

# norootforbuild


Name:           childsplay
Version:        0.90.2
Release:        13
Summary:        A suite of educational games for young children
Group:          Amusements/Games
License:        GPLv3
Url:            http://childsplay.sourceforge.net/
Vendor:         openSUSE-Education
Source0:        %{name}-%{version}.tar.bz2
Source1:        childsplay.desktop
Source2:        childsplay.xpm
Patch0:         childsplay-0.84.1-highscore.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  python
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
Requires:       python-pygame, SDL, SDL_mixer
%{py_requires}
%if 0%{?suse_version} > 1000
Recommends:     childsplay_plugins >= 0.84
%else
Requires:       childsplay_plugins >= 0.84
%endif
%if 0%{?suse_version} > 1020
BuildRequires:  fdupes
%endif
%endif

%description
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.


Authors:
--------
    Stas Zytkiewicz
    Matias Grana


%prep
%setup -q
%patch0 -p1 -z .highscore
# we don't use the buggy provided install
rm install.py
# the translation is merged into the assetml file, so don't ship it seperatly
rm -r assetml/childsplay/memory-136x136/po
# fixup the python scripts to call python directly and make them executable
sed -i 's!/usr/bin/env python!%{_bindir}/python!' %{name}.py letters-trans.py
chmod 755 %{name}.py letters-trans.py pyassetmlcreator.py
# move these out of Data so our wildcard install doesn't install them
mv Data/*.txt Data/logo_cp_*.png Data/childsplay.* .

%build
# INSTALL.sh is seriously borked, so DIY
echo "## Automated file please do not edit" > BASEPATH.py
echo "CPDIR=\"%{_datadir}/%{name}\"" >> BASEPATH.py  
echo "SHAREDATADIR=\"%{_datadir}/%{name}/Data\"" >> BASEPATH.py
echo "SHARELIBDATADIR=\"%{_datadir}/%{name}/plugins\"" >> BASEPATH.py
echo "LIBDIR=\"%{_datadir}/%{name}/plugins\"" >> BASEPATH.py
echo "MODULESDIR=\"%{_datadir}/%{name}/plugins\"" >> BASEPATH.py
echo "RCDIR=\"%{_datadir}/%{name}/plugins/ConfigData\"" >> BASEPATH.py
echo "LOCALEDIR=\"%{_datadir}/locale\"" >> BASEPATH.py
echo "ASSETMLDIR=\"%{_datadir}\"" >> BASEPATH.py
echo "CHILDSPLAYRC=\"childsplayrc\"" >> BASEPATH.py
echo "HOME_DIR_NAME=\".childsplay\"" >> BASEPATH.py

%install
mkdir -p %buildroot%{_bindir}
mkdir -p %buildroot%{_datadir}/%{name}/plugins
mkdir -p %buildroot%{_datadir}/locale
mkdir -p %buildroot%{_mandir}/man6
cp -a *.py %buildroot%{_datadir}/%{name}/
ln -s ../share/%{name}/%{name}.py %buildroot%{_bindir}/%{name}
ln -s ../share/%{name}/letters-trans.py %buildroot%{_bindir}/letters-trans
cp -a Data  %buildroot%{_datadir}/%{name}
cp -a lib/* %buildroot%{_datadir}/%{name}/plugins
cp -a assetml/%{name}/* %buildroot%{_datadir}/%{name}
cp -a locale/* %buildroot%{_datadir}/locale
cp -a man/* %buildroot%{_mandir}/man6
for i in childsplay.py letters-trans.py pyassetmlcreator.py; do
	sed -e "s|#!/usr/bin/env python|#!/usr/bin/python|g" %buildroot%{_datadir}/%{name}/$i > %buildroot%{_datadir}/%{name}/${i}.tmp
	mv %buildroot%{_datadir}/%{name}/${i}.tmp %buildroot%{_datadir}/%{name}/${i}
	chmod 0755 %buildroot%{_datadir}/%{name}/$i
done

# below is the desktop file and icon stuff.
mkdir -p %buildroot%{_datadir}/applications

%if 0%{?suse_version}
  mkdir -p %buildroot%{_datadir}/pixmaps
  install -m 644 %{SOURCE2} %buildroot%{_datadir}/pixmaps/childsplay.xpm
  install -m 644 %{SOURCE1} %buildroot%{_datadir}/applications
  %if 0%{?suse_version} >= 1020
   %suse_update_desktop_file -n -N Childsplay -G "Educational games for young children" childsplay 
  %else
   %suse_update_desktop_file -r childsplay Edutainment
  %endif
  # "no" is not allowed anymore in SuSE Linux.
  # Please use nb or nb_NO (and nn for nynorsk) 
  %{__mv} %buildroot%{_datadir}/locale/no %buildroot%{_datadir}/locale/nb
%endif

%if 0%{?suse_version} > 1020
%fdupes -s %buildroot
%endif

%find_lang %{name}

%clean
rm -rf %buildroot

%files -f %{name}.lang
%defattr(-, root, root, -)
%doc README* doc/GPL* doc/README* License_*.ttf.txt
%{_bindir}/childsplay
%{_bindir}/letters-trans
%{_datadir}/%{name}
%{_mandir}/man6/*.6.gz
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/childsplay.xpm
##%{_datadir}/icons/hicolor/*/apps/%{name}.png


%changelog
openSUSE Build Service is sponsored by