RepositoryExternal.mk                          |   12 ++++++
 configure.ac                                   |    2 -
 external/libeot/0001-remove-unused-err.h.patch |   24 ++++++++++++
 external/libeot/ExternalProject_libeot.mk      |    2 -
 external/libeot/Module_libeot.mk               |   11 ++++-
 external/libeot/StaticLibrary_libeot.mk        |   47 +++++++++++++++++++++++++
 external/libeot/UnpackedTarball_libeot.mk      |    9 ++++
 7 files changed, 103 insertions(+), 4 deletions(-)

New commits:
commit 80e08f59eaee11a0ff1874416cbcc7e3fb102164
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri May 9 00:06:19 2025 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Fri May 9 06:55:09 2025 +0200

    make libeot compile on Windows
    
    Compile for Windows with LO infrastructure (not the only external lib
    where we do this).
    
    Remove unneeded include of <err.h> in libeot.c that isn't used, but
    Windows doesn't have <err.h> - it's a BSD / Linux thing.
    
    Only compile libeot.la and not the eot2ttf binary (which uses err.h so
    it doesn't compile on Windows).
    
    Change-Id: I26afb2b7bcf0bdf0d2ce0bdbcfceb10599d599e1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185057
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 9cacf77039d5..ed7e47804b3d 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3463,9 +3463,21 @@ $(call gb_LinkTarget_set_include,$(1),\
        -I$(gb_UnpackedTarball_workdir)/libeot/inc \
        $$(INCLUDE) \
 )
+
+ifeq ($(COM),MSC)
+
+$(call gb_LinkTarget_use_static_libraries,$(1),\
+       libeot \
+)
+
+else
+
 $(call gb_LinkTarget_add_libs,$(1),\
        
$(gb_UnpackedTarball_workdir)/libeot/.libs/libeot$(gb_StaticLibrary_PLAINEXT) \
 )
+
+endif
+
 $(call gb_LinkTarget_use_external_project,$(1),libeot)
 
 endef
diff --git a/configure.ac b/configure.ac
index 6cb9f6ba0ff0..d52460df2b7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1910,7 +1910,7 @@ libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
 
 # Enable by default on Linux and macOS only
-if test $_os = Darwin -o $_os = Linux; then
+if test $_os = Darwin -o $_os = Linux -o $_os = WINNT; then
     libo_FUZZ_ARG_ENABLE([eot],
         [AS_HELP_STRING([--disable-eot],
             [Disable support for Embedded OpenType fonts.])],
diff --git a/external/libeot/0001-remove-unused-err.h.patch 
b/external/libeot/0001-remove-unused-err.h.patch
new file mode 100644
index 000000000000..826bf12135c0
--- /dev/null
+++ b/external/libeot/0001-remove-unused-err.h.patch
@@ -0,0 +1,24 @@
+From cc2fbd324a2b3b014914ae253513d546e4076320 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= <tomaz.vajng...@collabora.co.uk>
+Date: Fri, 9 May 2025 09:55:23 +0900
+Subject: [PATCH] remove unused err.h
+
+---
+ src/libeot.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/libeot.c b/src/libeot.c
+index 8bac0c0..dce12ba 100644
+--- a/src/libeot.c
++++ b/src/libeot.c
+@@ -6,7 +6,6 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <stdint.h>
+-#include <err.h>
+ 
+ #include <sys/stat.h>
+ 
+-- 
+2.49.0
+
diff --git a/external/libeot/ExternalProject_libeot.mk 
b/external/libeot/ExternalProject_libeot.mk
index c8f1b3b8b122..95b5128a9d63 100644
--- a/external/libeot/ExternalProject_libeot.mk
+++ b/external/libeot/ExternalProject_libeot.mk
@@ -24,7 +24,7 @@ $(call gb_ExternalProject_get_state_target,libeot,build) :
                        --disable-shared \
                        --disable-debug \
                        $(gb_CONFIGURE_PLATFORMS) \
-               && $(MAKE) $(if $(verbose),V=1) \
+               && $(MAKE) $(if $(verbose),V=1) libeot.la \
        )
        $(call gb_Trace_EndRange,libeot,EXTERNAL)
 
diff --git a/external/libeot/Module_libeot.mk b/external/libeot/Module_libeot.mk
index 128b255d1b90..6d39a68c2ce3 100644
--- a/external/libeot/Module_libeot.mk
+++ b/external/libeot/Module_libeot.mk
@@ -10,8 +10,15 @@
 $(eval $(call gb_Module_Module,libeot))
 
 $(eval $(call gb_Module_add_targets,libeot,\
-       ExternalProject_libeot \
        UnpackedTarball_libeot \
 ))
-
+ifeq ($(COM),MSC)
+$(eval $(call gb_Module_add_targets,libeot,\
+       StaticLibrary_libeot \
+))
+else
+$(eval $(call gb_Module_add_targets,libeot,\
+       ExternalProject_libeot \
+))
+endif
 # vim: set noet sw=4 ts=4:
diff --git a/external/libeot/StaticLibrary_libeot.mk 
b/external/libeot/StaticLibrary_libeot.mk
new file mode 100644
index 000000000000..4e185e4edef0
--- /dev/null
+++ b/external/libeot/StaticLibrary_libeot.mk
@@ -0,0 +1,47 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_StaticLibrary_StaticLibrary,libeot))
+
+$(eval $(call gb_StaticLibrary_use_unpacked,libeot,libeot))
+
+$(eval $(call gb_StaticLibrary_set_warnings_disabled,libeot))
+
+$(eval $(call gb_StaticLibrary_set_include,libeot, \
+    -I$(gb_UnpackedTarball_workdir)/libeot/inc \
+    -I$(gb_UnpackedTarball_workdir)/libeot/src \
+    -I$(gb_UnpackedTarball_workdir)/libeot/src/ctf \
+    -I$(gb_UnpackedTarball_workdir)/libeot/src/lzcomp \
+    -I$(gb_UnpackedTarball_workdir)/libeot/src/util \
+    $$(INCLUDE) \
+))
+
+$(eval $(call gb_StaticLibrary_add_defs,libeot, \
+       -DDECOMPRESS_ON \
+))
+
+$(eval $(call gb_StaticLibrary_add_generated_cobjects,libeot,\
+       UnpackedTarball/libeot/src/libeot \
+       UnpackedTarball/libeot/src/EOT \
+       UnpackedTarball/libeot/src/writeFontFile \
+       UnpackedTarball/libeot/src/triplet_encodings \
+       UnpackedTarball/libeot/src/ctf/parseCTF \
+       UnpackedTarball/libeot/src/ctf/parseTTF \
+       UnpackedTarball/libeot/src/ctf/SFNTContainer \
+       UnpackedTarball/libeot/src/util/stream \
+       UnpackedTarball/libeot/src/lzcomp/ahuff \
+       UnpackedTarball/libeot/src/lzcomp/bitio \
+       UnpackedTarball/libeot/src/lzcomp/liblzcomp \
+       UnpackedTarball/libeot/src/lzcomp/lzcomp \
+       UnpackedTarball/libeot/src/lzcomp/mtxmem \
+))
+
+
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libeot/UnpackedTarball_libeot.mk 
b/external/libeot/UnpackedTarball_libeot.mk
index cbd1a69aa8b5..669dc1ecd76a 100644
--- a/external/libeot/UnpackedTarball_libeot.mk
+++ b/external/libeot/UnpackedTarball_libeot.mk
@@ -7,8 +7,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
+libeot_patches :=
+libeot_patches += 0001-remove-unused-err.h.patch
+
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,libeot))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,libeot,$(LIBEOT_TARBALL)))
 
+$(eval $(call gb_UnpackedTarball_set_patchlevel,libeot,1))
+
+$(eval $(call gb_UnpackedTarball_add_patches,libeot,\
+       $(foreach patch,$(libeot_patches),external/libeot/$(patch)) \
+))
+
 # vim: set noet sw=4 ts=4:

Reply via email to