atasm.SlackBuild 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/bin/bash
  2. # Slackware build script for atasm
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. cd $(dirname $0) ; CWD=$(pwd)
  6. PRGNAM=atasm
  7. VERSION=${VERSION:-1.07d}
  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 [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  19. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  20. exit 0
  21. fi
  22. TMP=${TMP:-/tmp/SBo}
  23. PKG=$TMP/package-$PRGNAM
  24. OUTPUT=${OUTPUT:-/tmp}
  25. if [ "$ARCH" = "i586" ]; then
  26. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  27. LIBDIRSUFFIX=""
  28. elif [ "$ARCH" = "i686" ]; then
  29. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  30. LIBDIRSUFFIX=""
  31. elif [ "$ARCH" = "x86_64" ]; then
  32. SLKCFLAGS="-O2 -fPIC"
  33. LIBDIRSUFFIX="64"
  34. else
  35. SLKCFLAGS="-O2"
  36. LIBDIRSUFFIX=""
  37. fi
  38. set -e
  39. SRCNAM="${PRGNAM}${VERSION/./}"
  40. ZIPFILE="$SRCNAM.zip"
  41. SRCDIR="$( echo "$SRCNAM" | sed 's,[a-z]$,,' )"
  42. rm -rf $PKG
  43. mkdir -p $TMP $PKG $OUTPUT
  44. cd $TMP
  45. rm -rf $SRCDIR
  46. unzip $CWD/$ZIPFILE
  47. cd $SRCDIR
  48. chown -R root:root .
  49. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  50. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  51. DOCDIR=/usr/doc/$PRGNAM-$VERSION
  52. # fix reference to full documentation.
  53. sed -i \
  54. -e "s,$PRGNAM\.txt,$PRGNAM.pdf," \
  55. -e "s,%%DOCDIR%%,$DOCDIR," \
  56. src/$PRGNAM.1.in
  57. sed -i "s,-O3.*,$SLKCFLAGS," src/Makefile
  58. mkdir -p $PKG/usr/bin $PKG/usr/man/man1 $PKG/usr/doc/$PRGNAM-$VERSION
  59. # 'make install' chokes because this file's missing:
  60. touch $PRGNAM.txt
  61. # N.B. nonstandard use of DESTDIR and MANDIR here.
  62. make -C src all install \
  63. DESTDIR=$PKG/usr/bin \
  64. MANDIR=$PKG/usr/man/man1 \
  65. DOCDIR=$PKG/$DOCDIR
  66. strip $PKG/usr/bin/$PRGNAM
  67. gzip $PKG/usr/man/man1/$PRGNAM.1
  68. rm -f $PKG/$DOCDIR/$PRGNAM.txt
  69. cp -a LICENSE *.TXT docs/* examples $PKG/$DOCDIR
  70. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  71. mkdir -p $PKG/install
  72. cat $CWD/slack-desc > $PKG/install/slack-desc
  73. cd $PKG
  74. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE