Summary: DjVu viewer
Summary(ja): DjVu 画像形式ファイルのビュアー
Name: djview
Version: 4.7
Release: 2%{?_dist_release}
License: GPL
Group: Applications/Publishing
URL: http://djvu.sourceforge.net/djview4.html
Source: http://downloads.sourceforge.net/djvu/%{name}-%{version}.tar.gz
BuildRequires: qt4-devel >= 4.2
BuildRequires: djvulibre-devel >= 3.5.19
BuildRequires: desktop-file-utils
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Distribution: Project Vine
Vendor: Vine Linux
Packager: owa

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

%package plugin
Summary: The plug-in files needed for firefox.
Group: Applications/Internet
Requires: %{name} = %{version}
Obsoletes: djvulibre-plugin <= 3.5.22

%description plugin
Djview plug-in files for firefox.


%prep
%setup -q


%build
%configure QTDIR=`pkg-config --variable=prefix Qt`
make %{?_smp_mflags}


%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} install
mv %{buildroot}/%{_libdir}/netscape %{buildroot}/%{_libdir}/mozilla

# Remove symlinks to djview when there are alternatives
if test -x /usr/sbin/update-alternatives ; then
  test -h %{buildroot}%{_bindir}/djview \
    && rm %{buildroot}%{_bindir}/djview
  test -h %{buildroot}%{_mandir}/man1/djview.1 \
    && rm %{buildroot}%{_mandir}/man1/djview.1
fi

cat > %{name}.desktop <<EOF
[Desktop Entry]
Encoding=UTF-8
Type=Application
Categories=Application;Graphics;
MimeType=image/x-djvu;image/x.djvu;image/vnd.djvu;
Name=DjView
Name[ja]=Djvuビュアー
Exec=%{name} %f
Comment=Standalone Djvu Viewer
Comment[ja]=スタンドアロンでDjvu画像を表示するツールです
Terminal=false
Icon=%{name}
EOF

desktop-file-install --dir=$RPM_BUILD_ROOT%{_datadir}/applications %{name}.desktop
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/64x64/apps
install -m644 ./desktopfiles/hi32-djview4.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
install -m644 ./desktopfiles/hi64-djview4.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/64x64/apps/%{name}.png


%post 
update-desktop-database -q
update-mime-database /usr/share/mime > /dev/null 2>&1 || :
touch %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  /usr/bin/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
fi

%postun
update-desktop-database -q
update-mime-database /usr/share/mime > /dev/null 2>&1 || :
touch %{_datadir}/icons/hicolor
if [ -x /usr/bin/gtk-update-icon-cache ]; then
  /usr/bin/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
fi

%clean
rm -rf %{buildroot}


%files
%defattr(-, root, root)
%doc COPYRIGHT COPYING INSTALL NEWS README*
%{_bindir}
%{_datadir}/djvu/djview4
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/*.png
%{_mandir}

%files plugin
%defattr(-, root, root)
%{_libdir}/mozilla/plugins/nsdejavu.so


%changelog
* Mon May 02 2011 Shu KONNO <owa@bg.wakwak.com> 4.7-2
- install desktop files

* Sun May 01 2011 Shu KONNO <owa@bg.wakwak.com> 4.7-1
- initial build for VineLinux

