summaryrefslogtreecommitdiff
path: root/extra/source/brltty/brltty.SlackBuild
blob: c58959746bb2413c5bf585d0daf4bf05d58cf368 (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
#!/bin/sh
# Set initial variables:
CWD=`pwd`
if [ "$TMP" = "" ]; then
  TMP=/tmp
fi
if [ ! -d $TMP ]; then
  mkdir -p $TMP # location to build the source
fi
PKG=/tmp/package-brltty

VERSION=4.0
ARCH=${ARCH:-x86_64}
BUILD=${BUILD:-1}

if [ "$ARCH" = "x86_64" ]; then
  LIBDIRSUFFIX="64"
else
  LIBDIRSUFFIX=""
fi

rm -rf $PKG
mkdir -p $PKG
cd $TMP
rm -rf brltty-$VERSION
tar xf $CWD/brltty-$VERSION.tar.?z* || exit 1
cd brltty-$VERSION

sh autogen

chown -R root:root .
find . -perm 775 -exec chmod 755 {} \;
find . -perm 700 -exec chmod 755 {} \;
find . -perm 744 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;
find . -perm 600 -exec chmod 644 {} \;
./configure \
  --prefix=/usr \
  --bindir=/bin \
  --sbindir=/sbin \
  --libdir=/lib${LIBDIRSUFFIX} \
  --infodir=/usr/info \
  --mandir=/usr/man \
  --sysconfdir=/etc \
  --build=$ARCH-slackware-linux
make -j2 || exit 1
make install INSTALL_ROOT=$PKG || exit 1
chmod 755 $PKG/bin/* $PKG/lib${LIBDIRSUFFIX}/brltty/*

( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)

mkdir -p $PKG/usr/doc/brltty-$VERSION
cp -a \
  README* COPYING* \
  Documents/{Manual-*,TODO,CONTRIBUTORS,HISTORY,README.*} \
  $PKG/usr/doc/brltty-$VERSION
cat Documents/ChangeLog | head -n 150 > $PKG/usr/doc/brltty-$VERSION/ChangeLog
( cd $PKG/usr/doc/brltty-$VERSION
  find . -name "Makefile*" -exec rm -f {} \;
  find . -name "*.sgml" -exec rm -f {} \;
  find . -size 0 -type f -exec rm -f {} \;
)

gzip -9 $PKG/usr/man/man?/*.?

mkdir -p $PKG/etc
cp -a Documents/brltty.conf $PKG/etc/brltty.conf.new

mkdir -p $PKG/install
# Write out the doinst.sh:
cat << EOF > $PKG/install/doinst.sh
config() {
  NEW="\$1"
  OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r \$OLD ]; then
    mv \$NEW \$OLD
  elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then # toss the redundant copy
    rm \$NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}
config etc/brltty.conf.new

EOF

cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
makepkg -l y -c n ../brltty-$VERSION-$ARCH-$BUILD.txz