diff options
Diffstat (limited to 'meta-networking/recipes-daemons/postfix/postfix_3.10.6.bb')
| -rw-r--r-- | meta-networking/recipes-daemons/postfix/postfix_3.10.6.bb | 250 |
1 files changed, 250 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/postfix/postfix_3.10.6.bb b/meta-networking/recipes-daemons/postfix/postfix_3.10.6.bb new file mode 100644 index 0000000000..647680bf25 --- /dev/null +++ b/meta-networking/recipes-daemons/postfix/postfix_3.10.6.bb | |||
| @@ -0,0 +1,250 @@ | |||
| 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 libpcre2 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] = "71b383f57d4cb363201be8a301bcbafe304aadbe7f38ebde41cd5b952248465b" | ||
| 32 | |||
| 33 | UPSTREAM_CHECK_URI = "https://www.postfix.org/announcements.html" | ||
| 34 | UPSTREAM_CHECK_REGEX = "postfix-(?P<pver>\d+(\.\d+)+)" | ||
| 35 | |||
| 36 | S = "${UNPACKDIR}/postfix-${PV}" | ||
| 37 | |||
| 38 | CLEANBROKEN = "1" | ||
| 39 | |||
| 40 | BBCLASSEXTEND = "native" | ||
| 41 | |||
| 42 | inherit pkgconfig update-rc.d useradd update-alternatives systemd lib_package | ||
| 43 | |||
| 44 | INITSCRIPT_NAME = "postfix" | ||
| 45 | INITSCRIPT_PARAMS = "start 58 3 4 5 . stop 13 0 1 6 ." | ||
| 46 | USERADD_PACKAGES = "${PN}-bin" | ||
| 47 | USERADD_PARAM:${PN}-bin = \ | ||
| 48 | "-d /var/spool/postfix -r -g postfix --shell /bin/false postfix; \ | ||
| 49 | -d /var/spool/vmail -r -g vmail --shell /bin/false vmail \ | ||
| 50 | " | ||
| 51 | GROUPADD_PARAM:${PN}-bin = "--system postfix;--system postdrop;--system vmail" | ||
| 52 | |||
| 53 | export SYSLIBS = "${LDFLAGS}" | ||
| 54 | |||
| 55 | # CCARGS specifies includes, defines | ||
| 56 | # AUXLIBS specifies libraries | ||
| 57 | # Linux2/Linux3 has HAS_DB defined | ||
| 58 | # makedefs will make CC to be CC+CCARGS | ||
| 59 | |||
| 60 | # ldap support | ||
| 61 | export CCARGS-ldap = "\ | ||
| 62 | ${@bb.utils.contains('DISTRO_FEATURES', 'ldap', '-DHAS_LDAP', '', d)}" | ||
| 63 | export AUXLIBS-ldap = "\ | ||
| 64 | ${@bb.utils.contains('DISTRO_FEATURES', 'ldap', '-lldap -llber', '', d)}" | ||
| 65 | |||
| 66 | # no native openldap | ||
| 67 | export CCARGS-ldap:class-native = "" | ||
| 68 | export AUXLIBS-ldap:class-native = "" | ||
| 69 | |||
| 70 | export CCARGS-nonis:libc-musl = "-DNO_NIS" | ||
| 71 | export CCARGS-nonis = "" | ||
| 72 | |||
| 73 | # SASL support -DUSE_LDAP_SASL -DUSE_SASL_AUTH | ||
| 74 | # current openldap didn't enable SASL | ||
| 75 | export CCARGS-sasl = "\ | ||
| 76 | ${@bb.utils.contains('DISTRO_FEATURES', 'sasl', '-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I${STAGING_INCDIR}/sasl', '', d)}" | ||
| 77 | export AUXLIBS-sasl = "\ | ||
| 78 | ${@bb.utils.contains('DISTRO_FEATURES', 'sasl', '-lsasl2', '', d)}" | ||
| 79 | export CCARGS-sasl:class-native = "" | ||
| 80 | export AUXLIBS-sasl:class-native = "" | ||
| 81 | |||
| 82 | # PCRE, TLS support default | ||
| 83 | export CCARGS = "${CFLAGS} -DHAS_PCRE=2 -DUSE_TLS -I${STAGING_INCDIR}/openssl ${CCARGS-ldap} ${CCARGS-sasl} ${CCARGS-nonis}" | ||
| 84 | export AUXLIBS = "-lpcre2-8 -lssl -lcrypto ${AUXLIBS-sasl} ${AUXLIBS-ldap}" | ||
| 85 | export POSTCONF = "${STAGING_DIR_NATIVE}${sbindir_native}/postconf" | ||
| 86 | |||
| 87 | # OPT,DEBUG is aready in CFLAGS | ||
| 88 | # ignore the OPTS="CC=$CC" in Makefile it will not use the CC=$CC $CCARGS | ||
| 89 | EXTRA_OEMAKE += "OPT= DEBUG= OPTS= " | ||
| 90 | |||
| 91 | # use gnu17 for now as recommended in: | ||
| 92 | # https://marc.info/?l=postfix-users&m=173542420611213 | ||
| 93 | CFLAGS += "-std=gnu17" | ||
| 94 | |||
| 95 | do_compile () { | ||
| 96 | unset CFLAGS CPPFLAGS CXXFLAGS | ||
| 97 | local native_build | ||
| 98 | |||
| 99 | native_build="${@['0', '1'][bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d)]}" | ||
| 100 | |||
| 101 | # if not native build, then pass SYSTEM and RELEASE to makedefs | ||
| 102 | if [ "${native_build}" != "1" ]; then | ||
| 103 | # uname -s for target | ||
| 104 | SYSTEM="Linux" | ||
| 105 | |||
| 106 | # uname -r, use 2.6 as bottomline, even target kernel ver > 2.6 | ||
| 107 | RELEASE="2.6.34" | ||
| 108 | sed -i -e \ | ||
| 109 | "s:\$(SHELL) makedefs):\$(SHELL) makedefs $SYSTEM $RELEASE):" \ | ||
| 110 | ${S}/Makefile.in | ||
| 111 | export BUILD_SYSROOT="${STAGING_DIR_HOST}" | ||
| 112 | else | ||
| 113 | # native build | ||
| 114 | export BUILD_SYSROOT="${STAGING_DIR_NATIVE}" | ||
| 115 | fi | ||
| 116 | |||
| 117 | oe_runmake makefiles | ||
| 118 | oe_runmake | ||
| 119 | } | ||
| 120 | |||
| 121 | do_install:prepend:class-native() { | ||
| 122 | export POSTCONF="bin/postconf" | ||
| 123 | } | ||
| 124 | |||
| 125 | SYSTEMD_SERVICE:${PN} = "postfix.service" | ||
| 126 | |||
| 127 | do_install () { | ||
| 128 | sh ./postfix-install 'install_root=${D}' \ | ||
| 129 | 'config_directory=${sysconfdir}/postfix' \ | ||
| 130 | 'daemon_directory=${libexecdir}/postfix' \ | ||
| 131 | 'command_directory=${sbindir}' \ | ||
| 132 | 'queue_directory=${localstatedir}/spool/postfix' \ | ||
| 133 | 'sendmail_path=${sbindir}/sendmail.postfix' \ | ||
| 134 | 'newaliases_path=${bindir}/newaliases' \ | ||
| 135 | 'mailq_path=${bindir}/mailq' \ | ||
| 136 | 'manpage_directory=${mandir}' \ | ||
| 137 | 'readme_directory=${datadir}/doc/postfix' \ | ||
| 138 | 'data_directory=${localstatedir}/lib/postfix' \ | ||
| 139 | -non-interactive | ||
| 140 | rm -rf ${D}${localstatedir}/spool/postfix | ||
| 141 | mv ${D}${sysconfdir}/postfix/main.cf ${D}${sysconfdir}/postfix/${MLPREFIX}sample-main.cf | ||
| 142 | install -m 755 ${S}/bin/smtp-sink ${D}/${sbindir}/ | ||
| 143 | install -m 644 ${UNPACKDIR}/main.cf ${D}${sysconfdir}/postfix/main.cf | ||
| 144 | sed -i 's#@LIBEXECDIR@#${libexecdir}#' ${D}${sysconfdir}/postfix/main.cf | ||
| 145 | |||
| 146 | install -m 755 ${UNPACKDIR}/check_hostname.sh ${D}${sbindir}/ | ||
| 147 | |||
| 148 | install -m 644 ${UNPACKDIR}/internal_recipient ${D}${sysconfdir}/postfix/internal_recipient | ||
| 149 | |||
| 150 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
| 151 | install -d ${D}${sysconfdir}/init.d | ||
| 152 | install -m 755 ${UNPACKDIR}/postfix ${D}${sysconfdir}/init.d/postfix | ||
| 153 | fi | ||
| 154 | |||
| 155 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
| 156 | install -d ${D}${systemd_unitdir}/system | ||
| 157 | install -m 0644 ${UNPACKDIR}/postfix.service ${D}${systemd_unitdir}/system | ||
| 158 | sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}${systemd_unitdir}/system/postfix.service | ||
| 159 | sed -i -e 's#@LOCALSTATEDIR@#${localstatedir}#g' ${D}${systemd_unitdir}/system/postfix.service | ||
| 160 | sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/postfix.service | ||
| 161 | fi | ||
| 162 | |||
| 163 | install -m 0755 ${UNPACKDIR}/aliasesdb ${D}${libexecdir}/postfix | ||
| 164 | |||
| 165 | install -m 770 -d ${D}${localstatedir}/spool/postfix | ||
| 166 | chown postfix:postfix ${D}${localstatedir}/spool/postfix | ||
| 167 | |||
| 168 | install -m 0755 -d ${D}${localstatedir}/lib/postfix | ||
| 169 | chown postfix:nogroup ${D}${localstatedir}/lib/postfix | ||
| 170 | install -m 0755 -d ${D}${localstatedir}/spool/postfix | ||
| 171 | chown root:postfix ${D}${localstatedir}/spool/postfix | ||
| 172 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/active | ||
| 173 | chown postfix:root ${D}${localstatedir}/spool/postfix/active | ||
| 174 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/bounce | ||
| 175 | chown postfix:root ${D}${localstatedir}/spool/postfix/bounce | ||
| 176 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/corrupt | ||
| 177 | chown postfix:root ${D}${localstatedir}/spool/postfix/corrupt | ||
| 178 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/defer | ||
| 179 | chown postfix:root ${D}${localstatedir}/spool/postfix/defer | ||
| 180 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/deferred | ||
| 181 | chown postfix:root ${D}${localstatedir}/spool/postfix/deferred | ||
| 182 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/flush | ||
| 183 | chown postfix:root ${D}${localstatedir}/spool/postfix/flush | ||
| 184 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/hold | ||
| 185 | chown postfix:root ${D}${localstatedir}/spool/postfix/hold | ||
| 186 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/incoming | ||
| 187 | chown postfix:root ${D}${localstatedir}/spool/postfix/incoming | ||
| 188 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/saved | ||
| 189 | chown postfix:root ${D}${localstatedir}/spool/postfix/saved | ||
| 190 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/trace | ||
| 191 | chown postfix:root ${D}${localstatedir}/spool/postfix/trace | ||
| 192 | install -m 0730 -d ${D}${localstatedir}/spool/postfix/maildrop | ||
| 193 | chown postfix:postdrop ${D}${localstatedir}/spool/postfix/maildrop | ||
| 194 | install -m 0755 -d ${D}${localstatedir}/spool/postfix/pid | ||
| 195 | chown root:root ${D}${localstatedir}/spool/postfix/pid | ||
| 196 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/private | ||
| 197 | chown postfix:root ${D}${localstatedir}/spool/postfix/private | ||
| 198 | install -m 0710 -d ${D}${localstatedir}/spool/postfix/public | ||
| 199 | chown postfix:postdrop ${D}${localstatedir}/spool/postfix/public | ||
| 200 | install -m 0755 -d ${D}${localstatedir}/spool/vmail | ||
| 201 | chown vmail:vmail ${D}${localstatedir}/spool/vmail | ||
| 202 | |||
| 203 | chown :postdrop ${D}${sbindir}/postqueue | ||
| 204 | chown :postdrop ${D}${sbindir}/postdrop | ||
| 205 | chmod g+s ${D}${sbindir}/postqueue | ||
| 206 | chmod g+s ${D}${sbindir}/postdrop | ||
| 207 | |||
| 208 | rm -rf ${D}/etc/postfix/makedefs.out | ||
| 209 | } | ||
| 210 | |||
| 211 | do_install:append:class-native() { | ||
| 212 | ln -sf ../sbin/sendmail.postfix ${D}${bindir}/newaliases | ||
| 213 | ln -sf ../sbin/sendmail.postfix ${D}${bindir}/mailq | ||
| 214 | } | ||
| 215 | |||
| 216 | ALTERNATIVE:${PN}-bin = "sendmail mailq newaliases" | ||
| 217 | # /usr/lib/sendmial is required by LSB core test | ||
| 218 | ALTERNATIVE:${PN}-bin:linuxstdbase = "sendmail mailq newaliases usr-lib-sendmail" | ||
| 219 | ALTERNATIVE_TARGET[mailq] = "${bindir}/mailq" | ||
| 220 | ALTERNATIVE_TARGET[newaliases] = "${bindir}/newaliases" | ||
| 221 | ALTERNATIVE_TARGET[sendmail] = "${sbindir}/sendmail.postfix" | ||
| 222 | ALTERNATIVE_LINK_NAME[sendmail] = "${sbindir}/sendmail" | ||
| 223 | ALTERNATIVE_TARGET[usr-lib-sendmail] = "${sbindir}/sendmail.postfix" | ||
| 224 | ALTERNATIVE_LINK_NAME[usr-lib-sendmail] = "/usr/lib/sendmail" | ||
| 225 | |||
| 226 | ALTERNATIVE_PRIORITY = "120" | ||
| 227 | |||
| 228 | ALTERNATIVE:${PN}-doc += "mailq.1 newaliases.1 sendmail.1" | ||
| 229 | ALTERNATIVE_LINK_NAME[mailq.1] = "${mandir}/man1/mailq.1" | ||
| 230 | ALTERNATIVE_LINK_NAME[newaliases.1] = "${mandir}/man1/newaliases.1" | ||
| 231 | ALTERNATIVE_LINK_NAME[sendmail.1] = "${mandir}/man1/sendmail.1" | ||
| 232 | |||
| 233 | pkg_postinst_ontarget:${PN}-cfg () { | ||
| 234 | touch /etc/aliases | ||
| 235 | newaliases | ||
| 236 | |||
| 237 | # generate virtual_alias, default is hash | ||
| 238 | touch /etc/postfix/virtual_alias | ||
| 239 | postmap /etc/postfix/virtual_alias | ||
| 240 | } | ||
| 241 | |||
| 242 | PACKAGES =+ "${PN}-cfg" | ||
| 243 | RDEPENDS:${PN}-cfg:class-target += "${PN}-bin" | ||
| 244 | RDEPENDS:${PN}:class-target += "${PN}-cfg" | ||
| 245 | # Exclude .debug directories from the main package | ||
| 246 | FILES:${PN}-bin += "${localstatedir} ${bindir}/* ${sbindir}/* \ | ||
| 247 | ${libexecdir}/* ${systemd_unitdir}/*" | ||
| 248 | FILES:${PN}-cfg = "${sysconfdir}" | ||
| 249 | FILES:${PN}-dbg += "${libexecdir}/postfix/.debug" | ||
| 250 | ALLOW_EMPTY:${PN} = "1" | ||
