media-sound/mpg123: stable 1.25.2 for ppc, bug #623786
[gentoo.git] / media-sound / mpg123 / mpg123-1.25.6.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 inherit flag-o-matic toolchain-funcs libtool multilib-minimal
6
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"
10
11 LICENSE="GPL-2 LGPL-2.1"
12 SLOT="0"
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"
15
16 # No MULTILIB_USEDEP here since we only build libmpg123 for non native ABIs.
17 RDEPEND="app-eselect/eselect-mpg123
18         dev-libs/libltdl:0
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 )
25         abi_x86_32? (
26                 !<=app-emulation/emul-linux-x86-soundlibs-20130224-r9
27                 !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
28         )"
29 DEPEND="${RDEPEND}
30         sys-devel/libtool
31         virtual/pkgconfig"
32
33 DOCS=( AUTHORS ChangeLog NEWS NEWS.libmpg123 README )
34
35 pkg_setup() {
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
39 }
40
41 src_prepare() {
42         default
43         elibtoolize # for Darwin bundles
44 }
45
46 multilib_src_configure() {
47         local _audio=dummy
48         local _output=dummy
49         local _cpu=generic_fpu
50
51         if $(multilib_is_native_abi) ; then
52                 for flag in nas portaudio sdl oss jack alsa pulseaudio coreaudio; do
53                         if use ${flag}; then
54                                 _audio+=" ${flag/pulseaudio/pulse}"
55                                 _output=${flag/pulseaudio/pulse}
56                         fi
57                 done
58         fi
59
60         use altivec && _cpu=altivec
61
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
66                 _cpu=generic_fpu
67         elif use x86-macos ; then
68                 # ASM doesn't work quite as expected with the Darwin linker
69                 _cpu=generic_fpu
70         else
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
75         fi
76
77         local myconf=""
78         multilib_is_native_abi || myconf="${myconf} --disable-modules"
79
80         ECONF_SOURCE="${S}" econf \
81                 --with-optimization=0 \
82                 --with-audio="${_audio}" \
83                 --with-default-audio=${_output} \
84                 --with-cpu=${_cpu} \
85                 --enable-network \
86                 $(use_enable ipv6) \
87                 --enable-int-quality=$(usex int-quality) \
88                 ${myconf}
89
90         if ! $(multilib_is_native_abi) ; then
91                 sed -i -e 's:src doc:src/libmpg123:' Makefile || die
92         fi
93 }
94
95 multilib_src_install_all() {
96         einstalldocs
97         mv "${ED}"/usr/bin/mpg123{,-mpg123}
98         find "${ED}" -name '*.la' -exec sed -i -e "/^dependency_libs/s:=.*:='':" {} +
99 }
100
101 pkg_postinst() {
102         eselect mpg123 update ifunset
103 }
104
105 pkg_postrm() {
106         eselect mpg123 update ifunset
107 }