diff options
author | jlam <jlam@pkgsrc.org> | 2004-07-19 19:59:16 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2004-07-19 19:59:16 +0000 |
commit | 44703d45946e2518de101ecdc1250fb5d44a9c37 (patch) | |
tree | c9d89406ca84e78fee15008177e0d29512a1a8a2 /mail/postfix | |
parent | f75335f241f660101118a1703cfd8b9d44d85f6d (diff) | |
download | pkgsrc-44703d45946e2518de101ecdc1250fb5d44a9c37.tar.gz |
Stop the proliferation of <PKG>_USE_<FOO> yes/no variables in the
mail/postfix package -- create a new option "POSTFIX_OPTIONS" that is a
list of optional add-ons that will be built into Postfix. Currently,
it accepts any of "inet6 ldap mysql mysql4 prce sasl tls". Move the
existing POSTFIX_USE_* variables into bsd.pkg.obsolete.mk.
Also split out the optional add-ons into a separate Makefile.options
so that the main Makefile workflow is a bit easier to understand.
Lastly, collapse the pre-install target into the do-install target we run
custom code for the whole install process anyway.
Approved by martti.
Diffstat (limited to 'mail/postfix')
-rw-r--r-- | mail/postfix/Makefile | 221 | ||||
-rw-r--r-- | mail/postfix/Makefile.options | 136 |
2 files changed, 196 insertions, 161 deletions
diff --git a/mail/postfix/Makefile b/mail/postfix/Makefile index c649a1d8133..1bbab623d6e 100644 --- a/mail/postfix/Makefile +++ b/mail/postfix/Makefile @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.139 2004/07/19 05:28:07 jlam Exp $ +# $NetBSD: Makefile,v 1.140 2004/07/19 19:59:16 jlam Exp $ DISTNAME= postfix-2.1.3 CATEGORIES= mail MASTER_SITES= ftp://ftp.porcupine.org/mirrors/postfix-release/official/ +DIST_SUBDIR= postfix PATCHFILES+= postfix-2.1.1-canonical_classes.diff PATCH_SITES+= ftp://ftp.gw.com/pub/people/kim/patches/ @@ -14,160 +15,70 @@ COMMENT= Postfix SMTP server and tools CONFLICTS+= sendmail-[0-9]* -DIST_SUBDIR= postfix - PKG_INSTALLATION_TYPES= overwrite pkgviews +USE_BUILDLINK3= yes -USE_BUILDLINK3= yes -USE_PKGINSTALL= yes - -PKG_SYSCONFSUBDIR= postfix -POSTFIX_QUEUE_DIR= /var/spool/postfix +.include "../../mk/bsd.prefs.mk" -OWN_DIRS= ${POSTFIX_QUEUE_DIR} +# POSTFIX_QUEUE_DIR is the default queue directory for Postfix. This is +# merely a default, and may be changed by setting "queue_directory" in +# ${PKG_SYSCONFDIR}/main.cf. +# +POSTFIX_QUEUE_DIR?= ${VARBASE}/spool/postfix + +# CCARGS is a list of options to pass to the preprocessor/compiler. +# AUXLIBS is a list of options to pass to the linker. +# +CCARGS= # empty +AUXLIBS= # empty +FIX_RPATH+= AUXLIBS CCARGS+= -DDEF_CONFIG_DIR=\"${PKG_SYSCONFDIR}\" +CCARGS+= -DDEF_QUEUE_DIR=\"${POSTFIX_QUEUE_DIR}\" +CCARGS+= -DDEF_COMMAND_DIR=\"${PREFIX}/sbin\" +CCARGS+= -DDEF_DAEMON_DIR=\"${LIBEXECDIR}\" CCARGS+= -DDEF_SENDMAIL_PATH=\"${PREFIX}/sbin/sendmail\" CCARGS+= -DDEF_MAILQ_PATH=\"${PREFIX}/bin/mailq\" CCARGS+= -DDEF_NEWALIAS_PATH=\"${PREFIX}/bin/newaliases\" -CCARGS+= -DDEF_COMMAND_DIR=\"${PREFIX}/sbin\" -CCARGS+= -DDEF_DAEMON_DIR=\"${LIBEXECDIR}\" -CCARGS+= -DDEF_QUEUE_DIR=\"${POSTFIX_QUEUE_DIR}\" - -.include "../../mk/bsd.prefs.mk" -# NetBSD 1.5 and above has /etc/rc.d/postfix already which is -# suitable. -.if empty(MACHINE_PLATFORM:MNetBSD-1.[5-9]*-*) -RCD_SCRIPTS= postfix -.endif - -FIX_RPATH+= AUXLIBS - -BUILD_DEFS+= POSTFIX_USE_INET6 -BUILD_DEFS+= POSTFIX_USE_TLS -BUILD_DEFS+= POSTFIX_USE_PCRE -BUILD_DEFS+= POSTFIX_USE_MYSQL -BUILD_DEFS+= POSTFIX_USE_PGSQL -BUILD_DEFS+= USE_OPENLDAP -BUILD_DEFS+= USE_SASL -BUILD_DEFS+= USE_SASL2 - -.if defined(POSTFIX_USE_INET6) && ${POSTFIX_USE_INET6} == "YES" -. include "../../security/openssl/buildlink3.mk" -PATCHFILES+= tls+ipv6-1.25-pf-2.1.3.patch.gz -PATCH_SITES+= ftp://ftp.stack.nl/pub/postfix/tls+ipv6/1.25/ -PATCH_DIST_STRIP= -p1 +# Makefile.options appends to CCARGS and AUXLIBS the options needed to +# build Postfix with support for various add-on modules. It also defines +# _POSTFIX_OPTIONS, which is POSTFIX_OPTIONS filtered to only contain +# supported modules. +# +.include "Makefile.options" -CCARGS+= -DHAS_SSL -AUXLIBS+= -L${BUILDLINK_PREFIX.openssl}/lib \ - -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.openssl}/lib \ - -lssl -lcrypto +PKG_SYSCONFSUBDIR= postfix +LIBEXECDIR= ${PREFIX}/libexec/${PKGBASE} +DOCDIR= ${PREFIX}/share/doc/${PKGBASE} +EXAMPLEDIR= ${PREFIX}/share/examples/${PKGBASE} -PLIST_SRC+= ${PKGDIR}/PLIST.tls -MESSAGE_SRC+= ${PKGDIR}/MESSAGE.tls -.endif +FILES_SUBST+= EXAMPLEDIR=${EXAMPLEDIR} +MESSAGE_SUBST+= EXAMPLEDIR=${EXAMPLEDIR} -.if defined(POSTFIX_USE_PCRE) && ${POSTFIX_USE_PCRE} == "YES" -. include "../../devel/pcre/buildlink3.mk" -CCARGS+= -DHAS_PCRE -AUXLIBS+= -L${BUILDLINK_PREFIX.pcre}/lib \ - -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.pcre}/lib \ - -lpcre -.else -CCARGS+= -DNO_PCRE -.endif - -.if defined(USE_OPENLDAP) && ${USE_OPENLDAP} == "YES" -. include "../../databases/openldap/buildlink3.mk" -CCARGS+= -DHAS_LDAP -AUXLIBS+= -L${BUILDLINK_PREFIX.openldap}/lib \ - -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.openldap}/lib \ - -lldap -llber -. if ${OPSYS} != "Linux" -. include "../../databases/db4/buildlink3.mk" -CCARGS+= -I${BUILDLINK_PREFIX.db4}/include/db4 -AUXLIBS+= -L${BUILDLINK_PREFIX.db4}/lib \ - -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.db4}/lib \ - -ldb4 -. endif +MESSAGE_SRC+= ${PKGDIR}/MESSAGE +.if exists(${PKGDIR}/MESSAGE.${OPSYS}) +MESSAGE_SRC+= ${PKGDIR}/MESSAGE.${OPSYS} .endif +PLIST_SRC+= ${PKGDIR}/PLIST -.if defined(POSTFIX_USE_MYSQL) && ${POSTFIX_USE_MYSQL} == "YES" -. include "../../databases/mysql-client/buildlink3.mk" -CCARGS+= -DHAS_MYSQL -I${BUILDLINK_PREFIX.mysql-client}/include/mysql -AUXLIBS+= -L${BUILDLINK_PREFIX.mysql-client}/lib/mysql \ - -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.mysql-client}/lib/mysql \ - -lmysqlclient -lz -lm -.endif +ALL_TARGET= # empty +MAKE_ENV= CC="${CC}" OPT="${CFLAGS}" +MAKE_ENV+= AUXLIBS="${AUXLIBS}" CCARGS="${CCARGS}" -## .if defined(POSTFIX_USE_PGSQL) && ${POSTFIX_USE_PGSQL} == "YES" -## . include "../../databases/postgresql-lib/buildlink3.mk" -## . include "../../security/openssl/buildlink3.mk" -## PATCHFILES+= postfix-pg.postfix-2.0.0.2.patch -## PATCH_SITES+= http://www.mat.cc/postfix/ -## PATCH_DIST_STRIP= -p1 -## -## CCARGS+= -DHAS_PGSQL -I${BUILDLINK_PREFIX.postgresql-lib}/include/pgsql -## AUXLIBS+= -L${BUILDLINK_PREFIX.postgresql-lib}/lib -lpq \ -## -L${BUILDLINK_PREFIX.openssl}/lib -lcrypt -## .endif - -.if defined(USE_SASL2) && ${USE_SASL2} == "YES" -USING_SASL= YES -. include "../../security/cyrus-sasl2/buildlink3.mk" -CCARGS+= -DUSE_SASL2_AUTH -AUXLIBS+= -L${BUILDLINK_PREFIX.cyrus-sasl}/lib \ - -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.cyrus-sasl}/lib \ - -lsasl2 -.elif defined(USE_SASL) && ${USE_SASL} == "YES" -USING_SASL=YES -. include "../../security/cyrus-sasl/buildlink3.mk" -CCARGS+= -DUSE_SASL_AUTH -AUXLIBS+= -L${BUILDLINK_PREFIX.cyrus-sasl}/lib \ - -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.cyrus-sasl}/lib \ - -lsasl -.endif +USE_PKGINSTALL= yes +RCD_SCRIPTS= postfix +OWN_DIRS+= ${POSTFIX_QUEUE_DIR} +MAKE_DIRS+= ${PKG_SYSCONFDIR} -.if defined(USING_SASL) -PLIST_SRC+= ${PKGDIR}/PLIST.sasl -MESSAGE_SRC+= ${PKGDIR}/MESSAGE.sasl -MESSAGE_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR} -.endif +PKG_GROUPS?= postfix maildrop +PKG_USERS?= postfix:postfix::Postfix\\ User:${POSTFIX_QUEUE_DIR} -MESSAGE_SRC+= ${PKGDIR}/MESSAGE -.if exists(${PKGDIR}/MESSAGE.${OPSYS}) -MESSAGE_SRC+= ${PKGDIR}/MESSAGE.${OPSYS} -.endif -PLIST_SRC+= ${PKGDIR}/PLIST -ALL_TARGET= #empty -MAKE_ENV= CC="${CC}" OPT="${CFLAGS}" -MAKE_ENV+= AUXLIBS="${AUXLIBS}" CCARGS="${CCARGS}" - -POSTFIX_CONF_FILES= conf/main.cf src/util/sys_defs.h postfix-install -POSTFIX_CONF_FILES+= src/global/mail_params.h - -FILES_SUBST+= EXAMPLEDIR=${EXAMPLEDIR} -MESSAGE_SUBST+= EXAMPLEDIR=${EXAMPLEDIR} -MESSAGE_SUBST+= DOCDIR=${DOCDIR} - -PKG_GROUPS?= postfix maildrop -PKG_USERS?= postfix:postfix::Postfix\\ User:${POSTFIX_QUEUE_DIR} - -LIBEXECDIR= ${PREFIX}/libexec/${PKGBASE} -DOCDIR= ${PREFIX}/share/doc/${PKGBASE} -EXAMPLEDIR= ${PREFIX}/share/examples/${PKGBASE} - -CONF_FILES= ${EXAMPLEDIR}/main.cf ${PKG_SYSCONFDIR}/main.cf -CONF_FILES+= ${EXAMPLEDIR}/master.cf ${PKG_SYSCONFDIR}/master.cf -.if defined(USING_SASL) -. if defined(USE_SASL2) -MAKE_DIRS+= ${PREFIX}/lib/sasl2 -CONF_FILES+= ${EXAMPLEDIR}/smtpd.conf ${PREFIX}/lib/sasl2/smtpd.conf -. else -MAKE_DIRS+= ${PREFIX}/lib/sasl -CONF_FILES+= ${EXAMPLEDIR}/smtpd.conf ${PREFIX}/lib/sasl/smtpd.conf -. endif +CONF_FILES= ${EXAMPLEDIR}/main.cf ${PKG_SYSCONFDIR}/main.cf +CONF_FILES+= ${EXAMPLEDIR}/master.cf ${PKG_SYSCONFDIR}/master.cf +.if !empty(_POSTFIX_OPTIONS:Msasl) +MAKE_DIRS+= ${SASLLIBDIR} +CONF_FILES+= ${EXAMPLEDIR}/smtpd.conf ${SASLLIBDIR}/smtpd.conf .endif CONF_FILES_PERMS= # empty .for confscr in post-install postfix-files postfix-script @@ -176,6 +87,9 @@ CONF_FILES_PERMS+= ${EXAMPLEDIR}/${confscr} ${PKG_SYSCONFDIR}/${confscr} \ .endfor .undef confscr +POSTFIX_CONF_FILES= conf/main.cf src/util/sys_defs.h \ + src/global/mail_params.h postfix-install + pre-configure: @for i in ${POSTFIX_CONF_FILES}; do \ ${CP} ${WRKSRC}/$${i} ${WRKSRC}/$${i}.dist; \ @@ -190,22 +104,17 @@ do-configure: post-build: @${SED} ${FILES_SUBST_SED} ${FILESDIR}/mailer.conf \ - > ${WRKDIR}/mailer.conf.postfix + > ${WRKDIR}/mailer.conf +.if !empty(_POSTFIX_OPTIONS:Msasl) + ${ECHO} "pwcheck_method: ${PWCHECK_METHOD}" > ${WRKDIR}/smtpd.conf +.endif -pre-install: - ${INSTALL_DATA_DIR} ${PKG_SYSCONFDIR} - ${INSTALL_DATA_DIR} ${EXAMPLEDIR} +do-install: ${INSTALL_DATA_DIR} ${LIBEXECDIR} + ${INSTALL_DATA_DIR} ${EXAMPLEDIR} ${INSTALL_DATA_DIR} ${DOCDIR} - ${CHOWN} ${ROOT_USER}:${ROOT_GROUP} ${EXAMPLEDIR} ${LIBEXECDIR} - ${CHMOD} 755 ${EXAMPLEDIR} ${LIBEXECDIR} -${RM} -f ${WRKSRC}/conf/*.orig -.if defined(USING_SASL) -. if defined(USE_SASL2) - ${ECHO} "pwcheck_method: auxprop" > ${WRKDIR}/smtpd.conf -. else - ${ECHO} "pwcheck_method: sasldb" > ${WRKDIR}/smtpd.conf -. endif +.if !empty(_POSTFIX_OPTIONS:Msasl) ${INSTALL_DATA} ${WRKDIR}/smtpd.conf ${EXAMPLEDIR} .endif ${INSTALL_SCRIPT} ${WRKSRC}/conf/post-install ${EXAMPLEDIR} @@ -213,18 +122,8 @@ pre-install: ${INSTALL_SCRIPT} ${WRKSRC}/conf/postfix-script ${EXAMPLEDIR} ${INSTALL_DATA} ${WRKSRC}/conf/main.cf ${EXAMPLEDIR} ${INSTALL_DATA} ${WRKSRC}/conf/master.cf ${EXAMPLEDIR} - ${INSTALL_DATA} ${WRKDIR}/mailer.conf.postfix ${EXAMPLEDIR}/mailer.conf - -do-install: + ${INSTALL_DATA} ${WRKDIR}/mailer.conf ${EXAMPLEDIR}/mailer.conf cd ${WRKSRC} && ${SETENV} config_directory="${EXAMPLEDIR}" \ ${SH} postfix-install -non-interactive -.if ${OPSYS} == "Linux" -. include "../../databases/db/buildlink3.mk" -CCARGS+= -I${BUILDLINK_PREFIX.db2}/include/db2 -AUXLIBS+= -L${BUILDLINK_PREFIX.db2}/lib \ - -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.db2}/lib \ - -ldb2 -.endif - .include "../../mk/bsd.pkg.mk" diff --git a/mail/postfix/Makefile.options b/mail/postfix/Makefile.options new file mode 100644 index 00000000000..c684d4071a3 --- /dev/null +++ b/mail/postfix/Makefile.options @@ -0,0 +1,136 @@ +# $NetBSD: Makefile.options,v 1.1 2004/07/19 19:59:17 jlam Exp $ +# +# POSTFIX_ALL_OPTIONS lists all of the currently-supported optional modules +# that may be built into Postfix. +# +# POSTFIX_OPTIONS is a list of the modules that will be built into Postfix. +# +POSTFIX_ALL_OPTIONS= inet6 ldap mysql mysql4 pcre sasl tls +POSTFIX_OPTIONS?= # empty + +_POSTFIX_OPTIONS= # empty +.for _opt_ in ${POSTFIX_OPTIONS} +. if empty(_POSTFIX_OPTIONS:M${_opt_}) +. if !empty(POSTFIX_ALL_OPTIONS:M${_opt_}) +_POSTFIX_OPTIONS+= ${_opt_} +. else +PKG_FAIL_REASON+= "\"${_opt_}\" is not a supported Postfix build option." +. endif +. endif +.endfor + +### +### IPv6 and STARTTLS support (http://www.ipnet6.org/postfix/) +### +.if !empty(_POSTFIX_OPTIONS:Minet6) || !empty(_POSTFIX_OPTIONS:Mtls) +. include "../../security/openssl/buildlink3.mk" +PATCHFILES+= tls+ipv6-1.25-pf-2.1.3.patch.gz +PATCH_SITES+= ftp://ftp.stack.nl/pub/postfix/tls+ipv6/1.25/ +PATCH_DIST_STRIP= -p1 + +CCARGS+= -DHAS_SSL +AUXLIBS+= -L${BUILDLINK_PREFIX.openssl}/lib \ + -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.openssl}/lib \ + -lssl -lcrypto + +PLIST_SRC+= ${PKGDIR}/PLIST.tls +MESSAGE_SRC+= ${PKGDIR}/MESSAGE.tls +.endif + +### +### Support "pcre" map type for regular expressions. +### +.if !empty(_POSTFIX_OPTIONS:Mpcre) +. include "../../devel/pcre/buildlink3.mk" +CCARGS+= -DHAS_PCRE +AUXLIBS+= -L${BUILDLINK_PREFIX.pcre}/lib \ + -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.pcre}/lib \ + -lpcre +.else +CCARGS+= -DNO_PCRE +.endif + +### +### Support LDAP directories for table lookups. +### +.if !empty(_POSTFIX_OPTIONS:Mldap) +. include "../../databases/openldap/buildlink3.mk" +CCARGS+= -DHAS_LDAP +AUXLIBS+= -L${BUILDLINK_PREFIX.openldap}/lib \ + -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.openldap}/lib \ + -lldap -llber +. if ${OPSYS} != "Linux" +. include "../../databases/db4/buildlink3.mk" +CCARGS+= -I${BUILDLINK_PREFIX.db4}/include/db4 +AUXLIBS+= -L${BUILDLINK_PREFIX.db4}/lib \ + -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.db4}/lib \ + -ldb4 +. endif +.endif + +### +### Support using a MySQL database server for table lookups. +### +.if !empty(_POSTFIX_OPTIONS:Mmysql4) +. include "../../databases/mysql4-client/buildlink3.mk" +CCARGS+= -DHAS_MYSQL +CCARGS+= `${BUILDLINK_PREFIX.mysql-client}/bin/mysql_config --include` +AUXLIBS+= `${BUILDLINK_PREFIX.mysql-client}/bin/mysql_config --libs` +.elif !empty(_POSTFIX_OPTIONS:Mmysql) +. include "../../databases/mysql-client/buildlink3.mk" +CCARGS+= -DHAS_MYSQL -I${BUILDLINK_PREFIX.mysql-client}/include/mysql +AUXLIBS+= -L${BUILDLINK_PREFIX.mysql-client}/lib/mysql \ + -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.mysql-client}/lib/mysql \ + -lmysqlclient -lz -lm +.endif + +## ### +## ### Support using a PostgreSQL database server for table lookups. +## ### +## .if !empty(_POSTFIX_OPTIONS:Mpgsql) +## . include "../../databases/postgresql-lib/buildlink3.mk" +## . include "../../security/openssl/buildlink3.mk" +## PATCHFILES+= postfix-pg.postfix-2.0.0.2.patch +## PATCH_SITES+= http://www.mat.cc/postfix/ +## PATCH_DIST_STRIP= -p1 +## +## CCARGS+= -DHAS_PGSQL -I${BUILDLINK_PREFIX.postgresql-lib}/include/pgsql +## AUXLIBS+= -L${BUILDLINK_PREFIX.postgresql-lib}/lib -lpq \ +## -L${BUILDLINK_PREFIX.openssl}/lib -lcrypt +## .endif + +### +### SASL support for SMTP authentication. +### +.if !empty(_POSTFIX_OPTIONS:Msasl) +. if defined(USE_SASL2) && !empty(USE_SASL2:M[yY][eE][sS]) +. include "../../security/cyrus-sasl2/buildlink3.mk" +SASLLIBDIR= ${PREFIX}/lib/sasl2 +PWCHECK_METHOD= auxprop +CCARGS+= -DUSE_SASL2_AUTH +AUXLIBS+= -L${BUILDLINK_PREFIX.cyrus-sasl}/lib \ + -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.cyrus-sasl}/lib \ + -lsasl2 +. elif defined(USE_SASL) && !empty(USE_SASL:M[yY][eE][sS]) +. include "../../security/cyrus-sasl/buildlink3.mk" +SASLLIBDIR= ${PREFIX}/lib/sasl +PWCHECK_METHOD= sasldb +CCARGS+= -DUSE_SASL_AUTH +AUXLIBS+= -L${BUILDLINK_PREFIX.cyrus-sasl}/lib \ + -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.cyrus-sasl}/lib \ + -lsasl +. endif + +PLIST_SRC+= ${PKGDIR}/PLIST.sasl +MESSAGE_SRC+= ${PKGDIR}/MESSAGE.sasl +MESSAGE_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR} +MESSAGE_SUBST+= SASLLIBDIR=${SASLLIBDIR} +.endif + +.if ${OPSYS} == "Linux" +. include "../../databases/db/buildlink3.mk" +CCARGS+= -I${BUILDLINK_PREFIX.db2}/include/db2 +AUXLIBS+= -L${BUILDLINK_PREFIX.db2}/lib \ + -Wl,${RPATH_FLAG}${BUILDLINK_PREFIX.db2}/lib \ + -ldb2 +.endif |