summaryrefslogtreecommitdiff
path: root/system/opensc-ceres/opensc-ceres.SlackBuild
blob: 2e2fafb91dea27ac2418713b160040bd91e6cf0d (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
#!/bin/sh

## Written by Daniel R. <danielrodriguez.es@gmail.com>
 
# Based on scripts by the SlackBuilds.org project

PRGNAM=opensc-ceres
VERSION=2.1.1
ARCH=${ARCH:-i386}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

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

if [ "$ARCH" = "x86_64" ]; then
  TARGET="x86_64"
else
  TARGET="x86"
fi

if [ "$TARGET" = "x86" ]; then
  SRCFILE=Debian_Lenny_32bits.zip
  SRCDEB=${PRGNAM}_$(echo $VERSION | tr "_" "-")_i386.deb
elif [ "$TARGET" = "x86_64" ]; then
  SRCFILE=Debian_Lenny_64bits.zip
  SRCDEB=${PRGNAM}_$(echo $VERSION | tr "_" "-")_amd64.deb
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $PKG

unzip -j $CWD/$SRCFILE */$SRCDEB
ar x $SRCDEB data.tar.gz 
tar xzf data.tar.gz 
rm $SRCDEB data.tar.gz

if [ "$TARGET" = "x86_64" ]; then
  mv $PKG/usr/lib $PKG/usr/lib64
  sed -i "s%= /usr/lib/%= /usr/lib64/%" \
    $PKG/usr/share/$PRGNAM/opensc.conf.ceres
  sed -i "s%libdir=\${exec_prefix}/lib%libdir=\${exec_prefix}/lib64%" \
    $PKG/usr/lib64/pkgconfig/*.pc
  sed -i "s%/usr/lib%/usr/lib64%g" \
    $PKG/usr/lib64/*.la
fi

mkdir -p $PKG/etc
cp $PKG/usr/share/$PRGNAM/opensc.conf.ceres $PKG/etc/opensc.conf.new

mv $PKG/usr/share/doc $PKG/usr
mv $PKG/usr/doc/$PRGNAM $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
chown -R root:root .
find . -type d -exec chmod 755 {} \;
chmod -R u+rw,go+r-w,a-s .

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