1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 inherit flag-o-matic toolchain-funcs libtool multilib-minimal
7 DESCRIPTION="a realtime MPEG 1.0/2.0/2.5 audio player for layers 1, 2 and 3"
8 HOMEPAGE="https://www.mpg123.org/"
9 SRC_URI="https://www.mpg123.org/download/${P}.tar.bz2"
11 LICENSE="GPL-2 LGPL-2.1"
13 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~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"
14 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"
16 # No MULTILIB_USEDEP here since we only build libmpg123 for non native ABIs.
17 RDEPEND="app-eselect/eselect-mpg123
19 alsa? ( media-libs/alsa-lib )
20 jack? ( virtual/jack )
21 nas? ( media-libs/nas )
22 portaudio? ( media-libs/portaudio )
23 pulseaudio? ( media-sound/pulseaudio )
24 sdl? ( media-libs/libsdl )
26 !<=app-emulation/emul-linux-x86-soundlibs-20130224-r9
27 !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
33 DOCS=( AUTHORS ChangeLog NEWS NEWS.libmpg123 README )
36 # Build fails without -D_GNU_SOURCE like this:
37 # error: ‘struct hostent’ has no member named ‘h_addr’
38 append-cflags -D_GNU_SOURCE
43 elibtoolize # for Darwin bundles
46 multilib_src_configure() {
49 local _cpu=generic_fpu
51 if $(multilib_is_native_abi) ; then
52 for flag in nas portaudio sdl oss jack alsa pulseaudio coreaudio; do
54 _audio+=" ${flag/pulseaudio/pulse}"
55 _output=${flag/pulseaudio/pulse}
60 use altivec && _cpu=altivec
62 if [[ $(tc-arch) == amd64 || ${ARCH} == x64-* ]]; then
63 use cpu_flags_x86_sse && _cpu=x86-64
64 elif use x86 && gcc-specs-pie ; then
65 # Don't use any mmx, 3dnow, sse and 3dnowext #bug 164504
67 elif use x86-macos ; then
68 # ASM doesn't work quite as expected with the Darwin linker
71 use cpu_flags_x86_mmx && _cpu=mmx
72 use cpu_flags_x86_3dnow && _cpu=3dnow
73 use cpu_flags_x86_sse && _cpu=x86
74 use cpu_flags_x86_3dnowext && _cpu=x86
78 multilib_is_native_abi || myconf="${myconf} --disable-modules"
80 ECONF_SOURCE="${S}" econf \
81 --with-optimization=0 \
82 --with-audio="${_audio}" \
83 --with-default-audio=${_output} \
87 --enable-int-quality=$(usex int-quality) \
90 if ! $(multilib_is_native_abi) ; then
91 sed -i -e 's:src doc:src/libmpg123:' Makefile || die
95 multilib_src_install_all() {
97 mv "${ED}"/usr/bin/mpg123{,-mpg123}
98 find "${ED}" -name '*.la' -exec sed -i -e "/^dependency_libs/s:=.*:='':" {} +
102 eselect mpg123 update ifunset
106 eselect mpg123 update ifunset