mlton.SlackBuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/bin/sh
  2. # Slackware build script for mlton
  3. # Originally by Jockey S. Kyd (jockey dot kyd at gmail dot com)
  4. # Modified by Ryan P.C. McQuen, WA, ryanpcmcquen@member.fsf.org
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version, with the following exception:
  9. # the text of the GPL license may be omitted..
  10. # This program is distributed in the hope that it will be useful, but
  11. # without any warranty; without even the implied warranty of
  12. # merchantability or fitness for a particular purpose. Compiling,
  13. # interpreting, executing or merely reading the text of the program
  14. # may result in lapses of consciousness and/or very being, up to and
  15. # including the end of all existence and the Universe as we know it.
  16. # See the GNU General Public License for more details.
  17. # You may have received a copy of the GNU General Public License
  18. # along with this program (most likely, a file named COPYING). If
  19. # not, see <http://www.gnu.org/licenses/>.
  20. PRGNAM=mlton
  21. VERSION=${VERSION:-20130715}
  22. BUILD=${BUILD:-1}
  23. TAG=${TAG:-_SBo}
  24. if [ -z "$ARCH" ]; then
  25. case "$(uname -m)" in
  26. i?86) ARCH=i486 ;;
  27. arm*) ARCH=arm ;;
  28. *) ARCH=$(uname -m) ;;
  29. esac
  30. fi
  31. CWD=$(pwd)
  32. TMP=${TMP:-/tmp/SBo}
  33. PKG=$TMP/package-$PRGNAM
  34. OUTPUT=${OUTPUT:-/tmp}
  35. case "$ARCH" in
  36. i?86) LIBDIRSUFFIX=""
  37. TARARCH="x86" ;;
  38. x86_64) LIBDIRSUFFIX="64"
  39. TARARCH="amd64" ;;
  40. *) printf "$ARCH is not supported.\n" 1>&2
  41. exit 1 ;;
  42. esac
  43. DIST=$PRGNAM-$VERSION-1.$TARARCH-linux
  44. set -e
  45. rm -rf $PKG
  46. mkdir -p $TMP $PKG $OUTPUT
  47. cd $PKG
  48. tar xvf $CWD/$DIST.tgz
  49. chown -R root:root .
  50. find -L . \
  51. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  52. -o -perm 511 \) -exec chmod 755 {} \; -o \
  53. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  54. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  55. [ "$LIBDIRSUFFIX" = "64" ] && mv $PKG/usr/lib{,64}
  56. sed -i "s|^lib=.*$|lib='/usr/lib$LIBDIRSUFFIX/mlton'|" $PKG/usr/bin/mlton
  57. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  58. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  59. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  60. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  61. mv $PKG/usr/share/doc/mlton/* $PKG/usr/doc/$PRGNAM-$VERSION/
  62. rm -rf $PKG/usr/share
  63. mkdir -p $PKG/install
  64. cat $CWD/slack-desc > $PKG/install/slack-desc
  65. cd $PKG
  66. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}