[json-glib] build: Add abicheck.sh



commit f91117fcc066fb20204aa34c979d7fb199f0f38a
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sat Jun 30 14:50:51 2012 +0100

    build: Add abicheck.sh
    
    The abicheck.sh script is used to check that the actural ABI we expose
    in our shared library is the same as the expected one we encode inside
    the json-glib.symbols file.
    
    Using abicheck.sh at check time, we can verify that: a) the symbols file
    is up to date and b) we're not unintentionally leaking private symbols
    to the outside world.

 configure.ac          |   13 ++++++++++++-
 json-glib/Makefile.am |    6 ++++++
 json-glib/abicheck.sh |    6 ++++++
 3 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f2d197c..5f85f3d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,6 +68,9 @@ JSON_LT_LDFLAGS="-version-info $JSON_LT_VERSION"
 
 dnl === Platform checks =======================================================
 
+platform_linux=no
+platform_win32=no
+
 AC_CANONICAL_HOST
 AC_MSG_CHECKING([if building for some Win32 platform])
 AS_CASE([$host],
@@ -78,10 +81,18 @@ AS_CASE([$host],
           platform_win32=yes
         ],
 
-        [platform_win32=no]
+        [*-*-linux*],
+        [
+          platform_linux=yes
+        ],
+
+        []
 )
 AC_MSG_RESULT([$platform_win32])
 
+AM_CONDITIONAL(OS_LINUX, [test "$platform_linux" = "yes"])
+AM_CONDITIONAL(OS_WIN32, [test "$platform_win32" = "yes"])
+
 AC_SUBST(JSON_LT_LDFLAGS)
 
 dnl === Dependencies ==========================================================
diff --git a/json-glib/Makefile.am b/json-glib/Makefile.am
index 01969f5..0b84d74 100644
--- a/json-glib/Makefile.am
+++ b/json-glib/Makefile.am
@@ -92,6 +92,12 @@ EXTRA_DIST += json-version.h.in json-glib.h json-version.h
 
 TESTS_ENVIRONMENT = srcdir="$(srcdir)" json_all_c_sources="$(source_c)"
 
+if OS_LINUX
+TESTS = abicheck.sh
+endif
+
+EXTRA_DIST += abicheck.sh
+
 # intospection
 -include $(INTROSPECTION_MAKEFILE)
 
diff --git a/json-glib/abicheck.sh b/json-glib/abicheck.sh
new file mode 100755
index 0000000..0cba7f9
--- /dev/null
+++ b/json-glib/abicheck.sh
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+cpp -P ${cppargs} ${srcdir:-.}/json-glib.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' -e 's/ PRIVATE//' -e 's/ DATA//' | sort > expected-abi
+
+nm -D -g --defined-only .libs/libjson-glib-1.0.so | cut -d ' ' -f 3 | egrep -v '^(__bss_start|_edata|_end)' | sort > actual-abi
+diff -u expected-abi actual-abi && rm -f expected-abi actual-abi



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]