increase dvbapp PR.
[vuplus_openembedded] / recipes / postfix / postfix.inc
1 SECTION = "console/network"
2 DEPENDS = "virtual/db libpcre postfix-native"
3 LICENSE = "IPL"
4
5 SRC_URI = "ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-${PV}.tar.gz \
6            file://makedefs.patch;patch=1 \
7            file://install.patch;patch=1 \
8            file://main.cf_2.0 \
9            file://volatiles \
10            file://postfix \
11            file://internal_recipient \
12            "
13
14 S = "${WORKDIR}/postfix-${PV}"
15
16 inherit update-rc.d
17
18 INITSCRIPT_NAME = "postfix"
19 INITSCRIPT_PARAMS = "start 58 3 4 5 . stop 13 0 1 6 ."
20
21 #FIXME: this is broken because the native build won't work on systems where
22 # native bdb does not require libpthread.  ARM doesn't require libpthread
23 # because it uses an assembler mutex implementation.
24 LIBBDB_EXTRA = "-lpthread"
25 LIBBDB_EXTRA_arm = ""
26 LIBBDB_EXTRA_armeb = ""
27
28 export SYSLIBS = "-lpcre -ldb ${LIBBDB_EXTRA} -lnsl -lresolv ${LDFLAGS}"
29 export EXPORT = "AUXLIBS='-lpcre' CCARGS='-DHAS_PCRE ${CFLAGS}' OPT='' DEBUG='-g'"
30 export CC_append = " -DHAS_PCRE ${CFLAGS}"
31 export EXTRA_OEMAKE = "-e"
32 export POSTCONF = "${STAGING_BINDIR_NATIVE}/postconf"
33
34 do_compile () {
35         unset CFLAGS CPPFLAGS CXXFLAGS
36         oe_runmake makefiles
37         oe_runmake
38 }
39
40 do_install () {
41         sh ./postfix-install 'install_root=${D}' -non-interactive
42         rm -rf ${D}${localstatedir}/spool/postfix
43         mv ${D}${sysconfdir}/postfix/main.cf ${D}${sysconfdir}/postfix/sample-main.cf
44         install -d ${D}${localstatedir}/tmp
45         install -d ${D}${sysconfdir}/default/volatiles
46         install -d ${D}${sysconfdir}/init.d
47         install -m 755 ${WORKDIR}/main.cf_2.0 ${D}${localstatedir}/tmp/main_cf.sh
48         install -m 644 ${WORKDIR}/volatiles ${D}${sysconfdir}/default/volatiles/01_postfix
49         install -m 755 ${WORKDIR}/postfix ${D}${sysconfdir}/init.d/postfix
50         install -m 644 ${WORKDIR}/internal_recipient ${D}${sysconfdir}/postfix/internal_recipient
51         mv ${D}${sbindir}/sendmail ${D}${sbindir}/sendmail.${PN}
52 }
53
54 pkg_postinst () {
55         update-alternatives --install ${sbindir}/sendmail sendmail sendmail.${PN} 40
56         grep postfix /etc/group || addgroup postfix
57         grep postdrop /etc/group || addgroup postdrop
58         grep vmail /etc/group || addgroup vmail
59         grep postfix /etc/passwd || adduser --disabled-password --home=/var/spool/postfix --ingroup postfix -g "Postfix" postfix
60         grep vmail /etc/passwd || adduser --disabled-password --home=/var/spool/vmail --ingroup vmail -g "Postfix" vmail
61         chgrp postdrop /usr/sbin/postqueue
62         chgrp postdrop /usr/sbin/postdrop
63         chmod g+s /usr/sbin/postqueue
64         chmod g+s /usr/sbin/postdrop
65         /var/tmp/main_cf.sh >/etc/postfix/main.cf
66         rm -f /var/tmp/main_cf.sh
67         chmod 644 /etc/postfix/main.cf
68         [ -d /var/spool/postfix ] && rmdir /var/spool/postfix
69         /etc/init.d/populate-volatile.sh update
70         touch /etc/aliases
71         newaliases
72 }
73
74 pkg_postrm () {
75         update-alternatives --remove sendmail sendmail.${PN}
76 }
77
78 # Exclude .debug directories from the main package
79 FILES_${PN} = "${sysconfdir} ${localstatedir} ${bindir}/* ${sbindir}/* \
80                ${libexecdir}/postfix/*"
81 FILES_${PN}-dbg += "${libexecdir}/postfix/.debug"