cwiid.SlackBuild 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #!/bin/bash
  2. # Slackware build script for cwiid
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20220410 bkw: BUILD=2
  6. # - *really* fix permissions on header.
  7. # - re-add --disable-ldconfig. configure claims it's unsupported, but
  8. # it actually works.
  9. # 20210910 bkw:
  10. # - Upgrade to 0.6.91_2 (Debian's 0.6.91-2).
  11. # - Actually apply SLKCFLAGS.
  12. # - Use icon, .desktop, lswm.1 from Debian tarball instead of
  13. # including in SBo git.
  14. # 20170306 bkw:
  15. # - Add --disable-ldconfig
  16. # 20130318 bkw:
  17. # - Upgraded from 0.6.00 to 0.6.00+svn201
  18. # - Added init script
  19. # - Added lswm man page
  20. # - Added .desktop and icon
  21. # - Removed bluez4 API patch (no longer needed)
  22. # - Fixed permissions of config files and header
  23. # - Added ir_fps and nunchuk_kb plugins
  24. # https://deb.debian.org/debian/pool/main/c/cwiid/cwiid_0.6.91-2.debian.tar.xz
  25. # https://deb.debian.org/debian/pool/main/c/cwiid/cwiid_0.6.91.orig.tar.xz
  26. cd $(dirname $0) ; CWD=$(pwd)
  27. PRGNAM=cwiid
  28. VERSION=${VERSION:-0.6.91_2}
  29. BUILD=${BUILD:-2}
  30. TAG=${TAG:-_SBo}
  31. PKGTYPE=${PKGTYPE:-tgz}
  32. if [ -z "$ARCH" ]; then
  33. case "$( uname -m )" in
  34. i?86) ARCH=i586 ;;
  35. arm*) ARCH=arm ;;
  36. *) ARCH=$( uname -m ) ;;
  37. esac
  38. fi
  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" = "i586" ]; then
  47. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  48. LIBDIRSUFFIX=""
  49. elif [ "$ARCH" = "i686" ]; then
  50. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  51. LIBDIRSUFFIX=""
  52. elif [ "$ARCH" = "x86_64" ]; then
  53. SLKCFLAGS="-O2 -fPIC"
  54. LIBDIRSUFFIX="64"
  55. else
  56. SLKCFLAGS="-O2"
  57. LIBDIRSUFFIX=""
  58. fi
  59. set -e
  60. TARVER=${VERSION/_*}
  61. DEBVER=${VERSION/*_}
  62. LIBDIR=/usr/lib$LIBDIRSUFFIX
  63. PKGLIB=$PKG/$LIBDIR
  64. rm -rf $PKG
  65. mkdir -p $TMP $PKG/usr $PKG/etc $OUTPUT
  66. cd $TMP
  67. rm -rf $PRGNAM
  68. tar xvf $CWD/${PRGNAM}_$TARVER.orig.tar.xz
  69. cd $PRGNAM
  70. tar xvf $CWD/${PRGNAM}_$TARVER-$DEBVER.debian.tar.xz
  71. chown -R root:root .
  72. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  73. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  74. # this patch is debian-specific (calls dpkg):
  75. rm -f debian/patches/python-setup.py.patch
  76. for i in $( cat debian/patches/series ); do
  77. [ -e $i ] && patch -p1 < debian/patches/$i
  78. done
  79. # re-enable this when needed
  80. #patch -p1 < $CWD/python310.patch
  81. autoreconf -if
  82. ./configure \
  83. --prefix=/usr \
  84. --libdir=$LIBDIR \
  85. --sysconfdir=/etc \
  86. --localstatedir=/var \
  87. --docdir=/usr/doc/$PRGNAM-$VERSION \
  88. --mandir=/usr/man \
  89. --disable-ldconfig \
  90. --build=$ARCH-slackware-linux
  91. # configure script ignores CFLAGS in the env. Can't use CFLAGS
  92. # nor DEBUGFLAGS with make... sneak them in this way.
  93. make WARNFLAGS="-Wall $SLKCFLAGS"
  94. make install DESTDIR=$PKG
  95. # no install-strip...
  96. strip $PKG/usr/bin/* \
  97. $PKGLIB/*.so.?.? \
  98. $PKGLIB/$PRGNAM/plugins/*.so \
  99. $PKGLIB/python*/site-packages/*.so
  100. # Header and configs get installed +x, fix
  101. chmod 644 $PKG/etc/cwiid/wminput/* $PKG/usr/include/cwiid.h
  102. # Remove static library, configure doesn't accept --disable-static
  103. rm -f $PKGLIB/libcwiid.a
  104. gzip -9 $PKG/usr/man/man1/*
  105. # Use Debian's extra man page, desktop file, icons.
  106. gzip -9c debian/lswm.1 > $PKG/usr/man/man1/lswm.1.gz
  107. mkdir -p $PKG/usr/share/pixmaps
  108. cp -a debian/icons/*.xpm $PKG/usr/share/pixmaps
  109. mkdir -p $PKG/usr/share/applications
  110. sed -e '/^Icon/s,=.*,=/usr/share/pixmaps/wmgui.xpm,' \
  111. -e '/^Categories/s,$,;Settings;,' \
  112. debian/menus/wmgui.desktop > $PKG/usr/share/applications/wmgui.desktop
  113. # init script written for this build
  114. mkdir -p $PKG/etc/rc.d/
  115. cat $CWD/rc.cwiid.new > $PKG/etc/rc.d/rc.cwiid.new
  116. cat $CWD/rc.cwiid.conf.new > $PKG/etc/rc.d/rc.cwiid.conf.new
  117. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  118. cp -a AUTHORS COPYING ChangeLog NEWS README $PKG/usr/doc/$PRGNAM-$VERSION
  119. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  120. mkdir -p $PKG/install
  121. cat $CWD/slack-desc > $PKG/install/slack-desc
  122. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  123. cd $PKG
  124. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE