itex2mml.SlackBuild 2.4 KB

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