easystroke.SlackBuild 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/bin/bash
  2. # Slackware build script for easystroke
  3. # Written by Larry Hajali <larryhaja[at]gmail[dot]com>
  4. # Modified by Willy Sudiarto Raharjo <willysr@slackware-id.org>
  5. # Modified by B. Watson <urchlay@slackware.uk>, fix .desktop file, BUILD=2.
  6. cd $(dirname $0) ; CWD=$(pwd)
  7. PRGNAM=easystroke
  8. VERSION=${VERSION:-0.6.0}
  9. BUILD=${BUILD:-2}
  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. rm -rf $PKG
  41. mkdir -p $TMP $PKG $OUTPUT
  42. cd $TMP
  43. rm -rf $PRGNAM-$VERSION
  44. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  45. cd $PRGNAM-$VERSION
  46. chown -R root:root .
  47. find -L . \
  48. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  49. -o -perm 511 \) -exec chmod 755 {} \+ -o \
  50. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  51. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
  52. # Add StartupNotify to desktop menu item.
  53. sed -i '2iStartupNotify=false' $PRGNAM.desktop.in
  54. # Fix multithreading boost library in Makefile.
  55. sed -i 's|-lboost_serialization-mt|-lboost_serialization|' Makefile
  56. # Thanks to ARCH Linux
  57. patch -p1 < $CWD/lambda.patch
  58. patch -p1 < $CWD/gcc7-build-fix.patch
  59. make CXX="g++ $SLKCFLAGS" CC="gcc -std=c99 $SLKCFLAGS" PREFIX=/usr
  60. # Determine if we compile manpages with help2man. Default is no.
  61. if [ "${COMPILE_MAN:-no}" != "no" ]; then
  62. make man
  63. mkdir -p $PKG/usr/man/man1
  64. gzip -9c $PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  65. fi
  66. make install PREFIX=/usr DESTDIR=$PKG
  67. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  68. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  69. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  70. cp -a changelog LICENSE $PKG/usr/doc/$PRGNAM-$VERSION
  71. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  72. mkdir -p $PKG/install
  73. cat $CWD/slack-desc > $PKG/install/slack-desc
  74. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  75. cd $PKG
  76. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE