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

EAPI=8

PYTHON_COMPAT=( python3_{10..12} )
inherit cmake python-single-r1 xdg

DESCRIPTION="Atari ST emulator"
HOMEPAGE="https://hatari.tuxfamily.org/"
SRC_URI="https://download.tuxfamily.org/hatari/${PV}/${P}.tar.bz2"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="X capsimage capstone gui png portmidi readline udev zlib"
REQUIRED_USE="
	${PYTHON_REQUIRED_USE}
	png? ( zlib )
"

COMMON_DEPEND="
	media-libs/libsdl2[X?,joystick,sound,video]
	X? ( x11-libs/libX11 )
	capsimage? ( dev-libs/spsdeclib )
	capstone? ( dev-libs/capstone:= )
	png? ( media-libs/libpng:= )
	portmidi? ( media-libs/portmidi )
	readline? ( sys-libs/readline:= )
	udev? ( virtual/udev )
	zlib? ( sys-libs/zlib:= )
"
RDEPEND="
	${PYTHON_DEPS}
	${COMMON_DEPEND}
	gui? (
		$(python_gen_cond_dep 'dev-python/pygobject:3[${PYTHON_USEDEP}]')
		x11-libs/gtk+:3[introspection]
	)
	games-emulation/emutos
"
DEPEND="
	${COMMON_DEPEND}
	X? ( x11-base/xorg-proto )
"
BDEPEND="${PYTHON_DEPS}"

PATCHES=(
	"${FILESDIR}"/${PN}-2.3.1-caps5-include-path.patch
)

DOCS=(
	readme.txt
	doc/{bugs,changelog,scsi-driver,thanks,video-recording}.txt
)

src_prepare() {
	cmake_src_prepare

	sed -i "s/\.1\.gz\b/.1/;T;s/gzip[^\$]*/cat /" {*/,}*/CMakeLists.txt || die
	sed -i "s:doc/${PN}:doc/${PF}/html:" python-ui/uihelpers.py || die
	sed -e "s/python3/${EPYTHON}/" \
		-e 's/mkdosfs/mkfs.fat/' \
		-i tools/atari-hd-image.sh || die

	# use emutos package rather than bundled ROM
	rm src/tos.img || die
	cat <<-EOF > hatari.cfg || die
		[ROM]
		szTosImageFileName = ${EPREFIX}/usr/share/emutos/etos1024k.img
	EOF
}

src_configure() {
	local mycmakeargs=(
		-DBUILD_SHARED_LIBS=OFF
		-DDOCDIR="${EPREFIX}"/usr/share/doc/${PF}/html
		-DETCDIR="${EPREFIX}"/etc
		$(cmake_use_find_package X X11)
		$(cmake_use_find_package capsimage CapsImage)
		$(cmake_use_find_package capstone Capstone)
		$(cmake_use_find_package png PNG)
		$(cmake_use_find_package portmidi PortMidi)
		$(cmake_use_find_package readline Readline)
		$(cmake_use_find_package udev Udev)
		$(cmake_use_find_package zlib ZLIB)
		$(usev !gui -DPYTHON_EXECUTABLE=false) # only disables python-ui/
	)

	cmake_src_configure
}

src_install() {
	cmake_src_install

	insinto /etc
	doins hatari.cfg

	mv -- "${ED}"/usr/share/doc/${PF}/{html/*.txt,} || die

	python_fix_shebang "${ED}"/usr/bin
	use gui && python_fix_shebang "${ED}"/usr/share/${PN}/${PN}ui
}