build-sys: Add "release build" flag, use for symbol versioning
authorColin Walters <walters@verbum.org>
Mon, 19 Jun 2017 14:23:21 +0000 (10:23 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 19 Jun 2017 14:54:59 +0000 (14:54 +0000)
I was trying to do a release and move the symbols from `-devel.sym` into
`-release.sym`, but it turns out that at least GNU binutils `ld` treats an empty
version script as a syntax error.  Fix this by adding a "release build"
flag, and only include `-devel` in non-release builds.

This would also make it easier to inject that flag into our `.pc` and
`ostree-version.h` and `ostree --version` metadata, but I didn't do that yet.

EDIT: Turns out a simpler fix is just to add an empty section. However I kept
this commit since it's a useful sanity check for whether we should include
`-devel.sym` in builds, and we may want to inject the metadata later.

Closes: #942
Approved by: jlebon

Makefile-libostree.am
configure.ac

index 3c2b6237d927e94600c0d6487e4428dca47021c2..61ad1f4a34969afda5eed54c5c80779b89e36c3c 100644 (file)
@@ -155,8 +155,10 @@ libostree_1_la_SOURCES += \
        $(NULL)
 endif
 
-symbol_files = $(top_srcdir)/src/libostree/libostree-released.sym \
-               $(top_srcdir)/src/libostree/libostree-devel.sym
+symbol_files = $(top_srcdir)/src/libostree/libostree-released.sym
+if BUILDOPT_IS_DEVEL_BUILD
+symbol_files += $(top_srcdir)/src/libostree/libostree-devel.sym
+endif
 if ENABLE_EXPERIMENTAL_API
 symbol_files += $(top_srcdir)/src/libostree/libostree-experimental.sym
 endif
@@ -164,7 +166,6 @@ endif
 wl_versionscript_arg = -Wl,--version-script=
 EXTRA_DIST += $(symbol_files)
 
-
 libostree_1_la_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/bsdiff -I$(srcdir)/libglnx -I$(srcdir)/src/libotutil -I$(srcdir)/src/libostree -I$(builddir)/src/libostree \
        $(OT_INTERNAL_GIO_UNIX_CFLAGS) $(OT_INTERNAL_GPGME_CFLAGS) $(OT_DEP_LZMA_CFLAGS) $(OT_DEP_ZLIB_CFLAGS) $(OT_DEP_OPENSSL_CFLAGS) \
        -fvisibility=hidden '-D_OSTREE_PUBLIC=__attribute__((visibility("default"))) extern'
index cf8a01b8eabd099caf22f93f2854a932c11edd2f..448c7f4ea935feac13fea06bb3efd0ecda27de98 100644 (file)
@@ -1,12 +1,13 @@
 AC_PREREQ([2.63])
 dnl If doing a final release, remember to follow the instructions to
 dnl update libostree-released.sym from libostree-devel.sym, and update the checksum
-dnl in test-symbols.sh
+dnl in test-symbols.sh, and also set is_release_build=yes below.  Then make
+dnl another post-release commit to bump the version, and set is_release_build=no.
 m4_define([year_version], [2017])
 m4_define([release_version], [7])
 m4_define([package_version], [year_version.release_version])
-
 AC_INIT([libostree], [package_version], [walters@verbum.org])
+is_release_build=no
 AC_CONFIG_HEADER([config.h])
 AC_CONFIG_MACRO_DIR([buildutil])
 AC_CONFIG_AUX_DIR([build-aux])
@@ -458,6 +459,8 @@ AS_IF([test x$enable_experimental_api = xyes],
    OSTREE_FEATURES="$OSTREE_FEATURES experimental"]
 )
 AM_CONDITIONAL([ENABLE_EXPERIMENTAL_API],[test x$enable_experimental_api = xyes])
+AM_CONDITIONAL([BUILDOPT_IS_DEVEL_BUILD],[test x$is_release_build != xyes])
+AM_COND_IF([BUILDOPT_IS_DEVEL_BUILD], release_build_type=devel, release_build_type=release)
 
 AC_CONFIG_FILES([
 Makefile
@@ -468,7 +471,7 @@ src/libostree/ostree-version.h
 AC_OUTPUT
 
 echo "
-    libOSTree $VERSION
+    libOSTree $VERSION ($release_build_type)
     ===============