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

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

PRGNAM=opensc-ceres
VERSION=2.3.2
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

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

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

if [ "$ARCH" = "x86_64" ]; then
  TARGET="x86_64"
elif [ "$ARCH" = "i386" ]; then
  TARGET="x86"
else
  printf "$ARCH is not supported.\n"
  exit 1
fi

if [ "$TARGET" = "x86" ]; then
  SRCFILE=Debian_Lenny_32bits.zip
  SRCDEB=${PRGNAM}_${VERSION}_i386.deb
elif [ "$TARGET" = "x86_64" ]; then
  SRCFILE=Debian_Lenny_64bits.zip
  SRCDEB=${PRGNAM}_${VERSION}-1_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}