fontconfig: Branch 'main' - 2 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Apr 1 03:00:22 UTC 2025
src/meson.build | 41 +++++++++++++++++++++++++----------------
test/meson.build | 4 ++--
2 files changed, 27 insertions(+), 18 deletions(-)
New commits:
commit 309e5c705167fd748bb9536ce7e599d9b715db05
Merge: 31252db b57c116
Author: Akira TAGOH <akira at tagoh.org>
Date: Tue Apr 1 03:00:19 2025 +0000
Merge branch 'fix_static_only_build' into 'main'
meson: don't force build of a shared library
See merge request fontconfig/fontconfig!373
commit b57c1162e6c2cde828d0289b8b0a4bd6061fb6b8
Author: Kacper Michajłow <kasper93 at gmail.com>
Date: Thu Mar 27 16:10:41 2025 +0100
meson: don't force build of a shared library
Shared library linking has certain preconditions that may not always be
met, depending on usage. For example, static dependencies must be built
with PIC, which is unnecessary if we only require the static library.
We need to build both libraries only if `default_library` is not static.
If we are already building a static library, there is no need to link
the shared one. This also fixes the Windows build in this case, as
`c_shared_args` would otherwise force everything to be built twice.
This change is needed to fix the OSS-Fuzz build of FFmpeg.
Changelog: fixed
Fixes: 50aa6e3685223fb644b8800d5af77e1b6cda7345
diff --git a/src/meson.build b/src/meson.build
index e3c518e..9bd0d48 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -43,24 +43,33 @@ fcobjshash_h = custom_target('fcobjshash.h',
command: [gperf, '--pic', '-m', '100', '@INPUT@', '--output-file', '@OUTPUT@']
)
-# Define FcPublic appropriately for exports on windows
-fc_c_shared_args = []
+lib_sources = [fc_sources, alias_headers, ft_alias_headers, fclang_h, fccase_h, fcobjshash_h, fcstdint_h]
+lib_kwargs = {
+ 'include_directories': incbase,
+ 'dependencies': [deps, math_dep],
+ 'install': true,
+}
-if host_machine.system() == 'windows' and get_option('default_library') in ['both', 'shared']
- fc_c_shared_args += '-DFcPublic=__declspec(dllexport)'
- fc_c_shared_args += '-DDLL_EXPORT'
-endif
+if get_option('default_library') in ['both', 'shared']
+ # Define FcPublic appropriately for exports on windows
+ fc_c_shared_args = []
+ if host_machine.system() == 'windows'
+ fc_c_shared_args += '-DFcPublic=__declspec(dllexport)'
+ fc_c_shared_args += '-DDLL_EXPORT'
+ endif
-libfontconfig = both_libraries('fontconfig',
- fc_sources, alias_headers, ft_alias_headers, fclang_h, fccase_h, fcobjshash_h, fcstdint_h,
- c_shared_args: fc_c_shared_args,
- include_directories: incbase,
- dependencies: [deps, math_dep],
- install: true,
- soversion: soversion,
- version: libversion,
- darwin_versions: osxversion,
-)
+ libfontconfig = both_libraries('fontconfig',
+ lib_sources,
+ c_shared_args: fc_c_shared_args,
+ soversion: soversion,
+ version: libversion,
+ darwin_versions: osxversion,
+ kwargs: lib_kwargs)
+ libfontconfig_internal = libfontconfig.get_static_lib()
+else
+ libfontconfig = static_library('fontconfig', lib_sources, kwargs: lib_kwargs)
+ libfontconfig_internal = libfontconfig
+endif
fontconfig_dep = declare_dependency(link_with: libfontconfig,
include_directories: incbase,
diff --git a/test/meson.build b/test/meson.build
index fa16a92..313ad2b 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -37,7 +37,7 @@ foreach test_data : tests
exe = executable(test_name, fname,
c_args: c_args + extra_c_args,
include_directories: incbase,
- link_with: [libfontconfig.get_static_lib()],
+ link_with: [libfontconfig_internal],
dependencies: extra_deps,
)
@@ -47,7 +47,7 @@ endforeach
if get_option('fontations').enabled()
rust = import('rust')
- rust.test('fc_fontations_rust_tests', fc_fontations, link_with: [fc_fontations, libfontconfig.get_static_lib()])
+ rust.test('fc_fontations_rust_tests', fc_fontations, link_with: [fc_fontations, libfontconfig_internal])
endif
fs = import('fs')
More information about the Fontconfig
mailing list