Commit c7c45e5b authored by Natanael Copa's avatar Natanael Copa

extra/postfix: support for dynamic maps: ldap mysql pcre pgsql

parent 1701a043
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=postfix
pkgver=2.5.6
pkgrel=2
pkgrel=4
pkgdesc="Secure and fast drop-in replacement for Sendmail (MTA)"
url="http://www.postfix.org/"
license="IPL-1"
depends="db pcre openssl"
makedepends="db-dev pcre-dev openssl-dev"
makedepends="db-dev pcre-dev openssl-dev postgresql-dev mysql-dev openldap-dev"
install="$pkgname.pre-install $pkgname.post-install"
subpackages="$pkgname-doc"
subpackages="$pkgname-doc $pkgname-ldap $pkgname-mysql $pkgname-pcre
$pkgname-pgsql"
source="ftp://ftp.porcupine.org/mirrors/$pkgname-release/official/$pkgname-$pkgver.tar.gz
$pkgname.initd
$install
postfix-2.5.5-dynamicmaps.patch
dynamicmaps.cf
postfix-ldap.post-install
postfix-mysql.post-install
postfix-pcre.post-install
postfix-pgsql.post-install
"
# the dynamic maps patch is taken from mandriva
# http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/postfix/current/SOURCES
build () {
cd "$srcdir/$pkgname-$pkgver"
for i in ../*.patch; do
msg "Applying $i..."
patch -p1 < $i || return 1
done
cp ../dynamicmaps.cf conf/
sed -i -e "s|#define HAS_NIS|//#define HAS_NIS|g" \
-e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/postfix/aliases|" \
src/util/sys_defs.h || return 1
sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || return 1
# needed for dynamic maps.
local ccargs="-DHAS_DLOPEN -DHAS_SHL_LOAD"
local auxlibs="$LDFLAGS -lpthread -lcrypt"
# pcre
ccargs="$ccargs -DHAS_PCRE"
#auxlibs="$auxlibs -lpcre"
# ssl
ccargs="$ccargs -DUSE_TLS"
auxlibs="$auxlibs -lssl -lcrypto"
# dovecot-sasl
ccargs="$ccargs -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
# postgresql
ccargs="$ccargs -DHAS_PGSQL -I$(pg_config --includedir)"
#auxlibs="$auxlibs -lpq -L$(pg_config --libdir)"
# mysql
ccargs="$ccargs -DHAS_MYSQL $(mysql_config --include)"
#auxlibs="$auxlibs -lmysqlclient -lm -lz"
# compile
make DEBUG="" \
OPT="$CFLAGS" \
CCARGS="-DHAS_PCRE -DUSE_TLS -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\"" \
AUXLIBS="$LDFLAGS -lpcre -lcrypt -lpthread -lssl -lcrypto" \
CCARGS="$ccargs" \
AUXLIBS="$auxlibs" \
makefiles || return 1
make OPT="$CFLAGS" || return 1
sh postfix-install \
-non-interactive \
for i in lib/*.a; do
j=${i#lib/lib}
ln -s ${i#lib/} lib/libpostfix-${j%.a}.so.1
done
# install to pkgdir
LD_LIBRARY_PATH=$PWD/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} make \
non-interactive-package \
install_root="$pkgdir" \
config_directory=/usr/share/doc/$pkgname/defaults \
readme_directory=/usr/share/doc/$pkgname/readme \
manpage_directory=/usr/share/man \
|| return 1
install -d "$pkgdir"/usr/lib
for i in lib/*.a; do
j=${i#lib/lib}
install $i "$pkgdir"/usr/lib/libpostfix-${j%.a}.so.1 || return 1
done
# fix permissions
for i in postdrop postqueue; do
chgrp postdrop "$pkgdir"/usr/sbin/$i
chmod g+s "$pkgdir"/usr/sbin/$i
......@@ -51,7 +105,30 @@ build () {
install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE
}
_mv_dict() {
local m=$1
shift
pkgdesc="$m map support for postfix"
depends="postfix uclibc $@"
install="postfix-${m}.post-install"
mkdir -p "$subpkgdir"/usr/lib/postfix
mv "$pkgdir"/usr/libexec/postfix/dict_${m}.so \
"$subpkgdir"/usr/lib/postfix/
}
ldap() { _mv_dict ldap libldap; }
mysql() { _mv_dict mysql libmysqlclient;}
pcre() { _mv_dict pcre pcre; }
pgsql() { _mv_dict pgsql libpq; }
md5sums="ec2cb63b53f5f36c3ca91da8f3bc9407 postfix-2.5.6.tar.gz
8416354d402f3be288fa98b60af86240 postfix.initd
2bfc3864183694e5484ac073bb0cb7ef postfix.pre-install
0064d45c2c8a46c374b55c4abc46cfb2 postfix.post-install"
0064d45c2c8a46c374b55c4abc46cfb2 postfix.post-install
e71b0c501150cba4d30aef52a6fb542c postfix-2.5.5-dynamicmaps.patch
0efff9b4bb493ad2ff0b9915cb244d14 dynamicmaps.cf
2ebe51a882eb9d6d7866583eb6af3969 postfix-ldap.post-install
2ebe51a882eb9d6d7866583eb6af3969 postfix-mysql.post-install
2ebe51a882eb9d6d7866583eb6af3969 postfix-pcre.post-install
2ebe51a882eb9d6d7866583eb6af3969 postfix-pgsql.post-install"
# Postfix dynamic maps configuration file.
#
# The first match found is the one that is used. Wildcards are not
# supported.
#
#type location of .so file name of open function
#==== ============================= =====================
#ldap /usr/lib/postfix/dict_ldap.so dict_ldap_open
#mysql /usr/lib/postfix/dict_mysql.so dict_mysql_open
#pcre /usr/lib/postfix/dict_pcre.so dict_pcre_open
#pgsq /usr/lib/postfix/dict_pgsql.so dict_pgsql_open
# apk tools will manage the lines below
## AUTO BEGIN ##
## AUTO END ##
This diff is collapsed.
#!/bin/sh
# update the dynamicmaps.cf
conf=/etc/postfix/dynamicmaps.cf
sed -i -e '/\#\# AUTO BEGIN/,/\#\# AUTO END/d' $conf
(
echo '## AUTO BEGIN ##'
if cd /usr/lib/postfix/; then
for i in *.so; do
m=${i#dict_}
m=${m%.so}
echo -e "$m\t/usr/lib/postfix/$i\tdict_${m}_open"
done
fi
echo '## AUTO END ##'
) >> $conf
postfix-ldap.post-install
\ No newline at end of file
postfix-ldap.post-install
\ No newline at end of file
postfix-ldap.post-install
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment