aboutsummaryrefslogtreecommitdiff
path: root/bpkg
diff options
context:
space:
mode:
Diffstat (limited to 'bpkg')
-rw-r--r--bpkg/.gitignore1
-rw-r--r--bpkg/buildfile9
-rw-r--r--bpkg/manifest1
-rw-r--r--bpkg/version37
-rw-r--r--bpkg/version.in44
5 files changed, 52 insertions, 40 deletions
diff --git a/bpkg/.gitignore b/bpkg/.gitignore
new file mode 100644
index 0000000..088eda4
--- /dev/null
+++ b/bpkg/.gitignore
@@ -0,0 +1 @@
+version
diff --git a/bpkg/buildfile b/bpkg/buildfile
index 74ee29a..7def27f 100644
--- a/bpkg/buildfile
+++ b/bpkg/buildfile
@@ -10,13 +10,16 @@ lib{bpkg}: \
{hxx }{ version } \
$int_libs
+hxx{version}: in{version} $src_root/file{manifest}
+hxx{version}: dist = true
+
# For pre-releases use the complete version to make sure they cannot be used
# in place of another pre-release or the final version.
#
-if $abi_prerelease
- lib{bpkg}: bin.lib.version = @-$version
+if $version.pre_release
+ lib{bpkg}: bin.lib.version = @"-$version.project_id"
else
- lib{bpkg}: bin.lib.version = @-$abi_major.$abi_minor
+ lib{bpkg}: bin.lib.version = @"-$version.major.$version.minor"
cxx.poptions =+ "-I$src_root"
obja{*}: cxx.poptions += -DLIBBPKG_STATIC_BUILD
diff --git a/bpkg/manifest b/bpkg/manifest
index f638592..d6caabf 100644
--- a/bpkg/manifest
+++ b/bpkg/manifest
@@ -18,6 +18,7 @@
#include <butl/manifest-forward>
#include <bpkg/export>
+#include <bpkg/version>
namespace bpkg
{
diff --git a/bpkg/version b/bpkg/version
deleted file mode 100644
index acbf1f8..0000000
--- a/bpkg/version
+++ /dev/null
@@ -1,37 +0,0 @@
-// file : bpkg/version -*- C++ -*-
-// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
-// license : MIT; see accompanying LICENSE file
-
-#ifndef LIBBPKG_VERSION // Note: using the version macro itself.
-
-#include <butl/version> // LIBBUTL_VERSION
-
-// Version format is AABBCCDD where
-//
-// AA - major version number
-// BB - minor version number
-// CC - bugfix version number
-// DD - alpha / beta (DD + 50) version number
-//
-// When DD is not 00, 1 is subtracted from AABBCC. For example:
-//
-// Version AABBCCDD
-// 2.0.0 02000000
-// 2.1.0 02010000
-// 2.1.1 02010100
-// 2.2.0-a1 02019901
-// 3.0.0-b2 02999952
-//
-#define LIBBPKG_VERSION 49901
-#define LIBBPKG_VERSION_STR "0.5.0-a1"
-
-// Generally, we expect minor versions to be source code backwards-
-// compatible, thought we might have a minimum version requirement.
-//
-// Note: does not apply during early development.
-//
-#if LIBBUTL_VERSION != 49901
-# error incompatible libbutl version
-#endif
-
-#endif // LIBBPKG_VERSION
diff --git a/bpkg/version.in b/bpkg/version.in
new file mode 100644
index 0000000..da8d84c
--- /dev/null
+++ b/bpkg/version.in
@@ -0,0 +1,44 @@
+// file : bpkg/version -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef LIBBPKG_VERSION // Note: using the version macro itself.
+
+// Note: using build2 standard versioning scheme. The numeric version format
+// is AAABBBCCCDDDE where:
+//
+// AAA - major version number
+// BBB - minor version number
+// CCC - bugfix version number
+// DDD - alpha / beta (DDD + 500) version number
+// E - final (0) / snapshot (1)
+//
+// When DDDE is not 0, 1 is subtracted from AAABBBCCC. For example:
+//
+// Version AAABBBCCCDDDE
+//
+// 0.1.0 0000010000000
+// 0.1.2 0000010010000
+// 1.2.3 0010020030000
+// 2.2.0-a.1 0020019990010
+// 3.0.0-b.2 0029999995020
+// 2.2.0-a.1.z 0020019990011
+//
+#define LIBBPKG_VERSION $libbpkg.version.project_number$ULL
+#define LIBBPKG_VERSION_STR "$libbpkg.version.project$"
+#define LIBBPKG_VERSION_ID "$libbpkg.version.project_id$"
+
+#define LIBBPKG_VERSION_MAJOR $libbpkg.version.major$
+#define LIBBPKG_VERSION_MINOR $libbpkg.version.minor$
+#define LIBBPKG_VERSION_PATCH $libbpkg.version.patch$
+
+#define LIBBPKG_PRE_RELEASE $libbpkg.version.pre_release$
+
+#define LIBBPKG_SNAPSHOT $libbpkg.version.snapshot_sn$ULL
+#define LIBBPKG_SNAPSHOT_ID "$libbpkg.version.snapshot_id$"
+
+#include <butl/version>
+
+$libbutl.check(LIBBUTL_VERSION, LIBBUTL_SNAPSHOT)$
+
+#endif // LIBBPKG_VERSION