hunspell-es.SlackBuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/bin/bash
  2. # Slackware build script for hunspell-es
  3. # Copyright 2017 Dhaby Xiloj <slack.dhabyx@gmail.com>
  4. # Copyright 2014-2017 Pablo Santamaria (pablosantamaria@gmail.com)
  5. # All rights reserved.
  6. #
  7. # Redistribution and use of this script, with or without modification, is
  8. # permitted provided that the following conditions are met:
  9. #
  10. # 1. Redistributions of this script must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  14. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  16. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  21. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  22. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. # Based on the Arch PKGBUILD
  24. cd $(dirname $0) ; CWD=$(pwd)
  25. PRGNAM=hunspell-es
  26. VERSION=${VERSION:-2.2}
  27. BUILD=${BUILD:-1}
  28. TAG=${TAG:-_SBo}
  29. PKGTYPE=${PKGTYPE:-tgz}
  30. ARCH="noarch"
  31. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  32. # the name of the created package would be, and then exit. This information
  33. # could be useful to other scripts.
  34. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  35. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  36. exit 0
  37. fi
  38. TMP=${TMP:-/tmp/SBo}
  39. PKG=$TMP/package-$PRGNAM
  40. OUTPUT=${OUTPUT:-/tmp}
  41. # Getting all localizations available
  42. LOCALIZATIONS=*.oxt
  43. LOCALIZATIONS=$(echo $LOCALIZATIONS | sed -e 's/es_ANY.oxt//g' | sed -e 's/.oxt//g')
  44. set -e
  45. rm -rf $PKG
  46. mkdir -p $TMP $PKG $OUTPUT
  47. cd $TMP
  48. rm -rf $PRGNAM-$VERSION
  49. mkdir -p $PRGNAM-$VERSION
  50. cd $PRGNAM-$VERSION
  51. for file in $CWD/*.oxt ; do
  52. LANG=en_US.utf8 bsdtar -xf $file
  53. done
  54. # Putting everything in proper place
  55. install -dm755 $PKG/usr/share/hunspell
  56. install -m644 es_*.dic es_*.aff $PKG/usr/share/hunspell
  57. install -Dm644 hyph_es_ANY.dic $PKG/usr/share/hyphen/hyph_es_ANY.dic
  58. install -dm755 $PKG/usr/share/mythes
  59. install -m644 th_es_ES_v2.* $PKG/usr/share/mythes
  60. # Symlinks for ditcs
  61. install -dm755 $PKG/usr/share/myspell/dicts
  62. pushd $PKG/usr/share/myspell/dicts
  63. for file in $PKG/usr/share/hunspell/*; do
  64. ln -sv ../../hunspell/$(basename $file) .
  65. done
  66. popd
  67. # Hyphenation symlinks
  68. pushd $PKG/usr/share/hyphen/
  69. echo $LOCALIZATIONS
  70. for lang in $LOCALIZATIONS; do
  71. ln -sv hyph_es_ANY.dic hyph_${lang}.dic
  72. done
  73. popd
  74. # Thesaurus symlinks
  75. pushd $PKG/usr/share/mythes/
  76. for lang in $(echo $LOCALIZATIONS | sed -e 's/es_ES//g'); do
  77. ln -sv th_es_ES_v2.idx th_${lang}_v2.idx
  78. ln -sv th_es_ES_v2.dat th_${lang}_v2.dat
  79. done
  80. popd
  81. # myspell symlinks
  82. install -dm755 $PKG/usr/share/myspell/dicts
  83. pushd $PKG/usr/share/myspell/dicts
  84. for file in $PKG/usr/share/hyphen/*; do
  85. ln -sv ../../hyphen/$(basename $file) .
  86. done
  87. for file in $PKG/usr/share/mythes/*; do
  88. ln -sv ../../mythes/$(basename $file) .
  89. done
  90. popd
  91. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  92. install -m644 README* COPYING* $PKG/usr/doc/$PRGNAM-$VERSION
  93. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  94. mkdir -p $PKG/install
  95. cat $CWD/slack-desc > $PKG/install/slack-desc
  96. cd $PKG
  97. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE