1This file is part of MXE. See LICENSE.md for licensing information.
2
3Contains ad hoc patches for cross building.
4
5From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
6From: =?UTF-8?q?Stefan=20L=C3=B6ffler?= <st.loeffler@gmail.com>
7Date: Sun, 5 Nov 2017 20:53:42 +0100
8Subject: [PATCH 1/4] Only check for Type1 fonts in custom directory if path is
9 non-NULL
10
11Otherwise, programs using poppler may crash
12Proposed upstream at https://bugs.freedesktop.org/show_bug.cgi?id=49037
13
14diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
15index 1111111..2222222 100644
16--- a/poppler/GlobalParamsWin.cc
17+++ b/poppler/GlobalParamsWin.cc
18@@ -382,7 +382,7 @@ void GlobalParams::setupBaseFonts(const char *dir)
19
20         GooString *fontName = new GooString(displayFontTab[i].name);
21
22-        if (dir) {
23+        if (dir && displayFontTab[i].t1FileName) {
24             GooString *fontPath = appendToPath(new GooString(dir), displayFontTab[i].t1FileName);
25             if (FileExists(fontPath->c_str()) || FileExists(replaceSuffix(fontPath, ".pfb", ".pfa")->c_str())) {
26                 addFontFile(fontName, fontPath);
27
28From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
29From: darealshinji <djcj@gmx.de>
30Date: Thu, 14 Jul 2016 13:21:26 +0200
31Subject: [PATCH 2/4] enable cross-building DLLs
32
33
34diff --git a/cpp/poppler-global.h b/cpp/poppler-global.h
35index 1111111..2222222 100644
36--- a/cpp/poppler-global.h
37+++ b/cpp/poppler-global.h
38@@ -22,7 +22,7 @@
39 #ifndef POPPLER_GLOBAL_H
40 #define POPPLER_GLOBAL_H
41
42-#if defined(_WIN32)
43+#if defined(_WIN32) && defined(DLL_EXPORT)
44 #    define LIB_EXPORT __declspec(dllexport)
45 #    define LIB_IMPORT __declspec(dllimport)
46 #else
47diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
48index 1111111..2222222 100644
49--- a/poppler/GlobalParams.cc
50+++ b/poppler/GlobalParams.cc
51@@ -104,6 +104,7 @@ std::unique_ptr<GlobalParams> globalParams;
52
53 static HMODULE hmodule;
54
55+#ifdef DLL_EXPORT
56 extern "C" {
57 /* Provide declaration to squelch -Wmissing-declarations warning */
58 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
59@@ -119,6 +120,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
60     return TRUE;
61 }
62 }
63+#endif
64
65 static const char *get_poppler_datadir(void)
66 {
67diff --git a/qt5/src/poppler-export.h b/qt5/src/poppler-export.h
68index 1111111..2222222 100644
69--- a/qt5/src/poppler-export.h
70+++ b/qt5/src/poppler-export.h
71@@ -2,7 +2,7 @@
72  * This file is used to set the poppler_qt5_EXPORT macros right.
73  * This is needed for setting the visibility on windows, it will have no effect on other platforms.
74  */
75-#if defined(_WIN32)
76+#if defined(_WIN32) && defined(DLL_EXPORT)
77 #    define _POPPLER_QT5_LIB_EXPORT __declspec(dllexport)
78 #    define _POPPLER_QT5_LIB_IMPORT __declspec(dllimport)
79 #elif defined(__GNUC__)
80
81From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
82From: Boris Nagaev <bnagaev@gmail.com>
83Date: Wed, 27 Jul 2016 10:29:52 +0200
84Subject: [PATCH 3/4] do not try to use mman.h (package mman-win32)
85
86fix https://github.com/mxe/mxe/issues/1455
87
88diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
89index 1111111..2222222 100644
90--- a/poppler/CairoFontEngine.cc
91+++ b/poppler/CairoFontEngine.cc
92@@ -51,13 +51,6 @@
93 #include "Gfx.h"
94 #include "Page.h"
95
96-#if defined(HAVE_FCNTL_H) && defined(HAVE_SYS_MMAN_H) && defined(HAVE_SYS_STAT_H)
97-#    include <fcntl.h>
98-#    include <sys/stat.h>
99-#    include <sys/mman.h>
100-#    define CAN_CHECK_OPEN_FACES 1
101-#endif
102-
103 //------------------------------------------------------------------------
104 // CairoFont
105 //------------------------------------------------------------------------
106
107From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
108From: =?UTF-8?q?Stefan=20L=C3=B6ffler?= <st.loeffler@gmail.com>
109Date: Sat, 2 Mar 2019 12:42:53 +0100
110Subject: [PATCH 4/4] Add the possibility to disable tests
111
112
113diff --git a/CMakeLists.txt b/CMakeLists.txt
114index 1111111..2222222 100644
115--- a/CMakeLists.txt
116+++ b/CMakeLists.txt
117@@ -48,10 +48,11 @@ set (CMAKE_CXX_EXTENSIONS OFF)
118
119 # command line switches
120 option(ENABLE_UNSTABLE_API_ABI_HEADERS "Install API/ABI unstable xpdf headers." OFF)
121-option(BUILD_GTK_TESTS "Whether to compile the GTK+ test programs." ON)
122-option(BUILD_QT5_TESTS "Whether to compile the Qt5 test programs." ON)
123-option(BUILD_QT6_TESTS "Whether to compile the Qt6 test programs." ON)
124-option(BUILD_CPP_TESTS "Whether to compile the CPP test programs." ON)
125+option(ENABLE_TESTS "Whether compile tests." ON)
126+option(BUILD_GTK_TESTS "Whether to compile the GTK+ test programs." ${ENABLE_TESTS})
127+option(BUILD_QT5_TESTS "Whether to compile the Qt5 test programs." ${ENABLE_TESTS})
128+option(BUILD_QT6_TESTS "Whether to compile the Qt6 test programs." ${ENABLE_TESTS})
129+option(BUILD_CPP_TESTS "Whether to compile the CPP test programs." ${ENABLE_TESTS})
130 option(ENABLE_SPLASH "Build the Splash graphics backend." ON)
131 option(ENABLE_UTILS "Compile poppler command line utils." ON)
132 option(ENABLE_CPP "Compile poppler cpp wrapper." ON)
133@@ -727,7 +728,9 @@ endif()
134 if(ENABLE_GLIB)
135   add_subdirectory(glib)
136 endif()
137-add_subdirectory(test)
138+if(ENABLE_TESTS)
139+  add_subdirectory(test)
140+endif()
141 if(ENABLE_QT5)
142   add_subdirectory(qt5)
143 endif()
144