itex2mml.SlackBuild 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #!/bin/sh
  2. # Slackware build script for itex2mml
  3. # Written by David Matthew Jerry Koenig <koenigdavidmj@gmail.com>
  4. # Public domain.
  5. PRGNAM=itex2mml
  6. VERSION=${VERSION:-1.4.11}
  7. BUILD=${BUILD:-1}
  8. TAG=${TAG:-_SBo}
  9. if [ -z "$ARCH" ]; then
  10. case "$( uname -m )" in
  11. i?86) ARCH=i486 ;;
  12. arm*) ARCH=arm ;;
  13. *) ARCH=$( uname -m ) ;;
  14. esac
  15. fi
  16. CWD=$(pwd)
  17. TMP=${TMP:-/tmp/SBo}
  18. PKG=$TMP/package-$PRGNAM
  19. OUTPUT=${OUTPUT:-/tmp}
  20. if [ "$ARCH" = "i486" ]; then
  21. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  22. elif [ "$ARCH" = "i686" ]; then
  23. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  24. elif [ "$ARCH" = "x86_64" ]; then
  25. SLKCFLAGS="-O2 -fPIC"
  26. fi
  27. # Enable Ruby bindings by default.
  28. RUBY=${RUBY:-YES}
  29. set -e
  30. rm -rf $PKG
  31. mkdir -p $TMP $PKG $OUTPUT
  32. cd $TMP
  33. rm -rf $PRGNAM-$VERSION
  34. tar xvf $CWD/itexToMML.tar.gz
  35. cd itexToMML/itex-src
  36. chown -R root:root .
  37. find -L . \
  38. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  39. -exec chmod 755 {} \; -o \
  40. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  41. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  42. if [[ "$RUBY" = "YES" ]]; then
  43. MYRARCH=$(ruby -e 'print RbConfig::CONFIG["arch"]')
  44. fi
  45. # This fixes ruby bindings build, BINDIR,
  46. sed -i \
  47. -e "s|require\ \"rbconfig\";\ print\ |print Rb|" \
  48. -e "s|RUBYDIR)|RUBYDIR) -I/usr/include/ruby-1.9.1/${MYRARCH}|" \
  49. -e "s|local/||" \
  50. Makefile
  51. make clean
  52. CFLAGS="$SLKCFLAGS" \
  53. CXXFLAGS="$SLKCFLAGS" \
  54. make
  55. mkdir -p $PKG/usr/bin
  56. make install BINDIR=$PKG/usr/bin
  57. if [[ "$RUBY" = "YES" ]]; then
  58. make ruby
  59. ARCHDIR="$PKG$(ruby -e 'print RbConfig::CONFIG["sitearchdir"]')"
  60. SITEDIR="$PKG$(ruby -e 'print RbConfig::CONFIG["sitelibdir"]')"
  61. mkdir -p $ARCHDIR
  62. mkdir -p $SITEDIR
  63. make CFLAGS="$SLKCFLAGS" install_ruby RUBY_SITEARCHDIR=$ARCHDIR RUBY_SITEDIR=$SITEDIR
  64. fi
  65. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  66. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  67. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  68. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  69. # Copy the slack-desc (and a custom doinst.sh if necessary) into ./install
  70. mkdir -p $PKG/install
  71. cat $CWD/slack-desc > $PKG/install/slack-desc
  72. cd $PKG
  73. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}