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

EAPI=8

inherit multilib

MY_P="libopenmpt-${PV}+release.autotools"
DESCRIPTION="libopenmpt-based command line player for tracked music files (modules)"
HOMEPAGE="https://lib.openmpt.org/libopenmpt/"
SRC_URI="https://lib.openmpt.org/files/libopenmpt/src/${MY_P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm ~riscv ~x86"
IUSE="flac portaudio pulseaudio sdl sndfile"

RDEPEND="
	~media-libs/libopenmpt-${PV}
	flac? ( media-libs/flac )
	pulseaudio? ( media-sound/pulseaudio )
	sdl? ( >=media-libs/libsdl2-2.0.4 )
	sndfile? ( media-libs/libsndfile )
"

DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"

S="${WORKDIR}/${MY_P}"

src_prepare() {
	default

	# Normally libopenmpt is built alongside openmpt123. Avoid the
	# internal dependency and link it externally.
	rm -r libopenmpt/ || die
	sed -i \
		-e "s:libopenmpt/libopenmpt\.pc::g" \
		configure || die
	sed -i \
		-e "/_${PN}_DEPENDENCIES/s:libopenmpt\.la::g" \
		-e "/_${PN}_LDADD/s:libopenmpt\.la:-lopenmpt:g" \
		Makefile.in || die
}

src_configure() {
	# A lot of these optional dependencies relate to libopenmpt, which
	# we package separately, so we disable them here.
	econf \
		--disable-static \
		--enable-openmpt123 \
		--disable-examples \
		--disable-tests \
		--disable-doxygen-doc \
		--without-zlib \
		--without-mpg123 \
		--without-ogg \
		--without-vorbis \
		--without-vorbisfile \
		$(use_with pulseaudio) \
		$(use_with portaudio) \
		--without-portaudiocpp \
		$(use_with sdl sdl2) \
		$(use_with sndfile) \
		$(use_with flac)
}

src_compile() {
	emake "bin/${PN}$(get_exeext)"
}

src_install() {
	dobin "bin/${PN}$(get_exeext)"
}