aboutsummaryrefslogtreecommitdiff
path: root/bpkg/bpkg-version
blob: c9ebe170d730dc01699e97f2213d687d3030269e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// file      : bpkg/bpkg-version -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#ifndef BPKG_VERSION // Note: using the version macro itself.

#include <butl/version> // LIBBUTL_VERSION
#include <bpkg/version> // 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
//
//                       AABBCCDD
#define BPKG_VERSION        10000
#define BPKG_VERSION_STR "0.1.0"

// 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.
//
//                     AABBCCDD
#if (LIBBUTL_VERSION <    10000 || \
     LIBBUTL_VERSION >    10000)
#  error incompatible libbutl version
#endif

#if (LIBBPKG_VERSION <    10000 || \
     LIBBPKG_VERSION >    10000)
#  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 "; +http://build2.org)"      \
  " libbpkg/" LIBBPKG_VERSION_STR                                    \
  " libbutl/" LIBBUTL_VERSION_STR

#endif // BPKG_VERSION