Summary:        PDF document editor
Summary(ja):    PDF ドキュメントエディタ

Name:           pdfedit
Version:        0.4.3
Release:        1%{?_dist_release}

Group:          Applications/Publishing
License:        GPLv2
URL:            http://sourceforge.net/projects/pdfedit/
Source0:        http://downloads.sourceforge.net/pdfedit/%{name}-%{version}.tar.bz2
Source1:        pdfedit.desktop
Patch0:         pdfedit-destdir.patch
Patch1:         pdfedit-fix-includes.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:  libboost-devel, openMotif-devel, libpaper-devel
BuildRequires:  libXpm-devel, t1lib-devel
BuildRequires:  desktop-file-utils, doxygen
BuildRequires:  qt-devel

Distribution:     Vine Linux
Vendor:           Project Vine
Packager:         daisuke

%description
Free pdf editing using PdfEdit. Complete editing of pdf documents is made
possible with PDFedit. You can change either raw pdf objects (for advanced
users) or use predefined gui functions. Functions can be easily added as
everything is based on a script.

%description -l ja
pdfedit はフリーなPDF編集ツールです。生のPDFオブジェクトを編集することや
あらかじめ定義されたGUI機能を使うこともできます。

%prep
%setup -q

%patch0 -p1 -b .destdir
%patch1 -p1 -b .fix-includes

# fix paths to be relative to rpm build root
sed -i 's/\(.path\s\+= \)/\1$(QMAKE_DESTDIR)\//' src/gui/pdfedit.pro

%build
export QMAKESPEC=linux-g++
# currently boost-iostreams causes an error when running configure
%configure --without-boost-iostreams
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
# DESTDIR is reserved in qmake
make install QMAKE_DESTDIR=$RPM_BUILD_ROOT

# use rpm standard /usr/share/doc/%{name}-%{version} directory for doc files
mv $RPM_BUILD_ROOT/usr/share/doc/pdfedit \
  $RPM_BUILD_ROOT/usr/share/doc/pdfedit-%{version}

# install desktop file
desktop-file-install --vendor="fedora"             \
  --dir=${RPM_BUILD_ROOT}%{_datadir}/applications  \
  %{SOURCE1}

# install icons
install -d \
  $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/{16x16,32x32,48x48,64x64}/apps
install -p -m 0644 src/gui/icon/pdfedit_icon_16.png \
  $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/16x16/apps/pdfedit.png
install -p -m 0644 src/gui/icon/pdfedit_icon_32.png \
  $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/32x32/apps/pdfedit.png
install -p -m 0644 src/gui/icon/pdfedit_icon_48.png \
  $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/48x48/apps/pdfedit.png
install -p -m 0644 src/gui/icon/pdfedit_icon_64.png \
  $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/64x64/apps/pdfedit.png


%clean
rm -rf $RPM_BUILD_ROOT

%post
update-desktop-database &> /dev/null ||:
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%postun
update-desktop-database &> /dev/null ||:
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
  %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi


%files
%defattr(-,root,root,-)
%{_bindir}/*
%{_mandir}/man1/*
%{_datadir}/%{name}
%{_datadir}/applications/*desktop
%{_datadir}/icons/hicolor/*/apps/pdfedit.png
%{_docdir}

%changelog
* Mon Aug 31 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.4.3-1
- new upstream release
- update BR:
- add %%post/%%postun scripts
- import patches from fedora

* Wed Feb 21 2007 Susumu Tanimura <stanimura-ngs@umin.ac.jp>
- Initial package for VineLinux 4.0

