ltrace.SlackBuild 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/bin/bash
  2. # Slackware build script for ltrace
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20170628 bkw: updated for 0.7.3_6
  6. cd $(dirname $0) ; CWD=$(pwd)
  7. PRGNAM=ltrace
  8. VERSION=${VERSION:-0.7.3_6}
  9. BUILD=${BUILD:-1}
  10. TAG=${TAG:-_SBo}
  11. PKGTYPE=${PKGTYPE:-tgz}
  12. if [ -z "$ARCH" ]; then
  13. case "$( uname -m )" in
  14. i?86) ARCH=i586 ;;
  15. arm*) ARCH=arm ;;
  16. *) ARCH=$( uname -m ) ;;
  17. esac
  18. fi
  19. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  20. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  21. exit 0
  22. fi
  23. TMP=${TMP:-/tmp/SBo}
  24. PKG=$TMP/package-$PRGNAM
  25. OUTPUT=${OUTPUT:-/tmp}
  26. if [ "$ARCH" = "i586" ]; then
  27. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  28. LIBDIRSUFFIX=""
  29. elif [ "$ARCH" = "i686" ]; then
  30. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  31. LIBDIRSUFFIX=""
  32. elif [ "$ARCH" = "x86_64" ]; then
  33. SLKCFLAGS="-O2 -fPIC"
  34. LIBDIRSUFFIX="64"
  35. else
  36. SLKCFLAGS="-O2"
  37. LIBDIRSUFFIX=""
  38. fi
  39. set -e
  40. # VERSION is upstream's plus Debian's (since we use their patchset)
  41. SRCVER=$( echo $VERSION | cut -d_ -f1 )
  42. DEBVER=$( echo $VERSION | cut -d_ -f2 )
  43. rm -rf $PKG
  44. mkdir -p $TMP $PKG $OUTPUT
  45. cd $TMP
  46. rm -rf $PRGNAM-$SRCVER
  47. tar xvf $CWD/${PRGNAM}_$SRCVER.orig.tar.bz2
  48. cd $PRGNAM-$SRCVER
  49. tar xvf $CWD/${PRGNAM}_$SRCVER-$DEBVER.debian.tar.?z debian/patches
  50. chown -R root:root .
  51. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  52. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  53. # apply Debian's patches, which fix a few bugs.
  54. for i in $( cat debian/patches/series ); do
  55. patch -p1 < debian/patches/$i
  56. done
  57. # Slackware's gelf.h lives in /usr/include/libelf. Normally not a problem,
  58. # but ltrace is old enough that it doesn't use pkg-config.
  59. SLKCFLAGS="$SLKCFLAGS -I/usr/include/libelf"
  60. CFLAGS="$SLKCFLAGS" \
  61. CXXFLAGS="$SLKCFLAGS" \
  62. ./configure \
  63. --prefix=/usr \
  64. --libdir=/usr/lib${LIBDIRSUFFIX} \
  65. --sysconfdir=/etc \
  66. --localstatedir=/var \
  67. --mandir=/usr/man \
  68. --docdir=/usr/doc/$PRGNAM-$VERSION \
  69. --disable-werror \
  70. --build=$ARCH-slackware-linux
  71. make
  72. make install-strip DESTDIR=$PKG
  73. gzip $PKG/usr/man/man?/*
  74. mv $PKG/etc/$PRGNAM.conf $PKG/etc/$PRGNAM.conf.new
  75. # docs already installed in right place, we don't need this one:
  76. rm -f $PKG/usr/doc/$PRGNAM-$VERSION/INSTALL
  77. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  78. mkdir -p $PKG/install
  79. cat $CWD/slack-desc > $PKG/install/slack-desc
  80. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  81. cd $PKG
  82. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE