Commit c260fccd by Maarten L. Hekkelman

versioning

parent d9bf7c94
......@@ -13,7 +13,4 @@ libcifpp.la
config.status
config.log
libtool
rsrc/lib-version.txt
version-info*.txt
src/revision.hpp
test/pdb2cif-test
......@@ -64,8 +64,8 @@ LIB_NAME = @PACKAGE_NAME@
LIB_VERSION = @LIBCIF_LT_VERSION@
LIB_CURRENT = @LIBCIF_LT_CURRENT@
LIB_TARGET = $(LIB_NAME).la
VERSION = @PACKAGE_VERSION@
DIST_NAME = @PACKAGE_NAME@-$(subst :,.,$(LIB_VERSION))
VERSION = @LIBCIF_SEMANTIC_VERSION@
DIST_NAME = @PACKAGE_NAME@-$(subst :,.,$(VERSION))
# libtool stuff
......@@ -133,6 +133,37 @@ $(OBJDIR)/Symmetry.lo: src/SymOpTable_data.cpp
endif
# We have development releases and official releases, for each we
# maintain different versioning schemes.
ifneq "x@UPDATE_REVISION@" "x"
REVISION = $(shell git log --pretty=format:%h --max-count=1)
REVISION_FILE = version-info-$(REVISION).txt
$(REVISION_FILE):
rm -f version-info-*.txt
@ echo libcifpp-version: $(VERSION) > $@
@ git describe --match=build --dirty >> $@
@ git log --pretty=medium --date=iso8601 -1 >> $@
src/revision.hpp: $(REVISION_FILE)
@ echo 'const char kRevision[] = R"(' > $@
@ cat $? >> $@
@ echo ')";' >> $@
else
src/revision.hpp:
@ echo 'const char kRevision[] = R"(' > $@
@ echo libcifpp-version: $(VERSION) >> $@
@ echo ')";' >> $@
endif
$(OBJDIR)/CifUtils.o: src/revision.hpp
$(OBJDIR)/CifUtils.lo: src/revision.hpp
$(LIB_TARGET): $(OBJECTS)
$(CXXLINK) -rpath $(libdir) $(OBJECTS) $(LIBS)
......
......@@ -646,7 +646,9 @@ BOOST_CPPFLAGS
SET_MAKE
PKG_CONFIG
CCP4
UPDATE_REVISION
DEBUG
LIBCIF_SEMANTIC_VERSION
LIBCIF_LT_VERSION
LIBCIF_LT_CURRENT
LIBTOOL_DEPS
......@@ -766,6 +768,7 @@ CC
CFLAGS
LT_SYS_LIBRARY_PATH
DEBUG
UPDATE_REVISION
CCP4
LIBZ_CPPFLAGS
LIBZ_LDFLAGS
......@@ -1446,6 +1449,8 @@ Some influential environment variables:
LT_SYS_LIBRARY_PATH
User-defined run-time library search path.
DEBUG Build a debug version of the library
UPDATE_REVISION
Update the revision.hpp file
CCP4 The location where CCP4 is installed
LIBZ_CPPFLAGS
C preprocessor flags for LIBZ headers
......@@ -16081,6 +16086,11 @@ LIBCIF_LT_VERSION="${LIBCIF_CURRENT}:${LIBCIF_REVISION}:${LIBCIF_AGE}"
LIBCIF_SEMANTIC_VERSION=1.0.0
......
......@@ -57,7 +57,7 @@ dnl LT_INIT([disable-shared])
LT_INIT
AC_SUBST(LIBTOOL_DEPS)
dnl versioning
dnl versioning, first for libtool
LIBCIF_CURRENT=1
LIBCIF_REVISION=0
LIBCIF_AGE=0
......@@ -68,8 +68,14 @@ LIBCIF_LT_VERSION="${LIBCIF_CURRENT}:${LIBCIF_REVISION}:${LIBCIF_AGE}"
AC_SUBST(LIBCIF_LT_CURRENT)
AC_SUBST(LIBCIF_LT_VERSION)
dnl and now for the semantic version
LIBCIF_SEMANTIC_VERSION=1.0.0
AC_SUBST(LIBCIF_SEMANTIC_VERSION)
AC_ARG_VAR([DEBUG], [Build a debug version of the library])
AC_ARG_VAR([UPDATE_REVISION], [Update the revision.hpp file])
AC_ARG_VAR([CCP4], [The location where CCP4 is installed])
AC_PATH_PROG([PKG_CONFIG], [pkg-config])
......
......@@ -64,7 +64,8 @@ extern int VERBOSE;
std::string get_version_nr()
{
const std::regex
rxVersionNr(R"(build-(\d+)-g[0-9a-f]{7}(-dirty)?)");
rxVersionNr1(R"(build-(\d+)-g[0-9a-f]{7}(-dirty)?)"),
rxVersionNr2(R"(libcifpp-version: (\d+\.\d+\.\d+))");
#include "revision.hpp"
......@@ -81,13 +82,17 @@ std::string get_version_nr()
{
std::smatch m;
if (std::regex_match(line, m, rxVersionNr))
if (std::regex_match(line, m, rxVersionNr1))
{
result = m[1];
if (m[2].matched)
result += '*';
break;
}
// always the first, replace with more specific if followed by the other info
if (std::regex_match(line, m, rxVersionNr2))
result = m[1];
}
return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment