File lbreakout2.spec of Package lbreakout2

#
# spec file for package lbreakout2
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2009-2010 Pascal Bleser <pascal.bleser@opensuse.org>
# Copyright (c) 2017 Pauline Emily <vilene@posteo.net>
#
# 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:           lbreakout2
Version:        2.6.5
Release:        0
Summary:        Classic Breakout-Style Game
License:        GPL-2.0-or-later
Group:          Amusements/Games/Action/Breakout
URL:            https://lgames.sourceforge.net/index.php?project=LBreakout2
Source:         %{name}-%{version}.tar.gz
Source1:        %{name}-levelsets-20160512.tar.gz
Source2:        lbreakout2.6
Source3:        lbreakout2server.6
BuildRequires:  ImageMagick
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(SDL_mixer)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(sdl)
Requires(post): user(games)

%description
A Breakout-style arcade game for Linux featuring a number of added
graphical enhancements and effects. You control a paddle at the bottom
of the playing field and must destroy bricks at the top by bouncing
balls against them.

%prep
%autosetup -p1

%build
export CFLAGS="%{optflags} -fno-strict-aliasing -D_FORTIFY_SOURCE=2"
%configure \
  --docdir=%{_docdir}/%{name} \
  --localstatedir=%{_localstatedir}/games
%make_build

%install
%make_install

# install levels
tar -xf %{SOURCE1} -C %{buildroot}%{_datadir}/%{name}/levels

# install icons
rm -rf %{buildroot}%{_datadir}/icons
for size in 32 48; do
	icon_dir=%{buildroot}%{_datadir}/icons/hicolor/${size}x${size}/apps
	mkdir -p ${icon_dir}
	convert -strip lbreakout${size}.gif ${icon_dir}/%{name}.png
done

# install man pages
install -d %{buildroot}%{_mandir}/man6
install -m 644 %{SOURCE2} %{SOURCE3} %{buildroot}%{_mandir}/man6

# fix name of the HTML documentation directory
mv %{buildroot}%{_docdir}/%{name}/lbreakout2 \
   %{buildroot}%{_docdir}/%{name}/html

# fix desktop file
sed -i "s/^\(Icon=\).*/\1%{name}/" \
	%{buildroot}%{_datadir}/applications/%{name}.desktop

# fix file modes
find %{buildroot}%{_datadir}/%{name} -type f -exec chmod 0644 {} \;

%find_lang %{name}
%fdupes -s %{buildroot}

%files -f %{name}.lang
%license COPYING
%doc AUTHORS ChangeLog README TODO
%{_mandir}/man6/lbreakout2.6%{?ext_man}
%{_mandir}/man6/lbreakout2server.6%{?ext_man}
%{_bindir}/lbreakout2
%{_bindir}/lbreakout2server
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_docdir}/%{name}
%attr(664,games,games) %{_localstatedir}/games/%{name}.hscr

%changelog
openSUSE Build Service is sponsored by