Draft: plugins: Improve footprint by allowing element selection during static link stage
This MR intends to offer a way to create a very light gstreamer-full library containing only a set of elements from a given plugin. During the link stage of gstreamer-full, the dead code path will be removed and the final binary size will be smaller.
This MR depends on another MR pending on gst-build repository:
To give a little bit of measurement:
build command: MESON build_static_minimal -Ddefault_library=static -Dlibav=disabled -Dpython=disabled -Dlibnice=disabled -Ddevtools=disabled -Dges=disabled -Drtsp_server=disabled -Dgst-examples=disabled -Dtests=disabled -Dexamples=disabled -Ddoc=disabled -Dbad=disabled -Dugly=disabled -Dgood=disabled -Dbase=disabled -Dbuildtype=release -Dbackend=ninja
- With this MR and filesrc, fakesink enabled: 1.7M
- Without this MR: 2.3M
lib (stripped) | 1 | 2 | 3 | 4 | 5 | 6 |
---|---|---|---|---|---|---|
ligstreamer-full.so | 2337112 | 2341176 | 2250776 | 1793240 | 1641400 | 1629080 |
- before any mods in gst repos (except removing base and good from the build, see commit): build without
-Dgstreamer:optimize-gc-sections=true -Dgst-full-elements=coreelements:filesrc,fakesink,identity
in the meson command line. - without element separation: build without
-Dgstreamer:optimize-gc-sections=true -Dgst-full-elements=coreelements:filesrc,fakesink,identity
in the meson command line. - with element separation: build without
-Dgstreamer:optimize-gc-sections=true
- Final build with command line above.
- With commit 9351982e(split init in each element file) without garbage collection
- With commit 9351982e with garbage collection