File puzzles.spec of Package puzzles

#
# spec file for package puzzles
#
# Copyright (c) 2025 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:           puzzles
Version:        20250613.47bd72c
Release:        0
Summary:        Portable Puzzle Collection
License:        MIT
Group:          Amusements/Games/Logic
URL:            https://www.chiark.greenend.org.uk/~sgtatham/puzzles
Source:         %{name}-%{version}.tar.gz
Patch1:         desktop.patch
BuildRequires:  ImageMagick
BuildRequires:  cmake >= 3.17
%if 0%{?sle_version}
BuildRequires:  gcc10
%else
BuildRequires:  gcc >= 10.2.1
%endif
BuildRequires:  dejavu-fonts
BuildRequires:  fdupes
BuildRequires:  halibut
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(gtk+-3.0)
Suggests:       sgt-launcher

%description
Simon Tatham's Portable Puzzle Collection.

%prep
%autosetup -p1
sed -i '21a\\\cfg{man-identity}{PUZZLES}{6}{2004-2025}{Puzzles}{Games}' %{name}.but
sed -i '/all_icon_sizes/s/88 //;/all_icon_sizes/s/44 //' icons/icons.cmake

%build
%cmake \
    -DBUILD_SHARED_LIBS:BOOL=OFF \
%if 0%{?sle_version}
    -DCMAKE_C_COMPILER=%{_bindir}/gcc-10 \
%endif
    -DPUZZLES_GTK_VERSION=3 \
    -DNAME_PREFIX=sgt- \
    -DPUZZLES_ENABLE_UNFINISHED="group;separate;slide;sokoban"
%cmake_build
cd ..
halibut --man=%{name}.6 %{name}.but

%install
%cmake_install
install -Dm 0644 %{name}.6 -t %{buildroot}%{_mandir}/man6/

for i in $(grep -h 'puzzle(' CMakeLists.txt | grep -v 'nullgame' | awk -F\( '{print $2}'); do
    %suse_update_desktop_file -n -u sgt-$i
# Create man pages for other binaries
    for other in sgt-$i; do
      echo ".so man6/%{name}.6" > %{buildroot}%{_mandir}/man6/"${other}.6"
    done
done
%fdupes %{buildroot}%{_mandir}/man6/

%files
%license LICENCE
%doc README
%{_bindir}/sgt-*
%{_datadir}/applications/sgt-*.desktop
%{_datadir}/icons/hicolor/*/apps/sgt-*.??g
%{_mandir}/man?/%{name}.?%{?ext_man}
%{_mandir}/man?/sgt-*.?%{?ext_man}
%dir %{_datadir}/sgt-%{name}
%{_datadir}/sgt-%{name}/help

%changelog
openSUSE Build Service is sponsored by