]> git.ipfire.org Git - thirdparty/zstd.git/commit
meson: for internal linkage, link to both libzstd and a static copy of it 3122/head
authorEli Schwartz <eschwartz@archlinux.org>
Thu, 28 Apr 2022 22:22:55 +0000 (18:22 -0400)
committerEli Schwartz <eschwartz@archlinux.org>
Fri, 29 Apr 2022 01:57:02 +0000 (21:57 -0400)
commit6548ec7440712eb531f4148ed0568cf90fa1e523
tree1cb6f44f506bf7619de4927417f93030183633e9
parent8d522b8a9da21edc7b3b85faa4daeb495ff56a85
meson: for internal linkage, link to both libzstd and a static copy of it

Partial, Meson-only implementation of #2976 for non-MSVC builds.

Due to the prevalence of private symbol reuse, linking to a shared
library is simply utterly unreliable, but we still want to defer to the
shared library for installable applications. By linking to both, we can
share symbols where possible, and statically link where needed.

This means we no longer need to manually track every file that needs to
be extracted and reused.

The flip side is that MSVC completely does not support this, so for MSVC
builds we just link to a full static copy even where
-Ddefault_library=shared.

As a side benefit, by using library inclusion rather than including
extra explicit object files, the zstd program shrinks in size slightly
(~4kb).
build/meson/lib/meson.build
build/meson/programs/meson.build
build/meson/tests/meson.build