summaryrefslogtreecommitdiff
blob: b1acf6f084c52b127e3b7b282f39c893df85cbff (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
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6
inherit eutils user
RESTRICT="mirror"

DESCRIPTION="simple game similar to the classical game Marble Madness"
HOMEPAGE="http://trackballs.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz
	mirror://sourceforge/${PN}/${PN}-music-1.4.tar.bz2"

LICENSE="GPL-2 FML-1"
SLOT="0"
KEYWORDS="amd64 ~ppc x86"
IUSE="nls"

RDEPEND="virtual/opengl
	virtual/glu
	media-libs/libsdl[sound,joystick,video]
	>=dev-scheme/guile-1.8:12[deprecated]
	media-libs/sdl-mixer
	media-libs/sdl-image
	media-libs/sdl-ttf
	nls? ( virtual/libintl )"
DEPEND="${RDEPEND}
	nls? ( sys-devel/gettext )"

pkg_setup(){
	enewgroup gamestat 36
}

src_prepare() {
	sed -i \
		-e 's/icons //' \
		-e 's/games/gamestat/' \
		share/Makefile.in \
		|| die
	sed -i \
		-e '/^localedir/s:=.*:=/usr/share/locale:' \
		src/Makefile.in \
		po/Makefile.in.in \
		|| die
	# Fix _FORTIFY_SOURCE buffer overflow due to wrong sizeof
	sed -i \
		-e 's/\(snprintf(\(name\),sizeof\)(str)/\1(\2)/' \
		src/enterHighScoreMode.cc || die
	# Fix -Wformat-security warning due to non-literal with no format arguments
	sed -i \
		-e 's/\(snprintf(levelname,sizeof(levelname),\)\(name)\)/\1 "%s", \2/' \
		-e 's/\(snprintf(Settings::settings->specialLevel,sizeof(Settings::settings->specialLevel),\)\(levelname)\)/\1 "%s", \2/' \
		src/editMode.cc || die
	sed -i \
		-e 's/\(snprintf(\(textureName\),\)63\(,textureNames\[i\])\)/\1 sizeof(\2), "%s"\3/' \
		src/map.cc || die
	eapply "${FILESDIR}"/${P}-warning.patch
	eapply_user
}

src_configure() {
	econf \
		--datadir=/usr/share/games \
		--datarootdir=/usr/share \
		--disable-dependency-tracking \
		--with-highscores=/var/games/${PN}.score \
		$(use_enable nls)
}

src_install() {
	make DESTDIR="${D}" install
	insinto /usr/share/games/${PN}/music
	doins "${WORKDIR}"/trackballs-music/*.ogg
	newicon share/icons/${PN}-64x64.png ${PN}.png
	make_desktop_entry ${PN} Trackballs
	dodoc AUTHORS ChangeLog FAQ NEWS README TODO
	fowners root:gamestat /usr/bin/${PN}
	fperms 2755 /usr/bin/${PN}
}