add bcond for systemd - used in flatpak

This commit is contained in:
Zdenek Dohnal 2023-02-23 16:23:37 +01:00
parent c555c50533
commit 0ad9add3c7

View File

@ -15,10 +15,16 @@
%global camera_backends_list dc210 dc240 dc25 dmc gphoto2 qcam stv680 v4l %global camera_backends_list dc210 dc240 dc25 dmc gphoto2 qcam stv680 v4l
%global config_files_list abaton agfafocus apple artec artec_eplus48u avision bh canon canon630u canon_dr canon_lide70 canon_pp cardscan coolscan coolscan2 coolscan3 dell1600n_net dll epjitsu epson epson2 epsonds fujitsu genesys gt68xx hp hp3900 hp4200 hp5400 hpsj5s hs2p ibm kodak kodakaio kvs1025 leo lexmark ma1509 magicolor matsushita microtek microtek2 mustek mustek_pp mustek_usb nec net p5 pie pieusb pixma plustek plustek_pp ricoh rts8891 s9036 sceptre sharp sm3840 snapscan sp15c st400 tamarack teco1 teco2 teco3 test u12 umax umax1220u umax_pp xerox_mfp dc210 dc240 dc25 dmc gphoto2 qcam stv680 v4l %global config_files_list abaton agfafocus apple artec artec_eplus48u avision bh canon canon630u canon_dr canon_lide70 canon_pp cardscan coolscan coolscan2 coolscan3 dell1600n_net dll epjitsu epson epson2 epsonds fujitsu genesys gt68xx hp hp3900 hp4200 hp5400 hpsj5s hs2p ibm kodak kodakaio kvs1025 leo lexmark ma1509 magicolor matsushita microtek microtek2 mustek mustek_pp mustek_usb nec net p5 pie pieusb pixma plustek plustek_pp ricoh rts8891 s9036 sceptre sharp sm3840 snapscan sp15c st400 tamarack teco1 teco2 teco3 test u12 umax umax1220u umax_pp xerox_mfp dc210 dc240 dc25 dmc gphoto2 qcam stv680 v4l
%if 0%{?flatpak}
%bcond_with systemd
%else
%bcond_without systemd
%endif
Summary: Scanner access software Summary: Scanner access software
Name: sane-backends Name: sane-backends
Version: 1.2.1 Version: 1.2.1
Release: 2%{?dist} Release: 3%{?dist}
# lib/ is LGPLv2+, backends are GPLv2+ with exceptions # lib/ is LGPLv2+, backends are GPLv2+ with exceptions
# Tools are GPLv2+, docs are public domain # Tools are GPLv2+, docs are public domain
# see LICENSE for details # see LICENSE for details
@ -73,16 +79,20 @@ BuildRequires: libv4l-devel
BuildRequires: make BuildRequires: make
# pixma backend generates header files during build via python script # pixma backend generates header files during build via python script
BuildRequires: python3 BuildRequires: python3
%if %{with systemd}
BuildRequires: systemd-devel BuildRequires: systemd-devel
BuildRequires: systemd BuildRequires: systemd
# needed by macros in rpm scriptlets # needed by macros in rpm scriptlets
BuildRequires: systemd-rpm-macros BuildRequires: systemd-rpm-macros
%endif
Requires: libpng Requires: libpng
Requires: sane-airscan Requires: sane-airscan
Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%if %{with systemd}
Requires: systemd >= 196 Requires: systemd >= 196
Requires: systemd-udev >= 196 Requires: systemd-udev >= 196
%endif
# workaround for Brother scanners, which drivers are built with old libnsl # workaround for Brother scanners, which drivers are built with old libnsl
# it is ignored by DNF, but it seems GUI installation apps should offer it # it is ignored by DNF, but it seems GUI installation apps should offer it
@ -180,7 +190,11 @@ LDFLAGS="-pie"
%configure \ %configure \
--with-gphoto2=%{_prefix} \ --with-gphoto2=%{_prefix} \
--with-docdir=%{_maindocdir} \ --with-docdir=%{_maindocdir} \
%if %{with systemd}
--with-systemd \ --with-systemd \
%else
--without-systemd \
%endif
--disable-locking --disable-rpath \ --disable-locking --disable-rpath \
%if %libusb1 %if %libusb1
--with-usb \ --with-usb \
@ -199,8 +213,6 @@ popd
%install %install
%make_install %make_install
install -p -D -m 0644 %{SOURCE6} %{buildroot}%{_sysusersdir}/sane-backends.conf
mkdir -p %{buildroot}%{_datadir}/pixmaps mkdir -p %{buildroot}%{_datadir}/pixmaps
install -m 644 %{SOURCE1} %{buildroot}%{_datadir}/pixmaps install -m 644 %{SOURCE1} %{buildroot}%{_datadir}/pixmaps
rm -f %{buildroot}%{_bindir}/gamma4scanimage rm -f %{buildroot}%{_bindir}/gamma4scanimage
@ -239,11 +251,15 @@ popd
install -m 644 %{SOURCE4} %{buildroot}%{_maindocdir} install -m 644 %{SOURCE4} %{buildroot}%{_maindocdir}
%if %{with systemd}
install -m 755 -d %{buildroot}%{_unitdir} install -m 755 -d %{buildroot}%{_unitdir}
install -m 644 %{SOURCE2} %{buildroot}%{_unitdir} install -m 644 %{SOURCE2} %{buildroot}%{_unitdir}
sed 's|@CONFIGDIR@|%{_sysconfdir}/sane.d|g' < %{SOURCE3} > saned@.service sed 's|@CONFIGDIR@|%{_sysconfdir}/sane.d|g' < %{SOURCE3} > saned@.service
install -m 644 saned@.service %{buildroot}%{_unitdir} install -m 644 saned@.service %{buildroot}%{_unitdir}
install -p -D -m 0644 %{SOURCE6} %{buildroot}%{_sysusersdir}/sane-backends.conf
%endif
%ifarch armv7hl %ifarch armv7hl
rm -f %{buildroot}%{_libdir}/sane/libsane-qcam.so rm -f %{buildroot}%{_libdir}/sane/libsane-qcam.so
%endif %endif
@ -292,6 +308,7 @@ udevadm hwdb --update >/dev/null 2>&1 || :
%ldconfig_scriptlets libs %ldconfig_scriptlets libs
%if %{with systemd}
%pre daemon %pre daemon
%sysusers_create_compat %{SOURCE6} %sysusers_create_compat %{SOURCE6}
@ -303,6 +320,7 @@ udevadm hwdb --update >/dev/null 2>&1 || :
%postun daemon %postun daemon
%systemd_postun_with_restart saned.socket %systemd_postun_with_restart saned.socket
%endif
%files -f %{name}.lang -f config_list %files -f %{name}.lang -f config_list
%dir %{_maindocdir} %dir %{_maindocdir}
@ -384,12 +402,17 @@ udevadm hwdb --update >/dev/null 2>&1 || :
%{_sbindir}/saned %{_sbindir}/saned
%{_mandir}/man8/saned* %{_mandir}/man8/saned*
%config(noreplace) %{_sysconfdir}/sane.d/saned.conf %config(noreplace) %{_sysconfdir}/sane.d/saned.conf
%{_sysusersdir}/sane-backends.conf
%{_udevrulesdir}/66-saned.rules %{_udevrulesdir}/66-saned.rules
%if %{with systemd}
%{_sysusersdir}/sane-backends.conf
%{_unitdir}/saned.socket %{_unitdir}/saned.socket
%{_unitdir}/saned@.service %{_unitdir}/saned@.service
%endif
%changelog %changelog
* Thu Feb 23 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1.2.1-3
- add bcond for systemd - used in flatpak
* Tue Feb 21 2023 DJ Delorie <dj@redhat.com> - 1.2.1-2 * Tue Feb 21 2023 DJ Delorie <dj@redhat.com> - 1.2.1-2
- Fix C99 compatibility issue - Fix C99 compatibility issue