tapecalc.SlackBuild 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/bin/bash
  2. # Slackware build script for tapecalc
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # Note: the original name for this is "add". This seems *awfully*
  6. # generic (there's no /usr/bin/add in Slackware, but I can imagine
  7. # some other SBo package using that name for something). When this
  8. # got packaged for Debian, their maintainer renamed it to 'tapecalc'.
  9. # I'll use their name. As a nice side effect, it's easier to search
  10. # for under this name.
  11. cd $(dirname $0) ; CWD=$(pwd)
  12. PRGNAM=tapecalc
  13. SRCNAM=add
  14. VERSION=${VERSION:-20230205}
  15. BUILD=${BUILD:-1}
  16. TAG=${TAG:-_SBo}
  17. PKGTYPE=${PKGTYPE:-tgz}
  18. if [ -z "$ARCH" ]; then
  19. case "$( uname -m )" in
  20. i?86) ARCH=i586 ;;
  21. arm*) ARCH=arm ;;
  22. *) ARCH=$( uname -m ) ;;
  23. esac
  24. fi
  25. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  26. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  27. exit 0
  28. fi
  29. TMP=${TMP:-/tmp/SBo}
  30. PKG=$TMP/package-$PRGNAM
  31. OUTPUT=${OUTPUT:-/tmp}
  32. if [ "$ARCH" = "i586" ]; then
  33. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  34. LIBDIRSUFFIX=""
  35. elif [ "$ARCH" = "i686" ]; then
  36. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  37. LIBDIRSUFFIX=""
  38. elif [ "$ARCH" = "x86_64" ]; then
  39. SLKCFLAGS="-O2 -fPIC"
  40. LIBDIRSUFFIX="64"
  41. else
  42. SLKCFLAGS="-O2"
  43. LIBDIRSUFFIX=""
  44. fi
  45. set -e
  46. rm -rf $PKG
  47. mkdir -p $TMP $PKG $OUTPUT
  48. cd $TMP
  49. rm -rf $SRCNAM-$VERSION
  50. tar xvf $CWD/$SRCNAM-$VERSION.tgz
  51. cd $SRCNAM-$VERSION
  52. chown -R root:root .
  53. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  54. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  55. CFLAGS="$SLKCFLAGS" \
  56. CXXFLAGS="$SLKCFLAGS" \
  57. ./configure \
  58. --prefix=/usr \
  59. --libdir=/usr/lib${LIBDIRSUFFIX} \
  60. --sysconfdir=/etc \
  61. --localstatedir=/var \
  62. --mandir=/usr/man \
  63. --disable-static \
  64. --program-transform-name='s/add/tapecalc/' \
  65. --datadir=/usr/share/$PRGNAM \
  66. --build=$ARCH-slackware-linux
  67. make
  68. strip $SRCNAM
  69. make install DESTDIR=$PKG
  70. gzip $PKG/usr/man/man*/*
  71. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  72. mkdir -p $PKGDOC
  73. cp -a CHANGES COPYING README $PKGDOC
  74. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  75. mkdir -p $PKG/install
  76. cat $CWD/slack-desc > $PKG/install/slack-desc
  77. cd $PKG
  78. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE