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

EAPI=7

WX_GTK_VER="3.0-gtk3"
inherit cmake-utils desktop wxwidgets xdg

DESCRIPTION="Online multiplayer free software engine for DOOM"
HOMEPAGE="https://odamex.net/"
SRC_URI="mirror://sourceforge/${PN}/Odamex/${PV}/${PN}-src-${PV}.tar.bz2"

LICENSE="GPL-2+ MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+client master +odalaunch portmidi server upnp X"
REQUIRED_USE="|| ( client master server )"

RDEPEND="
	client? (
		media-libs/libpng:0=
		media-libs/libsdl2[joystick,sound,video]
		media-libs/sdl2-mixer
		odalaunch? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )
		portmidi? ( media-libs/portmidi )
		X? ( x11-libs/libX11 )
	)
	server? (
		upnp? ( net-libs/miniupnpc:= )
	)"
DEPEND="${RDEPEND}"
BDEPEND="games-util/deutex"

S="${WORKDIR}/${PN}-src-${PV}"

PATCHES=(
	"${FILESDIR}"/${P}-miniupnpc.patch
)

src_prepare() {
	rm -r libraries/libminiupnpc odamex.wad || die

	use odalaunch && setup-wxwidgets

	cmake-utils_src_prepare
}

src_configure() {
	local mycmakeargs=(
		-DBUILD_CLIENT=$(usex client)
		-DBUILD_MASTER=$(usex master)
		-DBUILD_ODALAUNCH=$(usex odalaunch)
		-DBUILD_SERVER=$(usex server)
		-DENABLE_PORTMIDI=$(usex portmidi)
		-DUSE_MINIUPNP=$(usex upnp)
	)

	cmake-utils_src_configure
}

src_compile() {
	cmake-utils_src_compile

	# Build odamex.wad
	cd wad || die "cd failed"
	deutex -rgb 0 255 255 -doom2 bootstrap -build wadinfo.txt ../odamex.wad || die
}

src_install() {
	if use client ; then
		newicon -s 128 "${S}/media/icon_${PN}_128.png" "${PN}.png"
		make_desktop_entry "${PN} -waddir /usr/share/doom" "Odamex"

		if use odalaunch ; then
			newicon -s 128 "${S}/media/icon_odalaunch_128.png" "odalaunch.png"
			make_desktop_entry odalaunch "Odamex Launcher" odalaunch
		fi
	fi

	cmake-utils_src_install
}