aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-11-28 11:03:04 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-11-28 11:03:04 +0200
commit9190569b69e34468841b18b33c98f78e66a3d26e (patch)
tree927fc02afec55b8b6d3b31f4b0abc527cdfc22f3
parentb71fa164192f1af8b702e1578cf202b510a9b281 (diff)
Add config.hxx.in config header, move stage status there
-rw-r--r--build/root.build2
-rw-r--r--build2/.gitignore1
-rw-r--r--build2/buildfile5
-rw-r--r--build2/config.hxx.in28
-rw-r--r--build2/context.cxx8
-rw-r--r--build2/types.hxx8
6 files changed, 43 insertions, 9 deletions
diff --git a/build/root.build b/build/root.build
index f6be793..24741ec 100644
--- a/build/root.build
+++ b/build/root.build
@@ -2,6 +2,8 @@
# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
+using in
+
cxx.std = latest
using cxx
diff --git a/build2/.gitignore b/build2/.gitignore
index eda023f..5ea3913 100644
--- a/build2/.gitignore
+++ b/build2/.gitignore
@@ -2,4 +2,5 @@ b
b-boot
#*-options
#*-options.?xx
+config.hxx
version.hxx
diff --git a/build2/buildfile b/build2/buildfile
index 1609ea4..ce9f7d7 100644
--- a/build2/buildfile
+++ b/build2/buildfile
@@ -7,10 +7,11 @@ import libs += libpkgconf%lib{pkgconf}
exe{b}: cxx{b} libue{b}
-libue{b}: {hxx ixx txx cxx}{** -b -b-options -version} \
- {hxx ixx cxx}{b-options} {hxx}{version} \
+libue{b}: {hxx ixx txx cxx}{** -b -b-options -config -version} \
+ {hxx ixx cxx}{b-options} {hxx}{config version} \
$libs
+hxx{config}: in{config}
hxx{version}: in{version} $src_root/manifest
# Pass our compiler target to be used as build2 host.
diff --git a/build2/config.hxx.in b/build2/config.hxx.in
new file mode 100644
index 0000000..af42fcd
--- /dev/null
+++ b/build2/config.hxx.in
@@ -0,0 +1,28 @@
+// file : build2/config.hxx.in -*- C++ -*-
+// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+// This file is included by <build2/types.hxx> so normally you don't need to
+// include it directly. Note that this file is included unprocessed (i.e., as
+// an .in) during bootstrap.
+//
+// Also, note that some BUILD_* configuration macros are passed directly from
+// the buildfile with the -D options.
+
+#ifndef BUILD2_CONFIG_HXX
+#define BUILD2_CONFIG_HXX
+
+// Currently the value is adjusted manually during release but in the future
+// the idea is to use version metadata (e.g., 1.2.3-a.1+0.stage). This way it
+// will all be managed in a central place (manifest), we can teach the version
+// module to extract it, and we can also set it for the other packages in the
+// toolchain. Bootstrap will be a problem though. (Maybe set it to nullptr and
+// say that it shall not be queried?)
+//
+#define BUILD2_STAGE true
+
+#ifdef BUILD2_BOOTSTRAP
+#else
+#endif
+
+#endif // BUILD2_CONFIG_HXX
diff --git a/build2/context.cxx b/build2/context.cxx
index 10995e6..142a99d 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -477,13 +477,7 @@ namespace build2
// Note that it is either staged or public, without queued, since we do
// not re-package things during the queued-to-public transition.
//
- // Currently the value is adjusted manually during release but in the
- // future the idea is to use version metadata (e.g., 1.2.3-a.1+0.stage).
- // This way it will all be managed in a central place (manifest), we
- // can teach the version module to extract it, and we can also set it
- // for the other packages in the toolchain.
- //
- set ("build.version.stage", true);
+ set ("build.version.stage", BUILD2_STAGE);
}
// Enter the host information. Rather than jumping through hoops like
diff --git a/build2/types.hxx b/build2/types.hxx
index 32780ef..a84a433 100644
--- a/build2/types.hxx
+++ b/build2/types.hxx
@@ -5,6 +5,14 @@
#ifndef BUILD2_TYPES_HXX
#define BUILD2_TYPES_HXX
+// Include unprocessed file during bootstrap. See config.hxx.in for details.
+//
+#ifdef BUILD2_BOOTSTRAP
+# include <build2/config.hxx.in>
+#else
+# include <build2/config.hxx>
+#endif
+
#include <array>
#include <tuple>
#include <vector>