File omnitux.spec of Package omnitux

#
# spec file for package omnitux
#
# 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 http://bugs.opensuse.org/
#


Name:           omnitux
Version:        1.2.1
Release:        1
License:        GPL-2.0+ and CC-BY-1.0 and CC-BY-NC-SA-1.0
Summary:        Educational activities around multimedia elements
Url:            http://omnitux.sourceforge.net/
Group:          Amusements/Teaching/Mathematics
Source0:        %{name}-%{version}.tar.bz2
Source1:        %{name}.desktop
Source2:        %{name}.svg
# PATCH-MISSING-TAG -- See http://en.opensuse.org/Packaging/Patches
Patch1:         omnitux-new_from_file_at_size.patch
BuildArch:      noarch
###########################################
# Fedora specials
###########################################
%if 0%{?fedora_version}
Requires:       pygame
Requires:       pygtk2
%endif
###########################################
# SUSE specials
###########################################
%if 0%{?suse_version}
BuildRequires:  fdupes
BuildRequires:  update-desktop-files
Requires:       python-gtk
Requires:       python-pygame
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The project aims to provide various educational activities around multimedia
elements (images, sounds, texts). Omnitux provides various different activity
types including associations, puzzles and counting.

%prep
%setup -q -n %{name}
%patch1 -p0
find -iname "*.pyc" -delete

%build

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}/
cp -r * %{buildroot}%{_datadir}/%{name}/
# cleanup
rm -rf %{buildroot}%{_datadir}/%{name}/log
rm %{buildroot}%{_datadir}/%{name}/bin/ui.py.orig
find %{buildroot}%{_datadir}/%{name} -name "*.txt" -exec chmod 644 {} \;
find %{buildroot}%{_datadir}/%{name} -name "*.xml" -exec chmod 644 {} \;
find %{buildroot}%{_datadir}/%{name} -name "*.svg" -exec chmod 644 {} \;

# docu
for file in LICENSE.txt README.txt ; do
	mv %{buildroot}%{_datadir}/%{name}/$file %{buildroot}%{_defaultdocdir}/%{name}/
done
chmod +x %{buildroot}%{_datadir}/%{name}/*.sh
#
# install binfile
cat > %{buildroot}%{_bindir}/%{name} << EOF
#!/bin/bash
cd %{_datadir}/%{name}
/bin/bash omnitux.sh
EOF
chmod +x %{buildroot}%{_bindir}/%{name}
#
# below is the desktop file and icon stuff.
install -Dm 644 %SOURCE1 %{buildroot}%{_datadir}/applications/%{name}.desktop
install -Dm 644 %SOURCE2 %{buildroot}%{_datadir}/pixmaps/%{name}.svg
%if 0%{?suse_version}
%suse_update_desktop_file -n %{name} Education Math
%endif
#
%if 0%{?fedora_version}
desktop-file-install --vendor="%{vendor}" \
  --dir=%{buildroot}%{_datadir}/applications \
  %SOURCE1
%endif
#
# save discspace: symlink duplicates
%if 0%{?suse_version}
%fdupes -s %{buildroot}
%endif

%clean
rm -rf %{buildroot}

%files
%defattr(-, root, root)
%doc %{_defaultdocdir}/%{name}
%{_bindir}/%{name}
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.*

%changelog
openSUSE Build Service is sponsored by