Porting Postfix 2.4.5

Jay Chandler lists at sequestered.net
Sun Oct 14 12:07:56 PDT 2007


Greetings.

In my spare time I've been working on getting Postfix 2.4.5 working with
MacPorts, as well as getting TLS and SASL to work correctly (OpenSSL
deps using system libraries instead of the ported version, leading to
0.9.7 vs 0.9.8 mismatch).

The below portfile *works* correctly (with thanks to Mark Duling to
helping me get this far!)-- the issue is that while I'm rather
comfortable with Postifx, I'm quite certain I don't know enough about
the MacPorts system to make it work in the proscribed manner.  For
instance, it isn't set up to use variants and whatnot, but the make
arguments get passed correctly and it uses the proper dependencies.

Can anyone lend a hand towards helping me polish this so that it can be
published?

The issues I see at the moment:

jay-chandlers-computer:/opt/local/var/macports/sources/rsync.macports.org/release/ports/mail/postfix 

jay$ sudo postfix start
postfix/postfix-script: warning: not owned by root:
/opt/local/var/spool/postfix
postfix/postfix-script: warning: not owned by group postdrop:
/opt/local/var/spool/postfix/public
postfix/postfix-script: warning: not owned by group postdrop:
/opt/local/var/spool/postfix/maildrop
postfix/postfix-script: warning: not owned by group postdrop:
/opt/local/sbin/postqueue
postfix/postfix-script: warning: not owned by group postdrop:
/opt/local/sbin/postdrop
postfix/postfix-script: warning: not set-gid or not owner+group+world
executable: /opt/local/sbin/postqueue
postfix/postfix-script: warning: not set-gid or not owner+group+world
executable: /opt/local/sbin/postdrop
postfix/postfix-script: starting the Postfix mail system

That's simple enough to fix-- should just be a chown, I figure.

Oct 14 11:57:25 jay-chandlers-computer postfix/master[29706]: daemon
started -- version 2.4.5, configuration /etc/postfix
The fact that it's pulling from /etc/postfix for its configuration is
somewhat more puzzling.

Portfile begins here:
# $Id: Portfile 28505 2007-09-02 20:15:23Z yeled at macports.org $

PortSystem  1.0
name            postfix
version         2.4.5
categories      mail
maintainers     nomaintainer at macports.org
description     Fast and robust mail transfer agent
long_description    Postfix attempts to be fast, easy to administer, and \
             secure, while at the same time being \
             sendmail-compatible enough to not upset existing \
             users. It also offers QMQP and VERP support to let \
             Postfix act as delivery daemon for ezmlm-idx.
homepage        http://www.postfix.org/
platforms       darwin
checksums       sha1 dc3616ffd441c23748273527b6693835f3502ad2
master_sites    http://postfix.problemlos.ch/release/official/ \
     http://www.swissrave.ch/mirror/postfix-source/official/ \
     ftp://ftp.matrix.com.br/pub/postfix/official/ \

ftp://ftp.its.cz/MIRRORS/ftp.porcupine.org/mirrors/postfix-release/official/\

ftp://ftp.club-internet.fr/pub/mirrors/ftp.porcupine.org/postfix-release/official/\

ftp://ftp.doc.cs.univ-paris8.fr/mirrors/ftp.porcupine.org/postfix-release/official/

set CCARGS  -DNO_PCRE
set AUXLIBS "-L/opt/local/lib -R/opt/local/lib -L/opt/local/lib -lsasl2
-lssl -lcrypto"

configure {
     cd ${worksrcpath}
     system "make makefiles CCARGS=\"${CCARGS}\" AUXLIBS=\"${AUXLIBS}\""
     reinplace "s|__PREFIX|${prefix}|g" src/util/sys_defs.h
     reinplace "s|__PREFIX|${prefix}|g" conf/main.cf
     reinplace "s|__PREFIX|${prefix}|g" src/global/mail_params.h
     reinplace "s|__PREFIX|${prefix}|g" man/man1/postdrop.1
#   reinplace "s|__PREFIX|${prefix}|g" conf/sample-misc.cf
     reinplace "s|__PREFIX|${prefix}|g" man/man1/postqueue.1
     reinplace "s|__PREFIX|${prefix}|g" man/man1/sendmail.1
     reinplace "s|__PREFIX|${prefix}|g" man/man5/access.5
     reinplace "s|__PREFIX|${prefix}|g" man/man5/canonical.5
     reinplace "s|__PREFIX|${prefix}|g" man/man5/pcre_table.5
     reinplace "s|__PREFIX|${prefix}|g" man/man5/regexp_table.5
     reinplace "s|__PREFIX|${prefix}|g" man/man5/relocated.5
     reinplace "s|__PREFIX|${prefix}|g" man/man5/transport.5
     reinplace "s|__PREFIX|${prefix}|g" man/man5/virtual.5
     reinplace "s|__PREFIX|${prefix}|g" man/man8/cleanup.8
     reinplace "s|__PREFIX|${prefix}|g" man/man8/flush.8
     reinplace "s|__PREFIX|${prefix}|g" man/man8/master.8
     reinplace "s|__PREFIX|${prefix}|g" man/man8/proxymap.8
}

build.target

startupitem.create      yes
startupitem.start       "${prefix}/sbin/${name} start"
startupitem.stop        "${prefix}/sbin/${name} stop"

destroot {
     adduser postfix realname=Postfix\ Server
     addgroup postdrop
     cd ${worksrcpath}
     file mkdir ${destroot}${prefix}/etc/postfix
     file mkdir ${destroot}${prefix}/share/postfix
     xinstall -d -o postfix -g postdrop -m \
         710 ${destroot}${prefix}/var/spool/postfix/public
     xinstall -d -o postfix -g postdrop -m 730 \
         ${destroot}${prefix}/var/spool/postfix/maildrop
     destroot.keepdirs ${destroot}${prefix}/var/spool/postfix/public \
         ${destroot}${prefix}/var/spool/postfix/maildrop
     system "/bin/sh postfix-install -non-interactive \
         install_root=${destroot} \
         config_directory=${prefix}/etc/postfix \
         daemon_directory=${prefix}/libexec/postfix \
         command_directory=${prefix}/sbin \
         manpage_directory=${prefix}/share/man \
         queue_directory=${prefix}/var/spool/postfix \
         sendmail_path=${prefix}/sbin/sendmail \
         newaliases_path=${prefix}/bin/newaliases \
         mailq_path=${prefix}/bin/mailq \
         sample_directory=${prefix}/share/postfix/sample \
         readme_directory=${prefix}/share/postfix/readme"
}
# This makes sure we don't overwrite user /etc files. This now breaks
postfix
# "just working" on fresh installs.
# YOU MUST MOVE THE SAMPLE FILES TO THE CORRECT NAMESPACE.
# XXX unsure if this stilll an issue 07/07/05 yeled@
post-destroot {
     file rename ${destroot}${prefix}/etc/postfix/main.cf \
         ${destroot}${prefix}/etc/postfix/main.cf.sample
     file rename ${destroot}${prefix}/etc/postfix/master.cf \
         ${destroot}${prefix}/etc/postfix/master.cf.sample
     file rename ${destroot}${prefix}/etc/postfix/aliases \
         ${destroot}${prefix}/etc/postfix/aliases.sample
}

post-install {
     # Tell the user about renaming the sample configuration files.
ui_msg "\n
To get postfix working, you need to copy the sample configuration
files and edit them (${prefix}/etc/postfix/*.sample).  You may also
want to turn off Apple's built-in MTA.  For example, on 10.4:

-Delete or rename /System/Library/LaunchDaemons/org.postfix.master.plist
-Replace the built-in sendmail file with a symlink to MacPorts' own:
         sudo mv /usr/sbin/sendmail /usr/sbin/sendmail.org
         ln -s ${prefix}/sbin/sendmail /usr/sbin/sendmail

NOTE: Apple OS updates could upgrade the built-in Postfix and overwrite the
       symlink, so the symlink mught have to be recreated.
\n"
}

variant pcre {
     set CCARGS      [ldelete ${CCARGS} -DNO_PCRE]
     set CCARGS      [concat  ${CCARGS} -DHAS_PCRE -I${prefix}/include]
     set AUXLIBS     [concat ${AUXLIBS} -L${prefix}/lib -lpcre]
     depends_lib-append  port:pcre
}

variant tls {
     depends_lib-append  port:openssl
     set CCARGS      [concat ${CCARGS} -DUSE_TLS -DHAS_SSL
-I${prefix}/include/openssl]
     set AUXLIBS     [concat ${AUXLIBS} -lssl -lcrypto]
}

variant sasl {
     depends_lib-append  port:cyrus-sasl2
     set CCARGS      [concat ${CCARGS} -DUSE_CYRUS_SASL -DUSE_SASL_AUTH
-I${prefix}/include/sasl]
     set AUXLIBS     [concat ${AUXLIBS} -lsasl2]
}

variant ldap {
     depends_lib-append  port:openldap
     set CCARGS      [concat ${CCARGS} -DHAS_LDAP]
     set AUXLIBS     [concat ${AUXLIBS} -lldap -llber]
}

variant mysql5 {
     depends_lib-append port:mysql5
     set CCARGS      [concat ${CCARGS} -DHAS_MYSQL
-I${prefix}/include/mysql5/mysql]
     set AUXLIBS     [concat ${AUXLIBS} -L${prefix}/lib/mysql5/mysql
-lmysqlclient -lz -lm]
}




-- 
Jay Chandler / KB1JWQ
Living Legend / Systems Exorcist
Today's Excuse: Traffic jam on the Information Superhighway



More information about the macports-users mailing list