meson: hide symbols by default unless explicitly exported

This commit is contained in:
Tim-Philipp Müller 2017-08-10 13:32:43 +01:00
parent f5f21e5e8b
commit be8eb436b2
2 changed files with 14 additions and 1 deletions

View file

@ -54,11 +54,18 @@ configure_file(input : 'check.h.in',
internal_check_h_inc = include_directories('..') internal_check_h_inc = include_directories('..')
# Must explicitly make symbols public if default visibility is hidden
if have_visibility_hidden
libcheck_visibility_args = ['-DCK_DLL_EXP=extern __attribute__ ((visibility ("default")))']
else
libcheck_visibility_args = ['-DCK_DLL_EXP=extern']
endif
libcheck = static_library('check', libcheck = static_library('check',
libcheck_files, libcheck_files,
include_directories : [configinc, internal_check_h_inc], include_directories : [configinc, internal_check_h_inc],
dependencies : [rt_lib, mathlib], dependencies : [rt_lib, mathlib],
c_args: gst_c_args + c_args: gst_c_args + libcheck_visibility_args +
# Don't want libcompat to think we don't have these and substitute # Don't want libcompat to think we don't have these and substitute
# replacements since we don't check for or define these. See libcompat.h # replacements since we don't check for or define these. See libcompat.h
['-DHAVE_VSNPRINTF', '-DHAVE_SNPRINTF', '-DHAVE_MALLOC', '-DHAVE_REALLOC'], ['-DHAVE_VSNPRINTF', '-DHAVE_SNPRINTF', '-DHAVE_MALLOC', '-DHAVE_REALLOC'],

View file

@ -48,6 +48,12 @@ elif cc.has_argument('-Wl,-Bsymbolic-functions')
# FIXME: Add FATAL_WARNINGS from configure.ac # FIXME: Add FATAL_WARNINGS from configure.ac
endif endif
# Symbol visibility
have_visibility_hidden = cc.has_argument('-fvisibility=hidden')
if have_visibility_hidden
add_project_arguments('-fvisibility=hidden', language: 'c')
endif
cdata = configuration_data() cdata = configuration_data()
cdata.set_quoted('GST_API_VERSION', apiversion) cdata.set_quoted('GST_API_VERSION', apiversion)
cdata.set_quoted('GST_DATADIR', join_paths(prefix, get_option('datadir'))) cdata.set_quoted('GST_DATADIR', join_paths(prefix, get_option('datadir')))