aboutsummaryrefslogtreecommitdiff
path: root/misc/cwiid/cwiid.SlackBuild
blob: 7d19cef3aefa87b6b903ab2d1b08e160e7511038 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/bin/bash

# Slackware build script for cwiid

# Written by B. Watson (yalhcru@gmail.com)

# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.

# 20210910 bkw:
# - Upgrade to 0.6.91_2 (Debian's 0.6.91-2).
# - Actually apply SLKCFLAGS.
# - Use icon, .desktop, lswm.1 from Debian tarball instead of
#   including in SBo git.

# 20170306 bkw:
# - Add --disable-ldconfig

# 20130318 bkw:
# - Upgraded from 0.6.00 to 0.6.00+svn201
# - Added init script
# - Added lswm man page
# - Added .desktop and icon
# - Removed bluez4 API patch (no longer needed)
# - Fixed permissions of config files and header
# - Added ir_fps and nunchuk_kb plugins

# https://deb.debian.org/debian/pool/main/c/cwiid/cwiid_0.6.91-2.debian.tar.xz
# https://deb.debian.org/debian/pool/main/c/cwiid/cwiid_0.6.91.orig.tar.xz

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=cwiid
VERSION=${VERSION:-0.6.91_2}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

TARVER=${VERSION/_*}
DEBVER=${VERSION/*_}

LIBDIR=/usr/lib$LIBDIRSUFFIX
PKGLIB=$PKG/$LIBDIR

rm -rf $PKG
mkdir -p $TMP $PKG/usr $PKG/etc $OUTPUT
cd $TMP
rm -rf $PRGNAM
tar xvf $CWD/${PRGNAM}_$TARVER.orig.tar.xz
cd $PRGNAM
tar xvf $CWD/${PRGNAM}_$TARVER-$DEBVER.debian.tar.xz
chown -R root:root .
find -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+

# this patch is debian-specific (calls dpkg):
rm -f debian/patches/python-setup.py.patch

for i in $( cat debian/patches/series ); do
  [ -e $i ] && patch -p1 < debian/patches/$i
done

patch -p1 < $CWD/python310.patch

autoreconf -if

./configure \
  --prefix=/usr \
  --libdir=$LIBDIR \
  --sysconfdir=/etc \
  --localstatedir=/var \
  --docdir=/usr/doc/$PRGNAM-$VERSION \
  --mandir=/usr/man \
  --build=$ARCH-slackware-linux

# configure script ignores CFLAGS in the env. Can't use CFLAGS
# nor DEBUGFLAGS with make... sneak them in this way.
make WARNFLAGS="-Wall $SLKCFLAGS"
make install DESTDIR=$PKG

# no install-strip...
strip $PKG/usr/bin/* \
      $PKGLIB/*.so.?.? \
      $PKGLIB/$PRGNAM/plugins/*.so \
      $PKGLIB/python*/site-packages/*.so

# Header gets installed +x, fix
chmod 644 $PKG/etc/cwiid/wminput/*

# Remove static library, configure doesn't accept --disable-static
rm -f $PKGLIB/libcwiid.a

gzip -9 $PKG/usr/man/man1/*

# Use Debian's extra man page, desktop file, icons.
gzip -9c debian/lswm.1 > $PKG/usr/man/man1/lswm.1.gz

mkdir -p $PKG/usr/share/pixmaps
cp -a debian/icons/*.xpm $PKG/usr/share/pixmaps

mkdir -p $PKG/usr/share/applications
sed -e '/^Icon/s,=.*,=/usr/share/pixmaps/wmgui.xpm,' \
    -e '/^Categories/s,$,;Settings;,' \
    debian/menus/wmgui.desktop > $PKG/usr/share/applications/wmgui.desktop

# init script written for this build
mkdir -p $PKG/etc/rc.d/
cat $CWD/rc.cwiid.new > $PKG/etc/rc.d/rc.cwiid.new
cat $CWD/rc.cwiid.conf.new > $PKG/etc/rc.d/rc.cwiid.conf.new

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING ChangeLog NEWS README $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE