[meson] specify preferred linker to avoid stdc++ linking
diff --git a/meson_options.txt b/meson_options.txt
index 6fe06df..c76ccaf 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -28,6 +28,8 @@
option('icu-builtin', type: 'boolean', value: false,
description: 'Don\'t separate ICU support as harfbuzz-icu module')
+option('with-libstdcxx', type: 'boolean', value: false,
+ description: 'Allow linking with libstdc++ (ignored and always enabled in Windows)')
option('experimental-api', type: 'boolean', value: false,
description: 'Enable experimental APIs')
option('amalgam', type : 'boolean', value : false,
diff --git a/src/meson.build b/src/meson.build
index 36804ea..361f453 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -334,6 +334,16 @@
deps += [icu_dep]
endif
+if host_machine.system() == 'windows' or get_option('with-libstdcxx')
+ chosen_linker = 'cpp'
+else
+ # our autotools port was limiting this to HAVE_GCC as https://github.com/harfbuzz/harfbuzz/commit/e784632
+ # let's see if that is needed anymore
+
+ # Use a C linker, not C++; Don't link to libstdc++
+ chosen_linker = 'c'
+endif
+
# harfbuzz
gen_def = find_program('gen-def.py')
@@ -369,6 +379,7 @@
soversion: hb_so_version,
version: version,
install: true,
+ link_language: chosen_linker,
name_prefix: hb_lib_prefix)
libharfbuzz_dep = declare_dependency(
@@ -390,6 +401,7 @@
soversion: hb_so_version,
version: version,
install: true,
+ link_language: chosen_linker,
name_prefix: hb_lib_prefix)
libharfbuzz_subset_dep = declare_dependency(
@@ -471,7 +483,9 @@
if not get_option('amalgam')
dist_check_script += 'check-includes.sh'
endif
- if false # !WITH_LIBSTDCXX
+ if false and not get_option('with-libstdcxx')
+ # enable this once https://github.com/mesonbuild/meson/pull/6838 hits a release
+ # and make that version (i.e. 0.55) our minimum build requirement
dist_check_script += 'check-libstdc++.sh' # See https://github.com/harfbuzz/harfbuzz/issues/2276
endif
@@ -515,6 +529,8 @@
soversion: hb_so_version,
version: version,
install: true,
+ # ICU links to stdc++ anyway so the default linker is good
+ # link_language: chosen_linker,
name_prefix: hb_lib_prefix)
libharfbuzz_icu_dep = declare_dependency(
@@ -598,6 +614,7 @@
soversion: hb_so_version,
version: version,
install: true,
+ link_language: chosen_linker,
name_prefix: hb_lib_prefix)
gir = find_program('g-ir-scanner', required: get_option('introspection'))