[Libosinfo] [libosinfo PATCH 1/2] syms: "export" private syms

Fabiano Fidêncio fidencio at redhat.com
Tue Nov 20 09:26:25 UTC 2018


In a similar way as done in libvirt (and pointed out by Martin
Kletzander), let's have our private symbols also exported so they can be
used in our tests.

This approach is pretty much identical to the libvirt one and now we've
libosinfo_public.syms and libosinfo_private.syms, which will be used to
generate the libosinfo.syms.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 .gitignore                                       |  1 +
 osinfo/Makefile.am                               | 12 ++++++++++++
 osinfo/libosinfo_private.syms                    |  7 +++++++
 osinfo/{libosinfo.syms => libosinfo_public.syms} |  0
 4 files changed, 20 insertions(+)
 create mode 100644 osinfo/libosinfo_private.syms
 rename osinfo/{libosinfo.syms => libosinfo_public.syms} (100%)

diff --git a/.gitignore b/.gitignore
index 951c8a4..1f95c5a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,6 +35,7 @@ stamp-h1
 tags
 tests/test-skeleton
 tests/test-skeleton.sh
+osinfo/libosinfo.syms
 osinfo/libosinfo.pc
 osinfo/Libosinfo-1.0.gir
 osinfo/Libosinfo-1.0.typelib
diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am
index 058653a..e533ee9 100644
--- a/osinfo/Makefile.am
+++ b/osinfo/Makefile.am
@@ -6,6 +6,18 @@ EXTRA_DIST = libosinfo.syms \
 BUILT_SOURCES = osinfo_enum_types.c \
 		osinfo_enum_types.h
 
+libosinfo.syms: libosinfo_public.syms libosinfo_private.syms
+	$(AM_V_GEN)rm -rf $@-tmp $@ ; \
+	printf '# WARNING: generated from the following:\n# $^\n\n' >$@-tmp && \
+	cat $(srcdir)/libosinfo_public.syms >>$@-tmp && \
+	printf '\n\n# Private symbols\n\n' >>$@-tmp && \
+	printf 'LIBOSINFO_PRIVATE_$(VERSION) {\n\n'  >>$@-tmp && \
+	printf 'global:\n\n' >>$@-tmp && \
+	cat libosinfo_private.syms >>$@-tmp && \
+	printf '\n\nlocal:\n*;\n\n};' >>$@-tmp && \
+	chmod a-w $@-tmp && \
+	mv $@-tmp libosinfo.syms
+
 if USE_VERSION_DEFS
 LIBOSINFO_VERSION_FILE = $(builddir)/libosinfo.def
 BUILT_SOURCES += $(LIBOSINFO_VERSION_FILE)
diff --git a/osinfo/libosinfo_private.syms b/osinfo/libosinfo_private.syms
new file mode 100644
index 0000000..df8c37e
--- /dev/null
+++ b/osinfo/libosinfo_private.syms
@@ -0,0 +1,7 @@
+/*
+ * General private symbols.
+ *
+ * Add symbols here, abd see Makefile.am for more details.
+ *
+ * Keep this file sorted by header name, then by symbols with each header!
+ */
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo_public.syms
similarity index 100%
rename from osinfo/libosinfo.syms
rename to osinfo/libosinfo_public.syms
-- 
2.19.1




More information about the Libosinfo mailing list