summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Playfair Cal <daniel.playfair.cal@gmail.com>2020-12-19 01:24:57 +0000
committerDaniel Playfair Cal <daniel.playfair.cal@gmail.com>2020-12-19 01:24:57 +0000
commit6f7f010b69326eac4e8ee6e0ea7275aaf3232c80 (patch)
treee66209279f4356b1dc11b268471583c3eb17225b
parent490421c6a89f918dbb75ae14efb66a1ce1fe1399 (diff)
parent72fbd6f7442a7e3dbc227068e58d082bbbefa2dc (diff)
downloaddconf-6f7f010b69326eac4e8ee6e0ea7275aaf3232c80.tar.gz
Merge branch 'fix-symbols' into 'master'
build: Improve libdconf visible symbols See merge request GNOME/dconf!59
-rw-r--r--client/meson.build13
-rw-r--r--client/symbols.txt40
-rw-r--r--common/meson.build16
-rwxr-xr-xgsettings/abicheck.sh26
-rw-r--r--gsettings/meson.build29
-rw-r--r--gsettings/symbol.map10
-rw-r--r--gsettings/symbols.txt3
-rwxr-xr-xtests/abicheck.sh35
-rw-r--r--tests/meson.build17
9 files changed, 121 insertions, 68 deletions
diff --git a/client/meson.build b/client/meson.build
index de6387e..e9672b8 100644
--- a/client/meson.build
+++ b/client/meson.build
@@ -12,11 +12,6 @@ install_headers(
sources = files('dconf-client.c')
-deps = [
- libdconf_common_hidden_dep,
- libdconf_gdbus_thread_dep,
-]
-
libdconf_client = static_library(
'dconf-client',
sources: sources,
@@ -31,13 +26,19 @@ libdconf_client_dep = declare_dependency(
link_with: libdconf_client,
)
+client_deps = [
+ libdconf_common_dep,
+ libdconf_engine_dep,
+ libdconf_gdbus_thread_dep,
+]
+
libdconf = shared_library(
'dconf',
sources: sources,
version: libversion,
soversion: soversion,
include_directories: top_inc,
- dependencies: deps,
+ dependencies: client_deps,
c_args: dconf_c_args,
install: true,
)
diff --git a/client/symbols.txt b/client/symbols.txt
new file mode 100644
index 0000000..d22c22f
--- /dev/null
+++ b/client/symbols.txt
@@ -0,0 +1,40 @@
+dconf_changeset_all
+dconf_changeset_change
+dconf_changeset_describe
+dconf_changeset_deserialise
+dconf_changeset_diff
+dconf_changeset_filter_changes
+dconf_changeset_get
+dconf_changeset_is_empty
+dconf_changeset_is_similar_to
+dconf_changeset_new
+dconf_changeset_new_database
+dconf_changeset_new_write
+dconf_changeset_ref
+dconf_changeset_seal
+dconf_changeset_serialise
+dconf_changeset_set
+dconf_changeset_unref
+dconf_client_change_fast
+dconf_client_change_sync
+dconf_client_get_type
+dconf_client_is_writable
+dconf_client_list
+dconf_client_list_locks
+dconf_client_new
+dconf_client_read
+dconf_client_read_full
+dconf_client_sync
+dconf_client_unwatch_fast
+dconf_client_unwatch_sync
+dconf_client_watch_fast
+dconf_client_watch_sync
+dconf_client_write_fast
+dconf_client_write_sync
+dconf_error_quark
+dconf_is_dir
+dconf_is_key
+dconf_is_path
+dconf_is_rel_dir
+dconf_is_rel_key
+dconf_is_rel_path
diff --git a/common/meson.build b/common/meson.build
index 58e0fa8..befa9bc 100644
--- a/common/meson.build
+++ b/common/meson.build
@@ -28,19 +28,5 @@ libdconf_common = static_library(
libdconf_common_dep = declare_dependency(
dependencies: glib_dep,
- link_whole: libdconf_common,
-)
-
-libdconf_common_hidden = static_library(
- 'dconf-common-hidden',
- sources: sources,
- include_directories: top_inc,
- dependencies: glib_dep,
- c_args: dconf_c_args + cc.get_supported_arguments('-fvisibility=hidden'),
- pic: true,
-)
-
-libdconf_common_hidden_dep = declare_dependency(
- dependencies: glib_dep,
- link_with: libdconf_common_hidden,
+ link_with: libdconf_common,
)
diff --git a/gsettings/abicheck.sh b/gsettings/abicheck.sh
deleted file mode 100755
index 1dca6ea..0000000
--- a/gsettings/abicheck.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-# The following checks that gsettings/libdconfsettings.so only has
-# dconf_* symbols.
-#
-# We also make sure to ignore gcov symbols included when building with
-# --coverage, which usually means the following:
-#
-# __gcov_error_file
-# __gcov_master
-# __gcov_sort_n_vals
-# __gcov_var
-#
-# And starting with gcc-9, also this one:
-#
-# mangle_path
-
-${NM:-nm} --dynamic --defined-only $GSETTINGS_LIB > public-abi
-
-test "`\
- cat public-abi | \
- cut -f 3 -d ' ' | \
- grep -v ^_ | \
- grep -v ^mangle_path | \
- grep -v ^g_io_module | \
- wc -l`" -eq 0 && rm public-abi
diff --git a/gsettings/meson.build b/gsettings/meson.build
index a28892d..9463453 100644
--- a/gsettings/meson.build
+++ b/gsettings/meson.build
@@ -1,32 +1,19 @@
-# We use the libraries directly, as the dependency objects use
-# link_whole; this avoids the gsettings backend module exposing
-# symbols other than g_io_module_*
backend_deps = [
- libdconf_common_hidden,
- libdconf_gdbus_thread,
+ libdconf_common_dep,
+ libdconf_gdbus_thread_dep,
]
+symbol_map = join_paths(meson.current_source_dir(), 'symbol.map')
+ldflags = cc.get_supported_link_arguments('-Wl,--version-script,@0@'.format(symbol_map))
+
libdconf_settings = shared_library(
'dconfsettings',
sources: 'dconfsettingsbackend.c',
include_directories: top_inc,
- link_with: backend_deps,
- dependencies: gio_dep,
+ dependencies: backend_deps,
c_args: dconf_c_args,
+ link_args: ldflags,
+ link_depends: symbol_map,
install: true,
install_dir: gio_module_dir,
)
-
-envs = test_env + [
- 'G_TEST_SRCDIR=' + meson.current_source_dir(),
- 'G_TEST_BUILDDIR=' + meson.current_build_dir(),
- 'GSETTINGS_LIB=' + libdconf_settings.full_path(),
-]
-
-unit_test = 'abicheck'
-
-test(
- unit_test,
- find_program(unit_test + '.sh'),
- env: envs,
-)
diff --git a/gsettings/symbol.map b/gsettings/symbol.map
new file mode 100644
index 0000000..ad1719c
--- /dev/null
+++ b/gsettings/symbol.map
@@ -0,0 +1,10 @@
+{
+global:
+ g_io_module_load;
+ g_io_module_unload;
+ g_io_module_query;
+ environ;
+ __progname;
+local:
+ *;
+};
diff --git a/gsettings/symbols.txt b/gsettings/symbols.txt
new file mode 100644
index 0000000..0ac9e5e
--- /dev/null
+++ b/gsettings/symbols.txt
@@ -0,0 +1,3 @@
+g_io_module_load
+g_io_module_query
+g_io_module_unload
diff --git a/tests/abicheck.sh b/tests/abicheck.sh
new file mode 100755
index 0000000..7d90c17
--- /dev/null
+++ b/tests/abicheck.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# The following checks that a given binary only defines the symbols
+# specified
+#
+# We also make sure to ignore gcov symbols included when building with
+# --coverage, which usually means the following:
+#
+# __gcov_error_file
+# __gcov_master
+# __gcov_sort_n_vals
+# __gcov_var
+#
+# And starting with gcc-9, also this one:
+#
+# mangle_path
+
+set -x
+
+if test $# != 2; then
+ echo " Usage: $0 <binary> <symbol_file>"
+ echo " symbol_file is a file where each line is the name of an exported symbol"
+ exit 1
+fi
+
+BINARY="$1"
+SYMBOL_FILE="$2"
+
+${NM:-nm} --dynamic --defined-only "$BINARY" | \
+ cut -f 3 -d ' ' | \
+ grep -v ^_ | \
+ grep -v ^environ | \
+ grep -v __progname | \
+ grep -v ^mangle_path | \
+ diff "$SYMBOL_FILE" -
diff --git a/tests/meson.build b/tests/meson.build
index 0d4260f..19f693a 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -48,6 +48,23 @@ foreach unit_test: unit_tests
test(unit_test[0], exe, is_parallel: false, env: envs)
endforeach
+symbol_test = find_program('abicheck.sh')
+
+abi_tests = [
+ ['gsettings', libdconf_settings, files('../gsettings/symbols.txt')[0]],
+ ['libdconf', libdconf, files('../client/symbols.txt')[0]],
+]
+
+foreach abi_test: abi_tests
+ test(
+ abi_test[0],
+ symbol_test,
+ env: envs,
+ args: [abi_test[1].full_path(), abi_test[2]],
+ )
+endforeach
+
+
python3 = find_program('python3', required: false)
dbus_daemon = find_program('dbus-daemon', required: false)