From 0ad9add3c7f570cc30ce4f35eb47c9f92f703541 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Feb 23 2023 15:23:37 +0000 Subject: add bcond for systemd - used in flatpak --- diff --git a/sane-backends.spec b/sane-backends.spec index aea1b8c..c28a5ba 100644 --- a/sane-backends.spec +++ b/sane-backends.spec @@ -15,10 +15,16 @@ %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 +%if 0%{?flatpak} +%bcond_with systemd +%else +%bcond_without systemd +%endif + Summary: Scanner access software Name: sane-backends Version: 1.2.1 -Release: 2%{?dist} +Release: 3%{?dist} # lib/ is LGPLv2+, backends are GPLv2+ with exceptions # Tools are GPLv2+, docs are public domain # see LICENSE for details @@ -73,16 +79,20 @@ BuildRequires: libv4l-devel BuildRequires: make # pixma backend generates header files during build via python script BuildRequires: python3 +%if %{with systemd} BuildRequires: systemd-devel BuildRequires: systemd # needed by macros in rpm scriptlets BuildRequires: systemd-rpm-macros +%endif Requires: libpng Requires: sane-airscan Requires: sane-backends-libs%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} +%if %{with systemd} Requires: systemd >= 196 Requires: systemd-udev >= 196 +%endif # 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 @@ -180,7 +190,11 @@ LDFLAGS="-pie" %configure \ --with-gphoto2=%{_prefix} \ --with-docdir=%{_maindocdir} \ +%if %{with systemd} --with-systemd \ +%else + --without-systemd \ +%endif --disable-locking --disable-rpath \ %if %libusb1 --with-usb \ @@ -199,8 +213,6 @@ popd %install %make_install -install -p -D -m 0644 %{SOURCE6} %{buildroot}%{_sysusersdir}/sane-backends.conf - mkdir -p %{buildroot}%{_datadir}/pixmaps install -m 644 %{SOURCE1} %{buildroot}%{_datadir}/pixmaps rm -f %{buildroot}%{_bindir}/gamma4scanimage @@ -239,11 +251,15 @@ popd install -m 644 %{SOURCE4} %{buildroot}%{_maindocdir} +%if %{with systemd} install -m 755 -d %{buildroot}%{_unitdir} install -m 644 %{SOURCE2} %{buildroot}%{_unitdir} sed 's|@CONFIGDIR@|%{_sysconfdir}/sane.d|g' < %{SOURCE3} > saned@.service install -m 644 saned@.service %{buildroot}%{_unitdir} +install -p -D -m 0644 %{SOURCE6} %{buildroot}%{_sysusersdir}/sane-backends.conf +%endif + %ifarch armv7hl rm -f %{buildroot}%{_libdir}/sane/libsane-qcam.so %endif @@ -292,6 +308,7 @@ udevadm hwdb --update >/dev/null 2>&1 || : %ldconfig_scriptlets libs +%if %{with systemd} %pre daemon %sysusers_create_compat %{SOURCE6} @@ -303,6 +320,7 @@ udevadm hwdb --update >/dev/null 2>&1 || : %postun daemon %systemd_postun_with_restart saned.socket +%endif %files -f %{name}.lang -f config_list %dir %{_maindocdir} @@ -384,12 +402,17 @@ udevadm hwdb --update >/dev/null 2>&1 || : %{_sbindir}/saned %{_mandir}/man8/saned* %config(noreplace) %{_sysconfdir}/sane.d/saned.conf -%{_sysusersdir}/sane-backends.conf %{_udevrulesdir}/66-saned.rules +%if %{with systemd} +%{_sysusersdir}/sane-backends.conf %{_unitdir}/saned.socket %{_unitdir}/saned@.service +%endif %changelog +* Thu Feb 23 2023 Zdenek Dohnal - 1.2.1-3 +- add bcond for systemd - used in flatpak + * Tue Feb 21 2023 DJ Delorie - 1.2.1-2 - Fix C99 compatibility issue