File 0001-MSI-packaging.patch of Package mingw32-poppler

From 8840c526ee95a45a019e9eb3acf24efeea4c600e Mon Sep 17 00:00:00 2001
From: Hib Eris <hib@hiberis.nl>
Date: Sun, 26 Mar 2017 14:25:49 +0200
Subject: [PATCH] MSI packaging

---
 Makefile.am      | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 configure.ac     | 29 +++++++++++++++++++++++++----
 poppler-glib.wxs | 17 +++++++++++++++++
 poppler-qt4.wxs  | 17 +++++++++++++++++
 poppler.wxs      | 39 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 150 insertions(+), 4 deletions(-)
 create mode 100644 poppler-glib.wxs
 create mode 100644 poppler-qt4.wxs
 create mode 100644 poppler.wxs

diff --git a/Makefile.am b/Makefile.am
index 9540b6a..fd9c028 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -130,3 +130,55 @@ ChangeLog:
 
 .PHONY: ChangeLog
 
+EXTRA_DIST +=			\
+	poppler.wxs		\
+	poppler-glib.wxs	\
+	poppler-qt4.wxs
+
+if ENABLE_WIX
+
+wixlibdir = ${datadir}/wixlib
+wixlib_WIX = poppler.wixlib poppler-glib.wixlib poppler-qt4.wixlib
+
+poppler.wixlib: wixdistdir
+poppler-glib.wixlib: wixdistdir
+poppler-qt4.wixlib: wixdistdir
+
+all-am: poppler-pc-stamp
+poppler-pc-stamp: poppler.pc
+	echo 'Requires.private: freetype2 libjpeg libopenjpeg lcms2 libpng libxml-2.0 zlib libstdcxx libgcc' >> poppler.pc
+	echo 'Wixlibs=${wixlibdir}/poppler.wixlib' >> poppler.pc
+	echo 'Fualflags=-C poppler -D poppler' >> poppler.pc
+	touch \$(@)
+
+all-am: poppler-glib-pc-stamp
+poppler-glib-pc-stamp: poppler-glib.pc
+	echo 'Wixlibs=${wixlibdir}/poppler-glib.wixlib' >> poppler-glib.pc
+	echo 'Fualflags=-C poppler_glib -D poppler_glib' >> poppler-glib.pc
+	touch \$(@)
+
+all-am: poppler-qt4-pc-stamp
+poppler-qt4-pc-stamp: poppler-qt4.pc
+	echo 'Wixlibs=${wixlibdir}/poppler-qt4.wixlib' >> poppler-qt4.pc
+	echo 'Fualflags=-C poppler_qt4 -D poppler_qt4' >> poppler-qt4.pc
+	touch \$(@)
+
+poppler-package.wxs: wixdistdir
+	$(HEAT) dir $(wixdistdir) $(HEAT_FLAGS) -gg -sfrag -sreg -cg poppler_package -dr poppler_package -srd -var var.wixdistdir -o $(@)
+
+#copy_demo_programs_stamp: wixdistdir
+#	cp glib/.libs/test-poppler-glib.exe $(wixdistdir)/bin
+#	cp qt4/demos/.libs/poppler_qt4viewer.exe $(wixdistdir)/bin
+
+poppler.msi.wxs:
+	$(FUAL) -o $(@) -p Poppler-$(VERSION) -C poppler_package -D poppler_package $(POPPLER_FUAL_FLAGS)
+
+noinst_msi_WIX =			\
+    poppler.msi
+
+@WIX_MAKE_RULES@
+
+poppler.msi: poppler.msi.wixobj poppler-package.wixobj
+	$(LIGHT) -ext WixUIExtension poppler.msi.wixobj poppler-package.wixobj $(POPPLER_WIXLIBS) -o $(@) -sval
+
+endif
diff --git a/configure.ac b/configure.ac
index 7a233b9..fb8dfdc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -254,10 +254,8 @@ if test x$openjpeg1 = xyes || test x$openjpeg2 = xyes; then
   AC_DEFINE(ENABLE_LIBOPENJPEG)
   PKG_CHECK_EXISTS(libopenjpeg >= 1.5,
       [AC_DEFINE(WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG, 1, [OpenJPEG with the OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG flag.])],
-      [PKG_CHECK_EXISTS(libopenjpeg1 >= 1.5,
-       [AC_DEFINE(WITH_OPENJPEG_IGNORE_PCLR_CMAP_CDEF_FLAG, 1, [OpenJPEG with the OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG flag.])],
-       [])
-      ])
+      [])
+  poppler_requires="$poppler_requires libopenjpeg"
 else
   enable_libopenjpeg=no
 fi
@@ -421,6 +419,7 @@ if test x$enable_libcurl = xyes; then
   AC_DEFINE(ENABLE_LIBCURL, 1, [Build against libcurl.])
   AC_DEFINE(POPPLER_HAS_CURL_SUPPORT, 1,
      [Support for curl based doc builder is compiled in.])
+  poppler_requires="$poppler_requires libcurl"
 fi
 
 AM_CONDITIONAL(BUILD_LIBCURL, test x$enable_libcurl = xyes)
@@ -490,6 +489,9 @@ if test x$enable_libjpeg != xno; then
   USER_LDFLAGS="$ac_save_USER_LDFLAGS"
 fi
 
+if test x$enable_libjpeg = xyes; then
+  poppler_requires="$poppler_requires libjpeg"
+fi
 AM_CONDITIONAL(BUILD_LIBJPEG, test x$enable_libjpeg = xyes)
 AH_TEMPLATE([ENABLE_LIBJPEG],
             [Use libjpeg instead of builtin jpeg decoder.])
@@ -508,6 +510,7 @@ fi
 
 if test x$enable_libpng = xyes; then
   AC_DEFINE(ENABLE_LIBPNG, 1, [Build against libpng.])
+  poppler_requires="$poppler_requires libpng"
 fi
 
 AM_CONDITIONAL(BUILD_LIBPNG, test x$enable_libpng = xyes)
@@ -520,6 +523,7 @@ PKG_CHECK_MODULES(FREETYPE, freetype2,
 if test "x$freetype_pkgconfig" = "xyes"; then
 
   AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])
+  poppler_requires="$poppler_requires freetype2"
 
 else
 
@@ -567,6 +571,7 @@ case $with_font_configuration in
      AC_DEFINE([WITH_FONTCONFIGURATION_FONTCONFIG],
                [1],[Use fontconfig font configuration backend])
      PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.0.0)
+     poppler_requires="$poppler_requires fontconfig >= 2.0.0"
      ;;
   *)
      AC_MSG_ERROR(
@@ -628,6 +633,7 @@ if test x$enable_cairo_output = xyes; then
   CAIRO_FEATURE="#define POPPLER_HAS_CAIRO 1"
   CAIRO_REQ="cairo"
   AC_CHECK_HEADERS(fcntl.h sys/mman.h sys/stat.h)
+  poppler_requires="$poppler_requires cairo >= $CAIRO_VERSION"
 else
   CAIRO_FEATURE="#undef POPPLER_HAS_CAIRO"
   CAIRO_REQ=""
@@ -663,6 +669,7 @@ if test x$enable_cairo_output = xyes; then
     AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
     POPPLER_GLIB_DISABLE_DEPRECATED="$POPPLER_GLIB_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED"
     POPPLER_GLIB_DISABLE_SINGLE_INCLUDES="$POPPLER_GLIB_DISABLE_SINGLE_INCLUDES -DG_DISABLE_SINGLE_INCLUDES"
+    poppler_requires="$poppler_requires $GLIB_REQ"
   fi
 else
   if test x$enable_poppler_glib = xyes; then
@@ -735,6 +742,7 @@ if test x$enable_poppler_qt4 = xyes; then
   fi
   AC_SUBST(MOCQT4)
   AC_MSG_RESULT([$MOCQT4])
+  poppler_requires="$poppler_requires QtCore >= 4.4.0 QtGui >= 4.4.0 QtXml >= 4.4.0"
 fi
 
 AM_CONDITIONAL(BUILD_POPPLER_QT4, test "x$enable_poppler_qt4" = "xyes")
@@ -840,6 +848,9 @@ elif test x$enable_gtk_test = xtry; then
                     [enable_gtk_test="yes"],
                     [enable_gtk_test="no"])
 fi
+if test x$enable_gtk_test = xyes; then
+  poppler_requires="$poppler_requires gtk+-2.0 >= 2.14 gdk-pixbuf-2.0 gthread-2.0 gio-2.0"
+fi
 AM_CONDITIONAL(BUILD_GTK_TEST, test x$enable_gtk_test = xyes -a x$enable_poppler_glib = xyes)
 
 AC_ARG_ENABLE(utils,
@@ -880,6 +891,9 @@ if test x$lcms1 = xyes || test x$lcms2 = xyes; then
   if test x$lcms1 = xyes; then
     lcms1=yes;
     AC_DEFINE(USE_LCMS1, 1, [Defines if use lcms1])
+    poppler_requires="$poppler_requires lcms"
+  else
+    poppler_requires="$poppler_requires lcms2"
   fi
 else
   enable_cms=no
@@ -986,6 +1000,13 @@ AC_SUBST([POPPLER_MINOR_VERSION],[poppler_version_minor])
 AC_SUBST([POPPLER_MICRO_VERSION],[poppler_version_micro])
 AC_SUBST([POPPLER_VERSION],[poppler_version])
 
+WIX_INIT()
+if test "x$enable_wix" = "xyes"; then
+   WIX_PKG_CHECK_MODULES(POPPLER, $poppler_requires libstdcxx libgcc)
+fi
+AC_SUBST(POPPLER_WIXLIBS)
+AC_SUBST(POPPLER_FUAL_FLAGS)
+
 AC_OUTPUT([
 Makefile
 goo/Makefile
diff --git a/poppler-glib.wxs b/poppler-glib.wxs
new file mode 100644
index 0000000..0158b85
--- /dev/null
+++ b/poppler-glib.wxs
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+    <Fragment>
+        <ComponentGroup Id="poppler_glib">
+            <ComponentRef Id="cmp0555FFCF0DADEC44C08C52A415F2F11B" />
+        </ComponentGroup>
+    </Fragment>
+    <Fragment>
+        <DirectoryRef Id="poppler_glib">
+            <Directory Id="dir8CF2A83C36D0A908F17CCAA28869C8D8" Name="bin">
+                <Component Id="cmp0555FFCF0DADEC44C08C52A415F2F11B" Guid="{A60E019B-8726-4CB7-A551-55F62F5025AF}">
+                    <File Id="fil6DC1E5C255C363378E4E00FBF00CEC5D" KeyPath="yes" Source="$(var.wixdistdir)\bin\libpoppler-glib-8.dll" />
+                </Component>
+            </Directory>
+        </DirectoryRef>
+    </Fragment>
+</Wix>
diff --git a/poppler-qt4.wxs b/poppler-qt4.wxs
new file mode 100644
index 0000000..a3eb12e
--- /dev/null
+++ b/poppler-qt4.wxs
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+    <Fragment>
+        <ComponentGroup Id="poppler_qt4">
+            <ComponentRef Id="cmp369E52086628D3EA759143F752AFC76D" />
+        </ComponentGroup>
+    </Fragment>
+    <Fragment>
+        <DirectoryRef Id="poppler_qt4">
+            <Directory Id="dir06BCD53B48E91D5C98136340248022A2" Name="bin">
+                <Component Id="cmp369E52086628D3EA759143F752AFC76D" Guid="{33FC8D60-C27C-4A0C-B943-B2A4939101BD}">
+                   <File Id="fil517EEFFCDDCFD1D1C8F081A49EEED64A" KeyPath="yes" Source="$(var.wixdistdir)\bin\libpoppler-qt4-4.dll" />
+               </Component>
+            </Directory>
+        </DirectoryRef>
+    </Fragment>
+</Wix>
diff --git a/poppler.wxs b/poppler.wxs
new file mode 100644
index 0000000..2b0db1f
--- /dev/null
+++ b/poppler.wxs
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+    <Fragment>
+        <ComponentGroup Id="poppler">
+            <ComponentRef Id="cmp7188DE409C993B815E46122E6495F3DA" />
+            <ComponentRef Id="cmp6114C427DE314F3DADDEBDB1983563A9" />
+            <ComponentRef Id="cmp1DC380992EBB4DCF86A9075922EEF1D9" />
+            <ComponentRef Id="cmp24B0E1F1FCD141E7A166E403BBE19F6C" />
+            <ComponentRef Id="cmp78D676E4683441A684E2302706115B9F" />
+        </ComponentGroup>
+    </Fragment>
+    <Fragment>
+        <DirectoryRef Id="poppler">
+            <Directory Id="dir72F2A83C36D0A908F17CCAA28869C8D8" Name="bin">
+                <Component Id="cmp7188DE409C993B815E46122E6495F3DA" Guid="{B8C9D89E-B9D0-4AFC-8784-529E7D466B8A}">
+                    <File Id="fil6D7EC42B28A8F787B1C821326FF8BA52" KeyPath="yes" Source="$(var.wixdistdir)/bin/libpoppler-37.dll" />
+                </Component>
+            </Directory>
+            <Directory Id="dirC8775DE729A345F393683B02408E4924" Name="share">
+                <Directory Id="dir81424CB395404266BAC9E241F3705F6D" Name="license">
+                    <Directory Id="dirFBDD40E12BB14E2586201453B86CB2D8" Name="poppler">
+                        <Component Id="cmp6114C427DE314F3DADDEBDB1983563A9" Guid="{EB3254E7-6E9A-4A27-88E5-1B17DE577427}">
+                            <File Id="fil4531B6FC8BB84B9F96EE0E74614A00B3" KeyPath="yes" Source="AUTHORS" />
+                        </Component>
+                        <Component Id="cmp1DC380992EBB4DCF86A9075922EEF1D9" Guid="{87CEAEA1-A004-4E56-A998-B5ED47480AED}">
+                            <File Id="fil4AA85BFBA3334B20878630684A7F028D" KeyPath="yes" Source="COPYING" />
+                        </Component>
+                        <Component Id="cmp24B0E1F1FCD141E7A166E403BBE19F6C" Guid="{7D4D505B-5D39-4DB5-A1E4-1DAEDC4924D3}">
+                            <File Id="fil2D7CC7D46D794E47946C8C372211CFCD" KeyPath="yes" Source="README" />
+                        </Component>
+                        <Component Id="cmp78D676E4683441A684E2302706115B9F" Guid="{1D451096-6E65-4387-8D6B-0B0B42E3609D}">
+                            <File Id="fil937A134CF4504C2292C7CBF9F9FDCF90" KeyPath="yes" Source="README-XPDF" />
+                        </Component>
+                    </Directory>
+                </Directory>
+            </Directory>
+        </DirectoryRef>
+    </Fragment>
+</Wix>
-- 
2.7.4

openSUSE Build Service is sponsored by