File bambam.spec of Package bambam
#
# spec file for package bambam
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
Name: bambam
# when bumping this version, ensure the version is also bumped in _service
Version: 1.3.0
Release: 0
Summary: Keyboard mashing and doodling game for babies and toddlers
# Original code specifies GPLv3+ as license, assuming GPL-3.0-only+ applies but it may well be GPL-3.0-or-later+
License: GPL-3.0-only+
URL: https://github.com/porridge/bambam
# artefact generated by _service
Source0: %{name}-%{version}.tar.xz
BuildArch: noarch
BuildRequires: desktop-file-utils
BuildRequires: po4a >= 0.52
Requires: python3-base >= 3.9
Requires: python3-pygame >= 2.0
Requires: python3-PyYAML
%description
Bambam is a simple baby keyboard (and gamepad) masher application that locks the keyboard and mouse and instead displays bright colors, pictures, and sounds. While OSX has great programs like AlphaBaby, the original author couldn't find anything for Linux and having wanted to learn Python for a while, Bambam was his excuse.
%prep
%autosetup -p1
%build
sed -i -e "s,-o root -g root ,," Makefile
sed -i -e "s,/usr/bin/env python3,%{_bindir}/python3," %{name}.py
make all
# Generated by make banban.desktop banban-session.desktop
sed -i -e "s,/usr/games/,/usr/bin/," %{name}.desktop
sed -i -e "s,/usr/games/,/usr/bin/," %{name}-session.desktop
%install
PREFIX=%{buildroot} make install-mo
mkdir -p %{buildroot}/usr/share/%{name}
cp -r data %{buildroot}/usr/share/%{name}/
cp -r extensions %{buildroot}/usr/share/%{name}/
install -m 0644 -D %{name}.desktop %{buildroot}/usr/share/applications/%{name}.desktop
install -m 0644 -D %{name}-session.desktop %{buildroot}/usr/share/xsessions/%{name}-session.desktop
# debugging
desktop-file-validate %{buildroot}/usr/share/applications/%{name}.desktop
desktop-file-validate %{buildroot}/usr/share/xsessions/%{name}-session.desktop
install -m 0644 -D %{name}.6 %{buildroot}/%_mandir/man6/%{name}.6
# manpages in other languages, this feels gross but how else would you do this
sh -c 'for lang in %{name}.??*.6; do install -m 0644 -D $lang %{buildroot}/%{_mandir}/`echo $lang|awk -F. '"'"'{print $2}'"'"'`/man6/%{name}.6; done'
%find_lang %{name} --with-man
# according to rpm-packaging-guide.github.io you should compile to python bytecode and have a shim that invokes your compiled file
# but that appears to have been written when python 2.7 was in vogue so i will not do that.
install -m 0755 -D %{name}.py %{buildroot}/%_bindir/%{name}
%check
# FIXME: have to declare that the package expects /usr/share/man/ko/man6 and the same for tr because non-tumbleweed variants of opensuse may not know about them and it causes the build to fail
%files -f %{name}.lang
%license COPYING
%doc EXTENSIONS.md README.md
%_bindir/%{name}
%_mandir/man6/%{name}.6*
/usr/share/%{name}
/usr/share/applications/%{name}.desktop
/usr/share/xsessions/%{name}-session.desktop
%dir %_mandir/ko
%dir %_mandir/ko/man6
%dir %_mandir/tr
%dir %_mandir/tr/man6
%changelog
* Mon Jun 17 2024 Maff <hi@maff.scot> - 1.3.0
- First OpenSuSE build of bambam.