File dymo-cups-drivers.spec of Package dymo-cups-drivers

#
# spec file for package dymo-cups-drivers
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2026 Aleksa Sarai <cyphar@cyphar.com>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define v1_version 1.4.0.5
%define v1_archive_version 1.4.0

%define v2_version v2-9f2f15b

Name:           dymo-cups-drivers
Version:        1.5.0
Release:        0
Summary:        DYMO LabelWriter Drivers for CUPS
License:        GPL-2.0-or-later
Group:          Hardware/Printing
URL:            http://www.dymo.com
Source1:        http://download.dymo.com/Software/Linux/dymo-cups-drivers-%{v1_archive_version}.tar.gz#/%{name}-v%{v1_version}.tar.gz
Source2:        %{name}-%{v2_version}.tar.xz
Patch101:       https://aur.archlinux.org/cgit/aur.git/plain/cups-ppd-header.patch?h=dymo-cups-drivers#/v1-0001-cups-ppd-header.patch
Patch102:       https://aur.archlinux.org/cgit/aur.git/plain/cups-2.6-api.patch?h=dymo-cups-drivers#/v1-0002-cups-2.6-api.patch
# FIX-OPENSUSE: There is a missing "#import <time.h>" line in the upstream
#               driver, causing compilation issues.
Patch201:       v2-0001-lm-ctime-header.patch
# FIX-OPENSUSE: When using cupsfilter directly (i.e., dymo-cups-drivers-testing),
#               there is a bug that causes CCupsFilter::LockName_ to be unset
#               if there is destination for the printer configured. This causes
#               an error when trying to use cupsfilter.
Patch202:       v2-0002-LockName-default.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  cups-devel
BuildRequires:  gcc-c++
BuildRequires:  libboost_thread-devel
# Install into this non-root directory (required when norootforbuild is used):
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

# TODO: Get this from pkg-config.
%define cups_datadir /usr/share/cups
%define cups_serverbindir /usr/lib/cups

%description
DYMO LabelWriter and DYMO LabelMANAGER series drivers for CUPS.

%prep
%define v1_builddir %{_builddir}/%{name}-%{v1_version}
%setup -q -T -b 1 -n %{name}-%{v1_version}
%patch -P101 -p1
%patch -P102 -p1
sed -i 's|^cupsmodeldir=.*|cupsmodeldir=${cupsdatadir}/model/manufacturer-PPDs/dymo|g' configure*
[ "%{v1_builddir}" = "$PWD" ]

%define v2_builddir %{_builddir}/%{name}-%{v2_version}
%setup -q -T -b 2 -n %{name}-%{v2_version}
%patch -P201 -p1
%patch -P202 -p1
sed -i 's|^cupsmodeldir=.*|cupsmodeldir=${cupsdatadir}/model/manufacturer-PPDs/dymo|g' configure*
[ "%{v2_builddir}" = "$PWD" ]

%build
pushd "%{v1_builddir}"
autoreconf -fiv && chmod +x %{_configure}
%configure
%make_build || make %{?_smp_mflags}
popd

pushd "%{v2_builddir}"
autoreconf -fiv && chmod +x %{_configure}
%configure
%make_build || make %{?_smp_mflags}
popd

%install
%make_install -C "%{v1_builddir}"
%make_install -C "%{v2_builddir}"

%files
%defattr(-,root,root)
%dir %{cups_serverbindir}
%dir %{cups_serverbindir}/filter
%{cups_serverbindir}/filter/raster2dymolm*
%{cups_serverbindir}/filter/raster2dymolw*
%dir %{cups_datadir}
%dir %{cups_datadir}/model
%dir %{cups_datadir}/model/manufacturer-PPDs
%dir %{cups_datadir}/model/manufacturer-PPDs/dymo
%{cups_datadir}/model/manufacturer-PPDs/dymo/*.ppd

%changelog
openSUSE Build Service is sponsored by