File mingw32-evince.spec of Package mingw32-evince

%define __strip %{_mingw32_strip}
%define __objdump %{_mingw32_objdump}
%define _use_internal_dependency_generator 0
%define __find_requires %{_mingw32_findrequires}
%define __find_provides %{_mingw32_findprovides}
%define __os_install_post %{_mingw32_debug_install_post} \
                          %{_mingw32_install_post}

%define run_autogen 1
%define enable_dvi_backend 1

Name:           mingw32-evince
Version:        2.32.0
Release:        0
Summary:        GNOME Document Viewer

License:        GPL v2 or later
Group:          Development/Libraries
URL:            http://www.gnome.org/projects/evince/
Source0:        ftp://ftp.gnome.org/pub/gnome/sources/evince/2.32/evince-%{version}.tar.bz2
Source1000:     %{name}-rpmlintrc
Patch0:         evince-2.32.0-zlib.patch
Patch100:       0001-comics-Optionally-use-libgsf-for-reading-comics.patch
Patch101:       0001-tiff-Use-TIFFOpenW-on-windows.patch
#Patch102:       0001-tiff-backend-use-cairo-for-printing.patch
Patch102:       cairo-print.patch
Patch103:       0001-libview-close-tmpfile-descriptor-before-copying-to-i.patch
Patch104:       0001-pdf-Update-to-poppler-api-changes.patch
Patch105:       0001-libdocument-Check-for-NULL-in-synctex_backward_searc.patch
Patch106:       0001-backends-Fix-several-security-issues-in-the-dvi-back.patch
Patch107:       0001-backends-Fix-another-security-issue-in-the-dvi-backe.patch
Patch108:       0001-document-create_thumbnail_frame-should-return-NULL-w.patch
Patch109:       0001-Fix-rotated-tiff-documents.patch
Patch110:       evince-2.32.0-metadata.patch
Patch1000:      evince-2.32.0-wix.patch
Patch1001:      evince-2.30.1-command-line.patch
Patch1002:      evince-2.32.0-taskbar.patch
Patch1003:      evince-2.32.0-extensions.patch
Patch1004:      evince-2.30.3-helphack.patch
Patch1005:      evince-2.32.0-README.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch:      noarch
#!BuildIgnore: post-build-checks  

BuildRequires:  mingw32-filesystem >= 25
BuildRequires:  mingw32-cross-gcc
BuildRequires:  mingw32-cross-gcc-c++
BuildRequires:  mingw32-cross-gcc-wixlibs
BuildRequires:  mingw32-cross-binutils
BuildRequires:  mingw32-cross-pkg-config
BuildRequires:  mingw32-glib2-devel
BuildRequires:  mingw32-gtk2-devel
BuildRequires:  mingw32-libexpat-devel
BuildRequires:  mingw32-libxml2-devel
BuildRequires:  mingw32-libgs-devel
BuildRequires:  mingw32-libpoppler-glib-devel
BuildRequires:  mingw32-libpoppler-devel
BuildRequires:  mingw32-cairo-devel
BuildRequires:  mingw32-liblcms-devel
BuildRequires:  mingw32-libjasper-devel
BuildRequires:  mingw32-libjpeg-devel
BuildRequires:  mingw32-libtiff-devel
BuildRequires:  mingw32-libpng-devel
BuildRequires:  mingw32-libdjvulibre-devel
BuildRequires:  mingw32-pango-devel
BuildRequires:  mingw32-zlib-devel
BuildRequires:  mingw32-libspectre-devel
BuildRequires:  mingw32-libgsf-devel
%if %{enable_dvi_backend}
BuildRequires:  mingw32-texlive-devel
%endif
%if %{run_autogen}
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  gnome-doc-utils-devel
BuildRequires:  gnome-common
BuildRequires:  gconf2-devel
%endif
BuildRequires:  intltool
BuildRequires:  gtk-doc
BuildRequires:  glib2-devel
%glib2_gsettings_schema_requires
BuildRequires:  mingw32-gettext-tools
BuildRequires:  mingw32-freetype-devel
BuildRequires:  mingw32-fontconfig-devel
BuildRequires:  mingw32-atk-devel
BuildRequires:  mingw32-hicolor-icon-theme-devel
BuildRequires:  mingw32-poppler-data-devel
BuildRequires:  wixwine uuid-runtime

Requires:       %{name}-lang

%description
Evince is a document viewer capable of displaying multiple and
singlepage document formats like PDF and PostScript. For more
information about Evince, visit the project Web site at
http://www.gnome.org/projects/evince/.


%package devel
Summary:        GPL v2 or later
Group:          Development/Libraries


%description devel
Evince is a document viewer capable of displaying multiple and
singlepage document formats like PDF and PostScript. For more
information about Evince, visit the project Web site at
http://www.gnome.org/projects/evince/.

%package msi
Summary:        Evince Windows Installer
Group:          Development/Libraries 

%description msi
Evince is a document viewer capable of displaying multiple and
singlepage document formats like PDF and PostScript. For more
information about Evince, visit the project Web site at
http://www.gnome.org/projects/evince/.


%{_mingw32_debug_package}

%lang_package 

%prep
%setup -q -n evince-%{version}
%patch0 -p1 -b .zlib

%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1

%patch1000 -p1 -b .wix
%patch1001 -p1 -b .commandline
%patch1002 -p1 -b .taskbar
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1


%build
# Each GNOME distributed installer is build in separate 
# GNOME:Apps:Evince:Windows subproject. This subproject should be 
# named "$VERSION.$DIST", where $VERSION is the Evince version, 
# e.g. 2.32.0 and $DIST is a unique increasing distribution number.
# The distribution number is added to the version number.
regex='GNOME:Apps:Evince:Windows:[0-9]*\.[0-9]*\.[0-9]*\.\([0-9]*\).*$'
if [[ $(echo '%{distribution}' | grep $regex) ]]; then
   n=$(echo '%{distribution}' | sed "s/$regex/\1/g")
   sed -i -e "s#m4_define(\[ev_extra_version\],\[\])#m4_define(\[ev_extra_version\],\[.$n\])#g" configure.ac
   msi=evince-%{version}.$n.msi
else
   msi=evince-%{version}.msi
fi

%if %{run_autogen}
NOCONFIGURE=1 AUTOMAKE=`which automake` ./autogen.sh
%endif

echo "lt_cv_deplibs_check_method='pass_all'" >>%{_mingw32_cache}
%{_mingw32_configure} \
	--enable-shared --disable-static

%{_mingw32_make} %{?_smp_mflags} || %{_mingw32_make}

mkdir -p ./msi
cd msi
cp ../evince.msi $msi
md5sum $msi > $msi.md5sum
echo "
The $msi installer was build on the Open Build Service,
%{distribution} distribution, 
with the following packages installed:
" > $msi.SOURCES
rpm -qa >> $msi.SOURCES
echo "

" >> $msi.SOURCES
cat ../README.Windows >> $msi.SOURCES

%install
rm -rf $RPM_BUILD_ROOT

%{_mingw32_make} DESTDIR=$RPM_BUILD_ROOT install

rm -f $RPM_BUILD_ROOT%{_mingw32_libdir}/evince/3/backends/*.dll.a
rm -f $RPM_BUILD_ROOT%{_mingw32_datadir}/applications/evince.desktop

%find_lang evince

cp -r msi $RPM_BUILD_ROOT%{_mingw32_datadir}

%clean
rm -rf $RPM_BUILD_ROOT

%post
%{_bindir}/glib-compile-schemas %{_mingw32_datadir}/glib-2.0/schemas

%postun
if [ $1 -eq 0 ]; then
  %{_bindir}/glib-compile-schemas %{_mingw32_datadir}/glib-2.0/schemas
fi

%files
%defattr(-,root,root)
%{_mingw32_bindir}/evince.exe
%{_mingw32_bindir}/evince-previewer.exe
%{_mingw32_bindir}/evince-thumbnailer.exe
%{_mingw32_bindir}/libevdocument-3.dll
%{_mingw32_bindir}/libevview-3.dll
%{_mingw32_libdir}/evince/3/backends/djvudocument.evince-backend
%{_mingw32_libdir}/evince/3/backends/libdjvudocument.dll
%{_mingw32_libdir}/evince/3/backends/pdfdocument.evince-backend
%{_mingw32_libdir}/evince/3/backends/libpdfdocument.dll
%{_mingw32_libdir}/evince/3/backends/tiffdocument.evince-backend
%{_mingw32_libdir}/evince/3/backends/libtiffdocument.dll
%{_mingw32_libdir}/evince/3/backends/psdocument.evince-backend
%{_mingw32_libdir}/evince/3/backends/libpsdocument.dll
%{_mingw32_libdir}/evince/3/backends/comicsdocument.evince-backend
%{_mingw32_libdir}/evince/3/backends/libcomicsdocument.dll
%if %{enable_dvi_backend}
%{_mingw32_libdir}/evince/3/backends/dvidocument.evince-backend
%{_mingw32_libdir}/evince/3/backends/libdvidocument.dll
%endif
%{_mingw32_libexecdir}/evince-convert-metadata.exe
%{_mingw32_mandir}/man1/evince.1*
%{_mingw32_datadir}/evince/evince-ui.xml
%{_mingw32_datadir}/evince/hand-open.png
%{_mingw32_datadir}/evince/evince-previewer-ui.xml
%{_mingw32_datadir}/evince/evince-toolbar.xml
%{_mingw32_datadir}/evince/icons/hicolor
%{_mingw32_datadir}/icons/hicolor
%{_mingw32_datadir}/GConf/gsettings/evince.convert
%{_mingw32_datadir}/glib-2.0/schemas/org.gnome.Evince.gschema.xml

%files msi
%defattr(-,root,root)
%{_mingw32_datadir}/msi/*

%files lang -f evince.lang
%defattr(-,root,root)
%if %{suse_version} <= 1100
%{_mingw32_datadir}/omf/evince/evince-*.omf
%endif


%files devel
%defattr(-,root,root)
%{_mingw32_includedir}/evince/2.32
%{_mingw32_libdir}/libevdocument.dll.a
%{_mingw32_libdir}/libevview.dll.a
%{_mingw32_libdir}/pkgconfig/evince-document-2.32.pc
%{_mingw32_libdir}/pkgconfig/evince-view-2.32.pc
%{_mingw32_datadir}/gtk-doc/html/evince
%{_mingw32_datadir}/gtk-doc/html/libevdocument-2.32
%{_mingw32_datadir}/gtk-doc/html/libevview-2.32


%changelog
openSUSE Build Service is sponsored by