summaryrefslogtreecommitdiff
path: root/app-emulation/uxn/uxn-0_p20240304.ebuild
blob: ef6e9fc2dafeb54805fe57ec06617c787a4ec4f7 (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
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit toolchain-funcs

DESCRIPTION="An assembler and emulator for the Uxn stack-machine, written in ANSI C"
HOMEPAGE="https://wiki.xxiivv.com/site/uxn.html
	https://git.sr.ht/~rabbits/uxn/"

if [[ "${PV}" == *9999* ]] ; then
	inherit git-r3

	EGIT_REPO_URI="https://git.sr.ht/~rabbits/${PN}"
elif [[ "${PV}" == *_p20240304 ]] ; then
	COMMIT=e7c25fad05850f0e577fc83a140405ca6ccd93c2
	SRC_URI="https://git.sr.ht/~rabbits/${PN}/archive/${COMMIT}.tar.gz
		-> ${P}.tar.gz"
	S="${WORKDIR}/uxn-${COMMIT}"

	KEYWORDS="~amd64 ~x86"
else
	die "wrong package version (PV), please update the ebuild, given: ${PV}"
fi

LICENSE="MIT"
SLOT="0"

RDEPEND="
	media-libs/libsdl2:=
"
DEPEND="
	${RDEPEND}
"

PATCHES=(
	"${FILESDIR}/uxn-0_p20230609-build.sh.patch"
)

src_compile() {
	CC="$(tc-getCC)" CFLAGS="${CFLAGS} ${LDFLAGS}"	\
	  ./build.sh --no-run							\
		|| die "building with \"build.sh\" failed"

	# Fails to assemble via following loop.
	# Possibly not mean to be assembled by hand.
	rm -rf ./projects/library ./projects/software/{asma,launcher}.tal || die

	local tal_file
	local tal_file_base

	while read -r tal_file ; do
		tal_file_base="$(basename "${tal_file}" .tal)"

		ebegin "Assembling ROM ${tal_file_base}"
		bin/uxnasm "${tal_file}" "$(dirname "${tal_file}")/${tal_file_base}.rom"
		eend ${?} || die "failed to assemble ${tal_file}"
	done \
		< <(find projects -type f -name "*.tal")
}

src_install() {
	insinto /usr/bin
	doins bin/uxn*
	fperms 0755 /usr/bin/uxn*

	insinto /usr/share/uxn
	doins -r projects

	einstalldocs
}