diff options
Diffstat (limited to 'meta-networking/recipes-daemons/postfix/postfix_3.10.1.bb')
-rw-r--r-- | meta-networking/recipes-daemons/postfix/postfix_3.10.1.bb | 249 |
1 files changed, 249 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/postfix/postfix_3.10.1.bb b/meta-networking/recipes-daemons/postfix/postfix_3.10.1.bb new file mode 100644 index 0000000000..a85176d871 --- /dev/null +++ b/meta-networking/recipes-daemons/postfix/postfix_3.10.1.bb | |||
@@ -0,0 +1,249 @@ | |||
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] = "75868db7a8ed252cd3a14c13a3ce383ddd42563160c02027d061202ee36799bf" | ||
32 | |||
33 | UPSTREAM_CHECK_REGEX = "postfix\-(?P<pver>3\.10(\.\d+)+).tar.gz" | ||
34 | |||
35 | S = "${UNPACKDIR}/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 | # use gnu17 for now as recommended in: | ||
91 | # https://marc.info/?l=postfix-users&m=173542420611213 | ||
92 | CFLAGS += "-std=gnu17" | ||
93 | |||
94 | do_compile () { | ||
95 | unset CFLAGS CPPFLAGS CXXFLAGS | ||
96 | local native_build | ||
97 | |||
98 | native_build="${@['0', '1'][bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d)]}" | ||
99 | |||
100 | # if not native build, then pass SYSTEM and RELEASE to makedefs | ||
101 | if [ "${native_build}" != "1" ]; then | ||
102 | # uname -s for target | ||
103 | SYSTEM="Linux" | ||
104 | |||
105 | # uname -r, use 2.6 as bottomline, even target kernel ver > 2.6 | ||
106 | RELEASE="2.6.34" | ||
107 | sed -i -e \ | ||
108 | "s:\$(SHELL) makedefs):\$(SHELL) makedefs $SYSTEM $RELEASE):" \ | ||
109 | ${S}/Makefile.in | ||
110 | export BUILD_SYSROOT="${STAGING_DIR_HOST}" | ||
111 | else | ||
112 | # native build | ||
113 | export BUILD_SYSROOT="${STAGING_DIR_NATIVE}" | ||
114 | fi | ||
115 | |||
116 | oe_runmake makefiles | ||
117 | oe_runmake | ||
118 | } | ||
119 | |||
120 | do_install:prepend:class-native() { | ||
121 | export POSTCONF="bin/postconf" | ||
122 | } | ||
123 | |||
124 | SYSTEMD_SERVICE:${PN} = "postfix.service" | ||
125 | |||
126 | do_install () { | ||
127 | sh ./postfix-install 'install_root=${D}' \ | ||
128 | 'config_directory=${sysconfdir}/postfix' \ | ||
129 | 'daemon_directory=${libexecdir}/postfix' \ | ||
130 | 'command_directory=${sbindir}' \ | ||
131 | 'queue_directory=${localstatedir}/spool/postfix' \ | ||
132 | 'sendmail_path=${sbindir}/sendmail.postfix' \ | ||
133 | 'newaliases_path=${bindir}/newaliases' \ | ||
134 | 'mailq_path=${bindir}/mailq' \ | ||
135 | 'manpage_directory=${mandir}' \ | ||
136 | 'readme_directory=${datadir}/doc/postfix' \ | ||
137 | 'data_directory=${localstatedir}/lib/postfix' \ | ||
138 | -non-interactive | ||
139 | rm -rf ${D}${localstatedir}/spool/postfix | ||
140 | mv ${D}${sysconfdir}/postfix/main.cf ${D}${sysconfdir}/postfix/${MLPREFIX}sample-main.cf | ||
141 | install -m 755 ${S}/bin/smtp-sink ${D}/${sbindir}/ | ||
142 | install -m 644 ${UNPACKDIR}/main.cf ${D}${sysconfdir}/postfix/main.cf | ||
143 | sed -i 's#@LIBEXECDIR@#${libexecdir}#' ${D}${sysconfdir}/postfix/main.cf | ||
144 | |||
145 | install -m 755 ${UNPACKDIR}/check_hostname.sh ${D}${sbindir}/ | ||
146 | |||
147 | install -m 644 ${UNPACKDIR}/internal_recipient ${D}${sysconfdir}/postfix/internal_recipient | ||
148 | |||
149 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
150 | install -d ${D}${sysconfdir}/init.d | ||
151 | install -m 755 ${UNPACKDIR}/postfix ${D}${sysconfdir}/init.d/postfix | ||
152 | fi | ||
153 | |||
154 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
155 | install -d ${D}${systemd_unitdir}/system | ||
156 | install -m 0644 ${UNPACKDIR}/postfix.service ${D}${systemd_unitdir}/system | ||
157 | sed -i -e 's#@LIBEXECDIR@#${libexecdir}#g' ${D}${systemd_unitdir}/system/postfix.service | ||
158 | sed -i -e 's#@LOCALSTATEDIR@#${localstatedir}#g' ${D}${systemd_unitdir}/system/postfix.service | ||
159 | sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/postfix.service | ||
160 | fi | ||
161 | |||
162 | install -m 0755 ${UNPACKDIR}/aliasesdb ${D}${libexecdir}/postfix | ||
163 | |||
164 | install -m 770 -d ${D}${localstatedir}/spool/postfix | ||
165 | chown postfix:postfix ${D}${localstatedir}/spool/postfix | ||
166 | |||
167 | install -m 0755 -d ${D}${localstatedir}/lib/postfix | ||
168 | chown postfix:nogroup ${D}${localstatedir}/lib/postfix | ||
169 | install -m 0755 -d ${D}${localstatedir}/spool/postfix | ||
170 | chown root:postfix ${D}${localstatedir}/spool/postfix | ||
171 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/active | ||
172 | chown postfix:root ${D}${localstatedir}/spool/postfix/active | ||
173 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/bounce | ||
174 | chown postfix:root ${D}${localstatedir}/spool/postfix/bounce | ||
175 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/corrupt | ||
176 | chown postfix:root ${D}${localstatedir}/spool/postfix/corrupt | ||
177 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/defer | ||
178 | chown postfix:root ${D}${localstatedir}/spool/postfix/defer | ||
179 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/deferred | ||
180 | chown postfix:root ${D}${localstatedir}/spool/postfix/deferred | ||
181 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/flush | ||
182 | chown postfix:root ${D}${localstatedir}/spool/postfix/flush | ||
183 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/hold | ||
184 | chown postfix:root ${D}${localstatedir}/spool/postfix/hold | ||
185 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/incoming | ||
186 | chown postfix:root ${D}${localstatedir}/spool/postfix/incoming | ||
187 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/saved | ||
188 | chown postfix:root ${D}${localstatedir}/spool/postfix/saved | ||
189 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/trace | ||
190 | chown postfix:root ${D}${localstatedir}/spool/postfix/trace | ||
191 | install -m 0730 -d ${D}${localstatedir}/spool/postfix/maildrop | ||
192 | chown postfix:postdrop ${D}${localstatedir}/spool/postfix/maildrop | ||
193 | install -m 0755 -d ${D}${localstatedir}/spool/postfix/pid | ||
194 | chown root:root ${D}${localstatedir}/spool/postfix/pid | ||
195 | install -m 0700 -d ${D}${localstatedir}/spool/postfix/private | ||
196 | chown postfix:root ${D}${localstatedir}/spool/postfix/private | ||
197 | install -m 0710 -d ${D}${localstatedir}/spool/postfix/public | ||
198 | chown postfix:postdrop ${D}${localstatedir}/spool/postfix/public | ||
199 | install -m 0755 -d ${D}${localstatedir}/spool/vmail | ||
200 | chown vmail:vmail ${D}${localstatedir}/spool/vmail | ||
201 | |||
202 | chown :postdrop ${D}${sbindir}/postqueue | ||
203 | chown :postdrop ${D}${sbindir}/postdrop | ||
204 | chmod g+s ${D}${sbindir}/postqueue | ||
205 | chmod g+s ${D}${sbindir}/postdrop | ||
206 | |||
207 | rm -rf ${D}/etc/postfix/makedefs.out | ||
208 | } | ||
209 | |||
210 | do_install:append:class-native() { | ||
211 | ln -sf ../sbin/sendmail.postfix ${D}${bindir}/newaliases | ||
212 | ln -sf ../sbin/sendmail.postfix ${D}${bindir}/mailq | ||
213 | } | ||
214 | |||
215 | ALTERNATIVE:${PN}-bin = "sendmail mailq newaliases" | ||
216 | # /usr/lib/sendmial is required by LSB core test | ||
217 | ALTERNATIVE:${PN}-bin:linuxstdbase = "sendmail mailq newaliases usr-lib-sendmail" | ||
218 | ALTERNATIVE_TARGET[mailq] = "${bindir}/mailq" | ||
219 | ALTERNATIVE_TARGET[newaliases] = "${bindir}/newaliases" | ||
220 | ALTERNATIVE_TARGET[sendmail] = "${sbindir}/sendmail.postfix" | ||
221 | ALTERNATIVE_LINK_NAME[sendmail] = "${sbindir}/sendmail" | ||
222 | ALTERNATIVE_TARGET[usr-lib-sendmail] = "${sbindir}/sendmail.postfix" | ||
223 | ALTERNATIVE_LINK_NAME[usr-lib-sendmail] = "/usr/lib/sendmail" | ||
224 | |||
225 | ALTERNATIVE_PRIORITY = "120" | ||
226 | |||
227 | ALTERNATIVE:${PN}-doc += "mailq.1 newaliases.1 sendmail.1" | ||
228 | ALTERNATIVE_LINK_NAME[mailq.1] = "${mandir}/man1/mailq.1" | ||
229 | ALTERNATIVE_LINK_NAME[newaliases.1] = "${mandir}/man1/newaliases.1" | ||
230 | ALTERNATIVE_LINK_NAME[sendmail.1] = "${mandir}/man1/sendmail.1" | ||
231 | |||
232 | pkg_postinst_ontarget:${PN}-cfg () { | ||
233 | touch /etc/aliases | ||
234 | newaliases | ||
235 | |||
236 | # generate virtual_alias, default is hash | ||
237 | touch /etc/postfix/virtual_alias | ||
238 | postmap /etc/postfix/virtual_alias | ||
239 | } | ||
240 | |||
241 | PACKAGES =+ "${PN}-cfg" | ||
242 | RDEPENDS:${PN}-cfg:class-target += "${PN}-bin" | ||
243 | RDEPENDS:${PN}:class-target += "${PN}-cfg" | ||
244 | # Exclude .debug directories from the main package | ||
245 | FILES:${PN}-bin += "${localstatedir} ${bindir}/* ${sbindir}/* \ | ||
246 | ${libexecdir}/* ${systemd_unitdir}/*" | ||
247 | FILES:${PN}-cfg = "${sysconfdir}" | ||
248 | FILES:${PN}-dbg += "${libexecdir}/postfix/.debug" | ||
249 | ALLOW_EMPTY:${PN} = "1" | ||