2017-11-15 02:42:55 +00:00
#
2015-06-26 12:51:16 +00:00
# Copyright (C) 2014-2015 OpenWrt.org
2014-09-30 21:08:26 +00:00
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
i n c l u d e $( TOPDIR ) / r u l e s . m k
PKG_NAME := postfix
2018-08-29 12:45:17 +00:00
PKG_RELEASE := 2
2018-05-28 18:47:30 +00:00
PKG_VERSION := 3.3.1
2017-10-02 21:07:13 +00:00
PKG_SOURCE_URL := \
https://cdn.postfix.johnriley.me/mirrors/postfix-release/official/ \
ftp://ftp.porcupine.org/mirrors/postfix-release/official/
2018-05-28 18:47:30 +00:00
PKG_HASH := 54f514dae42b5275cb4bc9c69283f16c06200b71813d0bb696568c4ba7ae7e3b
2014-09-30 21:08:26 +00:00
PKG_SOURCE := $( PKG_NAME) -$( PKG_VERSION) .tar.gz
PKG_MAINTAINER := Denis Shulyaka <Shulyaka@gmail.com>
PKG_LICENSE := IPL-1.0
2014-11-25 07:42:42 +00:00
PKG_LICENSE_FILES := LICENSE
2018-01-07 19:06:50 +00:00
PKG_BUILD_DEPENDS := POSTFIX_CDB:tinycdb
2017-07-16 21:35:00 +00:00
PKG_CONFIG_DEPENDS := \
CONFIG_POSTFIX_TLS \
CONFIG_POSTFIX_SASL \
CONFIG_POSTFIX_LDAP \
CONFIG_POSTFIX_CDB \
CONFIG_POSTFIX_DB \
CONFIG_POSTFIX_SQLITE \
2018-08-29 12:45:17 +00:00
CONFIG_POSTFIX_MYSQL \
2017-07-16 21:35:00 +00:00
CONFIG_POSTFIX_PGSQL \
CONFIG_POSTFIX_PCRE \
CONFIG_POSTFIX_EAI \
2014-09-30 21:08:26 +00:00
i n c l u d e $( INCLUDE_DIR ) / p a c k a g e . m k
d e f i n e P a c k a g e / p o s t f i x
SECTION:= mail
CATEGORY:= Mail
TITLE:= Postfix Mail Transmit Agent
2017-11-15 02:42:55 +00:00
USERID:= \
postfix = 25:postfix= 25 \
postdrop = 26:postdrop= 26
2014-09-30 21:08:26 +00:00
URL:= http://www.postfix.org/
2018-08-29 12:45:17 +00:00
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
2014-09-30 21:08:26 +00:00
e n d e f
d e f i n e P a c k a g e / p o s t f i x / d e s c r i p t i o n
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.
e n d e f
d e f i n e P a c k a g e / p o s t f i x / c o n f i g
menu "Select postfix build options"
config POSTFIX_TLS
bool "TLS support"
default y
help
Implements TLS support in postfix ( using OpenSSL) .
config POSTFIX_SASL
bool "SASL support"
default y
help
Implements SASL support in postfix ( using Cyrus SASL) .
config POSTFIX_LDAP
bool "LDAP support"
default y
help
Implements LDAP support in postfix ( using OpenLDAP) .
2014-11-01 10:20:17 +00:00
config POSTFIX_DB
bool "BerkeleyDB support"
default n
help
2017-11-15 02:42:55 +00:00
Implements support for btree and hash files using Berkeley DB.
2014-11-01 10:20:17 +00:00
config POSTFIX_CDB
bool "CDB support"
default y
help
Implements support for cdb files using tinycdb
2017-03-08 00:02:03 +00:00
config POSTFIX_SQLITE
bool "SQLITE support"
default y
help
Implements support for SQLite3 DB
2018-08-29 12:45:17 +00:00
config POSTFIX_MYSQL
bool "MYSQL support"
default n
help
Implements support for MySQL
2017-07-16 21:35:00 +00:00
config POSTFIX_PGSQL
bool "PostgreSQL support"
default n
help
Implement support for PostgreSQL
config POSTFIX_PCRE
bool "PCRE support"
2017-11-15 02:42:55 +00:00
default y
2017-07-16 21:35:00 +00:00
help
Implement support for Perl Compatible Regular Expressions
2016-02-09 08:25:13 +00:00
config POSTFIX_EAI
bool "SMTPUTF8 support"
default n
help
2017-07-16 21:35:00 +00:00
Enable Postfix support for Email Address Internationalization
( EAI) as defined in RFC 6531 ( SMTPUTF8 extension) , RFC 6532
( Internationalized email headers) and RFC 6533
( Internationalized delivery status notifications) .
Since version 3.0, Postfix fully supports UTF-8 email
addresses and UTF-8 message header values.
2014-09-30 21:08:26 +00:00
endmenu
e n d e f
2016-02-09 08:25:13 +00:00
CCARGS = -DNO_NIS
2014-11-01 10:20:17 +00:00
AUXLIBS = -L$( STAGING_DIR) /usr/lib
2014-09-30 21:08:26 +00:00
i f d e f C O N F I G _ P O S T F I X _ T L S
CCARGS += -DUSE_TLS
AUXLIBS += -lssl -lcrypto
e n d i f
i f d e f C O N F I G _ P O S T F I X _ S A S L
CCARGS += -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I$( STAGING_DIR) /usr/include/sasl
AUXLIBS += -lsasl2
e n d i f
i f d e f C O N F I G _ P O S T F I X _ L D A P
CCARGS += -DHAS_LDAP
AUXLIBS += -lldap -llber
e n d i f
2014-11-01 10:20:17 +00:00
i f d e f C O N F I G _ P O S T F I X _ C D B
CCARGS += -DHAS_CDB
AUXLIBS += -lcdb
2017-11-15 02:42:55 +00:00
ifndef default_database_type
default_database_type = cdb
endif
2014-11-01 10:20:17 +00:00
e n d i f
i f d e f C O N F I G _ P O S T F I X _ D B
AUXLIBS += -ldb
CCARGS += -DHAS_DB
2017-11-15 02:42:55 +00:00
ifndef default_database_type
2014-11-01 10:20:17 +00:00
default_database_type = btree
endif
e l s e
CCARGS += -DNO_DB
e n d i f
2017-03-08 00:02:03 +00:00
i f d e f C O N F I G _ P O S T F I X _ S Q L I T E
CCARGS += -DHAS_SQLITE -I$( STAGING_DIR) /usr/include/
AUXLIBS += -L$( STAGING_DIR) /usr/lib -lsqlite3 -lpthread
e n d i f
2018-08-29 12:45:17 +00:00
i f d e f C O N F I G _ P O S T F I X _ M Y S Q L
CCARGS += -DHAS_MYSQL -I$( STAGING_DIR) /usr/include/mysql
AUXLIBS += -L$( STAGING_DIR) /usr/lib -lmysqlclient -lz -lm
e n d i f
2017-07-16 21:35:00 +00:00
i f d e f C O N F I G _ P O S T F I X _ P G S Q L
CCARGS += -DHAS_PGSQL -I$( STAGING_DIR) /usr/include/
AUXLIBS += -L$( STAGING_DIR) /usr/lib -lpq
e n d i f
i f d e f C O N F I G _ P O S T F I X _ P C R E
CCARGS += -DHAS_PCRE -I$( STAGING_DIR) /usr/include/
AUXLIBS += -L$( STAGING_DIR) /usr/lib -lpcre
e l s e
CCARGS += -DNO_PCRE
e n d i f
2016-02-09 08:25:13 +00:00
i f d e f C O N F I G _ P O S T F I X _ E A I
AUXLIBS += -licuuc
CCARGS += -DHAS_EAI
smtputf8_conf = yes
e l s e
CCARGS += -DNO_EAI
smtputf8_conf = no
e n d i f
2014-11-01 10:20:17 +00:00
CCARGS += -DDEF_DB_TYPE= \" $( default_database_type) \"
2017-11-15 02:42:55 +00:00
# prevent postfix-install from executing postconf at build time
# by explicitly providing the default values to postfix-install
config_directory = /etc/postfix
2014-09-30 21:08:26 +00:00
sample_directory = /etc/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
html_directory = no
manpage_directory = no
readme_directory = no
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
2015-02-15 22:17:45 +00:00
shlib_directory = /usr/lib/postfix
meta_directory = /etc/postfix
2017-11-15 02:42:55 +00:00
data_directory = /usr/var/lib/postfix
queue_directory = /usr/var/spool/postfix
mail_spool_directory = /usr/var/mail
2014-09-30 21:08:26 +00:00
ln_suffix = .postfix
2017-11-15 02:42:55 +00:00
ln_suffix_pre_pf = .pre-postfix
ln_suffix_legacy = .old
2014-09-30 21:08:26 +00:00
2014-11-01 10:20:17 +00:00
d e f i n e P a c k a g e / p o s t f i x / c o n f f i l e s
2017-11-15 02:42:55 +00:00
$( config_directory )
2014-11-01 10:20:17 +00:00
e n d e f
2014-09-30 21:08:26 +00:00
d e f i n e B u i l d / C o n f i g u r e
2017-11-15 02:42:55 +00:00
if [ " $( default_database_type) " = "" ] ; then \
echo "Build error: CDB or BerkeleyDB support must be enabled." ; \
exit 1; \
2014-11-01 10:20:17 +00:00
fi
2014-09-30 21:08:26 +00:00
cd $( PKG_BUILD_DIR) ; $( MAKE) makefiles CCARGS = '$(CCARGS)' $( TARGET_CONFIGURE_OPTS) AUXLIBS = " $( AUXLIBS) "
e n d e f
d e f i n e B u i l d / C o m p i l e
2016-02-09 08:25:13 +00:00
# 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
2014-09-30 21:08:26 +00:00
cd $( PKG_BUILD_DIR) ; $( MAKE) $( TARGET_CONFIGURE_OPTS) CC = '$(TARGET_CC) $(CCARGS)'
2017-11-15 02:42:55 +00:00
$( foreach p, \
default_database_type config_directory command_directory daemon_directory \
shlib_directory manpage_directory data_directory queue_directory \
mail_spool_directory, \
echo " $( p) = $( $( p) ) " >> $( PKG_BUILD_DIR) /conf/main.cf; )
2014-09-30 21:08:26 +00:00
e n d e f
d e f i n e P a c k a g e / p o s t f i x / i n s t a l l
2015-02-15 22:17:45 +00:00
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
2014-09-30 21:08:26 +00:00
$( INSTALL_DIR) $( 1) /etc/init.d/
2014-10-25 17:17:54 +00:00
$( INSTALL_BIN) ./files/postfix.init $( 1) /etc/init.d/postfix
2014-09-30 21:08:26 +00:00
e n d e f
d e f i n e P a c k a g e / p o s t f i x / p o s t i n s t
#!/bin/sh
2017-11-15 02:42:55 +00:00
f o r s y m l i n $( sendmail_path ) $( newaliases_path ) $( mailq_path ) ; d o
file = $$ { IPKG_INSTROOT} $$ { syml}
if [ -f " $$ {file} $( ln_suffix_legacy) " ] ; then
# update files saved by legacy versions of Postfix postinst script
mv " $$ {file} $( ln_suffix_legacy) " " $$ {file} $( ln_suffix_pre_pf) "
fi
if [ -f " $$ {file} " ] ; then
linktarget = $$ ( basename $$ ( readlink " $$ {file} " ) )
postfixf = $$ ( basename " $$ {syml} " ) $( ln_suffix)
if [ $$ { linktarget} != $$ { postfixf} ] ; then
mv " $$ {file} " " $$ {file} $( ln_suffix_pre_pf) "
echo " Info: $$ {file} saved as $$ {file} $( ln_suffix_pre_pf) "
fi
fi
if [ ! -f " $$ {file} " ] ; then
ln -s " $$ {syml} $( ln_suffix) " " $$ {file} "
fi
d o n e
# fix file/dir ownership in data_directory and queue_directory
i f [ - z "$${IPKG_INSTROOT}" ] ; t h e n
postfix set-permissions
f i
2014-09-30 21:08:26 +00:00
e n d e f
d e f i n e P a c k a g e / p o s t f i x / p o s t r m
#!/bin/sh
2017-11-15 02:42:55 +00:00
r m - f "$(sendmail_path)" "$(newaliases_path)" "$(mailq_path)"
f o r s y m l i n "$(sendmail_path)" "$(newaliases_path)" "$(mailq_path)" ; d o
file = $$ { IPKG_INSTROOT} $$ { syml}
if [ -f " $$ {file} $( ln_suffix_legacy) " ] ; then
# update files saved by legacy versions of Postfix postinst script
mv " $$ {file} $( ln_suffix_legacy) " " $$ {file} $( ln_suffix_pre_pf) "
fi
if [ -f " $$ {syml} $( ln_suffix_pre_pf) " ] ; then
mv " $$ {syml} $( ln_suffix_pre_pf) " " $$ {syml} "
echo " Info: $$ {syml} $( ln_suffix_pre_pf) restored as $$ {syml} "
fi
d o n e
2014-09-30 21:08:26 +00:00
e n d e f
$( eval $ ( call BuildPackage ,postfix ) )