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