media-sound/qmmp: Removed old
[gentoo.git] / media-sound / mpg123 / mpg123-1.25.13.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
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 cpu_flags_ppc_altivec alsa 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 BDEPEND="
29         sys-devel/libtool
30         virtual/pkgconfig
31 "
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                 local flag
53                 for flag in nas portaudio sdl oss jack alsa pulseaudio coreaudio; do
54                         if use ${flag}; then
55                                 _audio+=" ${flag/pulseaudio/pulse}"
56                                 _output=${flag/pulseaudio/pulse}
57                         fi
58                 done
59         fi
60
61         use cpu_flags_ppc_altivec && _cpu=altivec
62
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
67                 _cpu=generic_fpu
68         elif use x86-macos ; then
69                 # ASM doesn't work quite as expected with the Darwin linker
70                 _cpu=generic_fpu
71         else
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
76         fi
77
78         local myconf=(
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         )
87         multilib_is_native_abi || myconf+=( --disable-modules )
88
89         ECONF_SOURCE="${S}" econf "${myconf[@]}"
90
91         if ! $(multilib_is_native_abi) ; then
92                 sed -i -e 's:src doc:src/libmpg123:' Makefile || die
93         fi
94 }
95
96 multilib_src_install_all() {
97         einstalldocs
98         mv "${ED}"/usr/bin/mpg123{,-mpg123}
99         find "${ED}" -type f -name '*.la' -delete || die
100 }
101
102 pkg_postinst() {
103         eselect mpg123 update ifunset
104 }
105
106 pkg_postrm() {
107         eselect mpg123 update ifunset
108 }