stardict-tools.SlackBuild 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #!/bin/bash
  2. # Slackware build script for stardict-tools
  3. # Written by Cezary M. Kruk (c.kruk@bigfoot.com)
  4. cd $(dirname $0) ; CWD=$(pwd)
  5. PRGNAM=stardict-tools
  6. VERSION=${VERSION:-3.0.6.2}
  7. BUILD=${BUILD:-1}
  8. TAG=${TAG:-_SBo}
  9. PKGTYPE=${PKGTYPE:-tgz}
  10. if [ -z "$ARCH" ]; then
  11. case "$( uname -m )" in
  12. i?86) ARCH=i586 ;;
  13. arm*) ARCH=arm ;;
  14. *) ARCH=$( uname -m ) ;;
  15. esac
  16. fi
  17. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  18. # the name of the created package would be, and then exit. This information
  19. # could be useful to other scripts.
  20. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  21. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  22. exit 0
  23. fi
  24. TMP=${TMP:-/tmp/SBo}
  25. PKG=$TMP/package-$PRGNAM
  26. OUTPUT=${OUTPUT:-/tmp}
  27. if [ "$ARCH" = "i586" ]; then
  28. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  29. LIBDIRSUFFIX=""
  30. elif [ "$ARCH" = "i686" ]; then
  31. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  32. LIBDIRSUFFIX=""
  33. elif [ "$ARCH" = "x86_64" ]; then
  34. SLKCFLAGS="-O2 -fPIC"
  35. LIBDIRSUFFIX="64"
  36. else
  37. SLKCFLAGS="-O2"
  38. LIBDIRSUFFIX=""
  39. fi
  40. set -e
  41. rm -rf $PKG
  42. mkdir -p $TMP $PKG $OUTPUT
  43. cd $TMP
  44. rm -rf stardict-$VERSION
  45. tar -xvf $CWD/stardict-$VERSION-github-2.tar.?z*
  46. cd stardict-$VERSION
  47. chown -R root:root .
  48. find -L . \
  49. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  50. -o -perm 511 \) -exec chmod 755 {} \; -o \
  51. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  52. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  53. sed -i 's/, enchant/, enchant-2/' dict/configure.ac
  54. sed -i '/AM_GCONF_SOURCE_2/d' dict/configure.ac
  55. sed -i '/GNOME_DOC_INIT/d' dict/configure.ac
  56. sed -i '/gnome-doc-utils.make/d' dict/help/Makefile.am
  57. ./autogen.sh
  58. ( cd dict ; ./autogen.sh )
  59. CFLAGS="$SLKCFLAGS" \
  60. CXXFLAGS="$SLKCFLAGS -std=c++11" \
  61. ./configure \
  62. --prefix=/usr \
  63. --libdir=/usr/lib${LIBDIRSUFFIX} \
  64. --sysconfdir=/etc \
  65. --localstatedir=/var \
  66. --mandir=/usr/man \
  67. --docdir=/usr/doc/$PRGNAM-$VERSION \
  68. --disable-gucharmap \
  69. --disable-festival \
  70. --disable-flite \
  71. --disable-espeak \
  72. --disable-gnome-support \
  73. --disable-schemas-install \
  74. --disable-updateinfo \
  75. --disable-static \
  76. --build=$ARCH-slackware-linux
  77. sed -e 's/ -shared / -Wl,-O1,--as-needed\0/g' -i {dict,lib,tools}/libtool
  78. make
  79. mkdir -p $PKG/usr/bin
  80. cd tools/src
  81. cp -a \
  82. 21shiji dictbuilder exc2i2e kingsoft soothill wikipedia \
  83. 21tech dictd2dic fest2dict mova stardict-editor wikipediaImage \
  84. KangXi directory2dic frgb2utf myspell2dic stardict2txt wordnet \
  85. Unihan directory2treedic gmx2utf olddic2newdic wquick2dic \
  86. babylon downloadwiki i2e2dict ooo2dict wubi \
  87. jdictionary oxford2dic tabfile xiaoxuetang-ja \
  88. buddhist duden jpgb2utf powerword tabfile2sql xmlinout \
  89. cedict ec50 kanjidic2 pydict2dic ydp2dict \
  90. degb2utf edict kdic rucn treedict2dir \
  91. $PKG/usr/bin
  92. cd -
  93. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  94. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  95. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  96. cp -a AUTHORS COPYING ChangeLog INSTALL README $PKG/usr/doc/$PRGNAM-$VERSION
  97. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  98. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/examples
  99. cd tools/src
  100. cp -a Po2Tab.zip example.ifo example_treedict.tar.bz2 \
  101. $PKG/usr/doc/$PRGNAM-$VERSION/examples
  102. cd -
  103. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/scripts
  104. cd tools/src
  105. cp -a \
  106. KangXiZiDian-djvu2tiff.py hanzim2dict.py makevietdict.py ooo.sh \
  107. i2e.sh mkguangyunst.py parse-oxford.perl \
  108. exc.sh jm2stardict.py myspell.sh stmerge.py \
  109. extractKangXi.py lingea-trd-decoder.py ncce2stardict.pl uyghur2dict.py \
  110. $PKG/usr/doc/$PRGNAM-$VERSION/scripts
  111. cd -
  112. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/contrib
  113. cp $CWD/sd $CWD/README.sd $PKG/usr/doc/$PRGNAM-$VERSION/contrib
  114. cp $CWD/README.StarDict $PKG/usr/doc/$PRGNAM-$VERSION
  115. mkdir -p $PKG/install
  116. cat $CWD/slack-desc > $PKG/install/slack-desc
  117. cd $PKG
  118. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE