ydotool.SlackBuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/bin/bash
  2. # Slackware build script for ydotool
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # Note: this is not the latest version of ydotool, though it's newer
  6. # than the version that Debian packages. It uses the stable(ish)
  7. # libevdevplus and libuinputplus versions that Debian also packages.
  8. # Later ytodool, libevdevplus, and libuinputplus versions are
  9. # rapidly-moving targets for now. Plus, latest ydotool uses "CPM"
  10. # (Cmake Package Manager) to auto-download its dependencies, and I
  11. # haven't had time to figure out how to defeat that so the script can
  12. # run without doing network access...
  13. cd $(dirname $0) ; CWD=$(pwd)
  14. PRGNAM=ydotool
  15. VERSION=${VERSION:-0.1.9}
  16. BUILD=${BUILD:-1}
  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. # The cmake project version variables control the shared library's
  57. # version, which should match the actual ytodool version... version
  58. # 0.1.9 thinks it's 0.1.5.
  59. patch -p1 < $CWD/project_version.diff
  60. mkdir -p build
  61. cd build
  62. cmake \
  63. -DDYNAMIC_BUILD=on \
  64. -DSTATIC_BUILD=off \
  65. -DCMAKE_CXX_FLAGS_RELEASE="$SLKCFLAGS -DNDEBUG" \
  66. -DCMAKE_INSTALL_PREFIX=/usr \
  67. -DLIB_SUFFIX=${LIBDIRSUFFIX} \
  68. -DMAN_INSTALL_DIR=/usr/man \
  69. -DCMAKE_BUILD_TYPE=Release ..
  70. make VERBOSE=1
  71. make install/strip DESTDIR=$PKG
  72. cd ..
  73. # Upstream's man pages are in scdoc format, which looks like a pretty
  74. # nice text-to-manpage mini-language. Rather than require scdoc as a
  75. # dependency, I just converted the man pages and included them with
  76. # the script. If they ever need to be generated again, use this:
  77. if [ "${CONVERT_MAN:-no}" = "yes" ]; then
  78. sed -i 's,\\fR,,' manpage/ydotool.1.scd
  79. scdoc < manpage/ydotool.1.scd > $CWD/ydotool.1
  80. scdoc < manpage/ydotoold.8.scd > $CWD/ydotoold.8
  81. fi
  82. PMAN=$PKG/usr/man
  83. mkdir -p $PMAN/man{1,8}
  84. gzip -9c < $CWD/$PRGNAM.1 > $PMAN/man1/$PRGNAM.1.gz
  85. gzip -9c < $CWD/${PRGNAM}d.8 > $PMAN/man8/${PRGNAM}d.8.gz
  86. # Install setuid unless disabled. See README for rationale.
  87. if [ "${SETUID:-yes}" = "yes" ]; then
  88. chown root:console $PKG/usr/bin/*
  89. chmod 4750 $PKG/usr/bin/*
  90. fi
  91. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  92. cp -a LICENSE README* $PKG/usr/doc/$PRGNAM-$VERSION
  93. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  94. mkdir -p $PKG/install
  95. cat $CWD/slack-desc > $PKG/install/slack-desc
  96. cd $PKG
  97. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE