summaryrefslogtreecommitdiff
path: root/libraries/barry/barry.SlackBuild
blob: cc9fa1a78beac58fc3199b9a00b54062eea198ed (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
#!/bin/sh -e

## Barry is a GPL C++ library for interfacing with the RIM BlackBerry
## Handheld. It comes with a command line tool for exploring the device
## and a GUI for making quick backups. This project's goal is to create
## a fully functional syncing mechanism on Linux.
## http://sourceforge.net/projects/barry/
##
## Written by "Vincent Batts <vbatts@batts.mine.nu>"
##
## opensync consideration added thanks
##   to "Heinz Wiesinger <HMWiesinger@gmx.at>"

# Modified by Robby Workman <rworkman@slackbuilds.org>

PRGNAM=barry
VERSION=0.14
ARCH=${ARCH:-i486}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

# If you want to use a group other than "plugdev" for barry,
# specify it on the command line as BARRY_GROUP - for example:
#   BARRY_GROUP=barry ./barry.SlackBuild
BARRY_GROUP=${BARRY_GROUP:-plugdev}

# Enable opensync-plugin?
OPENSYNC=${OPENSYNC:-no}

if [ "$OPENSYNC" = "no" ]; then
  opensync_opt="dis"
else
  opensync_opt="en"
fi

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

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R a-s,u+rw,go+r-w .

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --mandir=/usr/man \
  --disable-static \
  --${opensync_opt}able-opensync-plugin \
  --build=$ARCH-slackware-linux

make || exit 1
make install DESTDIR=$PKG || exit 1

( 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
)

( cd $PKG/usr/man
  find . -type f -exec gzip -9 {} \;
  for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
)

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README TODO COPYING AUTHORS NEWS ChangeLog \
  $PKG/usr/doc/$PRGNAM-$VERSION

mkdir -p $PKG/lib/udev/rules.d/
sed s/SYSFS/ATTR/g udev/10-blackberry.rules > \
  $PKG/lib/udev/rules.d/10-blackberry.rules
sed -e s/SYSFS/ATTR/g udev/99-barry-perms > \
  $PKG/lib/udev/rules.d/99-barry-permissions.rules
if [ "$BARRY_GROUP" != "barry" ]; then
  sed -i "s/GROUP=\"barry\""/GROUP=\"$BARRY_GROUP\"/ \
    $PKG/lib/udev/rules.d/99-barry-permissions.rules
fi

mkdir -p $PKG/etc/modprobe.d
echo "blacklist berry-charge" > $PKG/etc/modprobe.d/barry

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

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