blob: 3bee29e27534bd103ff7c621732eac23eea3d5f1 (
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
#!/bin/bash
#
# original script from http://www.slacky.it/download/network/tool/postfix/2.2.10/src/postfix.SlackBuild
# changes by rhatto at riseup.net
#
# TODO: atualizar para o postfix 2.3.0
# slack-required
# arrumar pasta de construcao
#
cat << EOECHO
To build postfix with full capabilities (pcre, mysql, sasl, tls, ldap, vda and
postfix-anon support, first build/install the following packages:
db3 and/or db4
libgpg-error
libgcrypt
courier-authlib
courier-imap
gnutls
cyrus-sasl
openldap-client
Type ENTER you have those built and installed.
EOECHO
read
CWD=`pwd`
if [ -f "/etc/slackbuildrc" ]; then
source /etc/slackbuildrc
fi
if [ -f "~/.slackbuildrc" ]; then
source ~/.slackbuildrc
fi
# default settings
PACKAGE=postfix
ARCH=${ARCH:=x86_64}
VERSION=${VERSION:=2.2.10}
BUILD=${BUILD:=2rha}
SRC_DIR=${SRC:=$CWD}
TMP=${TMP:=/tmp}
REPOS=${REPOS:=$TMP}
if [ "$ARCH" == "x86_64" ]; then
LIBDIR=/usr/lib64
else
LIBDIR=/usr/lib
fi
# general definitions
PACKAGE_EXT="gz"
NAME=$PACKAGE
DOCDIR=/usr/doc/${NAME}-${VERSION}
READMEDIR=${DOCDIR}/README_FILES
HTMLDIR=${DOCDIR}/HTML
MANDIR=/usr/man
TMP="$TMP/$PACKAGE"
PKGDIR=${TMP}/package-${NAME}
SOURCEDIR=${TMP}/${NAME}-${VERSION}
RTOOL="wget"
SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT"
# url definitions
VDA="$PACKAGE-$VERSION-vda.patch.gz"
VDA_URL="http://web.onda.com.br/nadal/postfix/VDA/$VDA"
ANON="postfix-anon-$VERSION.diff"
URL="ftp://ftp.pucpr.br/$PACKAGE/official/$SRC"
SRC_DIR="$SRC_DIR/$PACKAGE"
mkdir -p $SRC_DIR
# download sources
if [ "$RTOOL" == "wget" ]; then
if [ ! -f "$SRC_DIR/$SRC" ]; then
wget "$URL" -O "$SRC_DIR/$SRC"
fi
if [ ! -f "$SRC_DIR/$VDA" ]; then
wget "$VDA_URL" -O "$SRC_DIR/$VDA"
fi
if [ ! -f "$SRC_DIR/$SRC.sig" ]; then
wget "$URL.sig" -O "$SRC_DIR/$SRC.sig"
fi
fi
rm -rf ${PKGDIR}
mkdir -p ${PKGDIR}
cd ${PKGDIR}
# install scripts
if [ -e ${CWD}/script_${NAME}.tgz ]; then
tar zxvf ${CWD}/script_${NAME}.tgz
else
mkdir -v install
fi
sleep 1
if [ -e ${CWD}/slack-desc ];then
cat ${CWD}/slack-desc | grep ^${NAME} > ${PKGDIR}/install/slack-desc
fi
# Extract
cd ${TMP}
rm -rf ${NAME}-${VERSION} ${SOURCEDIR}
tar xzvf $SRC_DIR/${NAME}-$VERSION.tar.gz
# Patch
if [ -f "$SRC_DIR/$VDA" ]; then
gzip -dc $SRC_DIR/$VDA | patch -p0
fi
if [ -f "$CWD/$ANON" ]; then
patch -p0 < $CWD/$ANON
fi
cd ${SOURCEDIR}
sleep 1
# Build
# make -f Makefile.init makefiles \
# 'CCARGS=-DUSE_TLS -DHAS_SSL -I/usr/include/openssl -DHAS_MYSQL -I/usr/include/mysql' \
# 'AUXLIBS=-L/usr/lib -lssl -lcrypto -L/usr/lib/mysql -lmysqlclient -lz -lm'
# db3 explicit
# make -f Makefile.init makefiles CCARGS="-DUSE_SASL_AUTH -I/usr/include/sasl/ -DHAS_MYSQL -I/usr/include/mysql/ -I/usr/include -DHAS_LDAP -DUSE_TLS -I/usr/include/gnutls/ -DHAS_PCRE -I/usr/include -DHAS_DB -I/usr/include/db3" AUXLIBS="-L/usr/lib -lsasl2 -L/usr/lib/mysql/ -lmysqlclient -lz -lm -L/usr/lib -lssl -lcrypto -L/usr/lib -lpcre -L/usr/lib -lldap -L/usr/lib -llber -L/usr/include/db3 -ldb3"
make -f Makefile.init makefiles CCARGS="-DUSE_SASL_AUTH -I/usr/include/sasl/ -DHAS_MYSQL -I/usr/include/mysql/ -I/usr/include -DHAS_LDAP -DUSE_TLS -I/usr/include/gnutls/ -DHAS_PCRE -I/usr/include" AUXLIBS="-L/usr/lib -lsasl2 -L/usr/lib/mysql/ -lmysqlclient -lz -lm -L/usr/lib -lssl -lcrypto -L/usr/lib -lpcre -L/usr/lib -lldap -L/usr/lib -llber"
make
sleep 1
sh postfix-install \
install_root=${PKGDIR} \
tempdir=${SOURCE} \
manpage_directory=${MANDIR} \
readme_directory=${READMEDIR} \
html_directory=${HTMLDIR} \
config_directory=/etc/postfix \
sample_directory=/etc/postfix/sample \
daemon_directory=/usr/libexec/postfix \
command_directory=/usr/sbin/ \
queue_directory=/var/spool/postfix \
sendmail_path=/usr/sbin/sendmail \
newaliases_path=/usr/sbin/newaliases \
mailq_path=/usr/sbin/mailq \
mail_owner=postfix \
setgid_group=postdrop \
-non-interactive
cd ${PKGDIR}/etc/postfix
for a in access aliases canonical header_checks main.cf makedefs.out master.cf postfix-files relocated transport virtual; do
mv ${a} ${a}.new
done
sleep 2
mkdir -p ${PKGDIR}/${DOCDIR}
for file in AUTHORS COPYING HACKING NEWS README TODO INSTALL AAAREADME COMPATIBILITY COPYRIGHT HISTORY LICENSE RELEASE_NOTES* TLS_* US_PATENT_6321267; do
if [ -e "${SOURCEDIR}/${file}" ]; then
cp -v ${SOURCEDIR}/${file} ${PKGDIR}/${DOCDIR}/
fi
done
( cd $PKGDIR
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
)
find ${PKGDIR}/${DOCDIR} ${PKGDIR}/${MANDIR} -type f | xargs gzip -v
find ${PKGDIR}/bin ${PKGDIR}/sbin ${PKGDIR}/usr/bin ${PKGDIR}/usr/sbin -type f | xargs chown -v root.bin
# Build the package:
cd $PKGDIR
#requiredbuilder -v -y -s $CWD $PKGDIR
/sbin/makepkg -l n -c n --prepend $REPOS/${NAME}-${VERSION}-${ARCH}-${BUILD}.tgz
# Clean up the extra stuff:
if [ "$CLEANUP" == "yes" ]; then
rm -rf $TMP
fi
|