flite.SlackBuild 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. #!/bin/bash
  2. # Slackware build script for flite
  3. # Originally written by Martin Lefebvre (email removed)
  4. # Now maintained by B. Watson (urchlay@slackware.uk), original author is MIA.
  5. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  6. # 20210802 bkw: update for v2.2
  7. # - remove texi2html dep, as upstream now uses texi2any
  8. # - related to above, always build the HTML docs
  9. # - add flite_time and t2p to usr/bin. Also man pages for same,
  10. # from Debian.
  11. # - Note to self: the shared library versioning is weird looking. The
  12. # soname version is 1, same as FLITE_PROJECT_SHLIB_VERSION
  13. # in flite_version.h, and the files are installed as
  14. # libfliteblah.2.2. So we end up with symlinks libfliteblah.so.1 =>
  15. # libfliteblah.2.2, which is actually correct.
  16. # 20181114 bkw:
  17. # - BUILD=2
  18. # - add WTFPL to script
  19. # - always build the .info API docs
  20. # - get rid of DOCS env variable
  21. # - only build HTML docs if texi2html is available
  22. # - update README to document the above
  23. # - minor updates to man page and slack-desc
  24. # - add HTML=no to skip building HTML docs
  25. # 20180612 bkw: update for 2.1 (or is it 2.1.0?)
  26. # 20170614 bkw:
  27. # - add ldflags patch from King Beowulf, to allow external programs
  28. # to link correctly with libflite.so. BUILD=2.
  29. # 20150623 bkw:
  30. # - fix doc build failure with standalone SBo texi2html, thanks
  31. # to John Vogel for investigating this
  32. # - add DOCS=no option, in case a future texi2html has more
  33. # issues
  34. # 20150509 bkw:
  35. # - update for 2.0.0
  36. # - add HTML and .info docs
  37. # - add man page
  38. # - update HOMEPAGE
  39. # - add optional extra voice support
  40. # 20141020 bkw: fix handy-ruler, make VERSION respect environment.
  41. # 20130411 bkw: Updated for flite 1.4, added fix for parallel builds.
  42. # Removed --with-vox=cmu_us_kal16 configure flag (it doesn't seem to
  43. # do anything).
  44. # The updated version is released under the WTFPL, see
  45. # http://www.wtfpl.net/txt/copying/ for details.
  46. cd $(dirname $0) ; CWD=$(pwd)
  47. PRGNAM=flite
  48. VERSION=${VERSION:-2.2}
  49. BUILD=${BUILD:-1}
  50. TAG=${TAG:-_SBo}
  51. PKGTYPE=${PKGTYPE:-tgz}
  52. if [ -z "$ARCH" ]; then
  53. case "$( uname -m )" in
  54. i?86) ARCH=i586 ;;
  55. arm*) ARCH=arm ;;
  56. *) ARCH=$( uname -m ) ;;
  57. esac
  58. fi
  59. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  60. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  61. exit 0
  62. fi
  63. TMP=${TMP:-/tmp/SBo}
  64. PKG=$TMP/package-$PRGNAM
  65. OUTPUT=${OUTPUT:-/tmp}
  66. if [ "$ARCH" = "i586" ]; then
  67. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  68. LIBDIRSUFFIX=""
  69. elif [ "$ARCH" = "i686" ]; then
  70. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  71. LIBDIRSUFFIX=""
  72. elif [ "$ARCH" = "x86_64" ]; then
  73. SLKCFLAGS="-O2 -fPIC"
  74. LIBDIRSUFFIX="64"
  75. else
  76. SLKCFLAGS="-O2"
  77. LIBDIRSUFFIX=""
  78. fi
  79. set -e
  80. rm -rf $PKG
  81. mkdir -p $TMP $PKG $OUTPUT
  82. cd $TMP
  83. rm -rf $PRGNAM-$VERSION
  84. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  85. cd $PRGNAM-$VERSION
  86. chown -R root:root .
  87. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  88. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  89. CFLAGS="$SLKCFLAGS -Wl,-s" \
  90. CXXFLAGS="$SLKCFLAGS -Wl,-s" \
  91. ./configure \
  92. --prefix=/usr \
  93. --libdir=/usr/lib${LIBDIRSUFFIX} \
  94. --sysconfdir=/etc \
  95. --localstatedir=/var \
  96. --with-audio=alsa \
  97. --enable-shared \
  98. --build=$ARCH-slackware-linux
  99. make
  100. make install prefix=$PKG/usr INSTALLLIBDIR=$PKG/usr/lib${LIBDIRSUFFIX}
  101. strip $PKG/usr/lib$LIBDIRSUFFIX/*.so.*.*
  102. # --disable-static is accepted by configure but totally ignored, so:
  103. rm -rf $PKG/usr/lib$LIBDIRSUFFIX/*.a
  104. # flite.1 written by SlackBuild author. The rest are from Debian.
  105. mkdir -p $PKG/usr/man/man1
  106. for i in $CWD/man/*.1; do
  107. gzip -9c < $i > $PKG/usr/man/man1/"$( basename "$i" )".gz
  108. done
  109. # the Debian package includes these 2 binaries that don't get installed
  110. # by 'make install'. They look useful enough, so:
  111. install -s -m0755 bin/t2p bin/flite_time $PKG/usr/bin
  112. # include any *.flitevox files the user downloaded.
  113. for file in $CWD/*.flitevox; do
  114. [ -e "$file" ] && \
  115. mkdir -p $PKG/usr/share/$PRGNAM && \
  116. cat $file > $PKG/usr/share/$PRGNAM/"$( basename "$file" )" && \
  117. EXTRA=yes
  118. done
  119. # build the docs. NB don't replace subshells with "cd dir" and
  120. # "cd -", as they don't nest.
  121. ( cd doc
  122. # build the HTML docs.
  123. make $PRGNAM.html
  124. ( cd html
  125. # Upstream hardlinks index.html, use a symlink instead.
  126. rm -f index.html
  127. ln -s ${PRGNAM}_toc.html index.html
  128. # Also, we don't ship the PDF doc, so link to upstream's.
  129. # Fix link to source package.
  130. sed -i \
  131. -e 's,HREF="flite.pdf",HREF="http://www.festvox.org/flite/doc/flite.pdf",' \
  132. -e 's,\.tar\.gz,.tar.bz2,g' \
  133. ${PRGNAM}_toc.html
  134. )
  135. )
  136. # 20181114 bkw: always build the GNU info docs.
  137. ( cd doc
  138. makeinfo $PRGNAM.texi
  139. mkdir -p $PKG/usr/info
  140. gzip -9c < $PRGNAM.info > $PKG/usr/info/$PRGNAM.info.gz
  141. )
  142. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  143. cp -a ACKNOWLEDGEMENTS COPYING README* doc/html doc/*.txt doc/alice \
  144. $PKG/usr/doc/$PRGNAM-$VERSION
  145. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  146. mkdir -p $PKG/install
  147. # slack-desc gets a note if extra voices are included.
  148. if [ "$EXTRA" = "yes" ]; then
  149. sed '15s,$, This package includes extra voices in /usr/share/flite/,' \
  150. $CWD/slack-desc > $PKG/install/slack-desc
  151. else
  152. cat $CWD/slack-desc > $PKG/install/slack-desc
  153. fi
  154. # doinst.sh needed because we append to /usr/info/dir.
  155. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  156. cd $PKG
  157. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE