You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
175 lines
5.7 KiB
175 lines
5.7 KiB
## |
|
## milter-greylist.spec -- OpenPKG RPM Package Specification |
|
## Copyright (c) 2000-2022 OpenPKG Project <http://openpkg.org/> |
|
## |
|
## Permission to use, copy, modify, and distribute this software for |
|
## any purpose with or without fee is hereby granted, provided that |
|
## the above copyright notice and this permission notice appear in all |
|
## copies. |
|
## |
|
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
|
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
|
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
|
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
## SUCH DAMAGE. |
|
## |
|
|
|
# package information |
|
Name: milter-greylist |
|
Summary: Mail Filter for Greylisting |
|
URL: http://hcpnet.free.fr/milter-greylist/ |
|
Vendor: Emmanuel Dreyfus |
|
Packager: OpenPKG Project |
|
Distribution: OpenPKG Community |
|
Class: EVAL |
|
Group: Mail |
|
License: BSD |
|
Version: 4.6.4 |
|
Release: 20200901 |
|
|
|
# package options |
|
%option with_fsl yes |
|
%option with_curl no |
|
%option with_spf no |
|
|
|
# list of sources |
|
Source0: ftp://ftp.espci.fr/pub/milter-greylist/milter-greylist-%{version}.tgz |
|
Source1: rc.milter-greylist |
|
Source2: greylist.conf |
|
Source3: fsl.milter-greylist |
|
Patch0: milter-greylist.patch |
|
|
|
# build information |
|
BuildPreReq: OpenPKG, openpkg >= 20160101, bison, flex, pkgconfig |
|
PreReq: OpenPKG, openpkg >= 20160101 |
|
BuildPreReq: milter, pcre, db |
|
PreReq: milter, pcre, db |
|
%if "%{with_fsl}" == "yes" |
|
BuildPreReq: fsl |
|
PreReq: fsl |
|
%endif |
|
%if "%{with_curl}" == "yes" |
|
BuildPreReq: curl |
|
PreReq: curl |
|
%endif |
|
%if "%{with_spf}" == "yes" |
|
BuildPreReq: libspf2 |
|
PreReq: libspf2 |
|
%endif |
|
|
|
%description |
|
milter-greylist is a Greylisting mail filter based on the MILTER API |
|
of MTAs. |
|
|
|
%track |
|
prog milter-greylist = { |
|
version = %{version} |
|
url = ftp://ftp.espci.fr/pub/milter-greylist/ |
|
regex = milter-greylist-(\d+\.\d+\.\d+)\.tgz |
|
} |
|
|
|
%prep |
|
%setup -q |
|
%patch -p0 |
|
|
|
%build |
|
# configure program |
|
export CC="%{l_cc}" \ |
|
export CFLAGS="%{l_cflags -O}" |
|
export CPPFLAGS="%{l_cppflags}" |
|
export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" |
|
export LIBS="%{l_fsl_libs}" |
|
CFLAGS="$CFLAGS `pkg-config db --cflags-only-other`" |
|
CPPFLAGS="$CPPFLAGS `pkg-config db --cflags-only-I`" |
|
LDFLAGS="$LDFLAGS `pkg-config db --libs-only-other`" |
|
LIBS="$LIBS `pkg-config db --libs-only-l`" |
|
%if "%{with_curl}" == "yes" |
|
CFLAGS="$CFLAGS `pkg-config libcurl --cflags-only-other`" |
|
CPPFLAGS="$CPPFLAGS `pkg-config libcurl --cflags-only-I`" |
|
LDFLAGS="$LDFLAGS `pkg-config libcurl --libs-only-other`" |
|
LIBS="$LIBS `pkg-config libcurl --libs-only-l`" |
|
%endif |
|
LIBS="$LIBS -lpcreposix -lpcre" |
|
sh ./configure \ |
|
--prefix=%{l_prefix} \ |
|
--with-conffile=%{l_prefix}/etc/milter-greylist/greylist.conf \ |
|
--with-dumpfile=%{l_prefix}/var/milter-greylist/greylist.dump \ |
|
--with-libmilter=%{l_prefix} \ |
|
%if "%{with_curl}" == "yes" |
|
--with-libcurl=%{l_prefix} \ |
|
%endif |
|
%if "%{with_spf}" == "yes" |
|
--with-libspf2=%{l_prefix} \ |
|
%endif |
|
--with-user=%{l_rusr} \ |
|
--enable-postfix |
|
|
|
# build program |
|
%{l_make} %{l_mflags} |
|
|
|
%install |
|
# create installation hierarchy |
|
%{l_shtool} mkdir -p -m 755 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/sbin \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/milter-greylist \ |
|
$RPM_BUILD_ROOT%{l_prefix}/var/milter-greylist \ |
|
$RPM_BUILD_ROOT%{l_prefix}/man/man5 \ |
|
$RPM_BUILD_ROOT%{l_prefix}/man/man8 |
|
|
|
# install program |
|
%{l_shtool} install -c -s -m 755 \ |
|
milter-greylist $RPM_BUILD_ROOT%{l_prefix}/sbin/ |
|
|
|
# install manual pages |
|
%{l_shtool} install -c -m 644 \ |
|
milter-greylist.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/ |
|
%{l_shtool} install -c -m 644 \ |
|
greylist.conf.5 $RPM_BUILD_ROOT%{l_prefix}/man/man5/ |
|
|
|
# install default configuration |
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
%{SOURCE greylist.conf} \ |
|
$RPM_BUILD_ROOT%{l_prefix}/etc/milter-greylist/ |
|
|
|
# install run-command script |
|
%{l_shtool} install -c -m 755 %{l_value -s -a} \ |
|
%{SOURCE rc.milter-greylist} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
|
|
|
# install OSSP fsl configuration |
|
%{l_shtool} install -c -m 644 %{l_value -s -a} \ |
|
%{SOURCE fsl.milter-greylist} $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
|
|
|
# determine installation files |
|
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
|
%{l_files_std} \ |
|
'%config %{l_prefix}/etc/fsl/*' \ |
|
'%config %{l_prefix}/etc/milter-greylist/*' \ |
|
'%attr(-,%{l_rusr},%{l_mgrp}) %{l_prefix}/var/milter-greylist' |
|
|
|
%files -f files |
|
|
|
%clean |
|
|
|
%post |
|
# after upgrade, restart service |
|
[ $1 -eq 2 ] || exit 0 |
|
eval `%{l_rc} milter-greylist status 2>/dev/null` |
|
[ ".$milter_greylist_active" = .yes ] && %{l_rc} milter-greylist restart |
|
exit 0 |
|
|
|
%preun |
|
# before erase, stop service and remove log files |
|
[ $1 -eq 0 ] || exit 0 |
|
%{l_rc} milter-greylist stop 2>/dev/null |
|
rm -f $RPM_INSTALL_PREFIX/var/milter-greylist/* >/dev/null 2>&1 || true |
|
exit 0 |
|
|
|
|