Sophie

Sophie

distrib > Mageia > 8 > armv7hl > media > core-release-src > by-pkgid > 5550024dbfca0f96fdd657291604e8ca > files > 3

opendmarc-1.3.2-1.mga8.src.rpm

%define major		2
%define libname		%mklibname opendmarc %{major}
%define develname	%mklibname opendmarc -d
%define bigname		OpenDMARC
%define postfixdir	%{_var}/spool/postfix

Name:			opendmarc
Version:		1.3.2
Release:		%mkrel 1
Summary:		Domain Message Auth, Report and Conformance (DMARC) policy service milter
Group:			System/Servers
License:		BSD and Sendmail
URL:			http://www.trusteddomain.org/opendmarc/
Source0:		http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Patch0:			opendmarc-1.3.2-fix-pidfile-path.patch
Requires:		publicsuffix-list
BuildRequires:	pkgconfig(libbsd)
BuildRequires:	libmilter-devel
BuildRequires:	libspf2-devel
BuildRequires:	libtool

%description
OpenDMARC allows report generation and/or policy enforcement of email through
an open source library that implements the DMARC service, plus a milter-based
filter applications that can plug in to any milter-aware MTA, including
sendmail, Postfix, or any other MTA that supports the milter protocol.

%package -n %{libname}
Summary: An open source DMARC library
Group: System/Servers

%description -n %{libname}
This package contains the library files required for running services built
using libopendmarc.

%package -n %{develname}
Summary: Development files for lib%{name}
Group: Development/Other

%description -n %{develname}
This package contains the static libraries, headers, and other support files
required for developing applications against libopendmarc.

%prep
%setup -q
%patch0 -p 1

%build
autoreconf -f -i
# Always use system libtool instead of package-provided one to
# properly handle 32 versus 64 bit detection and settings
%global LIBTOOL LIBTOOL=`which libtool`

export LDFLAGS="%{ldflags} -lresolv"

%configure --with-sql-backend --with-spf --with-milter --disable-static --enable-shared --prefix=/usr

# Prevent build-aux/depcomp not found error
automake --add-missing

# Remove rpath
%{__sed} -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
%{__sed} -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%make_build %{LIBTOOL}

%install
%make_install

install -d %{buildroot}%{_sysconfdir}

install -d %{buildroot}%{_unitdir}
install -m 0644 contrib/service/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
perl -pi -e 's|^(ExecReload=)|ExecStartPost=+%{_bindir}/systemd-tmpfiles --create %{_tmpfilesdir}/%{name}.conf\n$1|' %{buildroot}%{_unitdir}/%{name}.service

install -p -d %{buildroot}%{_tmpfilesdir}
%{__cat} > %{buildroot}%{_tmpfilesdir}/%{name}.conf <<EOF
D %{_rundir}/%{name} 0755 %{name} %{name} -
z %{_rundir}/%{name}/%{name}.pid 0644 %{name} %{name} -
D %{postfixdir}%{_rundir}/%{name} 0755 %{name} postfix -
z %{postfixdir}%{_rundir}/%{name}/%{name}.sock 0664 %{name} postfix -
EOF

rm -rf %{buildroot}%{_prefix}/share/doc/%{name}
rm -f %{buildroot}%{_libdir}/*.a
rm -f %{buildroot}%{_libdir}/*.la

install -m 0644 opendmarc/%{name}.conf.sample %{buildroot}%{_sysconfdir}/%{name}.conf
perl -pi -e 's|^# (BaseDirectory )/var/run/opendmarc|$1%{_rundir}/%{name}|;
	s|^# (HistoryFile )/var/run/opendmarc.dat|$1%{_rundir}/%{name}/%{name}.dat|;
	s|^(# IgnoreHosts )/usr/local(/etc/opendmarc/ignore.hosts)|$1$2|;
	s|^# (PidFile )/var/run/opendmarc.pid|$1%{_rundir}/%{name}/%{name}.pid|;
	s|^# (PublicSuffixList )path|$1%{_datadir}/publicsuffix/effective_tld_names.dat|;
	s|^(# (Socket )inet:8893\@localhost)|$1\n$2local:%{postfixdir}%{_rundir}/%{name}/%{name}.sock|;
	s|^# (UMask) 077|$1 002|;' %{buildroot}%{_sysconfdir}/%{name}.conf
#s|^# (UserID )opendmarc|$1%{name}:%{name}|;

mkdir -p %{buildroot}%{_localstatedir}/spool/%{name}
mkdir -p %{buildroot}%{_rundir}/%{name}

# Install README.urpmi
%{__cat} << EOF | perl -pe 'chomp if eof' > README.urpmi

%{bigname} is now installed.

Choose socket type in %{_sysconfdir}/%{name}.conf:
# Socket inet:8893@localhost
Socket local:%{postfixdir}%{_rundir}/%{name}/%{name}.sock

Configure message filter in %{_sysconfdir}/postfix/main.cf:
# smtpd_milters = inet:localhost:8893
smtpd_milters = unix:%{_rundir}/%{name}/%{name}.sock
non_smtpd_milters = \$smtpd_milters
milter_default_action = accept
milter_protocol = 6

Enable the service with:
# systemctl enable %{name}.service

Start the service with:
# systemctl restart %{name}.service
EOF

%pre
%_pre_useradd %{name} %{_rundir}/%{name} /bin/false

%post
%_post_service %{name}
%_tmpfilescreate %{name}

%preun
%_preun_service %{name}

%files
%doc RELEASE_NOTES INSTALL
%doc contrib/rddmarc/dmarcfail.py contrib/rddmarc/mkdmarc contrib/rddmarc/mysql_ip6.c contrib/rddmarc/rddmarc contrib/rddmarc/README.rddmarc
%doc db/README.schema db/schema.mysql
%doc README.urpmi
%config(noreplace) %{_sysconfdir}/%{name}.conf
%config(noreplace) %{_tmpfilesdir}/%{name}.conf
%{_unitdir}/%{name}.service
%{_sbindir}/%{name}
%{_sbindir}/%{name}-check
%{_sbindir}/%{name}-expire
%{_sbindir}/%{name}-import
%{_sbindir}/%{name}-importstats
%{_sbindir}/%{name}-params
%{_sbindir}/%{name}-reports
%{_mandir}/man5/*.5*
%{_mandir}/man8/*.8*

%files -n %{libname}
%doc LICENSE LICENSE.Sendmail
%doc README
%{_libdir}/lib%{name}.so.*

%files -n %{develname}
%doc LICENSE LICENSE.Sendmail
%doc lib%{name}/docs/*.html
%{_includedir}/%{name}
%{_libdir}/*.so


%changelog
* Fri Dec 11 2020 rapsys <rapsys> 1.3.2-1.mga8
+ Revision: 1655357
- Rebuild release 1
- Fix buildrequires
- Fix tmpfiles permissions
- Import opendmarc sha1.lst
- Import opendmarc
- Created package structure for opendmarc.