From 33b0be6d60cc793951623feb6b8a2d1177112aca Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 28 Apr 2009 22:51:53 +0200 Subject: [PATCH] blkid: split SONAME and LIBBLKID_VERSION It seems better to split SONAME and the public library version. The library version will be the same as util-linux-ng PACKAGE_VERSION. PACKAGE_VERSION: .[-] e.g. 2.15-rc2 Symbols versioning: BLKID_. e.g. BLKID_2.15 blkid_get_library_version(): ..0 e.g. 2.15.0 SONAME: libblkid.so.1 See also the original patch a0487b1cb5beffb8f6783476664b01e8833e0ea8 where was introduced library versioning. Signed-off-by: Karel Zak --- configure.ac | 27 +++++++++++---------------- libs/blkid/bin/blkid.c | 2 +- libs/blkid/blkid.pc.in | 2 +- libs/blkid/src/Makefile.am | 4 ++-- libs/blkid/src/blkid.sym | 6 +++--- libs/blkid/src/version.c | 12 ++++++++++-- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/configure.ac b/configure.ac index 017958f7..96244573 100644 --- a/configure.ac +++ b/configure.ac @@ -11,16 +11,15 @@ AC_CONFIG_SRCDIR(mount/mount.c) AC_PREFIX_DEFAULT([/usr]) -dnl blkid version definition (the library SONAME is -dnl "libblkid.so.$BLKID_VERSION_MAJOR", see blkid/Makefile.am) -dnl ---------------------------------------------------------- -BLKID_VERSION_MAJOR=1 -BLKID_VERSION_MINOR=99 -BLKID_VERSION_RELEASE=0 -BLKID_DATE="10-Feb-2009" +dnl version details from .[-] +PACKAGE_VERSION_MAJOR=$(echo $PACKAGE_VERSION | awk -F. '{print $1}') +PACKAGE_VERSION_MINOR=$(echo $PACKAGE_VERSION | awk -F. '{print $2}' \ + | awk -F- '{print $1}') +PACKAGE_VERSION_RELEASE=0 -BLKID_VERSION=$BLKID_VERSION_MAJOR.$BLKID_VERSION_MINOR.$BLKID_VERSION_RELEASE -BLKID_VERSION_INFO=`expr $BLKID_VERSION_MAJOR + $BLKID_VERSION_MINOR`:$BLKID_VERSION_RELEASE:$BLKID_VERSION_MINOR +dnl libblkid version +LIBBLKID_VERSION="$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_RELEASE" +LIBBLKID_DATE="10-Feb-2009" # Check whether exec_prefix=/usr: case $exec_prefix:$prefix in @@ -188,13 +187,9 @@ elif test "x$with_fsprobe" = xbuiltin; then have_blkid=yes build_libblkid=yes have_blkid_evaluate=yes - AC_SUBST(BLKID_VERSION_MAJOR) - AC_SUBST(BLKID_VERSION_MINOR) - AC_SUBST(BLKID_VERSION_RELEASE) - AC_SUBST(BLKID_VERSION) - AC_SUBST(BLKID_VERSION_INFO) - AC_DEFINE_UNQUOTED(BLKID_VERSION, "$BLKID_VERSION", [libblkid version string]) - AC_DEFINE_UNQUOTED(BLKID_DATE, "$BLKID_DATE", [libblkid date string]) + AC_SUBST(LIBBLKID_VERSION) + AC_DEFINE_UNQUOTED(LIBBLKID_VERSION, "$LIBBLKID_VERSION", [libblkid version string]) + AC_DEFINE_UNQUOTED(LIBBLKID_DATE, "$LIBBLKID_DATE", [libblkid date string]) fi if test "x$have_blkid" = xyes; then diff --git a/libs/blkid/bin/blkid.c b/libs/blkid/bin/blkid.c index 620344e4..72b22c3d 100644 --- a/libs/blkid/bin/blkid.c +++ b/libs/blkid/bin/blkid.c @@ -45,7 +45,7 @@ const char *progname = "blkid"; static void print_version(FILE *out) { fprintf(out, "%s from %s (libblkid %s, %s)\n", - progname, PACKAGE_STRING, BLKID_VERSION, BLKID_DATE); + progname, PACKAGE_STRING, LIBBLKID_VERSION, LIBBLKID_DATE); } static void usage(int error) diff --git a/libs/blkid/blkid.pc.in b/libs/blkid/blkid.pc.in index 69557508..5d58c3e1 100644 --- a/libs/blkid/blkid.pc.in +++ b/libs/blkid/blkid.pc.in @@ -5,7 +5,7 @@ includedir=@includedir@ Name: blkid Description: Block device id library -Version: @BLKID_VERSION@ +Version: @LIBBLKID_VERSION@ Requires.private: uuid Cflags: -I${includedir}/blkid Libs: -L${libdir} -lblkid diff --git a/libs/blkid/src/Makefile.am b/libs/blkid/src/Makefile.am index 8c95a47f..805d0899 100644 --- a/libs/blkid/src/Makefile.am +++ b/libs/blkid/src/Makefile.am @@ -29,9 +29,9 @@ libblkid_la_LIBADD = probers/libblkid_probers.la $(common_ldadd) libblkid_la_DEPENDENCIES = $(libblkid_la_LIBADD) blkid.sym # TODO: for unknown reason "make distcheck" requires -# full path to the version string +# full path to the version script libblkid_la_LDFLAGS = -Wl,--version-script=$(top_srcdir)/libs/blkid/src/blkid.sym \ - -version-info @BLKID_VERSION_INFO@ + -version-info 1:0:0 tests = test_cache test_config test_dev test_devname test_devno test_getsize \ test_read test_resolve test_save test_tag test_verify test_evaluate diff --git a/libs/blkid/src/blkid.sym b/libs/blkid/src/blkid.sym index e08df0f5..abb8e51f 100644 --- a/libs/blkid/src/blkid.sym +++ b/libs/blkid/src/blkid.sym @@ -3,7 +3,7 @@ * can't run with old libblkid.so not providing foo() - the global SONAME * version info can't enforce this since we never change the SONAME. * - * The original libblkid (.so version 1.0) from e2fsprogs does not to use + * The original libblkid from e2fsprogs (<=1.41.4) does not to use * symbol versioning -- all the original symbols are in BLKID_1.0 now. */ BLKID_1.0 { @@ -39,9 +39,9 @@ local: /* - * util-linux-ng version(s) + * version(s) since util-linux-ng 2.15 */ -BLKID_1.42 { +BLKID_2.15 { global: blkid_do_probe; blkid_do_safeprobe; diff --git a/libs/blkid/src/version.c b/libs/blkid/src/version.c index 5d75e8f6..838af114 100644 --- a/libs/blkid/src/version.c +++ b/libs/blkid/src/version.c @@ -18,8 +18,9 @@ #include "blkid.h" -static const char *lib_version = BLKID_VERSION; -static const char *lib_date = BLKID_DATE; +/* LIBBLKID_* defined in the global config.h */ +static const char *lib_version = LIBBLKID_VERSION; /* release version */ +static const char *lib_date = LIBBLKID_DATE; int blkid_parse_version_string(const char *ver_string) { @@ -36,6 +37,13 @@ int blkid_parse_version_string(const char *ver_string) return version; } +/** + * blkid_get_library_version: + * @ver_string: returns relese version (!= SONAME version) + * @date_string: returns date + * + * Returns release version code. + */ int blkid_get_library_version(const char **ver_string, const char **date_string) { -- 2.39.5