PageRenderTime 83ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/mail/postfix26/Makefile

https://github.com/johnnywalker/freebsd-ports
Makefile | 334 lines | 278 code | 44 blank | 12 comment | 9 complexity | eb3ff7d31e7acf2ec35704f4f59e1358 MD5 | raw file
  1. # New ports collection makefile for: postfix
  2. # Date created: 18 Mar 1999
  3. # Whom: torstenb
  4. #
  5. # $FreeBSD$
  6. #
  7. PORTNAME= postfix
  8. PORTVERSION= 2.6.13
  9. PORTEPOCH= 1
  10. CATEGORIES= mail ipv6
  11. MASTER_SITES= ftp://ftp.porcupine.org/mirrors/postfix-release/official/ \
  12. ftp://ftp.tux.org/pub/net/postfix/official/ \
  13. ftp://ftp.utoronto.ca/mirror/packages/postfix/official/ \
  14. ftp://ftp.samurai.com/pub/postfix/official/ \
  15. ${MASTER_SITE_RINGSERVER:S,%SUBDIR%,net/mail/postfix/official/&,}
  16. MASTER_SITE_SUBDIR= . old related/postfix
  17. DISTNAME= postfix-${PORTVERSION}
  18. DIST_SUBDIR= ${PORTNAME}
  19. MAINTAINER= sahil@FreeBSD.org
  20. COMMENT= A secure alternative to widely-used Sendmail
  21. VDAVERSION= 2.6.5
  22. CONFLICTS= courier-0.* postfix-1.* postfix-2.[0-57-9].* postfix-current-2.* \
  23. sendmail-8.* sendmail+*-8.* smail-3.* zmailer-2.*
  24. USERS= postfix
  25. GROUPS= mail maildrop postfix
  26. NO_LATEST_LINK= yes
  27. USE_SUBMAKE= yes
  28. USE_PERL5_BUILD=yes
  29. USE_RC_SUBR= postfix.sh
  30. SCRIPTS_ENV+= POSTFIX_DEFAULT_MTA="${POSTFIX_DEFAULT_MTA}"
  31. # back compat pull in settings from POSTFIX_OPTIONS for convenience when
  32. # make config is run (happens first time port is built, too)
  33. .for o in SASL2 SASLKRB SASLKRB5 SASLKRB5MIT TLS BDB MySQL PgSQL OpenLDAP CDB NIS VDA Test
  34. STATUS_${o}=off
  35. .endfor
  36. .if defined(POSTFIX_OPTIONS)
  37. . for o in ${POSTFIX_OPTIONS}
  38. STATUS_${o}=on
  39. . endfor
  40. .endif
  41. OPTIONS= PCRE "Perl Compatible Regular Expressions" on \
  42. SASL2 "Cyrus SASLv2 (Simple Auth. and Sec. Layer)" ${STATUS_SASL2} \
  43. DOVECOT "Dovecot SASL authentication method" off \
  44. SASLKRB "If your SASL req. Kerberos, select this" ${STATUS_SASLKRB} \
  45. SASLKRB5 "If your SASL req. Kerberos5, select this" ${STATUS_SASLKRB5} \
  46. SASLKMIT "If your SASL req. MIT Kerberos5, select this" ${STATUS_SASLKRB5MIT} \
  47. TLS "Enable SSL and TLS support" ${STATUS_TLS} \
  48. BDB "Berkeley DB (uses WITH_BDB_VER)" ${STATUS_BDB} \
  49. MYSQL "MySQL maps (uses WITH_MYSQL_VER)" ${STATUS_MySQL} \
  50. PGSQL "PostgreSQL maps (uses DEFAULT_PGSQL_VER)" ${STATUS_PgSQL} \
  51. OPENLDAP "OpenLDAP maps (uses WITH_OPENLDAP_VER)" ${STATUS_OpenLDAP} \
  52. CDB "CDB maps lookups" ${STATUS_CDB} \
  53. NIS "NIS maps lookups" ${STATUS_NIS} \
  54. VDA "VDA (Virtual Delivery Agent 32Bit)" ${STATUS_VDA} \
  55. TEST "SMTP/LMTP test server and generator" ${STATUS_Test}
  56. .include <bsd.port.options.mk>
  57. MAN1= postalias.1 postcat.1 postconf.1 postdrop.1 postfix.1 postkick.1 \
  58. postlock.1 postlog.1 postmap.1 postmulti.1 postqueue.1 postsuper.1 \
  59. sendmail.1 qshape.1
  60. MAN5= access.5 aliases.5 bounce.5 canonical.5 cidr_table.5 generic.5 \
  61. header_checks.5 ldap_table.5 master.5 mysql_table.5 nisplus_table.5 \
  62. pcre_table.5 pgsql_table.5 postconf.5 postfix-wrapper.5 regexp_table.5 \
  63. relocated.5 tcp_table.5 transport.5 virtual.5
  64. MAN8= anvil.8 bounce.8 cleanup.8 discard.8 error.8 flush.8 local.8 master.8 \
  65. oqmgr.8 pickup.8 pipe.8 proxymap.8 qmgr.8 qmqpd.8 scache.8 showq.8 \
  66. smtp.8 smtpd.8 spawn.8 tlsmgr.8 trivial-rewrite.8 verify.8 virtual.8
  67. MLINKS= sendmail.1 mailq.1 \
  68. sendmail.1 newaliases.1 \
  69. header_checks.5 body_checks.5 \
  70. bounce.8 defer.8 \
  71. bounce.8 trace.8 \
  72. smtp.8 lmtp.8
  73. HTML1= SOHO_README.html body_checks.5.html bounce.5.html postfix-power.png \
  74. scache.8.html tlsmgr.8.html
  75. .if ${OSVERSION} >= 800037
  76. KRB5_EXTR= -lhx509
  77. .endif
  78. .if !defined(DEBUG)
  79. MAKEFILEFLAGS+= DEBUG=
  80. .endif
  81. MAKEFILEFLAGS+= CC="${CC}" OPT="${CFLAGS}"
  82. POSTFIX_CCARGS+= -DDEF_CONFIG_DIR=\\\"${ETCDIR}\\\" \
  83. -DDEF_DAEMON_DIR=\\\"${DAEMONDIR}\\\" \
  84. -DDEF_COMMAND_DIR=\\\"${PREFIX}/sbin\\\" \
  85. -DDEF_SENDMAIL_PATH=\\\"${PREFIX}/sbin/sendmail\\\" \
  86. -DDEF_NEWALIAS_PATH=\\\"${PREFIX}/bin/newaliases\\\" \
  87. -DDEF_MAILQ_PATH=\\\"${PREFIX}/bin/mailq\\\" \
  88. -DDEF_MANPAGE_DIR=\\\"${MANPREFIX}/man\\\" \
  89. -DDEF_README_DIR=\\\"${READMEDIR}\\\" \
  90. -DDEF_HTML_DIR=\\\"${READMEDIR}\\\" \
  91. -DDEF_QUEUE_DIR=\\\"/var/spool/postfix\\\" \
  92. -DDEF_DATA_DIR=\\\"/var/db/postfix\\\" \
  93. -DDEF_MAIL_OWNER=\\\"postfix\\\" \
  94. -DDEF_SGID_GROUP=\\\"maildrop\\\" \
  95. # Default requirement for postfix rc script
  96. _REQUIRE= LOGIN cleanvar
  97. .if defined(WITH_PCRE)
  98. LIB_DEPENDS+= pcre.0:${PORTSDIR}/devel/pcre
  99. POSTFIX_CCARGS+= -DHAS_PCRE -I${LOCALBASE}/include
  100. POSTFIX_AUXLIBS+= -L${LOCALBASE}/lib -lpcre
  101. .else
  102. POSTFIX_CCARGS+= -DNO_PCRE
  103. .endif
  104. .if defined(WITH_SASL2)
  105. LIB_DEPENDS+= sasl2.2:${PORTSDIR}/security/cyrus-sasl2
  106. POSTFIX_CCARGS+= -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I${LOCALBASE}/include -I${LOCALBASE}/include/sasl
  107. POSTFIX_AUXLIBS+= -L${LOCALBASE}/lib -lsasl2 -lpam -lcrypt
  108. .endif
  109. .if defined(WITH_DOVECOT)
  110. RUN_DEPENDS+= dovecot:${PORTSDIR}/mail/dovecot
  111. POSTFIX_CCARGS+= -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\"
  112. _REQUIRE+= dovecot
  113. .endif
  114. .if defined(WITH_SASLKRB)
  115. .if defined(WITH_SASLKRB5) || defined(WITH_SASLKMIT)
  116. BROKEN= Select only one SASL Kerberos option
  117. .endif
  118. POSTFIX_AUXLIBS+= -lkrb -lcrypto -lcom_err
  119. .endif
  120. .if defined(WITH_SASLKRB5)
  121. .if defined(WITH_SASLKRB) || defined(WITH_SASLKMIT)
  122. BROKEN= Select only one SASL Kerberos option
  123. .endif
  124. POSTFIX_AUXLIBS+= -lkrb5 ${KRB5_EXTR} -lcrypto -lcrypt -lcom_err -lasn1 -lroken
  125. .endif
  126. .if defined(WITH_SASLKMIT)
  127. .if defined(WITH_SASLKRB) || defined(WITH_SASLKRB5)
  128. BROKEN= Select only one SASL Kerberos option
  129. .endif
  130. LIB_DEPENDS+= krb5.3:${PORTSDIR}/security/krb5
  131. POSTFIX_AUXLIBS+= -Wl,--rpath,$${KRB5_HOME:-${LOCALBASE}}/lib -lkrb5 -lcrypto -lcrypt -lcom_err
  132. .endif
  133. .if defined(WITH_TLS)
  134. .include "${PORTSDIR}/Mk/bsd.openssl.mk"
  135. POSTFIX_CCARGS+= -DUSE_TLS -I${OPENSSLINC}
  136. POSTFIX_AUXLIBS+= -L${OPENSSLLIB} ${LDFLAGS} -lssl -lcrypto
  137. .endif
  138. .if defined(WITH_BDB)
  139. USE_BDB= yes
  140. POSTFIX_CCARGS+= -I${BDB_INCLUDE_DIR}
  141. POSTFIX_AUXLIBS+= -L${BDB_LIB_DIR} -l${BDB_LIB_NAME}
  142. .endif
  143. .if defined(WITH_MYSQL)
  144. USE_MYSQL= yes
  145. POSTFIX_CCARGS+= -DHAS_MYSQL -I${LOCALBASE}/include/mysql
  146. POSTFIX_AUXLIBS+= -L${LOCALBASE}/lib/mysql -lmysqlclient -lz -lcrypt -lm
  147. _REQUIRE+= mysql
  148. .endif
  149. .if defined(WITH_PGSQL)
  150. USE_PGSQL= yes
  151. POSTFIX_CCARGS+= -DHAS_PGSQL -I${LOCALBASE}/include -I${LOCALBASE}/pgsql/include
  152. POSTFIX_AUXLIBS+= -L${LOCALBASE}/lib -L${LOCALBASE}/pgsql/lib -lpq -lcrypt
  153. _REQUIRE+= postgresql
  154. .endif
  155. .if defined(WITH_OPENLDAP)
  156. USE_OPENLDAP= yes
  157. .if defined(WITH_OPENLDAP_VER)
  158. WANT_OPENLDAP_VER= ${WITH_OPENLDAP_VER}
  159. .endif
  160. POSTFIX_CCARGS+= -DHAS_LDAP -I${LOCALBASE}/include
  161. POSTFIX_AUXLIBS+= -L${LOCALBASE}/lib -lldap -llber
  162. _REQUIRE+= slapd
  163. .endif
  164. .if defined(WITH_CDB)
  165. BUILD_DEPENDS+= ${LOCALBASE}/lib/libcdb.a:${PORTSDIR}/databases/tinycdb
  166. POSTFIX_CCARGS+= -DHAS_CDB -I${LOCALBASE}/include
  167. POSTFIX_AUXLIBS+= -L${LOCALBASE}/lib -lcdb
  168. .endif
  169. .if defined(WITH_NIS)
  170. POSTFIX_CCARGS+= -DHAS_NIS
  171. _REQUIRE+= ypserv
  172. .endif
  173. # 32Bit VDA patch (64Bit has different patch)
  174. .if defined(WITH_VDA)
  175. PATCH_SITES+= http://vda.sourceforge.net/VDA/
  176. PATCHFILES+= postfix-${VDAVERSION}-vda-ng.patch.gz
  177. PATCH_DIST_STRIP= -p1
  178. PLIST_SUB+= VDA=""
  179. .else
  180. PLIST_SUB+= VDA="@comment "
  181. .endif
  182. .if defined(WITH_TEST)
  183. BINTEST= qmqp-sink qmqp-source smtp-sink smtp-source
  184. MANTEST= qmqp-sink.1 qmqp-source.1 smtp-sink.1 smtp-source.1
  185. MAN1+= ${MANTEST}
  186. PLIST_SUB+= TEST=""
  187. .else
  188. PLIST_SUB+= TEST="@comment "
  189. .endif
  190. .if defined(NOPORTDOCS)
  191. READMEDIR= no
  192. .else
  193. READMEDIR= ${DOCSDIR}
  194. .endif
  195. DAEMONDIR= ${PREFIX}/libexec/postfix
  196. SUB_LIST+= REQUIRE="${_REQUIRE}" READMEDIR="${READMEDIR}" DAEMONDIR="${DAEMONDIR}"
  197. SUB_FILES+= pkg-install pkg-message
  198. # sed script for files in ${WRKSRC}/README_FILES ${WRKSRC}/conf ${WRKSRC}/man
  199. REINPLACE= s!^PATH=.*!PATH=/bin:/sbin:/usr/bin:/usr/sbin:${PREFIX}/bin:${PREFIX}/sbin!;\
  200. s!(_directory = )/usr/!\1${PREFIX}/!g;\
  201. s!^(data_directory = /var/)lib/!\1db/!g;\
  202. s!^\#(mynetworks_style = host)!\1!g;\
  203. s!^(sendmail_path =)!\1 ${PREFIX}/sbin/sendmail!g;\
  204. s!^(newaliases_path =)!\1 ${PREFIX}/bin/newaliases!g;\
  205. s!^(mailq_path =)!\1 ${PREFIX}/bin/mailq!g;\
  206. s!^(setgid_group =)!\1 maildrop!g;\
  207. s!^(manpage_directory =)!\1 ${PREFIX}/man!g;\
  208. s!^((html|readme)_directory =)!\1 ${READMEDIR}!g;\
  209. \!^\#alias_database = dbm:/etc/mail/aliases$$!d;\
  210. s!(:|= )/etc/postfix!\1$$config_directory!g;\
  211. s!/etc/postfix!${ETCDIR}!g;\
  212. s!^(sample_directory =)!\1 ${ETCDIR}!g;\
  213. s!($config_directory/(access|aliases|canonical|generic|header_checks|relocated|transport|virtual):f:root:-:644:)p1!\1o!;
  214. pre-patch:
  215. .if defined(POSTFIX_OPTIONS)
  216. @${ECHO_MSG}
  217. @${ECHO_MSG}
  218. @${ECHO_MSG}
  219. @${ECHO_MSG} "***** ALERT *****"
  220. @${ECHO_MSG} "POSTFIX_OPTIONS is no longer supported,"
  221. @${ECHO_MSG} "${PORTNAME} uses options, consider running"
  222. @${ECHO_MSG} "# make config"
  223. @${ECHO_MSG}
  224. @${ECHO_MSG}
  225. @${ECHO_MSG}
  226. @sleep 10
  227. .endif
  228. .if defined(WITH_SASL2) && !defined(WITH_MYSQL) && exists(${LOCALBASE}/lib/libsasl2.a)
  229. @if /usr/bin/nm ${LOCALBASE}/lib/libsasl2.a | ${GREP} -wq "mysql_init"; then \
  230. ${ECHO_MSG}; \
  231. ${ECHO_MSG} "Your SASL2 library it's compiled with MYSQL"; \
  232. ${ECHO_MSG} "If you use MYSQL in ${PORTNAME} consider CTRL+C and"; \
  233. ${ECHO_MSG} "select MYSQL OPTION in config menu."; \
  234. ${ECHO_MSG} "# make clean config"; \
  235. ${ECHO_MSG}; \
  236. sleep 5; \
  237. fi
  238. .endif
  239. @${ECHO} '<HTML><BODY>See <A HREF="header_checks.5.html">header_checks.5.html</A></BODY></HTML>' \
  240. > ${WRKSRC}/html/body_checks.5.html
  241. @${REINPLACE_CMD} -E -e 's![[:<:]]perl[[:>:]]!${PERL}!' \
  242. ${WRKSRC}/src/bounce/Makefile.in
  243. @${REINPLACE_CMD} -E -e 's!^(#define DEF_SGID_GROUP[^"]+)"postdrop"$$!\1"maildrop"!' \
  244. ${WRKSRC}/src/global/mail_params.h
  245. @${FIND} -X ${WRKSRC}/README_FILES ${WRKSRC}/conf ${WRKSRC}/man \
  246. -type f -a ! \( -name INSTALL -o -name aliases \) | ${XARGS} \
  247. ${REINPLACE_CMD} -E -e '${REINPLACE}'
  248. post-patch:
  249. @${ECHO} '$$readme_directory/SOHO_README:f:root:-:644' \
  250. >> ${WRKSRC}/conf/postfix-files
  251. .for f in ${HTML1}
  252. @${ECHO} '$$html_directory/$f:f:root:-:644' \
  253. >> ${WRKSRC}/conf/postfix-files
  254. .endfor
  255. .if defined(WITH_VDA)
  256. @${ECHO} '$$readme_directory/VDA_README:f:root:-:644' \
  257. >> ${WRKSRC}/conf/postfix-files
  258. @${REINPLACE_CMD} -E -e '${REINPLACE}' \
  259. ${WRKSRC}/README_FILES/VDA_README
  260. .endif
  261. do-configure:
  262. (cd ${WRKSRC} && ${MAKE} -f Makefile.init makefiles ${MAKEFILEFLAGS} \
  263. CCARGS="${POSTFIX_CCARGS}" AUXLIBS="${POSTFIX_AUXLIBS}" && \
  264. ${ECHO} "all: default" >> Makefile)
  265. do-install:
  266. @cd ${WRKSRC} && ${SH} postfix-install -non-interactive install_root=/ tempdir=/tmp \
  267. config_directory=${ETCDIR} \
  268. command_directory=${PREFIX}/sbin \
  269. daemon_directory=${DAEMONDIR} \
  270. html_directory=${READMEDIR} \
  271. mailq_path=${PREFIX}/bin/mailq \
  272. manpage_directory=${MANPREFIX}/man \
  273. newaliases_path=${PREFIX}/bin/newaliases \
  274. readme_directory=${READMEDIR} \
  275. sendmail_path=${PREFIX}/sbin/sendmail
  276. ${INSTALL_SCRIPT} ${WRKSRC}/auxiliary/rmail/rmail ${PREFIX}/bin/rmail
  277. ${INSTALL_SCRIPT} ${WRKSRC}/auxiliary/qshape/qshape.pl ${PREFIX}/bin/qshape
  278. ${INSTALL_MAN} ${WRKSRC}/man/man1/qshape.1 ${MANPREFIX}/man/man1
  279. .for f in ${BINTEST}
  280. ${INSTALL_PROGRAM} ${WRKSRC}/bin/${f} ${PREFIX}/bin
  281. .endfor
  282. .for f in ${MANTEST}
  283. ${INSTALL_MAN} ${WRKSRC}/man/man1/${f} ${MANPREFIX}/man/man1
  284. .endfor
  285. post-install:
  286. @${SETENV} ${SCRIPTS_ENV} PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
  287. # Fix compressed man pages
  288. @${REINPLACE_CMD} -i '' -E -e "s|(man[158]/.*.[158]):|\1.gz:|g" ${DAEMONDIR}/postfix-files
  289. @${CAT} ${PKGMESSAGE}
  290. .include <bsd.port.mk>