myspell-r2.eclass 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # @ECLASS: aspell-dict.eclass
  4. # @MAINTAINER:
  5. # maintainer-needed@gentoo.org
  6. # @AUTHOR:
  7. # Tomáš Chvátal <scarabeus@gentoo.org>
  8. # @BLURB: An eclass to ease the construction of ebuilds for myspell dicts
  9. # @DESCRIPTION:
  10. EXPORT_FUNCTIONS src_unpack src_install
  11. # @ECLASS-VARIABLE: MYSPELL_DICT
  12. # @DEFAULT_UNSET
  13. # @DESCRIPTION:
  14. # Array variable containing list of all dictionary files.
  15. # MYSPELL_DICT=( "file.dic" "dir/file2.aff" )
  16. # @ECLASS-VARIABLE: MYSPELL_HYPH
  17. # @DESCRIPTION:
  18. # Array variable containing list of all hyphenation files.
  19. # MYSPELL_HYPH=( "file.dic" "dir/file2.dic" )
  20. # @ECLASS-VARIABLE: MYSPELL_THES
  21. # @DESCRIPTION:
  22. # Array variable containing list of all thesarus files.
  23. # MYSPELL_THES=( "file.dat" "dir/file2.idx" )
  24. # Basically no extra deps needed.
  25. # Unzip is required for .oxt libreoffice extensions
  26. # which are just fancy zip files.
  27. DEPEND="app-arch/unzip"
  28. RDEPEND=""
  29. # by default this stuff does not have any folder in the pack
  30. S="${WORKDIR}"
  31. # @FUNCTION: myspell-r2_src_unpack
  32. # @DESCRIPTION:
  33. # Unpack all variants of weird stuff.
  34. # In our case .oxt packs.
  35. myspell-r2_src_unpack() {
  36. debug-print-function ${FUNCNAME} "$@"
  37. local f
  38. for f in ${A}; do
  39. case ${f} in
  40. *.oxt)
  41. echo ">>> Unpacking "${DISTDIR}/${f}" to ${PWD}"
  42. unzip -qoj ${DISTDIR}/${f}
  43. assert "failed unpacking ${DISTDIR}/${f}"
  44. ;;
  45. *) unpack ${f} ;;
  46. esac
  47. done
  48. }
  49. # @FUNCTION: myspell-r2_src_install
  50. # @DESCRIPTION:
  51. # Install the dictionaries to the right places.
  52. myspell-r2_src_install() {
  53. debug-print-function ${FUNCNAME} "$@"
  54. local x target
  55. # Following the debian directory layout here.
  56. # DICT: /usr/share/hunspell
  57. # THES: /usr/share/mythes
  58. # HYPH: /usr/share/hyphen
  59. # We just need to copy the required files to proper places.
  60. # TODO: backcompat dosym remove when all dictionaries and libreoffice
  61. # ebuilds in tree use only the new paths
  62. # Very old installs have hunspell to be symlink to myspell.
  63. # This results in fcked up install/symlink stuff.
  64. if [[ -L "${EPREFIX}/usr/share/hunspell" ]] ; then
  65. eerror "\"${EPREFIX}/usr/share/hunspell\" is a symlink."
  66. eerror "Please remove it so it is created properly as folder"
  67. die "\"${EPREFIX}/usr/share/hunspell\" is a symlink."
  68. fi
  69. insinto /usr/share/hunspell
  70. for x in "${MYSPELL_DICT[@]}"; do
  71. target="${x##*/}"
  72. newins "${x}" "${target}" || die
  73. dosym /usr/share/hunspell/"${target}" /usr/share/myspell/"${target}" || die
  74. done
  75. insinto /usr/share/mythes
  76. for x in "${MYSPELL_THES[@]}"; do
  77. target="${x##*/}"
  78. newins "${x}" "${target}" || die
  79. dosym /usr/share/mythes/"${target}" /usr/share/myspell/"${target}" || die
  80. done
  81. insinto /usr/share/hyphen
  82. for x in "${MYSPELL_HYPH[@]}"; do
  83. target="${x##*/}"
  84. newins "${x}" "${target}" || die
  85. dosym /usr/share/hyphen/"${target}" /usr/share/myspell/"${target}" || die
  86. done
  87. # Remove licenses as they suffix them with .txt too
  88. rm -rf COPYING*
  89. rm -rf LICENSE*
  90. rm -rf LICENCE*
  91. rm -rf license*
  92. rm -rf licence*
  93. # Readme and so on
  94. for x in *.txt README*; do
  95. if [[ -f ${x} ]]; then
  96. dodoc ${x} || die
  97. fi
  98. done
  99. }