OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: FYI: MacOSX 10.4 Postfix based on 2.1.5

From: D. Walsh (infodaleenterprise.com)
Date: Tue May 03 2005 - 03:06:01 CDT


Sadly enough they (apple) still didn't include some key lookup table
options like mysql but now they've dropped DirectoryServices, ldap
and netinfo which seems like a step backwards.

If you download the postfix source from the darwin site, you can use
the following "Makefile" replacement to get a better postfix, it has
several build options so you can select the one you want.
(change the build you want in the pre-install line).

As an alternative and you want to use a newer postfix, download the
newer version of postfix and place it in a custom source path like "/
SourceCache/Custom_Postfix".

In this directory would be the modified Makefile and the postfix
source folder (renamed to postfix).

A "make install" doesn't install it in your system but rather it
places it in "/tmp/postfix/Release" from which you can make an
installer package for future installs and to place it on other
systems you have.

Delete the main.cf/master.cf files before making the installer
package so you don't overwrite your currently installed setting when
making an installer package.

If you just want to install it (upgrade your existing postfix) you
can cd to "/tmp/postfix/Build" and do a "make upgrade", restart the
server and you have added lookup table options (mysql is nice to add
virtual user support via mysql) and everything continues to function
as it did before.

Oh ya, one other note, you require a couple of directories:

/AppleInternal/Developer/Headers/sasl
/AppleInternal/Developer/Headers/netinfo

Place the netinfo and sasl header files in those directories.

Hope this helps you see how easy it really is to update your postfix
without breaking anything Apple.

-- Dale

The modified "Makefile"
_____________________________________________________________________

#
# modified Makefile for postfix+(mysql/netinfo/ldap/pcre)
# by Dale Walsh 04/29/2005
#

PROJECT=postfix

SHELL := /bin/sh

# Sane defaults, which are typically overridden on the command line.
SRCROOT= /tmp/postfix/Build
OBJROOT=$(SRCROOT)
SYMROOT=$(OBJROOT)
DSTROOT=/tmp/postfix/Release
RC_ARCHS=
CFLAGS=-mdynamic-no-pic -Os $(RC_CFLAGS)

#ENV = \
# CFLAGS="-no-cpp-precomp $(RC_CFLAGS)" \
# XCFLAGS="-no-cpp-precomp $(RC_CFLAGS)" \
# RC_ARCHS="$(RC_ARCHS)" \
# DYLD_LIBRARY_PATH="$(DSTROOT)/usr/lib"

all : installsrc install

clean :
     rm -r $(SRCROOT)/$(Project)

installhdrs : ;

installsrc : clean
     [ ! -d $(SRCROOT)/$(PROJECT) ] && mkdir -p $(SRCROOT)/$(PROJECT)/
Debug
     tar cf - . | (cd $(SRCROOT) ; tar xfp -)
     find $(SRCROOT) -type d -name CVS -print0 | xargs -0 rm -rf

buildmysql :
     echo "ENV = $(ENV)"
     $(ENV) $(MAKE) -C $(SRCROOT)/$(PROJECT) makefiles OPT="-
DBIND_8_COMPAT -DHAS_SSL -DNO_NETINFO -DUSE_SASL_AUTH -DHAS_MYSQL -
D__APPLE__ \
             -I/AppleInternal/Developer/Headers/sasl -I/AppleInternal/
Developer/Headers -I/usr/include -I/usr/include/gssapi -I/usr/include/
mysql -framework DirectoryService $(CFLAGS)" \
             AUXLIBS="-L/usr/lib -lssl -lsasl2.2.0.1 -lgssapi_krb5 -
ldb -L/usr/lib/mysql -lmysqlclient -lz -lm"
     $(ENV) $(MAKE) -C $(SRCROOT)/$(PROJECT)
     cd $(SRCROOT)/postfix/src/smtpstone && make all

buildmysqlldapnetinfo :
     echo "ENV = $(ENV)"
     $(ENV) $(MAKE) -C $(SRCROOT)/$(PROJECT) makefiles OPT="-
DBIND_8_COMPAT -DHAS_SSL -DUSE_SASL_AUTH -DHAS_LDAP -DHAS_NETINFO -
DHAS_MYSQL -D__APPLE__ \
             -I/AppleInternal/Developer/Headers/sasl -I/AppleInternal/
Developer/Headers -I/usr/include -I/usr/include/gssapi -I/usr/include/
mysql -framework DirectoryService $(CFLAGS)" \
             AUXLIBS="-L/usr/lib -lssl -lsasl2.2.0.1 -lgssapi_krb5 -
lldap -ldb -L/usr/lib/mysql -lmysqlclient -lz -lm"
     $(ENV) $(MAKE) -C $(SRCROOT)/$(PROJECT)
     cd $(SRCROOT)/postfix/src/smtpstone && make all

buildmysqlpcrenetinfo :
     echo "ENV = $(ENV)"
     $(ENV) $(MAKE) -C $(SRCROOT)/$(PROJECT) makefiles OPT="-
DBIND_8_COMPAT -DHAS_SSL -DUSE_SASL_AUTH -DHAS_PCRE -DHAS_NETINFO -
DHAS_MYSQL -D__APPLE__ \
             -I/AppleInternal/Developer/Headers/sasl -I/AppleInternal/
Developer/Headers -I/usr/include -I/usr/include/gssapi -I/usr/include/
mysql -framework DirectoryService $(CFLAGS)" \
             AUXLIBS="-L/usr/lib -lssl -lsasl2.2.0.1 -lgssapi_krb5 -
lpcre -ldb -L/usr/lib/mysql -lmysqlclient -lz -lm"
     $(ENV) $(MAKE) -C $(SRCROOT)/$(PROJECT)
     cd $(SRCROOT)/postfix/src/smtpstone && make all

buildmysqlpcreldapnetinfo :
     echo "ENV = $(ENV)"
     $(ENV) $(MAKE) -C $(SRCROOT)/$(PROJECT) makefiles OPT="-
DBIND_8_COMPAT -DHAS_SSL -DUSE_SASL_AUTH -DHAS_LDAP -DHAS_PCRE -
DHAS_NETINFO -DHAS_MYSQL -D__APPLE__ \
             -I/AppleInternal/Developer/Headers/sasl -I/AppleInternal/
Developer/Headers -I/usr/include -I/usr/include/gssapi -I/usr/include/
mysql -framework DirectoryService $(CFLAGS)" \
             AUXLIBS="-L/usr/lib -lssl -lsasl2.2.0.1 -lgssapi_krb5 -
lpcre -lldap -ldb -L/usr/lib/mysql -lmysqlclient -lz -lm"
     $(ENV) $(MAKE) -C $(SRCROOT)/$(PROJECT)
     cd $(SRCROOT)/postfix/src/smtpstone && make all

install : pre-install
     install -d -m 755 $(DSTROOT)/System/Library/LaunchDaemons
     install -d -m 755 $(DSTROOT)/System/Library/ServerSetup/SetupExtras
     install -d -m 755 $(DSTROOT)/usr/libexec/postfix/scripts
     install -d -m 755 $(DSTROOT)/usr/share/man/man1
     install -d -m 755 $(DSTROOT)/usr/local/OpenSourceVersions
     install -d -m 755 $(DSTROOT)/usr/local/OpenSourceLicenses
     cp $(SRCROOT)/aliases.db $(DSTROOT)/private/etc
     ln -s postfix/aliases $(DSTROOT)/private/etc
     install -d -m 755 $(DSTROOT)/private/etc/postfix/sample/
     cp $(SRCROOT)/postfix/conf/sample/sample* $(DSTROOT)/private/etc/
postfix/sample/
     install -m 0444 $(SRCROOT)/master.cf.defaultserver $(DSTROOT)/
private/etc/postfix
     install -m 0644 $(SRCROOT)/Postfix.LaunchDaemons/
org.postfix.master.plist \
             $(DSTROOT)/System/Library/LaunchDaemons/
org.postfix.master.plist
     install -m 0755 $(SRCROOT)/Postfix.ServerSetup/toggle_on_demand \
             $(DSTROOT)/System/Library/ServerSetup/SetupExtras/
toggle_on_demand
     install -s -m 0755 $(SRCROOT)/postfix/src/smtpstone/qmqp-sink $
(DSTROOT)/usr/libexec/postfix
     install -s -m 0755 $(SRCROOT)/postfix/src/smtpstone/smtp-sink $
(DSTROOT)/usr/libexec/postfix
     install -s -m 0755 $(SRCROOT)/postfix/src/smtpstone/qmqp-source $
(DSTROOT)/usr/libexec/postfix
     install -s -m 0755 $(SRCROOT)/postfix/src/smtpstone/smtp-source $
(DSTROOT)/usr/libexec/postfix
     install -m 0444 $(SRCROOT)/Postfix.OpenSourceInfo/postfix.plist $
(DSTROOT)/usr/local/OpenSourceVersions
     install -m 0444 $(SRCROOT)/Postfix.OpenSourceInfo/postfix.txt $
(DSTROOT)/usr/local/OpenSourceLicenses
     install -s -m 0755 $(DSTROOT)/usr/sbin/sendmail $(DSTROOT)/usr/
bin/newaliases
     install -s -m 0755 $(DSTROOT)/usr/sbin/sendmail $(DSTROOT)/usr/
bin/mailq
     rm $(DSTROOT)/private/etc/postfix/makedefs.out

pre-install : buildmysql
     cd $(SRCROOT)/$(PROJECT)/$(SRCDIR) && \
     $(SHELL) -x postfix-install -non-interactive \
         install_root=$(DSTROOT) \
         tempdir=$(OBJROOT) \
         mail_owner=postfix \
         setgid_group=postdrop \
         config_directory=/private/etc/postfix \
         daemon_directory=/usr/libexec/postfix \
         command_directory=/usr/sbin \
         queue_directory=/private/var/spool/postfix \
         sendmail_path=/usr/sbin/sendmail \
         newaliases_path=/usr/bin/newaliases \
         mailq_path=/usr/bin/mailq \
         manpage_directory=/usr/share/man \
         sample_directory=/usr/share/doc/postfix/examples \
         readme_directory=/usr/share/doc/postfix && \
     for F in $(DSTROOT)/usr/{{s,}bin,libexec/postfix}/*; do \
         echo "$$F" ; cp "$$F" $(SYMROOT); \
         [ -f "$$F" -a -x "$$F" ] && strip -x "$$F"; \
     done && \
     $(SHELL) -x conf/post-install set-permissions \
         mail_owner=postfix \
         setgid_group=postdrop \
         config_directory=$(DSTROOT)/private/etc/postfix \
         daemon_directory=$(DSTROOT)/usr/libexec/postfix \
         command_directory=$(DSTROOT)/usr/sbin \
         queue_directory=$(DSTROOT)/private/var/spool/postfix \
         sendmail_path=$(DSTROOT)/usr/sbin/sendmail \
         newaliases_path=$(DSTROOT)/usr/bin/newaliases \
         mailq_path=$(DSTROOT)/usr/bin/mailq \
         manpage_directory=$(DSTROOT)/usr/share/man \
         sample_directory=$(DSTROOT)/usr/share/doc/postfix/examples \
         readme_directory=$(DSTROOT)/usr/share/doc/postfix

.PHONY: clean installhdrs installsrc buildmysql buildmysqlldapnetinfo
buildmysqlpcrenetinfo buildmysqlpcreldapnetinfo install pre-install