svox.SlackBuild 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #!/bin/bash
  2. # Slackware build script for svox
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # This is heavily based on Debian's packaging, see:
  6. # https://packages.debian.org/source/sid/svox
  7. # It's in the Debian non-free repo on a technicality: svox is free
  8. # software released under the Apache-2.0 license, but the sources
  9. # for the compiled voices (/usr/share/pico/lang/*.bin) are missing,
  10. # so it doesn't quite comply with its own license.
  11. # Notes to self:
  12. # - The _8 in the version number is the Debian build number, keep it
  13. # in sync with future Debian updates.
  14. # - "Upstream" here is Debian, not Android. Debian has svox's homepage
  15. # listed as "www.android.com", it seems more useful to set HOMEPAGE
  16. # to the Debian page for svox.
  17. # 20210802 bkw: BUILD=2
  18. # - update pico2audio script to support multiple words without quotes.
  19. # - add man page for pico2audio.
  20. # - update pico2wave man page.
  21. # - add svox man page symlink, in case someone remembers the name of the
  22. # package but not the name of the binary.
  23. cd $(dirname $0) ; CWD=$(pwd)
  24. PRGNAM=svox
  25. VERSION=${VERSION:-1.0+git20130326_8}
  26. BUILD=${BUILD:-2}
  27. TAG=${TAG:-_SBo}
  28. PKGTYPE=${PKGTYPE:-tgz}
  29. if [ -z "$ARCH" ]; then
  30. case "$( uname -m )" in
  31. i?86) ARCH=i586 ;;
  32. arm*) ARCH=arm ;;
  33. *) ARCH=$( uname -m ) ;;
  34. esac
  35. fi
  36. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  37. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  38. exit 0
  39. fi
  40. TMP=${TMP:-/tmp/SBo}
  41. PKG=$TMP/package-$PRGNAM
  42. OUTPUT=${OUTPUT:-/tmp}
  43. if [ "$ARCH" = "i586" ]; then
  44. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  45. LIBDIRSUFFIX=""
  46. elif [ "$ARCH" = "i686" ]; then
  47. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "x86_64" ]; then
  50. SLKCFLAGS="-O2 -fPIC"
  51. LIBDIRSUFFIX="64"
  52. else
  53. SLKCFLAGS="-O2"
  54. LIBDIRSUFFIX=""
  55. fi
  56. set -e
  57. # Split up and recombine Debian's version number, we can't have a - in
  58. # a Slackware version number. And using the -8 for BUILD is a bad idea
  59. # (thanks for pointing that out, idlemoor).
  60. DEBVER="$( echo $VERSION | cut -d_ -f1 )"
  61. DEBBLD="$( echo $VERSION | cut -d_ -f2 )"
  62. PRGVER=${PRGNAM}_$DEBVER
  63. rm -rf $PKG
  64. mkdir -p $TMP $PKG $OUTPUT
  65. cd $TMP
  66. rm -rf $PRGNAM-$DEBVER
  67. tar xvf $CWD/$PRGVER.orig.tar.gz
  68. cd $PRGNAM-$DEBVER
  69. tar xvf $CWD/$PRGVER-$DEBBLD.debian.tar.xz
  70. chown -R root:root .
  71. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  72. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  73. # Apply all of Debian's patches. Many thanks to the Debian maintainers
  74. # for all the work that went into these patches.
  75. for i in $( cat debian/patches/series ); do
  76. # use -e here to skip commented-out patches in 'series'.
  77. [ -e debian/patches/$i ] && patch --verbose -p1 < debian/patches/$i
  78. done
  79. # Stop pico2wave from segfaulting on exit, when given words on the
  80. # command line. The code presumably works on Debian, maybe because
  81. # of differences in the popt library, or in glibc itself?
  82. patch --verbose -p1 < $CWD/dont_try_to_free_argv.diff
  83. cd pico
  84. autoreconf -if
  85. CFLAGS="$SLKCFLAGS" \
  86. CXXFLAGS="$SLKCFLAGS" \
  87. ./configure \
  88. --enable-shared \
  89. --disable-static \
  90. --prefix=/usr \
  91. --libdir=/usr/lib${LIBDIRSUFFIX} \
  92. --sysconfdir=/etc \
  93. --localstatedir=/var \
  94. --mandir=/usr/man \
  95. --docdir=/usr/doc/$PRGNAM-$VERSION \
  96. --build=$ARCH-slackware-linux
  97. make
  98. make install-strip DESTDIR=$PKG
  99. # We don't need this:
  100. rm $PKG/usr/lib$LIBDIRSUFFIX/*.la
  101. # It drives me nuts that pico2wave can't play to my speakers, so
  102. # I wrote a script:
  103. install -m0755 -oroot -groot $CWD/pico2audio $PKG/usr/bin
  104. # The original Debian man page was generated from the --help output. I've
  105. # expanded it to include a proper description, examples, a list of
  106. # allowed languages for the -l option, and a few other goodies.
  107. # 20210802 bkw: Added a man page for the pico2audio script, too.
  108. # Please don't add pico2audio.rst to the package, and please don't
  109. # remove it from the repo because it's not in the package: it's the
  110. # source for pico2audio.1.
  111. mkdir -p $PKG/usr/man/man1
  112. gzip -9c < $CWD/pico2wave.1 > $PKG/usr/man/man1/pico2wave.1.gz
  113. ln -s pico2wave.1.gz $PKG/usr/man/man1/$PRGNAM.1.gz
  114. gzip -9c < $CWD/pico2audio.1 > $PKG/usr/man/man1/pico2audio.1.gz
  115. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  116. cat ../debian/copyright > $PKG/usr/doc/$PRGNAM-$VERSION/copyright
  117. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  118. mkdir -p $PKG/install
  119. cat $CWD/slack-desc > $PKG/install/slack-desc
  120. cd $PKG
  121. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE