postfix/postfix.spec

Wed, 12 Sep 2012 18:43:24 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 12 Sep 2012 18:43:24 +0200
changeset 672
fcc7a5543835
parent 671
f82939c12e5f
child 676
7a7cc794483b
permissions
-rw-r--r--

Blindly commit previously discovered and corrected linking problem.

     1 ##
     2 ##  postfix.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
     4 ##
     5 ##  Permission to use, copy, modify, and distribute this software for
     6 ##  any purpose with or without fee is hereby granted, provided that
     7 ##  the above copyright notice and this permission notice appear in all
     8 ##  copies.
     9 ##
    10 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    11 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    12 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    13 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    14 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    15 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    16 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    17 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    18 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    19 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    20 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    21 ##  SUCH DAMAGE.
    22 ##
    24 #   package versions
    25 %define       V_postfix      2.9.4
    26 %define       V_pflogsumm    1.1.5
    27 %define       V_whoson       2.4.0
    29 #   package information
    30 Name:         postfix
    31 Summary:      Mail Transfer Agent (MTA)
    32 URL:          http://www.postfix.org/
    33 Vendor:       Wietse Venema
    34 Packager:     OpenPKG Foundation e.V.
    35 Distribution: OpenPKG Community
    36 Class:        BASE
    37 Group:        Mail
    38 License:      IPL
    39 Version:      %{V_postfix}
    40 Release:      20120800
    42 #   package options
    43 %option       with_fsl       yes
    44 %option       with_ssl       no
    45 %option       with_sasl      no
    46 %option       with_sqlite    no
    47 %option       with_mysql     no
    48 %option       with_pgsql     no
    49 %option       with_ldap      no
    50 %option       with_whoson    no
    51 %option       with_fdsetsize no
    53 #   list of sources
    54 Source0:      ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-%{V_postfix}.tar.gz
    55 Source1:      http://jimsun.linxnet.com/downloads/pflogsumm-%{V_pflogsumm}.tar.gz
    56 Source2:      postfix.txt
    57 Source3:      fsl.postfix
    58 Source4:      rc.postfix
    59 Patch0:       postfix.patch
    60 Patch1:       postfix.patch.pfls
    61 Patch2:       http://download.openpkg.org/components/versioned/postfix/postfix-%{V_whoson}-whoson.patch
    63 #   build information
    64 BuildPreReq:  OpenPKG, openpkg >= 20100101, perl, gcc
    65 PreReq:       OpenPKG, openpkg >= 20100101, perl, procmail, perl-time
    66 BuildPreReq:  make, pcre, db
    67 PreReq:       make, pcre, db
    68 %if "%{with_fsl}" == "yes"
    69 BuildPreReq:  fsl
    70 PreReq:       fsl
    71 %endif
    72 %if "%{with_ssl}" == "yes"
    73 BuildPreReq:  openssl
    74 PreReq:       openssl
    75 %endif
    76 %if "%{with_sasl}" == "yes"
    77 BuildPreReq:  sasl
    78 PreReq:       sasl
    79 %endif
    80 %if "%{with_sqlite}" == "yes"
    81 BuildPreReq:  sqlite
    82 PreReq:       sqlite
    83 %endif
    84 %if "%{with_mysql}" == "yes"
    85 BuildPreReq:  mysql
    86 PreReq:       mysql
    87 %endif
    88 %if "%{with_pgsql}" == "yes"
    89 BuildPreReq:  postgresql, openssl
    90 PreReq:       postgresql, openssl
    91 %endif
    92 %if "%{with_ldap}" == "yes"
    93 BuildPreReq:  openldap, openssl
    94 PreReq:       openldap, openssl
    95 %endif
    96 %if "%{with_whoson}" == "yes"
    97 BuildPreReq:  whoson
    98 PreReq:       whoson
    99 %endif
   100 Provides:     MTA
   101 Conflicts:    exim, sendmail, ssmtp
   103 %description
   104     Postfix is a new-generation Mail Transfer Agent (MTA) able to fully
   105     replace the Sendmail MTA. It is fully standards compliant and
   106     supports SMTP, ESMTP, LMTP over IPv4/IPv6 with optional TLS/SASL.
   108     Local specifics in this OpenPKG version:
   109     o Postfix delivers locally via Procmail
   110     o Postfix logs directly to the filesystem via OSSP fsl
   111     o Berkeley-DB dictionary support
   112     o PCRE matching support
   113     o Optional STARTTLS encryption support   (see package options)
   114     o Optional SASL2 authentication support  (see package options)
   115     o Optional SQLite dictionary support     (see package options)
   116     o Optional MySQL dictionary support      (see package options)
   117     o Optional PostgreSQL dictionary support (see package options)
   118     o Optional OpenLDAP dictionary support   (see package options)
   119     o Optional WHOSON dictionary support     (see package options)
   121 %track
   122     prog postfix = {
   123         version   = %{V_postfix}
   124         url       = ftp://ftp.porcupine.org/mirrors/postfix-release/official/
   125         regex     = postfix-(\d+\.\d+\.\d+)\.tar\.gz
   126     }
   127     prog postfix:pflogsumm = {
   128         version   = %{V_pflogsumm}
   129         url       = http://jimsun.linxnet.com/postfix_contrib.html
   130         regex     = pflogsumm-(__VER__)\.tar\.gz
   131     }
   132     prog postfix:whoson = {
   133         version   = %{V_whoson}
   134         url       = http://download.openpkg.org/components/versioned/postfix/
   135         regex     = postfix-(__VER__)-whoson.patch
   136     }
   138 %prep
   139     #   unpack distribution files
   140     %setup -q
   141     %setup -q -T -D -a 1
   143     #   apply OpenPKG patches
   144     %patch -p0
   145     ( cd pflogsumm-%{V_pflogsumm} && %{l_patch} -p0 -b <%{PATCH1} ) || exit $?
   147     #   apply vendor WHOSON patch
   148 %if "%{with_whoson}" == "yes"
   149     %patch -p0 -P 2
   150 %endif
   152     #   remove OpenPKG privelege model incompatible exit conditions
   153     %{l_shtool} subst \
   154         -e 's;msg_fatal\(.*attribute specifies mail system\);msg_info\1;g' \
   155         src/pipe/pipe.c
   157     #   platform specific corrections
   158     case "%{l_platform -t}" in
   159         *-sunos5.11 )
   160             %{l_shtool} subst \
   161                 -e 's;#define HAS_NISPLUS;#undef HAS_NISPLUS;' \
   162                 src/util/sys_defs.h
   163             ;;
   164     esac
   166 %build
   167     #   configure Postfix (hard-core part I)
   168     %{l_shtool} subst \
   169         -e 's/var_config_dir, /var_command_dir, /' \
   170         src/postfix/postfix.c
   171     %{l_shtool} subst \
   172         -e 's;config_directory/postfix-script;command_directory/postfix-script;' \
   173         -e 's;config_directory/post-install;command_directory/postfix-install;' \
   174         conf/postfix-script
   175     %{l_shtool} subst \
   176         -e 's;/usr/include;%{l_prefix}/include;g' \
   177         makedefs
   179     #   configure Postfix (regular part)
   180     rflags=`echo $LD_LIBRARY_PATH | %{l_shtool} subst -e 's;\(.\);-R\1;'`
   181     rflags=`echo $rflags | %{l_shtool} subst -e 's/:/ -R/g'`
   182     unset LD_LIBRARY_PATH || true
   183     CCARGS=""
   184     CCARGS="$CCARGS %{l_cflags -O}"
   185     CCARGS="$CCARGS %{l_cppflags}"
   186     CCARGS="$CCARGS -DDEF_COMMAND_DIR=\\\"%{l_prefix}/sbin\\\""
   187     CCARGS="$CCARGS -DDEF_SENDMAIL_PATH=\\\"%{l_prefix}/sbin/sendmail\\\""
   188     CCARGS="$CCARGS -DDEF_CONFIG_DIR=\\\"%{l_prefix}/etc/postfix\\\""
   189     CCARGS="$CCARGS -DDEF_DAEMON_DIR=\\\"%{l_prefix}/libexec/postfix\\\""
   190     CCARGS="$CCARGS -DDEF_QUEUE_DIR=\\\"%{l_prefix}/var/postfix\\\""
   191     CCARGS="$CCARGS -DDEF_DATA_DIR=\\\"%{l_prefix}/var/postfix/data\\\""
   192     AUXLIBS=""
   193     AUXLIBS="$AUXLIBS $rflags %{l_ldflags}"
   194     CCARGS="$CCARGS -DHAS_DB"
   195     AUXLIBS="$AUXLIBS -ldb"
   196     CCARGS="$CCARGS -DHAS_PCRE"
   197     AUXLIBS="$AUXLIBS -lpcre"
   198 %if "%{with_sqlite}" == "yes"
   199     CCARGS="$CCARGS -DHAS_SQLITE"
   200     AUXLIBS="$AUXLIBS -lsqlite3"
   201 %endif
   202 %if "%{with_mysql}" == "yes"
   203     CCARGS="$CCARGS -DHAS_MYSQL %{l_cppflags mysql .}"
   204     AUXLIBS="$AUXLIBS %{l_ldflags mysql .} -lmysqlclient -lz -lm"
   205 %endif
   206 %if "%{with_pgsql}" == "yes"
   207     CCARGS="$CCARGS -DHAS_PGSQL %{l_cppflags postgresql .}"
   208     AUXLIBS="$AUXLIBS -lpq -lssl -lcrypto -lcrypt"
   209 %endif
   210 %if "%{with_sasl}" == "yes"
   211     CCARGS="$CCARGS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL %{l_cppflags sasl .}"
   212     AUXLIBS="$AUXLIBS -lsasl2 -lcrypt"
   213     if [ -f /usr/lib/libdl.so -o -f /usr/lib/libdl.a ]; then
   214         AUXLIBS="$AUXLIBS -ldl"
   215     fi
   216     if [ -f /usr/lib64/libdl.so -o -f /usr/lib64/libdl.a ]; then
   217         AUXLIBS="$AUXLIBS -ldl"
   218     fi
   219 %endif
   220 %if "%{with_ssl}" == "yes"
   221     CCARGS="$CCARGS -DUSE_TLS"
   222     AUXLIBS="$AUXLIBS -lssl -lcrypto"
   223 %endif
   224 %if "%{with_ldap}" == "yes"
   225     CCARGS="$CCARGS -DHAS_LDAP"
   226     AUXLIBS="$AUXLIBS -lldap -llber -lssl -lcrypto"
   227 %endif
   228 %if "%{with_fsl}" == "yes"
   229     AUXLIBS="$AUXLIBS %{l_fsl_ldflags} %{l_fsl_libs}"
   230     CCARGS="$CCARGS -DUSE_SOFTLIMITONLY"
   231 %endif
   232 %if "%{with_fdsetsize}" != "no"
   233 %if "%{with_fdsetsize}" == "yes"
   234     CCARGS="$CCARGS -DFD_SETSIZE=1024"
   235 %else
   236     CCARGS="$CCARGS -DFD_SETSIZE=%{with_fdsetsize}"
   237 %endif
   238 %endif
   239     case "%{l_platform -t}" in
   240         *-sunos* ) AUXLIBS="$AUXLIBS -lrt" ;;
   241     esac
   242     %{l_make} %{l_mflags} -f Makefile.init makefiles \
   243         CC="%{l_cc}" CCARGS="$CCARGS" AUXLIBS="$AUXLIBS"
   245     #   configure Postfix (hard-core part II)
   246     %{l_shtool} subst \
   247         -e 's;#define HAS_DBM;#define HAS_DBM_DISABLED;' \
   248         -e 's;#define HAS_DB;#define HAS_DB_DISABLED;' \
   249         src/util/sys_defs.h
   251     #   build Postfix
   252     %{l_make} %{l_mflags -O}
   254 %install
   256     #   perform standard installation procedure
   257     %{l_shtool} subst -e "s;chown;true;" postfix-install
   258     sh postfix-install -non-interactive \
   259         install_root=$RPM_BUILD_ROOT \
   260         config_directory=%{l_prefix}/etc/postfix \
   261         daemon_directory=%{l_prefix}/libexec/postfix \
   262         command_directory=%{l_prefix}/sbin \
   263         queue_directory=%{l_prefix}/var/postfix \
   264         data_directory=%{l_prefix}/var/postfix/data \
   265         sendmail_path=%{l_prefix}/sbin/sendmail \
   266         newaliases_path=%{l_prefix}/sbin/newaliases \
   267         mailq_path=%{l_prefix}/sbin/mailq \
   268         manpage_directory=%{l_prefix}/man \
   269         mail_user=%{l_musr} \
   270         setgid_group=%{l_rgrp}
   272     #   post-adjust binaries
   273     rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq
   274     ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \
   275        $RPM_BUILD_ROOT%{l_prefix}/sbin/mailq
   276     rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases
   277     ln $RPM_BUILD_ROOT%{l_prefix}/sbin/sendmail \
   278        $RPM_BUILD_ROOT%{l_prefix}/sbin/newaliases
   279     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   280     strip $RPM_BUILD_ROOT%{l_prefix}/libexec/postfix/* >/dev/null 2>&1 || true
   282     #   post-adjust configuration
   283     for cfg in \
   284         *LICENSE makedefs.out bounce.cf.default access aliases \
   285         canonical header_checks relocated transport virtual \
   286         main.cf master.cf main.cf.default; do
   287         rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/$cfg
   288     done
   290     #   install default configuration
   291     for name in `grep "^<file" %{SOURCE postfix.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
   292         (echo ""; cat %{SOURCE postfix.txt}; echo "") |\
   293             sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
   294         %{l_shtool} install -c -m 644 %{l_value -s -a} \
   295             $name $RPM_BUILD_ROOT%{l_prefix}/etc/postfix/
   296     done
   298     #   pre-create variable stuff
   299     ( cd $RPM_BUILD_ROOT%{l_prefix}/var/postfix
   300       %{l_shtool} mkdir -f -p -m 700 data
   301       %{l_shtool} mkdir -f -p -m 755 log
   302     ) || exit $?
   304     #   install addons
   305     %{l_shtool} install -c -m 755 \
   306         -e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \
   307         auxiliary/rmail/rmail $RPM_BUILD_ROOT%{l_prefix}/sbin/rmail
   308     %{l_shtool} install -c -m 755 \
   309         -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
   310         -e 's;postconf -h;%{l_prefix}/sbin/postconf -h;' \
   311         auxiliary/qshape/qshape.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/qshape
   312     %{l_shtool} install -c -m 644 \
   313         man/man1/qshape.1 $RPM_BUILD_ROOT%{l_prefix}/man/man8/qshape.8
   314     ( cd pflogsumm-%{V_pflogsumm}
   315       %{l_shtool} install -c -m 755 \
   316           -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;g' \
   317           pflogsumm.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/pflogsumm
   318       %{l_shtool} install -c -m 644 \
   319           pflogsumm.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
   320     ) || exit $?
   322     #   install run-command script
   323     %{l_shtool} mkdir -f -p -m 755 \
   324         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   325     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   326         %{SOURCE rc.postfix} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   328     #   adjust installation to avoid file name conflicts
   329     ( cd $RPM_BUILD_ROOT%{l_prefix}/man/man8
   330       mv master.8 postfix_master.8
   331     ) || exit $?
   333     #   install OSSP fsl configuration
   334     %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   335     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   336         %{SOURCE fsl.postfix} \
   337         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   339     #   generate file list
   340     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   341         %{l_files_std} \
   342         '%config %{l_prefix}/etc/fsl/fsl.postfix' \
   343         '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix' \
   344         '%config %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/postfix/*' \
   345         '%attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix/*' \
   346         '%attr(2755,%{l_musr},%{l_rgrp}) %{l_prefix}/sbin/{postdrop,postqueue}' \
   347         '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/libexec/postfix' \
   348         '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/var/postfix' \
   349         '%dir %attr(-,%{l_susr},%{l_mgrp}) %{l_prefix}/var/postfix/pid' \
   350         '%dir %attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/var/postfix/{maildrop,public}'
   352 %files -f files
   354 %clean
   356 %pre
   357     #   before upgrade, save status and stop service
   358     [ $1 -eq 2 ] || exit 0
   359     eval `%{l_rc} postfix status 2>/dev/null | tee %{l_tmpfile}`
   360     %{l_rc} postfix stop 2>/dev/null
   361     exit 0
   363 %post
   364     if [ $1 -eq 1 ]; then
   365         #   after install, generate configuration
   366         ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} all; true ) >/dev/null 2>&1
   367     fi
   368     if [ $1 -eq 2 ]; then
   369         #   after upgrade, regenerate configuration
   370         ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean all; true ) >/dev/null 2>&1
   371         #   after upgrade, restore status
   372         eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} >/dev/null 2>&1 || true
   373         [ ".$postfix_active" = .yes ] && %{l_rc} postfix start
   374     fi
   375     exit 0
   377 %preun
   378     #   before erase, stop service and remove log files
   379     [ $1 -eq 0 ] || exit 0
   380     %{l_rc} postfix stop 2>/dev/null
   381     rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.log* >/dev/null 2>&1 || true
   382     rm -f $RPM_INSTALL_PREFIX/var/postfix/log/postfix.sum* >/dev/null 2>&1 || true
   383     #   remove generated configuration files
   384     ( cd $RPM_INSTALL_PREFIX/etc/postfix && %{l_make} clean >/dev/null 2>&1; true ) || true
   385     #   remove generated runtime files and directories
   386     rm -rf $RPM_INSTALL_PREFIX/var/postfix/data/*
   387     rm -rf $RPM_INSTALL_PREFIX/var/postfix/pid/*
   388     rm -rf $RPM_INSTALL_PREFIX/var/postfix/private/*
   389     rm -rf $RPM_INSTALL_PREFIX/var/postfix/public/*
   390     find $RPM_INSTALL_PREFIX/var/postfix/active/ -type d -print |\
   391         xargs rmdir >/dev/null 2>&1 || true
   392     find $RPM_INSTALL_PREFIX/var/postfix/incoming/ -type d -print |\
   393         xargs rmdir >/dev/null 2>&1 || true
   394     exit 0

mercurial