aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorTero Tervala <tero.tervala@unikie.com>2022-06-29 19:35:57 +0300
committerDavid Gibson <david@gibson.dropbear.id.au>2022-07-27 16:38:45 +1000
commit7ad60734b1c1ac12856674fa7913fc9492dc5d28 (patch)
tree8d4f765563e116a81d39b4d1384834f0f599cf3a /meson.build
parentfd9b8c96c780c90dd0f1af46963bf2c52de1f0a6 (diff)
downloaddtc-7ad60734b1c1ac12856674fa7913fc9492dc5d28.zip
dtc-7ad60734b1c1ac12856674fa7913fc9492dc5d28.tar.gz
dtc-7ad60734b1c1ac12856674fa7913fc9492dc5d28.tar.bz2
Allow static building with meson
Added "static-build" option in the meson_options.txt. Setting it to "true" allows static building. Signed-off-by: Tero Tervala <tero.tervala@unikie.com> Message-Id: <20220629163557.932298-1-tero.tervala@unikie.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build14
1 files changed, 12 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index b23ea1b..78251eb 100644
--- a/meson.build
+++ b/meson.build
@@ -31,8 +31,16 @@ add_project_arguments(
language: 'c'
)
+if get_option('static-build')
+ static_build = true
+ extra_link_args = ['-static']
+else
+ static_build = false
+ extra_link_args = []
+endif
+
yamltree = 'yamltree.c'
-yaml = dependency('yaml-0.1', required: get_option('yaml'))
+yaml = dependency('yaml-0.1', required: get_option('yaml'), static: static_build)
if not yaml.found()
add_project_arguments('-DNO_YAML', language: 'c')
yamltree = []
@@ -85,6 +93,7 @@ if get_option('tools')
],
dependencies: util_dep,
install: true,
+ link_args: extra_link_args,
)
endif
@@ -105,10 +114,11 @@ if get_option('tools')
],
dependencies: [util_dep, yaml],
install: true,
+ link_args: extra_link_args,
)
foreach e: ['fdtdump', 'fdtget', 'fdtput', 'fdtoverlay']
- executable(e, files(e + '.c'), dependencies: util_dep, install: true)
+ executable(e, files(e + '.c'), dependencies: util_dep, install: true, link_args: extra_link_args)
endforeach
install_data(