summaryrefslogtreecommitdiff
blob: f7d5b90b6286114e89e440f79e92780a7a8516b0 (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
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7
PYTHON_COMPAT=( python3_{6,7,8} )

inherit desktop python-single-r1

DESCRIPTION="An enriched clone of the game 'Logical' by Rainbow Arts"
HOMEPAGE="http://pathological.sourceforge.net/"
SRC_URI="
	mirror://sourceforge/${PN}/${P/_p*}.tar.gz
	mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PV/_p*}-${PV/*_p}.debian.tar.xz
"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"

IUSE="doc"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"

RDEPEND="${PYTHON_DEPS}
	>=dev-python/pygame-1.5.5[${PYTHON_USEDEP}]
"
DEPEND="${RDEPEND}"
BDEPEND="${PYTHON_DEPS}
	doc? ( media-libs/netpbm )
"

S="${WORKDIR}/${P/_p*}"

src_unpack() {
	unpack ${A}
	cd "${S}" || die
	unpack ./${PN}.6.gz
}

src_prepare() {
	default

	# Debian fixes
	# We don't face this bug, this way we skip needing to convert the
	# files at build time
	sed -i -e '/60_use_ogg_music.patch/d' "${WORKDIR}"/debian/patches/series || die

	for p in $(<"${WORKDIR}"/debian/patches/series) ; do
		eapply -p1 "${WORKDIR}/debian/patches/${p}"
	done

	# Fix prestripped files
	eapply "${FILESDIR}/${PN}-1.1.3-build-r1.patch"

	if use doc ; then
		sed -i -e '5,$ s/=/ /g' makehtml || die
	else
		echo "#!/bin/sh" > makehtml
	fi

	sed -i \
		-e "s:/usr/share/games:/usr/share:" \
		-e "s:exec:exec ${EPYTHON}:" \
		${PN} || die

	sed -i \
		-e 's:\xa9:(C):' \
		-e "s:/usr/lib/${PN}/bin:/usr/$(get_libdir)/${PN}:" \
		${PN}.py || die

	python_fix_shebang ${PN}.py
}

src_install() {
	dobin ${PN}

	exeinto /usr/"$(get_libdir)"/${PN}
	doexe write-highscores

	insinto /usr/share/${PN}
	doins -r circuits graphics music sounds ${PN}.py

	insinto /var/games/
	doins ${PN}_scores
	fperms 660 /var/games/${PN}_scores

	dodoc changelog README TODO
	doman ${PN}.6
	use doc && dohtml -r html/*

	doicon ${PN}.xpm
	make_desktop_entry ${PN} Pathological ${PN}

	# remove some unneeded resource files
	rm -f "${ED}"/usr/share/${PN}/graphics/*.xcf
}

pkg_postinst() {
	if ! has_version "media-libs/sdl-mixer[mod]" ; then
		echo
		elog "Since you have turned off the 'mod' use flag for media-libs/sdl-mixer"
		elog "no background music will be played."
		echo
	fi

}