aboutsummaryrefslogtreecommitdiffstats
path: root/main/postfix/APKBUILD
blob: 6c782ccfc8835b33df81aa0c1ede2a7a89a53285 (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
188
189
190
191
192
193
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=postfix
pkgver=2.11.3
pkgrel=0
pkgdesc="Secure and fast drop-in replacement for Sendmail (MTA)"
url="http://www.postfix.org/"
arch="all"
license="IPL-1"
depends=
makedepends="db-dev pcre-dev openssl-dev postgresql-dev mysql-dev openldap-dev
	cyrus-sasl-dev perl file sqlite-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-ldap $pkgname-mysql $pkgname-pcre
	$pkgname-pgsql $pkgname-sqlite"
options="suid"
source="ftp://ftp.porcupine.org/mirrors/$pkgname-release/official/$pkgname-$pkgver.tar.gz
	$pkgname.initd
	dynamic-maps.patch
	no-glibc.patch
	dynamicmaps.cf
	postfix-ldap.post-install
	postfix-mysql.post-install
	postfix-pcre.post-install
	postfix-pgsql.post-install
	postfix-sqlite.post-install
	"

# the dynamic maps patch is taken from mandriva
# http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/postfix/current/SOURCES

_shared_libs() {
	file --mime-type "$@" | \
		awk -F: '$2 ~ /sharedlib/ {print $1}'
}

prepare() {
	cd "$srcdir/$pkgname-$pkgver"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	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
}

build () {
	cd "$srcdir/$pkgname-$pkgver"
	# needed for dynamic maps.
	local ccargs="-DHAS_DLOPEN -DHAS_SHL_LOAD"
	local auxlibs="$LDFLAGS -lpthread -lcrypt"

	ccargs="$ccargs -DDEF_DAEMON_DIR=\\\"/usr/lib/postfix\\\""

	# 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\\\""

	# cyrus sasl
	ccargs="$ccargs	-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl"
	auxlibs="$auxlibs -lsasl2"

	# 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"

	# ldap
	ccargs="$ccargs -DHAS_LDAP"
	#auxlibs="$auxlibs -lldap -llber"

	# sqlite
	ccargs="$ccargs -DHAS_SQLITE"

	# compile
	make DEBUG="" \
		OPT="$CFLAGS" \
		CCARGS="$ccargs" \
		AUXLIBS="$auxlibs" \
		makefiles || return 1

	make -j1 OPT="$CFLAGS" || return 1
}

package() {
	cd "$srcdir/$pkgname-$pkgver"
	for i in $(_shared_libs 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 $(_shared_libs 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
	done

	mkdir -p "$pkgdir"/etc/postfix
	mv "$pkgdir"/usr/share/doc/$pkgname/defaults/*.cf \
		"$pkgdir"/usr/share/doc/$pkgname/defaults/aliases \
		"$pkgdir"/usr/share/doc/$pkgname/defaults/canonical \
		"$pkgdir"/usr/share/doc/$pkgname/defaults/generic \
		"$pkgdir"/usr/share/doc/$pkgname/defaults/header_checks \
		"$pkgdir"/usr/share/doc/$pkgname/defaults/relocated \
		"$pkgdir"/usr/share/doc/$pkgname/defaults/transport \
		"$pkgdir"/usr/share/doc/$pkgname/defaults/virtual \
		"$pkgdir"/etc/postfix/ || return 1

	install -d -o postfix -g postfix "$pkgdir"/var/spool/postfix
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE
	chown postfix "$pkgdir"/var/spool/postfix/* "$pkgdir"/var/lib/postfix \
		|| return 1
	chgrp postdrop "$pkgdir"/var/spool/postfix/maildrop \
		"$pkgdir"/var/spool/postfix/public || return 1
}

_mv_dict() {
	local m=$1
	shift
	pkgdesc="$m map support for postfix"
	depends=
	install="postfix-${m}.post-install"
	mkdir -p "$subpkgdir"/usr/lib/postfix
	mv "$pkgdir"/usr/lib/postfix/dict_${m}.so \
		"$subpkgdir"/usr/lib/postfix/
}

ldap()  { _mv_dict ldap ; }
mysql() { _mv_dict mysql ;}
pcre()  { _mv_dict pcre ; }
pgsql() { _mv_dict pgsql ; }
sqlite() { _mv_dict sqlite ; }

md5sums="c3f0f51d8865559b40e9350eb3816011  postfix-2.11.3.tar.gz
d773f01dcc965d219a8a37b88f89c5bf  postfix.initd
c03239969df760e2a74c4e048ce514a1  dynamic-maps.patch
cd39f4c05a6462c121a3ab3612d6a5bd  no-glibc.patch
442efd1a95b0c061dfb8ab75456e0f24  dynamicmaps.cf
2ebe51a882eb9d6d7866583eb6af3969  postfix-ldap.post-install
2ebe51a882eb9d6d7866583eb6af3969  postfix-mysql.post-install
fd16ec00b60269c4ede4a0a0a514cefa  postfix-pcre.post-install
2ebe51a882eb9d6d7866583eb6af3969  postfix-pgsql.post-install
2ebe51a882eb9d6d7866583eb6af3969  postfix-sqlite.post-install"
sha256sums="04e5146e6e56261baae9f63c590348a4b12ce22d3d46260e26e97233f40802c3  postfix-2.11.3.tar.gz
6b3fe71542ab783c7adddbfa161f7e2dcb2325913ad5d611ca56f730876ce4ab  postfix.initd
cfa5000955f1941082567a9e50764f52851f33c468f534c0431f6932d73e8ffb  dynamic-maps.patch
ad2d6b6889ea2e8b1eab05c87f153a1a2ce82e3a877e1235b595a990266dfc04  no-glibc.patch
2041ff6cd71fe16f3d75603ff40d90a08a8b97f0883e1de1d58563ab1521b5ea  dynamicmaps.cf
fbd75ef31a5d78d5f82b67e08e5bf5ada380afa58a69ef4a07d756c47b3bb498  postfix-ldap.post-install
fbd75ef31a5d78d5f82b67e08e5bf5ada380afa58a69ef4a07d756c47b3bb498  postfix-mysql.post-install
8dbe9339aeac4932e5ee383bfe497512607cd819fe67c38cbf7273118c4b0f71  postfix-pcre.post-install
fbd75ef31a5d78d5f82b67e08e5bf5ada380afa58a69ef4a07d756c47b3bb498  postfix-pgsql.post-install
fbd75ef31a5d78d5f82b67e08e5bf5ada380afa58a69ef4a07d756c47b3bb498  postfix-sqlite.post-install"
sha512sums="b371f1099b1e6e653242a9b4f3812b38b6a9145a4f4c1c9fa5bef6a02e1a9a8f4ec2979c8946f6c873e303ac54f5dd1a84b934eeea8169e2ce187028c36c857e  postfix-2.11.3.tar.gz
c179534a7243bcf8c19b5367a703b54fcc88b7587ce7ef07ec111cfe00053779eed23b3ccda81eb20059599b857cae0a57cc02613526209f3dd966d65abd9a3f  postfix.initd
1a92089410691d400953472be522c872be1456521203560a4feadb632cb85cfacaf3721108d62111873fb23478976b8a949077734cf801374ca58bcaf363922c  dynamic-maps.patch
4d2624ee98f798f8818789433b05cce4ee337750e93ee49c4074bc0c741c678d426c42bd09088596d5010f0bc680ec3b5aed630acfd3d5513512f6a6af15b61c  no-glibc.patch
49b8205166f575e5fb9bdaaaaa042dc1be9b556331bf659a55b1115c9fa48486896941f18ca9fb633dd54675079f29a9d69d53c214170731c2127862456ec90b  dynamicmaps.cf
b35931865eb15b5cd6a2b95bbf486cd064d1447eac1a91d507a7d23155229ac7e7fdf6b8518e663c5c7072b201786c72aead0d95e94d8708a9b5a7c3f37be138  postfix-ldap.post-install
b35931865eb15b5cd6a2b95bbf486cd064d1447eac1a91d507a7d23155229ac7e7fdf6b8518e663c5c7072b201786c72aead0d95e94d8708a9b5a7c3f37be138  postfix-mysql.post-install
845871cacebb8c4d2073783db06a704c993d258f3113ac6c416e742f87649e8eababceb5f8426849256e7815c492e24654468ee76e7607d91b506e8cba78f2ed  postfix-pcre.post-install
b35931865eb15b5cd6a2b95bbf486cd064d1447eac1a91d507a7d23155229ac7e7fdf6b8518e663c5c7072b201786c72aead0d95e94d8708a9b5a7c3f37be138  postfix-pgsql.post-install
b35931865eb15b5cd6a2b95bbf486cd064d1447eac1a91d507a7d23155229ac7e7fdf6b8518e663c5c7072b201786c72aead0d95e94d8708a9b5a7c3f37be138  postfix-sqlite.post-install"