srecord.SlackBuild 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. # Slackware build script for srecord
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20210907 bkw: BUILD=2
  6. # - get rid of useless BUILDING.pdf
  7. # - move PDF docs directly into the doc dir (instead of a subdir of it)
  8. # - get rid of .la file
  9. # - make the script code easier to read (for me anyway)
  10. # 20140819 bkw: updated for v1.64, switched to regular sourceforge download
  11. # URL. Turns out the short URL on the main site will disappear whenever
  12. # there's a new release.
  13. cd $(dirname $0) ; CWD=$(pwd)
  14. PRGNAM=srecord
  15. VERSION=${VERSION:-1.64}
  16. BUILD=${BUILD:-2}
  17. TAG=${TAG:-_SBo}
  18. PKGTYPE=${PKGTYPE:-tgz}
  19. if [ -z "$ARCH" ]; then
  20. case "$( uname -m )" in
  21. i?86) ARCH=i586 ;;
  22. arm*) ARCH=arm ;;
  23. *) ARCH=$( uname -m ) ;;
  24. esac
  25. fi
  26. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  27. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  28. exit 0
  29. fi
  30. TMP=${TMP:-/tmp/SBo}
  31. PKG=$TMP/package-$PRGNAM
  32. OUTPUT=${OUTPUT:-/tmp}
  33. if [ "$ARCH" = "i586" ]; then
  34. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  35. LIBDIRSUFFIX=""
  36. elif [ "$ARCH" = "i686" ]; then
  37. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  38. LIBDIRSUFFIX=""
  39. elif [ "$ARCH" = "x86_64" ]; then
  40. SLKCFLAGS="-O2 -fPIC"
  41. LIBDIRSUFFIX="64"
  42. else
  43. SLKCFLAGS="-O2"
  44. LIBDIRSUFFIX=""
  45. fi
  46. set -e
  47. rm -rf $PKG
  48. mkdir -p $TMP $PKG $OUTPUT
  49. cd $TMP
  50. rm -rf $PRGNAM-$VERSION
  51. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  52. cd $PRGNAM-$VERSION
  53. chown -R root:root .
  54. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  55. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  56. DOCDIR=/usr/doc/$PRGNAM-$VERSION
  57. PKGDOC=$PKG/$DOCDIR
  58. LIBDIR=/usr/lib$LIBDIRSUFFIX
  59. PKGLIB=$PKG/$LIBDIR
  60. CFLAGS="$SLKCFLAGS" \
  61. CXXFLAGS="$SLKCFLAGS" \
  62. ./configure \
  63. --prefix=/usr \
  64. --libdir=$LIBDIR \
  65. --sysconfdir=/etc \
  66. --localstatedir=/var \
  67. --mandir=/usr/man \
  68. --docdir=$DOCDIR \
  69. --build=$ARCH-slackware-linux
  70. make
  71. make install DESTDIR=$PKG
  72. # don't need static lib, and --disable-static doesn't work
  73. rm -f $PKGLIB/*.a
  74. strip $PKG/usr/bin/* $PKGLIB/*.so.?.?.?
  75. rm -f $PKGLIB/*.la
  76. gzip -9 $PKG/usr/man/man?/*
  77. mkdir -p $PKGDOC
  78. cp -a AUTHORS LICENSE README $PKGDOC
  79. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  80. # --docdir is ignored, too
  81. mv $PKG/usr/share/doc/$PRGNAM/* $PKGDOC
  82. rm -rf $PKG/usr/share $PKGDOC/BUILDING.pdf
  83. mkdir -p $PKG/install
  84. cat $CWD/slack-desc > $PKG/install/slack-desc
  85. cd $PKG
  86. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE