g15daemon.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #!/bin/bash
  2. # Slackware build script for g15daemon
  3. # Copyright (c) 2011 Alan Alberghini <414N@slacky.it>
  4. # All rights reserved.
  5. #
  6. # Permission to use, copy, modify, and distribute this software for
  7. # any purpose with or without fee is hereby granted, provided that
  8. # the above copyright notice and this permission notice appear in all
  9. # copies.
  10. #
  11. # THIS SOFTWARE IS PROVIDED AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. # IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. # SUCH DAMAGE.
  23. cd $(dirname $0) ; CWD=$(pwd)
  24. PRGNAM=g15daemon
  25. VERSION=${VERSION:-1.9.5.3}
  26. BUILD=${BUILD:-3}
  27. TAG=${TAG:-_SBo}
  28. PKGTYPE=${PKGTYPE:-tgz}
  29. if [ -z "$ARCH" ]; then
  30. case "$( uname -m )" in
  31. i?86) ARCH=i486 ;;
  32. arm*) ARCH=arm ;;
  33. *) ARCH=$( uname -m ) ;;
  34. esac
  35. fi
  36. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  37. # the name of the created package would be, and then exit. This information
  38. # could be useful to other scripts.
  39. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  40. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  41. exit 0
  42. fi
  43. TMP=${TMP:-/tmp/SBo}
  44. PKG=$TMP/package-$PRGNAM
  45. OUTPUT=${OUTPUT:-/tmp}
  46. if [ "$ARCH" = "i486" ]; then
  47. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "s390" ]; then
  50. SLKCFLAGS="-O2"
  51. LIBDIRSUFFIX=""
  52. elif [ "$ARCH" = "x86_64" ]; then
  53. SLKCFLAGS="-O2"
  54. LIBDIRSUFFIX="64"
  55. else
  56. SLKCFLAGS="-O2"
  57. LIBDIRSUFFIX=""
  58. fi
  59. set -e
  60. rm -rf $PKG
  61. mkdir -p $TMP $PKG $OUTPUT
  62. cd $TMP
  63. rm -rf $PRGNAM-$VERSION
  64. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  65. cd $PRGNAM-$VERSION
  66. chown -R root:root .
  67. find -L . \
  68. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  69. -exec chmod 755 {} \; -o \
  70. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  71. -exec chmod 644 {} \;
  72. # Patch for uinput to make the Gn keys work under X
  73. # Thanks to Gentoo bugzilla people!
  74. patch -p1 < "$CWD/g15daemon-1.9.5.3-uinput.patch"
  75. CFLAGS="$SLKCFLAGS -fcommon" \
  76. CXXFLAGS="$SLKCFLAGS" \
  77. ./configure \
  78. --disable-static \
  79. --prefix=/usr \
  80. --libdir=/usr/lib${LIBDIRSUFFIX} \
  81. --sysconfdir=/etc \
  82. --localstatedir=/var \
  83. --mandir=/usr/man \
  84. --docdir=/usr/doc/$PRGNAM-$VERSION \
  85. --build=$ARCH-slackware-linux
  86. make install-strip docdir=/usr/doc/$PRGNAM-$VERSION DESTDIR=$PKG
  87. # Install init and configuration script
  88. mkdir -p $PKG/etc/rc.d
  89. cat $CWD/rc.$PRGNAM > $PKG/etc/rc.d/rc.$PRGNAM.new
  90. cat $CWD/rc.$PRGNAM.conf > $PKG/etc/rc.d/rc.$PRGNAM.conf.new
  91. chmod 0755 $PKG/etc/rc.d/rc.$PRGNAM.new
  92. # Install pm-utils hook
  93. mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/pm-utils/sleep.d
  94. cat $CWD/51g15hook.sh > $PKG/usr/lib${LIBDIRSUFFIX}/pm-utils/sleep.d/51g15hook
  95. chmod 0755 $PKG/usr/lib${LIBDIRSUFFIX}/pm-utils/sleep.d/51g15hook
  96. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  97. cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
  98. find $PKG/usr/man -type f -exec gzip -9 {} \;
  99. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  100. rm -f $PKG/usr/lib*/*.la
  101. mkdir -p $PKG/install
  102. cat $CWD/slack-desc > $PKG/install/slack-desc
  103. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  104. cd $PKG
  105. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE