summaryrefslogtreecommitdiff
path: root/7w/7w.spec
blob: 8ccac299b95d7f2f33543e0968e12fa769232533 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
%global     use_master 1
%if 0%{use_master}
%global vername master
%else
%global vername %{version}
%endif

# turn off debug package
%define debug_package %{nil}

Name:       7w
Version:    0.0.1
Release:    1%{?dist}
Summary:    Ncurses-based implementation of 7 Wonders

Group:      Games/Boardgame
License:    GPL2
#OriginalURL: https://github.com/NathanRVance/7w
URL:        https://gitlab.com/bgstack15/%{name}
Source0:    %{URL}/-/archive/%{vername}/%{name}-%{vername}.tar.gz
Source1:    %{name}.svg

Packager:   B Stack <bgstack15@gmail.com>
BuildRequires: gcc
BuildRequires: ncurses-devel
BuildRequires: ImageMagick
Requires:   ncurses
# do not require the icon theme. the rpm can make the dirs, and it won't hurt on terminal-only systems to have the directories with just these icons.
#Requires:      hicolor-icon-theme

%description
7 Wonders is a drafting card game by Antoine Bauza and adapted for ncurses-based gameplay by Nathan Vance. Other works by the computer adaptation author include cettlers, an ncurses adapation of Settlers of Catan.

%prep
#%%setup -n %%{name}-%%{vername}
tar -zxf %{SOURCE0}
cp -p %{SOURCE1} .

%build
cd %{name}-*
cd Release
%make_build

%install
pushd %{name}-*
#%%make_install
# upstream has no install instructions
install -d %{buildroot}%{_licensedir}/%{name} %{buildroot}%{_bindir}
install -m0644 LICENSE %{buildroot}%{_licensedir}/%{name}/
install -m0755 Release/%{name} %{buildroot}%{_bindir}/

# desktop files
install -d %{buildroot}%{_datadir}/applications
cat <<EOF > %{buildroot}%{_datadir}/applications/%{name}.desktop
#!/usr/bin/xdg-open
[Desktop Entry]
Name=7 Wonders
Exec=%{_bindir}/%{name}
Type=Application
StartupNotify=true
Path=%{_bindir}
Icon=%{name}
StartupWMClass=_7wonders
Comment=Drafting card game
Terminal=true
Categories=Game;BoardGame;
EOF

# application start script
# none

# man pages
# none

# mimetypes
# none

# icons
popd
for res in 16 22 24 32 48 64 96 128 256 ;do
  dir=%{buildroot}%{_datadir}/icons/hicolor/${res}x${res}/apps
  mkdir -p ${dir}
  for icon in %{name} ; do
    convert ${icon}.svg -filter Lanczos -resize ${res}x${res}  \
      ${dir}/${icon}.png
  done
done
scalable_dir="%{buildroot}%{_datadir}/icons/hicolor/scalable/apps"
install -d "${scalable_dir}"
install -m0644 "%{name}.svg" "${scalable_dir}"

%clean
%{__rm} -rf %{buildroot} || :

%post
touch --no-create %{_datadir}/icons/hicolor 1>/dev/null 2>&1 || :
update-desktop-database 1>/dev/null 2>&1 || :

%preun
# is it a final removal?
#if test "$1" = "0" ;
#then
#fi

%postun
update-desktop-database &> /dev/null || :

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

%files
#%license %attr(444, -, -) NONE.txt
#%doc %attr(444, -, -) NONE.txt
%license %attr(444, -, -) %{_licensedir}/*
#%doc %attr(444, -, -) %%{_docdir}/*/*
%{_bindir}/%{name}
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*/apps/*
#%%{_datadir}/%%{name}

%changelog
* Fri Apr  5 2019 B Stack <bgstack15@gmail.com> - 0.0.1-1
- Initial rpm built
bgstack15