Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
michael@191 | 1 | ## |
michael@191 | 2 | ## spamassassin.spec -- OpenPKG RPM Package Specification |
michael@374 | 3 | ## Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@191 | 4 | ## |
michael@191 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@191 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@191 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@191 | 8 | ## copies. |
michael@191 | 9 | ## |
michael@191 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@191 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@191 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@191 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@191 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@191 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@191 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@191 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@191 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@191 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@191 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@191 | 21 | ## SUCH DAMAGE. |
michael@191 | 22 | ## |
michael@191 | 23 | |
michael@191 | 24 | # package version |
michael@629 | 25 | %define V_real 3.3.2 |
michael@629 | 26 | %define V_here 3.3.2 |
michael@629 | 27 | %define V_sdir 3.3.2 |
michael@191 | 28 | |
michael@191 | 29 | # package information |
michael@191 | 30 | Name: spamassassin |
michael@191 | 31 | Summary: Mail Filter Identifying Spam |
michael@191 | 32 | URL: http://spamassassin.apache.org/ |
michael@191 | 33 | Vendor: Justin Mason |
michael@191 | 34 | Packager: OpenPKG Foundation e.V. |
michael@191 | 35 | Distribution: OpenPKG Community |
michael@191 | 36 | Class: BASE |
michael@191 | 37 | Group: Mail |
michael@191 | 38 | License: ASF |
michael@191 | 39 | Version: %{V_here} |
michael@629 | 40 | Release: 20120800 |
michael@191 | 41 | |
michael@191 | 42 | # package options |
michael@191 | 43 | %option with_fsl yes |
michael@191 | 44 | |
michael@191 | 45 | # list of sources |
michael@629 | 46 | Source0: http://www.apache.org/dist/spamassassin/source/Mail-SpamAssassin-%{V_real}.tar.bz2 |
michael@191 | 47 | Source1: rc.spamassassin |
michael@191 | 48 | Source2: local.cf |
michael@191 | 49 | Source3: fsl.spamassassin |
michael@191 | 50 | |
michael@191 | 51 | # build information |
michael@629 | 52 | BuildPreReq: OpenPKG, openpkg >= 20100101, perl, perl-openpkg >= 5.8.4, make |
michael@629 | 53 | PreReq: OpenPKG, openpkg >= 20100101, perl, gnupg |
michael@374 | 54 | BuildPreReq: perl-db, perl-crypto, perl-xml, perl-dns, perl-locale, perl-www |
michael@374 | 55 | PreReq: perl-db, perl-crypto, perl-xml, perl-dns, perl-locale, perl-www |
michael@191 | 56 | %if "%{with_fsl}" == "yes" |
michael@191 | 57 | BuildPreReq: fsl |
michael@191 | 58 | PreReq: fsl |
michael@191 | 59 | %endif |
michael@191 | 60 | |
michael@191 | 61 | %description |
michael@191 | 62 | SpamAssassin provides you with a way to reduce if not completely |
michael@191 | 63 | eliminate Unsolicited Commercial Email (UCE, aka SPAM) from your |
michael@191 | 64 | incoming email. It uses a genetic-algorithm evolved scoring system |
michael@191 | 65 | to identify messages which look spammy, then adds headers to the |
michael@191 | 66 | message so they can be filtered by the user's mail reading software. |
michael@191 | 67 | This distribution includes the spamd/spamc components which create a |
michael@191 | 68 | server that considerably speeds processing of mail. |
michael@191 | 69 | |
michael@191 | 70 | %track |
michael@191 | 71 | prog spamassassin = { |
michael@191 | 72 | version = %{V_real} |
michael@191 | 73 | url = http://www.apache.org/dist/spamassassin/source/ |
michael@629 | 74 | regex = Mail-SpamAssassin-(\d+\.\d+\.\d+)\.tar\.bz2 |
michael@191 | 75 | } |
michael@191 | 76 | |
michael@191 | 77 | %prep |
michael@191 | 78 | %setup -q -n Mail-SpamAssassin-%{V_sdir} |
michael@191 | 79 | |
michael@191 | 80 | %build |
michael@191 | 81 | # configure package |
michael@191 | 82 | %{l_prefix}/bin/perl-openpkg prepare |
michael@191 | 83 | export CC="%{l_cc}" |
michael@191 | 84 | export CFLAGS="%{l_cflags -O} -Ispamc %{l_cppflags}" |
michael@191 | 85 | export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" |
michael@191 | 86 | export LIBS="%{l_ldflags} %{l_fsl_ldflags} %{l_fsl_libs}" |
michael@191 | 87 | %{l_prefix}/bin/perl-openpkg configure \ |
michael@191 | 88 | -A DESTDIR="$RPM_BUILD_ROOT" \ |
michael@191 | 89 | -A PREFIX="%{l_prefix}" \ |
michael@191 | 90 | -A SYSCONFDIR="%{l_prefix}/etc/spamassassin" \ |
michael@191 | 91 | -A LOCALRULESDIR="%{l_prefix}/etc/spamassassin" \ |
michael@191 | 92 | -A DATADIR="%{l_prefix}/share/spamassassin" \ |
michael@191 | 93 | -A PERL_BIN="%{l_prefix}/bin/perl" |
michael@191 | 94 | |
michael@191 | 95 | # build package |
michael@629 | 96 | %{l_make} %{l_mflags -O} |
michael@191 | 97 | |
michael@191 | 98 | %install |
michael@191 | 99 | # install package |
michael@191 | 100 | %{l_make} %{l_mflags} install |
michael@191 | 101 | |
michael@191 | 102 | # install default configuration |
michael@191 | 103 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@191 | 104 | $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin |
michael@191 | 105 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@191 | 106 | %{SOURCE local.cf} \ |
michael@191 | 107 | $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin/ |
michael@191 | 108 | |
michael@192 | 109 | # create directories for PID file and virtual users |
michael@191 | 110 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@192 | 111 | $RPM_BUILD_ROOT%{l_prefix}/var/spamassassin/spool |
michael@191 | 112 | |
michael@191 | 113 | # strip installation |
michael@191 | 114 | chmod u+w $RPM_BUILD_ROOT%{l_prefix}/bin/* |
michael@191 | 115 | strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true |
michael@191 | 116 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3 |
michael@191 | 117 | |
michael@192 | 118 | # install runcommand script |
michael@191 | 119 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@191 | 120 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
michael@191 | 121 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@191 | 122 | %{SOURCE rc.spamassassin} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@191 | 123 | |
michael@191 | 124 | # install OSSP fsl configuration |
michael@191 | 125 | %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
michael@191 | 126 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@191 | 127 | %{SOURCE fsl.spamassassin} \ |
michael@191 | 128 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
michael@191 | 129 | |
michael@191 | 130 | # determine installation files |
michael@191 | 131 | %{l_prefix}/bin/perl-openpkg \ |
michael@191 | 132 | -F perl-openpkg-files \ |
michael@191 | 133 | fixate cleanup |
michael@191 | 134 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@191 | 135 | %{l_files_std} \ |
michael@191 | 136 | '%config %{l_prefix}/etc/fsl/fsl.spamassassin' \ |
michael@191 | 137 | '%config %{l_prefix}/etc/spamassassin/*' \ |
michael@191 | 138 | '%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/spamassassin' \ |
michael@192 | 139 | '%attr(755,%{l_susr},%{l_sgrp}) %{l_prefix}/var/spamassassin/spool' \ |
michael@191 | 140 | '%attr(4755,%{l_rusr},%{l_mgrp}) %{l_prefix}/bin/spamc' \ |
michael@191 | 141 | `cat perl-openpkg-files` |
michael@191 | 142 | |
michael@191 | 143 | %files -f files |
michael@191 | 144 | |
michael@191 | 145 | %clean |
michael@191 | 146 | |
michael@191 | 147 | %post |
michael@191 | 148 | # after upgrade, restart service |
michael@191 | 149 | [ $1 -eq 2 ] || exit 0 |
michael@191 | 150 | eval `%{l_rc} spamassassin status 2>/dev/null` |
michael@191 | 151 | [ ".$spamassassin_active" = .yes ] && %{l_rc} spamassassin restart |
michael@191 | 152 | exit 0 |
michael@191 | 153 | |
michael@191 | 154 | %preun |
michael@191 | 155 | # before erase, stop service |
michael@191 | 156 | [ $1 -eq 0 ] || exit 0 |
michael@191 | 157 | %{l_rc} spamassassin stop 2>/dev/null |
michael@191 | 158 | rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.pid >/dev/null 2>&1 || true |
michael@191 | 159 | rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.log* >/dev/null 2>&1 || true |
michael@191 | 160 | exit 0 |
michael@191 | 161 |