1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit flag-o-matic toolchain-funcs libtool multilib-minimal
8 DESCRIPTION="a realtime MPEG 1.0/2.0/2.5 audio player for layers 1, 2 and 3"
9 HOMEPAGE="http://www.mpg123.org/"
10 SRC_URI="http://www.mpg123.org/download/${P}.tar.bz2"
12 LICENSE="GPL-2 LGPL-2.1"
14 KEYWORDS="alpha amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
15 IUSE="cpu_flags_x86_3dnow cpu_flags_x86_3dnowext alsa altivec coreaudio int-quality ipv6 jack cpu_flags_x86_mmx nas oss portaudio pulseaudio sdl cpu_flags_x86_sse"
17 # No MULTILIB_USEDEP here since we only build libmpg123 for non native ABIs.
18 RDEPEND="app-eselect/eselect-mpg123
19 || ( dev-libs/libltdl:0 <sys-devel/libtool-2.4.3-r2:2 )
20 alsa? ( media-libs/alsa-lib )
21 jack? ( media-sound/jack-audio-connection-kit )
22 nas? ( media-libs/nas )
23 portaudio? ( media-libs/portaudio )
24 pulseaudio? ( media-sound/pulseaudio )
25 sdl? ( media-libs/libsdl )
27 !<=app-emulation/emul-linux-x86-soundlibs-20130224-r9
28 !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
34 DOCS=( AUTHORS ChangeLog NEWS NEWS.libmpg123 README )
37 # Build fails without -D_GNU_SOURCE like this:
38 # error: ‘struct hostent’ has no member named ‘h_addr’
39 append-cflags -D_GNU_SOURCE
44 elibtoolize # for Darwin bundles
47 multilib_src_configure() {
50 local _cpu=generic_fpu
52 if $(multilib_is_native_abi) ; then
53 for flag in nas portaudio sdl oss jack alsa pulseaudio coreaudio; do
55 _audio+=" ${flag/pulseaudio/pulse}"
56 _output=${flag/pulseaudio/pulse}
61 use altivec && _cpu=altivec
63 if [[ $(tc-arch) == amd64 || ${ARCH} == x64-* ]]; then
64 use cpu_flags_x86_sse && _cpu=x86-64
65 elif use x86 && gcc-specs-pie ; then
66 # Don't use any mmx, 3dnow, sse and 3dnowext #bug 164504
68 elif use x86-macos ; then
69 # ASM doesn't work quite as expected with the Darwin linker
72 use cpu_flags_x86_mmx && _cpu=mmx
73 use cpu_flags_x86_3dnow && _cpu=3dnow
74 use cpu_flags_x86_sse && _cpu=x86
75 use cpu_flags_x86_3dnowext && _cpu=x86
79 multilib_is_native_abi || myconf="${myconf} --disable-modules"
81 ECONF_SOURCE="${S}" econf \
82 --with-optimization=0 \
83 --with-audio="${_audio}" \
84 --with-default-audio=${_output} \
88 --enable-int-quality=$(usex int-quality) \
91 if ! $(multilib_is_native_abi) ; then
92 sed -i -e 's:src doc:src/libmpg123:' Makefile || die
96 multilib_src_install_all() {
98 mv "${ED}"/usr/bin/mpg123{,-mpg123}
99 find "${ED}" -name '*.la' -exec sed -i -e "/^dependency_libs/s:=.*:='':" {} +
103 eselect mpg123 update ifunset
107 eselect mpg123 update ifunset