PageRenderTime 51ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/mail/postfix/Makefile

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