summaryrefslogtreecommitdiff
path: root/games-fps/xonotic/xonotic-0.8.6.ebuild
blob: 9848e246cedb1ce1c4d56ca42a3d63d03aebd54d (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
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit desktop check-reqs toolchain-funcs xdg

DESCRIPTION="Fork of Nexuiz, Deathmatch FPS based on DarkPlaces, an advanced Quake 1 engine"
HOMEPAGE="https://xonotic.org/"
SRC_URI="https://dl.xonotic.org/${P}.zip"
S="${WORKDIR}/${PN^}"

LICENSE="GPL-3+ GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~x86"
IUSE="X +alsa ode +sdl"

# note: many dependencies are used through dlopen()
COMMON_UIDEPEND="
	media-libs/libogg
	media-libs/libtheora
	media-libs/libvorbis"
RDEPEND="
	dev-libs/d0_blind_id
	media-libs/libjpeg-turbo:=
	media-libs/libpng
	media-libs/freetype:2
	net-misc/curl
	sys-libs/zlib:=
	X? (
		${COMMON_UIDEPEND}
		media-libs/libglvnd[X]
		x11-libs/libX11
		x11-libs/libXext
		x11-libs/libXpm
		x11-libs/libXxf86vm
		alsa? ( media-libs/alsa-lib )
	)
	ode? ( dev-games/ode:=[double-precision] )
	sdl? (
		${COMMON_UIDEPEND}
		media-libs/libsdl2[joystick,opengl,sound,video]
	)"
DEPEND="
	${RDEPEND}
	X? ( x11-base/xorg-proto )"
BDEPEND="app-arch/unzip"

CHECKREQS_DISK_BUILD="1500M"
CHECKREQS_DISK_USR="1200M"

src_prepare() {
	default

	sed -e 's|-O3 ||' \
		-e '/^LDFLAGS_RELEASE/s/$(OPTIM_RELEASE)/$(GENTOO_LDFLAGS)/' \
		-i source/darkplaces/makefile.inc || die
}

src_compile() {
	tc-export CC

	# do not pass in array to keep the makefile.inc's += flags
	local -x CPUOPTIMIZATIONS=${CFLAGS}

	local emakeargs=(
		-C source/darkplaces
		DEFAULT_SNDAPI=$(usex alsa ALSA OSS)
		DP_FS_BASEDIR="${EPREFIX}"/usr/share/${PN}
		DP_LINK_ODE=$(usex ode shared no)
		STRIP=:
		GENTOO_LDFLAGS="${LDFLAGS}"
	)

	# split for bug 473352
	emake "${emakeargs[@]}" sv-release
	use X && emake "${emakeargs[@]}" cl-release
	use sdl && emake "${emakeargs[@]}" sdl-release
}

src_install() {
	newbin {source/darkplaces/darkplaces,${PN}}-dedicated

	if use X || use sdl; then
		if use X; then
			newbin {source/darkplaces/darkplaces,${PN}}-glx
			domenu misc/logos/${PN}-glx.desktop
		fi
		if use sdl; then
			newbin {source/darkplaces/darkplaces,${PN}}-sdl
			domenu misc/logos/${PN}.desktop
		fi

		local size
		for size in 16 22 24 32 48 128 256 512; do
			newicon -s ${size} misc/logos/icons_png/${PN}_${size}.png ${PN}.png
		done
		newicon -s scalable misc/logos/${PN}_icon.svg ${PN}.svg
	fi

	dodoc Docs/*.{md,txt}

	insinto /usr/share/${PN}
	doins -r key_0.d0pk server data

	rm "${ED}"/usr/share/${PN}/server/.gitattributes || die
}