mxe/src/poppler-1-win32.patch

144 lines
5.2 KiB
Diff
Raw Permalink Normal View History

This file is part of MXE. See LICENSE.md for licensing information.
2019-03-03 16:45:42 +00:00
Contains ad hoc patches for cross building.
2016-07-15 16:43:44 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20L=C3=B6ffler?= <st.loeffler@gmail.com>
2019-03-03 16:45:42 +00:00
Date: Sun, 5 Nov 2017 20:53:42 +0100
Subject: [PATCH 1/4] Only check for Type1 fonts in custom directory if path is
non-NULL
Otherwise, programs using poppler may crash
Proposed upstream at https://bugs.freedesktop.org/show_bug.cgi?id=49037
diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
2016-07-15 16:43:44 +01:00
index 1111111..2222222 100644
--- a/poppler/GlobalParamsWin.cc
+++ b/poppler/GlobalParamsWin.cc
2020-07-29 01:27:38 +01:00
@@ -382,7 +382,7 @@ void GlobalParams::setupBaseFonts(const char *dir)
2019-03-03 16:45:42 +00:00
2020-07-29 01:27:38 +01:00
GooString *fontName = new GooString(displayFontTab[i].name);
- if (dir) {
+ if (dir && displayFontTab[i].t1FileName) {
GooString *fontPath = appendToPath(new GooString(dir), displayFontTab[i].t1FileName);
2020-07-29 01:27:38 +01:00
if (FileExists(fontPath->c_str()) || FileExists(replaceSuffix(fontPath, ".pfb", ".pfa")->c_str())) {
addFontFile(fontName, fontPath);
2016-07-15 16:43:44 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: darealshinji <djcj@gmx.de>
Date: Thu, 14 Jul 2016 13:21:26 +0200
2019-03-03 16:45:42 +00:00
Subject: [PATCH 2/4] enable cross-building DLLs
diff --git a/cpp/poppler-global.h b/cpp/poppler-global.h
2016-07-15 16:43:44 +01:00
index 1111111..2222222 100644
--- a/cpp/poppler-global.h
+++ b/cpp/poppler-global.h
2019-03-03 16:45:42 +00:00
@@ -22,7 +22,7 @@
#ifndef POPPLER_GLOBAL_H
#define POPPLER_GLOBAL_H
-#if defined(_WIN32)
2016-07-15 16:43:44 +01:00
+#if defined(_WIN32) && defined(DLL_EXPORT)
2020-07-29 01:27:38 +01:00
# define LIB_EXPORT __declspec(dllexport)
# define LIB_IMPORT __declspec(dllimport)
2016-07-15 16:43:44 +01:00
#else
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 1111111..2222222 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
2020-09-03 16:40:40 +01:00
@@ -104,6 +104,7 @@ std::unique_ptr<GlobalParams> globalParams;
2016-07-15 16:43:44 +01:00
static HMODULE hmodule;
+#ifdef DLL_EXPORT
extern "C" {
2020-07-29 01:27:38 +01:00
/* Provide declaration to squelch -Wmissing-declarations warning */
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
2020-09-03 16:40:40 +01:00
@@ -119,6 +120,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
2019-03-03 16:45:42 +00:00
return TRUE;
2020-07-29 01:27:38 +01:00
}
2016-07-15 16:43:44 +01:00
}
+#endif
2020-07-29 01:27:38 +01:00
static const char *get_poppler_datadir(void)
{
2016-12-27 00:58:03 +00:00
diff --git a/qt5/src/poppler-export.h b/qt5/src/poppler-export.h
index 1111111..2222222 100644
--- a/qt5/src/poppler-export.h
+++ b/qt5/src/poppler-export.h
@@ -2,7 +2,7 @@
2020-07-29 01:27:38 +01:00
* This file is used to set the poppler_qt5_EXPORT macros right.
* This is needed for setting the visibility on windows, it will have no effect on other platforms.
*/
2016-12-27 00:58:03 +00:00
-#if defined(_WIN32)
+#if defined(_WIN32) && defined(DLL_EXPORT)
2020-07-29 01:27:38 +01:00
# define _POPPLER_QT5_LIB_EXPORT __declspec(dllexport)
# define _POPPLER_QT5_LIB_IMPORT __declspec(dllimport)
2016-12-27 00:58:03 +00:00
#elif defined(__GNUC__)
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Nagaev <bnagaev@gmail.com>
Date: Wed, 27 Jul 2016 10:29:52 +0200
2019-03-03 16:45:42 +00:00
Subject: [PATCH 3/4] do not try to use mman.h (package mman-win32)
fix https://github.com/mxe/mxe/issues/1455
diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index 1111111..2222222 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
2019-03-03 16:45:42 +00:00
@@ -51,13 +51,6 @@
#include "Gfx.h"
#include "Page.h"
2019-03-03 16:45:42 +00:00
-#if defined(HAVE_FCNTL_H) && defined(HAVE_SYS_MMAN_H) && defined(HAVE_SYS_STAT_H)
2020-07-29 01:27:38 +01:00
-# include <fcntl.h>
-# include <sys/stat.h>
-# include <sys/mman.h>
-# define CAN_CHECK_OPEN_FACES 1
-#endif
-
2019-03-03 16:45:42 +00:00
//------------------------------------------------------------------------
// CairoFont
//------------------------------------------------------------------------
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20L=C3=B6ffler?= <st.loeffler@gmail.com>
Date: Sat, 2 Mar 2019 12:42:53 +0100
Subject: [PATCH 4/4] Add the possibility to disable tests
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1111111..2222222 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
2020-08-03 11:22:50 +01:00
@@ -48,10 +48,11 @@ set (CMAKE_CXX_EXTENSIONS OFF)
2019-03-03 16:45:42 +00:00
# command line switches
option(ENABLE_UNSTABLE_API_ABI_HEADERS "Install API/ABI unstable xpdf headers." OFF)
2019-05-26 12:14:29 +01:00
-option(BUILD_GTK_TESTS "Whether to compile the GTK+ test programs." ON)
-option(BUILD_QT5_TESTS "Whether to compile the Qt5 test programs." ON)
2020-07-29 01:27:38 +01:00
-option(BUILD_QT6_TESTS "Whether to compile the Qt6 test programs." ON)
2019-05-26 12:14:29 +01:00
-option(BUILD_CPP_TESTS "Whether to compile the CPP test programs." ON)
2019-03-03 16:45:42 +00:00
+option(ENABLE_TESTS "Whether compile tests." ON)
2019-05-26 12:14:29 +01:00
+option(BUILD_GTK_TESTS "Whether to compile the GTK+ test programs." ${ENABLE_TESTS})
+option(BUILD_QT5_TESTS "Whether to compile the Qt5 test programs." ${ENABLE_TESTS})
2020-07-29 01:27:38 +01:00
+option(BUILD_QT6_TESTS "Whether to compile the Qt6 test programs." ${ENABLE_TESTS})
2019-05-26 12:14:29 +01:00
+option(BUILD_CPP_TESTS "Whether to compile the CPP test programs." ${ENABLE_TESTS})
2019-03-03 16:45:42 +00:00
option(ENABLE_SPLASH "Build the Splash graphics backend." ON)
option(ENABLE_UTILS "Compile poppler command line utils." ON)
option(ENABLE_CPP "Compile poppler cpp wrapper." ON)
2020-09-03 16:40:40 +01:00
@@ -727,7 +728,9 @@ endif()
2019-03-03 16:45:42 +00:00
if(ENABLE_GLIB)
add_subdirectory(glib)
endif()
-add_subdirectory(test)
+if(ENABLE_TESTS)
+ add_subdirectory(test)
+endif()
if(ENABLE_QT5)
add_subdirectory(qt5)
endif()