Summary: DjVu viewers, encoders and utilities.
Summary(ja): DjVu 画像形式ファイル操作用ライブラリ、ツール
Name: djvulibre
Version: 3.5.28
Release: 2%{?_dist_release}
Group: graphics
Distribution: Project Vine
Vendor: Vine Linux
Packager: owa

License: GPLv2
URL: http://djvu.sourceforge.net
Source0: http://prdownloads.sourceforge.net/djvu/djvulibre-%{version}.tar.gz

Patch1000: 0001-Reviewed-Fedora-patches-and-adopted-some-of-them-or-.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: libtiff-devel
BuildRequires: libjpeg-devel
BuildRequires: glibc-devel
BuildRequires: inkscape
BuildRequires: xdg-utils chrpath
BuildRequires: hicolor-icon-theme

Requires(post): xdg-utils
Requires(preun): xdg-utils

%description 
DjVu is a web-centric format and software platform for distributing documents
and images.  DjVu content downloads faster, displays and renders faster, looks
nicer on a screen, and consume less client resources than competing formats.
DjVu was originally developed at AT&T Labs-Research by Leon Bottou, Yann
LeCun, Patrick Haffner, and many others.  In March 2000, AT&T sold DjVu to
LizardTech Inc. who now distributes Windows/Mac plug-ins, and commercial
encoders (mostly on Windows)

In an effort to promote DjVu as a Web standard, the LizardTech management was
enlightened enough to release the reference implementation of DjVu under the
GNU GPL in October 2000.  DjVuLibre (which means free DjVu), is an enhanced
version of that code maintained by the original inventors of DjVu. It is
compatible with version 3.5 of the LizardTech DjVu software suite.

DjVulibre-3.5 contains:
- a standalone DjVu viewer based on the Qt library. 
- A browser plugin that works with most Unix browsers.
- A full-fledged wavelet-based compressor for pictures. 
- A simple compressor for bitonal (black and white) scanned pages. 
- A compressor for palettized images (a la GIF/PNG). 
- A set of utilities to manipulate and assemble DjVu images and documents. 
- A set of decoders to convert DjVu to a number of other formats. 
- An up-to-date version of the C++ DjVu Reference Library.


%package libs
Summary: Library files for DjVuLibre
Group: programming

%description libs
Library files for DjVuLibre.


%package devel
Summary: The libraries and header files needed for djvulibre development.
Group: programming
Requires: %{name}-libs = %{version}-%{release}

%description devel
DjVulibre libraries and header files for development.


%debug_package


%prep
%setup -q -n %{name}-%{version}
%autopatch -p1


%build
%configure --enable-threads
make %{?_smp_mflags} V=1


%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} install

# fix to stop ldconfig from complaining
find %{buildroot}%{_libdir} -name "*.so*" -exec chmod 755 {} \;

# Remove rpath
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/djvutoxml
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/djvused
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/cjb2
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/csepdjvu
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/djvuserve
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/djvm
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/djvuxmlparser
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/djvutxt
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/ddjvu
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/djvumake
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/cpaldjvu
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/djvuextract
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/c44
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/djvups
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/djvudump
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/djvmcvt
chrpath --delete $RPM_BUILD_ROOT%{_bindir}/bzz

# This XML file does not differentiate between DjVu Image and DjVu Document
# MIME types, the default one in shared-mime-info does.
rm -f $RPM_BUILD_ROOT%{_datadir}/mime/packages/djvulibre-mime.xml

# MIME types (icons and desktop file) - this installs icon files under
# /usr/share/icons/hicolor/ and an xml file under /usr/share/mime/image/
# Taken from {_datadir}/djvu/osi/desktop/register-djvu-mime install
# See also the README file in the desktopfiles directory of the source distribution
pushd desktopfiles
for i in 22 32 48 64 ; do
    install -d $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${i}x${i}/mimetypes/
    cp -a ./prebuilt-hi${i}-djvu.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${i}x${i}/mimetypes/image-vnd.djvu.mime.png
#    cp -a ./hi${i}-djvu.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/${i}x${i}/mimetypes/gnome-mime-image-vnd.djvu.png
done
popd


%clean
rm -rf %{buildroot}


%files
%defattr(-, root, root)
%license COPYRIGHT COPYING
%doc README NEWS
%{_bindir}/*
%exclude %{_datadir}/djvu/osi/de/*
%exclude %{_datadir}/djvu/osi/fr/*
%exclude %{_datadir}/djvu/osi/zh/*
%dir %{_datadir}/djvu
%{_datadir}/djvu/pubtext
%dir %{_datadir}/djvu/osi
%{_datadir}/djvu/osi/languages.xml
%{_datadir}/djvu/osi/en
%{_datadir}/djvu/osi/cs
%lang(ja) %{_datadir}/djvu/osi/ja*
%{_datadir}/icons/hicolor/*/mimetypes/*
%{_mandir}/man?

%files libs
%license COPYRIGHT COPYING
%doc README NEWS
%{_libdir}/*.so.*

%files devel
%defattr(-, root, root)
%doc doc
%{_includedir}/libdjvu
%{_libdir}/lib*.so
%exclude %{_libdir}/*.la
%{_libdir}/pkgconfig/ddjvuapi.pc


%changelog
* Tue Jun 29 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.5.28-2
- import Patch1000 from upstream to fix CVE-2021-{3500,32490,32491,32492,32493}.
- dropped Patch0 and 6: Patch1000 includes them.
- dropped ldconfig scriptlets.

* Wed Mar 03 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.5.28-1
- new upstream release.
- added a subpackage: djvulibre-libs.
- dropped Patch2-5 and 7: fixed in upstream.

* Tue Aug 04 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.5.27-1
- new upstream release.

* Fri Jul  1 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.5.25.3-3
- rebuilt with new toolchain.

* Thu Feb 26 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.5.25.3-2
- rebuilt on current VineSeed
- moved %{_libdir}/lib*.so to devel subpackage

* Sun Jul 07 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.5.25.3-1
- update to 3.5.25.3
- remove BuildRequires: qt-devel
- add BuildRequires: inkscape

* Sun May 01 2011 Shu KONNO <owa@bg.wakwak.com> 3.5.24-1
- updated djvulibre to 3.5.24
- obsoletes djvulibre-plugin (new is djview-plugin)

* Sat Apr 30 2011 Shu KONNO <owa@bg.wakwak.com> 3.5.22-4
- installed djview3.png

* Sun Sep 26 2010 Shu KONNO <owa@bg.wakwak.com> 3.5.22-3
- rebuilt with rpm-4.8.1 for pkg-config

* Wed Jul 01 2009 Shu KONNO <owa@bg.wakwak.com> 3.5.22-2
- rebuilt with new toolchain

* Wed Jul 01 2009 Shu KONNO <owa@bg.wakwak.com> 3.5.22-1
- updated djvulibre to 3.5.22

* Tue Dec 30 2008 Shu KONNO <owa@bg.wakwak.com> 3.5.21-1
- initial build for VineSeed
- spec in utf-8, and applied vine versioning policy
- updated djvulibre to 3.5.21
- added CXXFLAG="-march=i686" if i386
- added djview desktop file

* Tue Apr 03 2007 Shu KONNO <owa@bg.wakwak.com> 3.5.19-uvl1
- updated djvulibre to 3.5.19
- added scripts to alternative djview at %%post, %%preun

* Thu Dec 01 2005 Shu KONNO <owa@bg.wakwak.com> 3.5.16-uvl1
- updated djvulibre to 3.5.16
- changed suffix
- divided into djvulibre, djvulibre-devel, djvulibre-plugin

* Tue Nov 09 2004 Shu KONNO <owa@bg.wakwak.com> 3.5.14-uvl2
- updated djvulibre to 3.5.14 (realese 2)

* Thu Jun 17 2004 Leon Bottou <leon@bottou.org> 3.5.13-4
- changed runtime generation of file list.
* Mon May 31 2004 Leon Bottou <leon@bottou.org> 3.5.13-3
- removed 'make install-desktop-files'
* Wed May  5 2004 Leon Bottou <leon@bottou.org> 3.5.13-2
* Fri Apr  9 2004 Leon Bottou <leon@bottou.org> 3.5.13-1
- added runtime generation of file list.
- using DESTDIR instead of %makeinstall.
- added 'make install-desktop-files'
* Wed Nov  5 2003 Leon Bottou <leon@bottou.org> 3.5.12-3
- added support for i18n
- renamed symlink in mozilla plugin dirs.
* Mon Jul  7 2003 Leon Bottou <leon@bottou.org> 3.5.12-1
* Thu Apr 24 2003 Leon Bottou <leon@bottou.org> 3.5.11-1
* Thu Feb  6 2003 Leon Bottou <leon@bottou.org> 3.5.10-2
* Fri Jan 24 2003 Leon Bottou <leon@bottou.org> 3.5.10-1
* Wed Oct  9 2002 Leon Bottou <leonb@users.sourceforge.net> 3.5.9-2
- fixed logic for uninstalling nsdejavu links.
- learned a few tricks from the freshrpms spec file.
* Sun Oct  6 2002 Leon Bottou <leonb@users.sourceforge.net> 3.5.9-1
- added logic to install nsdejavu for mozilla.
* Wed May 29 2002 Leon Bottou <leonb@users.sourceforge.net> 3.5.6-1
* Mon Apr 1 2002  Leon Bottou <leonb@users.sourceforge.net> 3.5.5-2
- changed group to Applications/Publishing.
* Mon Mar 25 2002 Leon Bottou <leonb@users.sourceforge.net> 3.5.5-2
* Tue Jan 22 2002 Leon Bottou <leonb@users.sourceforge.net> 3.5.4-2
- added macros to locate man directory.
* Wed Jan 16 2002 Leon Bottou <leonb@users.sourceforge.net> 3.5.3-1
* Fri Dec  7 2001 Leon Bottou <leonb@users.sourceforge.net> 3.5.2-1
* Wed Dec  5 2001 Leon Bottou <leonb@users.sourceforge.net> 3.5.1-1
- created initial file.

