summaryrefslogtreecommitdiffstats
path: root/debian/patches/fix-system-abseil-build.diff
blob: f7cbb10a6f07806081ce4c24040c6a147771b19a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
From 61a6811906d48bb3d92384a6aef6cabcfe4fdcca Mon Sep 17 00:00:00 2001
From: Rene Engelhard <rene@rene-engelhard.de>
Date: Fri, 15 Dec 2023 23:45:04 +0100
Subject: [PATCH] fix system-abseil build even with 2022 version

actually it seems it was a internal abseil header from pdfium vs. system
header mismatch. Include proper absl/container/inlined_vector.h if using
system-abseil.

While at it we can also just use pkg-config, no idea why I did it
without back then. Also gets the advantage that it knows that the libs
needed for absl_inlined_vector is actually
-labsl_throw_delegate -labsl_raw_logging_internal -labsl_log_severity

This effectively reverts e89723103313ec4366ee58144c47d7a5c16bf838

Change-Id: Ide4f79860b4e0673c5c6587d503058bdd2930744
---
 configure.ac                              | 19 +------------------
 external/pdfium/Library_pdfium.mk         |  5 +++++
 external/pdfium/UnpackedTarball_pdfium.mk |  2 ++
 external/pdfium/system-abseil.diff        | 15 +++++++++++++++
 4 files changed, 23 insertions(+), 18 deletions(-)
 create mode 100644 external/pdfium/system-abseil.diff

diff --git a/configure.ac b/configure.ac
index 97de2b514d3a..586e31f8bae5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12231,15 +12231,7 @@ if test "$ENABLE_PDFIUM" = "TRUE"; then
         AC_MSG_RESULT([external])
         SYSTEM_ABSEIL=TRUE
         AC_LANG_PUSH([C++])
-        AC_CHECK_HEADER(absl/types/bad_optional_access.h, [],
-                        [AC_MSG_ERROR(abseil headers not found.)], [])
-        AC_CHECK_HEADER(absl/types/bad_variant_access.h, [],
-                        [AC_MSG_ERROR(abseil headers not found.)], [])
-        AC_CHECK_LIB([absl_bad_optional_access], [main], [],
-                     [AC_MSG_ERROR([libabsl_bad_optional_access library not found.])])
-        AC_CHECK_LIB([absl_bad_variant_access], [main], [],
-                     [AC_MSG_ERROR([libabsl_bad_variant_access library not found.])])
-        ABSEIL_LIBS="-labsl_bad_optional_access -labsl_bad_variant_access"
+	PKG_CHECK_MODULES(ABSEIL, absl_bad_optional_access absl_bad_variant_access absl_inlined_vector )
         AC_LANG_POP([C++])
         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
         FilterLibs "${ABSEIL_LIBS}"
diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk
index fc0903d873d1..85f9d953b752 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -40,6 +40,11 @@ $(eval $(call gb_Library_add_defs,pdfium,\
     -DUSE_SYSTEM_LIBOPENJPEG2 \
 ))
 endif
+ifeq ($(SYSTEM_ABSEIL),TRUE)
+$(eval $(call gb_Library_add_defs,pdfium,\
+    -DUSE_SYSTEM_ABSEIL \
+))
+endif
 
 
 $(eval $(call gb_Library_set_generated_cxx_suffix,pdfium,cpp))
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index 924bbe23a8b8..f8d95d2785c7 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -16,6 +16,8 @@ pdfium_patches += c++20-comparison.patch
 
 pdfium_patches += constexpr-template.patch
 
+pdfium_patches += system-abseil.diff
+
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,pdfium,$(PDFIUM_TARBALL)))
diff --git a/external/pdfium/system-abseil.diff b/external/pdfium/system-abseil.diff
new file mode 100644
index 000000000000..841bc8ce9468
--- /dev/null
+++ b/external/pdfium/system-abseil.diff
@@ -0,0 +1,15 @@
+--- core/fpdfapi/page/cpdf_sampledfunc.cpp	2023-12-15 23:27:10.955659091 +0100
++++ core/fpdfapi/page/cpdf_sampledfunc.cpp	2023-12-15 23:27:43.420136476 +0100
+@@ -16,8 +16,11 @@
+ #include "core/fxcrt/cfx_bitstream.h"
+ #include "core/fxcrt/fx_memory_wrappers.h"
+ #include "core/fxcrt/fx_safe_types.h"
++#ifdef USE_SYSTEM_ABSEIL
++#include <absl/container/inlined_vector.h>
++#else
+ #include "third_party/abseil-cpp/absl/container/inlined_vector.h"
+-
++#endif
+ namespace {
+ 
+ // See PDF Reference 1.7, page 170, table 3.36.
-- 
2.39.2