summaryrefslogtreecommitdiff
path: root/games-strategy/naev/naev-0.13.5.ebuild
blob: f9602371b53d77ec70cf294104ea00b0c4d4dda9 (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

LUA_COMPAT=( lua5-{1,3,4} luajit )
PYTHON_COMPAT=( python3_{13..14} )
RUST_MIN_VER=1.89.0
inherit cargo lua-single meson python-any-r1 xdg

DESCRIPTION="2D space trading and combat game, in a similar vein to Escape Velocity"
HOMEPAGE="https://naev.org/"
# creating the vendor tarball first requires running src_compile until
# it fails downloading crates in sandbox to generate several cargo files
# https://codeberg.org/naev/naev/issues/3449
SRC_URI="
	https://codeberg.org/naev/naev/releases/download/v${PV}/${P}-source.tar.xz
	https://distfiles.gentoo.org/pub/dev/ionen@gentoo.org/${P}-vendor.tar.xz
"

LICENSE="GPL-3+ BSD BSD-2 MIT"
LICENSE+="
	Apache-2.0 CC-BY-2.0 CC-BY-3.0 CC-BY-4.0 CC-BY-SA-2.0 CC-BY-SA-3.0
	CC-BY-SA-4.0 CC0-1.0 FDL-1.2 GPL-2+ OFL-1.1 public-domain
" # assets
LICENSE+="
	Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 BSD CC0-1.0
	CDLA-Permissive-2.0 IJG ISC MIT MIT-0 MPL-2.0 openssl Unicode-3.0
	ZLIB
" # crates
SLOT="0"
KEYWORDS="~amd64"
IUSE="doc"
REQUIRED_USE="${LUA_REQUIRED_USE}"

# tests been a headache to keep working in sandbox with software GL
RESTRICT="test"

# dlopen: libglvnd
# libunibreak upper bound: bug #983053
RDEPEND="
	${LUA_DEPS}
	app-text/cmark:=
	dev-games/physfs
	>=dev-libs/libgit2-1.9.4:0/1.9
	dev-libs/libpcre2:=
	<dev-libs/libunibreak-8.0:=
	dev-libs/libxml2:=
	dev-libs/openssl:=
	media-libs/dav1d:=
	media-libs/freetype:2
	media-libs/libglvnd
	media-libs/libsdl3[opengl]
	media-libs/libvorbis
	media-libs/openal
	media-libs/opus
	net-libs/enet:1.3=
	net-libs/libssh2
	sci-libs/cholmod:=
	sci-libs/cxsparse:=
	sci-libs/flexiblas
	sci-libs/openblas
	sci-mathematics/glpk:=
	virtual/libintl
"
DEPEND="${RDEPEND}"
BDEPEND="
	$(python_gen_any_dep 'dev-python/pyyaml[${PYTHON_USEDEP}]')
	>=dev-build/meson-1.7.0
	>=dev-util/bindgen-0.72.0
	sys-devel/gettext
	doc? (
		app-text/doxygen
		dev-lua/ldoc
		media-gfx/graphviz
	)
"

QA_FLAGS_IGNORED="usr/lib.*/libnaev_rlib.so" # rust

python_check_deps() {
	python_has_version "dev-python/pyyaml[${PYTHON_USEDEP}]"
}

pkg_setup() {
	lua-single_pkg_setup
	python-any-r1_pkg_setup
	rust_pkg_setup
}

src_prepare() {
	default

	# don't probe OpenGL for tests (avoids sandbox violations, bug #829369)
	sed -i "/subdir('glcheck')/d" test/meson.build || die

	# meson.build overrides CARGO_HOME, symlink to use our config.toml
	# (note need to set BUILD_DIR either way due to cargo_env's subshell)
	BUILD_DIR=${WORKDIR}/${P}-build
	mkdir -p -- "${BUILD_DIR}" || die
	ln -s -- "${CARGO_HOME}" "${BUILD_DIR}"/cargo-home || die
}

src_configure() {
	export LIBGIT2_NO_VENDOR=1
	export LIBSSH2_SYS_USE_PKG_CONFIG=1

	local emesonargs=(
		# *can* do lua5-1 but upstream uses+test luajit most (bug #946881)
		-Dluajit=enabled
		$(meson_feature doc docs_c)
		$(meson_feature doc docs_lua)
	)

	cargo_env meson_src_configure
}

src_compile() {
	cargo_env meson_src_compile
}

src_install() {
	local DOCS=( Changelog.md Readme.md )
	cargo_env meson_src_install

	if use doc; then
		dodir /usr/share/doc/${PF}/html
		mv -- "${ED}"/usr/{doc/naev/{c,lua},share/doc/${PF}/html} || die
		rm -r -- "${ED}"/usr/doc || die
	fi

	rm -r -- "${ED}"/usr/share/doc/naev || die
}