File vulture.spec of Package vultures

#
# spec file for package vulture
#
# Copyright (c) 2021 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:           vulture
Version:        2.4.0
Release:        0
Summary:        Isometric graphical interface for NetHack, Slash'EM and UnNetHack
License:        NGPL
Group:          Amusements/Games/RPG
URL:            https://www.darkarts.co.za/vulture-for-nethack
Source0:        https://download.darkarts.co.za/vulture/Vulture+for+NetHack+-+Community+Edition+2.4.zip
Source1:        vulture.png
Source2:        vulture-nethack.desktop
Source3:        vulture-slashem.desktop
Source4:        vulture-unnethack.desktop
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch0:         suse-nethack-config.patch
Patch1:         nethack-vultures-optflags.patch
Patch2:         nethack-vultures-std__algorithm.patch
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch3:         disable-pcmusic.patch
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch4:         suse-nethack-implicit.patch
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch5:         nethack-vultures-overflow-fix.patch
# PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines
Patch6:         vulture-png15.patch

BuildRequires:  SDL-devel
BuildRequires:  SDL_image-devel
BuildRequires:  SDL_mixer-devel
BuildRequires:  SDL_ttf-devel
BuildRequires:  SDL_ttf-devel
BuildRequires:  bison
BuildRequires:  bitstream-vera
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  gcc-c++
BuildRequires:  groff
BuildRequires:  libpng-devel
BuildRequires:  ncurses-devel
BuildRequires:  p7zip
BuildRequires:  unzip
BuildRequires:  update-desktop-files
Requires:       gzip
Requires(pre):  permissions

%description
Isometric graphical interface for NetHack, Slash'EM and UnNetHack.

Previously known as Vulture's Eye and Vulture's Claw for the NetHack and Slash'EM variants respectively, the project's isometric engine is now known as Vulture with all references to Eye and Claw being removed from the project pending the addition of the SporkHack and UnNetHack variants as well.

%package -n vulture-data
Summary:        Shared data files for Vulture
Group:          Amusements/Games/RPG
Requires:       bitstream-vera
Obsoletes:      nethack-falconseye <= 1.9.4-6.a
Obsoletes:      nethack-vultures <= 2.2.100

%description -n vulture-data
Shared data files for the different Vulture versions.

%package -n vulture-nethack
Summary:        Vulture for NetHack
Group:          Amusements/Games/RPG
Requires:       bzip2
Requires:       gzip
Requires:       vulture-data = %{version}
Obsoletes:      nethack-falconseye <= 1.9.4-6.a
Obsoletes:      nethack-vultures <= 2.2.100

%description -n vulture-nethack
Isometric graphical interface for NetHack.
Previously known as Vulture's Eye.

%package -n vulture-slashem
Summary:        Vulture for Slash'Em
Group:          Amusements/Games/RPG
Requires:       bzip2
Requires:       gzip
Requires:       vulture-data = %{version}
Obsoletes:      nethack-falconseye <= 1.9.4-6.a
Obsoletes:      nethack-vultures <= 2.2.100

%description -n vulture-slashem
Isometric graphical interface for Slash'Em.
Previously known as Vulture's Claw.

%package -n vulture-unnethack
Summary:        Vulture for UnNetHack
Group:          Amusements/Games/RPG
Requires:       bzip2
Requires:       gzip
Requires:       vulture-data = %{version}
Obsoletes:      nethack-falconseye <= 1.9.4-6.a
Obsoletes:      nethack-vultures <= 2.2.100

%description -n vulture-unnethack
Isometric graphical interface for UnNetHack.

%prep
%setup -q -n "Vulture for NetHack - Community Edition 2.4"
#%patch0 -p1
%patch1 -p1
%patch2 -p1
#%patch3 -p1
#%patch4 -p1
#%patch5 -p1
#%patch6 -p1

#sed -i -e "s|/usr/games/lib/nethackdir|/var/games/vulture-$game|g" \
#    $game/doc/{nethack,recover}.6 $game/include/config.h
#sed -i -e "s|/var/lib/games/nethack|/var/games/vulture-$game|g" \
#    $game/include/unixconf.h

%build
# create symlinks to makefiles
sh sys/unix/setup.sh 1
# Note: no %{?_smp_mflags} in any of these: various parallel build issues.
make OPTFLAGS="%{optflags}" CXX="g++ -std=c++98"
make -C util recover dlb dgn_comp lev_comp
make -C dat spec_levs quest_levs

%install
make install CHGRP=: CHOWN=: \
GAMEDIR=%{buildroot}%{_datadir}/vulture-$game \
VARDIR=%{buildroot}%{_localstatedir}/games/vulture-$game \
SHELLDIR=%{buildroot}%{_bindir}
%fdupes %{buildroot}%{_datadir}/vulture-$game/

# man pages
install -D -d -m 755 %{buildroot}%{_mandir}/man6/
for game in %{_gamelist}; do
install -m 644 $game/doc/nethack.6 %{buildroot}%{_mandir}/man6/vulture-$game.6
install -m 644 $game/doc/recover.6 %{buildroot}%{_mandir}/man6/vulture-$game-recover.6
done

# BLG-boyd
#install -m 755 -d %{buildroot}%{_sysconfdir}/vultures
#install -m 644 vulturesrc %{buildroot}%{_sysconfdir}/vultures/vulturesrc.$STYLE

# Install desktop files
install -dm 755 %{buildroot}%{_datadir}/applications/
install -D -m 644 %{SOURCE2} %{SOURCE3} %{SOURCE4} %{buildroot}%{_datadir}/applications/

install -dm 755 %{buildroot}%{_datadir}/pixmaps/
for game in %{_gamelist}; do
%suse_update_desktop_file vulture-$game
done

# Icon
install -D -m 644 %{SOURCE1} %{buildroot}%{_datadir}/pixmaps/
for game in %{_gamelist}; do
i=vulture-$game

# BLG-boyd
    mv %{buildroot}%{_datadir}/$i/recover \
        %{buildroot}%{_bindir}/$i-recover

# Added by Vincent Petry
    # Moving binaries out of the data dir
    mv %{buildroot}%{_datadir}/$i/$i %{buildroot}%{_bindir}/

    # Bitstream font link
    ln -sf %{_datadir}/fonts/truetype/VeraSe.ttf %{buildroot}%{_datadir}/$i/fonts/

    # Log file
    touch %{buildroot}%{_localstatedir}/games/$i/vultures_log.txt

    # Symlinks to var files
    for j in perm record logfile vultures_log.txt; do
        ln -sf %{_localstatedir}/games/$i/$j %{buildroot}%{_datadir}/$i/
    done
done

# Create a shared data directory
# and make symbolic links for each game point there
install -D -d %{buildroot}%{_datadir}/vulture-data/
for f in graphics music sound tiles manual; do
    mv %{buildroot}%{_datadir}/vulture-nethack/$f %{buildroot}%{_datadir}/vulture-data/
    for game in %{_gamelist}; do
        rm -rf %{buildroot}%{_datadir}/vulture-$game/$f
        ln -s %{_datadir}/vulture-data/$f \
            %{buildroot}%{_datadir}/vulture-$game/$f
    done
done

# Clean up
for game in %{_gamelist}; do
chmod -R 0775 %{buildroot}%{_localstatedir}/games/vulture-$game
sed -i -e "s|%{buildroot}||g" %{buildroot}%{_bindir}/vulture-$game

# Remove license from data dir, since already present in doc dir
rm %{buildroot}%{_datadir}/vulture-$game/license
done

%fdupes %{buildroot}

%post
%run_permissions

%files -n vulture-data
%defattr(-,root,root)
%dir %{_datadir}/vulture-data/
%{_datadir}/vulture-data/*
%{_datadir}/pixmaps/vulture*.png

%files -n vulture-nethack
%defattr(-,root,root)
%doc LICENSE README
%attr(755,root,root) %{_bindir}/vulture-nethack
%attr(755,root,root) %{_bindir}/vulture-nethack-recover
%attr(755,root,games) %dir %{_datadir}/vulture-nethack/
%{_datadir}/vulture-nethack/*
%{_datadir}/applications/vulture-nethack.desktop

%defattr(664,root,games,775)
%dir %{_localstatedir}/games/vulture-nethack/
%config(noreplace) %{_localstatedir}/games/vulture-nethack/record
%config(noreplace) %{_localstatedir}/games/vulture-nethack/perm
%config(noreplace) %{_localstatedir}/games/vulture-nethack/logfile
%config(noreplace) %{_localstatedir}/games/vulture-nethack/vultures_log.txt
%dir %{_localstatedir}/games/vulture-nethack/save/

%defattr(644,root,root,755)
%{_mandir}/man6/vulture-nethack-recover.6.gz
%{_mandir}/man6/vulture-nethack.6.gz

%files -n vulture-slashem
%defattr(-,root,root)
%doc slashem/readme.txt slashem/history.txt slashem/slamfaq.txt LICENSE README
%attr(755,root,root) %{_bindir}/vulture-slashem
%attr(755,root,root) %{_bindir}/vulture-slashem-recover
%attr(755,root,games) %dir %{_datadir}/vulture-slashem/
%{_datadir}/vulture-slashem/*
%{_datadir}/applications/vulture-slashem.desktop

%defattr(664,root,games,775)
%dir %{_localstatedir}/games/vulture-slashem/
%config(noreplace) %{_localstatedir}/games/vulture-slashem/record
%config(noreplace) %{_localstatedir}/games/vulture-slashem/perm
%config(noreplace) %{_localstatedir}/games/vulture-slashem/logfile
%config(noreplace) %{_localstatedir}/games/vulture-slashem/vultures_log.txt
%dir %{_localstatedir}/games/vulture-slashem/save/

%defattr(644,root,root,755)
%{_mandir}/man6/vulture-slashem-recover.6.gz
%{_mandir}/man6/vulture-slashem.6.gz

%files -n vulture-unnethack
%defattr(-,root,root)
%doc LICENSE README
%attr(755,root,root) %{_bindir}/vulture-unnethack
%attr(755,root,root) %{_bindir}/vulture-unnethack-recover
%attr(755,root,games) %dir %{_datadir}/vulture-unnethack/
%{_datadir}/vulture-unnethack/*
%{_datadir}/applications/vulture-unnethack.desktop

%defattr(664,root,games,775)
%dir %{_localstatedir}/games/vulture-unnethack/
%config(noreplace) %{_localstatedir}/games/vulture-unnethack/record
%config(noreplace) %{_localstatedir}/games/vulture-unnethack/perm
%config(noreplace) %{_localstatedir}/games/vulture-unnethack/logfile
%config(noreplace) %{_localstatedir}/games/vulture-unnethack/vultures_log.txt
%dir %{_localstatedir}/games/vulture-unnethack/save/

%defattr(644,root,root,755)
%{_mandir}/man6/vulture-unnethack-recover.6.gz
%{_mandir}/man6/vulture-unnethack.6.gz

%changelog
openSUSE Build Service is sponsored by