butt.SlackBuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/bin/bash
  2. # Slackware build script for butt
  3. # Copyright 2013-2022 klaatu | Lawrence NZ | klaatu@member.fsf.org
  4. #
  5. # GNU All Permissive License
  6. # Copying and distribution of this file, with or without modification,
  7. # are permitted in any medium without royalty provided the copyright
  8. # notice and this notice are preserved. This file is offered as-is,
  9. # without any warranty.
  10. cd $(dirname $0) ; CWD=$(pwd)
  11. PRGNAM=butt
  12. VERSION=${VERSION:-0.1.32}
  13. BUILD=${BUILD:-1}
  14. TAG=${TAG:-_SBo}
  15. PKGTYPE=${PKGTYPE:-tgz}
  16. PREFIX=${PREFIX:-/usr}
  17. MANDIR=${MANDIR:-$PREFIX/man}
  18. DOCDIR=${DOCDIR:-$PREFIX/doc}
  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 the variable PRINT_PACKAGE_NAME is set, then this script will report what
  27. # the name of the created package would be, and then exit. This information
  28. # could be useful to other scripts.
  29. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  30. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  31. exit 0
  32. fi
  33. TMP=${TMP:-/tmp/SBo}
  34. PKG=$TMP/package-$PRGNAM
  35. OUTPUT=${OUTPUT:-/tmp}
  36. if [ "$ARCH" = "i586" ]; then
  37. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  38. elif [ "$ARCH" = "i686" ]; then
  39. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  40. elif [ "$ARCH" = "x86_64" ]; then
  41. SLKCFLAGS="-O2 -fPIC"
  42. else
  43. SLKCFLAGS="-O2"
  44. fi
  45. set -e
  46. rm -rf $PKG
  47. mkdir -p $TMP $PKG $OUTPUT
  48. cd $TMP
  49. rm -rf $PRGNAM-$VERSION
  50. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  51. cd $PRGNAM-$VERSION
  52. chown -R root:root .
  53. find . \
  54. \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  55. -exec chmod 755 {} \; -o \
  56. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  57. -exec chmod 644 {} \;
  58. CFLAGS="$SLKCFLAGS" \
  59. CXXFLAGS="$SLKCFLAGS -fpermissive" \
  60. ./configure \
  61. --prefix $PREFIX \
  62. --docdir $DOCDIR
  63. mkdir -p $PKG/$PREFIX/bin
  64. make
  65. make install DESTDIR=$PKG
  66. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  67. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  68. find $PKG -name perllocal.pod \
  69. -o -name ".packlist" \
  70. -o -name "*.bs" \
  71. | xargs rm -f
  72. # desktop file, added to SlackBuild for convenience
  73. mkdir -p $PKG/usr/share/applications/
  74. cp $CWD/$PRGNAM.desktop $PKG/usr/share/applications/
  75. # icon file, added to SlackBuild for convenience
  76. mkdir -p $PKG/usr/share/icons/hicolor/scalable/apps
  77. cp $CWD/AJ-simple-radio.svg $PKG/usr/share/icons/hicolor/scalable/apps/$PRGNAM.svg
  78. mkdir -p $PKG/$DOCDIR/$PRGNAM-$VERSION
  79. cp -a \
  80. ChangeLog KNOWN_BUGS AUTHORS \
  81. INSTALL THANKS COPYING README \
  82. $PKG/$DOCDIR/$PRGNAM-$VERSION
  83. cat $CWD/$PRGNAM.SlackBuild > $PKG/$DOCDIR/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  84. mkdir -p $PKG/install
  85. cat $CWD/slack-desc > $PKG/install/slack-desc
  86. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  87. cd $PKG
  88. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE