diff --git a/.gitignore b/.gitignore index acabdea..da82652 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /lprint-1.0.tar.gz +/lprint-1.1.0.tar.gz diff --git a/0001-configure-Add-with-systemd-option.patch b/0001-configure-Add-with-systemd-option.patch new file mode 100644 index 0000000..fdae526 --- /dev/null +++ b/0001-configure-Add-with-systemd-option.patch @@ -0,0 +1,202 @@ +From ba5a66731b9b532a601ad5b3d7dd6b941d1d1917 Mon Sep 17 00:00:00 2001 +From: Zdenek Dohnal +Date: Wed, 12 Jan 2022 09:15:14 +0100 +Subject: [PATCH] configure: Add --with-systemd option + +The option enables disabling installation of systemd unit file +or setting a different path for systemd unit file. +--- + Makefile.in | 9 ++++---- + configure | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + configure.ac | 38 +++++++++++++++++++++++++++++++ + 3 files changed, 107 insertions(+), 4 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index 4161124..4cf40d7 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -56,6 +56,7 @@ sharedstatedir = @sharedstatedir@ + srcdir = @srcdir@ + sysconfdir = @sysconfdir@ + top_srcdir = @top_srcdir@ ++unitdir = @unitdir@ + + BUILDROOT = $(DSTROOT)$(RPM_BUILD_ROOT)$(DESTDIR) + +@@ -130,10 +131,10 @@ install: all + echo "Installing launchd service to $(BUILDROOT)/Library/LaunchDaemons..."; \ + $(INSTALL) -d -m 755 $(BUILDROOT)/Library/LaunchDaemons; \ + $(INSTALL) -c -m 644 org.msweet.lprint.plist $(BUILDROOT)/Library/LaunchDaemons; \ +- else \ +- echo "Installing systemd service to $(BUILDROOT)$(sysconfdir)/systemd/system..."; \ +- $(INSTALL) -d -m 755 $(BUILDROOT)$(sysconfdir)/systemd/system; \ +- $(INSTALL) -c -m 644 lprint.service $(BUILDROOT)$(sysconfdir)/systemd/system; \ ++ elif test x$unitdir != x; then \ ++ echo "Installing systemd service to $(BUILDROOT)$(unitdir)..."; \ ++ $(INSTALL) -d -m 755 $(BUILDROOT)$(unitdir); \ ++ $(INSTALL) -c -m 644 lprint.service $(BUILDROOT)$(unitdir); \ + fi + + +diff --git a/configure b/configure +index 249946c..7c5b496 100755 +--- a/configure ++++ b/configure +@@ -619,6 +619,7 @@ ac_subst_vars='LTLIBOBJS + LIBOBJS + OPTIM + CSFLAGS ++unitdir + CUPSCONFIG + PKGCONFIG + INSTALL +@@ -688,6 +689,7 @@ enable_option_checking + enable_debug + enable_maintainer + enable_sanitizer ++with_systemd + with_ldflags + ' + ac_precious_vars='build_alias +@@ -1327,6 +1329,7 @@ Optional Features: + Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) ++ --with-systemd=PATH install systemd service file, default=yes + --with-ldflags=... Specify additional LDFLAGS + + Some influential environment variables: +@@ -2349,6 +2352,14 @@ LDFLAGS="${LDFLAGS:=}" + LIBS="${LIBS:=}" + + ++if test $prefix = NONE ++then : ++ ++ prefix=$ac_default_prefix ++ ++fi ++ ++ + + + +@@ -3874,6 +3885,59 @@ then : + fi + + ++ ++ ++# Check whether --with-systemd was given. ++if test ${with_systemd+y} ++then : ++ withval=$with_systemd; ++ case $withval in #( ++ yes) : ++ ++ with_systemd=yes ++ unitdir=${prefix}/lib/systemd/system ++ ;; #( ++ no) : ++ ++ with_systemd=no ++ ;; #( ++ *) : ++ ++ with_systemd=yes ++ unitdir=$withval ++ ;; ++esac ++ ++else $as_nop ++ ++ with_systemd=yes ++ unitdir=${prefix}/lib/systemd/system ++ ++fi ++ ++ ++ ++if test `uname` != "Darwin" && test x$with_systemd = xyes ++then : ++ ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for systemd unit directory" >&5 ++printf %s "checking for systemd unit directory... " >&6; } ++ if test x$unitdir != x ++then : ++ ++ ++ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $unitdir" >&5 ++printf "%s\n" "$unitdir" >&6; } ++ ++else $as_nop ++ ++ as_fn_error $? "Path to the unit dir is empty." "$LINENO" 5 ++ ++fi ++ ++fi ++ ++ + if test x$enable_debug = xyes + then : + +diff --git a/configure.ac b/configure.ac +index cfb4090..9421478 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -54,6 +54,12 @@ LDFLAGS="${LDFLAGS:=}" + LIBS="${LIBS:=}" + + ++dnl Figure out prefix - needed for systemd unit dir ++AS_IF([test $prefix = NONE], [ ++ prefix=$ac_default_prefix ++], []) ++ ++ + dnl Standard programs... + AC_PROG_CC + AC_PROG_RANLIB +@@ -110,6 +116,38 @@ AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [turn on debugging, defa + AC_ARG_ENABLE([maintainer], AS_HELP_STRING([--enable-maintainer], [turn on maintainer mode, default=no])) + AC_ARG_ENABLE([sanitizer], AS_HELP_STRING([--enable-sanitizer], [build with AddressSanitizer, default=no])) + ++ ++AC_ARG_WITH([systemd], AS_HELP_STRING([--with-systemd[=PATH]], [install systemd service file, default=yes]), ++[ ++ AS_CASE([$withval], [yes], [ ++ with_systemd=yes ++ unitdir=${prefix}/lib/systemd/system ++ ], [no], [ ++ with_systemd=no ++ ], [ ++ with_systemd=yes ++ unitdir=$withval ++ ]) ++], [ ++ with_systemd=yes ++ unitdir=${prefix}/lib/systemd/system ++]) ++ ++ ++dnl Substitute unitdir macro if we aren't on Darwin and want systemd... ++AS_IF([test `uname` != "Darwin" && test x$with_systemd = xyes], [ ++ AC_MSG_CHECKING([for systemd unit directory]) ++ AS_IF([test x$unitdir != x], [ ++ AC_SUBST([unitdir]) ++ AC_MSG_RESULT([$unitdir]) ++ ], ++ [ ++ AC_MSG_ERROR([Path to the unit dir is empty.]) ++ ]) ++], ++[]) ++ ++ + AS_IF([test x$enable_debug = xyes], [ + OPTIM="-g" + CSFLAGS="" +-- +2.34.1 + diff --git a/lprint.spec b/lprint.spec index f25c26d..c8dd1b4 100644 --- a/lprint.spec +++ b/lprint.spec @@ -2,14 +2,22 @@ %global _hardened_build 1 Name: lprint -Version: 1.0 -Release: 4%{?dist} +Version: 1.1.0 +Release: 1%{?dist} Summary: A Label Printer Application License: ASL 2.0 URL: https://www.msweet.org/lprint Source0: https://github.com/michaelrsweet/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz + +# UPSTREAM PATCHES +# lprint puts service file into /etc/systemd/system instead of /usr/lib/systemd/system +# - /etc is for admin overrides, distro defaults must be in /usr/lib +# https://github.com/michaelrsweet/lprint/pull/50 +Patch01: 0001-configure-Add-with-systemd-option.patch + + # dns-sd support for register/sharing devices BuildRequires: pkgconfig(avahi-client) >= 0.7 # uses CUPS API for arrays, options, rastering, HTTP, IPP support @@ -24,9 +32,15 @@ BuildRequires: pkgconfig(libpng) >= 1.6.0 BuildRequires: pkgconfig(libusb-1.0) >= 1.0 # uses Makefile BuildRequires: make +# the basic printer application related structures are now implemented in PAPPL +BuildRequires: pkgconfig(pappl) >= 1.1 # using pkg-config in configure script BuildRequires: pkgconf-pkg-config +# for macros in rpm scriptlets +BuildRequires: systemd-rpm-macros +# lprint server now can run as a systemd service +Requires: systemd %description LPrint is a label printer application for macOS and Linux. Basically, @@ -47,11 +61,7 @@ export CC=%{__cc} # get system default CFLAGS and LDFLAGS %set_build_flags -# enable libpng, PAM and libusb support and use avahi for DNS-SD -%configure --enable-libpng \ - --enable-libusb \ - --with-dnssd=avahi \ - --enable-pam +%configure %make_build @@ -59,8 +69,17 @@ export CC=%{__cc} %install %make_install DESTDIR='' +%post +%systemd_post lprint.service + +%preun +%systemd_preun lprint.service + +%postun +%systemd_postun_with_restart lprint.service + %files -%doc README.md DOCUMENTATION.md DESIGN.md CONTRIBUTING.md CHANGES.md +%doc README.md DOCUMENTATION.md CONTRIBUTING.md CHANGES.md %license LICENSE NOTICE %{_bindir}/lprint %{_mandir}/man1/lprint-add.1* @@ -78,9 +97,13 @@ export CC=%{__cc} %{_mandir}/man1/lprint-submit.1* %{_mandir}/man1/lprint.1* %{_mandir}/man5/lprint.conf.5* +%{_unitdir}/lprint.service %changelog +* Tue Jan 04 2022 Zdenek Dohnal - 1.1.0-1 +- 2035381 - lprint-1.1.0 is available + * Thu Jul 22 2021 Fedora Release Engineering - 1.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index 4b25113..a4b4ab4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (lprint-1.0.tar.gz) = a9b5e38cab782d17b3e05ca536d8f0cabb2a85e414e6d377b7e0e68acebca94f6e518abc234ec9b101dfc4af3d58dec3afdf19abad7539ce16a6bb4b5256f61c +SHA512 (lprint-1.1.0.tar.gz) = 831914c8a7aadf960381ff459c65849948fafe0a200233af47e3a7691c013c26bdda458d1a8404f46b74e5c9a027814e8f816ac582ef48680ff78202de0d7fb3