external/pdfium/Library_pdfium.mk            |    2 +-
 external/pdfium/UnpackedTarball_pdfium.mk    |    2 ++
 external/pdfium/freebsd.patch                |   23 +++++++++++++++++++++++
 sal/osl/unx/process.cxx                      |    2 +-
 sal/osl/unx/socket.cxx                       |    3 +++
 solenv/gbuild/platform/FREEBSD_X86_64_GCC.mk |    2 ++
 6 files changed, 32 insertions(+), 2 deletions(-)

New commits:
commit 58f87a032edfbd00883fd3bb8936a716b03d4234
Author:     Jaap <[email protected]>
AuthorDate: Sun Aug 3 13:14:21 2025 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Aug 6 11:09:25 2025 +0200

    Fix compilation on FreeBSD
    
    Change-Id: Ida038aef3f83461cdcb0dfadf20a1057282b648b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188928
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/external/pdfium/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index 260127295b83..1a27cbb48259 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -732,7 +732,7 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
 ))
 endif
 
-ifeq ($(OS),LINUX)
+ifneq (,$(filter LINUX FREEBSD OPENBSD,$(OS)))
 # fxge
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/linux/fx_linux_impl \
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk 
b/external/pdfium/UnpackedTarball_pdfium.mk
index 6c5bce9b2e29..945f886ad04a 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 += freebsd.patch
+
 pdfium_patches += system-abseil.diff
 
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
diff --git a/external/pdfium/freebsd.patch b/external/pdfium/freebsd.patch
new file mode 100644
index 000000000000..a31bf00fb7a9
--- /dev/null
+++ b/external/pdfium/freebsd.patch
@@ -0,0 +1,23 @@
+--- core/fxge/linux/fx_linux_impl.cpp.orig     2024-04-16 00:00:38 UTC
++++ core/fxge/linux/fx_linux_impl.cpp
+@@ -17,7 +17,7 @@
+ #include "core/fxge/fx_font.h"
+ #include "core/fxge/systemfontinfo_iface.h"
+ 
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !defined(OS_ASMJS)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !defined(OS_ASMJS) && 
!defined(OS_FREEBSD) && !defined(OS_OPENBSD)
+ #error "Included on the wrong platform"
+ #endif
+ 
+--- core/fxge/cfx_fontmapper.cpp.orig  2024-04-16 00:00:38 UTC
++++ core/fxge/cfx_fontmapper.cpp
+@@ -157,7 +157,7 @@ constexpr AltFontFamily kAltFontFamilies[] = {
+     {"ForteMT", "Forte"},
+ };
+ 
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || defined(OS_ASMJS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || defined(OS_ASMJS) || 
defined(OS_FREEBSD) || defined(OS_OPENBSD)
+ const char kNarrowFamily[] = "LiberationSansNarrow";
+ #elif BUILDFLAG(IS_ANDROID)
+ const char kNarrowFamily[] = "RobotoCondensed";
+
diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx
index 0398afc58e45..ab813210b409 100644
--- a/sal/osl/unx/process.cxx
+++ b/sal/osl/unx/process.cxx
@@ -45,7 +45,7 @@
 #include <machine/param.h>
 #endif
 
-#ifdef IOS
+#if defined(IOS) || defined(FREEBSD)
 #include <signal.h>
 #endif
 
diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx
index 2b3a877ec977..28c7fd2e607b 100644
--- a/sal/osl/unx/socket.cxx
+++ b/sal/osl/unx/socket.cxx
@@ -39,6 +39,9 @@
 #include <arpa/inet.h>
 #include <fcntl.h>
 #include <netdb.h>
+#ifdef FREEBSD
+#include <netinet/ip.h>
+#endif
 #include <netinet/tcp.h>
 #include <poll.h>
 #include <unistd.h>
diff --git a/solenv/gbuild/platform/FREEBSD_X86_64_GCC.mk 
b/solenv/gbuild/platform/FREEBSD_X86_64_GCC.mk
index 6199f17b3015..a8eed6a9f131 100644
--- a/solenv/gbuild/platform/FREEBSD_X86_64_GCC.mk
+++ b/solenv/gbuild/platform/FREEBSD_X86_64_GCC.mk
@@ -11,4 +11,6 @@
 
 include $(GBUILDDIR)/platform/unxgcc.mk
 
+USE_LD += -Wl,--undefined-version
+
 # vim: set noet sw=4:

Reply via email to