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

EAPI=7
inherit autotools multilib-minimal

DESCRIPTION="LAME Ain't an MP3 Encoder"
HOMEPAGE="http://lame.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x64-solaris"
IUSE="debug cpu_flags_x86_mmx +frontend mp3rtp sndfile static-libs"

# These deps are without MULTILIB_USEDEP and are correct since we only build
# libmp3lame for multilib and these deps apply to the lame frontend executable.
RDEPEND="
	frontend? (
		>=sys-libs/ncurses-5.7-r7:0=
		sndfile? ( >=media-libs/libsndfile-1.0.2 )
	)
"
DEPEND="${RDEPEND}"
BDEPEND="
	sys-devel/gettext
	virtual/pkgconfig
	cpu_flags_x86_mmx? ( dev-lang/nasm )
"

PATCHES=(
	"${FILESDIR}"/${PN}-3.96-ccc.patch
	"${FILESDIR}"/${PN}-3.98-gtk-path.patch
	"${FILESDIR}"/${PN}-3.99.5-tinfo.patch
	"${FILESDIR}"/${PN}-3.99.5-msse.patch
	"${FILESDIR}"/${PN}-3.100-symbols.patch #662752
	"${FILESDIR}"/${PN}-3.100-pkgconfig.patch #735168
)

src_prepare() {
	default

	mkdir libmp3lame/i386/.libs || die #workaround parallel build with nasm

	sed -i -e '/define sp/s/+/ + /g' libmp3lame/i386/nasm.h || die

	use cpu_flags_x86_mmx || sed -i -e '/AC_PATH_PROG/s:nasm:dIsAbLe&:' configure.in #361879

	mv configure.{in,ac} || die
	AT_M4DIR=. eautoreconf
}

multilib_src_configure() {
	# Only build the frontend for the default ABI.
	local myconf=(
		--disable-mp3x
		--enable-dynamic-frontends
		$(multilib_native_use_enable frontend)
		$(multilib_native_use_enable mp3rtp)
		$(multilib_native_usex sndfile '--with-fileio=sndfile' '')
		$(use_enable debug debug norm)
		$(use_enable static-libs static)
		$(usex cpu_flags_x86_mmx '--enable-nasm' '') #361879
	)

	ECONF_SOURCE="${S}" econf "${myconf[@]}"
}

multilib_src_install() {
	emake \
		DESTDIR="${D}" \
		pkghtmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
		install
}

multilib_src_install_all() {
	dodoc API ChangeLog HACKING README STYLEGUIDE TODO USAGE
	docinto html
	dodoc misc/lameGUI.html Dll/LameDLLInterface.htm

	find "${ED}" -name '*.la' -type f -delete || die
}