[PATCH] build: use symbol versioning

Jan Engelhardt jengelh at inai.de
Tue Sep 9 10:08:50 PDT 2014


Symbol versions provide a means by which ELF utilities can determine
whether a program is incompatible with a too-old library version so
that package management tools can autodetect version-based
dependencies and suggest upgrade paths.

Signed-off-by: Jan Engelhardt <jengelh at inai.de>
---
The name chosen for symbols ("V_0.4.3") does not play a role as long as it is
unique within a particular .so file. Therefore, there is also no requirement
to use fancy long names like LIBXKBCOMMON_0.4.3.

 Makefile.am       |  2 ++
 xkbcommon-x11.map | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 xkbcommon.map     |  9 +++++++
 3 files changed, 84 insertions(+)
 create mode 100644 xkbcommon-x11.map
 create mode 100644 xkbcommon.map

diff --git a/Makefile.am b/Makefile.am
index 6ad2cd6..ccba897 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -84,6 +84,7 @@ libxkbcommon_la_SOURCES = \
 	src/utf8.h \
 	src/utils.c \
 	src/utils.h
+libxkbcommon_la_LDFLAGS = -Wl,--version-script=${srcdir}/xkbcommon-x11.map
 
 if ENABLE_X11
 pkgconfig_DATA += xkbcommon-x11.pc
@@ -97,6 +98,7 @@ lib_LTLIBRARIES += libxkbcommon-x11.la
 libxkbcommon_x11_la_CFLAGS = $(AM_CFLAGS) $(XCB_XKB_CFLAGS)
 libxkbcommon_x11_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/src/x11
 libxkbcommon_x11_la_LIBADD = libxkbcommon.la $(XCB_XKB_LIBS)
+libxkbcommon_x11_la_LDFLAGS = -Wl,--version-script=${srcdir}/xkbcommon.map
 
 libxkbcommon_x11_la_SOURCES = \
 	src/x11/keymap.c \
diff --git a/xkbcommon-x11.map b/xkbcommon-x11.map
new file mode 100644
index 0000000..919c0dc
--- /dev/null
+++ b/xkbcommon-x11.map
@@ -0,0 +1,73 @@
+V_0.4.3 {
+global:
+	xkb_keysym_get_name;
+	xkb_keysym_from_name;
+	xkb_keysym_to_utf8;
+	xkb_keysym_to_utf32;
+	xkb_context_new;
+	xkb_context_ref;
+	xkb_context_unref;
+	xkb_context_set_user_data;
+	xkb_context_get_user_data;
+	xkb_context_include_path_append;
+	xkb_context_include_path_append_default;
+	xkb_context_include_path_reset_defaults;
+	xkb_context_include_path_clear;
+	xkb_context_num_include_paths;
+	xkb_context_include_path_get;
+	xkb_context_set_log_level;
+	xkb_context_get_log_level;
+	xkb_context_set_log_verbosity;
+	xkb_context_get_log_verbosity;
+	xkb_context_set_log_fn;
+	xkb_keymap_new_from_names;
+	xkb_keymap_new_from_file;
+	xkb_keymap_new_from_string;
+	xkb_keymap_new_from_buffer;
+	xkb_keymap_ref;
+	xkb_keymap_unref;
+	xkb_keymap_get_as_string;
+	xkb_keymap_min_keycode;
+	xkb_keymap_max_keycode;
+	xkb_keymap_key_for_each;
+	xkb_keymap_num_mods;
+	xkb_keymap_mod_get_name;
+	xkb_keymap_mod_get_index;
+	xkb_keymap_num_layouts;
+	xkb_keymap_layout_get_name;
+	xkb_keymap_layout_get_index;
+	xkb_keymap_num_layouts_for_key;
+	xkb_keymap_num_levels_for_key;
+	xkb_keymap_key_get_syms_by_level;
+	xkb_keymap_num_leds;
+	xkb_keymap_led_get_name;
+	xkb_keymap_led_get_index;
+	xkb_keymap_key_repeats;
+	xkb_state_new;
+	xkb_state_ref;
+	xkb_state_unref;
+	xkb_state_get_keymap;
+	xkb_state_update_key;
+	xkb_state_update_mask;
+	xkb_state_key_get_syms;
+	xkb_state_key_get_utf8;
+	xkb_state_key_get_utf32;
+	xkb_state_key_get_one_sym;
+	xkb_state_key_get_layout;
+	xkb_state_key_get_level;
+	xkb_state_serialize_mods;
+	xkb_state_serialize_layout;
+	xkb_state_mod_name_is_active;
+	xkb_state_mod_names_are_active;
+	xkb_state_mod_index_is_active;
+	xkb_state_mod_indices_are_active;
+	xkb_state_mod_index_is_consumed;
+	xkb_state_mod_mask_remove_consumed;
+	xkb_state_key_get_consumed_mods;
+	xkb_state_layout_name_is_active;
+	xkb_state_layout_index_is_active;
+	xkb_state_led_name_is_active;
+	xkb_state_led_index_is_active;
+local:
+	*;
+};
diff --git a/xkbcommon.map b/xkbcommon.map
new file mode 100644
index 0000000..c1a3240
--- /dev/null
+++ b/xkbcommon.map
@@ -0,0 +1,9 @@
+V_0.4.3 {
+global:
+	xkb_x11_setup_xkb_extension;
+	xkb_x11_get_core_keyboard_device_id;
+	xkb_x11_keymap_new_from_device;
+	xkb_x11_state_new_from_device;
+local:
+	*;
+};
-- 
2.0.0



More information about the wayland-devel mailing list