diff --git a/README.md b/README.md index de300a8..2bb4574 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,9 @@ $ ninja install ``` By default, it will compile dynamic linked binaries. -If you want statically linked binaries, you can add `--default-library=static` +If you want statically linked binaries, you can add `-Dstatic-linkage=true` option to the meson command. +Be aware that you must have static library dependencies installed on your +system. Licensed as GPLv3 or later, see COPYING for more details. diff --git a/meson.build b/meson.build index 4ceaa0b..b47d6e7 100644 --- a/meson.build +++ b/meson.build @@ -2,6 +2,11 @@ project('kiwix-tools', 'cpp') compiler = meson.get_compiler('cpp') +static_linkage = get_option('static-linkage') +if static_linkage + add_global_link_arguments('-static-libstdc++', '--static', language:'cpp') +endif + thread_dep = dependency('threads') kiwixlib_dep = dependency('kiwix') microhttpd_dep = dependency('libmicrohttpd') diff --git a/meson_options.txt b/meson_options.txt index 886efcc..b8da3dc 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,2 +1,4 @@ +option('static-linkage', type : 'boolean', value : false, + description : 'Create statically linked binaries.') option('ctpp2-install-prefix', type : 'string', value : '', description : 'Prefix where ctpp libs has been installed')