2 # Copyright (C) 2014-2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
14 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
16 https
://de.postfix.org
/ftpmirror
/official
/ \
17 http
://ftp.porcupine.org
/mirrors
/postfix-release
/official
/
18 PKG_HASH
:=22582628cf3edc18c5155c9ff44543dd95a9435fb68135d76a99f572cb07456f
20 PKG_MAINTAINER
:=Denis Shulyaka
<Shulyaka@gmail.com
>
22 PKG_LICENSE_FILES
:=LICENSE
23 PKG_CPE_ID
:=cpe
:/a
:postfix
:postfix
25 PKG_CONFIG_DEPENDS
:= \
31 CONFIG_POSTFIX_SQLITE \
32 CONFIG_POSTFIX_MYSQL \
33 CONFIG_POSTFIX_PGSQL \
37 include $(INCLUDE_DIR
)/package.mk
39 define Package
/postfix
42 TITLE
:=Postfix Mail Transmit Agent
44 postfix
=25:postfix
=25 \
45 postdrop
=26:postdrop
=26
46 URL
:=http
://www.postfix.org
/
47 DEPENDS
:=+POSTFIX_CDB
:tinycdb
+POSTFIX_TLS
:libopenssl
+POSTFIX_SASL
:libsasl2
+POSTFIX_LDAP
:libopenldap
+POSTFIX_DB
:libdb47
+POSTFIX_SQLITE
:libsqlite3
+POSTFIX_MYSQL
:libmysqlclient
+POSTFIX_PGSQL
:libpq
+POSTFIX_EAI
:icu
+POSTFIX_PCRE
:libpcre
51 define Package
/postfix
/description
52 Postfix is Wietse Venema
's mailer that started life as an alternative to the widely-used Sendmail program. Postfix attempts to be fast, easy to administer, and secure, while at the same time being sendmail compatible enough to not upset existing users. Thus, the outside has a sendmail-ish flavor, but the inside is completely different.
55 define Package/postfix/config
57 depends on PACKAGE_postfix
61 Implements TLS support in postfix (using OpenSSL).
63 depends on PACKAGE_postfix
67 Implements SASL support in postfix (using Cyrus SASL).
69 depends on PACKAGE_postfix
73 Implements LDAP support in postfix (using OpenLDAP).
75 depends on PACKAGE_postfix
76 bool "BerkeleyDB support"
79 Implements support for btree and hash files using Berkeley DB.
81 depends on PACKAGE_postfix
85 Implements support for cdb files using tinycdb
87 depends on PACKAGE_postfix
91 Implements support for SQLite3 DB
93 depends on PACKAGE_postfix
97 Implements support for MySQL
99 depends on PACKAGE_postfix
100 bool "PostgreSQL support"
103 Implement support for PostgreSQL
105 depends on PACKAGE_postfix
109 Implement support for Perl Compatible Regular Expressions
111 depends on PACKAGE_postfix
112 bool "SMTPUTF8 support"
115 Enable Postfix support for Email Address Internationalization
116 (EAI) as defined in RFC 6531 (SMTPUTF8 extension), RFC 6532
117 (Internationalized email headers) and RFC 6533
118 (Internationalized delivery status notifications).
119 Since version 3.0, Postfix fully supports UTF-8 email
120 addresses and UTF-8 message header values.
123 CCARGS=-DNO_NIS -fcommon
124 AUXLIBS=-L$(STAGING_DIR)/usr/lib
126 ifdef CONFIG_POSTFIX_TLS
128 AUXLIBS+=-lssl -lcrypto
131 ifdef CONFIG_POSTFIX_SASL
132 CCARGS+=-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I$(STAGING_DIR)/usr/include/sasl
136 ifdef CONFIG_POSTFIX_LDAP
138 AUXLIBS+=-lldap -llber
141 ifdef CONFIG_POSTFIX_CDB
144 ifndef default_database_type
145 default_database_type=cdb
149 ifdef CONFIG_POSTFIX_DB
152 ifndef default_database_type
153 default_database_type=btree
159 ifdef CONFIG_POSTFIX_SQLITE
160 CCARGS+=-DHAS_SQLITE -I$(STAGING_DIR)/usr/include/
161 AUXLIBS+=-L$(STAGING_DIR)/usr/lib -lsqlite3 -lpthread
164 ifdef CONFIG_POSTFIX_MYSQL
165 CCARGS+=-DHAS_MYSQL -I$(STAGING_DIR)/usr/include/mysql
166 AUXLIBS+=-L$(STAGING_DIR)/usr/lib -lmysqlclient -lz -lm
169 ifdef CONFIG_POSTFIX_PGSQL
170 CCARGS+=-DHAS_PGSQL -I$(STAGING_DIR)/usr/include/
171 AUXLIBS+=-L$(STAGING_DIR)/usr/lib -lpq
174 ifdef CONFIG_POSTFIX_PCRE
175 CCARGS+=-DHAS_PCRE -I$(STAGING_DIR)/usr/include/
176 AUXLIBS+=-L$(STAGING_DIR)/usr/lib -lpcre
181 ifdef CONFIG_POSTFIX_EAI
190 CCARGS+=-DDEF_DB_TYPE=\"$(default_database_type)\"
191 TARGET_LDFLAGS += $(if $(CONFIG_USE_GLIBC),-lresolv)
193 # prevent postfix-install from executing postconf at build time
194 # by explicitly providing the default values to postfix-install
195 config_directory=/etc/postfix
196 sample_directory=/etc/postfix
197 command_directory=/usr/sbin
198 daemon_directory=/usr/libexec/postfix
202 sendmail_path=/usr/sbin/sendmail
203 newaliases_path=/usr/bin/newaliases
204 mailq_path=/usr/bin/mailq
205 shlib_directory=/usr/lib/postfix
206 meta_directory=/etc/postfix
207 data_directory=/usr/var/lib/postfix
208 queue_directory=/usr/var/spool/postfix
209 mail_spool_directory=/usr/var/mail
212 ln_suffix_pre_pf=.pre-postfix
213 ln_suffix_legacy=.old
215 define Package/postfix/conffiles
219 define Build/Configure
220 if [ "$(default_database_type)" = "" ]; then \
221 echo "Build error: CDB or BerkeleyDB support must be enabled."; \
224 cd $(PKG_BUILD_DIR); $(MAKE) makefiles CCARGS='$(CCARGS
)' $(TARGET_CONFIGURE_OPTS) AUXLIBS="$(AUXLIBS)"
228 # Currently postfix has a bug with Makefiles that CCARGS are not passed to the compiler, so we are copying them to CC as a workaround
229 cd $(PKG_BUILD_DIR); $(MAKE) $(TARGET_CONFIGURE_OPTS) CC='$(TARGET_CC
) $(CCARGS
) $(TARGET_CFLAGS
) $(TARGET_LDFLAGS
)'
231 default_database_type config_directory command_directory daemon_directory \
232 shlib_directory manpage_directory data_directory queue_directory \
233 mail_spool_directory, \
234 echo "$(p) = $($(p))" >> $(PKG_BUILD_DIR)/conf/main.cf;)
237 define Package/postfix/install
238 cd $(PKG_BUILD_DIR); $(MAKE) install_root=$(1) command_directory=$(command_directory) daemon_directory=$(daemon_directory) data_directory=$(data_directory) html_directory=$(html_directory) mail_owner=postfix mailq_path=$(mailq_path)$(ln_suffix) manpage_directory=$(manpage_directory) newaliases_path=$(newaliases_path)$(ln_suffix) queue_directory=$(queue_directory) readme_directory=$(readme_directory) sendmail_path=$(sendmail_path)$(ln_suffix) setgid_group=postdrop sample_directory=$(sample_directory) config_directory=$(config_directory) shlib_directory=$(shlib_directory) meta_directory=$(meta_directory) mail_version=$(PKG_VERSION) non-interactive-package
239 $(INSTALL_DIR) $(1)/etc/init.d/
240 $(INSTALL_BIN) ./files/postfix.init $(1)/etc/init.d/postfix
243 define Package/postfix/postinst
246 for syml in $(sendmail_path) $(newaliases_path) $(mailq_path); do
247 file=$${IPKG_INSTROOT}$${syml}
248 if [ -f "$${file}$(ln_suffix_legacy)" ]; then
249 # update files saved by legacy versions of Postfix postinst script
250 mv "$${file}$(ln_suffix_legacy)" "$${file}$(ln_suffix_pre_pf)"
252 if [ -f "$${file}" ]; then
253 linktarget=$$(basename $$(readlink "$${file}"))
254 postfixf=$$(basename "$${syml}")$(ln_suffix)
255 if [ $${linktarget} != $${postfixf} ]; then
256 mv "$${file}" "$${file}$(ln_suffix_pre_pf)"
257 echo "Info: $${file} saved as $${file}$(ln_suffix_pre_pf)"
260 if [ ! -f "$${file}" ]; then
261 ln -s "$${syml}$(ln_suffix)" "$${file}"
264 # fix file/dir ownership in data_directory and queue_directory
265 if [ -z "$${IPKG_INSTROOT}" ]; then
266 postfix set-permissions
271 define Package/postfix/postrm
273 rm -f "$(sendmail_path)" "$(newaliases_path)" "$(mailq_path)"
275 for syml in "$(sendmail_path)" "$(newaliases_path)" "$(mailq_path)"; do
276 file=$${IPKG_INSTROOT}$${syml}
277 if [ -f "$${file}$(ln_suffix_legacy)" ]; then
278 # update files saved by legacy versions of Postfix postinst script
279 mv "$${file}$(ln_suffix_legacy)" "$${file}$(ln_suffix_pre_pf)"
281 if [ -f "$${syml}$(ln_suffix_pre_pf)" ]; then
282 mv "$${syml}$(ln_suffix_pre_pf)" "$${syml}"
283 echo "Info: $${syml}$(ln_suffix_pre_pf) restored as $${syml}"
288 $(eval $(call BuildPackage,postfix))