dev-python/csv23: arm64 keyworded (bug #719700)
[gentoo.git] / net-misc / asterisk-core-sounds / asterisk-core-sounds-1.6.1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="7"
5
6 DESCRIPTION="Core sounds for asterisk"
7 HOMEPAGE="http://www.asterisk.org/"
8 MY_L10N="^en en_AU en_GB es fr it ja ru sv" # ^ is used to indicate to the loops below to NOT set this as an optional
9 CODECS="alaw g722 g729 +gsm siren7 siren14 sln16 ulaw wav"
10
11 SRC_URI=""
12 IUSE=""
13 for c in ${CODECS}; do
14         [[ "${c}" != +* ]] && IUSE+=" ${c}"
15 done
16 for l in ${MY_L10N}; do
17         [[ "${l}" != ^* ]] && IUSE+=" l10n_${l//_/-}" && SRC_URI+=" l10n_${l//_/-}? ("
18         for c in ${CODECS}; do
19                 [[ "${c}" != +* ]] &&
20                 SRC_URI+=" ${c#+}? ( http://downloads.asterisk.org/pub/telephony/sounds/releases/${PN}-${l#^}-${c#+}-${PV}.tar.gz )" ||
21                 SRC_URI+=" http://downloads.asterisk.org/pub/telephony/sounds/releases/${PN}-${l#^}-${c#+}-${PV}.tar.gz"
22         done
23         [[ "${l}" = ^* ]] || SRC_URI+=" )"
24 done
25
26 LICENSE="CC-BY-SA-3.0"
27 SLOT="0"
28 KEYWORDS="~amd64 ~ppc ~x86"
29
30 S="${WORKDIR}"
31
32 RDEPEND="!<net-misc/asterisk-extra-sounds-1.5.2"
33
34 src_unpack() {
35         local ar
36         local c
37
38         for ar in ${A}; do
39                 l="${ar#${PN}-}"
40                 l=${l%%-*}
41                 c="${ar#${PN}-*-}"
42                 c=${c%%-*}
43                 ebegin "Unpacking ${c} audio files for \"${l}\""
44                         [ -d "${WORKDIR}/${l}" ] || mkdir "${WORKDIR}/${l}" || die "Error creating unpack directory"
45                         tar xf "${DISTDIR}/${ar}" -C "${WORKDIR}/${l}" || die "Error unpacking ${ar}"
46                 eend $?
47         done
48 }
49
50 src_install() {
51         local l
52         local pf
53         for l in ${MY_L10N}; do
54                 if [[ "${l}" = ^* ]] || use l10n_${l//_/-}; then
55                         l="${l#^}"
56                         dodoc ${l}/${PN#asterisk-}-${l}.txt
57                         rm ${l}/${PN#asterisk-}-${l}.txt
58                         for pf in CHANGES CREDITS LICENSE; do
59                                 dodoc ${l}/${pf}-${PN%-sounds}-${l}-${PV}
60                                 rm ${l}/${pf}-${PN%-sounds}-${l}-${PV}
61                         done
62                 fi
63         done
64
65         diropts -m 0755 -o root -g root
66         insopts -m 0644 -o root -g root
67
68         ebegin "Installing audio files"
69                 dodir /var/lib/asterisk/sounds
70                 insinto /var/lib/asterisk/sounds
71                 doins -r .
72         eend $?
73 }