build-sys: Add "release build" flag, use for symbol versioning

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
This commit is contained in:
Colin Walters 2017-06-19 10:23:21 -04:00 committed by Atomic Bot
parent 22e753176e
commit a45dc0fd0b
2 changed files with 10 additions and 6 deletions

View 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'

View 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)
===============