summaryrefslogtreecommitdiff
path: root/games-fps/alephone/alephone-99999999.ebuild
blob: 37ad604ace9467a2902a1beee4c1836635b0686f (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

VIRTUALX_REQUIRED=test

inherit autotools optfeature prefix toolchain-funcs virtualx xdg

DESCRIPTION="Enhanced game engine version from the classic Mac game, Marathon"
HOMEPAGE="https://alephone.lhowon.org/"
if [[ ${PV} = 9999* ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/Aleph-One-Marathon/alephone/"
	EGIT_SUBMODULES=() # Upstream includes game data as submodules, we only want the engine
else
	SRC_URI="https://github.com/Aleph-One-Marathon/alephone/archive/refs/tags/release-${PV}.tar.gz -> ${P}.tar.gz"
	S="${WORKDIR}/${PN}-release-${PV}"
	KEYWORDS="~amd64 ~arm64"
fi

LICENSE="GPL-3+ BitstreamVera OFL-1.1"
SLOT="0"
IUSE="curl test upnp video-export"

RESTRICT="!test? ( test )"

RDEPEND="
	dev-libs/boost:=
	dev-libs/zziplib:=
	media-libs/openal
	media-libs/libpng
	media-libs/libsdl2[joystick]
	media-libs/libsndfile[-minimal]
	media-libs/sdl2-image[png]
	media-libs/sdl2-ttf
	virtual/zlib:=
	virtual/opengl
	virtual/glu
	curl? ( net-misc/curl )
	upnp? ( net-libs/miniupnpc )
	video-export? (
		dev-libs/libebml:=
		media-libs/libmatroska:=
		media-libs/libvorbis
		media-libs/libvpx:=
		media-libs/libyuv:=
	)
"
DEPEND="${RDEPEND}
	dev-cpp/asio
	test? (
		>=dev-cpp/catch-3:0
		games-fps/alephone-durandal
		games-fps/alephone-infinity
		games-fps/alephone-marathon
	)
"
BDEPEND="virtual/pkgconfig"

src_prepare() {
	default
	eautoreconf
}

src_configure() {
	my_econf=(
		--enable-opengl
		--disable-steam # not packaged?
		--without-nfd # not packaged?
		--with-png
		--with-sdl_image
		--with-zzip
		$(use_with curl)
		$(use_with test catch2)
		$(use_with upnp miniupnpc)
		$(use_with video-export ebml)
		$(use_with video-export matroska)
		$(use_with video-export vpx)
		$(use_with video-export vorbis)
		$(use_with video-export vorbisenc)
		$(use_with video-export libyuv)
	)
	econf "${my_econf[@]}"
}

src_compile() {
	tc-export AR
	default
}

src_test() {
	# We only have the replay regression tests available, but they're better than nothing.
	for p in marathon durandal infinity; do
		local replay_path
		case "${p}" in
		marathon)
			replay_path="${S}/tests/replays/Marathon/Tooncinator Films"
			;;
		durandal)
			replay_path="${S}/tests/replays/Marathon 2"
			;;
		infinity)
			replay_path="${S}/tests/replays/Marathon Infinity/Tooncinator Films"
			;;
		esac
		einfo "Running replay tests for alephone-${p}"
		einfo "This will take several minutes."
		virtx ./Source_Files/alephone_tests --replay-directory "${replay_path}" \
			"${EPREFIX}/usr/share/alephone-${p}" || die "Replay tests for alephone-${p} failed"
	done
}

src_install() {
	default
	prefixify_ro "${FILESDIR}"/${PN}.sh
	dobin "${T}"/${PN}.sh
	doman docs/${PN}.6
	docinto html/
	dodoc docs/*.html
	if use test; then
		rm "${D}"/usr/bin/${PN}_tests || die "Failed to remove test binary"
	fi
}

pkg_postinst() {
	xdg_pkg_postinst
	optfeature_header "Install game data:"
	optfeature "Marathon data files" games-fps/alephone-marathon
	optfeature "Marathon 2 Durandal data files" games-fps/alephone-durandal
	optfeature "Marathon: Infinity data files" games-fps/alephone-infinity
	optfeature "Apotheosis X data files" games-fps/alephone-apotheosis-x
}