1 # Copyright 1999-2020 Gentoo Authors
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="https://www.mpg123.org/"
10 SRC_URI="https://www.mpg123.org/download/${P}.tar.bz2"
12 LICENSE="GPL-2 LGPL-2.1"
14 KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 sparc x86 ~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.
19 app-eselect/eselect-mpg123
21 alsa? ( media-libs/alsa-lib )
22 jack? ( virtual/jack )
23 nas? ( media-libs/nas )
24 portaudio? ( media-libs/portaudio )
25 pulseaudio? ( media-sound/pulseaudio )
26 sdl? ( media-libs/libsdl )"
31 DOCS=( AUTHORS ChangeLog NEWS NEWS.libmpg123 README )
34 # Build fails without -D_GNU_SOURCE like this:
35 # error: ‘struct hostent’ has no member named ‘h_addr’
36 append-cflags -D_GNU_SOURCE
41 elibtoolize # for Darwin bundles
44 multilib_src_configure() {
47 local _cpu=generic_fpu
49 if $(multilib_is_native_abi) ; then
50 for flag in nas portaudio sdl oss jack alsa pulseaudio coreaudio; do
52 _audio+=" ${flag/pulseaudio/pulse}"
53 _output=${flag/pulseaudio/pulse}
58 use altivec && _cpu=altivec
60 if [[ $(tc-arch) == amd64 || ${ARCH} == x64-* ]]; then
61 use cpu_flags_x86_sse && _cpu=x86-64
62 elif use x86 && gcc-specs-pie ; then
63 # Don't use any mmx, 3dnow, sse and 3dnowext #bug 164504
65 elif use x86-macos ; then
66 # ASM doesn't work quite as expected with the Darwin linker
69 use cpu_flags_x86_mmx && _cpu=mmx
70 use cpu_flags_x86_3dnow && _cpu=3dnow
71 use cpu_flags_x86_sse && _cpu=x86
72 use cpu_flags_x86_3dnowext && _cpu=x86
76 multilib_is_native_abi || myconf="${myconf} --disable-modules"
78 ECONF_SOURCE="${S}" econf \
79 --with-optimization=0 \
80 --with-audio="${_audio}" \
81 --with-default-audio=${_output} \
85 --enable-int-quality=$(usex int-quality) \
88 if ! $(multilib_is_native_abi) ; then
89 sed -i -e 's:src doc:src/libmpg123:' Makefile || die
93 multilib_src_install_all() {
95 mv "${ED}"/usr/bin/mpg123{,-mpg123}
96 find "${ED}" -name '*.la' -delete || die
100 eselect mpg123 update ifunset
104 eselect mpg123 update ifunset