From 6dab0955dfac7f35f96041d0dfbe31bb623ebd71 Mon Sep 17 00:00:00 2001
From: Florian Walpen <dev@submerge.ch>
Date: Sat, 5 Mar 2022 23:11:49 +0100
Subject: [PATCH] editors/libreoffice: Fix build with PDFIUM and LTO.

When libvcllo.so is linked together with libpdfiumlo.so, it also needs
libopenjp2.so from graphics/openjpeg, since pdfium depends on that.
Building with LTO exposes this as an error, complaining about undefined
references to openjpeg library functions.

This patch adds the missing linker flag "-lopenjp2".
---
 editors/libreoffice/files/patch-RepositoryExternal.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 editors/libreoffice/files/patch-RepositoryExternal.mk

diff --git a/editors/libreoffice/files/patch-RepositoryExternal.mk b/editors/libreoffice/files/patch-RepositoryExternal.mk
new file mode 100644
index 000000000000..336262e5ef94
--- /dev/null
+++ b/editors/libreoffice/files/patch-RepositoryExternal.mk
@@ -0,0 +1,10 @@
+--- RepositoryExternal.mk.orig	2022-03-05 19:24:43 UTC
++++ RepositoryExternal.mk
+@@ -4203,6 +4203,7 @@ $(call gb_LinkTarget_set_include,$(1),\
+        $$(INCLUDE) \
+ )
+ $(call gb_LinkTarget_use_libraries,$(1),pdfium)
++$(call gb_LinkTarget_add_libs,$(1),$(OPENJPEG2_LIBS))
+ endef
+ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo,\
+        pdfium \
-- 
2.35.1