From 67ab77401f4b1c4580b7ce54a783843e31a55ebb Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 28 Apr 2017 16:20:35 +0300 Subject: Switch to version module --- bpkg/.gitignore | 1 + bpkg/bpkg-version | 81 ----------------------------------------------- bpkg/bpkg.cxx | 1 - bpkg/buildfile | 5 ++- bpkg/fetch.cxx | 1 - bpkg/satisfaction.cxx | 1 - bpkg/utility | 1 + bpkg/version-impl.in | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 93 insertions(+), 85 deletions(-) delete mode 100644 bpkg/bpkg-version create mode 100644 bpkg/version-impl.in (limited to 'bpkg') diff --git a/bpkg/.gitignore b/bpkg/.gitignore index 782196c..dde5e32 100644 --- a/bpkg/.gitignore +++ b/bpkg/.gitignore @@ -5,3 +5,4 @@ bpkg *-odb.?xx repository-signing repository-signing.cxx +version-impl diff --git a/bpkg/bpkg-version b/bpkg/bpkg-version deleted file mode 100644 index 05a93c1..0000000 --- a/bpkg/bpkg-version +++ /dev/null @@ -1,81 +0,0 @@ -// file : bpkg/bpkg-version -*- C++ -*- -// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#ifndef BPKG_VERSION // Note: using the version macro itself. - -#include // LIBBUTL_VERSION -#include // LIBBPKG_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 BPKG_VERSION 49901 -#define BPKG_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 - -#if LIBBPKG_VERSION != 49901 -# error incompatible libbpkg version -#endif - -// User agent. -// -#if defined(_WIN32) -# if defined(__MINGW32__) -# define BPKG_OS "MinGW" -# else -# define BPKG_OS "Windows" -# endif -#elif defined(__linux) -# define BPKG_OS "GNU/Linux" -#elif defined(__APPLE__) -# define BPKG_OS "MacOS" -#elif defined(__CYGWIN__) -# define BPKG_OS "Cygwin" -#elif defined(__FreeBSD__) -# define BPKG_OS "FreeBSD" -#elif defined(__OpenBSD__) -# define BPKG_OS "OpenBSD" -#elif defined(__NetBSD__) -# define BPKG_OS "NetBSD" -#elif defined(__sun) -# define BPKG_OS "Solaris" -#elif defined(__hpux) -# define BPKG_OS "HP-UX" -#elif defined(_AIX) -# define BPKG_OS "AIX" -#elif defined(__unix) -# define BPKG_OS "Unix" -#elif defined(__posix) -# define BPKG_OS "Posix" -#else -# define BPKG_OS "Other" -#endif - -#define BPKG_USER_AGENT \ - "bpkg/" BPKG_VERSION_STR " (" BPKG_OS "; +https://build2.org)" \ - " libbpkg/" LIBBPKG_VERSION_STR \ - " libbutl/" LIBBUTL_VERSION_STR - -#endif // BPKG_VERSION diff --git a/bpkg/bpkg.cxx b/bpkg/bpkg.cxx index 57375a4..e78e732 100644 --- a/bpkg/bpkg.cxx +++ b/bpkg/bpkg.cxx @@ -16,7 +16,6 @@ #include #include -#include // Commands. // diff --git a/bpkg/buildfile b/bpkg/buildfile index 6ce401d..1ed635b 100644 --- a/bpkg/buildfile +++ b/bpkg/buildfile @@ -10,7 +10,6 @@ import libs += libodb-sqlite%lib{odb-sqlite} exe{bpkg}: \ {hxx cxx}{ archive } \ {hxx cxx}{ auth } \ -{hxx }{ bpkg-version } \ { cxx}{ bpkg } {hxx ixx cxx}{ bpkg-options } \ {hxx cxx}{ cfg-create } {hxx ixx cxx}{ cfg-create-options } \ {hxx cxx}{ checksum } \ @@ -51,9 +50,13 @@ exe{bpkg}: \ {hxx }{ types } \ {hxx cxx}{ types-parsers } \ {hxx cxx}{ utility } \ +{hxx }{ version-impl } \ {hxx }{ wrapper-traits } \ $libs +hxx{version-impl}: in{version-impl} $src_root/file{manifest} +hxx{version-impl}: dist = true + # Disable "unknown pragma" warnings. # if ($cxx.id == "msvc") diff --git a/bpkg/fetch.cxx b/bpkg/fetch.cxx index c650958..6fe851e 100644 --- a/bpkg/fetch.cxx +++ b/bpkg/fetch.cxx @@ -13,7 +13,6 @@ #include #include -#include using namespace std; using namespace butl; diff --git a/bpkg/satisfaction.cxx b/bpkg/satisfaction.cxx index 6958328..bf033e9 100644 --- a/bpkg/satisfaction.cxx +++ b/bpkg/satisfaction.cxx @@ -10,7 +10,6 @@ #include #include #include -#include using namespace std; using namespace butl; diff --git a/bpkg/utility b/bpkg/utility index b562d04..6f4c3ca 100644 --- a/bpkg/utility +++ b/bpkg/utility @@ -18,6 +18,7 @@ #include #include +#include namespace bpkg { diff --git a/bpkg/version-impl.in b/bpkg/version-impl.in new file mode 100644 index 0000000..053c129 --- /dev/null +++ b/bpkg/version-impl.in @@ -0,0 +1,87 @@ +// file : bpkg/version-impl.in -*- C++ -*- +// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef BPKG_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 BPKG_VERSION $bpkg.version.project_number$ULL +#define BPKG_VERSION_STR "$bpkg.version.project$" +#define BPKG_VERSION_ID "$bpkg.version.project_id$" + +#define BPKG_VERSION_MAJOR $bpkg.version.major$ +#define BPKG_VERSION_MINOR $bpkg.version.minor$ +#define BPKG_VERSION_PATCH $bpkg.version.patch$ + +#define BPKG_PRE_RELEASE $bpkg.version.pre_release$ + +#define BPKG_SNAPSHOT $bpkg.version.snapshot_sn$ULL +#define BPKG_SNAPSHOT_ID "$bpkg.version.snapshot_id$" + +#include + +$libbutl.check(LIBBUTL_VERSION, LIBBUTL_SNAPSHOT)$ + +#include + +$libbpkg.check(LIBBPKG_VERSION, LIBBPKG_SNAPSHOT)$ + +// User agent. +// +#if defined(_WIN32) +# if defined(__MINGW32__) +# define BPKG_OS "MinGW" +# else +# define BPKG_OS "Windows" +# endif +#elif defined(__linux) +# define BPKG_OS "GNU/Linux" +#elif defined(__APPLE__) +# define BPKG_OS "MacOS" +#elif defined(__CYGWIN__) +# define BPKG_OS "Cygwin" +#elif defined(__FreeBSD__) +# define BPKG_OS "FreeBSD" +#elif defined(__OpenBSD__) +# define BPKG_OS "OpenBSD" +#elif defined(__NetBSD__) +# define BPKG_OS "NetBSD" +#elif defined(__sun) +# define BPKG_OS "Solaris" +#elif defined(__hpux) +# define BPKG_OS "HP-UX" +#elif defined(_AIX) +# define BPKG_OS "AIX" +#elif defined(__unix) +# define BPKG_OS "Unix" +#elif defined(__posix) +# define BPKG_OS "Posix" +#else +# define BPKG_OS "Other" +#endif + +#define BPKG_USER_AGENT \ + "bpkg/" BPKG_VERSION_STR " (" BPKG_OS "; +https://build2.org)" \ + " libbpkg/" LIBBPKG_VERSION_STR \ + " libbutl/" LIBBUTL_VERSION_STR + +#endif // BPKG_VERSION -- cgit v1.1