ydotool.SlackBuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/bin/bash
  2. # Slackware build script for ydotool
  3. # Written by B. Watson (yalhcru@gmail.com)
  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. if [ -z "$ARCH" ]; then
  19. case "$( uname -m )" in
  20. i?86) ARCH=i586 ;;
  21. arm*) ARCH=arm ;;
  22. *) ARCH=$( uname -m ) ;;
  23. esac
  24. fi
  25. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  26. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  27. exit 0
  28. fi
  29. TMP=${TMP:-/tmp/SBo}
  30. PKG=$TMP/package-$PRGNAM
  31. OUTPUT=${OUTPUT:-/tmp}
  32. if [ "$ARCH" = "i586" ]; then
  33. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  34. LIBDIRSUFFIX=""
  35. elif [ "$ARCH" = "i686" ]; then
  36. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  37. LIBDIRSUFFIX=""
  38. elif [ "$ARCH" = "x86_64" ]; then
  39. SLKCFLAGS="-O2 -fPIC"
  40. LIBDIRSUFFIX="64"
  41. else
  42. SLKCFLAGS="-O2"
  43. LIBDIRSUFFIX=""
  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 -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  54. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  55. # The cmake project version variables control the shared library's
  56. # version, which should match the actual ytodool version... version
  57. # 0.1.9 thinks it's 0.1.5.
  58. patch -p1 < $CWD/project_version.diff
  59. mkdir -p build
  60. cd build
  61. cmake \
  62. -DDYNAMIC_BUILD=on \
  63. -DSTATIC_BUILD=off \
  64. -DCMAKE_CXX_FLAGS_RELEASE="$SLKCFLAGS -DNDEBUG" \
  65. -DCMAKE_INSTALL_PREFIX=/usr \
  66. -DLIB_SUFFIX=${LIBDIRSUFFIX} \
  67. -DMAN_INSTALL_DIR=/usr/man \
  68. -DCMAKE_BUILD_TYPE=Release ..
  69. make VERBOSE=1
  70. make install/strip DESTDIR=$PKG
  71. cd ..
  72. # Upstream's man pages are in scdoc format, which looks like a pretty
  73. # nice text-to-manpage mini-language. Rather than require scdoc as a
  74. # dependency, I just converted the man pages and included them with
  75. # the script. If they ever need to be generated again, use this:
  76. if [ "${CONVERT_MAN:-no}" = "yes" ]; then
  77. sed -i 's,\\fR,,' manpage/ydotool.1.scd
  78. scdoc < manpage/ydotool.1.scd > $CWD/ydotool.1
  79. scdoc < manpage/ydotoold.8.scd > $CWD/ydotoold.8
  80. fi
  81. PMAN=$PKG/usr/man
  82. mkdir -p $PMAN/man{1,8}
  83. gzip -9c < $CWD/$PRGNAM.1 > $PMAN/man1/$PRGNAM.1.gz
  84. gzip -9c < $CWD/${PRGNAM}d.8 > $PMAN/man8/${PRGNAM}d.8.gz
  85. # Install setuid unless disabled. See README for rationale.
  86. if [ "${SETUID:-yes}" = "yes" ]; then
  87. chown root:console $PKG/usr/bin/*
  88. chmod 4750 $PKG/usr/bin/*
  89. fi
  90. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  91. cp -a LICENSE README* $PKG/usr/doc/$PRGNAM-$VERSION
  92. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  93. mkdir -p $PKG/install
  94. cat $CWD/slack-desc > $PKG/install/slack-desc
  95. cd $PKG
  96. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}