From 241041b0b38e5851bb1a166cbd9393bbdd6eea06 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 24 Dec 2017 03:42:06 -0500 Subject: [PATCH] meson: Build with static linkage. This switches all libraries from using shared_library() to static_library(). For some reason, switching them to just library() (which should obey default_library) doesn't allow -Ddefault_library=static to set most of them to static. I suspect it's a bug in meson 0.44.0-1. This also amends libglib_dep to include the pkg-config's Libs.private. --- gio/meson.build | 2 +- gio/tests/gdbus-object-manager-example/meson.build | 2 +- gio/tests/modules/meson.build | 4 ++-- glib/meson.build | 3 ++- gmodule/meson.build | 2 +- gobject/meson.build | 2 +- gthread/meson.build | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gio/meson.build b/gio/meson.build index d7030aa29..b904841b2 100644 --- a/gio/meson.build +++ b/gio/meson.build @@ -711,7 +711,7 @@ else gio_dtrace_hdr = [] endif -libgio = shared_library('gio-2.0', +libgio = static_library('gio-2.0', gioenumtypes_h, gioenumtypes_c, gnetworking_h, gio_sources, gio_dtrace_hdr, gio_dtrace_obj, version : library_version, diff --git a/gio/tests/gdbus-object-manager-example/meson.build b/gio/tests/gdbus-object-manager-example/meson.build index 630357378..b92d6ea9d 100644 --- a/gio/tests/gdbus-object-manager-example/meson.build +++ b/gio/tests/gdbus-object-manager-example/meson.build @@ -14,7 +14,7 @@ gdbus_example_objectmanager_generated = custom_target('gdbus-example-objectmanag '--generate-docbook', 'gdbus-example-objectmanager-generated', '@INPUT@']) -libgdbus_example_objectmanager = shared_library('libgdbus-example-objectmanager', +libgdbus_example_objectmanager = static_library('libgdbus-example-objectmanager', gdbus_example_objectmanager_generated, c_args : ['-DHAVE_CONFIG_H=1'] + gio_c_args, dependencies : [libglib_dep, libgmodule_dep, libgobject_dep, libgio_dep], diff --git a/gio/tests/modules/meson.build b/gio/tests/modules/meson.build index c219015d3..21a43c5ee 100644 --- a/gio/tests/modules/meson.build +++ b/gio/tests/modules/meson.build @@ -1,10 +1,10 @@ -libtestmodulea = shared_library('testmodulea', 'test-module-a.c', +libtestmodulea = static_library('testmodulea', 'test-module-a.c', install : false, dependencies : [libglib_dep, libgobject_dep, libgmodule_dep, libgio_dep], c_args : [ ] ) -libtestmoduleb = shared_library('testmoduleb', 'test-module-b.c', +libtestmoduleb = static_library('testmoduleb', 'test-module-b.c', install : false, dependencies : [libglib_dep, libgobject_dep, libgmodule_dep, libgio_dep], c_args : [ ] diff --git a/glib/meson.build b/glib/meson.build index e46d2deb6..371e5bfbf 100644 --- a/glib/meson.build +++ b/glib/meson.build @@ -220,7 +220,7 @@ if use_pcre_static_flag pcre_static_args = ['-DPCRE_STATIC'] endif -libglib = shared_library('glib-2.0', +libglib = static_library('glib-2.0', glib_dtrace_obj, glib_dtrace_hdr, sources : [deprecated_sources, glib_sources, thread_src, plat_src], version : library_version, @@ -235,6 +235,7 @@ libglib = shared_library('glib-2.0', ) libglib_dep = declare_dependency(link_with : libglib, + dependencies : [pcre, thread_dep, libintl, librt] + libiconv + platform_deps, # We sadly need to export configinc here because everyone includes include_directories : [configinc, glibinc]) diff --git a/gmodule/meson.build b/gmodule/meson.build index fd0219d92..841fc1e91 100644 --- a/gmodule/meson.build +++ b/gmodule/meson.build @@ -87,7 +87,7 @@ gmoduleconf_h = configure_file(input : 'gmoduleconf.h.in', install_headers(['gmodule.h'], subdir : 'glib-2.0') -libgmodule = shared_library('gmodule-2.0', +libgmodule = static_library('gmodule-2.0', sources : ['gmodule.c'], version : library_version, soversion : soversion, diff --git a/gobject/meson.build b/gobject/meson.build index 9c722ce30..feac8fa92 100644 --- a/gobject/meson.build +++ b/gobject/meson.build @@ -53,7 +53,7 @@ else gobject_dtrace_hdr = [] endif -libgobject = shared_library('gobject-2.0', +libgobject = static_library('gobject-2.0', gobject_dtrace_obj, gobject_dtrace_hdr, sources : [gobject_c_sources], version : library_version, diff --git a/gthread/meson.build b/gthread/meson.build index 2d5913a91..63e6dd86b 100644 --- a/gthread/meson.build +++ b/gthread/meson.build @@ -1,6 +1,6 @@ # Just a skeleton lib for backwards compatibility since all the functionaliy # has been moved into glib now -libgthread = shared_library('gthread-2.0', +libgthread = static_library('gthread-2.0', sources : [ 'gthread-impl.c' ], version : library_version, soversion : soversion, -- 2.15.1