waon.SlackBuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/bin/bash
  2. # Slackware build script for waon
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20211127 bkw: BUILD=2
  6. # - new-style (and actually square) icons.
  7. cd $(dirname $0) ; CWD=$(pwd)
  8. PRGNAM=waon
  9. VERSION=${VERSION:-0.10}
  10. BUILD=${BUILD:-2}
  11. TAG=${TAG:-_SBo}
  12. PKGTYPE=${PKGTYPE:-tgz}
  13. if [ -z "$ARCH" ]; then
  14. case "$( uname -m )" in
  15. i?86) ARCH=i586 ;;
  16. arm*) ARCH=arm ;;
  17. *) ARCH=$( uname -m ) ;;
  18. esac
  19. fi
  20. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  21. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  22. exit 0
  23. fi
  24. TMP=${TMP:-/tmp/SBo}
  25. PKG=$TMP/package-$PRGNAM
  26. OUTPUT=${OUTPUT:-/tmp}
  27. if [ "$ARCH" = "i586" ]; then
  28. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  29. LIBDIRSUFFIX=""
  30. elif [ "$ARCH" = "i686" ]; then
  31. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  32. LIBDIRSUFFIX=""
  33. elif [ "$ARCH" = "x86_64" ]; then
  34. SLKCFLAGS="-O2 -fPIC"
  35. LIBDIRSUFFIX="64"
  36. else
  37. SLKCFLAGS="-O2"
  38. LIBDIRSUFFIX=""
  39. fi
  40. set -e
  41. rm -rf $PKG
  42. mkdir -p $TMP $PKG $OUTPUT
  43. cd $TMP
  44. rm -rf $PRGNAM-$VERSION
  45. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  46. cd $PRGNAM-$VERSION
  47. chown -R root:root .
  48. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  49. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  50. # We will install pv as waon-pv, to avoid clashing with the existing SBo pv
  51. # package, so change references in all man pages from pv to waon-pv.
  52. sed -i -e 's/\.B pv/.B waon-pv/' -e 's/\.TH PV/.TH WAON-PV/' pv.1
  53. sed -i -e 's/\<pv\>/waon-pv/' $PRGNAM.1 g$PRGNAM.1
  54. sed -i "s,-O3,$SLKCFLAGS," Makefile
  55. make
  56. # No 'make install' rule, just stick everything where it goes.
  57. mkdir -p $PKG/usr/{bin,man/man1}
  58. install -s -m0755 $PRGNAM $PKG/usr/bin
  59. install -s -m0755 g$PRGNAM $PKG/usr/bin
  60. install -s -m0755 pv $PKG/usr/bin/$PRGNAM-pv
  61. gzip -9c $PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  62. gzip -9c g$PRGNAM.1 > $PKG/usr/man/man1/g$PRGNAM.1.gz
  63. gzip -9c pv.1 > $PKG/usr/man/man1/$PRGNAM-pv.1.gz
  64. # desktop file written for this SlackBuild
  65. mkdir -p $PKG/usr/share/applications
  66. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  67. # Icon based on WaoN.gif in the source (anyone care to design a better
  68. # looking icon & send it upstream?)
  69. for px in 16 32 48 64 128; do
  70. size=${px}x${px}
  71. dir=$PKG/usr/share/icons/hicolor/$size/apps
  72. mkdir -p $dir
  73. convert -resize $size $CWD/$PRGNAM.png $dir/$PRGNAM.png
  74. done
  75. mkdir -p $PKG/usr/share/pixmaps
  76. ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
  77. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  78. cp -a README COPYING ChangeLog TIPS TODO $PKG/usr/doc/$PRGNAM-$VERSION
  79. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  80. mkdir -p $PKG/install
  81. cat $CWD/slack-desc > $PKG/install/slack-desc
  82. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  83. cd $PKG
  84. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE