Simplify conditional builds
reference: /usr/lib/rpm/macros and use make_build and make install macros
This commit is contained in:
parent
eec7d43883
commit
c6bcaca9cf
69
clamav.spec
69
clamav.spec
|
@ -1,18 +1,18 @@
|
||||||
#global prerelease rc1
|
#global prerelease rc1
|
||||||
|
|
||||||
## Fedora Extras specific customization below...
|
## Fedora Extras specific customization below...
|
||||||
%bcond_without fedora
|
%bcond_without fedora
|
||||||
%bcond_with upstart
|
%bcond_with upstart
|
||||||
%bcond_without systemd
|
%bcond_without systemd
|
||||||
%if 0%{?fedora} < 23
|
%if 0%{?fedora} < 23
|
||||||
%bcond_without sysv
|
%bcond_without sysv
|
||||||
%else
|
%else
|
||||||
%bcond_with sysv
|
%bcond_with sysv
|
||||||
%endif
|
%endif
|
||||||
%bcond_without tmpfiles
|
%bcond_without tmpfiles
|
||||||
%bcond_with unrar
|
%bcond_with unrar
|
||||||
%bcond_without noarch
|
%bcond_without noarch
|
||||||
%bcond_without bytecode
|
%bcond_without bytecode
|
||||||
##
|
##
|
||||||
|
|
||||||
%global _hardened_build 1
|
%global _hardened_build 1
|
||||||
|
@ -63,7 +63,7 @@ Release: 14%{?dist}
|
||||||
License: %{?with_unrar:proprietary}%{!?with_unrar:GPLv2}
|
License: %{?with_unrar:proprietary}%{!?with_unrar:GPLv2}
|
||||||
Group: Applications/File
|
Group: Applications/File
|
||||||
URL: http://www.clamav.net
|
URL: http://www.clamav.net
|
||||||
%if 0%{?with_unrar:1}
|
%if %{with unrar}
|
||||||
Source0: http://download.sourceforge.net/sourceforge/clamav/%name-%version%{?prerelease}.tar.gz
|
Source0: http://download.sourceforge.net/sourceforge/clamav/%name-%version%{?prerelease}.tar.gz
|
||||||
Source999: http://download.sourceforge.net/sourceforge/clamav/%name-%version%{?prerelease}.tar.gz.sig
|
Source999: http://download.sourceforge.net/sourceforge/clamav/%name-%version%{?prerelease}.tar.gz.sig
|
||||||
%else
|
%else
|
||||||
|
@ -170,7 +170,7 @@ Requires: clamav-filesystem = %version-%release
|
||||||
Requires: clamav-lib = %version-%release
|
Requires: clamav-lib = %version-%release
|
||||||
Requires: coreutils
|
Requires: coreutils
|
||||||
|
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
%package server-sysvinit
|
%package server-sysvinit
|
||||||
Summary: SysV initscripts for clamav server
|
Summary: SysV initscripts for clamav server
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
|
@ -205,7 +205,7 @@ Requires(pre): group(virusgroup)
|
||||||
%{?noarch}
|
%{?noarch}
|
||||||
|
|
||||||
# Remove me after EOL of RHEL5
|
# Remove me after EOL of RHEL5
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
%package scanner-sysvinit
|
%package scanner-sysvinit
|
||||||
Summary: SysV initscripts for clamav scanner daemon
|
Summary: SysV initscripts for clamav scanner daemon
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
|
@ -262,7 +262,7 @@ Provides: clamav-milter-sendmail = %version-%release
|
||||||
Obsoletes: clamav-milter-sendmail < %version-%release
|
Obsoletes: clamav-milter-sendmail < %version-%release
|
||||||
|
|
||||||
# Remove me after EOL of RHEL5
|
# Remove me after EOL of RHEL5
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
%package milter-sysvinit
|
%package milter-sysvinit
|
||||||
Summary: SysV initscripts for the clamav sendmail-milter
|
Summary: SysV initscripts for the clamav sendmail-milter
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
|
@ -369,7 +369,7 @@ of this daemon should be started for each service requiring it.
|
||||||
See the README file how this can be done with a minimum of effort.
|
See the README file how this can be done with a minimum of effort.
|
||||||
|
|
||||||
|
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
%description server-sysvinit
|
%description server-sysvinit
|
||||||
SysV initscripts template for the clamav server
|
SysV initscripts template for the clamav server
|
||||||
%endif
|
%endif
|
||||||
|
@ -382,7 +382,7 @@ Systemd template for the clamav server
|
||||||
This package contains a generic system wide clamd service which is
|
This package contains a generic system wide clamd service which is
|
||||||
e.g. used by the clamav-milter package.
|
e.g. used by the clamav-milter package.
|
||||||
|
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
%description scanner-sysvinit
|
%description scanner-sysvinit
|
||||||
The SysV initscripts for clamav-scanner.
|
The SysV initscripts for clamav-scanner.
|
||||||
%endif
|
%endif
|
||||||
|
@ -397,7 +397,7 @@ The systemd initscripts for clamav-scanner.
|
||||||
%description milter
|
%description milter
|
||||||
This package contains files which are needed to run the clamav-milter.
|
This package contains files which are needed to run the clamav-milter.
|
||||||
|
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
%description milter-sysvinit
|
%description milter-sysvinit
|
||||||
The SysV initscripts for clamav-milter.
|
The SysV initscripts for clamav-milter.
|
||||||
%endif
|
%endif
|
||||||
|
@ -479,14 +479,14 @@ sed -i \
|
||||||
libtool
|
libtool
|
||||||
|
|
||||||
|
|
||||||
make %{?_smp_mflags}
|
%make_build
|
||||||
|
|
||||||
|
|
||||||
## ------------------------------------------------------------
|
## ------------------------------------------------------------
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf "$RPM_BUILD_ROOT" _doc*
|
rm -rf "$RPM_BUILD_ROOT" _doc*
|
||||||
make DESTDIR="$RPM_BUILD_ROOT" install
|
%make_install
|
||||||
|
|
||||||
function smartsubst() {
|
function smartsubst() {
|
||||||
local tmp
|
local tmp
|
||||||
|
@ -527,19 +527,19 @@ install -D -m 0644 -p %SOURCE11 $RPM_BUILD_ROOT%homedir/daily.cvd
|
||||||
## prepare the server-files
|
## prepare the server-files
|
||||||
install -D -m 0644 -p %SOURCE2 _doc_server/clamd.sysconfig
|
install -D -m 0644 -p %SOURCE2 _doc_server/clamd.sysconfig
|
||||||
install -D -m 0644 -p %SOURCE3 _doc_server/clamd.logrotate
|
install -D -m 0644 -p %SOURCE3 _doc_server/clamd.logrotate
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
install -D -m 0755 -p %SOURCE7 _doc_server/clamd.init
|
install -D -m 0755 -p %SOURCE7 _doc_server/clamd.init
|
||||||
%endif
|
%endif
|
||||||
install -D -m 0644 -p %SOURCE5 _doc_server/README
|
install -D -m 0644 -p %SOURCE5 _doc_server/README
|
||||||
install -D -m 0644 -p etc/clamd.conf.sample _doc_server/clamd.conf
|
install -D -m 0644 -p etc/clamd.conf.sample _doc_server/clamd.conf
|
||||||
|
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
install -m 0644 -p %SOURCE520 $RPM_BUILD_ROOT%pkgdatadir/
|
install -m 0644 -p %SOURCE520 $RPM_BUILD_ROOT%pkgdatadir/
|
||||||
%endif
|
%endif
|
||||||
install -m 0755 -p %SOURCE100 $RPM_BUILD_ROOT%pkgdatadir/
|
install -m 0755 -p %SOURCE100 $RPM_BUILD_ROOT%pkgdatadir/
|
||||||
cp -pa _doc_server/* $RPM_BUILD_ROOT%pkgdatadir/template
|
cp -pa _doc_server/* $RPM_BUILD_ROOT%pkgdatadir/template
|
||||||
|
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
smartsubst 's!/usr/share/clamav!%pkgdatadir!g' $RPM_BUILD_ROOT%pkgdatadir/clamd-wrapper
|
smartsubst 's!/usr/share/clamav!%pkgdatadir!g' $RPM_BUILD_ROOT%pkgdatadir/clamd-wrapper
|
||||||
%endif
|
%endif
|
||||||
install -D -p -m 0644 %SOURCE530 $RPM_BUILD_ROOT%_unitdir/clamd@.service
|
install -D -p -m 0644 %SOURCE530 $RPM_BUILD_ROOT%_unitdir/clamd@.service
|
||||||
|
@ -567,7 +567,7 @@ smartsubst 's!webmaster,clamav!webmaster,%updateuser!g;
|
||||||
sed -e 's!<SERVICE>!scan!g;s!<USER>!%scanuser!g' \
|
sed -e 's!<SERVICE>!scan!g;s!<USER>!%scanuser!g' \
|
||||||
etc/clamd.conf.sample > $RPM_BUILD_ROOT%_sysconfdir/clamd.d/scan.conf
|
etc/clamd.conf.sample > $RPM_BUILD_ROOT%_sysconfdir/clamd.d/scan.conf
|
||||||
|
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
sed -e 's!<SERVICE>!scan!g;' $RPM_BUILD_ROOT%pkgdatadir/template/clamd.init \
|
sed -e 's!<SERVICE>!scan!g;' $RPM_BUILD_ROOT%pkgdatadir/template/clamd.init \
|
||||||
> $RPM_BUILD_ROOT%_initrddir/clamd.scan
|
> $RPM_BUILD_ROOT%_initrddir/clamd.scan
|
||||||
%endif
|
%endif
|
||||||
|
@ -593,7 +593,7 @@ sed -r \
|
||||||
etc/clamav-milter.conf.sample > $RPM_BUILD_ROOT%_sysconfdir/mail/clamav-milter.conf
|
etc/clamav-milter.conf.sample > $RPM_BUILD_ROOT%_sysconfdir/mail/clamav-milter.conf
|
||||||
|
|
||||||
install -D -p -m 0644 %SOURCE310 $RPM_BUILD_ROOT%_sysconfdir/init/clamav-milter.conf
|
install -D -p -m 0644 %SOURCE310 $RPM_BUILD_ROOT%_sysconfdir/init/clamav-milter.conf
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
install -D -p -m 0755 %SOURCE320 $RPM_BUILD_ROOT%_initrddir/clamav-milter
|
install -D -p -m 0755 %SOURCE320 $RPM_BUILD_ROOT%_initrddir/clamav-milter
|
||||||
%endif
|
%endif
|
||||||
install -D -p -m 0644 %SOURCE330 $RPM_BUILD_ROOT%_unitdir/clamav-milter.service
|
install -D -p -m 0644 %SOURCE330 $RPM_BUILD_ROOT%_unitdir/clamav-milter.service
|
||||||
|
@ -611,12 +611,12 @@ touch $RPM_BUILD_ROOT{%milterstatedir/clamav-milter.{socket,pid},%milterlog}
|
||||||
%{!?with_sysv: rm -rf $RPM_BUILD_ROOT%_var/run/*/*.pid}
|
%{!?with_sysv: rm -rf $RPM_BUILD_ROOT%_var/run/*/*.pid}
|
||||||
%{!?with_tmpfiles: rm -rf $RPM_BUILD_ROOT%_tmpfilesdir}
|
%{!?with_tmpfiles: rm -rf $RPM_BUILD_ROOT%_tmpfilesdir}
|
||||||
|
|
||||||
%if 0%{?with_systemd:1}
|
%if %{with systemd}
|
||||||
# TODO: Evaluate using upstream's unit files
|
# TODO: Evaluate using upstream's unit files
|
||||||
rm $RPM_BUILD_ROOT%_unitdir/clamav-{daemon,freshclam}.*
|
rm $RPM_BUILD_ROOT%_unitdir/clamav-{daemon,freshclam}.*
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
# keep clamd-wrapper in every case because it might be needed by other
|
# keep clamd-wrapper in every case because it might be needed by other
|
||||||
# packages
|
# packages
|
||||||
ln -s %pkgdatadir/clamd-wrapper $RPM_BUILD_ROOT%_initrddir/clamd-wrapper
|
ln -s %pkgdatadir/clamd-wrapper $RPM_BUILD_ROOT%_initrddir/clamd-wrapper
|
||||||
|
@ -660,7 +660,7 @@ test "$1" != "1" || /bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
|
|
||||||
|
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
%post scanner-sysvinit
|
%post scanner-sysvinit
|
||||||
/sbin/chkconfig --add clamd.scan
|
/sbin/chkconfig --add clamd.scan
|
||||||
|
|
||||||
|
@ -825,13 +825,13 @@ test "$1" != "0" || /sbin/initctl -q stop clamav-milter || :
|
||||||
%exclude %_mandir/man8/clamav-milter*
|
%exclude %_mandir/man8/clamav-milter*
|
||||||
|
|
||||||
|
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
%files server-sysvinit
|
%files server-sysvinit
|
||||||
%_initrddir/clamd-wrapper
|
%_initrddir/clamd-wrapper
|
||||||
%pkgdatadir/clamd-wrapper
|
%pkgdatadir/clamd-wrapper
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?with_systemd:1}
|
%if %{with systemd}
|
||||||
%files server-systemd
|
%files server-systemd
|
||||||
%_unitdir/clamd@.service
|
%_unitdir/clamd@.service
|
||||||
%endif
|
%endif
|
||||||
|
@ -842,25 +842,25 @@ test "$1" != "0" || /sbin/initctl -q stop clamav-milter || :
|
||||||
%config(noreplace) %_sysconfdir/clamd.d/scan.conf
|
%config(noreplace) %_sysconfdir/clamd.d/scan.conf
|
||||||
%ghost %scanstatedir/clamd.sock
|
%ghost %scanstatedir/clamd.sock
|
||||||
|
|
||||||
%if 0%{?with_tmpfiles:1}
|
%if %{with tmpfiles}
|
||||||
%_tmpfilesdir/clamd.scan.conf
|
%_tmpfilesdir/clamd.scan.conf
|
||||||
%ghost %dir %attr(0710,%scanuser,%scanuser) %scanstatedir
|
%ghost %dir %attr(0710,%scanuser,%scanuser) %scanstatedir
|
||||||
%else
|
%else
|
||||||
%dir %attr(0710,%scanuser,%scanuser) %scanstatedir
|
%dir %attr(0710,%scanuser,%scanuser) %scanstatedir
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
%files scanner-sysvinit
|
%files scanner-sysvinit
|
||||||
%attr(0755,root,root) %config %_initrddir/clamd.scan
|
%attr(0755,root,root) %config %_initrddir/clamd.scan
|
||||||
%ghost %scanstatedir/clamd.pid
|
%ghost %scanstatedir/clamd.pid
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?with_upstart:1}
|
%if %{with upstart}
|
||||||
%files scanner-upstart
|
%files scanner-upstart
|
||||||
%config(noreplace) %_sysconfdir/init/clamd.scan*
|
%config(noreplace) %_sysconfdir/init/clamd.scan*
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?with_systemd:1}
|
%if %{with systemd}
|
||||||
%files scanner-systemd
|
%files scanner-systemd
|
||||||
%_unitdir/clamd@scan.service
|
%_unitdir/clamd@scan.service
|
||||||
%endif
|
%endif
|
||||||
|
@ -876,25 +876,25 @@ test "$1" != "0" || /sbin/initctl -q stop clamav-milter || :
|
||||||
%ghost %attr(0620,root,%milteruser) %verify(not size md5 mtime) %milterlog
|
%ghost %attr(0620,root,%milteruser) %verify(not size md5 mtime) %milterlog
|
||||||
%ghost %milterstatedir/clamav-milter.socket
|
%ghost %milterstatedir/clamav-milter.socket
|
||||||
|
|
||||||
%if 0%{?with_tmpfiles:1}
|
%if %{with tmpfiles}
|
||||||
%_tmpfilesdir/clamav-milter.conf
|
%_tmpfilesdir/clamav-milter.conf
|
||||||
%ghost %dir %attr(0710,%milteruser,%milteruser) %milterstatedir
|
%ghost %dir %attr(0710,%milteruser,%milteruser) %milterstatedir
|
||||||
%else
|
%else
|
||||||
%dir %attr(0710,%milteruser,%milteruser) %milterstatedir
|
%dir %attr(0710,%milteruser,%milteruser) %milterstatedir
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?with_sysv:1}
|
%if %{with sysv}
|
||||||
%files milter-sysvinit
|
%files milter-sysvinit
|
||||||
%config %_initrddir/clamav-milter
|
%config %_initrddir/clamav-milter
|
||||||
%ghost %milterstatedir/clamav-milter.pid
|
%ghost %milterstatedir/clamav-milter.pid
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?with_upstart:1}
|
%if %{with upstart}
|
||||||
%files milter-upstart
|
%files milter-upstart
|
||||||
%config(noreplace) %_sysconfdir/init/clamav-milter*
|
%config(noreplace) %_sysconfdir/init/clamav-milter*
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{?with_systemd:1}
|
%if %{with systemd}
|
||||||
%files milter-systemd
|
%files milter-systemd
|
||||||
%_unitdir/clamav-milter.service
|
%_unitdir/clamav-milter.service
|
||||||
%endif
|
%endif
|
||||||
|
@ -902,8 +902,11 @@ test "$1" != "0" || /sbin/initctl -q stop clamav-milter || :
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Thu Jan 04 2018 Sérgio Basto <sergio@serjux.com> - 0.99.2-14
|
* Thu Jan 04 2018 Sérgio Basto <sergio@serjux.com> - 0.99.2-14
|
||||||
|
- Use 4 spaces instead tabs
|
||||||
- Fix rhbz #1530678
|
- Fix rhbz #1530678
|
||||||
- Fix rhbz #1518016
|
- Fix rhbz #1518016
|
||||||
|
- Simplify conditional builds reference: /usr/lib/rpm/macros
|
||||||
|
- use make_build and make install macros
|
||||||
|
|
||||||
* Sun Nov 26 2017 Robert Scheck <robert@fedoraproject.org> - 0.99.2-13
|
* Sun Nov 26 2017 Robert Scheck <robert@fedoraproject.org> - 0.99.2-13
|
||||||
- Backported upstream patch to unbreak e2guardian vs. temp files
|
- Backported upstream patch to unbreak e2guardian vs. temp files
|
||||||
|
|
Loading…
Reference in New Issue