libdex/libdex-0.1.0-soversion.patch
2023-02-23 17:53:17 +00:00

113 lines
3.5 KiB
Diff

From bb93ebb64f2d468819c7bb3732f25f40dbcdb4af Mon Sep 17 00:00:00 2001
From: Christian Hergert <chergert@redhat.com>
Date: Tue, 21 Feb 2023 11:54:03 -0800
Subject: [PATCH] build: fix library versioning
This also undoes some of the build cleanups that were done previously
because they were too difficult for me to unwrap and see exactly how
settings are getting inherited.
Fixes #3
---
meson.build | 3 ---
src/meson.build | 41 ++++++++++++++++++++---------------------
2 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/meson.build b/meson.build
index 94e60b9..3b83b00 100644
--- a/meson.build
+++ b/meson.build
@@ -126,7 +126,6 @@ endforeach
add_project_arguments(project_c_args, language: 'c')
# Detect and set symbol visibility
-hidden_visibility_args = []
if get_option('default_library') != 'static'
if host_machine.system() == 'windows'
config_h.set('DLL_EXPORT', true)
@@ -134,11 +133,9 @@ if get_option('default_library') != 'static'
config_h.set('_DEX_EXTERN', '__declspec(dllexport) extern')
elif cc.has_argument('-fvisibility=hidden')
config_h.set('_DEX_EXTERN', '__attribute__((visibility("default"))) __declspec(dllexport) extern')
- hidden_visibility_args = ['-fvisibility=hidden']
endif
elif cc.has_argument('-fvisibility=hidden')
config_h.set('_DEX_EXTERN', '__attribute__((visibility("default"))) extern')
- hidden_visibility_args = ['-fvisibility=hidden']
endif
endif
diff --git a/src/meson.build b/src/meson.build
index 3f0fd8a..04f6e29 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -117,26 +117,31 @@ endif
libdex_c_args = [
deprecated_c_args,
- hidden_visibility_args,
+ release_args,
'-DG_LOG_DOMAIN="Dex"',
'-DDEX_COMPILATION',
]
-libdex = library('dex-@0@'.format(api_version), libdex_sources,
- dependencies: libdex_deps,
- c_args: libdex_c_args,
- install: true,
+libdex_static = static_library('dex-@0@'.format(api_version), libdex_sources,
+ dependencies: libdex_deps,
+ gnu_symbol_visibility: 'hidden',
+ c_args: libdex_c_args,
)
-if get_option('default_library') == 'shared'
- libdex_static = static_library('dex-@0@'.format(api_version),
- objects: libdex.extract_all_objects(recursive: true),
- )
-elif get_option('default_library') == 'static'
- libdex_static = libdex
-elif get_option('default_library') == 'both'
- libdex_static = libdex.get_static_lib()
-endif
+libdex_static_dep = declare_dependency(
+ link_whole: libdex_static,
+ include_directories: include_directories('.'),
+ dependencies: libdex_deps,
+)
+
+libdex = shared_library('dex-@0@'.format(api_version),
+ dependencies: libdex_deps + [libdex_static_dep],
+ c_args: libdex_c_args,
+ install: true,
+ gnu_symbol_visibility: 'hidden',
+ version: '@0@.0.0'.format(api_version),
+ darwin_versions: '1.0',
+)
libdex_dep_sources = []
@@ -152,7 +157,7 @@ pkg.generate(
)
if get_option('introspection').enabled()
- libdex_gir = gnome.generate_gir(libdex,
+ libdex_gir = gnome.generate_gir(libdex_static,
sources: [libdex_sources, libdex_headers],
nsversion: api_version,
namespace: 'Dex',
@@ -185,10 +190,4 @@ libdex_dep = declare_dependency(
sources: [libdex_dep_sources],
)
-libdex_static_dep = declare_dependency(
- link_whole: libdex_static,
- include_directories: include_directories('.'),
- dependencies: libdex_deps,
-)
-
meson.override_dependency('libdex-' + api_version, libdex_dep)
--
GitLab