File djvulibre.spec of Package djvulibre.12413

# spec file for package djvulibre
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# 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

%define asan_build     0

Name:           djvulibre
BuildRequires:  autoconf
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libjpeg-devel
BuildRequires:  libtiff-devel
BuildRequires:  libtool
# pkg-config is required for pkgconfig() provides and requires.
BuildRequires:  pkgconfig
Release:        0
Summary:        An Open Source Implementation of DjVu
License:        GPL-2.0-or-later
Group:          Productivity/Graphics/Other
Source:         %{name}-%{version}.tar.gz
Patch0:         %{name}-filepath.patch
# following reported upstream, should not be needed in future update
Patch1:         %{name}-not-existing-icons.patch
# CVE-2019-15143 [bsc#1146569]
Patch2:         djvulibre-CVE-2019-15143.patch
# CVE-2019-15144 [bsc#1146571]
Patch3:         djvulibre-CVE-2019-15144.patch
# CVE-2019-15145 [bsc#1146572]
Patch4:         djvulibre-CVE-2019-15145.patch
# CVE-2019-15142 [bsc#1146702]
Patch5:         djvulibre-CVE-2019-15142.patch
# do not segfault when libtiff encounters corrupted TIFF (upstream issue #295)
Patch6:         djvulibre-invalid-tiff.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

DjVu is a Web-centric format and software platform for distributing
documents and images. DjVuLibre is an open source (GPL) implementation
of DjVu, including viewers, browser plug-ins, decoders, simple
encoders, and utilities. DjVu can advantageously replace PDF, PS, TIFF,
JPEG, and GIF for distributing scanned documents, digital documents, or
high-resolution pictures. DjVu content downloads faster, displays and
renders faster, looks nicer on a screen, and consumes less client
resources than competing formats. DjVu images display instantly and can
be smoothly zoomed and panned with no lengthy rerendering. DjVu is used
by hundreds of academic, commercial, governmental, and noncommercial
Web sites around the world.

%package -n libdjvulibre21
Summary:        Libraries of Open Source Implementation of DjVu - djvulibre
Group:          Productivity/Graphics/Other

%description -n libdjvulibre21
Libraries of Open Source Implementation of DjVu - djvulibre.

%package -n libdjvulibre-devel
Summary:        Libraries of Open Source Implementation of DjVu - djvulibre
Group:          Development/Libraries/Other
Requires:       libdjvulibre21 = %{version}
Requires:       libjpeg-devel

%description -n libdjvulibre-devel
Libraries of Open Source Implementation of DjVu - djvulibre.

%package doc
Summary:        Documentation for the the DjVu - djvulibre
Group:          Productivity/Graphics/Other

%description doc
This package contains the documentation for the DjVu - djvulibre

%setup -n %{name}-3.5.25
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1

# run autoreconf otherwise @INKSCAPE@ is undefined (not replaced by false);
# try to remove in the next update
autoreconf -fi
	./configure \
	--prefix=%{_prefix} \
	--libdir=%{_libdir} \
%if %{asan_build}
sed -i -e 's/\(^CFLAGS.*\)/\1 -fsanitize=address/' \
       -e 's/\(^CXXFLAGS.*\)/\1 -fsanitize=address/' \
       -e 's/\(^LIBS=.*\)/\1 -lasan/' \
       Makefile */Makefile
make OPTS="$RPM_OPT_FLAGS -DNO_DEBUG" %{?_smp_mflags}

# Installing desktop file and icons in this section is more sane
# then in %%post section as author intended because of SuSE translation 
# process and little less pain with getting those scripts working
mkdir -p $RPM_BUILD_ROOT/usr/share/icons/hicolor/22x22/mimetypes/
mkdir -p $RPM_BUILD_ROOT/usr/share/icons/hicolor/32x32/mimetypes/
mkdir -p $RPM_BUILD_ROOT/usr/share/icons/hicolor/48x48/mimetypes/
mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
install -m 644 desktopfiles/hi22-djvu.png $RPM_BUILD_ROOT/usr/share/icons/hicolor/22x22/mimetypes/djvu.png
install -m 644 desktopfiles/hi32-djvu.png $RPM_BUILD_ROOT/usr/share/icons/hicolor/32x32/mimetypes/djvu.png
install -m 644 desktopfiles/hi48-djvu.png $RPM_BUILD_ROOT/usr/share/icons/hicolor/48x48/mimetypes/djvu.png

%post  -n libdjvulibre21 -p /sbin/ldconfig

%postun -n libdjvulibre21 -p /sbin/ldconfig

%doc %{_mandir}/man1/*
%dir %{_prefix}/share/icons/hicolor
%dir %{_prefix}/share/icons/hicolor/22x22
%dir %{_prefix}/share/icons/hicolor/22x22/mimetypes
%dir %{_prefix}/share/icons/hicolor/32x32
%dir %{_prefix}/share/icons/hicolor/32x32/mimetypes
%dir %{_prefix}/share/icons/hicolor/48x48
%dir %{_prefix}/share/icons/hicolor/48x48/mimetypes

%files -n libdjvulibre21
%exclude %{_libdir}/
%exclude %{_libdir}/

%files -n libdjvulibre-devel
%dir %{_prefix}/include/libdjvu

%files doc
%doc doc/*

openSUSE Build Service is sponsored by