mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 19:31:12 +00:00
meson: add gst-full-version-script option
Can be used to control the exact symbols exported, or not, in libgstreamer-full. This is useful when building a tailored libgstreamer-full aimed to be run with some specific binaries. By using such version script one can reduce the size of the generated lib by letting the linker garbage collect all the unused APIs. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/195>
This commit is contained in:
parent
a9731bdcb7
commit
89faf739c9
3 changed files with 21 additions and 0 deletions
|
@ -131,6 +131,12 @@ Since *1.20.0* `gst_init_static_plugins()` is called automatically by
|
||||||
`gst_init()` and applications must not call it manually any more. The header
|
`gst_init()` and applications must not call it manually any more. The header
|
||||||
file has been removed from public API.
|
file has been removed from public API.
|
||||||
|
|
||||||
|
One can use the `gst-full-version-script` option to pass a
|
||||||
|
[version script](https://www.gnu.org/software/gnulib/manual/html_node/LD-Version-Scripts.html)
|
||||||
|
to the linker. This can be used to control the exact symbols that are exported by
|
||||||
|
the gstreamer-full library, allowing the linker to garbage collect unused code
|
||||||
|
and so reduce the total library size.
|
||||||
|
|
||||||
This is an experimental feature, backward uncompatible changes could still be
|
This is an experimental feature, backward uncompatible changes could still be
|
||||||
made in the future.
|
made in the future.
|
||||||
|
|
||||||
|
|
13
meson.build
13
meson.build
|
@ -297,6 +297,18 @@ if get_option('default_library') == 'static'
|
||||||
requires = ['glib-2.0', 'gobject-2.0']
|
requires = ['glib-2.0', 'gobject-2.0']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
link_deps = []
|
||||||
|
if get_option('gst-full-version-script') != ''
|
||||||
|
symbol_map = meson.current_source_dir() / get_option('gst-full-version-script')
|
||||||
|
link_arg = '-Wl,--version-script=' + symbol_map
|
||||||
|
if cc.has_link_argument(link_arg)
|
||||||
|
gstfull_link_args += link_arg
|
||||||
|
else
|
||||||
|
error('Failed to link with version script (' + symbol_map + '), check logs for details')
|
||||||
|
endif
|
||||||
|
link_deps += symbol_map
|
||||||
|
endif
|
||||||
|
|
||||||
# Build both shared and static library
|
# Build both shared and static library
|
||||||
gstfull = both_libraries('gstreamer-full-1.0',
|
gstfull = both_libraries('gstreamer-full-1.0',
|
||||||
init_static_plugins_c,
|
init_static_plugins_c,
|
||||||
|
@ -304,6 +316,7 @@ if get_option('default_library') == 'static'
|
||||||
link_args: gstfull_link_args,
|
link_args: gstfull_link_args,
|
||||||
link_whole : exposed_libs,
|
link_whole : exposed_libs,
|
||||||
dependencies : gst_dep,
|
dependencies : gst_dep,
|
||||||
|
link_depends : link_deps,
|
||||||
install : true,
|
install : true,
|
||||||
)
|
)
|
||||||
pkgconfig.generate(gstfull,
|
pkgconfig.generate(gstfull,
|
||||||
|
|
|
@ -21,6 +21,8 @@ option('qt5', type : 'feature', value : 'auto', description : 'Qt5 Support')
|
||||||
option('custom_subprojects', type : 'string', value : '', description : 'Comma-separated project names')
|
option('custom_subprojects', type : 'string', value : '', description : 'Comma-separated project names')
|
||||||
option('gst-full-libraries', type : 'array', value : [],
|
option('gst-full-libraries', type : 'array', value : [],
|
||||||
description : '''List of libraries to expose in gstreamer-full's ABI. gstreamer, glib and gobject are always included.''')
|
description : '''List of libraries to expose in gstreamer-full's ABI. gstreamer, glib and gobject are always included.''')
|
||||||
|
option('gst-full-version-script', type : 'string', value: '',
|
||||||
|
description : 'path of the version script to be used by the linker, see https://www.gnu.org/software/gnulib/manual/html_node/LD-Version-Scripts.html')
|
||||||
|
|
||||||
# Common options, automatically inherited by subprojects
|
# Common options, automatically inherited by subprojects
|
||||||
option('tests', type : 'feature', value : 'auto', description : 'Build tests')
|
option('tests', type : 'feature', value : 'auto', description : 'Build tests')
|
||||||
|
|
Loading…
Reference in a new issue