meson: Fix build on macos

There is a bug in meson's Compiler.has_function_attribute('visibility'),
which results in it incorrectly returning False on macos. This causes
meson to not defined BZ_EXTERN, but the gnu_symbol_visibility results in
hidden by default symbols. This means that there are no visible symbols
in libbz2 at all and linking naturally fails.

Fixes #18
This commit is contained in:
Dylan Baker 2019-06-21 09:16:04 -07:00
parent a51fb7324e
commit 5cd6c8f2b2

View File

@ -20,7 +20,8 @@ if host_machine.system() == 'windows'
endif
c_args = []
if cc.has_function_attribute('visibility')
# The or is a workaround for https://github.com/mesonbuild/meson/issues/5530
if cc.has_function_attribute('visibility') or (cc.get_id() == 'clang' and host_machine.system() == 'darwin')
c_args += '-DBZ_EXTERN=__attribute__((__visibility__("default")))'
endif