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 https
://cdn.postfix.johnriley.me
/mirrors
/postfix-release
/official
/ \
15 http
://ftp.porcupine.org
/mirrors
/postfix-release
/official
/
17 PKG_HASH
:=27f2ab631a966a40e002aedc6db9281e5970295fa5fd96b29066e457a4601e34
18 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
19 PKG_MAINTAINER
:=Denis Shulyaka
<Shulyaka@gmail.com
>
21 PKG_LICENSE_FILES
:=LICENSE
22 PKG_BUILD_DEPENDS
:=POSTFIX_CDB
:tinycdb
23 PKG_CONFIG_DEPENDS
:= \
29 CONFIG_POSTFIX_SQLITE \
30 CONFIG_POSTFIX_MYSQL \
31 CONFIG_POSTFIX_PGSQL \
35 include $(INCLUDE_DIR
)/package.mk
37 define Package
/postfix
40 TITLE
:=Postfix Mail Transmit Agent
42 postfix
=25:postfix
=25 \
43 postdrop
=26:postdrop
=26
44 URL
:=http
://www.postfix.org
/
45 DEPENDS
:=+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
48 define Package
/postfix
/description
49 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.
52 define Package/postfix/config
53 menu "Select postfix build options"
58 Implements TLS support in postfix (using OpenSSL).
63 Implements SASL support in postfix (using Cyrus SASL).
68 Implements LDAP support in postfix (using OpenLDAP).
70 bool "BerkeleyDB support"
73 Implements support for btree and hash files using Berkeley DB.
78 Implements support for cdb files using tinycdb
83 Implements support for SQLite3 DB
88 Implements support for MySQL
90 bool "PostgreSQL support"
93 Implement support for PostgreSQL
98 Implement support for Perl Compatible Regular Expressions
100 bool "SMTPUTF8 support"
103 Enable Postfix support for Email Address Internationalization
104 (EAI) as defined in RFC 6531 (SMTPUTF8 extension), RFC 6532
105 (Internationalized email headers) and RFC 6533
106 (Internationalized delivery status notifications).
107 Since version 3.0, Postfix fully supports UTF-8 email
108 addresses and UTF-8 message header values.
113 AUXLIBS=-L$(STAGING_DIR)/usr/lib
115 ifdef CONFIG_POSTFIX_TLS
117 AUXLIBS+=-lssl -lcrypto
120 ifdef CONFIG_POSTFIX_SASL
121 CCARGS+=-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I$(STAGING_DIR)/usr/include/sasl
125 ifdef CONFIG_POSTFIX_LDAP
127 AUXLIBS+=-lldap -llber
130 ifdef CONFIG_POSTFIX_CDB
133 ifndef default_database_type
134 default_database_type=cdb
138 ifdef CONFIG_POSTFIX_DB
141 ifndef default_database_type
142 default_database_type=btree
148 ifdef CONFIG_POSTFIX_SQLITE
149 CCARGS+=-DHAS_SQLITE -I$(STAGING_DIR)/usr/include/
150 AUXLIBS+=-L$(STAGING_DIR)/usr/lib -lsqlite3 -lpthread
153 ifdef CONFIG_POSTFIX_MYSQL
154 CCARGS+=-DHAS_MYSQL -I$(STAGING_DIR)/usr/include/mysql
155 AUXLIBS+=-L$(STAGING_DIR)/usr/lib -lmysqlclient -lz -lm
158 ifdef CONFIG_POSTFIX_PGSQL
159 CCARGS+=-DHAS_PGSQL -I$(STAGING_DIR)/usr/include/
160 AUXLIBS+=-L$(STAGING_DIR)/usr/lib -lpq
163 ifdef CONFIG_POSTFIX_PCRE
164 CCARGS+=-DHAS_PCRE -I$(STAGING_DIR)/usr/include/
165 AUXLIBS+=-L$(STAGING_DIR)/usr/lib -lpcre
170 ifdef CONFIG_POSTFIX_EAI
179 CCARGS+=-DDEF_DB_TYPE=\"$(default_database_type)\"
181 # prevent postfix-install from executing postconf at build time
182 # by explicitly providing the default values to postfix-install
183 config_directory=/etc/postfix
184 sample_directory=/etc/postfix
185 command_directory=/usr/sbin
186 daemon_directory=/usr/libexec/postfix
190 sendmail_path=/usr/sbin/sendmail
191 newaliases_path=/usr/bin/newaliases
192 mailq_path=/usr/bin/mailq
193 shlib_directory=/usr/lib/postfix
194 meta_directory=/etc/postfix
195 data_directory=/usr/var/lib/postfix
196 queue_directory=/usr/var/spool/postfix
197 mail_spool_directory=/usr/var/mail
200 ln_suffix_pre_pf=.pre-postfix
201 ln_suffix_legacy=.old
203 define Package/postfix/conffiles
207 define Build/Configure
208 if [ "$(default_database_type)" = "" ]; then \
209 echo "Build error: CDB or BerkeleyDB support must be enabled."; \
212 cd $(PKG_BUILD_DIR); $(MAKE) makefiles CCARGS='$(CCARGS
)' $(TARGET_CONFIGURE_OPTS) AUXLIBS="$(AUXLIBS)"
216 # 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
217 cd $(PKG_BUILD_DIR); $(MAKE) $(TARGET_CONFIGURE_OPTS) CC='$(TARGET_CC
) $(CCARGS
)'
219 default_database_type config_directory command_directory daemon_directory \
220 shlib_directory manpage_directory data_directory queue_directory \
221 mail_spool_directory, \
222 echo "$(p) = $($(p))" >> $(PKG_BUILD_DIR)/conf/main.cf;)
225 define Package/postfix/install
226 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
227 $(INSTALL_DIR) $(1)/etc/init.d/
228 $(INSTALL_BIN) ./files/postfix.init $(1)/etc/init.d/postfix
231 define Package/postfix/postinst
234 for syml in $(sendmail_path) $(newaliases_path) $(mailq_path); do
235 file=$${IPKG_INSTROOT}$${syml}
236 if [ -f "$${file}$(ln_suffix_legacy)" ]; then
237 # update files saved by legacy versions of Postfix postinst script
238 mv "$${file}$(ln_suffix_legacy)" "$${file}$(ln_suffix_pre_pf)"
240 if [ -f "$${file}" ]; then
241 linktarget=$$(basename $$(readlink "$${file}"))
242 postfixf=$$(basename "$${syml}")$(ln_suffix)
243 if [ $${linktarget} != $${postfixf} ]; then
244 mv "$${file}" "$${file}$(ln_suffix_pre_pf)"
245 echo "Info: $${file} saved as $${file}$(ln_suffix_pre_pf)"
248 if [ ! -f "$${file}" ]; then
249 ln -s "$${syml}$(ln_suffix)" "$${file}"
252 # fix file/dir ownership in data_directory and queue_directory
253 if [ -z "$${IPKG_INSTROOT}" ]; then
254 postfix set-permissions
259 define Package/postfix/postrm
261 rm -f "$(sendmail_path)" "$(newaliases_path)" "$(mailq_path)"
263 for syml in "$(sendmail_path)" "$(newaliases_path)" "$(mailq_path)"; do
264 file=$${IPKG_INSTROOT}$${syml}
265 if [ -f "$${file}$(ln_suffix_legacy)" ]; then
266 # update files saved by legacy versions of Postfix postinst script
267 mv "$${file}$(ln_suffix_legacy)" "$${file}$(ln_suffix_pre_pf)"
269 if [ -f "$${syml}$(ln_suffix_pre_pf)" ]; then
270 mv "$${syml}$(ln_suffix_pre_pf)" "$${syml}"
271 echo "Info: $${syml}$(ln_suffix_pre_pf) restored as $${syml}"
276 $(eval $(call BuildPackage,postfix))