mingw-harfbuzz/harfbuzz-enable-delayload-freetype.patch

81 lines
3.3 KiB
Diff
Raw Normal View History

2023-03-03 21:49:25 +00:00
diff -rupN --no-dereference harfbuzz-7.1.0/configure.ac harfbuzz-7.1.0-new/configure.ac
--- harfbuzz-7.1.0/configure.ac 2023-03-03 00:07:04.000000000 +0100
+++ harfbuzz-7.1.0-new/configure.ac 2023-03-03 22:49:15.874808503 +0100
2022-07-29 18:39:46 +00:00
@@ -417,6 +417,30 @@ AM_CONDITIONAL(HAVE_CORETEXT, $have_core
dnl ===========================================================================
+AC_ARG_ENABLE(delay-load,
+ [AC_HELP_STRING([--enable-delay-load],
+ [makes the freetype dependency optional at runtime (win32 only)])],,
+ [enable_delay_load=no])
+
+AC_MSG_CHECKING([whether to enable the use of delay-loaded freetype dependencies])
+if test $hb_os_win32 = false; then
+ enable_delay_load=false
+fi
+AM_CONDITIONAL(ENABLE_DELAY_LOAD, test x"$enable_delay_load" = x"yes")
+AC_MSG_RESULT([$enable_delay_load])
+
+if test x"$enable_delay_load" = x"yes" ; then
+ AC_CHECK_TOOL([GENDEF], [gendef])
+
+ AC_MSG_CHECKING([whether gendef was found])
+ if test x"$GENDEF" = x"" ; then
+ AC_MSG_ERROR([The gendef tool (required for delay loading the freetype dependency) could not be detected])
+ fi
+ AC_MSG_RESULT([yes])
+fi
+
+dnl ===========================================================================
+
AC_CONFIG_FILES([
Makefile
src/Makefile
2022-07-29 18:39:46 +00:00
@@ -483,4 +507,5 @@ Other features:
2018-05-30 08:30:45 +00:00
Documentation: ${enable_gtk_doc}
GObject bindings: ${have_gobject}
Introspection: ${have_introspection}
+ Enable delay loading: ${enable_delay_load}
])
2023-03-03 21:49:25 +00:00
diff -rupN --no-dereference harfbuzz-7.1.0/src/Makefile.am harfbuzz-7.1.0-new/src/Makefile.am
--- harfbuzz-7.1.0/src/Makefile.am 2023-03-03 00:07:04.000000000 +0100
+++ harfbuzz-7.1.0-new/src/Makefile.am 2023-03-03 22:49:15.874808503 +0100
2022-12-17 18:06:34 +00:00
@@ -53,8 +53,23 @@ HB_HAS_GLIB_DEF = undef HB_HAS_GLIB
endif
if HAVE_FREETYPE
-HBCFLAGS += $(FREETYPE_CFLAGS)
+if ENABLE_DELAY_LOAD
+# Create delay-loaded import library for freetype
+libfreetype-delay-loaded.dll.a:
+ DLL=$(bindir)/libfreetype-6.dll; \
+ if test ! -f "$$DLL" ; then \
+ echo "*** File $$DLL could not be found, unable to create delay-loaded import library"; \
+ exit 1; \
+ fi; \
+ $(GENDEF) - "$$DLL" > freetype_delay_load.def; \
+ $(DLLTOOL) --def freetype_delay_load.def --kill-at --output-delaylib libfreetype-delay-loaded.dll.a
+
+harfbuzz_delayload_ldflags = -Wl,libfreetype-delay-loaded.dll.a -Wl,-lmingwex -Wl,-lkernel32
+harfbuzz_delayload_dependency = libfreetype-delay-loaded.dll.a
+else
HBLIBS += $(FREETYPE_LIBS)
+endif
2020-05-13 23:25:34 +00:00
+HBCFLAGS += $(FREETYPE_CFLAGS)
HBDEPS += $(FREETYPE_DEPS)
2016-04-09 20:35:23 +00:00
HBSOURCES += $(HB_FT_sources)
HBHEADERS += $(HB_FT_headers)
2023-02-15 10:26:45 +00:00
@@ -161,9 +176,9 @@ base_link_flags = $(AM_LDFLAGS) -lm -ver
2018-06-08 13:11:08 +00:00
libharfbuzz_la_LINK = $(chosen_linker) $(libharfbuzz_la_LDFLAGS)
2018-05-30 08:30:45 +00:00
libharfbuzz_la_SOURCES = $(HBSOURCES) $(HBHEADERS)
2018-06-08 13:11:08 +00:00
libharfbuzz_la_CPPFLAGS = $(HBCFLAGS) $(CODE_COVERAGE_CFLAGS)
-libharfbuzz_la_LDFLAGS = $(base_link_flags) $(export_symbols) $(CODE_COVERAGE_LDFLAGS)
+libharfbuzz_la_LDFLAGS = $(base_link_flags) $(export_symbols) $(CODE_COVERAGE_LDFLAGS) $(harfbuzz_delayload_ldflags)
libharfbuzz_la_LIBADD = $(HBLIBS)
-EXTRA_libharfbuzz_la_DEPENDENCIES = $(harfbuzz_def_dependency)
+EXTRA_libharfbuzz_la_DEPENDENCIES = $(harfbuzz_def_dependency) $(harfbuzz_delayload_dependency)
pkginclude_HEADERS = $(HBHEADERS)
2018-05-30 08:30:45 +00:00
nodist_pkginclude_HEADERS =
pkgconfigdir = $(libdir)/pkgconfig