Skip to content

Commit

Permalink
libfdt/meson.build: support building without static library
Browse files Browse the repository at this point in the history
Some build systems like meson-python and NixOS have difficulties with
static archives. The `both_library()` Meson function always builds both
shared and static libraries. Instead of using `both_libraries()` to
get a handle on a static lib, use `static_library()` directly.

Signed-off-by: Brandon Maier <[email protected]>
  • Loading branch information
blmaier committed Oct 17, 2024
1 parent 99031e3 commit 56a7d0c
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions libfdt/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,31 @@ else
endif

link_args += version_script
libfdt = both_libraries(
'fdt', sources,
version: meson.project_version(),
link_args: link_args,
link_depends: 'version.lds',
install: true,
)

if static_build
link_with = libfdt.get_static_lib()
libfdt = static_library(
'fdt',
sources,
link_args: link_args,
link_depends: 'version.lds',
install: true,
)
else
link_with = libfdt.get_shared_lib()
libfdt = library(
'fdt',
sources,
version: meson.project_version(),
link_args: link_args,
link_depends: 'version.lds',
install: true,
)
endif

libfdt_inc = include_directories('.')

libfdt_dep = declare_dependency(
include_directories: libfdt_inc,
link_with: link_with,
link_with: libfdt,
)

install_headers(
Expand Down

0 comments on commit 56a7d0c

Please sign in to comment.