diff options
Diffstat (limited to 'meta-networking/recipes-daemons/postfix/postfix_3.8.9.bb')
| -rw-r--r-- | meta-networking/recipes-daemons/postfix/postfix_3.8.9.bb | 240 |
1 files changed, 240 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/postfix/postfix_3.8.9.bb b/meta-networking/recipes-daemons/postfix/postfix_3.8.9.bb new file mode 100644 index 0000000000..2c474e4d04 --- /dev/null +++ b/meta-networking/recipes-daemons/postfix/postfix_3.8.9.bb | |||
| @@ -0,0 +1,240 @@ | |||
| 1 | SUMMARY = "Postfix Mail Transport Agent" | ||
| 2 | DESCRIPTION = "Postfix is Wietse Venema's mail server that started life at \ | ||
| 3 | IBM research as an alternative to the widely-used Sendmail program. \ | ||
| 4 | Postfix attempts to be fast, easy to administer, and secure. The outsidei \ | ||
| 5 | has a definite Sendmail-ish flavor, but the inside is completely different." | ||
| 6 | |||
| 7 | HOMEPAGE= "http://www.postfix.org" | ||
| 8 | SECTION = "mail" | ||
| 9 | DEPENDS = "db icu libpcre libnsl2 m4-native openssl postfix-native \ | ||
| 10 | ${@bb.utils.contains('DISTRO_FEATURES', 'ldap', 'openldap', '', d)} \ | ||
| 11 | ${@bb.utils.contains('DISTRO_FEATURES', 'sasl', 'cyrus-sasl', '', d)} \ | ||
| 12 | " | ||
| 13 | |||
| 14 | LICENSE = "IPL-1.0 | EPL-2.0" | ||
| 15 | LIC_FILES_CHKSUM = "file://LICENSE;md5=b181651ad99a7dc4cc8c4ce2f491ed1a" | ||
| 16 | |||
| 17 | SRC_URI = "http://ftp.porcupine.org/mirrors/postfix-release/official/postfix-${PV}.tar.gz \ | ||
| 18 | file://main.cf \ | ||
| 19 | file://postfix \ | ||
| 20 | file://internal_recipient \ | ||
| 21 | file://postfix.service \ | ||
| 22 | file://aliasesdb \ | ||
| 23 | file://check_hostname.sh \ | ||
| 24 | file://0001-Fix-makedefs.patch \ | ||
| 25 | file://0002-Change-fixed-postconf-to-a-variable-for-cross-compil.patch \ | ||
| 26 | file://0003-makedefs-Use-native-compiler-to-build-makedefs.test.patch \ | ||
| 27 | file://0004-Fix-icu-config.patch \ | ||
| 28 | file://0005-makedefs-add-lnsl-and-lresolv-to-SYSLIBS-by-default.patch \ | ||
| 29 | " | ||
| 30 | |||
| 31 | SRC_URI[sha256sum] = "d0205a11e36d57b640daaa17a7e7166b8abc730d93b1db7e92e32dfb24bbfde1" | ||
| 32 | |||
| 33 | UPSTREAM_CHECK_REGEX = "postfix\-(?P<pver>3\.8(\.\d+)+).tar.gz" | ||
| 34 | |||
| 35 | S = "${WORKDIR}/postfix-${PV}" | ||
| 36 | |||
| 37 | CLEANBROKEN = "1" | ||
| 38 | |||
| 39 | BBCLASSEXTEND = "native" | ||
| 40 | |||
| 41 | inherit pkgconfig update-rc.d useradd update-alternatives systemd lib_package | ||
| 42 | |||
| 43 | INITSCRIPT_NAME = "postfix" | ||
| 44 | INITSCRIPT_PARAMS = "start 58 3 4 5 . stop 13 0 1 6 ." | ||
| 45 | USERADD_PACKAGES = "${PN}-bin" | ||
| 46 | USERADD_PARAM:${PN}-bin = \ | ||
| 47 | "-d /var/spool/postfix -r -g postfix --shell /bin/false postfix; \ | ||
| 48 | -d /var/spool/vmail -r -g vmail --shell /bin/false vmail \ | ||
| 49 | " | ||
| 50 | GROUPADD_PARAM:${PN}-bin = "--system postfix;--system postdrop;--system vmail" | ||
| 51 | |||
| 52 | export SYSLIBS = "${LDFLAGS}" | ||
| 53 | |||
| 54 | # CCARGS specifies includes, defines | ||
| 55 | # AUXLIBS specifies libraries | ||
| 56 | # Linux2/Linux3 has HAS_DB defined | ||
| 57 | # makedefs will make CC to be CC+CCARGS | ||
| 58 | |||
| 59 | # ldap support | ||
| 60 | export CCARGS-ldap = "\ | ||
| 61 | ${@bb.utils.contains('DISTRO_FEATURES', 'ldap', '-DHAS_LDAP', '', d)}" | ||
| 62 | export AUXLIBS-ldap = "\ | ||
| 63 | ${@bb.utils.contains('DISTRO_FEATURES', 'ldap', '-lldap -llber', '', d)}" | ||
| 64 | |||
| 65 | # no native openldap | ||
| 66 | export CCARGS-ldap:class-native = "" | ||
| 67 | export AUXLIBS-ldap:class-native = "" | ||
| 68 | |||
| 69 | export CCARGS-nonis:libc-musl = "-DNO_NIS" | ||
| 70 | export CCARGS-nonis = "" | ||
| 71 | |||
| 72 | # SASL support -DUSE_LDAP_SASL -DUSE_SASL_AUTH | ||
| 73 | # current openldap didn't enable SASL | ||
| 74 | export CCARGS-sasl = "\ | ||
| 75 | ${@bb.utils.contains('DISTRO_FEATURES', 'sasl', '-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I${STAGING_INCDIR}/sasl', '', d)}" | ||
| 76 | export AUXLIBS-sasl = "\ | ||
| 77 | ${@bb.utils.contains('DISTRO_FEATURES', 'sasl', '-lsasl2', '', d)}" | ||
| 78 | export CCARGS-sasl:class-native = "" | ||
| 79 | export AUXLIBS-sasl:class-native = "" | ||
| 80 | |||
| 81 | # PCRE, TLS support default | ||
| 82 | export CCARGS = "${CFLAGS} -DHAS_PCRE -DUSE_TLS -I${STAGING_INCDIR}/openssl ${CCARGS-ldap} ${CCARGS-sasl} ${CCARGS-nonis}" | ||
| 83 | export AUXLIBS = "-lpcre -lssl -lcrypto ${AUXLIBS-sasl} ${AUXLIBS-ldap}" | ||
| 84 | export POSTCONF = "${STAGING_DIR_NATIVE}${sbindir_native}/postconf" | ||
| 85 | |||
| 86 | # OPT,DEBUG is aready in CFLAGS | ||
| 87 | # ignore the OPTS="CC=$CC" in Makefile it will not use the CC=$CC $CCARGS | ||
| 88 | EXTRA_OEMAKE += "OPT= DEBUG= OPTS= " | ||
| 89 | |||
| 90 | do_compile () { | ||
| 91 | unset CFLAGS CPPFLAGS CXXFLAGS | ||
| 92 | local native_build | ||
| 93 | |||
| 94 | native_build="${@['0', '1'][bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d)]}" | ||
| 95 | |||
| 96 | # if not native build, then pass SYSTEM and RELEASE to makedefs | ||
| 97 | if [ "${native_build}" != "1" ]; then | ||
| 98 | # uname -s for target | ||
| 99 | SYSTEM="Linux" | ||
| 100 | |||
| 101 | # uname -r, use 2.6 as bottomline, even target kernel ver > 2.6 | ||
| 102 | RELEASE="2.6.34" | ||
| 103 | sed -i -e \ | ||
| 104 | "s:\$(SHELL) makedefs):\$(SHELL) makedefs $SYSTEM $RELEASE):" \ | ||
| 105 | ${S}/Makefile.in | ||
| 106 | export BUILD_SYSROOT="${STAGING_DIR_HOST}" | ||
| 107 | else | ||
| 108 | # native build | ||
| 109 | export BUILD_SYSROOT="${STAGING_DIR_NATIVE}" | ||
| 110 | fi | ||
| 111 | |||
| 112 | oe_runmake makefiles | ||
| 113 | oe_runmake | ||
| 114 | } | ||
| 115 | |||
| 116 | do_install:prepend:class-native() { | ||
| 117 | export POSTCONF="bin/postconf" | ||
| 118 | } | ||
| 119 | |||
| 120 | SYSTEMD_SERVICE:${PN} = "postfix.service" | ||
| 121 | |||
| 122 | do_install () { | ||
| 123 | sh ./postfix-install 'install_root=${D}' \ | ||
| 124 | 'config_directory=${sysconfdir}/postfix' \ | ||
| 125 | 'daemon_directory=${libexecdir}/postfix' \ | ||
| 126 | 'command_directory=${sbindir}' \ | ||
| 127 | 'queue_directory=${localstatedir}/spool/postfix' \ | ||
| 128 | 'sendmail_path=${sbindir}/sendmail.postfix' \ | ||
| 129 | 'newaliases_path=${bindir}/newaliases' \ | ||
| 130 | 'mailq_path=${bindir}/mailq' \ | ||
| 131 | 'manpage_directory=${mandir}' \ | ||
| 132 | 'readme_directory=${datadir}/doc/postfix' \ | ||
| 133 | 'data_directory=${localstatedir}/lib/postfix' \ | ||
| 134 | -non-interactive | ||
| 135 | rm -rf ${D}${localstatedir}/spool/postfix | ||
| 136 | mv ${D}${sysconfdir}/postfix/main.cf ${D}${sysconfdir}/postfix/${MLPREFIX}sample-main.cf | ||
| 137 | install -m 755 ${S}/bin/smtp-sink ${D}/${sbindir}/ | ||
| 138 | install -d ${D}${sysconfdir}/init.d | ||
| 139 | install -m 644 ${UNPACKDIR}/main.cf ${D}${sysconfdir}/postfix/main.cf | ||
| 140 | sed -i 's#@LIBEXECDIR@#${libexecdir}#' ${D}${sysconfdir}/postfix/main.cf | ||
| 141 | |||
| 142 | install -m 755 ${UNPACKDIR}/check_hostname.sh ${D}${sbindir}/ | ||
| 143 | |||
| 144 | install -m 755 ${UNPACKDIR}/postfix ${D}${sysconfdir}/init.d/postfix | ||
| 145 | install -m 644 ${UNPACKDIR}/internal_recipient ${D}${sysconfdir}/postfix/internal_recipient | ||
| 146 | |||
| 147 | install -d ${D}${systemd_unitdir}/system | ||
| 148 | install -m 0644 ${UNPACKDIR}/postfix.service ${D}${systemd_unitdir}/system | ||
| 149 | sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}${systemd_unitdir}/system/postfix.service | ||
| 150 | sed -i -e 's#@LOCALSTATEDIR@#${localstatedir}#g' ${D}${systemd_unitdir}/system/postfix.service | ||
| 151 | sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/postfix.service | ||
| 152 | |||
| 153 | install -m 0755 ${UNPACKDIR}/aliasesdb ${D}${libexecdir}/postfix | ||
| 154 | |||
| 155 | install -m 770 -d ${D}${localstatedir}/spool/postfix | ||
| 156 | chown postfix:postfix ${D}${localstatedir}/spool/postfix | ||
| 157 | |||
| 158 | install -m 0755 -d ${D}${localstatedir}/lib/postfix | ||
| 159 | chown postfix:nogroup ${D}${localstatedir}/lib/postfix | ||
| 160 | install -m 0755 -d ${D}${localstatedir}/spool/postfix | ||
| 161 | chown root:postfix ${D}${localstatedir}/spool/postfix | ||
| 162 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/active | ||
| 163 | chown postfix:root ${D}${localstatedir}/spool/postfix/active | ||
| 164 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/bounce | ||
| 165 | chown postfix:root ${D}${localstatedir}/spool/postfix/bounce | ||
| 166 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/corrupt | ||
| 167 | chown postfix:root ${D}${localstatedir}/spool/postfix/corrupt | ||
| 168 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/defer | ||
| 169 | chown postfix:root ${D}${localstatedir}/spool/postfix/defer | ||
| 170 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/deferred | ||
| 171 | chown postfix:root ${D}${localstatedir}/spool/postfix/deferred | ||
| 172 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/flush | ||
| 173 | chown postfix:root ${D}${localstatedir}/spool/postfix/flush | ||
| 174 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/hold | ||
| 175 | chown postfix:root ${D}${localstatedir}/spool/postfix/hold | ||
| 176 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/incoming | ||
| 177 | chown postfix:root ${D}${localstatedir}/spool/postfix/incoming | ||
| 178 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/saved | ||
| 179 | chown postfix:root ${D}${localstatedir}/spool/postfix/saved | ||
| 180 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/trace | ||
| 181 | chown postfix:root ${D}${localstatedir}/spool/postfix/trace | ||
| 182 | install -m 0730 -d ${D}${localstatedir}/spool/postfix/maildrop | ||
| 183 | chown postfix:postdrop ${D}${localstatedir}/spool/postfix/maildrop | ||
| 184 | install -m 0755 -d ${D}${localstatedir}/spool/postfix/pid | ||
| 185 | chown root:root ${D}${localstatedir}/spool/postfix/pid | ||
| 186 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/private | ||
| 187 | chown postfix:root ${D}${localstatedir}/spool/postfix/private | ||
| 188 | install -m 0710 -d ${D}${localstatedir}/spool/postfix/public | ||
| 189 | chown postfix:postdrop ${D}${localstatedir}/spool/postfix/public | ||
| 190 | install -m 0755 -d ${D}${localstatedir}/spool/vmail | ||
| 191 | chown vmail:vmail ${D}${localstatedir}/spool/vmail | ||
| 192 | |||
| 193 | chown :postdrop ${D}${sbindir}/postqueue | ||
| 194 | chown :postdrop ${D}${sbindir}/postdrop | ||
| 195 | chmod g+s ${D}${sbindir}/postqueue | ||
| 196 | chmod g+s ${D}${sbindir}/postdrop | ||
| 197 | |||
| 198 | rm -rf ${D}/etc/postfix/makedefs.out | ||
| 199 | } | ||
| 200 | |||
| 201 | do_install:append:class-native() { | ||
| 202 | ln -sf ../sbin/sendmail.postfix ${D}${bindir}/newaliases | ||
| 203 | ln -sf ../sbin/sendmail.postfix ${D}${bindir}/mailq | ||
| 204 | } | ||
| 205 | |||
| 206 | ALTERNATIVE:${PN}-bin = "sendmail mailq newaliases" | ||
| 207 | # /usr/lib/sendmial is required by LSB core test | ||
| 208 | ALTERNATIVE:${PN}-bin:linuxstdbase = "sendmail mailq newaliases usr-lib-sendmail" | ||
| 209 | ALTERNATIVE_TARGET[mailq] = "${bindir}/mailq" | ||
| 210 | ALTERNATIVE_TARGET[newaliases] = "${bindir}/newaliases" | ||
| 211 | ALTERNATIVE_TARGET[sendmail] = "${sbindir}/sendmail.postfix" | ||
| 212 | ALTERNATIVE_LINK_NAME[sendmail] = "${sbindir}/sendmail" | ||
| 213 | ALTERNATIVE_TARGET[usr-lib-sendmail] = "${sbindir}/sendmail.postfix" | ||
| 214 | ALTERNATIVE_LINK_NAME[usr-lib-sendmail] = "/usr/lib/sendmail" | ||
| 215 | |||
| 216 | ALTERNATIVE_PRIORITY = "120" | ||
| 217 | |||
| 218 | ALTERNATIVE:${PN}-doc += "mailq.1 newaliases.1 sendmail.1" | ||
| 219 | ALTERNATIVE_LINK_NAME[mailq.1] = "${mandir}/man1/mailq.1" | ||
| 220 | ALTERNATIVE_LINK_NAME[newaliases.1] = "${mandir}/man1/newaliases.1" | ||
| 221 | ALTERNATIVE_LINK_NAME[sendmail.1] = "${mandir}/man1/sendmail.1" | ||
| 222 | |||
| 223 | pkg_postinst_ontarget:${PN}-cfg () { | ||
| 224 | touch /etc/aliases | ||
| 225 | newaliases | ||
| 226 | |||
| 227 | # generate virtual_alias, default is hash | ||
| 228 | touch /etc/postfix/virtual_alias | ||
| 229 | postmap /etc/postfix/virtual_alias | ||
| 230 | } | ||
| 231 | |||
| 232 | PACKAGES =+ "${PN}-cfg" | ||
| 233 | RDEPENDS:${PN}-cfg:class-target += "${PN}-bin" | ||
| 234 | RDEPENDS:${PN}:class-target += "${PN}-cfg" | ||
| 235 | # Exclude .debug directories from the main package | ||
| 236 | FILES:${PN}-bin += "${localstatedir} ${bindir}/* ${sbindir}/* \ | ||
| 237 | ${libexecdir}/* ${systemd_unitdir}/*" | ||
| 238 | FILES:${PN}-cfg = "${sysconfdir}" | ||
| 239 | FILES:${PN}-dbg += "${libexecdir}/postfix/.debug" | ||
| 240 | ALLOW_EMPTY:${PN} = "1" | ||
