build: set symbol visibility

A simple version script is used because it allows us to consistently
expose all symbols starting with "di_", removing the risk to forget
to mark a symbol as public.

Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
Simon Ser 2022-06-06 12:23:06 +02:00 committed by Pekka Paalanen
parent c383417629
commit a4d2bbf95f
2 changed files with 11 additions and 0 deletions

6
libdisplay-info.map Normal file
View file

@ -0,0 +1,6 @@
{
global:
di_*;
local:
*;
};

View file

@ -27,6 +27,9 @@ add_project_arguments(cc.get_supported_arguments([
'-Werror=implicit',
]), language: 'c')
symbols_file = 'libdisplay-info.map'
symbols_flag = '-Wl,--version-script,@0@'.format(meson.current_source_dir() / symbols_file)
di_lib = library(
'display-info',
[
@ -34,6 +37,8 @@ di_lib = library(
'info.c',
],
include_directories: include_directories('include'),
link_args: symbols_flag,
link_depends: symbols_file,
install: true,
)