asterisk-core-sounds-1.4.21-r1.ebuild 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Copyright 1999-2013 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="4"
  4. DESCRIPTION="Core sounds for asterisk"
  5. HOMEPAGE="http://www.asterisk.org/"
  6. LINGUAS="^en fr es ru" # ^ is used to indicate to the loops below to NOT set this as an optional
  7. CODECS="alaw g722 g729 +gsm siren7 siren14 sln16 ulaw wav"
  8. SRC_URI=""
  9. IUSE=""
  10. for c in ${CODECS}; do
  11. [[ "${c}" != +* ]] && IUSE+=" ${c}"
  12. done
  13. for l in ${LINGUAS}; do
  14. [[ "${l}" != ^* ]] && IUSE+=" linguas_${l}" && SRC_URI+=" linguas_${l}? ("
  15. for c in ${CODECS}; do
  16. [[ "${c}" != +* ]] &&
  17. SRC_URI+=" ${c#+}? ( http://downloads.asterisk.org/pub/telephony/sounds/releases/${PN}-${l#^}-${c#+}-${PV}.tar.gz )" ||
  18. SRC_URI+=" http://downloads.asterisk.org/pub/telephony/sounds/releases/${PN}-${l#^}-${c#+}-${PV}.tar.gz"
  19. done
  20. [[ "${l}" = ^* ]] || SRC_URI+=" )"
  21. done
  22. LICENSE="CC-BY-SA-3.0"
  23. SLOT="0"
  24. KEYWORDS="amd64 x86"
  25. DEPEND=">=net-misc/asterisk-1.4"
  26. S="${WORKDIR}"
  27. src_unpack() {
  28. local ar
  29. for ar in ${A}; do
  30. l="${ar#${PN}-}"
  31. l=${l%%-*}
  32. c="${ar#${PN}-*-}"
  33. c=${c%%-*}
  34. ebegin "Unpacking ${c} audio files for \"${l}\""
  35. [ -d "${WORKDIR}/${l}" ] || mkdir "${WORKDIR}/${l}" || die "Error creating unpack directory"
  36. tar xf "${DISTDIR}/${ar}" -C "${WORKDIR}/${l}" || die "Error unpacking ${ar}"
  37. eend $?
  38. done
  39. }
  40. src_install() {
  41. for l in ${LINGUAS}; do
  42. if [[ "${l}" = ^* ]] || use linguas_${l}; then
  43. l="${l#^}"
  44. ebegin "Installing documentation for \"${l}\""
  45. dodoc ${l}/CHANGES-${PN%-sounds}-${l}-${PV} ${l}/${PN#asterisk-}-${l}.txt
  46. rm ${l}/CHANGES-${PN%-sounds}-${l}-${PV} ${l}/${PN#asterisk-}-${l}.txt
  47. eend $?
  48. fi
  49. done
  50. diropts -m 0770 -o asterisk -g asterisk
  51. insopts -m 0660 -o asterisk -g asterisk
  52. ebegin "Installing audio files"
  53. dodir /var/lib/asterisk/sounds
  54. insinto /var/lib/asterisk/sounds
  55. doins -r .
  56. eend $?
  57. }