File djvulibre.spec of Package djvulibre

#
# spec file for package djvulibre (Version 3.5.23)
#
# Copyright (c) 2010 SUSE LINUX Products 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 http://bugs.opensuse.org/
#

# norootforbuild


Name:           djvulibre
BuildRequires:  fdupes libdrm-devel libjpeg-devel libtiff-devel qt3-devel qt3-devel-tools update-desktop-files xorg-x11-devel
License:        GPLv2+
Group:          Productivity/Graphics/Other
AutoReqProv:    on
Version:        3.5.23
Release:        1
Url:            http://djvu.sourceforge.net
Summary:        An Open Source Implementation of DjVu
Source:         %{name}-%{version}.tar.bz2
Patch1:         %{name}-%{version}-nsdejavu.patch
Patch2:         %{name}-%{version}-filepath.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
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.



Authors:
--------
    Dr Bill C Riemers <docbill@users.sourceforge.net>
    Leon Bottou <leonb@users.sourceforge.net>
    Yann LeCun <profshadoko@users.sourceforge.net>

%package djview3
License:        GPLv2+
Summary:        DjView3 is a portable DjVu Qt3 based viewer and browser plugin
Group:          Productivity/Graphics/Other
Requires:       djvulibre = %{version}
Conflicts:      djvulibre-djview4

%description djview3
DjView3 is a viewer and browser plugin for DjVu documents, based on the
DjVuLibre-3.5 library and the Qt3 toolkit.



Authors:
--------
    Dr Bill C Riemers <docbill@users.sourceforge.net>
    Leon Bottou <leonb@users.sourceforge.net>
    Yann LeCun <profshadoko@users.sourceforge.net>

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

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



Authors:
--------
    Dr Bill C Riemers <docbill@users.sourceforge.net>
    Leon Bottou <leonb@users.sourceforge.net>
    Yann LeCun <profshadoko@users.sourceforge.net>

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

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



Authors:
--------
    Dr Bill C Riemers <docbill@users.sourceforge.net>
    Leon Bottou <leonb@users.sourceforge.net>
    Yann LeCun <profshadoko@users.sourceforge.net>

%package doc
License:        GPLv2+
Summary:        Documentation for the the DjVu - djvulibre
Group:          Productivity/Graphics/Other
AutoReqProv:    on

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



Authors:
--------
    Dr Bill C Riemers <docbill@users.sourceforge.net>
    Leon Bottou <leonb@users.sourceforge.net>
    Yann LeCun <profshadoko@users.sourceforge.net>

%prep
%setup
%patch1
%patch2
# removing cvsignore files in version 3.5.19
rm -rf doc/minilisp/.cvsignore

%build
# specifying --x-libraries and -includes is needed due to new paths in X.org 7.x
# delete them if builds against X.org 6.9 or lower
CFLAGS="$RPM_OPT_FLAGS -I$QTDIR/include -Wall" \
CXXFLAGS="$RPM_OPT_FLAGS -I$QTDIR/include -Wall -fmessage-length=0 -fno-strict-aliasing" \
QT_LIBS="-L/usr/%_lib/qt3/%{_lib} -lqt-mt" \
	./configure \
	--prefix=%{_prefix} \
	--libdir=%{_libdir} \
	--mandir=%{_mandir} \
	--x-includes=/usr/include/ \
	--x-libraries=/usr/%{_lib}/ \
	--with-qt=/usr/%_lib/qt3 \
        --enable-djview
make OPTS="$RPM_OPT_FLAGS -Wall -fmessage-length=0 -DNO_DEBUG" 
#%{?jobs:-j%jobs}

%install
make install DESTDIR=$RPM_BUILD_ROOT
# 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
install -m 644 desktopfiles/hi32-djview3.png $RPM_BUILD_ROOT/usr/share/pixmaps/djvulibre-djview3.png
#fix wrong permissions
%__chmod 644 desktopfiles/djvulibre-djview3.desktop
#delete shebank from desktop file
%__sed -i '/#!\/usr\/bin\/env xdg-open/d' desktopfiles/djvulibre-djview3.desktop
%suse_update_desktop_file -r -i djvulibre-djview3 Graphics Viewer
%fdupes $RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%post  -n libdjvulibre21
# LIBS: Run ldconfig
/sbin/ldconfig

%postun -n libdjvulibre21
# LIBS: Run ldconfig
/sbin/ldconfig
exit 0

%files
%defattr(-,root,root)
%doc COPYING COPYRIGHT INSTALL NEWS README TODO
%doc %{_mandir}/man1/*
%doc %{_mandir}/ja/*
%{_datadir}/djvu
%{_bindir}/*
%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
%{_prefix}/share/icons/hicolor/22x22/mimetypes/djvu.png
%{_prefix}/share/icons/hicolor/32x32/mimetypes/djvu.png
%{_prefix}/share/icons/hicolor/48x48/mimetypes/djvu.png
# these go to djview3 subpackage
%exclude %{_prefix}/share/pixmaps/djvulibre-djview3.png
%exclude %{_libdir}/browser-plugins/nsdejavu.so
%exclude %{_datadir}/djvu/djview3
%exclude %{_bindir}/djview*
%exclude %doc %{_mandir}/man1/djview*
%exclude %doc %{_mandir}/ja/man1/djview*
%exclude %doc %{_mandir}/man1/nsdejavu*
%exclude %doc %{_mandir}/ja/man1/nsdejavu*

%files djview3
%defattr(-,root,root)
%doc %{_mandir}/man1/djview*
%doc %{_mandir}/ja/man1/djview*
%doc %{_mandir}/man1/nsdejavu*
%doc %{_mandir}/ja/man1/nsdejav*
%{_prefix}/share/pixmaps/djvulibre-djview3.png
%{_libdir}/browser-plugins/nsdejavu.so
%{_bindir}/djview*
%{_prefix}/share/applications/djvulibre-djview3.desktop

%files -n libdjvulibre21
%defattr(-,root,root)
%{_libdir}/libdjvulibre*
%exclude %{_libdir}/libdjvulibre.so
%exclude %{_libdir}/libdjvulibre.la

%files -n libdjvulibre-devel
%defattr(-,root,root)
%{_libdir}/libdjvulibre.so
%{_libdir}/libdjvulibre.la
%dir %{_prefix}/include/libdjvu
%{_prefix}/include/libdjvu/*.h
%{_libdir}/pkgconfig/ddjvuapi.pc

%files doc
%defattr(-,root,root,-)
%doc doc/*

%changelog