sys-libs/libnih: stable 1.0.3-r4 for hppa, bug #724174
[gentoo.git] / games-puzzle / sgt-puzzles / sgt-puzzles-99999999.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit eutils gnome2-utils toolchain-funcs autotools
7
8 if [[ ${PV} == "99999999" ]] ; then
9         inherit git-r3
10         EGIT_REPO_URI="https://git.tartarus.org/simon/puzzles.git"
11         GENTOO_ICONS="20160315"
12         SRC_URI="https://dev.gentoo.org/~np-hardass/distfiles/${PN}/${PN}-icons-${GENTOO_ICONS}.tar.xz"
13         KEYWORDS=""
14 else
15         MAGIC=e2135d5
16         SRC_URI="https://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles-${PV}.${MAGIC}.tar.gz"
17         S=${WORKDIR}/puzzles-${PV}.${MAGIC}
18         KEYWORDS="~amd64 ~x86"
19 fi
20
21 DESCRIPTION="Simon Tatham's Portable Puzzle Collection"
22 HOMEPAGE="https://www.chiark.greenend.org.uk/~sgtatham/puzzles/"
23
24 LICENSE="MIT"
25 SLOT="0"
26 IUSE="+doc gtk3"
27
28 COMMON_DEPEND="
29         !gtk3? ( x11-libs/gtk+:2 )
30         gtk3? ( x11-libs/gtk+:3 )"
31
32 RDEPEND="${COMMON_DEPEND}
33         x11-misc/xdg-utils" # Used by builtin help patch
34
35 DEPEND="${COMMON_DEPEND}
36         dev-lang/perl
37         virtual/pkgconfig
38         doc? ( >=app-doc/halibut-1.2 )"
39
40 PATCHES=( "${FILESDIR}/${PN}-20161207-builtin-help.patch" )
41
42 src_unpack() {
43         default
44         if [[ ${PV} == "99999999" ]]; then
45                 git-r3_src_unpack
46         fi
47 }
48
49 src_prepare() {
50         default
51
52         sed -i \
53                 -e 's|-Werror||g' \
54                 configure.ac || die
55         sed -i \
56                 -e 's/-O2 -Wall .* -g/-Wall/' \
57                 -e "s/libstr =/libstr = '\$(LDFLAGS) ' ./" \
58                 mkfiles.pl || die
59         ./mkfiles.pl || die
60         eautoreconf
61
62         # Import icons from latest Gentoo tarball for live
63         if [[ ${PV} == "99999999" ]]; then
64                 cp -R ../${PN}-icons/icons . || die
65         fi
66 }
67
68 src_configure() {
69         econf \
70                 --program-prefix="${PN}_" \
71                 --with-gtk=$(usex gtk3 3 2)
72 }
73
74 src_compile() {
75         emake CC="$(tc-getCC)"
76         if use doc ; then
77                 halibut --text --html --info --pdf --ps puzzles.but || die
78         fi
79 }
80
81 src_install() {
82         default
83
84         local file name
85         for file in *.R ; do
86                 [[ ${file} == "nullgame.R" ]] && continue
87                 name=$(awk -F: '/exe:/ { print $3 }' "${file}")
88                 file=${file%.R}
89                 newicon -s 48 icons/${file}-48d24.png ${PN}_${file}.png
90                 make_desktop_entry "${PN}_${file}" "${name}" "${PN}_${file}" "Game;LogicGame;X-${PN};"
91         done
92
93         if use doc ; then
94                 DOCS=( puzzles.{pdf,ps,txt} )
95                 HTML_DOCS=( *.html )
96                 einstalldocs
97                 doinfo puzzles.info{,-1,-2,-3}
98         fi
99
100         insinto /etc/xdg/menus/applications-merged
101         doins "${FILESDIR}/${PN}.menu"
102         insinto /usr/share/desktop-directories
103         doins "${FILESDIR}/${PN}.directory"
104 }
105
106 pkg_preinst() {
107         gnome2_icon_savelist
108 }
109
110 pkg_postinst() {
111         gnome2_icon_cache_update
112 }
113
114 pkg_postrm() {
115         gnome2_icon_cache_update
116 }