[gnome-software: 2/7] lib: Build libgnomesoftware as a shared library as well as static
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 2/7] lib: Build libgnomesoftware as a shared library as well as static
- Date: Thu, 11 Mar 2021 14:25:51 +0000 (UTC)
commit 49821109ca6ca906184d88ed8533cbe175d8f445
Author: Philip Withnall <pwithnall endlessos org>
Date: Wed Jan 27 14:36:46 2021 +0000
lib: Build libgnomesoftware as a shared library as well as static
This means it can be linked to the plugins dynamically. This reduces the
installed plugin size by 50% (and correspondingly the disk reads and
memory for loading them). It doesn’t measurably affect startup time, and
overall reduces memory consumption by about 5% (although almost all of
that will be read-only mappings of the code).
Install the shared library in a private libdir to emphasise the fact
it’s not API-stable. This requires adding to the rpath for executables
which use it.
This changes the installation location for the static library to be in
the private libdir as well. The build processes of external plugins may
need to be modified to track this.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
lib/meson.build | 7 +++++--
meson.build | 3 +++
src/meson.build | 3 ++-
3 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/lib/meson.build b/lib/meson.build
index 5cad44a4a..ba305e773 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -68,7 +68,7 @@ libgnomesoftware_include_directories = [
include_directories('..'),
]
-libgnomesoftware = static_library(
+libgnomesoftware = library(
'gnomesoftware',
sources : [
'gs-app.c',
@@ -96,6 +96,7 @@ libgnomesoftware = static_library(
dependencies : librarydeps,
c_args : cargs,
install: true,
+ install_dir: gs_private_libdir,
)
libgnomesoftware_dep = declare_dependency(link_with : libgnomesoftware,
@@ -112,6 +113,7 @@ pkg.generate(
name : 'gnome-software',
subdirs : 'gnome-software',
variables : 'plugindir=${libdir}/gs-plugins-' + gs_plugin_api_version,
+ install_dir : join_paths(get_option('prefix'), get_option('libdir'), 'pkgconfig'), # or it defaults to
gs_private_libdir, which is wrong
)
executable(
@@ -137,7 +139,8 @@ executable(
],
c_args : cargs,
install : true,
- install_dir : get_option('libexecdir')
+ install_dir : get_option('libexecdir'),
+ install_rpath : gs_private_libdir,
)
if get_option('tests')
diff --git a/meson.build b/meson.build
index 50a5c9fe5..07f978d43 100644
--- a/meson.build
+++ b/meson.build
@@ -16,6 +16,9 @@ conf.set_quoted('BUILD_TYPE', get_option('buildtype'))
gs_plugin_api_version = '16'
conf.set_quoted('GS_PLUGIN_API_VERSION', gs_plugin_api_version)
+# private subdirectory of libdir for the private shared libgnomesoftware to live in
+gs_private_libdir = join_paths(get_option('prefix'), get_option('libdir'), 'gnome-software')
+
# install docs
install_data('README.md', install_dir : 'share/doc/gnome-software')
diff --git a/src/meson.build b/src/meson.build
index 3a91c8667..ffd4e7d85 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -132,7 +132,8 @@ executable(
dependencies : gnome_software_dependencies,
c_args : cargs,
install : true,
- install_dir : get_option('bindir')
+ install_dir : get_option('bindir'),
+ install_rpath : gs_private_libdir,
)
executable(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]