as31.SlackBuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/bin/bash
  2. # Slackware build script for as31
  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=as31
  7. VERSION=${VERSION:-2.3.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 [ ! -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. # For some reason, upstream uses colons for separators in its URL.
  40. # Some clients might save the file with hex escapes in the name...
  41. # If all else fails, accept SRC from the environment.
  42. for i in "${SRC:-$PRGNAM-$VERSION.tar.gz}" \
  43. "wiki:projects:linux:as31:$PRGNAM-$VERSION.tar.gz" \
  44. "wiki%3Aprojects%3Alinux%3Aas31%3A$PRGNAM-$VERSION.tar.gz";
  45. do
  46. [ -e "$CWD/$i" ] && SRC="$CWD/$i"
  47. done
  48. rm -rf $PKG
  49. mkdir -p $TMP $PKG $OUTPUT
  50. cd $TMP
  51. rm -rf $PRGNAM-$VERSION
  52. tar xvf $SRC
  53. cd $PRGNAM-$VERSION
  54. chown -R root:root .
  55. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  56. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  57. # Patch from Debian, check return value from getline(), seems like
  58. # a good idea.
  59. patch -p1 < $CWD/as31-fix-duplicate-line.patch
  60. CFLAGS="$SLKCFLAGS" \
  61. CXXFLAGS="$SLKCFLAGS" \
  62. sh ./configure \
  63. --prefix=/usr \
  64. --libdir=/usr/lib${LIBDIRSUFFIX} \
  65. --sysconfdir=/etc \
  66. --localstatedir=/var \
  67. --mandir=/usr/man \
  68. --build=$ARCH-slackware-linux
  69. # parser.c is generated from parser.y. Using the supplied one causes
  70. # location counter overlaps errors, on x86_64.
  71. ( cd $PRGNAM && rm -f parser.c && make parser.c )
  72. make
  73. make install-strip DESTDIR=$PKG
  74. gzip -9 $PKG/usr/man/man1/$PRGNAM.1
  75. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/examples
  76. cp -a COPYING AUTHORS ChangeLog NEWS README $PKG/usr/doc/$PRGNAM-$VERSION
  77. cp -a examples/*.asm examples/*.ref $PKG/usr/doc/$PRGNAM-$VERSION/examples
  78. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  79. mkdir -p $PKG/install
  80. cat $CWD/slack-desc > $PKG/install/slack-desc
  81. cd $PKG
  82. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE