aboutsummaryrefslogtreecommitdiff
path: root/dev/libs/cyrus-sasl/cyrus-sasl.SlackBuild
blob: 56eef388a0163df75b77a26018e3a73581eafb7b (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
153
154
155
#!/bin/bash
#
# SlackBuild for Cyrus-SASL-ldap
#
##################################
## Creator: Stefano Stabellini  ##
## stefano@stabellini.net       ##
## http://www.stabellini.net    ##
##################################
#
# small changes by rhatto
#

if [ -s "slack-required" ]; then
  echo Recomended and required packages for building cyrus-sasl are:
  cat slack-required | sed -e 's/^/\t/'
  if [ "$INTERACT" != "no" ]; then
    echo If you dont have those installed, press Ctrl-C. Otherwise, hit ENTER.
    read crap
#  else
#    echo Sleeping 3 seconds...
#    sleep 3
  fi
fi

CWD="`pwd`"

if [ -f ~/.slackbuildrc ]; then
  source ~/.slackbuildrc
elif [ -f /etc/slackbuildrc ]; then
  source /etc/slackbuildrc
fi

PACKAGE="cyrus-sasl"
VERSION=${VERSION:=2.1.22}
ARCH=${ARCH:=i486}
BUILD=${BUILD:=1rha}
TMP=${TMP:=/tmp}
SRC_DIR=${SRC:=$CWD}
REPOS=${REPOS:=$TMP}

# -------  error codes for createpkg  --------------
ERROR_WGET=31;      ERROR_MAKE=32;      ERROR_INSTALL=33
ERROR_MD5=34;       ERROR_CONF=35;      ERROR_HELP=36
ERROR_TAR=37;       ERROR_MKPKG=38;     ERROR_GPG=39
ERROR_PATCH=40

if [ "$ARCH" == "x86_64" ]; then
  LIBDIR=/usr/lib64
else
  LIBDIR=/usr/lib
fi

RTOOL="wget"
PACKAGE_EXT="gz"
SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT"
KEY="ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/KEYS"
SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT"
URL="ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/$SRC"

if [ ! -d $TMP ]; then
  mkdir -p $TMP # location to build the source
fi

SRC_DIR="$SRC_DIR/$PACKAGE"
mkdir -p $SRC_DIR

if [ "$RTOOL" == "wget" ] && [ ! -f "$SRC_DIR/$SRC" ]; then
  wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET
  wget "$URL.sig" -O "$SRC_DIR/$SRC.sig" || exit $ERROR_WGET
fi

if [ ! -f "$SRC_DIR/$PACKAGE-key.asc" ]; then
  wget "$KEY" -O "$SRC_DIR/$PACKAGE-key.asc" && gpg --import $SRC_DIR/$PACKAGE-key.asc || exit $ERROR_WGET
fi

gpg --verify $SRC_DIR/$SRC.sig $SRC_DIR/$SRC || exit $ERROR_GPG
sleep 3

if [ "$ARCH" = "i386" ]; then
  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
elif [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2"
fi

TMP="$TMP/$PACKAGE"
PKG="$TMP/package-$PACKAGE"
rm -rf $TMP
mkdir -p $TMP
cd $TMP

mkdir -p $PKG/var/state/saslauthd
echo "+=====================+"
echo "| cyrus-sasl-$VERSION |"
echo "+=====================+"
cd $TMP
rm -rf cyrus-sasl-$VERSION
tar xvf $SRC_DIR/cyrus-sasl-$VERSION.tar.gz || exit $ERROR_TAR
cd cyrus-sasl-$VERSION
chown -R root.root .
find . -perm 777 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 700 -exec chmod 755 {} \;
find . -perm 744 -exec chmod 755 {} \;
find . -perm 666 -exec chmod 644 {} \;
find . -perm 664 -exec chmod 644 {} \;
find . -perm 600 -exec chmod 644 {} \;
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
#./configure --enable-login --enable-plain --enable-anon --enable-digest --with-static-sasl --with-bdb-libdir=/usr/lib \
#            --with-bdb-incdir=/usr/include/db4 --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --enable-ldap \
#            --with-ldap=/usr/libexec/openldap --with-authdaemond=/usr/sbin/authdaemond
./configure --prefix=/usr --sysconfdir=/etc --with-authdaemond=/usr/sbin/authdaemond --libdir=$LIBDIR || exit $ERROR_CONF
make || exit $ERROR_MAKE
make install DESTDIR=$PKG || exit $ERROR_INSTALL
strip $PKG/usr/sbin/*
chown -R root.bin $PKG/usr/bin
chown -R root.bin $PKG/usr/sbin
gzip -9 $PKG/usr/man/man3/*
gzip -9 $PKG/usr/man/cat8/*
gzip -9 $PKG/usr/man/man8/*
mkdir -p $PKG/usr/doc/cyrus-sasl-$VERSION
cp AUTHORS $PKG/usr/doc/cyrus-sasl-$VERSION
cp COPYRIGHT $PKG/usr/doc/cyrus-sasl-$VERSION
cp LICENSE $PKG/usr/doc/cyrus-sasl-$VERSION
cp HISTORY $PKG/usr/doc/cyrus-sasl-$VERSION
cp doc/* $PKG/usr/doc/cyrus-sasl-$VERSION
cp ChangeLog $PKG/usr/doc/cyrus-sasl-$VERSION
cp NEWS $PKG/usr/doc/cyrus-sasl-$VERSION
cp README $PKG/usr/doc/cyrus-sasl-$VERSION
cp INSTALL $PKG/usr/doc/cyrus-sasl-$VERSION
cp README $PKG/usr/doc/cyrus-sasl-$VERSION
mkdir -p $PKG/etc/rc.d
cat $CWD/rc.saslauthd.new > $PKG/etc/rc.d/rc.saslauthd.new
mkdir -p $PKG/install
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
#cat $CWD/slack-conflicts > $PKG/install/slack-conflicts
#cat $CWD/slack-required > $PKG/install/slack-required
#requiredbuilder $PKG
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

makepkg -l y -c n $REPOS/$PACKAGE-$VERSION-$ARCH-$BUILD.tgz || exit $ERROR_MKPKG

if [ "$CLEANUP" == "yes" ]; then
  rm -rf $TMP
fi