Compiling Postfix-2.7.0 As RPM Package

I used to have Simon J. Mudd when building postfix rpm package, but seems he’s not releasing official postfix 2.7.0 yet, here’s a way for impatient one

First make RedHat Linux the standard directory structure in our homedir

$ mkdir rpmbuild
$ mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp}

Create .rpmmacros file

$ vi .rpmmacros
%_topdir                %(echo $HOME)/rpmbuild
%_tmppath               %(echo $HOME)/rpmbuild/tmp

Create tempoerary working directory for postfix

$ mkdir postfix
$ cd postfix

Now download postfix-2.7.0 from official website

$ wget http://postfix.it-austria.net/releases/official/postfix-2.7.0-RC1.tar.gz

Download postfix srpms from Simon J. Mudd website, we need some files from this src rpm file

$ wget http://ftp.wl0.org/official/2.6/SRPMS/postfix-2.6.5-1.src.rpm

We need to convert postfix-2.7.0-RC1.tar.gz to postfix-2.7.0.tar.gz

$ tar xzf postfix-2.7.0-RC1.tar.gz
$ mv postfix-2.7.0-RC1 postfix-2.7.0
$ tar czf postfix-2.7.0.tar.gz postfix-2.7.0
$ rm -rf postfix-2.7.0

Extract some files from postfix-2.6.5-1.src.rpm, actually this is more esier using mc, but here i’ll explain how to ripped file(s) from src.rpm

$ for i in `rpm -qpl postfix-2.6.5-1.src.rpm --nosignature`;do rpm2cpio postfix-2.6.5-1.src.rpm | cpio -idv $i;done

We’ll get these bunch of files, as i recall corectly i just need to modified 3 file

$ ls
make-postfix.rpm                            postfix-2.6.5-1.src.rpm                  postfix-files.patch       postfix.spec
make-postfix.spec                           postfix-2.6.5.tar.gz                     postfix-get-distribution  postfix.spec.in
postfinger-1.30                             postfix-aliases                          postfix-makedefs.patch    README-Postfix-SASL-RedHat.txt
postfix-2.3.2_libspf2-1.2.x-20060819.patch  postfix-chroot.sh                        postfix-pam.conf
postfix-2.5.4-vda-ng.patch.gz               postfix-dict_cdb-1.1.11-20021104.tar.gz  postfix-saslauthd.conf
postfix-2.6.0-multiline-greeting.patch      postfix-etc-init.d-postfix               postfix-sasl.conf

rename postfix-2.6.0-multiline-greeting.patch to postfix-2.7.0-multiline-greeting.patch

$ mv postfix-2.6.0-multiline-greeting.patch postfix-2.7.0-multiline-greeting.patch

Edit paths in postfix-2.7.0-multiline-greeting.patch

$ vi postfix-2.7.0-multiline-greeting.patch

In Editor type : then write this line

%s/postfix-2.6.0/postfix-2.7.0/g

enter, save file

Edit postfix-files.patch, same as postfix-2.7.0-multiline-greeting.patch rename all lines containing postfix-2.6.0 to postfix-2.7.0

Edit postfix.spec.in, search for the line containing %define V_postfix

%define V_postfix 2.6.5

p>Simply change it to

%define V_postfix 2.7.0

Search for line containing Patch99: , change from:

Patch99: ftp://ftp.wl0.org/SOURCES/postfix-2.6.0-multiline-greeting.patch

To:

Patch99: ftp://ftp.wl0.org/SOURCES/postfix-2.7.0-multiline-greeting.patch

Now all files ready to move to ~/rpmbuild/SOURCES directory

$ for i in `ls | grep -v postfix-2.6.5.tar.gz | grep -v postfix-2.6.5-1.src.rpm`;do cp $i ~/rpmbuild/SOURCES/;done

Now, we’re ready to compile, as usual need to export some environtment variables(this is just examples)

export POSTFIX_SMTPD_MULTILINE_GREETING=1
export POSTFIX_LDAP=1
export POSTFIX_MYSQL_REDHAT=1
export POSTFIX_PCRE=1
export POSTFIX_PGSQL=1
export POSTFIX_RBL_MAPS=1
export POSTFIX_SASL=2
export POSTFIX_TLS=1
export POSTFIX_VDA=1
export POSTFIX_DB=4

Create postfix.spec

$ sh `rpm --eval '%{_sourcedir}'`/make-postfix.spec

Compile

$ cd `rpm --eval '%{_specdir}'`
$ rpmbuild -ba postfix.spec

If it’s compile without error, you’ll have three files like these

/home/user/rpmbuild/SRPMS/postfix-2.7.0-1.pcre.pgsql.mysql.sasl2.vda.rhel5.src.rpm
/home/user/rpmbuild/RPMS/postfix-2.7.0-1.pcre.pgsql.mysql.sasl2.vda.rhel5.x86_64.rpm
/home/user/rpmbuild/RPMS/postfix-debuginfo-2.7.0-1.pcre.pgsql.mysql.sasl2.vda.rhel5.x86_64.rpm

Warning, i didn’t test all patches that comes with original postfix-2.6.5-1.src.rpm by hand on postfix-2.7.0 source, but likely when patch section in postfix.spec doesn’t return error, it’s applied..hopefully

2 Comments

  1. Ram

    Great job .. but why did you not also publish the source rpm
     

Leave a Reply

Your email address will not be published. Required fields are marked *