aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README-GIT6
-rw-r--r--bootstrap-mingw.bat1
-rw-r--r--bootstrap-msvc.bat1
-rw-r--r--bootstrap.gmake47
-rwxr-xr-xbootstrap.sh1
-rw-r--r--build/export.build5
-rw-r--r--build/root.build2
-rw-r--r--build2/.gitignore8
-rw-r--r--build2/b-options.hxx2
-rw-r--r--build2/b.cli2
-rw-r--r--build2/b.cxx47
-rw-r--r--build2/bash/init.cxx8
-rw-r--r--build2/bash/init.hxx6
-rw-r--r--build2/bash/rule.cxx8
-rw-r--r--build2/bash/rule.hxx4
-rw-r--r--build2/bash/target.cxx2
-rw-r--r--build2/bash/target.hxx6
-rw-r--r--build2/bash/utility.hxx4
-rw-r--r--build2/bin/guess.cxx2
-rw-r--r--build2/bin/guess.hxx4
-rw-r--r--build2/bin/init.cxx6
-rw-r--r--build2/bin/init.hxx6
-rw-r--r--build2/bin/rule.cxx8
-rw-r--r--build2/bin/rule.hxx6
-rw-r--r--build2/bin/target.cxx2
-rw-r--r--build2/bin/target.hxx6
-rw-r--r--build2/buildfile13
-rw-r--r--build2/c/init.cxx6
-rw-r--r--build2/c/init.hxx6
-rw-r--r--build2/c/target.hxx4
-rw-r--r--build2/cc/common.cxx14
-rw-r--r--build2/cc/common.hxx6
-rw-r--r--build2/cc/compile-rule.cxx16
-rw-r--r--build2/cc/compile-rule.hxx8
-rw-r--r--build2/cc/gcc.cxx12
-rw-r--r--build2/cc/guess.cxx2
-rw-r--r--build2/cc/guess.hxx4
-rw-r--r--build2/cc/init.cxx10
-rw-r--r--build2/cc/init.hxx6
-rw-r--r--build2/cc/install-rule.cxx2
-rw-r--r--build2/cc/install-rule.hxx4
-rw-r--r--build2/cc/lexer.hxx6
-rw-r--r--build2/cc/lexer.test.cxx4
-rw-r--r--build2/cc/link-rule.cxx14
-rw-r--r--build2/cc/link-rule.hxx6
-rw-r--r--build2/cc/module.cxx6
-rw-r--r--build2/cc/module.hxx8
-rw-r--r--build2/cc/msvc.cxx14
-rw-r--r--build2/cc/parser.hxx6
-rw-r--r--build2/cc/parser.test.cxx4
-rw-r--r--build2/cc/pkgconfig.cxx14
-rw-r--r--build2/cc/target.cxx2
-rw-r--r--build2/cc/target.hxx6
-rw-r--r--build2/cc/types.hxx6
-rw-r--r--build2/cc/utility.cxx6
-rw-r--r--build2/cc/utility.hxx6
-rw-r--r--build2/cc/windows-manifest.cxx12
-rw-r--r--build2/cc/windows-rpath.cxx12
-rw-r--r--build2/cli/init.cxx8
-rw-r--r--build2/cli/init.hxx6
-rw-r--r--build2/cli/rule.cxx14
-rw-r--r--build2/cli/rule.hxx6
-rw-r--r--build2/cli/target.cxx2
-rw-r--r--build2/cli/target.hxx6
-rw-r--r--build2/config/init.cxx12
-rw-r--r--build2/config/init.hxx6
-rw-r--r--build2/config/module.hxx8
-rw-r--r--build2/config/operation.cxx16
-rw-r--r--build2/config/operation.hxx6
-rw-r--r--build2/config/utility.cxx8
-rw-r--r--build2/config/utility.hxx10
-rw-r--r--build2/config/utility.txx4
-rw-r--r--build2/cxx/init.cxx6
-rw-r--r--build2/cxx/init.hxx6
-rw-r--r--build2/cxx/target.cxx2
-rw-r--r--build2/cxx/target.hxx6
-rw-r--r--build2/dist/init.cxx6
-rw-r--r--build2/dist/init.hxx6
-rw-r--r--build2/dist/module.hxx8
-rw-r--r--build2/dist/operation.cxx16
-rw-r--r--build2/dist/operation.hxx6
-rw-r--r--build2/dist/rule.cxx8
-rw-r--r--build2/dist/rule.hxx10
-rw-r--r--build2/in/init.cxx8
-rw-r--r--build2/in/init.hxx6
-rw-r--r--build2/in/rule.cxx14
-rw-r--r--build2/in/rule.hxx6
-rw-r--r--build2/in/target.hxx6
-rw-r--r--build2/install/functions.cxx4
-rw-r--r--build2/install/init.cxx12
-rw-r--r--build2/install/init.hxx6
-rw-r--r--build2/install/operation.hxx6
-rw-r--r--build2/install/rule.cxx10
-rw-r--r--build2/install/rule.hxx12
-rw-r--r--build2/install/utility.hxx8
-rw-r--r--build2/test/common.cxx4
-rw-r--r--build2/test/common.hxx6
-rw-r--r--build2/test/init.cxx8
-rw-r--r--build2/test/init.hxx6
-rw-r--r--build2/test/module.hxx6
-rw-r--r--build2/test/operation.hxx6
-rw-r--r--build2/test/rule.cxx12
-rw-r--r--build2/test/rule.hxx8
-rw-r--r--build2/test/script/builtin.cxx2
-rw-r--r--build2/test/script/builtin.hxx4
-rw-r--r--build2/test/script/lexer.hxx6
-rw-r--r--build2/test/script/lexer.test.cxx4
-rw-r--r--build2/test/script/parser.cxx6
-rw-r--r--build2/test/script/parser.hxx8
-rw-r--r--build2/test/script/parser.test.cxx10
-rw-r--r--build2/test/script/regex.hxx4
-rw-r--r--build2/test/script/runner.cxx6
-rw-r--r--build2/test/script/runner.hxx4
-rw-r--r--build2/test/script/script.cxx4
-rw-r--r--build2/test/script/script.hxx6
-rw-r--r--build2/test/script/token.hxx6
-rw-r--r--build2/test/target.hxx6
-rw-r--r--build2/types-parsers.hxx2
-rw-r--r--build2/version/init.cxx8
-rw-r--r--build2/version/init.hxx6
-rw-r--r--build2/version/module.hxx6
-rw-r--r--build2/version/rule.cxx6
-rw-r--r--build2/version/rule.hxx4
-rw-r--r--build2/version/snapshot.cxx2
-rw-r--r--build2/version/snapshot.hxx6
-rw-r--r--build2/version/utility.cxx2
-rw-r--r--build2/version/utility.hxx6
-rw-r--r--libbuild2/.gitignore5
-rw-r--r--libbuild2/action.hxx (renamed from build2/action.hxx)16
-rw-r--r--libbuild2/algorithm.cxx (renamed from build2/algorithm.cxx)57
-rw-r--r--libbuild2/algorithm.hxx (renamed from build2/algorithm.hxx)81
-rw-r--r--libbuild2/algorithm.ixx (renamed from build2/algorithm.ixx)57
-rw-r--r--libbuild2/buildfile85
-rw-r--r--libbuild2/config.hxx0
-rw-r--r--libbuild2/config.hxx.in (renamed from build2/config.hxx.in)22
-rw-r--r--libbuild2/context.cxx (renamed from build2/context.cxx)72
-rw-r--r--libbuild2/context.hxx (renamed from build2/context.hxx)161
-rw-r--r--libbuild2/context.ixx (renamed from build2/context.ixx)2
-rw-r--r--libbuild2/depdb.cxx (renamed from build2/depdb.cxx)8
-rw-r--r--libbuild2/depdb.hxx (renamed from build2/depdb.hxx)20
-rw-r--r--libbuild2/depdb.ixx (renamed from build2/depdb.ixx)4
-rw-r--r--libbuild2/diagnostics.cxx (renamed from build2/diagnostics.cxx)21
-rw-r--r--libbuild2/diagnostics.hxx (renamed from build2/diagnostics.hxx)69
-rw-r--r--libbuild2/dump.cxx (renamed from build2/dump.cxx)14
-rw-r--r--libbuild2/dump.hxx (renamed from build2/dump.hxx)22
-rw-r--r--libbuild2/export.hxx58
-rw-r--r--libbuild2/file.cxx (renamed from build2/file.cxx)33
-rw-r--r--libbuild2/file.hxx (renamed from build2/file.hxx)86
-rw-r--r--libbuild2/file.ixx (renamed from build2/file.ixx)6
-rw-r--r--libbuild2/filesystem.cxx (renamed from build2/filesystem.cxx)8
-rw-r--r--libbuild2/filesystem.hxx (renamed from build2/filesystem.hxx)42
-rw-r--r--libbuild2/filesystem.txx (renamed from build2/filesystem.txx)6
-rw-r--r--libbuild2/function+call.test.testscript (renamed from build2/function+call.test.testscript)2
-rw-r--r--libbuild2/function+syntax.test.testscript (renamed from build2/function+syntax.test.testscript)2
-rw-r--r--libbuild2/function.cxx (renamed from build2/function.cxx)6
-rw-r--r--libbuild2/function.hxx (renamed from build2/function.hxx)50
-rw-r--r--libbuild2/function.test.cxx (renamed from build2/function.test.cxx)16
-rw-r--r--libbuild2/functions-builtin.cxx (renamed from build2/functions-builtin.cxx)6
-rw-r--r--libbuild2/functions-filesystem.cxx (renamed from build2/functions-filesystem.cxx)6
-rw-r--r--libbuild2/functions-name.cxx (renamed from build2/functions-name.cxx)8
-rw-r--r--libbuild2/functions-path.cxx (renamed from build2/functions-path.cxx)6
-rw-r--r--libbuild2/functions-process-path.cxx (renamed from build2/functions-process-path.cxx)6
-rw-r--r--libbuild2/functions-process.cxx (renamed from build2/functions-process.cxx)6
-rw-r--r--libbuild2/functions-project-name.cxx (renamed from build2/functions-project-name.cxx)6
-rw-r--r--libbuild2/functions-regex.cxx (renamed from build2/functions-regex.cxx)6
-rw-r--r--libbuild2/functions-string.cxx (renamed from build2/functions-string.cxx)6
-rw-r--r--libbuild2/functions-target-triplet.cxx (renamed from build2/functions-target-triplet.cxx)6
-rw-r--r--libbuild2/lexer+buildspec.test.testscript (renamed from build2/lexer+buildspec.test.testscript)2
-rw-r--r--libbuild2/lexer+comment.test.testscript (renamed from build2/lexer+comment.test.testscript)2
-rw-r--r--libbuild2/lexer+eval.test.testscript (renamed from build2/lexer+eval.test.testscript)2
-rw-r--r--libbuild2/lexer+quoting.test.testscript (renamed from build2/lexer+quoting.test.testscript)2
-rw-r--r--libbuild2/lexer.cxx (renamed from build2/lexer.cxx)4
-rw-r--r--libbuild2/lexer.hxx (renamed from build2/lexer.hxx)20
-rw-r--r--libbuild2/lexer.test.cxx (renamed from build2/lexer.test.cxx)10
-rw-r--r--libbuild2/module.cxx (renamed from build2/module.cxx)10
-rw-r--r--libbuild2/module.hxx (renamed from build2/module.hxx)24
-rw-r--r--libbuild2/name.cxx (renamed from build2/name.cxx)6
-rw-r--r--libbuild2/name.hxx (renamed from build2/name.hxx)27
-rw-r--r--libbuild2/name.ixx (renamed from build2/name.ixx)2
-rw-r--r--libbuild2/name.test.cxx (renamed from build2/name.test.cxx)8
-rw-r--r--libbuild2/operation.cxx (renamed from build2/operation.cxx)14
-rw-r--r--libbuild2/operation.hxx (renamed from build2/operation.hxx)50
-rw-r--r--libbuild2/parser.cxx (renamed from build2/parser.cxx)26
-rw-r--r--libbuild2/parser.hxx (renamed from build2/parser.hxx)26
-rw-r--r--libbuild2/prerequisite.cxx (renamed from build2/prerequisite.cxx)12
-rw-r--r--libbuild2/prerequisite.hxx (renamed from build2/prerequisite.hxx)28
-rw-r--r--libbuild2/prerequisite.ixx (renamed from build2/prerequisite.ixx)9
-rw-r--r--libbuild2/rule-map.hxx (renamed from build2/rule-map.hxx)14
-rw-r--r--libbuild2/rule.cxx (renamed from build2/rule.cxx)16
-rw-r--r--libbuild2/rule.hxx (renamed from build2/rule.hxx)26
-rw-r--r--libbuild2/scheduler.cxx (renamed from build2/scheduler.cxx)66
-rw-r--r--libbuild2/scheduler.hxx (renamed from build2/scheduler.hxx)38
-rw-r--r--libbuild2/scheduler.test.cxx (renamed from build2/scheduler.test.cxx)8
-rw-r--r--libbuild2/scheduler.txx (renamed from build2/scheduler.txx)4
-rw-r--r--libbuild2/scope.cxx (renamed from build2/scope.cxx)8
-rw-r--r--libbuild2/scope.hxx (renamed from build2/scope.hxx)55
-rw-r--r--libbuild2/scope.ixx (renamed from build2/scope.ixx)2
-rw-r--r--libbuild2/search.cxx (renamed from build2/search.cxx)16
-rw-r--r--libbuild2/search.hxx (renamed from build2/search.hxx)20
-rw-r--r--libbuild2/spec.cxx (renamed from build2/spec.cxx)8
-rw-r--r--libbuild2/spec.hxx (renamed from build2/spec.hxx)24
-rw-r--r--libbuild2/target-key.hxx (renamed from build2/target-key.hxx)20
-rw-r--r--libbuild2/target-state.hxx (renamed from build2/target-state.hxx)16
-rw-r--r--libbuild2/target-type.hxx (renamed from build2/target-type.hxx)16
-rw-r--r--libbuild2/target.cxx (renamed from build2/target.cxx)16
-rw-r--r--libbuild2/target.hxx (renamed from build2/target.hxx)221
-rw-r--r--libbuild2/target.ixx (renamed from build2/target.ixx)166
-rw-r--r--libbuild2/target.txx (renamed from build2/target.txx)8
-rw-r--r--libbuild2/token.cxx (renamed from build2/token.cxx)4
-rw-r--r--libbuild2/token.hxx (renamed from build2/token.hxx)18
-rw-r--r--libbuild2/types.hxx (renamed from build2/types.hxx)26
-rw-r--r--libbuild2/utility.cxx (renamed from build2/utility.cxx)16
-rw-r--r--libbuild2/utility.hxx (renamed from build2/utility.hxx)137
-rw-r--r--libbuild2/utility.ixx (renamed from build2/utility.ixx)2
-rw-r--r--libbuild2/utility.txx (renamed from build2/utility.txx)2
-rw-r--r--libbuild2/variable.cxx (renamed from build2/variable.cxx)19
-rw-r--r--libbuild2/variable.hxx (renamed from build2/variable.hxx)112
-rw-r--r--libbuild2/variable.ixx (renamed from build2/variable.ixx)11
-rw-r--r--libbuild2/variable.txx (renamed from build2/variable.txx)4
-rw-r--r--libbuild2/version.hxx0
-rw-r--r--libbuild2/version.hxx.in (renamed from build2/version.hxx.in)24
-rw-r--r--old-tests/depdb/driver.cxx6
-rw-r--r--tests/libbuild2/buildfile12
-rw-r--r--tests/libbuild2/driver.cxx24
-rw-r--r--tests/libbuild2/testscript7
-rw-r--r--tests/test/script/builtin/cp.testscript13
226 files changed, 1990 insertions, 1507 deletions
diff --git a/README-GIT b/README-GIT
index 0bd7de9..efa6a36 100644
--- a/README-GIT
+++ b/README-GIT
@@ -9,3 +9,9 @@ git clone --recursive https://git.build2.org/build2.git
Alternatively, if you have already cloned without --recursive, run:
git submodule update --init
+
+The checked out libbuild2/version.hxx and libbuild2/config.hxx will be
+overwritten during the build process but these changes should be ignored. To
+do this automatically, run:
+
+git update-index --assume-unchanged libbuild2/version.hxx libbuild2/config.hxx
diff --git a/bootstrap-mingw.bat b/bootstrap-mingw.bat
index a43278e..e2b51b7 100644
--- a/bootstrap-mingw.bat
+++ b/bootstrap-mingw.bat
@@ -72,6 +72,7 @@ set "src=%src% build2\test\script"
set "src=%src% build2\version"
set "src=%src% build2\install"
set "src=%src% build2\in"
+set "src=%src% libbuild2"
set "src=%src% %libbutl%\libbutl"
rem Get the compile options.
diff --git a/bootstrap-msvc.bat b/bootstrap-msvc.bat
index d9b4f5a..603395c 100644
--- a/bootstrap-msvc.bat
+++ b/bootstrap-msvc.bat
@@ -103,6 +103,7 @@ set "src=%src% build2\test\script"
set "src=%src% build2\version"
set "src=%src% build2\install"
set "src=%src% build2\in"
+set "src=%src% libbuild2"
set "src=%src% %libbutl%\libbutl"
rem Get the compile options.
diff --git a/bootstrap.gmake b/bootstrap.gmake
index 2aac8fc..e2fea35 100644
--- a/bootstrap.gmake
+++ b/bootstrap.gmake
@@ -129,42 +129,48 @@ endif
#
# Note: list nested subdirectories first (used in clean).
#
-sub_dirs := \
-config \
-dist \
-bin \
-c \
-cc \
-cxx \
-test/script \
-test \
-version \
-install \
+build2_sub := \
+config \
+dist \
+bin \
+c \
+cc \
+cxx \
+test/script \
+test \
+version \
+install \
in
-build2_src := $(wildcard $(src_root)/build2/*.cxx)
-build2_src += $(foreach d,$(sub_dirs),$(wildcard $(src_root)/build2/$d/*.cxx))
-libbutl_src := $(wildcard $(libbutl)/libbutl/*.cxx)
+build2_src := $(wildcard $(src_root)/build2/*.cxx)
+build2_src += $(foreach d,$(build2_sub),$(wildcard $(src_root)/build2/$d/*.cxx))
+libbuild2_src := $(wildcard $(src_root)/libbuild2/*.cxx)
+libbutl_src := $(wildcard $(libbutl)/libbutl/*.cxx)
# Filter out *.test.cxx sources.
#
-build2_src := $(filter-out %.test.cxx,$(build2_src))
-libbutl_src := $(filter-out %.test.cxx,$(libbutl_src))
+build2_src := $(filter-out %.test.cxx,$(build2_src))
+libbuild2_src := $(filter-out %.test.cxx,$(libbuild2_src))
+libbutl_src := $(filter-out %.test.cxx,$(libbutl_src))
# Note that we use the .b.o object file extension to avoid clashing with the
# build2 builds.
#
-build2_obj := $(patsubst $(src_root)/%.cxx,$(out_root)/%.b.o,$(build2_src))
-libbutl_obj := $(patsubst $(libbutl)/libbutl/%.cxx,$(libbutl_out)/%.b.o,$(libbutl_src))
+build2_obj := $(patsubst $(src_root)/%.cxx,$(out_root)/%.b.o,$(build2_src))
+libbuild2_obj := $(patsubst $(src_root)/%.cxx,$(out_root)/%.b.o,$(libbuild2_src))
+libbutl_obj := $(patsubst $(libbutl)/libbutl/%.cxx,$(libbutl_out)/%.b.o,$(libbutl_src))
# Build.
#
-$(out_root)/build2/b-boot$(exe): $(build2_obj) $(libbutl_obj)
+$(out_root)/build2/b-boot$(exe): $(build2_obj) $(libbuild2_obj) $(libbutl_obj)
$(CXX) -std=c++1y $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
$(out_root)/build2/%.b.o: $(src_root)/build2/%.cxx | $$(dir $$@).
$(CXX) -I$(libbutl) -I$(src_root) -DBUILD2_BOOTSTRAP -DBUILD2_HOST_TRIPLET=\"$(chost)\" $(CPPFLAGS) -std=c++1y $(CXXFLAGS) -o $@ -c $<
+$(out_root)/libbuild2/%.b.o: $(src_root)/libbuild2/%.cxx | $$(dir $$@).
+ $(CXX) -I$(libbutl) -I$(src_root) -DBUILD2_BOOTSTRAP -DBUILD2_HOST_TRIPLET=\"$(chost)\" $(CPPFLAGS) -std=c++1y $(CXXFLAGS) -o $@ -c $<
+
$(libbutl_out)/%.b.o: $(libbutl)/libbutl/%.cxx | $$(dir $$@).
$(CXX) -I$(libbutl) -DBUILD2_BOOTSTRAP $(CPPFLAGS) -std=c++1y $(CXXFLAGS) -o $@ -c $<
@@ -181,10 +187,11 @@ all: $(out_root)/build2/b-boot$(exe)
cleano:
rm -f $(build2_obj)
+ rm -f $(libbuild2_obj)
rm -f $(libbutl_obj)
clean: cleano
rm -f $(out_root)/build2/b-boot$(exe)
ifeq ($(in_tree),false)
- rm -fd $(foreach d,$(sub_dirs),$(out_root)/build2/$d) $(out_root)/build2 $(libbutl_out)
+ rm -fd $(foreach d,$(build2_sub),$(out_root)/build2/$d) $(out_root)/build2 $(out_root)/libbuild2 $(libbutl_out)
endif
diff --git a/bootstrap.sh b/bootstrap.sh
index 6116550..4cacd74 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -130,6 +130,7 @@ src="$src build2/version/*.cxx"
src="$src build2/install/*.cxx"
src="$src build2/in/*.cxx"
src="$src build2/bash/*.cxx"
+src="$src libbuild2/*.cxx"
src="$src $libbutl/libbutl/*.cxx"
# Filter out *.test.cxx sources.
diff --git a/build/export.build b/build/export.build
index dc94fa4..8bca42a 100644
--- a/build/export.build
+++ b/build/export.build
@@ -7,4 +7,7 @@ $out_root/
include build2/
}
-export $out_root/build2/exe{b}
+if ($import.target == exe{b})
+ export $out_root/build2/exe{b}
+elif ($import.target == lib{build2})
+ export $out_root/libbuild2/lib{build2}
diff --git a/build/root.build b/build/root.build
index 03e3fe6..9dbad8d 100644
--- a/build/root.build
+++ b/build/root.build
@@ -24,7 +24,7 @@ cxx.poptions =+ "-I$out_root" "-I$src_root"
# While we don't have any C sources to compile, we need to get the C compiler
# path to use as native/default.
#
-using c
+using c.config
# Load the cli module but only if it's available. This way a distribution
# that includes pre-generated files can be built without installing cli.
diff --git a/build2/.gitignore b/build2/.gitignore
index 51b4c16..83bbed4 100644
--- a/build2/.gitignore
+++ b/build2/.gitignore
@@ -1,11 +1,11 @@
b
b-boot
-*.test
+
#*-options
#*-options.?xx
-config.hxx
-version.hxx
-# Testscript output directory (can be symlink).
+# Unit test executables and Testscript output directories
+# (can be symlinks).
#
+*.test
test-*.test
diff --git a/build2/b-options.hxx b/build2/b-options.hxx
index 45666aa..c745025 100644
--- a/build2/b-options.hxx
+++ b/build2/b-options.hxx
@@ -365,7 +365,7 @@ namespace build2
#include <set>
-#include <build2/types.hxx>
+#include <libbuild2/types.hxx>
namespace build2
{
diff --git a/build2/b.cli b/build2/b.cli
index 802a160..4ab397b 100644
--- a/build2/b.cli
+++ b/build2/b.cli
@@ -3,7 +3,7 @@
// license : MIT; see accompanying LICENSE file
include <set>;
-include <build2/types.hxx>;
+include <libbuild2/types.hxx>;
"\section=1"
"\name=b"
diff --git a/build2/b.cxx b/build2/b.cxx
index 0eb007c..32d42aa 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -22,28 +22,31 @@
#include <libbutl/fdstream.mxx> // stderr_fd(), fdterm()
#include <libbutl/backtrace.mxx> // backtrace()
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
-
-#include <build2/dump.hxx>
-#include <build2/file.hxx>
-#include <build2/rule.hxx>
-#include <build2/spec.hxx>
-#include <build2/scope.hxx>
-#include <build2/module.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/variable.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/operation.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
-#include <build2/prerequisite.hxx>
-
-#include <build2/parser.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/dump.hxx>
+#include <libbuild2/file.hxx>
+#include <libbuild2/rule.hxx>
+#include <libbuild2/spec.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/module.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/operation.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
+#include <libbuild2/prerequisite.hxx>
+
+#include <libbuild2/parser.hxx>
#include <build2/b-options.hxx>
+#include <build2/config/utility.hxx> // config::save_variable()
+#include <build2/config/operation.hxx> // config::preprocess_create()
+
using namespace butl;
using namespace std;
@@ -365,7 +368,7 @@ main (int argc, char* argv[])
//
if (ops.version ())
{
- cout << "build2 " << BUILD2_VERSION_ID << endl
+ cout << "build2 " << LIBBUILD2_VERSION_ID << endl
<< "libbutl " << LIBBUTL_VERSION_ID << endl
<< "host " << BUILD2_HOST_TRIPLET << endl
<< "Copyright (c) 2014-2019 Code Synthesis Ltd" << endl
@@ -437,6 +440,10 @@ main (int argc, char* argv[])
auto& bm (builtin_modules);
bm["config"] = mf {&config::boot, &config::init};
+
+ config_save_variable = &config::save_variable;
+ config_preprocess_create = &config::preprocess_create;
+
bm["dist"] = mf {&dist::boot, &dist::init};
bm["test"] = mf {&test::boot, &test::init};
bm["install"] = mf {&install::boot, &install::init};
diff --git a/build2/bash/init.cxx b/build2/bash/init.cxx
index 6812f2b..83bfdb9 100644
--- a/build2/bash/init.cxx
+++ b/build2/bash/init.cxx
@@ -4,10 +4,10 @@
#include <build2/bash/init.hxx>
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/install/utility.hxx>
diff --git a/build2/bash/init.hxx b/build2/bash/init.hxx
index f4a82d7..2a7e95c 100644
--- a/build2/bash/init.hxx
+++ b/build2/bash/init.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_BASH_INIT_HXX
#define BUILD2_BASH_INIT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/bash/rule.cxx b/build2/bash/rule.cxx
index 09cc930..72e3219 100644
--- a/build2/bash/rule.cxx
+++ b/build2/bash/rule.cxx
@@ -6,10 +6,10 @@
#include <cstring> // strlen(), strchr()
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/in/target.hxx>
diff --git a/build2/bash/rule.hxx b/build2/bash/rule.hxx
index 9a1b161..6430947 100644
--- a/build2/bash/rule.hxx
+++ b/build2/bash/rule.hxx
@@ -5,8 +5,8 @@
#ifndef BUILD2_BASH_RULE_HXX
#define BUILD2_BASH_RULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
#include <build2/in/rule.hxx>
#include <build2/install/rule.hxx>
diff --git a/build2/bash/target.cxx b/build2/bash/target.cxx
index 8a4bd9e..e843d53 100644
--- a/build2/bash/target.cxx
+++ b/build2/bash/target.cxx
@@ -4,7 +4,7 @@
#include <build2/bash/target.hxx>
-#include <build2/context.hxx>
+#include <libbuild2/context.hxx>
using namespace std;
diff --git a/build2/bash/target.hxx b/build2/bash/target.hxx
index d1ab5b1..6be83c4 100644
--- a/build2/bash/target.hxx
+++ b/build2/bash/target.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_BASH_TARGET_HXX
#define BUILD2_BASH_TARGET_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/target.hxx>
namespace build2
{
diff --git a/build2/bash/utility.hxx b/build2/bash/utility.hxx
index e7f72f4..31a6b99 100644
--- a/build2/bash/utility.hxx
+++ b/build2/bash/utility.hxx
@@ -5,8 +5,8 @@
#ifndef BUILD2_BASH_UTILITY_HXX
#define BUILD2_BASH_UTILITY_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
namespace build2
{
diff --git a/build2/bin/guess.cxx b/build2/bin/guess.cxx
index c5effd7..d1b1545 100644
--- a/build2/bin/guess.cxx
+++ b/build2/bin/guess.cxx
@@ -4,7 +4,7 @@
#include <build2/bin/guess.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
diff --git a/build2/bin/guess.hxx b/build2/bin/guess.hxx
index a9c7246..a3b2b34 100644
--- a/build2/bin/guess.hxx
+++ b/build2/bin/guess.hxx
@@ -5,8 +5,8 @@
#ifndef BUILD2_BIN_GUESS_HXX
#define BUILD2_BIN_GUESS_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
namespace build2
{
diff --git a/build2/bin/init.cxx b/build2/bin/init.cxx
index cf47fbe..37fad6b 100644
--- a/build2/bin/init.cxx
+++ b/build2/bin/init.cxx
@@ -6,9 +6,9 @@
#include <map>
-#include <build2/scope.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/config/utility.hxx>
diff --git a/build2/bin/init.hxx b/build2/bin/init.hxx
index c58dbfd..989dcaf 100644
--- a/build2/bin/init.hxx
+++ b/build2/bin/init.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_BIN_INIT_HXX
#define BUILD2_BIN_INIT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/bin/rule.cxx b/build2/bin/rule.cxx
index 7eaa308..42ba86a 100644
--- a/build2/bin/rule.cxx
+++ b/build2/bin/rule.cxx
@@ -4,10 +4,10 @@
#include <build2/bin/rule.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/bin/target.hxx>
diff --git a/build2/bin/rule.hxx b/build2/bin/rule.hxx
index 19902c9..4230933 100644
--- a/build2/bin/rule.hxx
+++ b/build2/bin/rule.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_BIN_RULE_HXX
#define BUILD2_BIN_RULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/rule.hxx>
+#include <libbuild2/rule.hxx>
namespace build2
{
diff --git a/build2/bin/target.cxx b/build2/bin/target.cxx
index c602f3b..46f19bd 100644
--- a/build2/bin/target.cxx
+++ b/build2/bin/target.cxx
@@ -4,7 +4,7 @@
#include <build2/bin/target.hxx>
-#include <build2/context.hxx>
+#include <libbuild2/context.hxx>
using namespace std;
diff --git a/build2/bin/target.hxx b/build2/bin/target.hxx
index 1430477..a56c636 100644
--- a/build2/bin/target.hxx
+++ b/build2/bin/target.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_BIN_TARGET_HXX
#define BUILD2_BIN_TARGET_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/target.hxx>
namespace build2
{
diff --git a/build2/buildfile b/build2/buildfile
index ba8f25c..eb22266 100644
--- a/build2/buildfile
+++ b/build2/buildfile
@@ -5,14 +5,13 @@
import libs = libbutl%lib{butl}
import libs += libpkgconf%lib{pkgconf}
-./: exe{b}: {hxx ixx txx cxx}{+b} libue{b}
+include ../libbuild2/
-libue{b}: {hxx ixx txx cxx}{** -b -b-options -config -version -**.test...} \
- {hxx ixx cxx}{b-options} {hxx}{config version} \
- $libs
+./: exe{b}: {hxx ixx txx cxx}{+b} libue{b}
-hxx{config}: in{config}
-hxx{version}: in{version} $src_root/manifest
+libue{b}: {hxx ixx txx cxx}{** -b -b-options -**.test...} \
+ {hxx ixx cxx}{b-options} \
+ ../libbuild2/lib{build2} $libs
# Unit tests.
#
@@ -36,7 +35,7 @@ for t: cxx{**.test...}
#
# Pass our compiler target to be used as build2 host.
#
-obj{b context}: cxx.poptions += -DBUILD2_HOST_TRIPLET=\"$cxx.target\"
+obj{b}: cxx.poptions += -DBUILD2_HOST_TRIPLET=\"$cxx.target\"
# Pass native C and C++ compiler paths (not forgetting to escape backslashes
# on Windows). These are used as defaults for BUILD2_DEFAULT_*.
diff --git a/build2/c/init.cxx b/build2/c/init.cxx
index 7c12fdd..08846a7 100644
--- a/build2/c/init.cxx
+++ b/build2/c/init.cxx
@@ -4,9 +4,9 @@
#include <build2/c/init.hxx>
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/cc/guess.hxx>
#include <build2/cc/module.hxx>
diff --git a/build2/c/init.hxx b/build2/c/init.hxx
index 54cebf1..77119a9 100644
--- a/build2/c/init.hxx
+++ b/build2/c/init.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_C_INIT_HXX
#define BUILD2_C_INIT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/c/target.hxx b/build2/c/target.hxx
index 3119758..486c29c 100644
--- a/build2/c/target.hxx
+++ b/build2/c/target.hxx
@@ -5,8 +5,8 @@
#ifndef BUILD2_C_TARGET_HXX
#define BUILD2_C_TARGET_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
#include <build2/cc/target.hxx>
diff --git a/build2/cc/common.cxx b/build2/cc/common.cxx
index fa774d7..84ebbd5 100644
--- a/build2/cc/common.cxx
+++ b/build2/cc/common.cxx
@@ -4,13 +4,13 @@
#include <build2/cc/common.hxx>
-#include <build2/file.hxx> // import()
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
-#include <build2/variable.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/file.hxx> // import()
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/cc/utility.hxx>
diff --git a/build2/cc/common.hxx b/build2/cc/common.hxx
index 6eccf23..c58a7f3 100644
--- a/build2/cc/common.hxx
+++ b/build2/cc/common.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CC_COMMON_HXX
#define BUILD2_CC_COMMON_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/variable.hxx>
#include <build2/bin/target.hxx>
diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx
index a1796eb..c0c7eb3 100644
--- a/build2/cc/compile-rule.cxx
+++ b/build2/cc/compile-rule.cxx
@@ -7,14 +7,14 @@
#include <cstdlib> // exit()
#include <cstring> // strlen(), strchr()
-#include <build2/file.hxx>
-#include <build2/depdb.hxx>
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
-#include <build2/variable.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx> // mtime()
-#include <build2/diagnostics.hxx>
+#include <libbuild2/file.hxx>
+#include <libbuild2/depdb.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx> // mtime()
+#include <libbuild2/diagnostics.hxx>
#include <build2/bin/target.hxx>
#include <build2/config/utility.hxx> // create_project()
diff --git a/build2/cc/compile-rule.hxx b/build2/cc/compile-rule.hxx
index ab19e1c..62127a7 100644
--- a/build2/cc/compile-rule.hxx
+++ b/build2/cc/compile-rule.hxx
@@ -5,11 +5,11 @@
#ifndef BUILD2_CC_COMPILE_RULE_HXX
#define BUILD2_CC_COMPILE_RULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/rule.hxx>
-#include <build2/filesystem.hxx> // auto_rmfile
+#include <libbuild2/rule.hxx>
+#include <libbuild2/filesystem.hxx> // auto_rmfile
#include <build2/cc/types.hxx>
#include <build2/cc/common.hxx>
diff --git a/build2/cc/gcc.cxx b/build2/cc/gcc.cxx
index 724c555..52cc386 100644
--- a/build2/cc/gcc.cxx
+++ b/build2/cc/gcc.cxx
@@ -2,12 +2,12 @@
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/variable.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/bin/target.hxx>
diff --git a/build2/cc/guess.cxx b/build2/cc/guess.cxx
index f5db253..c74ccaf 100644
--- a/build2/cc/guess.cxx
+++ b/build2/cc/guess.cxx
@@ -7,7 +7,7 @@
#include <map>
#include <cstring> // strlen(), strchr()
-#include <build2/diagnostics.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
diff --git a/build2/cc/guess.hxx b/build2/cc/guess.hxx
index b807446..1ab6e49 100644
--- a/build2/cc/guess.hxx
+++ b/build2/cc/guess.hxx
@@ -5,8 +5,8 @@
#ifndef BUILD2_CC_GUESS_HXX
#define BUILD2_CC_GUESS_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
#include <build2/cc/types.hxx>
diff --git a/build2/cc/init.cxx b/build2/cc/init.cxx
index 882b205..18fba20 100644
--- a/build2/cc/init.cxx
+++ b/build2/cc/init.cxx
@@ -4,11 +4,11 @@
#include <build2/cc/init.hxx>
-#include <build2/file.hxx>
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/file.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/config/utility.hxx>
diff --git a/build2/cc/init.hxx b/build2/cc/init.hxx
index e62da3e..98defde 100644
--- a/build2/cc/init.hxx
+++ b/build2/cc/init.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CC_INIT_HXX
#define BUILD2_CC_INIT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/cc/install-rule.cxx b/build2/cc/install-rule.cxx
index 5f8722b..ce2424c 100644
--- a/build2/cc/install-rule.cxx
+++ b/build2/cc/install-rule.cxx
@@ -4,7 +4,7 @@
#include <build2/cc/install-rule.hxx>
-#include <build2/algorithm.hxx>
+#include <libbuild2/algorithm.hxx>
#include <build2/bin/target.hxx>
diff --git a/build2/cc/install-rule.hxx b/build2/cc/install-rule.hxx
index 7616b61..ea966b8 100644
--- a/build2/cc/install-rule.hxx
+++ b/build2/cc/install-rule.hxx
@@ -5,8 +5,8 @@
#ifndef BUILD2_CC_INSTALL_RULE_HXX
#define BUILD2_CC_INSTALL_RULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
#include <build2/install/rule.hxx>
diff --git a/build2/cc/lexer.hxx b/build2/cc/lexer.hxx
index c8b1042..5d5fa60 100644
--- a/build2/cc/lexer.hxx
+++ b/build2/cc/lexer.hxx
@@ -8,10 +8,10 @@
#include <libbutl/sha256.mxx>
#include <libbutl/char-scanner.mxx>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/diagnostics.hxx>
namespace build2
{
diff --git a/build2/cc/lexer.test.cxx b/build2/cc/lexer.test.cxx
index a2e33b7..4acc304 100644
--- a/build2/cc/lexer.test.cxx
+++ b/build2/cc/lexer.test.cxx
@@ -5,8 +5,8 @@
#include <cassert>
#include <iostream>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
#include <build2/cc/lexer.hxx>
diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx
index 9942f48..6dfcfa9 100644
--- a/build2/cc/link-rule.cxx
+++ b/build2/cc/link-rule.cxx
@@ -10,13 +10,13 @@
#include <libbutl/filesystem.mxx> // file_exists()
-#include <build2/depdb.hxx>
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
-#include <build2/variable.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/depdb.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/bin/target.hxx>
diff --git a/build2/cc/link-rule.hxx b/build2/cc/link-rule.hxx
index 14a8570..487b1cd 100644
--- a/build2/cc/link-rule.hxx
+++ b/build2/cc/link-rule.hxx
@@ -7,10 +7,10 @@
#include <set>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/rule.hxx>
+#include <libbuild2/rule.hxx>
#include <build2/cc/types.hxx>
#include <build2/cc/common.hxx>
diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx
index 7ea790b..ec35444 100644
--- a/build2/cc/module.cxx
+++ b/build2/cc/module.cxx
@@ -6,9 +6,9 @@
#include <iomanip> // left, setw()
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/bin/target.hxx>
diff --git a/build2/cc/module.hxx b/build2/cc/module.hxx
index f277f95..a7f787f 100644
--- a/build2/cc/module.hxx
+++ b/build2/cc/module.hxx
@@ -5,11 +5,11 @@
#ifndef BUILD2_CC_MODULE_HXX
#define BUILD2_CC_MODULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/module.hxx>
+#include <libbuild2/variable.hxx>
#include <build2/cc/common.hxx>
diff --git a/build2/cc/msvc.cxx b/build2/cc/msvc.cxx
index 08cd43c..e978f6a 100644
--- a/build2/cc/msvc.cxx
+++ b/build2/cc/msvc.cxx
@@ -4,13 +4,13 @@
#include <cstring> // strcmp()
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/variable.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/bin/target.hxx>
diff --git a/build2/cc/parser.hxx b/build2/cc/parser.hxx
index 2050dd1..3a588e9 100644
--- a/build2/cc/parser.hxx
+++ b/build2/cc/parser.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CC_PARSER_HXX
#define BUILD2_CC_PARSER_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/cc/types.hxx>
diff --git a/build2/cc/parser.test.cxx b/build2/cc/parser.test.cxx
index 2269a28..3b2da57 100644
--- a/build2/cc/parser.test.cxx
+++ b/build2/cc/parser.test.cxx
@@ -5,8 +5,8 @@
#include <cassert>
#include <iostream>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
#include <build2/cc/parser.hxx>
diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx
index dcf3cff..99715be 100644
--- a/build2/cc/pkgconfig.cxx
+++ b/build2/cc/pkgconfig.cxx
@@ -9,13 +9,13 @@
# include <libpkgconf/libpkgconf.h>
#endif
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/variable.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/install/utility.hxx>
diff --git a/build2/cc/target.cxx b/build2/cc/target.cxx
index d31a38c..c637e60 100644
--- a/build2/cc/target.cxx
+++ b/build2/cc/target.cxx
@@ -4,7 +4,7 @@
#include <build2/cc/target.hxx>
-#include <build2/context.hxx>
+#include <libbuild2/context.hxx>
using namespace std;
diff --git a/build2/cc/target.hxx b/build2/cc/target.hxx
index 6764fe5..fd6f6d5 100644
--- a/build2/cc/target.hxx
+++ b/build2/cc/target.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CC_TARGET_HXX
#define BUILD2_CC_TARGET_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/target.hxx>
namespace build2
{
diff --git a/build2/cc/types.hxx b/build2/cc/types.hxx
index 60c9a34..481c3c6 100644
--- a/build2/cc/types.hxx
+++ b/build2/cc/types.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CC_TYPES_HXX
#define BUILD2_CC_TYPES_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target-type.hxx>
+#include <libbuild2/target-type.hxx>
namespace build2
{
diff --git a/build2/cc/utility.cxx b/build2/cc/utility.cxx
index 2751032..2179c14 100644
--- a/build2/cc/utility.cxx
+++ b/build2/cc/utility.cxx
@@ -4,9 +4,9 @@
#include <build2/cc/utility.hxx>
-#include <build2/file.hxx>
-#include <build2/variable.hxx>
-#include <build2/algorithm.hxx> // search()
+#include <libbuild2/file.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/algorithm.hxx> // search()
#include <build2/bin/rule.hxx>
#include <build2/bin/target.hxx>
diff --git a/build2/cc/utility.hxx b/build2/cc/utility.hxx
index bc6c3fb..80ca741 100644
--- a/build2/cc/utility.hxx
+++ b/build2/cc/utility.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CC_UTILITY_HXX
#define BUILD2_CC_UTILITY_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/target.hxx>
#include <build2/bin/target.hxx>
#include <build2/cc/types.hxx>
diff --git a/build2/cc/windows-manifest.cxx b/build2/cc/windows-manifest.cxx
index f890ad5..da12f0f 100644
--- a/build2/cc/windows-manifest.cxx
+++ b/build2/cc/windows-manifest.cxx
@@ -2,12 +2,12 @@
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/variable.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/cc/link-rule.hxx>
diff --git a/build2/cc/windows-rpath.cxx b/build2/cc/windows-rpath.cxx
index 9ad2602..d18e36d 100644
--- a/build2/cc/windows-rpath.cxx
+++ b/build2/cc/windows-rpath.cxx
@@ -4,12 +4,12 @@
#include <errno.h> // E*
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
-#include <build2/variable.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/bin/target.hxx>
diff --git a/build2/cli/init.cxx b/build2/cli/init.cxx
index 35ef04e..24266ca 100644
--- a/build2/cli/init.cxx
+++ b/build2/cli/init.cxx
@@ -4,10 +4,10 @@
#include <build2/cli/init.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/cxx/target.hxx>
diff --git a/build2/cli/init.hxx b/build2/cli/init.hxx
index e6a7079..341dc11 100644
--- a/build2/cli/init.hxx
+++ b/build2/cli/init.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CLI_INIT_HXX
#define BUILD2_CLI_INIT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/cli/rule.cxx b/build2/cli/rule.cxx
index 2da5802..f6bebee 100644
--- a/build2/cli/rule.cxx
+++ b/build2/cli/rule.cxx
@@ -4,13 +4,13 @@
#include <build2/cli/rule.hxx>
-#include <build2/depdb.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/depdb.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/cli/target.hxx>
diff --git a/build2/cli/rule.hxx b/build2/cli/rule.hxx
index 3603f47..e839999 100644
--- a/build2/cli/rule.hxx
+++ b/build2/cli/rule.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CLI_RULE_HXX
#define BUILD2_CLI_RULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/rule.hxx>
+#include <libbuild2/rule.hxx>
namespace build2
{
diff --git a/build2/cli/target.cxx b/build2/cli/target.cxx
index 33aff72..096295a 100644
--- a/build2/cli/target.cxx
+++ b/build2/cli/target.cxx
@@ -4,7 +4,7 @@
#include <build2/cli/target.hxx>
-#include <build2/context.hxx>
+#include <libbuild2/context.hxx>
using namespace std;
using namespace butl;
diff --git a/build2/cli/target.hxx b/build2/cli/target.hxx
index 44126ff..c6aa266 100644
--- a/build2/cli/target.hxx
+++ b/build2/cli/target.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CLI_TARGET_HXX
#define BUILD2_CLI_TARGET_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/target.hxx>
#include <build2/cxx/target.hxx>
diff --git a/build2/config/init.cxx b/build2/config/init.cxx
index 7b518ab..bd2d573 100644
--- a/build2/config/init.cxx
+++ b/build2/config/init.cxx
@@ -4,12 +4,12 @@
#include <build2/config/init.hxx>
-#include <build2/file.hxx>
-#include <build2/rule.hxx>
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
-#include <build2/filesystem.hxx> // exists()
-#include <build2/diagnostics.hxx>
+#include <libbuild2/file.hxx>
+#include <libbuild2/rule.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/filesystem.hxx> // exists()
+#include <libbuild2/diagnostics.hxx>
#include <build2/config/module.hxx>
#include <build2/config/utility.hxx>
diff --git a/build2/config/init.hxx b/build2/config/init.hxx
index 2ac0f96..5a9b66d 100644
--- a/build2/config/init.hxx
+++ b/build2/config/init.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CONFIG_INIT_HXX
#define BUILD2_CONFIG_INIT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/config/module.hxx b/build2/config/module.hxx
index 10dac40..0c78b18 100644
--- a/build2/config/module.hxx
+++ b/build2/config/module.hxx
@@ -9,11 +9,11 @@
#include <libbutl/prefix-map.mxx>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/module.hxx>
+#include <libbuild2/variable.hxx>
namespace build2
{
diff --git a/build2/config/operation.cxx b/build2/config/operation.cxx
index f857330..ff5b44a 100644
--- a/build2/config/operation.cxx
+++ b/build2/config/operation.cxx
@@ -6,14 +6,14 @@
#include <set>
-#include <build2/file.hxx>
-#include <build2/spec.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/file.hxx>
+#include <libbuild2/spec.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/config/module.hxx>
#include <build2/config/utility.hxx>
diff --git a/build2/config/operation.hxx b/build2/config/operation.hxx
index 2892885..9f426ca 100644
--- a/build2/config/operation.hxx
+++ b/build2/config/operation.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CONFIG_OPERATION_HXX
#define BUILD2_CONFIG_OPERATION_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/operation.hxx>
+#include <libbuild2/operation.hxx>
namespace build2
{
diff --git a/build2/config/utility.cxx b/build2/config/utility.cxx
index e15c689..1ce07f7 100644
--- a/build2/config/utility.cxx
+++ b/build2/config/utility.cxx
@@ -4,10 +4,10 @@
#include <build2/config/utility.hxx>
-#include <build2/file.hxx>
-#include <build2/context.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/file.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/config/module.hxx>
diff --git a/build2/config/utility.hxx b/build2/config/utility.hxx
index eff1a02..5e4eac2 100644
--- a/build2/config/utility.hxx
+++ b/build2/config/utility.hxx
@@ -5,12 +5,12 @@
#ifndef BUILD2_CONFIG_UTILITY_HXX
#define BUILD2_CONFIG_UTILITY_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/scope.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/diagnostics.hxx>
namespace build2
{
diff --git a/build2/config/utility.txx b/build2/config/utility.txx
index b8e0acc..84650d9 100644
--- a/build2/config/utility.txx
+++ b/build2/config/utility.txx
@@ -2,8 +2,8 @@
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
namespace build2
{
diff --git a/build2/cxx/init.cxx b/build2/cxx/init.cxx
index 518a823..9db5817 100644
--- a/build2/cxx/init.cxx
+++ b/build2/cxx/init.cxx
@@ -4,9 +4,9 @@
#include <build2/cxx/init.hxx>
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/cc/guess.hxx>
#include <build2/cc/module.hxx>
diff --git a/build2/cxx/init.hxx b/build2/cxx/init.hxx
index 0a8bde9..83553e6 100644
--- a/build2/cxx/init.hxx
+++ b/build2/cxx/init.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CXX_INIT_HXX
#define BUILD2_CXX_INIT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/cxx/target.cxx b/build2/cxx/target.cxx
index 1b7c1cf..025bf9d 100644
--- a/build2/cxx/target.cxx
+++ b/build2/cxx/target.cxx
@@ -4,7 +4,7 @@
#include <build2/cxx/target.hxx>
-#include <build2/context.hxx>
+#include <libbuild2/context.hxx>
using namespace std;
diff --git a/build2/cxx/target.hxx b/build2/cxx/target.hxx
index 33959af..fabd3b6 100644
--- a/build2/cxx/target.hxx
+++ b/build2/cxx/target.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_CXX_TARGET_HXX
#define BUILD2_CXX_TARGET_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/target.hxx>
#include <build2/cc/target.hxx>
namespace build2
diff --git a/build2/dist/init.cxx b/build2/dist/init.cxx
index 56f676a..8edbccb 100644
--- a/build2/dist/init.cxx
+++ b/build2/dist/init.cxx
@@ -4,9 +4,9 @@
#include <build2/dist/init.hxx>
-#include <build2/scope.hxx>
-#include <build2/file.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/file.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/config/utility.hxx>
diff --git a/build2/dist/init.hxx b/build2/dist/init.hxx
index f337dad..0449a99 100644
--- a/build2/dist/init.hxx
+++ b/build2/dist/init.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_DIST_INIT_HXX
#define BUILD2_DIST_INIT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/dist/module.hxx b/build2/dist/module.hxx
index 74d8854..cd0d9a3 100644
--- a/build2/dist/module.hxx
+++ b/build2/dist/module.hxx
@@ -5,11 +5,11 @@
#ifndef BUILD2_DIST_MODULE_HXX
#define BUILD2_DIST_MODULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/module.hxx>
+#include <libbuild2/variable.hxx>
namespace build2
{
diff --git a/build2/dist/operation.cxx b/build2/dist/operation.cxx
index 3b247b2..ca90b50 100644
--- a/build2/dist/operation.cxx
+++ b/build2/dist/operation.cxx
@@ -9,14 +9,14 @@
#include <libbutl/filesystem.mxx> // path_match()
-#include <build2/file.hxx>
-#include <build2/dump.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/file.hxx>
+#include <libbuild2/dump.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/dist/module.hxx>
diff --git a/build2/dist/operation.hxx b/build2/dist/operation.hxx
index 592bf8c..00d8664 100644
--- a/build2/dist/operation.hxx
+++ b/build2/dist/operation.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_DIST_OPERATION_HXX
#define BUILD2_DIST_OPERATION_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/operation.hxx>
+#include <libbuild2/operation.hxx>
namespace build2
{
diff --git a/build2/dist/rule.cxx b/build2/dist/rule.cxx
index 274e3c2..c877abc 100644
--- a/build2/dist/rule.cxx
+++ b/build2/dist/rule.cxx
@@ -4,10 +4,10 @@
#include <build2/dist/rule.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
diff --git a/build2/dist/rule.hxx b/build2/dist/rule.hxx
index b409118..accce4c 100644
--- a/build2/dist/rule.hxx
+++ b/build2/dist/rule.hxx
@@ -5,12 +5,12 @@
#ifndef BUILD2_DIST_RULE_HXX
#define BUILD2_DIST_RULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/rule.hxx>
-#include <build2/action.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/rule.hxx>
+#include <libbuild2/action.hxx>
+#include <libbuild2/target.hxx>
namespace build2
{
diff --git a/build2/in/init.cxx b/build2/in/init.cxx
index 1bd93e1..f01fe20 100644
--- a/build2/in/init.cxx
+++ b/build2/in/init.cxx
@@ -4,10 +4,10 @@
#include <build2/in/init.hxx>
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/in/rule.hxx>
#include <build2/in/target.hxx>
diff --git a/build2/in/init.hxx b/build2/in/init.hxx
index a8482f8..3cf8ebf 100644
--- a/build2/in/init.hxx
+++ b/build2/in/init.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_IN_INIT_HXX
#define BUILD2_IN_INIT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/in/rule.cxx b/build2/in/rule.cxx
index a6d4f2c..8a3244d 100644
--- a/build2/in/rule.cxx
+++ b/build2/in/rule.cxx
@@ -6,13 +6,13 @@
#include <cstdlib> // strtoull()
-#include <build2/depdb.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/function.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/depdb.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/in/target.hxx>
diff --git a/build2/in/rule.hxx b/build2/in/rule.hxx
index b3430c5..71dc032 100644
--- a/build2/in/rule.hxx
+++ b/build2/in/rule.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_IN_RULE_HXX
#define BUILD2_IN_RULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/rule.hxx>
+#include <libbuild2/rule.hxx>
namespace build2
{
diff --git a/build2/in/target.hxx b/build2/in/target.hxx
index 2e735f8..47b0eed 100644
--- a/build2/in/target.hxx
+++ b/build2/in/target.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_IN_TARGET_HXX
#define BUILD2_IN_TARGET_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/target.hxx>
namespace build2
{
diff --git a/build2/install/functions.cxx b/build2/install/functions.cxx
index a097052..5780fd8 100644
--- a/build2/install/functions.cxx
+++ b/build2/install/functions.cxx
@@ -2,8 +2,8 @@
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
#include <build2/install/utility.hxx>
diff --git a/build2/install/init.cxx b/build2/install/init.cxx
index 06bef86..055b8b1 100644
--- a/build2/install/init.cxx
+++ b/build2/install/init.cxx
@@ -4,12 +4,12 @@
#include <build2/install/init.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/rule.hxx>
-#include <build2/function.hxx>
-#include <build2/operation.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/rule.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/operation.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/config/utility.hxx>
diff --git a/build2/install/init.hxx b/build2/install/init.hxx
index 968ae93..579c03e 100644
--- a/build2/install/init.hxx
+++ b/build2/install/init.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_INSTALL_INIT_HXX
#define BUILD2_INSTALL_INIT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/install/operation.hxx b/build2/install/operation.hxx
index 1cfbab5..7de0225 100644
--- a/build2/install/operation.hxx
+++ b/build2/install/operation.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_INSTALL_OPERATION_HXX
#define BUILD2_INSTALL_OPERATION_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/operation.hxx>
+#include <libbuild2/operation.hxx>
namespace build2
{
diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx
index a17cc0d..faa7c3f 100644
--- a/build2/install/rule.cxx
+++ b/build2/install/rule.cxx
@@ -6,11 +6,11 @@
#include <libbutl/filesystem.mxx> // dir_exists(), file_exists()
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
using namespace butl;
diff --git a/build2/install/rule.hxx b/build2/install/rule.hxx
index 526683d..09dd1b5 100644
--- a/build2/install/rule.hxx
+++ b/build2/install/rule.hxx
@@ -5,13 +5,13 @@
#ifndef BUILD2_INSTALL_RULE_HXX
#define BUILD2_INSTALL_RULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/rule.hxx>
-#include <build2/action.hxx>
-#include <build2/target.hxx>
-#include <build2/filesystem.hxx>
+#include <libbuild2/rule.hxx>
+#include <libbuild2/action.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/filesystem.hxx>
namespace build2
{
diff --git a/build2/install/utility.hxx b/build2/install/utility.hxx
index 2544630..29c6db0 100644
--- a/build2/install/utility.hxx
+++ b/build2/install/utility.hxx
@@ -5,11 +5,11 @@
#ifndef BUILD2_INSTALL_UTILITY_HXX
#define BUILD2_INSTALL_UTILITY_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
namespace build2
{
diff --git a/build2/test/common.cxx b/build2/test/common.cxx
index 161ba94..bbfd489 100644
--- a/build2/test/common.cxx
+++ b/build2/test/common.cxx
@@ -4,8 +4,8 @@
#include <build2/test/common.hxx>
-#include <build2/target.hxx>
-#include <build2/algorithm.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/algorithm.hxx>
using namespace std;
diff --git a/build2/test/common.hxx b/build2/test/common.hxx
index f5d31c3..7ee72bd 100644
--- a/build2/test/common.hxx
+++ b/build2/test/common.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_TEST_COMMON_HXX
#define BUILD2_TEST_COMMON_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/target.hxx>
namespace build2
{
diff --git a/build2/test/init.cxx b/build2/test/init.cxx
index 342add7..725d557 100644
--- a/build2/test/init.cxx
+++ b/build2/test/init.cxx
@@ -4,10 +4,10 @@
#include <build2/test/init.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/rule.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/rule.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/config/utility.hxx>
diff --git a/build2/test/init.hxx b/build2/test/init.hxx
index 2ef0af7..f429645 100644
--- a/build2/test/init.hxx
+++ b/build2/test/init.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_TEST_INIT_HXX
#define BUILD2_TEST_INIT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/test/module.hxx b/build2/test/module.hxx
index 02ba492..0c32fb9 100644
--- a/build2/test/module.hxx
+++ b/build2/test/module.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_TEST_MODULE_HXX
#define BUILD2_TEST_MODULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
#include <build2/test/rule.hxx>
#include <build2/test/common.hxx>
diff --git a/build2/test/operation.hxx b/build2/test/operation.hxx
index 9b5f8db..09b954e 100644
--- a/build2/test/operation.hxx
+++ b/build2/test/operation.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_TEST_OPERATION_HXX
#define BUILD2_TEST_OPERATION_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/operation.hxx>
+#include <libbuild2/operation.hxx>
namespace build2
{
diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx
index a67ceff..7cb830c 100644
--- a/build2/test/rule.cxx
+++ b/build2/test/rule.cxx
@@ -4,11 +4,11 @@
#include <build2/test/rule.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/test/target.hxx>
@@ -548,7 +548,7 @@ namespace build2
diag_frame::stack_guard dsg (ds);
r = perform_script_impl (t, ts, wd, *this);
},
- diag_frame::stack,
+ diag_frame::stack (),
ref (r),
cref (t),
cref (ts),
diff --git a/build2/test/rule.hxx b/build2/test/rule.hxx
index 81952f9..2f0ef53 100644
--- a/build2/test/rule.hxx
+++ b/build2/test/rule.hxx
@@ -5,11 +5,11 @@
#ifndef BUILD2_TEST_RULE_HXX
#define BUILD2_TEST_RULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/rule.hxx>
-#include <build2/action.hxx>
+#include <libbuild2/rule.hxx>
+#include <libbuild2/action.hxx>
#include <build2/test/common.hxx>
diff --git a/build2/test/script/builtin.cxx b/build2/test/script/builtin.cxx
index e4eb895..14ea267 100644
--- a/build2/test/script/builtin.cxx
+++ b/build2/test/script/builtin.cxx
@@ -15,7 +15,7 @@
#include <libbutl/fdstream.mxx> // fdopen_mode, fdstream_mode
#include <libbutl/filesystem.mxx>
-#include <build2/context.hxx> // sched
+#include <libbuild2/context.hxx> // sched
#include <build2/test/script/script.hxx>
diff --git a/build2/test/script/builtin.hxx b/build2/test/script/builtin.hxx
index 2c6c0c5..af7c809 100644
--- a/build2/test/script/builtin.hxx
+++ b/build2/test/script/builtin.hxx
@@ -7,8 +7,8 @@
#include <map>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
namespace build2
{
diff --git a/build2/test/script/lexer.hxx b/build2/test/script/lexer.hxx
index 5ab0cc0..ad1c386 100644
--- a/build2/test/script/lexer.hxx
+++ b/build2/test/script/lexer.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_TEST_SCRIPT_LEXER_HXX
#define BUILD2_TEST_SCRIPT_LEXER_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/lexer.hxx>
+#include <libbuild2/lexer.hxx>
#include <build2/test/script/token.hxx>
diff --git a/build2/test/script/lexer.test.cxx b/build2/test/script/lexer.test.cxx
index 56418b7..c9905ec 100644
--- a/build2/test/script/lexer.test.cxx
+++ b/build2/test/script/lexer.test.cxx
@@ -5,8 +5,8 @@
#include <cassert>
#include <iostream>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
#include <build2/test/script/token.hxx>
#include <build2/test/script/lexer.hxx>
diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx
index 2ae0b05..59b950f 100644
--- a/build2/test/script/parser.cxx
+++ b/build2/test/script/parser.cxx
@@ -6,7 +6,7 @@
#include <sstream>
-#include <build2/context.hxx> // sched, keep_going
+#include <libbuild2/context.hxx> // sched, keep_going
#include <build2/test/script/lexer.hxx>
#include <build2/test/script/runner.hxx>
@@ -3013,7 +3013,9 @@ namespace build2
// If the scope was executed synchronously, check the status
// and bail out if we weren't asked to keep going.
//
- const diag_frame* df (diag_frame::stack); // UBSan workaround.
+ // UBSan workaround.
+ //
+ const diag_frame* df (diag_frame::stack ());
if (!sched.async (task_count,
[] (const diag_frame* ds,
scope& s,
diff --git a/build2/test/script/parser.hxx b/build2/test/script/parser.hxx
index 9ca0cf1..dfa1126 100644
--- a/build2/test/script/parser.hxx
+++ b/build2/test/script/parser.hxx
@@ -5,11 +5,11 @@
#ifndef BUILD2_TEST_SCRIPT_PARSER_HXX
#define BUILD2_TEST_SCRIPT_PARSER_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/parser.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/parser.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/test/script/token.hxx>
#include <build2/test/script/script.hxx>
diff --git a/build2/test/script/parser.test.cxx b/build2/test/script/parser.test.cxx
index ea5da0a..352941a 100644
--- a/build2/test/script/parser.test.cxx
+++ b/build2/test/script/parser.test.cxx
@@ -5,12 +5,12 @@
#include <cassert>
#include <iostream>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx> // reset()
-#include <build2/scheduler.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx> // reset()
+#include <libbuild2/scheduler.hxx>
#include <build2/test/target.hxx>
diff --git a/build2/test/script/regex.hxx b/build2/test/script/regex.hxx
index 70de7ee..500c21b 100644
--- a/build2/test/script/regex.hxx
+++ b/build2/test/script/regex.hxx
@@ -12,8 +12,8 @@
#include <type_traits> // make_unsigned, enable_if, is_*
#include <unordered_set>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
namespace build2
{
diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx
index 0d3716f..9031211 100644
--- a/build2/test/script/runner.cxx
+++ b/build2/test/script/runner.cxx
@@ -10,9 +10,9 @@
#include <libbutl/regex.mxx>
#include <libbutl/fdstream.mxx> // fdopen_mode, fdnull(), fddup()
-#include <build2/variable.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/test/common.hxx>
diff --git a/build2/test/script/runner.hxx b/build2/test/script/runner.hxx
index 843ff52..5f70dcc 100644
--- a/build2/test/script/runner.hxx
+++ b/build2/test/script/runner.hxx
@@ -5,8 +5,8 @@
#ifndef BUILD2_TEST_SCRIPT_RUNNER_HXX
#define BUILD2_TEST_SCRIPT_RUNNER_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
#include <build2/test/script/script.hxx>
diff --git a/build2/test/script/script.cxx b/build2/test/script/script.cxx
index 865c798..8e6351f 100644
--- a/build2/test/script/script.cxx
+++ b/build2/test/script/script.cxx
@@ -6,8 +6,8 @@
#include <sstream>
-#include <build2/target.hxx>
-#include <build2/algorithm.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/algorithm.hxx>
using namespace std;
diff --git a/build2/test/script/script.hxx b/build2/test/script/script.hxx
index 4da9d97..cc162cb 100644
--- a/build2/test/script/script.hxx
+++ b/build2/test/script/script.hxx
@@ -7,10 +7,10 @@
#include <set>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/variable.hxx>
#include <build2/test/target.hxx>
diff --git a/build2/test/script/token.hxx b/build2/test/script/token.hxx
index d239787..c79ef1b 100644
--- a/build2/test/script/token.hxx
+++ b/build2/test/script/token.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_TEST_SCRIPT_TOKEN_HXX
#define BUILD2_TEST_SCRIPT_TOKEN_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/token.hxx>
+#include <libbuild2/token.hxx>
namespace build2
{
diff --git a/build2/test/target.hxx b/build2/test/target.hxx
index b8b2d3d..6cd07b9 100644
--- a/build2/test/target.hxx
+++ b/build2/test/target.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_TEST_TARGET_HXX
#define BUILD2_TEST_TARGET_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/target.hxx>
namespace build2
{
diff --git a/build2/types-parsers.hxx b/build2/types-parsers.hxx
index 5aa9d37..beea977 100644
--- a/build2/types-parsers.hxx
+++ b/build2/types-parsers.hxx
@@ -8,7 +8,7 @@
#ifndef BUILD2_TYPES_PARSERS_HXX
#define BUILD2_TYPES_PARSERS_HXX
-#include <build2/types.hxx>
+#include <libbuild2/types.hxx>
namespace build2
{
diff --git a/build2/version/init.cxx b/build2/version/init.cxx
index 77fb35d..8c9cd42 100644
--- a/build2/version/init.cxx
+++ b/build2/version/init.cxx
@@ -6,10 +6,10 @@
#include <libbutl/manifest-parser.mxx>
-#include <build2/scope.hxx>
-#include <build2/context.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/config/utility.hxx>
diff --git a/build2/version/init.hxx b/build2/version/init.hxx
index 1e23371..ef3688a 100644
--- a/build2/version/init.hxx
+++ b/build2/version/init.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_VERSION_INIT_HXX
#define BUILD2_VERSION_INIT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/version/module.hxx b/build2/version/module.hxx
index 1c6e637..d2b681c 100644
--- a/build2/version/module.hxx
+++ b/build2/version/module.hxx
@@ -7,10 +7,10 @@
#include <map>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
namespace build2
{
diff --git a/build2/version/rule.cxx b/build2/version/rule.cxx
index 674defd..912efe3 100644
--- a/build2/version/rule.cxx
+++ b/build2/version/rule.cxx
@@ -4,9 +4,9 @@
#include <build2/version/rule.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <build2/in/target.hxx>
diff --git a/build2/version/rule.hxx b/build2/version/rule.hxx
index 2813f87..8eb4830 100644
--- a/build2/version/rule.hxx
+++ b/build2/version/rule.hxx
@@ -5,8 +5,8 @@
#ifndef BUILD2_VERSION_RULE_HXX
#define BUILD2_VERSION_RULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
#include <build2/in/rule.hxx>
#include <build2/install/rule.hxx>
diff --git a/build2/version/snapshot.cxx b/build2/version/snapshot.cxx
index aa58a6e..b43e083 100644
--- a/build2/version/snapshot.cxx
+++ b/build2/version/snapshot.cxx
@@ -4,7 +4,7 @@
#include <build2/version/snapshot.hxx>
-#include <build2/filesystem.hxx>
+#include <libbuild2/filesystem.hxx>
using namespace std;
diff --git a/build2/version/snapshot.hxx b/build2/version/snapshot.hxx
index 78ad174..824ec89 100644
--- a/build2/version/snapshot.hxx
+++ b/build2/version/snapshot.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_VERSION_SNAPSHOT_HXX
#define BUILD2_VERSION_SNAPSHOT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/scope.hxx>
+#include <libbuild2/scope.hxx>
namespace build2
{
diff --git a/build2/version/utility.cxx b/build2/version/utility.cxx
index 6c4d43e..8286ff8 100644
--- a/build2/version/utility.cxx
+++ b/build2/version/utility.cxx
@@ -7,7 +7,7 @@
#include <libbutl/manifest-parser.mxx>
#include <libbutl/manifest-serializer.mxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace butl;
diff --git a/build2/version/utility.hxx b/build2/version/utility.hxx
index 5baebeb..83bb91c 100644
--- a/build2/version/utility.hxx
+++ b/build2/version/utility.hxx
@@ -5,10 +5,10 @@
#ifndef BUILD2_VERSION_UTILITY_HXX
#define BUILD2_VERSION_UTILITY_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/filesystem.hxx>
+#include <libbuild2/filesystem.hxx>
namespace build2
{
diff --git a/libbuild2/.gitignore b/libbuild2/.gitignore
new file mode 100644
index 0000000..292d2f8
--- /dev/null
+++ b/libbuild2/.gitignore
@@ -0,0 +1,5 @@
+# Unit test executables and Testscript output directories
+# (can be symlinks).
+#
+*.test
+test-*.test
diff --git a/build2/action.hxx b/libbuild2/action.hxx
index eeb73fd..9fa2a16 100644
--- a/build2/action.hxx
+++ b/libbuild2/action.hxx
@@ -1,12 +1,14 @@
-// file : build2/action.hxx -*- C++ -*-
+// file : libbuild2/action.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_ACTION_HXX
-#define BUILD2_ACTION_HXX
+#ifndef LIBBUILD2_ACTION_HXX
+#define LIBBUILD2_ACTION_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -106,7 +108,7 @@ namespace build2
bool operator>= (action, action) = delete;
bool operator<= (action, action) = delete;
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, action); // operation.cxx
// Inner/outer operation state container.
@@ -197,4 +199,4 @@ namespace build2
enum class execution_mode {first, last};
}
-#endif // BUILD2_ACTION_HXX
+#endif // LIBBUILD2_ACTION_HXX
diff --git a/build2/algorithm.cxx b/libbuild2/algorithm.cxx
index 892767a..963714b 100644
--- a/build2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -1,18 +1,18 @@
-// file : build2/algorithm.cxx -*- C++ -*-
+// file : libbuild2/algorithm.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/algorithm.hxx>
+#include <libbuild2/algorithm.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/rule.hxx>
-#include <build2/file.hxx> // import()
-#include <build2/search.hxx>
-#include <build2/context.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
-#include <build2/prerequisite.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/rule.hxx>
+#include <libbuild2/file.hxx> // import()
+#include <libbuild2/search.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
+#include <libbuild2/prerequisite.hxx>
using namespace std;
using namespace butl;
@@ -104,12 +104,27 @@ namespace build2
// target_lock
//
+ static
#ifdef __cpp_thread_local
thread_local
#else
__thread
#endif
- const target_lock* target_lock::stack = nullptr;
+ const target_lock* target_lock_stack = nullptr;
+
+ const target_lock* target_lock::
+ stack () noexcept
+ {
+ return target_lock_stack;
+ }
+
+ const target_lock* target_lock::
+ stack (const target_lock* s) noexcept
+ {
+ const target_lock* r (target_lock_stack);
+ target_lock_stack = s;
+ return r;
+ }
// If the work_queue is absent, then we don't wait.
//
@@ -601,8 +616,8 @@ namespace build2
}
catch (const failed&) {} // Phase lock failure.
},
- diag_frame::stack,
- target_lock::stack,
+ diag_frame::stack (),
+ target_lock::stack (),
ref (*ld.target),
ld.offset))
return make_pair (true, target_state::postponed); // Queued.
@@ -798,11 +813,11 @@ namespace build2
// Instantiate only for what we need.
//
- template void
+ template LIBBUILD2_SYMEXPORT void
match_members<const target*> (action, target&,
const target* const*, size_t);
- template void
+ template LIBBUILD2_SYMEXPORT void
match_members<prerequisite_target> (action, target&,
prerequisite_target const*, size_t);
@@ -1580,7 +1595,7 @@ namespace build2
diag_frame::stack_guard dsg (ds);
execute_impl (a, t);
},
- diag_frame::stack,
+ diag_frame::stack (),
ref (t)))
return target_state::unknown; // Queued.
@@ -1763,19 +1778,19 @@ namespace build2
// Instantiate only for what we need.
//
- template target_state
+ template LIBBUILD2_SYMEXPORT target_state
straight_execute_members<const target*> (
action, atomic_count&, const target*[], size_t, size_t);
- template target_state
+ template LIBBUILD2_SYMEXPORT target_state
reverse_execute_members<const target*> (
action, atomic_count&, const target*[], size_t, size_t);
- template target_state
+ template LIBBUILD2_SYMEXPORT target_state
straight_execute_members<prerequisite_target> (
action, atomic_count&, prerequisite_target[], size_t, size_t);
- template target_state
+ template LIBBUILD2_SYMEXPORT target_state
reverse_execute_members<prerequisite_target> (
action, atomic_count&, prerequisite_target[], size_t, size_t);
diff --git a/build2/algorithm.hxx b/libbuild2/algorithm.hxx
index b246c37..50e8423 100644
--- a/build2/algorithm.hxx
+++ b/libbuild2/algorithm.hxx
@@ -1,15 +1,17 @@
-// file : build2/algorithm.hxx -*- C++ -*-
+// file : libbuild2/algorithm.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_ALGORITHM_HXX
-#define BUILD2_ALGORITHM_HXX
+#ifndef LIBBUILD2_ALGORITHM_HXX
+#define LIBBUILD2_ALGORITHM_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/action.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/action.hxx>
+#include <libbuild2/target.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -36,10 +38,10 @@ namespace build2
// As above but specify the prerequisite to search as a key.
//
- const target&
+ LIBBUILD2_SYMEXPORT const target&
search (const target&, const prerequisite_key&);
- const target*
+ LIBBUILD2_SYMEXPORT const target*
search_existing (const prerequisite_key&);
// Uniform search interface for prerequisite/prerequisite_member.
@@ -91,13 +93,13 @@ namespace build2
// first created a prerequisite based on this name in exactly the same way
// as the parser would and then searched based on this prerequisite.
//
- const target&
+ LIBBUILD2_SYMEXPORT const target&
search (const target&, name, const scope&);
// Unlike the above version, this one can be called during the execute
// phase. Return NULL for unknown target types.
//
- const target*
+ LIBBUILD2_SYMEXPORT const target*
search_existing (const name&,
const scope&,
const dir_path& out = dir_path ());
@@ -108,7 +110,7 @@ namespace build2
// maintain a stack of active locks in the current dependency chain (used to
// detect dependency cycles).
//
- struct target_lock
+ struct LIBBUILD2_SYMEXPORT target_lock
{
using action_type = build2::action;
using target_type = build2::target;
@@ -146,13 +148,16 @@ namespace build2
data
release ();
- static
-#ifdef __cpp_thread_local
- thread_local
-#else
- __thread
-#endif
- const target_lock* stack; // Tip of the stack.
+ // Tip of the stack.
+ //
+ static const target_lock*
+ stack () noexcept;
+
+ // Set the new and return the previous tip of the stack.
+ //
+ static const target_lock*
+ stack (const target_lock*) noexcept;
+
const target_lock* prev;
void
@@ -160,8 +165,8 @@ namespace build2
struct stack_guard
{
- explicit stack_guard (const target_lock* s): s_ (stack) {stack = s;}
- ~stack_guard () {stack = s_;}
+ explicit stack_guard (const target_lock* s): s_ (stack (s)) {}
+ ~stack_guard () {stack (s_);}
const target_lock* s_;
};
};
@@ -198,7 +203,7 @@ namespace build2
// things like changing the ad hoc member name by declaring it in a
// buildfile.
//
- target&
+ LIBBUILD2_SYMEXPORT target&
add_adhoc_member (target&,
const target_type&,
const dir_path& dir,
@@ -336,7 +341,7 @@ namespace build2
// prerequisites for the clean operation. If this target is a member of a
// group, then first do this to the group's prerequisites.
//
- using match_search =function<
+ using match_search = function<
prerequisite_target (action,
const target&,
const prerequisite&,
@@ -433,7 +438,7 @@ namespace build2
// the target is in src tree). This can be used, for example, to place
// output into an otherwise non-existent directory.
//
- const fsdir*
+ LIBBUILD2_SYMEXPORT const fsdir*
inject_fsdir (action, target&, bool parent = true);
// Execute the action on target, assuming a rule has been matched and the
@@ -493,7 +498,7 @@ namespace build2
// Note: waits for the completion if the target is busy and translates
// target_state::failed to the failed exception.
//
- target_state
+ LIBBUILD2_SYMEXPORT target_state
execute_direct (action, const target&);
// The default prerequisite execute implementation. Call execute_async() on
@@ -656,36 +661,36 @@ namespace build2
// Return noop_recipe instead of using this function directly.
//
- target_state
+ LIBBUILD2_SYMEXPORT target_state
noop_action (action, const target&);
// Default action implementation which forwards to the prerequisites.
// Use default_recipe instead of using this function directly.
//
- target_state
+ LIBBUILD2_SYMEXPORT target_state
default_action (action, const target&);
// Standard perform(clean) action implementation for the file target
// (or derived).
//
- target_state
+ LIBBUILD2_SYMEXPORT target_state
perform_clean (action, const target&);
// As above, but also removes the auxiliary dependency database (.d file).
//
- target_state
+ LIBBUILD2_SYMEXPORT target_state
perform_clean_depdb (action, const target&);
// As above but clean the target group. The group should be an mtime_target
// and members should be files.
//
- target_state
+ LIBBUILD2_SYMEXPORT target_state
perform_clean_group (action, const target&);
// As above but clean both the target group and depdb. The depdb file path
// is derived from the first member file path.
//
- target_state
+ LIBBUILD2_SYMEXPORT target_state
perform_clean_group_depdb (action, const target&);
// Helper for custom perform(clean) implementations that cleans extra files
@@ -721,7 +726,7 @@ namespace build2
using clean_adhoc_extras = small_vector<clean_adhoc_extra, 2>;
- target_state
+ LIBBUILD2_SYMEXPORT target_state
perform_clean_extra (action, const file&,
const clean_extras&,
const clean_adhoc_extras& = {});
@@ -745,29 +750,29 @@ namespace build2
overwrite // Copy over but don't remove on clean (committed gen code).
};
- void
+ LIBBUILD2_SYMEXPORT void
update_backlink (const file& target,
const path& link,
bool changed,
backlink_mode = backlink_mode::link);
- void
+ LIBBUILD2_SYMEXPORT void
update_backlink (const path& target,
const path& link,
bool changed,
backlink_mode = backlink_mode::link);
- void
+ LIBBUILD2_SYMEXPORT void
update_backlink (const path& target,
const path& link,
backlink_mode = backlink_mode::link);
- void
+ LIBBUILD2_SYMEXPORT void
clean_backlink (const path& link,
uint16_t verbosity,
backlink_mode = backlink_mode::link);
}
-#include <build2/algorithm.ixx>
+#include <libbuild2/algorithm.ixx>
-#endif // BUILD2_ALGORITHM_HXX
+#endif // LIBBUILD2_ALGORITHM_HXX
diff --git a/build2/algorithm.ixx b/libbuild2/algorithm.ixx
index c79ee49..7d68611 100644
--- a/build2/algorithm.ixx
+++ b/libbuild2/algorithm.ixx
@@ -1,9 +1,11 @@
-// file : build2/algorithm.ixx -*- C++ -*-
+// file : libbuild2/algorithm.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/rule.hxx>
-#include <build2/context.hxx>
+#include <libbuild2/rule.hxx>
+#include <libbuild2/context.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -117,10 +119,10 @@ namespace build2
t, T::static_type, dir, out, name, ext, scope).template as<T> ();
}
- target_lock
+ LIBBUILD2_SYMEXPORT target_lock
lock_impl (action, const target&, optional<scheduler::work_queue>);
- void
+ LIBBUILD2_SYMEXPORT void
unlock_impl (action, target&, size_t);
inline target_lock::
@@ -128,10 +130,7 @@ namespace build2
: action (a), target (t), offset (o)
{
if (target != nullptr)
- {
- prev = stack;
- stack = this;
- }
+ prev = stack (this);
}
inline void target_lock::
@@ -139,8 +138,8 @@ namespace build2
{
if (target != nullptr && prev != this)
{
- assert (stack == this);
- stack = prev;
+ const target_lock* cur (stack (prev));
+ assert (cur == this);
prev = this;
}
}
@@ -154,8 +153,8 @@ namespace build2
if (prev != this)
{
- assert (stack == this);
- stack = prev;
+ const target_lock* cur (stack (prev));
+ assert (cur == this);
}
target = nullptr;
@@ -171,8 +170,8 @@ namespace build2
{
if (prev != this)
{
- assert (stack == this);
- stack = prev;
+ const target_lock* cur (stack (prev));
+ assert (cur == this);
}
target = nullptr;
@@ -195,9 +194,9 @@ namespace build2
{
if (x.prev != &x)
{
- assert (stack == &x);
+ const target_lock* cur (stack (this));
+ assert (cur == &x);
prev = x.prev;
- stack = this;
}
else
prev = this;
@@ -221,9 +220,9 @@ namespace build2
{
if (x.prev != &x)
{
- assert (stack == &x);
+ const target_lock* cur (stack (this));
+ assert (cur == &x);
prev = x.prev;
- stack = this;
}
else
prev = this;
@@ -238,7 +237,7 @@ namespace build2
inline const target_lock*
dependency_cycle (action a, const target& t)
{
- const target_lock* l (target_lock::stack);
+ const target_lock* l (target_lock::stack ());
for (; l != nullptr; l = l->prev)
{
@@ -291,13 +290,13 @@ namespace build2
return m;
}
- const rule_match*
+ LIBBUILD2_SYMEXPORT const rule_match*
match_impl (action, target&, const rule* skip, bool try_match = false);
- recipe
+ LIBBUILD2_SYMEXPORT recipe
apply_impl (action, target&, const rule_match&);
- pair<bool, target_state>
+ LIBBUILD2_SYMEXPORT pair<bool, target_state>
match (action, const target&, size_t, atomic_count*, bool try_match = false);
inline void
@@ -470,7 +469,7 @@ namespace build2
return match (a.inner_action (), t, um);
}
- group_view
+ LIBBUILD2_SYMEXPORT group_view
resolve_members_impl (action, const target&, target_lock);
inline group_view
@@ -508,7 +507,7 @@ namespace build2
return r;
}
- void
+ LIBBUILD2_SYMEXPORT void
resolve_group_impl (action, const target&, target_lock);
inline const target*
@@ -540,10 +539,10 @@ namespace build2
return t.group;
}
- void
+ LIBBUILD2_SYMEXPORT void
match_prerequisites (action, target&, const match_search&, const scope*);
- void
+ LIBBUILD2_SYMEXPORT void
match_prerequisite_members (action, target&,
const match_search_member&,
const scope*);
@@ -597,7 +596,7 @@ namespace build2
match_prerequisite_members (a, t, nullptr, &s);
}
- target_state
+ LIBBUILD2_SYMEXPORT target_state
execute (action, const target&, size_t, atomic_count*);
inline target_state
@@ -708,7 +707,7 @@ namespace build2
// If the first argument is NULL, then the result is treated as a boolean
// value.
//
- pair<optional<target_state>, const target*>
+ LIBBUILD2_SYMEXPORT pair<optional<target_state>, const target*>
execute_prerequisites (const target_type*,
action, const target&,
const timestamp&, const execute_filter&,
diff --git a/libbuild2/buildfile b/libbuild2/buildfile
new file mode 100644
index 0000000..99f616c
--- /dev/null
+++ b/libbuild2/buildfile
@@ -0,0 +1,85 @@
+# file : libbuild2/buildfile
+# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+import int_libs = libbutl%lib{butl}
+
+./: lib{build2}: libul{build2}: {hxx ixx txx cxx}{** -config \
+ -version \
+ -**.test...} \
+ {hxx}{config version} \
+ $int_libs
+
+# Include the generated config and version headers into the distribution (so
+# that we don't pick up installed ones) and don't remove them when cleaning in
+# src (so that clean results in a state identical to distributed).
+#
+hxx{config}: in{config}
+hxx{version}: in{version} $src_root/manifest
+
+hxx{config version}:
+{
+ dist = true
+ clean = ($src_root != $out_root)
+}
+
+# Unit tests.
+#
+exe{*.test}:
+{
+ test = true
+ install = false
+}
+
+for t: cxx{**.test...}
+{
+ d = $directory($t)
+ n = $name($t)...
+ b = $path.base($name($t))
+
+ ./: $d/exe{$n}: $t $d/{hxx ixx txx}{+$n} $d/testscript{+$n +$b+*.test...}
+ $d/exe{$n}: libul{build2}: bin.whole = false
+}
+
+# Build options.
+#
+obja{*}: cxx.poptions += -DLIBBUILD2_STATIC_BUILD
+objs{*}: cxx.poptions += -DLIBBUILD2_SHARED_BUILD
+
+# Pass our compiler target to be used as libbuild2 host.
+#
+obj{context}: cxx.poptions += -DBUILD2_HOST_TRIPLET=\"$cxx.target\"
+obja{context}: cxx.poptions += -DLIBBUILD2_STATIC_BUILD
+objs{context}: cxx.poptions += -DLIBBUILD2_SHARED_BUILD
+
+if ($cxx.target.class != "windows")
+ cxx.libs += -lpthread
+
+# Export options.
+#
+lib{build2}:
+{
+ cxx.export.poptions = "-I$out_root" "-I$src_root"
+ cxx.export.libs = $int_libs
+}
+
+liba{build2}: cxx.export.poptions += -DLIBBUILD2_STATIC
+libs{build2}: cxx.export.poptions += -DLIBBUILD2_SHARED
+
+# For pre-releases use the complete version to make sure they cannot be used
+# in place of another pre-release or the final version. See the version module
+# for details on the version.* variable values.
+#
+if $version.pre_release
+ lib{build2}: bin.lib.version = @"-$version.project_id"
+else
+ lib{build2}: bin.lib.version = @"-$version.major.$version.minor"
+
+# Install into the libbuild2/ subdirectory of, say, /usr/include/
+# recreating subdirectories.
+#
+{hxx ixx txx}{*}:
+{
+ install = include/libbuild2/
+ install.subdirs = true
+}
diff --git a/libbuild2/config.hxx b/libbuild2/config.hxx
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libbuild2/config.hxx
diff --git a/build2/config.hxx.in b/libbuild2/config.hxx.in
index 07499b1..62110da 100644
--- a/build2/config.hxx.in
+++ b/libbuild2/config.hxx.in
@@ -1,16 +1,16 @@
-// file : build2/config.hxx.in -*- C++ -*-
+// file : libbuild2/config.hxx.in -*- C++ -*-
// copyright : Copyright (c) 2014-2019 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.
+// This file is included by <libbuild2/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
+#ifndef LIBBUILD2_CONFIG_HXX
+#define LIBBUILD2_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
@@ -19,19 +19,19 @@
// toolchain. Bootstrap will be a problem though. (Maybe set it to nullptr and
// say that it shall not be queried?)
//
-#define BUILD2_STAGE true
+#define LIBBUILD2_STAGE true
// Modification time sanity checks are by default only enabled for the staged
// version but this can be overridden at runtime with --[no-]mtime-check.
//
-#if BUILD2_STAGE
-# define BUILD2_MTIME_CHECK true
+#if LIBBUILD2_STAGE
+# define LIBBUILD2_MTIME_CHECK true
#else
-# define BUILD2_MTIME_CHECK false
+# define LIBBUILD2_MTIME_CHECK false
#endif
#ifdef BUILD2_BOOTSTRAP
#else
#endif
-#endif // BUILD2_CONFIG_HXX
+#endif // LIBBUILD2_CONFIG_HXX
diff --git a/build2/context.cxx b/libbuild2/context.cxx
index e71201d..d56abb3 100644
--- a/build2/context.cxx
+++ b/libbuild2/context.cxx
@@ -1,26 +1,24 @@
-// file : build2/context.cxx -*- C++ -*-
+// file : libbuild2/context.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/context.hxx>
+#include <libbuild2/context.hxx>
#include <sstream>
#include <exception> // uncaught_exception[s]()
-#include <build2/rule.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/rule.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <libbutl/ft/exception.hxx> // uncaught_exceptions
// For command line variable parsing.
//
-#include <build2/token.hxx>
-#include <build2/lexer.hxx>
-#include <build2/parser.hxx>
-
-#include <build2/config/operation.hxx> // config::preprocess_create().
+#include <libbuild2/token.hxx>
+#include <libbuild2/lexer.hxx>
+#include <libbuild2/parser.hxx>
using namespace std;
using namespace butl;
@@ -34,13 +32,6 @@ namespace build2
size_t load_generation;
-#ifdef __cpp_thread_local
- thread_local
-#else
- __thread
-#endif
- phase_lock* phase_lock::instance;
-
bool phase_mutex::
lock (run_phase p)
{
@@ -216,11 +207,19 @@ namespace build2
// phase_lock
//
+ static
+#ifdef __cpp_thread_local
+ thread_local
+#else
+ __thread
+#endif
+ phase_lock* phase_lock_instance;
+
phase_lock::
phase_lock (run_phase p)
: p (p)
{
- if (phase_lock* l = instance)
+ if (phase_lock* l = phase_lock_instance)
assert (l->p == p);
else
{
@@ -230,7 +229,7 @@ namespace build2
throw failed ();
}
- instance = this;
+ phase_lock_instance = this;
//text << this_thread::get_id () << " phase acquire " << p;
}
@@ -239,9 +238,9 @@ namespace build2
phase_lock::
~phase_lock ()
{
- if (instance == this)
+ if (phase_lock_instance == this)
{
- instance = nullptr;
+ phase_lock_instance = nullptr;
phase_mutex::instance.unlock (p);
//text << this_thread::get_id () << " phase release " << p;
@@ -252,11 +251,11 @@ namespace build2
//
phase_unlock::
phase_unlock (bool u)
- : l (u ? phase_lock::instance : nullptr)
+ : l (u ? phase_lock_instance : nullptr)
{
if (u)
{
- phase_lock::instance = nullptr;
+ phase_lock_instance = nullptr;
phase_mutex::instance.unlock (l->p);
//text << this_thread::get_id () << " phase unlock " << l->p;
@@ -269,7 +268,7 @@ namespace build2
if (l != nullptr)
{
bool r (phase_mutex::instance.lock (l->p));
- phase_lock::instance = l;
+ phase_lock_instance = l;
// Fail unless we are already failing. Note that we keep the phase
// locked since there will be phase_lock down the stack to unlock it.
@@ -293,7 +292,7 @@ namespace build2
throw failed ();
}
- phase_lock::instance->p = n;
+ phase_lock_instance->p = n;
if (n == run_phase::load) // Note: load lock is exclusive.
load_generation++;
@@ -315,7 +314,7 @@ namespace build2
}
bool r (phase_mutex::instance.relock (n, o));
- phase_lock::instance->p = o;
+ phase_lock_instance->p = o;
// Similar logic to ~phase_unlock().
//
@@ -366,6 +365,14 @@ namespace build2
bool keep_going = false;
bool dry_run = false;
+ void (*config_save_variable) (scope&, const variable&, uint64_t);
+
+ const string& (*config_preprocess_create) (const variable_overrides&,
+ values&,
+ vector_view<opspec>&,
+ bool,
+ const location&);
+
variable_overrides
reset (const strings& cmd_vars)
{
@@ -386,15 +393,18 @@ namespace build2
vp.clear ();
// Reset meta/operation tables. Note that the order should match the id
- // constants in <build2/operation.hxx>.
+ // constants in <libbuild2/operation.hxx>.
//
meta_operation_table.clear ();
meta_operation_table.insert ("noop");
meta_operation_table.insert ("perform");
meta_operation_table.insert ("configure");
meta_operation_table.insert ("disfigure");
- meta_operation_table.insert (
- meta_operation_data ("create", &config::preprocess_create));
+
+ if (config_preprocess_create != nullptr)
+ meta_operation_table.insert (
+ meta_operation_data ("create", config_preprocess_create));
+
meta_operation_table.insert ("dist");
meta_operation_table.insert ("info");
@@ -481,7 +491,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.
//
- set ("build.version.stage", BUILD2_STAGE);
+ set ("build.version.stage", LIBBUILD2_STAGE);
}
// Enter the host information. Rather than jumping through hoops like
diff --git a/build2/context.hxx b/libbuild2/context.hxx
index 5799eef..66874e7 100644
--- a/build2/context.hxx
+++ b/libbuild2/context.hxx
@@ -1,23 +1,25 @@
-// file : build2/context.hxx -*- C++ -*-
+// file : libbuild2/context.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_CONTEXT_HXX
-#define BUILD2_CONTEXT_HXX
+#ifndef LIBBUILD2_CONTEXT_HXX
+#define LIBBUILD2_CONTEXT_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/scope.hxx>
-#include <build2/variable.hxx>
-#include <build2/operation.hxx>
-#include <build2/scheduler.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/operation.hxx>
+#include <libbuild2/scheduler.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
// Main (and only) scheduler. Started up and shut down in main().
//
- extern scheduler sched;
+ LIBBUILD2_SYMEXPORT extern scheduler sched;
// In order to perform each operation the build system goes through the
// following phases:
@@ -50,8 +52,8 @@ namespace build2
// various "nodes" to verify modifications are only done "within the
// islands".
//
- extern run_phase phase;
- extern size_t load_generation;
+ LIBBUILD2_SYMEXPORT extern run_phase phase;
+ LIBBUILD2_SYMEXPORT extern size_t load_generation;
// A "tri-mutex" that keeps all the threads in one of the three phases. When
// a thread wants to switch a phase, it has to wait for all the other
@@ -78,7 +80,7 @@ namespace build2
// false. Note that in this case we still switch to the desired phase. See
// the phase_{lock,switch,unlock} implementations for details.
//
- class phase_mutex
+ class LIBBUILD2_SYMEXPORT phase_mutex
{
public:
// Acquire a phase lock potentially blocking (unless already in the
@@ -190,7 +192,7 @@ namespace build2
// 3. Before calling wait(), we release our phase lock to allow switching
// the phase.
//
- struct phase_lock
+ struct LIBBUILD2_SYMEXPORT phase_lock
{
explicit phase_lock (run_phase);
~phase_lock ();
@@ -202,20 +204,12 @@ namespace build2
phase_lock& operator= (const phase_lock&) = delete;
run_phase p;
-
- static
-#ifdef __cpp_thread_local
- thread_local
-#else
- __thread
-#endif
- phase_lock* instance;
};
// Assuming we have a lock on the current phase, temporarily release it
// and reacquire on destruction.
//
- struct phase_unlock
+ struct LIBBUILD2_SYMEXPORT phase_unlock
{
phase_unlock (bool unlock = true);
~phase_unlock () noexcept (false);
@@ -226,7 +220,7 @@ namespace build2
// Assuming we have a lock on the current phase, temporarily switch to a
// new phase and switch back on destruction.
//
- struct phase_switch
+ struct LIBBUILD2_SYMEXPORT phase_switch
{
explicit phase_switch (run_phase);
~phase_switch () noexcept (false);
@@ -270,23 +264,32 @@ namespace build2
//
// Note: consider printing in info meta-operation if adding anything here.
//
- extern const variable* var_src_root;
- extern const variable* var_out_root;
- extern const variable* var_src_base;
- extern const variable* var_out_base;
- extern const variable* var_forwarded;
+ LIBBUILD2_SYMEXPORT extern const variable* var_src_root;
+ LIBBUILD2_SYMEXPORT extern const variable* var_out_root;
+ LIBBUILD2_SYMEXPORT extern const variable* var_src_base;
+ LIBBUILD2_SYMEXPORT extern const variable* var_out_base;
+ LIBBUILD2_SYMEXPORT extern const variable* var_forwarded;
- extern const variable* var_project;
- extern const variable* var_amalgamation;
- extern const variable* var_subprojects;
- extern const variable* var_version;
+ LIBBUILD2_SYMEXPORT extern const variable* var_project;
+ LIBBUILD2_SYMEXPORT extern const variable* var_amalgamation;
+ LIBBUILD2_SYMEXPORT extern const variable* var_subprojects;
+ LIBBUILD2_SYMEXPORT extern const variable* var_version;
+
+ // project.url
+ //
+ LIBBUILD2_SYMEXPORT extern const variable* var_project_url;
- extern const variable* var_project_url; // project.url
- extern const variable* var_project_summary; // project.summary
+ // project.summary
+ //
+ LIBBUILD2_SYMEXPORT extern const variable* var_project_summary;
- extern const variable* var_import_target; // import.target
+ // import.target
+ //
+ LIBBUILD2_SYMEXPORT extern const variable* var_import_target;
- extern const variable* var_clean; // [bool] target visibility
+ // [bool] target visibility
+ //
+ LIBBUILD2_SYMEXPORT extern const variable* var_clean;
// Forwarded configuration backlink mode. Valid values are:
//
@@ -299,7 +302,9 @@ namespace build2
//
// Note that it can be set by a matching rule as a rule-specific variable.
//
- extern const variable* var_backlink; // [string] target visibility
+ // [string] target visibility
+ //
+ LIBBUILD2_SYMEXPORT extern const variable* var_backlink;
// Prerequisite inclusion/exclusion. Valid values are:
//
@@ -324,13 +329,17 @@ namespace build2
// To query this value in rule implementations use the include() helpers
// from prerequisites.hxx.
//
- extern const variable* var_include; // [string] prereq visibility
+ // [string] prereq visibility
+ //
+ LIBBUILD2_SYMEXPORT extern const variable* var_include;
- extern const char var_extension[10]; // "extension"
+ LIBBUILD2_SYMEXPORT extern const char var_extension[10]; // "extension"
// The build.* namespace.
//
- extern const variable* var_build_meta_operation; // .meta_operation
+ // .meta_operation
+ //
+ LIBBUILD2_SYMEXPORT extern const variable* var_build_meta_operation;
// Current action (meta/operation).
//
@@ -338,23 +347,25 @@ namespace build2
// lifted. The name is always for an outer operation (or meta operation
// that hasn't been recognized as such yet).
//
- extern string current_mname;
- extern string current_oname;
+ LIBBUILD2_SYMEXPORT extern string current_mname;
+ LIBBUILD2_SYMEXPORT extern string current_oname;
- extern const meta_operation_info* current_mif;
- extern const operation_info* current_inner_oif;
- extern const operation_info* current_outer_oif;
- extern size_t current_on; // Current operation number (1-based) in the
- // meta-operation batch.
+ LIBBUILD2_SYMEXPORT extern const meta_operation_info* current_mif;
+ LIBBUILD2_SYMEXPORT extern const operation_info* current_inner_oif;
+ LIBBUILD2_SYMEXPORT extern const operation_info* current_outer_oif;
+
+ // Current operation number (1-based) in the meta-operation batch.
+ //
+ LIBBUILD2_SYMEXPORT extern size_t current_on;
- extern execution_mode current_mode;
+ LIBBUILD2_SYMEXPORT extern execution_mode current_mode;
// Some diagnostics (for example output directory creation/removal by the
// fsdir rule) is just noise at verbosity level 1 unless it is the only
// thing that is printed. So we can only suppress it in certain situations
// (e.g., dist) where we know we have already printed something.
//
- extern bool current_diag_noise;
+ LIBBUILD2_SYMEXPORT extern bool current_diag_noise;
// Total number of dependency relationships and targets with non-noop
// recipe in the current action.
@@ -368,9 +379,9 @@ namespace build2
// skipped executing the operation, then it should increment the skip count.
// These two counters are used for progress monitoring and diagnostics.
//
- extern atomic_count dependency_count;
- extern atomic_count target_count;
- extern atomic_count skip_count;
+ LIBBUILD2_SYMEXPORT extern atomic_count dependency_count;
+ LIBBUILD2_SYMEXPORT extern atomic_count target_count;
+ LIBBUILD2_SYMEXPORT extern atomic_count skip_count;
inline void
set_current_mif (const meta_operation_info& mif)
@@ -410,7 +421,7 @@ namespace build2
// serially. In parallel we queue most of the things up before we see any
// failures.
//
- extern bool keep_going;
+ LIBBUILD2_SYMEXPORT extern bool keep_going;
// Dry run flag (see --dry-run|-n).
//
@@ -443,12 +454,24 @@ namespace build2
// from filesystem) that respect this flag in order not to end up with a
// job half done.
//
- extern bool dry_run;
+ LIBBUILD2_SYMEXPORT extern bool dry_run;
+
+ // Config module entry points.
+ //
+ LIBBUILD2_SYMEXPORT extern void (*config_save_variable) (
+ scope&, const variable&, uint64_t flags);
+
+ LIBBUILD2_SYMEXPORT extern const string& (*config_preprocess_create) (
+ const variable_overrides&,
+ values&,
+ vector_view<opspec>&,
+ bool lifted,
+ const location&);
// Reset the build state. In particular, this removes all the targets,
// scopes, and variables.
//
- variable_overrides
+ LIBBUILD2_SYMEXPORT variable_overrides
reset (const strings& cmd_vars);
// Return the project name or empty string if unnamed.
@@ -463,17 +486,17 @@ namespace build2
// Return the src/out directory corresponding to the given out/src. The
// passed directory should be a sub-directory of out/src_root.
//
- dir_path
+ LIBBUILD2_SYMEXPORT dir_path
src_out (const dir_path& out, const scope& root);
- dir_path
+ LIBBUILD2_SYMEXPORT dir_path
src_out (const dir_path& out,
const dir_path& out_root, const dir_path& src_root);
- dir_path
+ LIBBUILD2_SYMEXPORT dir_path
out_src (const dir_path& src, const scope& root);
- dir_path
+ LIBBUILD2_SYMEXPORT dir_path
out_src (const dir_path& src,
const dir_path& out_root, const dir_path& src_root);
@@ -498,10 +521,10 @@ namespace build2
return os;
}
- string
+ LIBBUILD2_SYMEXPORT string
diag_do (const action&);
- void
+ LIBBUILD2_SYMEXPORT void
diag_do (ostream&, const action&, const target&);
inline diag_phrase
@@ -510,10 +533,10 @@ namespace build2
return diag_phrase {a, t, &diag_do};
}
- string
+ LIBBUILD2_SYMEXPORT string
diag_doing (const action&);
- void
+ LIBBUILD2_SYMEXPORT void
diag_doing (ostream&, const action&, const target&);
inline diag_phrase
@@ -522,10 +545,10 @@ namespace build2
return diag_phrase {a, t, &diag_doing};
}
- string
+ LIBBUILD2_SYMEXPORT string
diag_did (const action&);
- void
+ LIBBUILD2_SYMEXPORT void
diag_did (ostream&, const action&, const target&);
inline diag_phrase
@@ -534,7 +557,7 @@ namespace build2
return diag_phrase {a, t, &diag_did};
}
- void
+ LIBBUILD2_SYMEXPORT void
diag_done (ostream&, const action&, const target&);
inline diag_phrase
@@ -544,6 +567,6 @@ namespace build2
}
}
-#include <build2/context.ixx>
+#include <libbuild2/context.ixx>
-#endif // BUILD2_CONTEXT_HXX
+#endif // LIBBUILD2_CONTEXT_HXX
diff --git a/build2/context.ixx b/libbuild2/context.ixx
index 1c25922..f947bd7 100644
--- a/build2/context.ixx
+++ b/libbuild2/context.ixx
@@ -1,4 +1,4 @@
-// file : build2/context.ixx -*- C++ -*-
+// file : libbuild2/context.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
diff --git a/build2/depdb.cxx b/libbuild2/depdb.cxx
index 607e85a..32e5916 100644
--- a/build2/depdb.cxx
+++ b/libbuild2/depdb.cxx
@@ -1,15 +1,15 @@
-// file : build2/depdb.cxx -*- C++ -*-
+// file : libbuild2/depdb.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/depdb.hxx>
+#include <libbuild2/depdb.hxx>
#ifdef _WIN32
# include <libbutl/win32-utility.hxx>
#endif
-#include <build2/filesystem.hxx> // mtime()
-#include <build2/diagnostics.hxx>
+#include <libbuild2/filesystem.hxx> // mtime()
+#include <libbuild2/diagnostics.hxx>
using namespace std;
using namespace butl;
diff --git a/build2/depdb.hxx b/libbuild2/depdb.hxx
index 95d9f4b..8a1cd1f 100644
--- a/build2/depdb.hxx
+++ b/libbuild2/depdb.hxx
@@ -1,14 +1,16 @@
-// file : build2/depdb.hxx -*- C++ -*-
+// file : libbuild2/depdb.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_DEPDB_HXX
-#define BUILD2_DEPDB_HXX
+#ifndef LIBBUILD2_DEPDB_HXX
+#define LIBBUILD2_DEPDB_HXX
#include <cstring> // strlen()
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -58,7 +60,7 @@ namespace build2
// also used to handle the dry-run mode where we essentially do the
// interruption ourselves.
//
- struct depdb_base
+ struct LIBBUILD2_SYMEXPORT depdb_base
{
explicit
depdb_base (const path&, timestamp);
@@ -76,7 +78,7 @@ namespace build2
butl::fdbuf* buf_; // Current buffer (for tellg()/tellp()).
};
- class depdb: private depdb_base
+ class LIBBUILD2_SYMEXPORT depdb: private depdb_base
{
public:
using path_type = build2::path;
@@ -281,6 +283,6 @@ namespace build2
};
}
-#include <build2/depdb.ixx>
+#include <libbuild2/depdb.ixx>
-#endif // BUILD2_DEPDB_HXX
+#endif // LIBBUILD2_DEPDB_HXX
diff --git a/build2/depdb.ixx b/libbuild2/depdb.ixx
index cf67434..9f73fcb 100644
--- a/build2/depdb.ixx
+++ b/libbuild2/depdb.ixx
@@ -1,4 +1,4 @@
-// file : build2/depdb.ixx -*- C++ -*-
+// file : libbuild2/depdb.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
@@ -23,7 +23,7 @@ namespace build2
inline bool depdb::
mtime_check ()
{
- return mtime_check_option ? *mtime_check_option : BUILD2_MTIME_CHECK;
+ return mtime_check_option ? *mtime_check_option : LIBBUILD2_MTIME_CHECK;
}
inline void depdb::
diff --git a/build2/diagnostics.cxx b/libbuild2/diagnostics.cxx
index ac95c64..eab3b78 100644
--- a/build2/diagnostics.cxx
+++ b/libbuild2/diagnostics.cxx
@@ -1,8 +1,8 @@
-// file : build2/diagnostics.cxx -*- C++ -*-
+// file : libbuild2/diagnostics.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/diagnostics.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <cstring> // strchr()
@@ -53,12 +53,27 @@ namespace build2
// Diagnostics stack.
//
+ static
#ifdef __cpp_thread_local
thread_local
#else
__thread
#endif
- const diag_frame* diag_frame::stack = nullptr;
+ const diag_frame* diag_frame_stack = nullptr;
+
+ const diag_frame* diag_frame::
+ stack () noexcept
+ {
+ return diag_frame_stack;
+ }
+
+ const diag_frame* diag_frame::
+ stack (const diag_frame* f) noexcept
+ {
+ const diag_frame* r (diag_frame_stack);
+ diag_frame_stack = f;
+ return r;
+ }
// Diagnostic facility, project specifics.
//
diff --git a/build2/diagnostics.hxx b/libbuild2/diagnostics.hxx
index 992e741..9ad18ff 100644
--- a/build2/diagnostics.hxx
+++ b/libbuild2/diagnostics.hxx
@@ -1,14 +1,16 @@
-// file : build2/diagnostics.hxx -*- C++ -*-
+// file : libbuild2/diagnostics.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_DIAGNOSTICS_HXX
-#define BUILD2_DIAGNOSTICS_HXX
+#ifndef LIBBUILD2_DIAGNOSTICS_HXX
+#define LIBBUILD2_DIAGNOSTICS_HXX
#include <libbutl/diagnostics.mxx>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -29,10 +31,10 @@ namespace build2
// ...
// nameN arg arg ... nullptr nullptr
//
- void
+ LIBBUILD2_SYMEXPORT void
print_process (diag_record&, const char* const* args, size_t n = 0);
- void
+ LIBBUILD2_SYMEXPORT void
print_process (const char* const* args, size_t n = 0);
inline void
@@ -126,7 +128,7 @@ namespace build2
/* */ stream_verbosity (0, 1);
}
- extern const int stream_verb_index;
+ LIBBUILD2_SYMEXPORT extern const int stream_verb_index;
inline stream_verbosity
stream_verb (ostream& os)
@@ -173,17 +175,14 @@ namespace build2
// object optimization of std::function. So we have to complicate things
// a bit here.
//
- struct diag_frame
+ struct LIBBUILD2_SYMEXPORT diag_frame
{
explicit
diag_frame (void (*f) (const diag_frame&, const diag_record&))
: func_ (f)
{
if (func_ != nullptr)
- {
- prev_ = stack;
- stack = this;
- }
+ prev_ = stack (this);
}
diag_frame (diag_frame&& x)
@@ -192,7 +191,7 @@ namespace build2
if (func_ != nullptr)
{
prev_ = x.prev_;
- stack = this;
+ stack (this);
x.func_ = nullptr;
}
@@ -206,28 +205,30 @@ namespace build2
~diag_frame ()
{
if (func_ != nullptr )
- stack = prev_;
+ stack (prev_);
}
static void
apply (const diag_record& r)
{
- for (const diag_frame* f (stack); f != nullptr; f = f->prev_)
+ for (const diag_frame* f (stack ()); f != nullptr; f = f->prev_)
f->func_ (*f, r);
}
- static
-#ifdef __cpp_thread_local
- thread_local
-#else
- __thread
-#endif
- const diag_frame* stack; // Tip of the stack.
+ // Tip of the stack.
+ //
+ static const diag_frame*
+ stack () noexcept;
+
+ // Set the new and return the previous tip of the stack.
+ //
+ static const diag_frame*
+ stack (const diag_frame*) noexcept;
struct stack_guard
{
- explicit stack_guard (const diag_frame* s): s_ (stack) {stack = s;}
- ~stack_guard () {stack = s_;}
+ explicit stack_guard (const diag_frame* s): s_ (stack (s)) {}
+ ~stack_guard () {stack (s_);}
const diag_frame* s_;
};
@@ -261,7 +262,7 @@ namespace build2
// Diagnostic facility, project specifics.
//
- struct simple_prologue_base
+ struct LIBBUILD2_SYMEXPORT simple_prologue_base
{
explicit
simple_prologue_base (const char* type,
@@ -280,7 +281,7 @@ namespace build2
const stream_verbosity sverb_;
};
- struct location_prologue_base
+ struct LIBBUILD2_SYMEXPORT location_prologue_base
{
location_prologue_base (const char* type,
const char* mod,
@@ -367,10 +368,10 @@ namespace build2
};
using basic_mark = butl::diag_mark<basic_mark_base>;
- extern const basic_mark error;
- extern const basic_mark warn;
- extern const basic_mark info;
- extern const basic_mark text;
+ LIBBUILD2_SYMEXPORT extern const basic_mark error;
+ LIBBUILD2_SYMEXPORT extern const basic_mark warn;
+ LIBBUILD2_SYMEXPORT extern const basic_mark info;
+ LIBBUILD2_SYMEXPORT extern const basic_mark text;
// trace
//
@@ -428,8 +429,8 @@ namespace build2
};
using fail_end = butl::diag_noreturn_end<fail_end_base>;
- extern const fail_mark fail;
- extern const fail_end endf;
+ LIBBUILD2_SYMEXPORT extern const fail_mark fail;
+ LIBBUILD2_SYMEXPORT extern const fail_end endf;
}
-#endif // BUILD2_DIAGNOSTICS_HXX
+#endif // LIBBUILD2_DIAGNOSTICS_HXX
diff --git a/build2/dump.cxx b/libbuild2/dump.cxx
index 3b5d205..a866fe3 100644
--- a/build2/dump.cxx
+++ b/libbuild2/dump.cxx
@@ -1,14 +1,14 @@
-// file : build2/dump.cxx -*- C++ -*-
+// file : libbuild2/dump.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/dump.hxx>
+#include <libbuild2/dump.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/variable.hxx>
-#include <build2/context.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
diff --git a/build2/dump.hxx b/libbuild2/dump.hxx
index f8e3d03..fd1886b 100644
--- a/build2/dump.hxx
+++ b/libbuild2/dump.hxx
@@ -1,14 +1,16 @@
-// file : build2/dump.hxx -*- C++ -*-
+// file : libbuild2/dump.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_DUMP_HXX
-#define BUILD2_DUMP_HXX
+#ifndef LIBBUILD2_DUMP_HXX
+#define LIBBUILD2_DUMP_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/action.hxx>
+#include <libbuild2/action.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -19,14 +21,14 @@ namespace build2
// rules have been matched for this action and dump action-specific
// information (like rule-specific variables).
//
- void
+ LIBBUILD2_SYMEXPORT void
dump (optional<action> = nullopt);
- void
+ LIBBUILD2_SYMEXPORT void
dump (const scope&, const char* ind = "");
- void
+ LIBBUILD2_SYMEXPORT void
dump (const target&, const char* ind = "");
}
-#endif // BUILD2_DUMP_HXX
+#endif // LIBBUILD2_DUMP_HXX
diff --git a/libbuild2/export.hxx b/libbuild2/export.hxx
new file mode 100644
index 0000000..514c845
--- /dev/null
+++ b/libbuild2/export.hxx
@@ -0,0 +1,58 @@
+#pragma once
+
+// Normally we don't export class templates (but do complete specializations),
+// inline functions, and classes with only inline member functions. Exporting
+// classes that inherit from non-exported/imported bases (e.g., std::string)
+// will end up badly. The only known workarounds are to not inherit or to not
+// export. Also, MinGW GCC doesn't like seeing non-exported functions being
+// used before their inline definition. The workaround is to reorder code. In
+// the end it's all trial and error.
+//
+// Exportation of explicit template instantiations is even hairier: MinGW GCC
+// requires __declspec(dllexport) on the extern template declaration while VC
+// wants it on the definition. Use LIBBUILD2_{DEC,DEF}EXPORT for that.
+//
+
+#if defined(LIBBUILD2_STATIC) // Using static.
+# define LIBBUILD2_SYMEXPORT
+# define LIBBUILD2_DECEXPORT
+#elif defined(LIBBUILD2_STATIC_BUILD) // Building static.
+# define LIBBUILD2_SYMEXPORT
+# define LIBBUILD2_DECEXPORT
+# define LIBBUILD2_DEFEXPORT
+#elif defined(LIBBUILD2_SHARED) // Using shared.
+# ifdef _WIN32
+# define LIBBUILD2_SYMEXPORT __declspec(dllimport)
+# define LIBBUILD2_DECEXPORT __declspec(dllimport)
+# else
+# define LIBBUILD2_SYMEXPORT
+# define LIBBUILD2_DECEXPORT
+# endif
+#elif defined(LIBBUILD2_SHARED_BUILD) // Building shared.
+# ifdef _WIN32
+# define LIBBUILD2_SYMEXPORT __declspec(dllexport)
+# if defined(_MSC_VER)
+# define LIBBUILD2_DECEXPORT
+# define LIBBUILD2_DEFEXPORT __declspec(dllexport)
+# else
+# define LIBBUILD2_DECEXPORT __declspec(dllexport)
+# define LIBBUILD2_DEFEXPORT
+# endif
+# else
+# define LIBBUILD2_SYMEXPORT
+# define LIBBUILD2_DECEXPORT
+# define LIBBUILD2_DEFEXPORT
+# endif
+#else
+// If none of the above macros are defined, then we assume we are being used
+// by some third-party build system that cannot/doesn't signal the library
+// type. Note that this fallback works for both static and shared but in case
+// of shared will be sub-optimal compared to having dllimport. Also note that
+// bootstrap ends up here as well.
+//
+// Using static or shared.
+//
+# define LIBBUILD2_SYMEXPORT
+# define LIBBUILD2_DECEXPORT
+# define LIBBUILD2_DEFEXPORT
+#endif
diff --git a/build2/file.cxx b/libbuild2/file.cxx
index 8c7c74c..5966168 100644
--- a/build2/file.cxx
+++ b/libbuild2/file.cxx
@@ -1,23 +1,21 @@
-// file : build2/file.cxx -*- C++ -*-
+// file : libbuild2/file.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/file.hxx>
+#include <libbuild2/file.hxx>
#include <iostream> // cin
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/filesystem.hxx> // exists()
-#include <build2/prerequisite.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/filesystem.hxx> // exists()
+#include <libbuild2/prerequisite.hxx>
+#include <libbuild2/diagnostics.hxx>
-#include <build2/token.hxx>
-#include <build2/lexer.hxx>
-#include <build2/parser.hxx>
-
-#include <build2/config/utility.hxx>
+#include <libbuild2/token.hxx>
+#include <libbuild2/lexer.hxx>
+#include <libbuild2/parser.hxx>
using namespace std;
using namespace butl;
@@ -1292,7 +1290,11 @@ namespace build2
if (auto l = iroot[var])
{
out_root = cast<dir_path> (l); // Normalized and actualized.
- config::save_variable (iroot, var); // Mark as part of config.
+
+ // Mark as part of config.
+ //
+ if (config_save_variable != nullptr)
+ config_save_variable (iroot, var, 0 /* flags */);
// Empty config.import.* value means don't look in subprojects or
// amalgamations and go straight to the rule-specific import (e.g.,
@@ -1331,7 +1333,8 @@ namespace build2
if (r.empty ())
fail (loc) << "empty path in " << var.name;
- config::save_variable (iroot, var);
+ if (config_save_variable != nullptr)
+ config_save_variable (iroot, var, 0 /* flags */);
}
return r;
diff --git a/build2/file.hxx b/libbuild2/file.hxx
index c46d2d5..e2e8aaa 100644
--- a/build2/file.hxx
+++ b/libbuild2/file.hxx
@@ -1,17 +1,19 @@
-// file : build2/file.hxx -*- C++ -*-
+// file : libbuild2/file.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_FILE_HXX
-#define BUILD2_FILE_HXX
+#ifndef LIBBUILD2_FILE_HXX
+#define LIBBUILD2_FILE_HXX
#include <map>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/scope.hxx>
-#include <build2/variable.hxx> // list_value
+#include <libbuild2/scope.hxx>
+#include <libbuild2/variable.hxx> // list_value
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -21,15 +23,21 @@ namespace build2
using subprojects = std::map<project_name, dir_path>;
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, const subprojects&); // Print as name@dir sequence.
- extern const dir_path std_build_dir; // build/
- extern const path std_root_file; // build/root.build
- extern const path std_bootstrap_file; // build/bootstrap.build
+ LIBBUILD2_SYMEXPORT extern const dir_path std_build_dir; // build/
+
+ // build/root.build
+ //
+ LIBBUILD2_SYMEXPORT extern const path std_root_file;
+
+ // build/bootstrap.build
+ //
+ LIBBUILD2_SYMEXPORT extern const path std_bootstrap_file;
- extern const path std_buildfile_file; // buildfile
- extern const path alt_buildfile_file; // build2file
+ LIBBUILD2_SYMEXPORT extern const path std_buildfile_file; // buildfile
+ LIBBUILD2_SYMEXPORT extern const path alt_buildfile_file; // build2file
// If the altn argument value is present, then it indicates whether we are
// using the standard or the alternative build file/directory naming.
@@ -39,10 +47,10 @@ namespace build2
// naming scheme (by setting altn) and from then on all the remaining tests
// only look for things in this scheme.
//
- bool
+ LIBBUILD2_SYMEXPORT bool
is_src_root (const dir_path&, optional<bool>& altn);
- bool
+ LIBBUILD2_SYMEXPORT bool
is_out_root (const dir_path&, optional<bool>& altn);
// Given an src_base directory, look for a project's src_root based on the
@@ -50,7 +58,7 @@ namespace build2
// that if the input is normalized/actualized, then the output will be as
// well.
//
- dir_path
+ LIBBUILD2_SYMEXPORT dir_path
find_src_root (const dir_path&, optional<bool>& altn);
// The same as above but for project's out. Note that we also check whether
@@ -58,17 +66,17 @@ namespace build2
// the result returned as the second half of the pair. Note also that if the
// input is normalized/actualized, then the output will be as well.
//
- pair<dir_path, bool>
+ LIBBUILD2_SYMEXPORT pair<dir_path, bool>
find_out_root (const dir_path&, optional<bool>& altn);
// The old/new src_root paths. See main() (where they are set) for details.
//
- extern dir_path old_src_root;
- extern dir_path new_src_root;
+ LIBBUILD2_SYMEXPORT extern dir_path old_src_root;
+ LIBBUILD2_SYMEXPORT extern dir_path new_src_root;
// If buildfile is '-', then read from STDIN.
//
- void
+ LIBBUILD2_SYMEXPORT void
source (scope& root, scope& base, const path&);
// As above but first check if this buildfile has already been sourced for
@@ -79,25 +87,25 @@ namespace build2
// As above but checks against the specified scope rather than base.
//
- bool
+ LIBBUILD2_SYMEXPORT bool
source_once (scope& root, scope& base, const path&, scope& once);
// Create project's root scope. Only set the src_root variable if the passed
// src_root value is not empty. The scope argument is only used as proof of
// lock.
//
- scope_map::iterator
+ LIBBUILD2_SYMEXPORT scope_map::iterator
create_root (scope&, const dir_path& out_root, const dir_path& src_root);
// Setup root scope. Note that it assumes the src_root variable has already
// been set.
//
- void
+ LIBBUILD2_SYMEXPORT void
setup_root (scope&, bool forwarded);
// Setup the base scope (set *_base variables, etc).
//
- scope&
+ LIBBUILD2_SYMEXPORT scope&
setup_base (scope_map::iterator,
const dir_path& out_base,
const dir_path& src_base);
@@ -107,7 +115,7 @@ namespace build2
// the new scope is in another project. If the new scope is not in any
// project, then NULL is returned in second.
//
- pair<scope&, scope*>
+ LIBBUILD2_SYMEXPORT pair<scope&, scope*>
switch_scope (scope& root, const dir_path&);
// Bootstrap and optionally load an ad hoc (sub)project (i.e., the kind that
@@ -120,7 +128,7 @@ namespace build2
//
// The scope argument is only used as proof of lock.
//
- scope&
+ LIBBUILD2_SYMEXPORT scope&
load_project (scope&,
const dir_path& out_root,
const dir_path& src_root,
@@ -131,18 +139,18 @@ namespace build2
// src_root if there is no forward. See is_{src,out}_root() for the altn
// argument semantics.
//
- dir_path
+ LIBBUILD2_SYMEXPORT dir_path
bootstrap_fwd (const dir_path& src_root, optional<bool>& altn);
// Bootstrap the project's root scope, the out part.
//
- void
+ LIBBUILD2_SYMEXPORT void
bootstrap_out (scope& root, optional<bool>& altn);
// Bootstrap the project's root scope, the src part. Return true if we
// loaded anything (which confirms the src_root is not bogus).
//
- bool
+ LIBBUILD2_SYMEXPORT bool
bootstrap_src (scope& root, optional<bool>& altn);
// Return true if this scope has already been bootstrapped, that is, the
@@ -152,22 +160,22 @@ namespace build2
// setup_root()
// bootstrap_src()
//
- bool
+ LIBBUILD2_SYMEXPORT bool
bootstrapped (scope& root);
// Execute pre/post-bootstrap hooks. Similar to bootstrap_out/sr(), should
// only be called once per project bootstrap.
//
- void
+ LIBBUILD2_SYMEXPORT void
bootstrap_pre (scope& root, optional<bool>& altn);
- void
+ LIBBUILD2_SYMEXPORT void
bootstrap_post (scope& root);
// Create and bootstrap outer root scopes, if any. Loading is done by
// load_root().
//
- void
+ LIBBUILD2_SYMEXPORT void
create_bootstrap_outer (scope& root);
// Create and bootstrap inner root scopes, if any, recursively.
@@ -177,14 +185,14 @@ namespace build2
//
// Note that loading is done by load_root().
//
- scope&
+ LIBBUILD2_SYMEXPORT scope&
create_bootstrap_inner (scope& root, const dir_path& out_base = dir_path ());
// Load project's root.build (and root pre/post hooks) unless already
// loaded. Also make sure all outer root scopes are loaded prior to loading
// this root scope.
//
- void
+ LIBBUILD2_SYMEXPORT void
load_root (scope& root);
// Extract the specified variable value from a buildfile. It is expected to
@@ -192,7 +200,7 @@ namespace build2
// other than those from the global scope or any variable overrides. Return
// an indication of whether the variable was found.
//
- pair<value, bool>
+ LIBBUILD2_SYMEXPORT pair<value, bool>
extract_variable (const path&, const variable&);
// Import has two phases: the first is triggered by the import
@@ -215,7 +223,7 @@ namespace build2
// there is a package foo available in repository bar. Wanna
// download and use it?"
//
- names
+ LIBBUILD2_SYMEXPORT names
import (scope& base, name, const location&);
const target&
@@ -230,6 +238,6 @@ namespace build2
import_existing (const prerequisite_key&);
}
-#include <build2/file.ixx>
+#include <libbuild2/file.ixx>
-#endif // BUILD2_FILE_HXX
+#endif // LIBBUILD2_FILE_HXX
diff --git a/build2/file.ixx b/libbuild2/file.ixx
index a94d605..f8a79be 100644
--- a/build2/file.ixx
+++ b/libbuild2/file.ixx
@@ -1,7 +1,9 @@
-// file : build2/file.ixx -*- C++ -*-
+// file : libbuild2/file.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
+#include <libbuild2/export.hxx>
+
namespace build2
{
inline bool
@@ -10,7 +12,7 @@ namespace build2
return source_once (root, base, bf, base);
}
- const target*
+ LIBBUILD2_SYMEXPORT const target*
import (const prerequisite_key&, bool existing);
inline const target&
diff --git a/build2/filesystem.cxx b/libbuild2/filesystem.cxx
index 7242347..83408fa 100644
--- a/build2/filesystem.cxx
+++ b/libbuild2/filesystem.cxx
@@ -1,11 +1,11 @@
-// file : build2/filesystem.cxx -*- C++ -*-
+// file : libbuild2/filesystem.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/filesystem.hxx>
+#include <libbuild2/filesystem.hxx>
-#include <build2/context.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
using namespace butl;
diff --git a/build2/filesystem.hxx b/libbuild2/filesystem.hxx
index 2ba928c..6dca528 100644
--- a/build2/filesystem.hxx
+++ b/libbuild2/filesystem.hxx
@@ -1,14 +1,16 @@
-// file : build2/filesystem.hxx -*- C++ -*-
+// file : libbuild2/filesystem.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_FILESYSTEM_HXX
-#define BUILD2_FILESYSTEM_HXX
+#ifndef LIBBUILD2_FILESYSTEM_HXX
+#define LIBBUILD2_FILESYSTEM_HXX
#include <libbutl/filesystem.mxx>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/export.hxx>
// Higher-level filesystem utilities built on top of <libbutl/filesystem.mxx>.
//
@@ -40,14 +42,14 @@ namespace build2
// specified verbosity level. If the file does not exist and create is true,
// create it and fail otherwise.
//
- void
+ LIBBUILD2_SYMEXPORT void
touch (const path&, bool create, uint16_t verbosity = 1);
// Return the modification time for an existing regular file and
// timestamp_nonexistent otherwise. Print the diagnostics and fail on system
// error.
//
- timestamp
+ LIBBUILD2_SYMEXPORT timestamp
mtime (const char*);
inline timestamp
@@ -69,10 +71,10 @@ namespace build2
//
using mkdir_status = butl::mkdir_status;
- fs_status<mkdir_status>
+ LIBBUILD2_SYMEXPORT fs_status<mkdir_status>
mkdir (const dir_path&, uint16_t verbosity = 1);
- fs_status<mkdir_status>
+ LIBBUILD2_SYMEXPORT fs_status<mkdir_status>
mkdir_p (const dir_path&, uint16_t verbosity = 1);
// Remove the file (unless dry-run) and print the standard diagnostics
@@ -100,7 +102,7 @@ namespace build2
// Similar to rmfile() but for symlinks.
//
- fs_status<rmfile_status>
+ LIBBUILD2_SYMEXPORT fs_status<rmfile_status>
rmsymlink (const path&, bool dir, uint16_t verbosity);
// Similar to rmfile() but for directories (note: not -r).
@@ -130,19 +132,19 @@ namespace build2
//
// @@ Collides (via ADL) with butl::rmdir_r(), which sucks.
//
- fs_status<rmdir_status>
+ LIBBUILD2_SYMEXPORT fs_status<rmdir_status>
rmdir_r (const dir_path&, bool dir = true, uint16_t verbosity = 1);
// Check for a file, directory or filesystem entry existence. Print the
// diagnostics and fail on system error, unless ignore_error is true.
//
- bool
+ LIBBUILD2_SYMEXPORT bool
exists (const path&, bool follow_symlinks = true, bool ignore_error = false);
- bool
+ LIBBUILD2_SYMEXPORT bool
exists (const dir_path&, bool ignore_error = false);
- bool
+ LIBBUILD2_SYMEXPORT bool
entry_exists (const path&,
bool follow_symlinks = false,
bool ignore_error = false);
@@ -150,7 +152,7 @@ namespace build2
// Check for a directory emptiness. Print the diagnostics and fail on system
// error.
//
- bool
+ LIBBUILD2_SYMEXPORT bool
empty (const dir_path&);
// Directories containing .buildignore (or .build2ignore in the alternative
@@ -160,21 +162,21 @@ namespace build2
// Create a directory containing an empty .buildignore file.
//
- fs_status<mkdir_status>
+ LIBBUILD2_SYMEXPORT fs_status<mkdir_status>
mkdir_buildignore (const dir_path&, const path&, uint16_t verbosity = 1);
// Return true if the directory is empty or only contains the .buildignore
// file. Fail if the directory doesn't exist.
//
- bool
+ LIBBUILD2_SYMEXPORT bool
empty_buildignore (const dir_path&, const path&);
// Remove a directory if it is empty or only contains the .buildignore file.
//
- fs_status<rmdir_status>
+ LIBBUILD2_SYMEXPORT fs_status<rmdir_status>
rmdir_buildignore (const dir_path&, const path&, uint16_t verbosity = 1);
}
-#include <build2/filesystem.txx>
+#include <libbuild2/filesystem.txx>
-#endif // BUILD2_FILESYSTEM_HXX
+#endif // LIBBUILD2_FILESYSTEM_HXX
diff --git a/build2/filesystem.txx b/libbuild2/filesystem.txx
index 919a26e..6166082 100644
--- a/build2/filesystem.txx
+++ b/libbuild2/filesystem.txx
@@ -1,11 +1,11 @@
-// file : build2/filesystem.txx -*- C++ -*-
+// file : libbuild2/filesystem.txx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <type_traits> // is_base_of
-#include <build2/context.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/diagnostics.hxx>
namespace build2
{
diff --git a/build2/function+call.test.testscript b/libbuild2/function+call.test.testscript
index 1678c28..755572e 100644
--- a/build2/function+call.test.testscript
+++ b/libbuild2/function+call.test.testscript
@@ -1,4 +1,4 @@
-# file : build2/function+call.test.testscript
+# file : libbuild2/function+call.test.testscript
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
diff --git a/build2/function+syntax.test.testscript b/libbuild2/function+syntax.test.testscript
index bd86dd0..f8240f3 100644
--- a/build2/function+syntax.test.testscript
+++ b/libbuild2/function+syntax.test.testscript
@@ -1,4 +1,4 @@
-# file : build2/function+syntax.test.testscript
+# file : libbuild2/function+syntax.test.testscript
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
diff --git a/build2/function.cxx b/libbuild2/function.cxx
index e78cade..2d4dce9 100644
--- a/build2/function.cxx
+++ b/libbuild2/function.cxx
@@ -1,8 +1,8 @@
-// file : build2/function.cxx -*- C++ -*-
+// file : libbuild2/function.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/function.hxx>
+#include <libbuild2/function.hxx>
#include <cstring> // strchr()
@@ -323,7 +323,7 @@ namespace build2
return d->thunk (base, move (args), d);
}
-#if !defined(_MSC_VER) || _MSC_VER > 1910
+#if !defined(_WIN32)
constexpr const optional<const value_type*>* function_args<>::types;
#else
const optional<const value_type*>* const function_args<>::types = nullptr;
diff --git a/build2/function.hxx b/libbuild2/function.hxx
index 1b49f81..6b2bfe1 100644
--- a/build2/function.hxx
+++ b/libbuild2/function.hxx
@@ -1,19 +1,21 @@
-// file : build2/function.hxx -*- C++ -*-
+// file : libbuild2/function.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_FUNCTION_HXX
-#define BUILD2_FUNCTION_HXX
+#ifndef LIBBUILD2_FUNCTION_HXX
+#define LIBBUILD2_FUNCTION_HXX
#include <map>
#include <utility> // index_sequence
#include <type_traits> // aligned_storage
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/diagnostics.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -85,7 +87,7 @@ namespace build2
vector_view<value>,
const function_overload&);
- struct function_overload
+ struct LIBBUILD2_SYMEXPORT function_overload
{
const char* name; // Set to point to key by insert() below.
const char* alt_name; // Alternative name, NULL if none. This is the
@@ -145,10 +147,10 @@ namespace build2
}
};
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, const function_overload&); // Print signature.
- class function_map
+ class LIBBUILD2_SYMEXPORT function_map
{
public:
using map_type = std::multimap<string, function_overload>;
@@ -214,9 +216,9 @@ namespace build2
map_type map_;
};
- extern function_map functions;
+ LIBBUILD2_SYMEXPORT extern function_map functions;
- class function_family
+ class LIBBUILD2_SYMEXPORT function_family
{
public:
// The call() function above catches invalid_argument and issues
@@ -282,7 +284,7 @@ namespace build2
};
template <>
- struct function_arg<names> // Untyped.
+ struct LIBBUILD2_SYMEXPORT function_arg<names> // Untyped.
{
static const bool null = false;
static const bool opt = false;
@@ -301,7 +303,7 @@ namespace build2
};
template <>
- struct function_arg<value> // Anytyped.
+ struct LIBBUILD2_SYMEXPORT function_arg<value> // Anytyped.
{
static const bool null = false;
static const bool opt = false;
@@ -341,7 +343,7 @@ namespace build2
};
template <>
- struct function_arg<value*>: function_arg<value>
+ struct LIBBUILD2_SYMEXPORT function_arg<value*>: function_arg<value>
{
static const bool null = true;
@@ -388,7 +390,13 @@ namespace build2
// VC15 doesn't realize that a pointer to static object (in our case it is
// &value_trair<T>::value_type) is constexpr.
//
-#if !defined(_MSC_VER) || _MSC_VER > 1910
+ // Note that during the library split we discovered that the constexpr
+ // variant causes compilation/linkage issues for both MinGW GCC and
+ // VC. Thus we now only use it for POSIX systems.
+ //
+ // #if !defined(_MSC_VER) || _MSC_VER > 1910
+ //
+#if !defined(_WIN32)
static constexpr const optional<const value_type*> types[max] = {
function_arg<A>::type ()...};
#else
@@ -397,7 +405,7 @@ namespace build2
};
template <typename... A>
-#if !defined(_MSC_VER) || _MSC_VER > 1910
+#if !defined(_WIN32)
constexpr const optional<const value_type*>
function_args<A...>::types[function_args<A...>::max];
#else
@@ -409,12 +417,12 @@ namespace build2
// Specialization for no arguments.
//
template <>
- struct function_args<>
+ struct LIBBUILD2_SYMEXPORT function_args<>
{
static const size_t max = 0;
static const size_t min = 0;
-#if !defined(_MSC_VER) || _MSC_VER > 1910
+#if !defined(_WIN32)
static constexpr const optional<const value_type*>* types = nullptr;
#else
static const optional<const value_type*>* const types;
@@ -734,7 +742,7 @@ namespace build2
}
};
- struct function_family::entry
+ struct LIBBUILD2_SYMEXPORT function_family::entry
{
string name;
const string& qual;
@@ -894,4 +902,4 @@ namespace build2
}
}
-#endif // BUILD2_FUNCTION_HXX
+#endif // LIBBUILD2_FUNCTION_HXX
diff --git a/build2/function.test.cxx b/libbuild2/function.test.cxx
index b890bcd..5e442a3 100644
--- a/build2/function.test.cxx
+++ b/libbuild2/function.test.cxx
@@ -1,17 +1,17 @@
-// file : build2/function.test.cxx -*- C++ -*-
+// file : libbuild2/function.test.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <iostream>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/parser.hxx>
-#include <build2/context.hxx>
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/parser.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
diff --git a/build2/functions-builtin.cxx b/libbuild2/functions-builtin.cxx
index 138a364..44ae534 100644
--- a/build2/functions-builtin.cxx
+++ b/libbuild2/functions-builtin.cxx
@@ -1,9 +1,9 @@
-// file : build2/functions-builtin.cxx -*- C++ -*-
+// file : libbuild2/functions-builtin.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
namespace build2
{
diff --git a/build2/functions-filesystem.cxx b/libbuild2/functions-filesystem.cxx
index a3b2a40..d98c75d 100644
--- a/build2/functions-filesystem.cxx
+++ b/libbuild2/functions-filesystem.cxx
@@ -1,11 +1,11 @@
-// file : build2/functions-filesystem.cxx -*- C++ -*-
+// file : libbuild2/functions-filesystem.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <libbutl/filesystem.mxx>
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
using namespace std;
diff --git a/build2/functions-name.cxx b/libbuild2/functions-name.cxx
index ba1af5b..a8e08b6 100644
--- a/build2/functions-name.cxx
+++ b/libbuild2/functions-name.cxx
@@ -1,10 +1,10 @@
-// file : build2/functions-name.cxx -*- C++ -*-
+// file : libbuild2/functions-name.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/scope.hxx>
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
using namespace std;
diff --git a/build2/functions-path.cxx b/libbuild2/functions-path.cxx
index 6b435f5..6e39812 100644
--- a/build2/functions-path.cxx
+++ b/libbuild2/functions-path.cxx
@@ -1,9 +1,9 @@
-// file : build2/functions-path.cxx -*- C++ -*-
+// file : libbuild2/functions-path.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
using namespace std;
diff --git a/build2/functions-process-path.cxx b/libbuild2/functions-process-path.cxx
index bf9b417..65e426b 100644
--- a/build2/functions-process-path.cxx
+++ b/libbuild2/functions-process-path.cxx
@@ -1,9 +1,9 @@
-// file : build2/functions-process-path.cxx -*- C++ -*-
+// file : libbuild2/functions-process-path.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
using namespace std;
diff --git a/build2/functions-process.cxx b/libbuild2/functions-process.cxx
index b302ae5..83188d3 100644
--- a/build2/functions-process.cxx
+++ b/libbuild2/functions-process.cxx
@@ -1,11 +1,11 @@
-// file : build2/functions-process.cxx -*- C++ -*-
+// file : libbuild2/functions-process.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <libbutl/regex.mxx>
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
using namespace std;
using namespace butl;
diff --git a/build2/functions-project-name.cxx b/libbuild2/functions-project-name.cxx
index 65f263b..163e865 100644
--- a/build2/functions-project-name.cxx
+++ b/libbuild2/functions-project-name.cxx
@@ -1,9 +1,9 @@
-// file : build2/functions-project-name.cxx -*- C++ -*-
+// file : libbuild2/functions-project-name.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
using namespace std;
diff --git a/build2/functions-regex.cxx b/libbuild2/functions-regex.cxx
index 3f44e8a..2c478fe 100644
--- a/build2/functions-regex.cxx
+++ b/libbuild2/functions-regex.cxx
@@ -1,4 +1,4 @@
-// file : build2/functions-regex.cxx -*- C++ -*-
+// file : libbuild2/functions-regex.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
@@ -6,8 +6,8 @@
#include <libbutl/regex.mxx>
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
using namespace std;
using namespace butl;
diff --git a/build2/functions-string.cxx b/libbuild2/functions-string.cxx
index 61fd536..22860cb 100644
--- a/build2/functions-string.cxx
+++ b/libbuild2/functions-string.cxx
@@ -1,9 +1,9 @@
-// file : build2/functions-string.cxx -*- C++ -*-
+// file : libbuild2/functions-string.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
using namespace std;
diff --git a/build2/functions-target-triplet.cxx b/libbuild2/functions-target-triplet.cxx
index de0387a..4394c5a 100644
--- a/build2/functions-target-triplet.cxx
+++ b/libbuild2/functions-target-triplet.cxx
@@ -1,9 +1,9 @@
-// file : build2/functions-target-triplet.cxx -*- C++ -*-
+// file : libbuild2/functions-target-triplet.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
using namespace std;
diff --git a/build2/lexer+buildspec.test.testscript b/libbuild2/lexer+buildspec.test.testscript
index 9083abe..a80b2d5 100644
--- a/build2/lexer+buildspec.test.testscript
+++ b/libbuild2/lexer+buildspec.test.testscript
@@ -1,4 +1,4 @@
-# file : build2/lexer+buildspec.test.testscript
+# file : libbuild2/lexer+buildspec.test.testscript
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
diff --git a/build2/lexer+comment.test.testscript b/libbuild2/lexer+comment.test.testscript
index 4323c84..6ad1202 100644
--- a/build2/lexer+comment.test.testscript
+++ b/libbuild2/lexer+comment.test.testscript
@@ -1,4 +1,4 @@
-# file : build2/lexer+comment.test.testscript
+# file : libbuild2/lexer+comment.test.testscript
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
diff --git a/build2/lexer+eval.test.testscript b/libbuild2/lexer+eval.test.testscript
index eccd029..86f804a 100644
--- a/build2/lexer+eval.test.testscript
+++ b/libbuild2/lexer+eval.test.testscript
@@ -1,4 +1,4 @@
-# file : build2/lexer+eval.test.testscript
+# file : libbuild2/lexer+eval.test.testscript
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
diff --git a/build2/lexer+quoting.test.testscript b/libbuild2/lexer+quoting.test.testscript
index 21b9046..043737f 100644
--- a/build2/lexer+quoting.test.testscript
+++ b/libbuild2/lexer+quoting.test.testscript
@@ -1,4 +1,4 @@
-# file : build2/lexer+quoting.test.testscript
+# file : libbuild2/lexer+quoting.test.testscript
# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
diff --git a/build2/lexer.cxx b/libbuild2/lexer.cxx
index 8287640..fd13c31 100644
--- a/build2/lexer.cxx
+++ b/libbuild2/lexer.cxx
@@ -1,8 +1,8 @@
-// file : build2/lexer.cxx -*- C++ -*-
+// file : libbuild2/lexer.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/lexer.hxx>
+#include <libbuild2/lexer.hxx>
#include <cstring> // strchr()
diff --git a/build2/lexer.hxx b/libbuild2/lexer.hxx
index b71167a..f987071 100644
--- a/build2/lexer.hxx
+++ b/libbuild2/lexer.hxx
@@ -1,19 +1,21 @@
-// file : build2/lexer.hxx -*- C++ -*-
+// file : libbuild2/lexer.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_LEXER_HXX
-#define BUILD2_LEXER_HXX
+#ifndef LIBBUILD2_LEXER_HXX
+#define LIBBUILD2_LEXER_HXX
#include <stack>
#include <libbutl/char-scanner.mxx>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/token.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/token.hxx>
+#include <libbuild2/diagnostics.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -66,7 +68,7 @@ namespace build2
lexer_mode (base_type v): base_type (v) {}
};
- class lexer: public butl::char_scanner
+ class LIBBUILD2_SYMEXPORT lexer: public butl::char_scanner
{
public:
// If escape is not NULL then only escape sequences with characters from
@@ -202,4 +204,4 @@ namespace butl // ADL
}
}
-#endif // BUILD2_LEXER_HXX
+#endif // LIBBUILD2_LEXER_HXX
diff --git a/build2/lexer.test.cxx b/libbuild2/lexer.test.cxx
index 8abd5f7..84520d1 100644
--- a/build2/lexer.test.cxx
+++ b/libbuild2/lexer.test.cxx
@@ -1,15 +1,15 @@
-// file : build2/lexer.test.cxx -*- C++ -*-
+// file : libbuild2/lexer.test.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <cassert>
#include <iostream>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/token.hxx>
-#include <build2/lexer.hxx>
+#include <libbuild2/token.hxx>
+#include <libbuild2/lexer.hxx>
using namespace std;
diff --git a/build2/module.cxx b/libbuild2/module.cxx
index a4a0341..50530f2 100644
--- a/build2/module.cxx
+++ b/libbuild2/module.cxx
@@ -1,12 +1,12 @@
-// file : build2/module.cxx -*- C++ -*-
+// file : libbuild2/module.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/module.hxx>
+#include <libbuild2/module.hxx>
-#include <build2/scope.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
diff --git a/build2/module.hxx b/libbuild2/module.hxx
index 610b14f..5fbed9c 100644
--- a/build2/module.hxx
+++ b/libbuild2/module.hxx
@@ -1,17 +1,19 @@
-// file : build2/module.hxx -*- C++ -*-
+// file : libbuild2/module.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_MODULE_HXX
-#define BUILD2_MODULE_HXX
+#ifndef LIBBUILD2_MODULE_HXX
+#define LIBBUILD2_MODULE_HXX
#include <map>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/diagnostics.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -87,7 +89,7 @@ namespace build2
// Load and boot the specified module.
//
- void
+ LIBBUILD2_SYMEXPORT void
boot_module (scope& root, const string& name, const location&);
// Load (if not already loaded) and initialize the specified module. Used
@@ -101,7 +103,7 @@ namespace build2
// module (which may not always be able to extract the same information from
// its tools).
//
- bool
+ LIBBUILD2_SYMEXPORT bool
load_module (scope& root,
scope& base,
const string& name,
@@ -112,7 +114,7 @@ namespace build2
// Builtin modules.
//
using available_module_map = std::map<string, module_functions>;
- extern available_module_map builtin_modules;
+ LIBBUILD2_SYMEXPORT extern available_module_map builtin_modules;
}
-#endif // BUILD2_MODULE_HXX
+#endif // LIBBUILD2_MODULE_HXX
diff --git a/build2/name.cxx b/libbuild2/name.cxx
index 5aa7754..4aac32f 100644
--- a/build2/name.cxx
+++ b/libbuild2/name.cxx
@@ -1,12 +1,12 @@
-// file : build2/name.cxx -*- C++ -*-
+// file : libbuild2/name.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/types.hxx> // Note: not <build2/names>
+#include <libbuild2/types.hxx> // Note: not <libbuild2/name.hxx>
#include <string.h> // strchr()
-#include <build2/diagnostics.hxx>
+#include <libbuild2/diagnostics.hxx>
namespace build2
{
diff --git a/build2/name.hxx b/libbuild2/name.hxx
index ba6b7a6..1ce073a 100644
--- a/build2/name.hxx
+++ b/libbuild2/name.hxx
@@ -1,17 +1,20 @@
-// file : build2/name.hxx -*- C++ -*-
+// file : libbuild2/name.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-// Note: include <build2/types.hxx> instead of this file directly.
+// Note: include <libbuild2/types.hxx> instead of this file directly.
//
-#ifndef BUILD2_NAME_HXX
-#define BUILD2_NAME_HXX
+#ifndef LIBBUILD2_NAME_HXX
+#define LIBBUILD2_NAME_HXX
-// We cannot include <build2/utility.hxx> since it includes <build2/types>.
+// We cannot include <libbuild2/utility.hxx> since it includes
+// <libbuild2/types.hxx>.
//
#include <utility> // move()
+#include <libbuild2/export.hxx>
+
namespace build2
{
using std::move;
@@ -91,7 +94,7 @@ namespace build2
compare (const name&) const;
};
- extern const name empty_name;
+ LIBBUILD2_SYMEXPORT extern const name empty_name;
inline bool
operator== (const name& x, const name& y) {return x.compare (y) == 0;}
@@ -104,7 +107,7 @@ namespace build2
// Return string representation of a name.
//
- string
+ LIBBUILD2_SYMEXPORT string
to_string (const name&);
// Store a string in a name in a reversible way. If the string ends with a
@@ -129,7 +132,7 @@ namespace build2
// Note that in the quoted mode empty unqualified name is printed as '',
// not {}.
//
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
to_stream (ostream&, const name&, bool quote, char pair = '\0');
inline ostream&
@@ -145,11 +148,11 @@ namespace build2
using names = small_vector<name, 1>;
using names_view = vector_view<const name>;
- extern const names empty_names;
+ LIBBUILD2_SYMEXPORT extern const names empty_names;
// The same semantics as to_stream(name).
//
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
to_stream (ostream&, const names_view&, bool quote, char pair = '\0');
inline ostream&
@@ -164,6 +167,6 @@ namespace build2
using name_pair = pair<name, name>;
}
-#include <build2/name.ixx>
+#include <libbuild2/name.ixx>
-#endif // BUILD2_NAME_HXX
+#endif // LIBBUILD2_NAME_HXX
diff --git a/build2/name.ixx b/libbuild2/name.ixx
index 79b3145..188126e 100644
--- a/build2/name.ixx
+++ b/libbuild2/name.ixx
@@ -1,4 +1,4 @@
-// file : build2/name.ixx -*- C++ -*-
+// file : libbuild2/name.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
diff --git a/build2/name.test.cxx b/libbuild2/name.test.cxx
index 0434aac..09fb841 100644
--- a/build2/name.test.cxx
+++ b/libbuild2/name.test.cxx
@@ -1,4 +1,4 @@
-// file : build2/name.test.cxx -*- C++ -*-
+// file : libbuild2/name.test.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
@@ -7,10 +7,10 @@
#include <cassert>
#include <iostream>
-#include <build2/types.hxx> // Includes name.
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx> // Includes name.
+#include <libbuild2/utility.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
diff --git a/build2/operation.cxx b/libbuild2/operation.cxx
index 0144e51..9d84cc2 100644
--- a/build2/operation.cxx
+++ b/libbuild2/operation.cxx
@@ -1,16 +1,16 @@
-// file : build2/operation.cxx -*- C++ -*-
+// file : libbuild2/operation.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/operation.hxx>
+#include <libbuild2/operation.hxx>
#include <iostream> // cout
-#include <build2/file.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/file.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
using namespace butl;
diff --git a/build2/operation.hxx b/libbuild2/operation.hxx
index 03026eb..86f93c6 100644
--- a/build2/operation.hxx
+++ b/libbuild2/operation.hxx
@@ -1,19 +1,21 @@
-// file : build2/operation.hxx -*- C++ -*-
+// file : libbuild2/operation.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_OPERATION_HXX
-#define BUILD2_OPERATION_HXX
+#ifndef LIBBUILD2_OPERATION_HXX
+#define LIBBUILD2_OPERATION_HXX
#include <libbutl/string-table.mxx>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/action.hxx>
-#include <build2/variable.hxx>
-#include <build2/prerequisite.hxx>
-#include <build2/target-state.hxx>
+#include <libbuild2/action.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/prerequisite.hxx>
+#include <libbuild2/target-state.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -152,7 +154,7 @@ namespace build2
// loads the buildfile unless it has already been loaded for the root
// scope.
//
- void
+ LIBBUILD2_SYMEXPORT void
load (const values&,
scope&,
const path&,
@@ -163,7 +165,7 @@ namespace build2
// Search and match the target. This is the default implementation
// that does just that and adds a pointer to the target to the list.
//
- void
+ LIBBUILD2_SYMEXPORT void
search (const values&,
const scope&,
const scope&,
@@ -172,7 +174,7 @@ namespace build2
const location&,
action_targets&);
- void
+ LIBBUILD2_SYMEXPORT void
match (const values&, action, action_targets&,
uint16_t diag, bool prog);
@@ -180,13 +182,13 @@ namespace build2
// implementation that does just that while issuing appropriate
// diagnostics (unless quiet).
//
- void
+ LIBBUILD2_SYMEXPORT void
execute (const values&, action, const action_targets&,
uint16_t diag, bool prog);
- extern const meta_operation_info mo_noop;
- extern const meta_operation_info mo_perform;
- extern const meta_operation_info mo_info;
+ LIBBUILD2_SYMEXPORT extern const meta_operation_info mo_noop;
+ LIBBUILD2_SYMEXPORT extern const meta_operation_info mo_perform;
+ LIBBUILD2_SYMEXPORT extern const meta_operation_info mo_info;
// Operation info.
//
@@ -236,9 +238,9 @@ namespace build2
// Built-in operations.
//
- extern const operation_info op_default;
- extern const operation_info op_update;
- extern const operation_info op_clean;
+ LIBBUILD2_SYMEXPORT extern const operation_info op_default;
+ LIBBUILD2_SYMEXPORT extern const operation_info op_update;
+ LIBBUILD2_SYMEXPORT extern const operation_info op_clean;
// Global meta/operation tables. Each registered meta/operation
// is assigned an id which is used as an index in the per-project
@@ -293,9 +295,11 @@ namespace build2
return os << d.name;
}
- extern butl::string_table<meta_operation_id,
- meta_operation_data> meta_operation_table;
- extern butl::string_table<operation_id> operation_table;
+ LIBBUILD2_SYMEXPORT extern butl::string_table<meta_operation_id,
+ meta_operation_data>
+ meta_operation_table;
+
+ LIBBUILD2_SYMEXPORT extern butl::string_table<operation_id> operation_table;
// These are "sparse" in the sense that we may have "holes" that
// are represented as NULL pointers. Also, lookup out of bounds
@@ -354,4 +358,4 @@ namespace butl
};
}
-#endif // BUILD2_OPERATION_HXX
+#endif // LIBBUILD2_OPERATION_HXX
diff --git a/build2/parser.cxx b/libbuild2/parser.cxx
index 1542cf6..4e8ad23 100644
--- a/build2/parser.cxx
+++ b/libbuild2/parser.cxx
@@ -1,25 +1,25 @@
-// file : build2/parser.cxx -*- C++ -*-
+// file : libbuild2/parser.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/parser.hxx>
+#include <libbuild2/parser.hxx>
#include <sstream>
#include <iostream> // cout
#include <libbutl/filesystem.mxx> // path_search(), path_match()
-#include <build2/dump.hxx>
-#include <build2/file.hxx>
-#include <build2/scope.hxx>
-#include <build2/module.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/function.hxx>
-#include <build2/variable.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
-#include <build2/prerequisite.hxx>
+#include <libbuild2/dump.hxx>
+#include <libbuild2/file.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/module.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/function.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
+#include <libbuild2/prerequisite.hxx>
using namespace std;
diff --git a/build2/parser.hxx b/libbuild2/parser.hxx
index b4b7093..658f266 100644
--- a/build2/parser.hxx
+++ b/libbuild2/parser.hxx
@@ -1,20 +1,22 @@
-// file : build2/parser.hxx -*- C++ -*-
+// file : libbuild2/parser.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_PARSER_HXX
-#define BUILD2_PARSER_HXX
+#ifndef LIBBUILD2_PARSER_HXX
+#define LIBBUILD2_PARSER_HXX
#include <stack>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/spec.hxx>
-#include <build2/lexer.hxx>
-#include <build2/token.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/spec.hxx>
+#include <libbuild2/lexer.hxx>
+#include <libbuild2/token.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/diagnostics.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -22,7 +24,7 @@ namespace build2
class target;
class prerequisite;
- class parser
+ class LIBBUILD2_SYMEXPORT parser
{
public:
// If boot is true, then we are parsing bootstrap.build and modules
@@ -668,4 +670,4 @@ namespace build2
};
}
-#endif // BUILD2_PARSER_HXX
+#endif // LIBBUILD2_PARSER_HXX
diff --git a/build2/prerequisite.cxx b/libbuild2/prerequisite.cxx
index 2eee32b..7355323 100644
--- a/build2/prerequisite.cxx
+++ b/libbuild2/prerequisite.cxx
@@ -1,13 +1,13 @@
-// file : build2/prerequisite.cxx -*- C++ -*-
+// file : libbuild2/prerequisite.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/prerequisite.hxx>
+#include <libbuild2/prerequisite.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
diff --git a/build2/prerequisite.hxx b/libbuild2/prerequisite.hxx
index 258033d..f79ce04 100644
--- a/build2/prerequisite.hxx
+++ b/libbuild2/prerequisite.hxx
@@ -1,17 +1,19 @@
-// file : build2/prerequisite.hxx -*- C++ -*-
+// file : libbuild2/prerequisite.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_PREREQUISITE_HXX
-#define BUILD2_PREREQUISITE_HXX
+#ifndef LIBBUILD2_PREREQUISITE_HXX
+#define LIBBUILD2_PREREQUISITE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/action.hxx>
-#include <build2/variable.hxx>
-#include <build2/target-key.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/action.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/target-key.hxx>
+#include <libbuild2/diagnostics.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -40,12 +42,12 @@ namespace build2
bool is_a (const target_type& tt) const {return tk.is_a (tt);}
};
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, const prerequisite_key&);
// Note that every data member except for the target is immutable (const).
//
- class prerequisite
+ class LIBBUILD2_SYMEXPORT prerequisite
{
public:
using scope_type = build2::scope;
@@ -222,6 +224,6 @@ namespace build2
const target* = nullptr);
}
-#include <build2/prerequisite.ixx>
+#include <libbuild2/prerequisite.ixx>
-#endif // BUILD2_PREREQUISITE_HXX
+#endif // LIBBUILD2_PREREQUISITE_HXX
diff --git a/build2/prerequisite.ixx b/libbuild2/prerequisite.ixx
index 3874011..d62af49 100644
--- a/build2/prerequisite.ixx
+++ b/libbuild2/prerequisite.ixx
@@ -1,16 +1,19 @@
-// file : build2/prerequisite.ixx -*- C++ -*-
+// file : libbuild2/prerequisite.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
+
+#include <libbuild2/export.hxx>
+
namespace build2
{
- include_type
+ LIBBUILD2_SYMEXPORT include_type
include_impl (action,
const target&,
const string&,
const prerequisite&,
const target*);
- extern const variable* var_include; // context.cxx
+ LIBBUILD2_SYMEXPORT extern const variable* var_include; // context.cxx
inline include_type
include (action a, const target& t, const prerequisite& p, const target* m)
diff --git a/build2/rule-map.hxx b/libbuild2/rule-map.hxx
index 52e4b9f..26f80a8 100644
--- a/build2/rule-map.hxx
+++ b/libbuild2/rule-map.hxx
@@ -1,18 +1,18 @@
-// file : build2/rule-map.hxx -*- C++ -*-
+// file : libbuild2/rule-map.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_RULE_MAP_HXX
-#define BUILD2_RULE_MAP_HXX
+#ifndef LIBBUILD2_RULE_MAP_HXX
+#define LIBBUILD2_RULE_MAP_HXX
#include <map>
#include <libbutl/prefix-map.mxx>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/action.hxx>
+#include <libbuild2/action.hxx>
namespace build2
{
@@ -120,4 +120,4 @@ namespace build2
};
}
-#endif // BUILD2_RULE_MAP_HXX
+#endif // LIBBUILD2_RULE_MAP_HXX
diff --git a/build2/rule.cxx b/libbuild2/rule.cxx
index a09e28b..0ade8a3 100644
--- a/build2/rule.cxx
+++ b/libbuild2/rule.cxx
@@ -1,15 +1,15 @@
-// file : build2/rule.cxx -*- C++ -*-
+// file : libbuild2/rule.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/rule.hxx>
+#include <libbuild2/rule.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
using namespace butl;
diff --git a/build2/rule.hxx b/libbuild2/rule.hxx
index a9bc178..abd754e 100644
--- a/build2/rule.hxx
+++ b/libbuild2/rule.hxx
@@ -1,15 +1,17 @@
-// file : build2/rule.hxx -*- C++ -*-
+// file : libbuild2/rule.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_RULE_HXX
-#define BUILD2_RULE_HXX
+#ifndef LIBBUILD2_RULE_HXX
+#define LIBBUILD2_RULE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/action.hxx>
-#include <build2/target.hxx>
+#include <libbuild2/action.hxx>
+#include <libbuild2/target.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -32,7 +34,7 @@ namespace build2
// Fallback rule that only matches if the file exists. It will also match
// an mtime_target provided it has a set timestamp.
//
- class file_rule: public rule
+ class LIBBUILD2_SYMEXPORT file_rule: public rule
{
public:
virtual bool
@@ -45,7 +47,7 @@ namespace build2
static const file_rule instance;
};
- class alias_rule: public rule
+ class LIBBUILD2_SYMEXPORT alias_rule: public rule
{
public:
virtual bool
@@ -61,7 +63,7 @@ namespace build2
// Note that this rule ignores the dry_run flag; see mkdir() in filesystem
// for the rationale.
//
- class fsdir_rule: public rule
+ class LIBBUILD2_SYMEXPORT fsdir_rule: public rule
{
public:
virtual bool
@@ -88,7 +90,7 @@ namespace build2
// Fallback rule that always matches and does nothing.
//
- class noop_rule: public rule
+ class LIBBUILD2_SYMEXPORT noop_rule: public rule
{
public:
virtual bool
@@ -102,4 +104,4 @@ namespace build2
};
}
-#endif // BUILD2_RULE_HXX
+#endif // LIBBUILD2_RULE_HXX
diff --git a/build2/scheduler.cxx b/libbuild2/scheduler.cxx
index ad3a640..8ac2b97 100644
--- a/build2/scheduler.cxx
+++ b/libbuild2/scheduler.cxx
@@ -1,8 +1,8 @@
-// file : build2/scheduler.cxx -*- C++ -*-
+// file : libbuild2/scheduler.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/scheduler.hxx>
+#include <libbuild2/scheduler.hxx>
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
# include <pthread.h>
@@ -22,12 +22,36 @@
#include <cerrno>
#include <exception> // std::terminate()
-#include <build2/diagnostics.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
namespace build2
{
+ // TLS cache of thread's task queue.
+ //
+ // Note that scheduler::task_queue struct is private.
+ //
+ static
+#ifdef __cpp_thread_local
+ thread_local
+#else
+ __thread
+#endif
+ void* scheduler_queue = nullptr;
+
+ scheduler::task_queue* scheduler::
+ queue () noexcept
+ {
+ return static_cast<scheduler::task_queue*> (scheduler_queue);
+ }
+
+ void scheduler::
+ queue (scheduler::task_queue* q) noexcept
+ {
+ scheduler_queue = q;
+ }
+
size_t scheduler::
wait (size_t start_count, const atomic_count& task_count, work_queue wq)
{
@@ -47,7 +71,7 @@ namespace build2
// If we are waiting on someone else's task count then there migh still
// be no queue (set by async()).
//
- if (task_queue* tq = task_queue_)
+ if (task_queue* tq = queue ())
{
for (lock ql (tq->mutex); !tq->shutdown && !empty_back (*tq); )
{
@@ -571,12 +595,13 @@ namespace build2
// MinGW : 2048 / 2048
// VC : 1024 / 1024
//
- // Provided the main thread size is less-equal than BUILD2_SANE_STACK_SIZE
- // (default: sizeof(void*) * BUILD2_DEFAULT_STACK_SIZE), we make sure that
- // the new thread stack is the same as for the main thread. Otherwise, we
- // cap it at BUILD2_DEFAULT_STACK_SIZE (default: 8MB). This can also be
- // overridden at runtime with the --max-stack option (remember to update
- // its documentation of changing anything here).
+ // Provided the main thread size is less-equal than
+ // LIBBUILD2_SANE_STACK_SIZE (which defaults to
+ // sizeof(void*)*LIBBUILD2_DEFAULT_STACK_SIZE), we make sure that the new
+ // thread stack is the same as for the main thread. Otherwise, we cap it
+ // at LIBBUILD2_DEFAULT_STACK_SIZE (default: 8MB). This can also be
+ // overridden at runtime with the --max-stack build2 driver option
+ // (remember to update its documentation of changing anything here).
//
// On Windows the stack size is the same for all threads and is customized
// at the linking stage (see build2/buildfile). Thus neither *_STACK_SIZE
@@ -596,12 +621,12 @@ namespace build2
//
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
-#ifndef BUILD2_DEFAULT_STACK_SIZE
-# define BUILD2_DEFAULT_STACK_SIZE 8388608 // 8MB
+#ifndef LIBBUILD2_DEFAULT_STACK_SIZE
+# define LIBBUILD2_DEFAULT_STACK_SIZE 8388608 // 8MB
#endif
-#ifndef BUILD2_SANE_STACK_SIZE
-# define BUILD2_SANE_STACK_SIZE (sizeof(void*) * BUILD2_DEFAULT_STACK_SIZE)
+#ifndef LIBBUILD2_SANE_STACK_SIZE
+# define LIBBUILD2_SANE_STACK_SIZE (sizeof(void*) * LIBBUILD2_DEFAULT_STACK_SIZE)
#endif
// Auto-deleter.
@@ -671,8 +696,8 @@ namespace build2
if (*max_stack_ != 0 && stack_size > *max_stack_)
stack_size = *max_stack_;
}
- else if (stack_size > BUILD2_SANE_STACK_SIZE)
- stack_size = BUILD2_DEFAULT_STACK_SIZE;
+ else if (stack_size > LIBBUILD2_SANE_STACK_SIZE)
+ stack_size = LIBBUILD2_DEFAULT_STACK_SIZE;
pthread_attr_t attr;
int r (pthread_attr_init (&attr));
@@ -775,13 +800,6 @@ namespace build2
return nullptr;
}
-#ifdef __cpp_thread_local
- thread_local
-#else
- __thread
-#endif
- scheduler::task_queue* scheduler::task_queue_ = nullptr;
-
auto scheduler::
create_queue () -> task_queue&
{
@@ -796,7 +814,7 @@ namespace build2
tq->shutdown = shutdown_;
}
- task_queue_ = tq;
+ queue (tq);
return *tq;
}
}
diff --git a/build2/scheduler.hxx b/libbuild2/scheduler.hxx
index 3aa1dc5..09c9e02 100644
--- a/build2/scheduler.hxx
+++ b/libbuild2/scheduler.hxx
@@ -1,9 +1,9 @@
-// file : build2/scheduler.hxx -*- C++ -*-
+// file : libbuild2/scheduler.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_SCHEDULER_HXX
-#define BUILD2_SCHEDULER_HXX
+#ifndef LIBBUILD2_SCHEDULER_HXX
+#define LIBBUILD2_SCHEDULER_HXX
#include <list>
#include <mutex>
@@ -12,8 +12,10 @@
#include <type_traits> // aligned_storage, etc
#include <condition_variable>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -51,7 +53,7 @@ namespace build2
// stack. All this means that the number of threads created by the scheduler
// will normally exceed the maximum active allowed.
//
- class scheduler
+ class LIBBUILD2_SYMEXPORT scheduler
{
public:
using atomic_count = std::atomic<size_t>;
@@ -289,7 +291,7 @@ namespace build2
void
join ()
{
- assert (task_queue_ = nullptr);
+ assert (queue () == nullptr);
// Lock the mutex to make sure the values set in startup() are visible
// in this thread.
@@ -306,7 +308,7 @@ namespace build2
void
leave ()
{
- task_queue_ = nullptr;
+ queue (nullptr);
}
// Return the number of hardware threads or 0 if unable to determine.
@@ -691,21 +693,17 @@ namespace build2
//
std::list<task_queue> task_queues_;
- // TLS cache of thread's task queue.
- //
- static
-#ifdef __cpp_thread_local
- thread_local
-#else
- __thread
-#endif
- task_queue* task_queue_;
-
task_queue&
create_queue ();
+
+ static task_queue*
+ queue () noexcept;
+
+ static void
+ queue (task_queue*) noexcept;
};
}
-#include <build2/scheduler.txx>
+#include <libbuild2/scheduler.txx>
-#endif // BUILD2_SCHEDULER_HXX
+#endif // LIBBUILD2_SCHEDULER_HXX
diff --git a/build2/scheduler.test.cxx b/libbuild2/scheduler.test.cxx
index b088c1d..1252575 100644
--- a/build2/scheduler.test.cxx
+++ b/libbuild2/scheduler.test.cxx
@@ -1,4 +1,4 @@
-// file : build2/scheduler.test.cxx -*- C++ -*-
+// file : libbuild2/scheduler.test.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
@@ -8,10 +8,10 @@
#include <cassert>
#include <iostream>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/scheduler.hxx>
+#include <libbuild2/scheduler.hxx>
using namespace std;
diff --git a/build2/scheduler.txx b/libbuild2/scheduler.txx
index 97eae62..805a072 100644
--- a/build2/scheduler.txx
+++ b/libbuild2/scheduler.txx
@@ -1,4 +1,4 @@
-// file : build2/scheduler.txx -*- C++ -*-
+// file : libbuild2/scheduler.txx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
@@ -45,7 +45,7 @@ namespace build2
// Try to push the task into the queue falling back to running serially
// if the queue is full.
//
- task_queue* tq (task_queue_); // Single load.
+ task_queue* tq (queue ()); // Single load.
if (tq == nullptr)
tq = &create_queue ();
diff --git a/build2/scope.cxx b/libbuild2/scope.cxx
index a6ebe1f..1ad7455 100644
--- a/build2/scope.cxx
+++ b/libbuild2/scope.cxx
@@ -1,11 +1,11 @@
-// file : build2/scope.cxx -*- C++ -*-
+// file : libbuild2/scope.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/scope.hxx>
+#include <libbuild2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
using namespace std;
diff --git a/build2/scope.hxx b/libbuild2/scope.hxx
index afd294e..7b4fec5 100644
--- a/build2/scope.hxx
+++ b/libbuild2/scope.hxx
@@ -1,29 +1,31 @@
-// file : build2/scope.hxx -*- C++ -*-
+// file : libbuild2/scope.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_SCOPE_HXX
-#define BUILD2_SCOPE_HXX
+#ifndef LIBBUILD2_SCOPE_HXX
+#define LIBBUILD2_SCOPE_HXX
#include <map>
#include <unordered_set>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/module.hxx>
-#include <build2/variable.hxx>
-#include <build2/target-key.hxx>
-#include <build2/target-type.hxx>
-#include <build2/target-state.hxx>
-#include <build2/rule-map.hxx>
-#include <build2/operation.hxx>
+#include <libbuild2/module.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/target-key.hxx>
+#include <libbuild2/target-type.hxx>
+#include <libbuild2/target-state.hxx>
+#include <libbuild2/rule-map.hxx>
+#include <libbuild2/operation.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
class dir;
- class scope
+ class LIBBUILD2_SYMEXPORT scope
{
public:
// Absolute and normalized.
@@ -347,10 +349,11 @@ namespace build2
friend class scope_map;
friend class temp_scope;
- // These two from <build2/file.hxx> set strong_.
+ // These two from <libbuild2/file.hxx> set strong_.
//
- friend void create_bootstrap_outer (scope&);
- friend scope& create_bootstrap_inner (scope&, const dir_path&);
+ friend LIBBUILD2_SYMEXPORT void create_bootstrap_outer (scope&);
+ friend LIBBUILD2_SYMEXPORT scope& create_bootstrap_inner (scope&,
+ const dir_path&);
explicit
scope (bool global): vars (global), target_vars (global) {}
@@ -402,7 +405,7 @@ namespace build2
// Note that we assume the first insertion into the map is always the
// global scope with empty key.
//
- iterator
+ LIBBUILD2_SYMEXPORT iterator
insert (const dir_path&, bool root = false);
// Find the most qualified scope that encompasses this path.
@@ -443,24 +446,26 @@ namespace build2
rw (scope&) const {return const_cast<scope_map&> (*this);}
private:
- static scope_map instance;
+ LIBBUILD2_SYMEXPORT static scope_map instance;
// Entities that can access bypassing the lock proof.
//
friend int main (int, char*[]);
- friend variable_overrides reset (const strings&);
+ friend LIBBUILD2_SYMEXPORT variable_overrides reset (const strings&);
- scope&
+ LIBBUILD2_SYMEXPORT scope&
find (const dir_path&);
public:
- static const scope_map& cinstance; // For var_pool initialization.
+ // For var_pool initialization.
+ //
+ LIBBUILD2_SYMEXPORT static const scope_map& cinstance;
};
- extern const scope_map& scopes;
- extern const scope* global_scope;
+ LIBBUILD2_SYMEXPORT extern const scope_map& scopes;
+ LIBBUILD2_SYMEXPORT extern const scope* global_scope;
}
-#include <build2/scope.ixx>
+#include <libbuild2/scope.ixx>
-#endif // BUILD2_SCOPE_HXX
+#endif // LIBBUILD2_SCOPE_HXX
diff --git a/build2/scope.ixx b/libbuild2/scope.ixx
index 171ab25..3498ae0 100644
--- a/build2/scope.ixx
+++ b/libbuild2/scope.ixx
@@ -1,4 +1,4 @@
-// file : build2/scope.ixx -*- C++ -*-
+// file : libbuild2/scope.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
diff --git a/build2/search.cxx b/libbuild2/search.cxx
index 68fd5a5..1ff9c73 100644
--- a/build2/search.cxx
+++ b/libbuild2/search.cxx
@@ -1,15 +1,15 @@
-// file : build2/search.cxx -*- C++ -*-
+// file : libbuild2/search.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/search.hxx>
+#include <libbuild2/search.hxx>
-#include <build2/scope.hxx>
-#include <build2/target.hxx>
-#include <build2/context.hxx>
-#include <build2/filesystem.hxx> // mtime()
-#include <build2/prerequisite.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/filesystem.hxx> // mtime()
+#include <libbuild2/prerequisite.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
using namespace butl;
diff --git a/build2/search.hxx b/libbuild2/search.hxx
index 3e08bf8..b281b12 100644
--- a/build2/search.hxx
+++ b/libbuild2/search.hxx
@@ -1,12 +1,14 @@
-// file : build2/search.hxx -*- C++ -*-
+// file : libbuild2/search.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_SEARCH_HXX
-#define BUILD2_SEARCH_HXX
+#ifndef LIBBUILD2_SEARCH_HXX
+#define LIBBUILD2_SEARCH_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -15,7 +17,7 @@ namespace build2
// Search for an existing target in this prerequisite's scope.
//
- const target*
+ LIBBUILD2_SYMEXPORT const target*
search_existing_target (const prerequisite_key&);
// Search for an existing file. If the prerequisite directory is relative,
@@ -27,13 +29,13 @@ namespace build2
// Originally the plan was to have a target-type specific variable that
// contains the search paths. But there wasn't any need for this yet.
//
- const target*
+ LIBBUILD2_SYMEXPORT const target*
search_existing_file (const prerequisite_key&);
// Create a new target in this prerequisite's scope.
//
- const target&
+ LIBBUILD2_SYMEXPORT const target&
create_new_target (const prerequisite_key&);
}
-#endif // BUILD2_SEARCH_HXX
+#endif // LIBBUILD2_SEARCH_HXX
diff --git a/build2/spec.cxx b/libbuild2/spec.cxx
index eb85c68..3ad6b7d 100644
--- a/build2/spec.cxx
+++ b/libbuild2/spec.cxx
@@ -1,11 +1,11 @@
-// file : build2/spec.cxx -*- C++ -*-
+// file : libbuild2/spec.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/spec.hxx>
+#include <libbuild2/spec.hxx>
-#include <build2/context.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
diff --git a/build2/spec.hxx b/libbuild2/spec.hxx
index 9b429da..b18f665 100644
--- a/build2/spec.hxx
+++ b/libbuild2/spec.hxx
@@ -1,14 +1,16 @@
-// file : build2/spec.hxx -*- C++ -*-
+// file : libbuild2/spec.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_SPEC_HXX
-#define BUILD2_SPEC_HXX
+#ifndef LIBBUILD2_SPEC_HXX
+#define LIBBUILD2_SPEC_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/variable.hxx>
+#include <libbuild2/variable.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -54,17 +56,17 @@ namespace build2
typedef vector<metaopspec> buildspec;
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, const targetspec&);
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, const opspec&);
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, const metaopspec&);
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, const buildspec&);
}
-#endif // BUILD2_SPEC_HXX
+#endif // LIBBUILD2_SPEC_HXX
diff --git a/build2/target-key.hxx b/libbuild2/target-key.hxx
index ed9a0ed..e23991d 100644
--- a/build2/target-key.hxx
+++ b/libbuild2/target-key.hxx
@@ -1,19 +1,21 @@
-// file : build2/target-key.hxx -*- C++ -*-
+// file : libbuild2/target-key.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_TARGET_KEY_HXX
-#define BUILD2_TARGET_KEY_HXX
+#ifndef LIBBUILD2_TARGET_KEY_HXX
+#define LIBBUILD2_TARGET_KEY_HXX
#include <map>
#include <cstring> // strcmp()
#include <libbutl/utility.mxx> // compare_c_string
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target-type.hxx>
+#include <libbuild2/target-type.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -71,10 +73,10 @@ namespace build2
// If the target type has a custom print function, call that. Otherwise,
// call to_stream(). Both are defined in target.cxx.
//
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, const target_key&);
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
to_stream (ostream&, const target_key&, optional<stream_verbosity> = nullopt);
}
@@ -101,4 +103,4 @@ namespace std
};
}
-#endif // BUILD2_TARGET_KEY_HXX
+#endif // LIBBUILD2_TARGET_KEY_HXX
diff --git a/build2/target-state.hxx b/libbuild2/target-state.hxx
index ff44edc..5bc6895 100644
--- a/build2/target-state.hxx
+++ b/libbuild2/target-state.hxx
@@ -1,12 +1,14 @@
-// file : build2/target-state.hxx -*- C++ -*-
+// file : libbuild2/target-state.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_TARGET_STATE_HXX
-#define BUILD2_TARGET_STATE_HXX
+#ifndef LIBBUILD2_TARGET_STATE_HXX
+#define LIBBUILD2_TARGET_STATE_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -37,8 +39,8 @@ namespace build2
return l;
}
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, target_state); // target.cxx
}
-#endif // BUILD2_TARGET_STATE_HXX
+#endif // LIBBUILD2_TARGET_STATE_HXX
diff --git a/build2/target-type.hxx b/libbuild2/target-type.hxx
index aec1bcf..3537c90 100644
--- a/build2/target-type.hxx
+++ b/libbuild2/target-type.hxx
@@ -1,14 +1,16 @@
-// file : build2/target-type.hxx -*- C++ -*-
+// file : libbuild2/target-type.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_TARGET_TYPE_HXX
-#define BUILD2_TARGET_TYPE_HXX
+#ifndef LIBBUILD2_TARGET_TYPE_HXX
+#define LIBBUILD2_TARGET_TYPE_HXX
#include <map>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -55,7 +57,7 @@ namespace build2
// non-directory target must first call target::split_name() if reverse is
// false.
//
- struct target_type
+ struct LIBBUILD2_SYMEXPORT target_type
{
const char* name;
const target_type* base;
@@ -203,4 +205,4 @@ namespace build2
};
}
-#endif // BUILD2_TARGET_TYPE_HXX
+#endif // LIBBUILD2_TARGET_TYPE_HXX
diff --git a/build2/target.cxx b/libbuild2/target.cxx
index fee77b4..c823e85 100644
--- a/build2/target.cxx
+++ b/libbuild2/target.cxx
@@ -1,15 +1,15 @@
-// file : build2/target.cxx -*- C++ -*-
+// file : libbuild2/target.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/target.hxx>
+#include <libbuild2/target.hxx>
-#include <build2/file.hxx>
-#include <build2/scope.hxx>
-#include <build2/search.hxx>
-#include <build2/algorithm.hxx>
-#include <build2/filesystem.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/file.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/search.hxx>
+#include <libbuild2/algorithm.hxx>
+#include <libbuild2/filesystem.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
using namespace butl;
diff --git a/build2/target.hxx b/libbuild2/target.hxx
index b389ea5..cfbd9bc 100644
--- a/build2/target.hxx
+++ b/libbuild2/target.hxx
@@ -1,9 +1,9 @@
-// file : build2/target.hxx -*- C++ -*-
+// file : libbuild2/target.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_TARGET_HXX
-#define BUILD2_TARGET_HXX
+#ifndef LIBBUILD2_TARGET_HXX
+#define LIBBUILD2_TARGET_HXX
#include <iterator> // tags, etc.
#include <type_traits> // aligned_storage
@@ -11,16 +11,18 @@
#include <libbutl/multi-index.mxx> // map_iterator_adapter
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/scope.hxx>
-#include <build2/action.hxx>
-#include <build2/variable.hxx>
-#include <build2/target-key.hxx>
-#include <build2/target-type.hxx>
-#include <build2/target-state.hxx>
-#include <build2/prerequisite.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/action.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/target-key.hxx>
+#include <libbuild2/target-type.hxx>
+#include <libbuild2/target-state.hxx>
+#include <libbuild2/prerequisite.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -28,9 +30,11 @@ namespace build2
class scope;
class target;
- extern size_t current_on; // From <build/context>.
+ // From <libbuild2/context.hxx>.
+ //
+ LIBBUILD2_SYMEXPORT extern size_t current_on;
- // From <build2/algorithm.hxx>.
+ // From <libbuild2/algorithm.hxx>.
//
const target& search (const target&, const prerequisite&);
const target* search_existing (const prerequisite&);
@@ -61,20 +65,24 @@ namespace build2
// all the prerequisites in a loop, skipping ignored. Specifically,
// for actions with the "first" execution mode, it calls
// execute_prerequisites() while for those with the "last" mode --
- // reverse_execute_prerequisites(); see <build2/operation.hxx>,
- // <build2/algorithm.hxx> for details. The group recipe call's the group's
- // recipe.
+ // reverse_execute_prerequisites(); see <libbuild2/operation.hxx>,
+ // <libbuild2/algorithm.hxx> for details. The group recipe call's the
+ // group's recipe.
//
- extern const recipe empty_recipe;
- extern const recipe noop_recipe;
- extern const recipe default_recipe;
- extern const recipe group_recipe;
+ LIBBUILD2_SYMEXPORT extern const recipe empty_recipe;
+ LIBBUILD2_SYMEXPORT extern const recipe noop_recipe;
+ LIBBUILD2_SYMEXPORT extern const recipe default_recipe;
+ LIBBUILD2_SYMEXPORT extern const recipe group_recipe;
- target_state
- noop_action (action, const target&); // Defined in <build2/algorithm.hxx>.
+ // Defined in <libbuild2/algorithm.hxx>.
+ //
+ LIBBUILD2_SYMEXPORT target_state
+ noop_action (action, const target&);
- target_state
- group_action (action, const target&); // Defined in <build2/algorithm.hxx>.
+ // Defined in <libbuild2/algorithm.hxx>.
+ //
+ LIBBUILD2_SYMEXPORT target_state
+ group_action (action, const target&);
// A view of target group members.
//
@@ -114,7 +122,7 @@ namespace build2
// Target.
//
- class target
+ class LIBBUILD2_SYMEXPORT target
{
optional<string>* ext_; // Reference to value in target_key.
@@ -337,17 +345,10 @@ namespace build2
// be racy (see target::group).
//
bool
- has_prerequisites () const
- {
- return !prerequisites ().empty ();
- }
+ has_prerequisites () const;
bool
- has_group_prerequisites () const
- {
- return has_prerequisites () ||
- (group != nullptr && !group->has_prerequisites ());
- }
+ has_group_prerequisites () const;
private:
friend class parser;
@@ -470,7 +471,7 @@ namespace build2
// Inner/outer operation state. See operation.hxx for details.
//
- class opstate
+ class LIBBUILD2_SYMEXPORT opstate
{
public:
mutable atomic_count task_count {0}; // Start offset_touched - 1.
@@ -592,10 +593,7 @@ namespace build2
// is known to be unchanged. Used for optimizations during search & match.
//
bool
- unchanged (action a) const
- {
- return matched_state_impl (a).second == target_state::unchanged;
- }
+ unchanged (action) const;
// This function should only be called during execution if we have
// observed (synchronization-wise) that this target has been executed.
@@ -783,8 +781,8 @@ namespace build2
inline bool
operator!= (const target& x, const target& y) {return !(x == y);}
- inline ostream&
- operator<< (ostream& os, const target& t) {return os << t.key ();}
+ ostream&
+ operator<< (ostream&, const target&);
// Sometimes it is handy to "mark" a pointer to a target (for example, in
// prerequisite_targets). We use the last 2 bits in a pointer for that (aka
@@ -822,19 +820,9 @@ namespace build2
{
public:
explicit
- group_prerequisites (const target& t)
- : t_ (t),
- g_ (t_.group == nullptr ||
- t_.group->member != nullptr || // Ad hoc group member.
- t_.group->prerequisites ().empty ()
- ? nullptr : t_.group) {}
+ group_prerequisites (const target& t);
- explicit
- group_prerequisites (const target& t, const target* g)
- : t_ (t),
- g_ (g == nullptr ||
- g->prerequisites ().empty ()
- ? nullptr : g) {}
+ group_prerequisites (const target& t, const target* g);
using prerequisites_type = target::prerequisites_type;
using base_iterator = prerequisites_type::const_iterator;
@@ -854,31 +842,13 @@ namespace build2
base_iterator i): t_ (t), g_ (g), c_ (c), i_ (i) {}
iterator&
- operator++ ()
- {
- if (++i_ == c_->end () && c_ != &t_->prerequisites ())
- {
- c_ = &t_->prerequisites ();
- i_ = c_->begin ();
- }
- return *this;
- }
+ operator++ ();
iterator
operator++ (int) {iterator r (*this); operator++ (); return r;}
iterator&
- operator-- ()
- {
- if (i_ == c_->begin () && c_ == &t_->prerequisites ())
- {
- c_ = &g_->prerequisites ();
- i_ = c_->end ();
- }
-
- --i_;
- return *this;
- }
+ operator-- ();
iterator
operator-- (int) {iterator r (*this); operator-- (); return r;}
@@ -905,18 +875,10 @@ namespace build2
using reverse_iterator = std::reverse_iterator<iterator>;
iterator
- begin () const
- {
- auto& c ((g_ != nullptr ? *g_ : t_).prerequisites ());
- return iterator (&t_, g_, &c, c.begin ());
- }
+ begin () const;
iterator
- end () const
- {
- auto& c (t_.prerequisites ());
- return iterator (&t_, g_, &c, c.end ());
- }
+ end () const;
reverse_iterator
rbegin () const {return reverse_iterator (end ());}
@@ -925,11 +887,7 @@ namespace build2
rend () const {return reverse_iterator (begin ());}
size_t
- size () const
- {
- return t_.prerequisites ().size () +
- (g_ != nullptr ? g_->prerequisites ().size () : 0);
- }
+ size () const;
private:
const target& t_;
@@ -968,12 +926,7 @@ namespace build2
}
prerequisite_key
- key () const
- {
- return member != nullptr
- ? prerequisite_key {prerequisite.proj, member->key (), nullptr}
- : prerequisite.key ();
- }
+ key () const;
const target_type_type&
type () const
@@ -1230,37 +1183,17 @@ namespace build2
base_iterator e_;
};
- // prerequisite_members(t.prerequisites)
+ // prerequisite_members(t.prerequisites ())
//
- inline auto
- prerequisite_members (action a, target& t,
- members_mode m = members_mode::always)
- {
- return prerequisite_members (a, t, t.prerequisites (), m);
- }
-
- inline auto
+ auto
prerequisite_members (action a, const target& t,
- members_mode m = members_mode::always)
- {
- return prerequisite_members (a, t, t.prerequisites (), m);
- }
+ members_mode m = members_mode::always);
- // prerequisite_members(reverse_iterate(t.prerequisites))
+ // prerequisite_members(reverse_iterate(t.prerequisites ()))
//
- inline auto
- reverse_prerequisite_members (action a, target& t,
- members_mode m = members_mode::always)
- {
- return prerequisite_members (a, t, reverse_iterate (t.prerequisites ()), m);
- }
-
- inline auto
+ auto
reverse_prerequisite_members (action a, const target& t,
- members_mode m = members_mode::always)
- {
- return prerequisite_members (a, t, reverse_iterate (t.prerequisites ()), m);
- }
+ members_mode m = members_mode::always);
// prerequisite_members(group_prerequisites (t))
//
@@ -1305,7 +1238,7 @@ namespace build2
//
// Note also that once the extension is specified, it becomes immutable.
//
- class target_set
+ class LIBBUILD2_SYMEXPORT target_set
{
public:
using map_type = std::unordered_map<target_key, unique_ptr<target>>;
@@ -1450,11 +1383,11 @@ namespace build2
map_type map_;
};
- extern target_set targets;
+ LIBBUILD2_SYMEXPORT extern target_set targets;
// Modification time-based target.
//
- class mtime_target: public target
+ class LIBBUILD2_SYMEXPORT mtime_target: public target
{
public:
using target::target;
@@ -1510,7 +1443,7 @@ namespace build2
// Complain if timestamp is not lock-free unless we were told non-lock-
// free is ok.
//
-#ifndef BUILD2_ATOMIC_NON_LOCK_FREE
+#ifndef LIBBUILD2_ATOMIC_NON_LOCK_FREE
// C++17:
//
// static_assert (atomic<timestamp::rep>::is_always_lock_free,
@@ -1533,7 +1466,7 @@ namespace build2
// Filesystem path-based target.
//
- class path_target: public mtime_target
+ class LIBBUILD2_SYMEXPORT path_target: public mtime_target
{
public:
using mtime_target::mtime_target;
@@ -1565,7 +1498,7 @@ namespace build2
path (path_type) const;
timestamp
- load_mtime () const {return mtime_target::load_mtime (path ());}
+ load_mtime () const;
// Derive a path from target's dir, name, and, if set, ext. If ext is not
// set, try to derive it using the target type extension function and
@@ -1642,7 +1575,7 @@ namespace build2
// File target.
//
- class file: public path_target
+ class LIBBUILD2_SYMEXPORT file: public path_target
{
public:
using path_target::path_target;
@@ -1655,7 +1588,7 @@ namespace build2
// Alias target. It represents a list of targets (its prerequisites)
// as a single "name".
//
- class alias: public target
+ class LIBBUILD2_SYMEXPORT alias: public target
{
public:
using target::target;
@@ -1669,7 +1602,7 @@ namespace build2
// but rather an alias target with the directory name. For actual
// filesystem directory (creation), see fsdir.
//
- class dir: public alias
+ class LIBBUILD2_SYMEXPORT dir: public alias
{
public:
using alias::alias;
@@ -1702,7 +1635,7 @@ namespace build2
// already exist. In particular, we don't want to update the target just
// because some unrelated entry was created in that directory.
//
- class fsdir: public target
+ class LIBBUILD2_SYMEXPORT fsdir: public target
{
public:
using target::target;
@@ -1714,7 +1647,7 @@ namespace build2
// Executable file.
//
- class exe: public file
+ class LIBBUILD2_SYMEXPORT exe: public file
{
public:
using file::file;
@@ -1724,7 +1657,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class buildfile: public file
+ class LIBBUILD2_SYMEXPORT buildfile: public file
{
public:
using file::file;
@@ -1736,7 +1669,7 @@ namespace build2
// Common documentation file targets.
//
- class doc: public file
+ class LIBBUILD2_SYMEXPORT doc: public file
{
public:
using file::file;
@@ -1780,7 +1713,7 @@ namespace build2
// Note that handling subsections with man1..9{} is easy, we
// simply specify the extension explicitly, e.g., man{foo.1p}.
//
- class man: public doc
+ class LIBBUILD2_SYMEXPORT man: public doc
{
public:
using doc::doc;
@@ -1790,7 +1723,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class man1: public man
+ class LIBBUILD2_SYMEXPORT man1: public man
{
public:
using man::man;
@@ -1805,7 +1738,7 @@ namespace build2
// If you think about it, it's kind of a documentation, similar to (but
// better than) the version file that many projects come with.
//
- class manifest: public doc
+ class LIBBUILD2_SYMEXPORT manifest: public doc
{
public:
using doc::doc;
@@ -1856,29 +1789,29 @@ namespace build2
// Target type uses the extension but it is fixed and there is no use
// printing it (e.g., man1{}).
//
- void
+ LIBBUILD2_SYMEXPORT void
target_print_0_ext_verb (ostream&, const target_key&);
// Target type uses the extension and there is normally no default so it
// should be printed (e.g., file{}).
//
- void
+ LIBBUILD2_SYMEXPORT void
target_print_1_ext_verb (ostream&, const target_key&);
// The default behavior, that is, look for an existing target in the
// prerequisite's directory scope.
//
- const target*
+ LIBBUILD2_SYMEXPORT const target*
target_search (const target&, const prerequisite_key&);
// First look for an existing target as above. If not found, then look
// for an existing file in the target-type-specific list of paths.
//
- const target*
+ LIBBUILD2_SYMEXPORT const target*
file_search (const target&, const prerequisite_key&);
}
-#include <build2/target.ixx>
-#include <build2/target.txx>
+#include <libbuild2/target.ixx>
+#include <libbuild2/target.txx>
-#endif // BUILD2_TARGET_HXX
+#endif // LIBBUILD2_TARGET_HXX
diff --git a/build2/target.ixx b/libbuild2/target.ixx
index 30be02f..4570558 100644
--- a/build2/target.ixx
+++ b/libbuild2/target.ixx
@@ -1,10 +1,10 @@
-// file : build2/target.ixx -*- C++ -*-
+// file : libbuild2/target.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <cstring> // memcpy()
-#include <build2/filesystem.hxx> // mtime()
+#include <libbuild2/filesystem.hxx> // mtime()
namespace build2
{
@@ -64,6 +64,27 @@ namespace build2
}
}
+ inline bool target::
+ group_state (action a) const
+ {
+ // We go an extra step and short-circuit to the target state even if the
+ // raw state is not group provided the recipe is group_recipe and the
+ // state is unknown (see mtime() for a discussion on why we do it).
+ //
+ const opstate& s (state[a]);
+
+ if (s.state == target_state::group)
+ return true;
+
+ if (s.state == target_state::unknown && group != nullptr)
+ {
+ if (recipe_function* const* f = s.recipe.target<recipe_function*> ())
+ return *f == &group_action;
+ }
+
+ return false;
+ }
+
inline pair<bool, target_state> target::
matched_state_impl (action a) const
{
@@ -93,27 +114,6 @@ namespace build2
return (group_state (a) ? group->state : state)[a].state;
}
- inline bool target::
- group_state (action a) const
- {
- // We go an extra step and short-circuit to the target state even if the
- // raw state is not group provided the recipe is group_recipe and the
- // state is unknown (see mtime() for a discussion on why we do it).
- //
- const opstate& s (state[a]);
-
- if (s.state == target_state::group)
- return true;
-
- if (s.state == target_state::unknown && group != nullptr)
- {
- if (recipe_function* const* f = s.recipe.target<recipe_function*> ())
- return *f == &group_action;
- }
-
- return false;
- }
-
inline target_state target::
matched_state (action a, bool fail) const
{
@@ -149,6 +149,31 @@ namespace build2
return r;
}
+ inline bool target::
+ has_prerequisites () const
+ {
+ return !prerequisites ().empty ();
+ }
+
+ inline bool target::
+ has_group_prerequisites () const
+ {
+ return has_prerequisites () ||
+ (group != nullptr && !group->has_prerequisites ());
+ }
+
+ inline bool target::
+ unchanged (action a) const
+ {
+ return matched_state_impl (a).second == target_state::unchanged;
+ }
+
+ inline ostream&
+ operator<< (ostream& os, const target& t)
+ {
+ return os << t.key ();
+ }
+
// mark()/unmark()
//
@@ -186,6 +211,75 @@ namespace build2
return m;
}
+ // group_prerequisites
+ //
+ inline group_prerequisites::
+ group_prerequisites (const target& t)
+ : t_ (t),
+ g_ (t_.group == nullptr ||
+ t_.group->member != nullptr || // Ad hoc group member.
+ t_.group->prerequisites ().empty ()
+ ? nullptr : t_.group)
+ {
+ }
+
+ inline group_prerequisites::
+ group_prerequisites (const target& t, const target* g)
+ : t_ (t),
+ g_ (g == nullptr ||
+ g->prerequisites ().empty ()
+ ? nullptr : g)
+ {
+ }
+
+ inline auto group_prerequisites::
+ begin () const -> iterator
+ {
+ auto& c ((g_ != nullptr ? *g_ : t_).prerequisites ());
+ return iterator (&t_, g_, &c, c.begin ());
+ }
+
+ inline auto group_prerequisites::
+ end () const -> iterator
+ {
+ auto& c (t_.prerequisites ());
+ return iterator (&t_, g_, &c, c.end ());
+ }
+
+ inline size_t group_prerequisites::
+ size () const
+ {
+ return t_.prerequisites ().size () +
+ (g_ != nullptr ? g_->prerequisites ().size () : 0);
+ }
+
+ // group_prerequisites::iterator
+ //
+ inline auto group_prerequisites::iterator::
+ operator++ () -> iterator&
+ {
+ if (++i_ == c_->end () && c_ != &t_->prerequisites ())
+ {
+ c_ = &t_->prerequisites ();
+ i_ = c_->begin ();
+ }
+ return *this;
+ }
+
+
+ inline auto group_prerequisites::iterator::
+ operator-- () -> iterator&
+ {
+ if (i_ == c_->begin () && c_ == &t_->prerequisites ())
+ {
+ c_ = &g_->prerequisites ();
+ i_ = c_->end ();
+ }
+
+ --i_;
+ return *this;
+ }
+
// prerequisite_member
//
inline prerequisite prerequisite_member::
@@ -202,6 +296,14 @@ namespace build2
return prerequisite_type (*member);
}
+ inline prerequisite_key prerequisite_member::
+ key () const
+ {
+ return member != nullptr
+ ? prerequisite_key {prerequisite.proj, member->key (), nullptr}
+ : prerequisite.key ();
+ }
+
// prerequisite_members
//
group_view
@@ -297,6 +399,18 @@ namespace build2
false;
}
+ inline auto
+ prerequisite_members (action a, const target& t, members_mode m)
+ {
+ return prerequisite_members (a, t, t.prerequisites (), m);
+ }
+
+ inline auto
+ reverse_prerequisite_members (action a, const target& t, members_mode m)
+ {
+ return prerequisite_members (a, t, reverse_iterate (t.prerequisites ()), m);
+ }
+
// mtime_target
//
inline void mtime_target::
@@ -373,4 +487,10 @@ namespace build2
return path_;
}
+
+ inline timestamp path_target::
+ load_mtime () const
+ {
+ return mtime_target::load_mtime (path ());
+ }
}
diff --git a/build2/target.txx b/libbuild2/target.txx
index 3cc249b..b93a403 100644
--- a/build2/target.txx
+++ b/libbuild2/target.txx
@@ -1,12 +1,12 @@
-// file : build2/target.txx -*- C++ -*-
+// file : libbuild2/target.txx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <libbutl/filesystem.mxx> // dir_iterator
-#include <build2/scope.hxx>
-#include <build2/diagnostics.hxx>
-#include <build2/prerequisite.hxx>
+#include <libbuild2/scope.hxx>
+#include <libbuild2/diagnostics.hxx>
+#include <libbuild2/prerequisite.hxx>
namespace build2
{
diff --git a/build2/token.cxx b/libbuild2/token.cxx
index 8b62b46..7455e26 100644
--- a/build2/token.cxx
+++ b/libbuild2/token.cxx
@@ -1,8 +1,8 @@
-// file : build2/token.cxx -*- C++ -*-
+// file : libbuild2/token.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/token.hxx>
+#include <libbuild2/token.hxx>
using namespace std;
diff --git a/build2/token.hxx b/libbuild2/token.hxx
index 50d1396..a9b9a11 100644
--- a/build2/token.hxx
+++ b/libbuild2/token.hxx
@@ -1,14 +1,16 @@
-// file : build2/token.hxx -*- C++ -*-
+// file : libbuild2/token.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_TOKEN_HXX
-#define BUILD2_TOKEN_HXX
+#ifndef LIBBUILD2_TOKEN_HXX
+#define LIBBUILD2_TOKEN_HXX
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/diagnostics.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -78,7 +80,7 @@ namespace build2
class token;
- void
+ LIBBUILD2_SYMEXPORT void
token_printer (ostream&, const token&, bool);
class token
@@ -186,4 +188,4 @@ namespace build2
}
}
-#endif // BUILD2_TOKEN_HXX
+#endif // LIBBUILD2_TOKEN_HXX
diff --git a/build2/types.hxx b/libbuild2/types.hxx
index 15b7df6..cbaf89a 100644
--- a/build2/types.hxx
+++ b/libbuild2/types.hxx
@@ -1,16 +1,16 @@
-// file : build2/types.hxx -*- C++ -*-
+// file : libbuild2/types.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_TYPES_HXX
-#define BUILD2_TYPES_HXX
+#ifndef LIBBUILD2_TYPES_HXX
+#define LIBBUILD2_TYPES_HXX
// Include unprocessed file during bootstrap. See config.hxx.in for details.
//
#ifdef BUILD2_BOOTSTRAP
-# include <build2/config.hxx.in>
+# include <libbuild2/config.hxx.in>
#else
-# include <build2/config.hxx>
+# include <libbuild2/config.hxx>
#endif
#include <array>
@@ -56,6 +56,8 @@
#include <libbutl/semantic-version.mxx>
#include <libbutl/standard-version.mxx>
+#include <libbuild2/export.hxx>
+
namespace build2
{
// Commonly-used types.
@@ -328,10 +330,10 @@ namespace build2
//
enum class run_phase {load, match, execute};
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, run_phase); // utility.cxx
- extern run_phase phase;
+ LIBBUILD2_SYMEXPORT extern run_phase phase;
}
// In order to be found (via ADL) these have to be either in std:: or in
@@ -342,17 +344,17 @@ namespace std
{
// Path printing with trailing slash for directories.
//
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, const ::butl::path&);
// Print as recall[@effect].
//
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, const ::butl::process_path&);
}
-// <build2/name.hxx>
+// <libbuild2/name.hxx>
//
-#include <build2/name.hxx>
+#include <libbuild2/name.hxx>
-#endif // BUILD2_TYPES_HXX
+#endif // LIBBUILD2_TYPES_HXX
diff --git a/build2/utility.cxx b/libbuild2/utility.cxx
index 9448c03..396ce82 100644
--- a/build2/utility.cxx
+++ b/libbuild2/utility.cxx
@@ -1,23 +1,23 @@
-// file : build2/utility.cxx -*- C++ -*-
+// file : libbuild2/utility.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/utility.hxx>
+#include <libbuild2/utility.hxx>
#include <time.h> // tzset() (POSIX), _tzset() (Windows)
#include <cstring> // strlen(), str[n]cmp()
#include <iostream> // cerr
-#include <build2/target.hxx>
-#include <build2/variable.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/target.hxx>
+#include <libbuild2/variable.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
using namespace butl;
//
-// <build2/types.hxx>
+// <libbuild2/types.hxx>
//
namespace build2
{
@@ -67,11 +67,11 @@ namespace std
namespace build2
{
//
- // <build2/utility.hxx>
+ // <libbuild2/utility.hxx>
//
process_path argv0;
- const standard_version build_version (BUILD2_VERSION_STR);
+ const standard_version build_version (LIBBUILD2_VERSION_STR);
bool dry_run_option;
optional<bool> mtime_check_option;
diff --git a/build2/utility.hxx b/libbuild2/utility.hxx
index 0aa5537..af72c58 100644
--- a/build2/utility.hxx
+++ b/libbuild2/utility.hxx
@@ -1,9 +1,9 @@
-// file : build2/utility.hxx -*- C++ -*-
+// file : libbuild2/utility.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_UTILITY_HXX
-#define BUILD2_UTILITY_HXX
+#ifndef LIBBUILD2_UTILITY_HXX
+#define LIBBUILD2_UTILITY_HXX
#include <tuple> // make_tuple()
#include <memory> // make_shared()
@@ -20,20 +20,22 @@
#include <unordered_set>
-#include <build2/types.hxx>
+#include <libbuild2/types.hxx>
// "Fake" version values used during bootstrap.
//
#ifdef BUILD2_BOOTSTRAP
-# define BUILD2_VERSION 9999999999999990000ULL
-# define BUILD2_VERSION_STR "99999.99999.99999"
-# define BUILD2_VERSION_ID "99999.99999.99999"
-# define LIBBUTL_VERSION_STR "99999.99999.99999"
-# define LIBBUTL_VERSION_ID "99999.99999.99999"
+# define LIBBUILD2_VERSION 9999999999999990000ULL
+# define LIBBUILD2_VERSION_STR "99999.99999.99999"
+# define LIBBUILD2_VERSION_ID "99999.99999.99999"
+# define LIBBUTL_VERSION_STR "99999.99999.99999"
+# define LIBBUTL_VERSION_ID "99999.99999.99999"
#else
-# include <build2/version.hxx>
+# include <libbuild2/version.hxx>
#endif
+#include <libbuild2/export.hxx>
+
namespace build2
{
using std::move;
@@ -92,29 +94,31 @@ namespace build2
// Initialize the diagnostics state. Should be called once early in main().
// Default values are for unit tests.
//
- void
+ LIBBUILD2_SYMEXPORT void
init_diag (uint16_t verbosity,
optional<bool> progress = nullopt,
bool no_lines = false,
bool no_columns = false,
bool stderr_term = false);
- extern uint16_t verb;
- const uint16_t verb_never = 7;
+ LIBBUILD2_SYMEXPORT extern uint16_t verb;
+ const uint16_t verb_never = 7;
- extern optional<bool> diag_progress_option; // --[no-]progress
+ // --[no-]progress
+ //
+ LIBBUILD2_SYMEXPORT extern optional<bool> diag_progress_option;
- extern bool diag_no_line; // --no-line
- extern bool diag_no_column; // --no-column
+ LIBBUILD2_SYMEXPORT extern bool diag_no_line; // --no-line
+ LIBBUILD2_SYMEXPORT extern bool diag_no_column; // --no-column
- extern bool stderr_term; // True if stderr is a terminal.
+ LIBBUILD2_SYMEXPORT extern bool stderr_term; // True if stderr is a terminal.
// Global state (verbosity, home/work directories, etc).
// Initialize the global state. Should be called once early in main().
// Default values are for unit tests.
//
- void
+ LIBBUILD2_SYMEXPORT void
init (const char* argv0,
bool keep_going = false,
bool dry_run = false,
@@ -124,35 +128,38 @@ namespace build2
// Build system driver process path (argv0.initial is argv[0]).
//
- extern process_path argv0;
+ LIBBUILD2_SYMEXPORT extern process_path argv0;
// Build system driver version and check.
//
- extern const standard_version build_version;
+ LIBBUILD2_SYMEXPORT extern const standard_version build_version;
+
+ LIBBUILD2_SYMEXPORT extern bool dry_run_option; // --dry-run
- extern bool dry_run_option; // --dry-run
- extern optional<bool> mtime_check_option; // --[no-]mtime-check
+ // --[no-]mtime-check
+ //
+ LIBBUILD2_SYMEXPORT extern optional<bool> mtime_check_option;
- extern optional<path> config_sub; // --config-sub
- extern optional<path> config_guess; // --config-guess
+ LIBBUILD2_SYMEXPORT extern optional<path> config_sub; // --config-sub
+ LIBBUILD2_SYMEXPORT extern optional<path> config_guess; // --config-guess
class location;
- void
+ LIBBUILD2_SYMEXPORT void
check_build_version (const standard_version_constraint&, const location&);
// Work/home directories (must be initialized in main()) and relative path
// calculation.
//
- extern dir_path work;
- extern dir_path home;
+ LIBBUILD2_SYMEXPORT extern dir_path work;
+ LIBBUILD2_SYMEXPORT extern dir_path home;
// By default this points to work. Setting this to something else should
// only be done in tightly controlled, non-concurrent situations (e.g.,
// state dump). If it is empty, then relative() below returns the original
// path.
//
- extern const dir_path* relative_base;
+ LIBBUILD2_SYMEXPORT extern const dir_path* relative_base;
// If possible and beneficial, translate an absolute, normalized path into
// relative to the relative_base directory, which is normally work. Note
@@ -165,7 +172,7 @@ namespace build2
class path_target;
- path
+ LIBBUILD2_SYMEXPORT path
relative (const path_target&);
// In addition to calling relative(), this function also uses shorter
@@ -173,7 +180,7 @@ namespace build2
// slash. If the path is the same as base, returns "./" if current is true
// and empty string otherwise.
//
- string
+ LIBBUILD2_SYMEXPORT string
diag_relative (const path&, bool current = true);
// Basic process utilities.
@@ -184,7 +191,7 @@ namespace build2
// Search for a process executable. Issue diagnostics and throw failed in
// case of an error.
//
- process_path
+ LIBBUILD2_SYMEXPORT process_path
run_search (const char*& args0,
bool path_only,
const location& = location ());
@@ -195,14 +202,14 @@ namespace build2
return run_search (args0, false, l);
}
- process_path
+ LIBBUILD2_SYMEXPORT process_path
run_search (const path&,
bool init = false,
const dir_path& fallback = dir_path (),
bool path_only = false,
const location& = location ());
- process_path
+ LIBBUILD2_SYMEXPORT process_path
try_run_search (const path&,
bool init = false,
const dir_path& fallback = dir_path (),
@@ -215,7 +222,7 @@ namespace build2
// false), return false. The last argument is used in cooperation with
// run_start() in case STDERR is redirected to STDOUT.
//
- bool
+ LIBBUILD2_SYMEXPORT bool
run_finish (const char* args[],
process&,
bool error = true,
@@ -235,7 +242,7 @@ namespace build2
// from the child process). Issue diagnostics and throw failed in case of an
// error.
//
- process
+ LIBBUILD2_SYMEXPORT process
run_start (uint16_t verbosity,
const process_env&, // Implicit-constructible from process_path.
const char* args[],
@@ -442,15 +449,15 @@ namespace build2
// Empty/nullopt string, path, and project name.
//
- extern const string empty_string;
- extern const path empty_path;
- extern const dir_path empty_dir_path;
- extern const project_name empty_project_name;
+ LIBBUILD2_SYMEXPORT extern const string empty_string;
+ LIBBUILD2_SYMEXPORT extern const path empty_path;
+ LIBBUILD2_SYMEXPORT extern const dir_path empty_dir_path;
+ LIBBUILD2_SYMEXPORT extern const project_name empty_project_name;
- extern const optional<string> nullopt_string;
- extern const optional<path> nullopt_path;
- extern const optional<dir_path> nullopt_dir_path;
- extern const optional<project_name> nullopt_project_name;
+ LIBBUILD2_SYMEXPORT extern const optional<string> nullopt_string;
+ LIBBUILD2_SYMEXPORT extern const optional<path> nullopt_path;
+ LIBBUILD2_SYMEXPORT extern const optional<dir_path> nullopt_dir_path;
+ LIBBUILD2_SYMEXPORT extern const optional<project_name> nullopt_project_name;
// Hash a path potentially without the specific directory prefix.
//
@@ -502,13 +509,13 @@ namespace build2
class value;
struct lookup;
- void
+ LIBBUILD2_SYMEXPORT void
append_options (cstrings&, const lookup&, const char* excl = nullptr);
- void
+ LIBBUILD2_SYMEXPORT void
append_options (strings&, const lookup&, const char* excl = nullptr);
- void
+ LIBBUILD2_SYMEXPORT void
hash_options (sha256&, const lookup&);
void
@@ -520,17 +527,17 @@ namespace build2
void
hash_options (sha256&, const strings&);
- void
+ LIBBUILD2_SYMEXPORT void
append_options (cstrings&,
const strings&, size_t,
const char* excl = nullptr);
- void
+ LIBBUILD2_SYMEXPORT void
append_options (strings&,
const strings&, size_t,
const char* excl = nullptr);
- void
+ LIBBUILD2_SYMEXPORT void
hash_options (sha256&, const strings&, size_t);
// As above but append/hash option values for the specified option (e.g.,
@@ -567,13 +574,13 @@ namespace build2
const char* variable,
bool ignore_case = false);
- bool
+ LIBBUILD2_SYMEXPORT bool
find_option (const char* option, const lookup&, bool ignore_case = false);
- bool
+ LIBBUILD2_SYMEXPORT bool
find_option (const char* option, const strings&, bool ignore_case = false);
- bool
+ LIBBUILD2_SYMEXPORT bool
find_option (const char* option, const cstrings&, bool ignore_case = false);
// As above but look for several options returning true if any is present.
@@ -589,13 +596,13 @@ namespace build2
bool
find_options (initializer_list<const char*>, T&, const char*, bool = false);
- bool
+ LIBBUILD2_SYMEXPORT bool
find_options (initializer_list<const char*>, const lookup&, bool = false);
- bool
+ LIBBUILD2_SYMEXPORT bool
find_options (initializer_list<const char*>, const strings&, bool = false);
- bool
+ LIBBUILD2_SYMEXPORT bool
find_options (initializer_list<const char*>, const cstrings&, bool = false);
// As above but look for an option that has the specified prefix. Return the
@@ -611,13 +618,13 @@ namespace build2
const string*
find_option_prefix (const char* prefix, T&, const char*, bool = false);
- const string*
+ LIBBUILD2_SYMEXPORT const string*
find_option_prefix (const char* prefix, const lookup&, bool = false);
- const string*
+ LIBBUILD2_SYMEXPORT const string*
find_option_prefix (const char* prefix, const strings&, bool = false);
- const char*
+ LIBBUILD2_SYMEXPORT const char*
find_option_prefix (const char* prefix, const cstrings&, bool = false);
// As above but look for several option prefixes.
@@ -636,16 +643,16 @@ namespace build2
const char*,
bool = false);
- const string*
+ LIBBUILD2_SYMEXPORT const string*
find_option_prefixes (initializer_list<const char*>,
const lookup&, bool = false);
- const string*
+ LIBBUILD2_SYMEXPORT const string*
find_option_prefixes (initializer_list<const char*>,
const strings&,
bool = false);
- const char*
+ LIBBUILD2_SYMEXPORT const char*
find_option_prefixes (initializer_list<const char*>,
const cstrings&,
bool = false);
@@ -654,11 +661,11 @@ namespace build2
// NULL or empty, then return the stem itself. Assume the pattern is valid,
// i.e., contains a single '*' character.
//
- string
+ LIBBUILD2_SYMEXPORT string
apply_pattern (const char* stem, const string* pattern);
}
-#include <build2/utility.ixx>
-#include <build2/utility.txx>
+#include <libbuild2/utility.ixx>
+#include <libbuild2/utility.txx>
-#endif // BUILD2_UTILITY_HXX
+#endif // LIBBUILD2_UTILITY_HXX
diff --git a/build2/utility.ixx b/libbuild2/utility.ixx
index 1b1fe79..8d3f6ba 100644
--- a/build2/utility.ixx
+++ b/libbuild2/utility.ixx
@@ -1,4 +1,4 @@
-// file : build2/utility.ixx -*- C++ -*-
+// file : libbuild2/utility.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
diff --git a/build2/utility.txx b/libbuild2/utility.txx
index 0bbdfad..a91cb15 100644
--- a/build2/utility.txx
+++ b/libbuild2/utility.txx
@@ -1,4 +1,4 @@
-// file : build2/utility.txx -*- C++ -*-
+// file : libbuild2/utility.txx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
diff --git a/build2/variable.cxx b/libbuild2/variable.cxx
index 173efe5..beb169e 100644
--- a/build2/variable.cxx
+++ b/libbuild2/variable.cxx
@@ -1,15 +1,15 @@
-// file : build2/variable.cxx -*- C++ -*-
+// file : libbuild2/variable.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/variable.hxx>
+#include <libbuild2/variable.hxx>
#include <cstring> // memcmp()
#include <libbutl/filesystem.mxx> // path_match()
-#include <build2/context.hxx>
-#include <build2/diagnostics.hxx>
+#include <libbuild2/context.hxx>
+#include <libbuild2/diagnostics.hxx>
using namespace std;
@@ -1519,4 +1519,15 @@ namespace build2
size_t variable_cache_mutex_shard_size;
unique_ptr<shared_mutex[]> variable_cache_mutex_shard;
+
+ template struct LIBBUILD2_DEFEXPORT value_traits<strings>;
+ template struct LIBBUILD2_DEFEXPORT value_traits<vector<name>>;
+ template struct LIBBUILD2_DEFEXPORT value_traits<paths>;
+ template struct LIBBUILD2_DEFEXPORT value_traits<dir_paths>;
+ template struct LIBBUILD2_DEFEXPORT value_traits<uint64s>;
+
+ template struct LIBBUILD2_DEFEXPORT value_traits<std::map<string, string>>;
+
+ template struct LIBBUILD2_DEFEXPORT
+ value_traits<std::map<project_name, dir_path>>;
}
diff --git a/build2/variable.hxx b/libbuild2/variable.hxx
index 782cc2b..9a106b5 100644
--- a/build2/variable.hxx
+++ b/libbuild2/variable.hxx
@@ -1,9 +1,9 @@
-// file : build2/variable.hxx -*- C++ -*-
+// file : libbuild2/variable.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_VARIABLE_HXX
-#define BUILD2_VARIABLE_HXX
+#ifndef LIBBUILD2_VARIABLE_HXX
+#define LIBBUILD2_VARIABLE_HXX
#include <map>
#include <set>
@@ -13,10 +13,12 @@
#include <libbutl/prefix-map.mxx>
#include <libbutl/multi-index.mxx> // map_key
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/target-type.hxx>
+#include <libbuild2/target-type.hxx>
+
+#include <libbuild2/export.hxx>
namespace build2
{
@@ -137,7 +139,7 @@ namespace build2
}
#endif
- ostream&
+ LIBBUILD2_SYMEXPORT ostream&
operator<< (ostream&, variable_visibility);
// variable
@@ -253,7 +255,7 @@ namespace build2
//
//
- class value
+ class LIBBUILD2_SYMEXPORT value
{
public:
// NULL means this value is not (yet) typed.
@@ -397,12 +399,12 @@ namespace build2
// values can also be untyped. NULL values compare equal and a NULL value
// is always less than a non-NULL.
//
- bool operator== (const value&, const value&);
- bool operator!= (const value&, const value&);
- bool operator< (const value&, const value&);
- bool operator<= (const value&, const value&);
- bool operator> (const value&, const value&);
- bool operator>= (const value&, const value&);
+ LIBBUILD2_SYMEXPORT bool operator== (const value&, const value&);
+ bool operator!= (const value&, const value&);
+ LIBBUILD2_SYMEXPORT bool operator< (const value&, const value&);
+ bool operator<= (const value&, const value&);
+ LIBBUILD2_SYMEXPORT bool operator> (const value&, const value&);
+ bool operator>= (const value&, const value&);
// Value cast. The first three expect the value to be not NULL. The cast
// from lookup expects the value to also be defined.
@@ -455,12 +457,14 @@ namespace build2
template <typename T>
void typify (value&, const variable*);
void typify (value&, const value_type&, const variable*);
- void typify_atomic (value&, const value_type&, const variable*);
+
+ LIBBUILD2_SYMEXPORT void
+ typify_atomic (value&, const value_type&, const variable*);
// Remove value type from the value reversing it to names. This is similar
// to reverse() below except that it modifies the value itself.
//
- void untypify (value&);
+ LIBBUILD2_SYMEXPORT void untypify (value&);
// Reverse the value back to names. The value should not be NULL and storage
// should be empty.
@@ -678,7 +682,7 @@ namespace build2
// names
//
template <>
- struct value_traits<names>
+ struct LIBBUILD2_SYMEXPORT value_traits<names>
{
static const names& empty_instance;
};
@@ -686,7 +690,7 @@ namespace build2
// bool
//
template <>
- struct value_traits<bool>
+ struct LIBBUILD2_SYMEXPORT value_traits<bool>
{
static_assert (sizeof (bool) <= value::size_, "insufficient space");
@@ -703,7 +707,7 @@ namespace build2
};
template <>
- struct value_traits<uint64_t>
+ struct LIBBUILD2_SYMEXPORT value_traits<uint64_t>
{
static_assert (sizeof (uint64_t) <= value::size_, "insufficient space");
@@ -732,7 +736,7 @@ namespace build2
// string
//
template <>
- struct value_traits<string>
+ struct LIBBUILD2_SYMEXPORT value_traits<string>
{
static_assert (sizeof (string) <= value::size_, "insufficient space");
@@ -758,7 +762,7 @@ namespace build2
// path
//
template <>
- struct value_traits<path>
+ struct LIBBUILD2_SYMEXPORT value_traits<path>
{
static_assert (sizeof (path) <= value::size_, "insufficient space");
@@ -783,7 +787,7 @@ namespace build2
// dir_path
//
template <>
- struct value_traits<dir_path>
+ struct LIBBUILD2_SYMEXPORT value_traits<dir_path>
{
static_assert (sizeof (dir_path) <= value::size_, "insufficient space");
@@ -804,7 +808,7 @@ namespace build2
// abs_dir_path
//
template <>
- struct value_traits<abs_dir_path>
+ struct LIBBUILD2_SYMEXPORT value_traits<abs_dir_path>
{
static_assert (sizeof (abs_dir_path) <= value::size_,
"insufficient space");
@@ -824,7 +828,7 @@ namespace build2
// name
//
template <>
- struct value_traits<name>
+ struct LIBBUILD2_SYMEXPORT value_traits<name>
{
static_assert (sizeof (name) <= value::size_, "insufficient space");
@@ -847,7 +851,7 @@ namespace build2
// pair of two empties).
//
template <>
- struct value_traits<name_pair>
+ struct LIBBUILD2_SYMEXPORT value_traits<name_pair>
{
static_assert (sizeof (name_pair) <= value::size_, "insufficient space");
@@ -868,7 +872,7 @@ namespace build2
// initial is its shallow copy.
//
template <>
- struct value_traits<process_path>
+ struct LIBBUILD2_SYMEXPORT value_traits<process_path>
{
static_assert (sizeof (process_path) <= value::size_,
"insufficient space");
@@ -889,7 +893,7 @@ namespace build2
// target_triplet
//
template <>
- struct value_traits<target_triplet>
+ struct LIBBUILD2_SYMEXPORT value_traits<target_triplet>
{
static_assert (sizeof (target_triplet) <= value::size_,
"insufficient space");
@@ -909,7 +913,7 @@ namespace build2
// project_name
//
template <>
- struct value_traits<project_name>
+ struct LIBBUILD2_SYMEXPORT value_traits<project_name>
{
static_assert (sizeof (project_name) <= value::size_,
"insufficient space");
@@ -981,6 +985,24 @@ namespace build2
static const value_type_ex value_type;
};
+ // Explicitly pre-instantiate and export value_traits templates for
+ // vector/map value types used in the build2 project. Note that this is not
+ // merely an optimization since not doing so we may end up with multiple
+ // value type objects for the same traits type (and we use their addressed
+ // as identity; see cast(const value&) for an example).
+ //
+ extern template struct LIBBUILD2_DECEXPORT value_traits<strings>;
+ extern template struct LIBBUILD2_DECEXPORT value_traits<vector<name>>;
+ extern template struct LIBBUILD2_DECEXPORT value_traits<paths>;
+ extern template struct LIBBUILD2_DECEXPORT value_traits<dir_paths>;
+ extern template struct LIBBUILD2_DECEXPORT value_traits<uint64s>;
+
+ extern template struct LIBBUILD2_DECEXPORT
+ value_traits<std::map<string, string>>;
+
+ extern template struct LIBBUILD2_DECEXPORT
+ value_traits<std::map<project_name, dir_path>>;
+
// Project-wide (as opposed to global) variable overrides. Returned by
// context.cxx:reset().
//
@@ -1085,7 +1107,7 @@ namespace build2
// names (i.e., there would be no cross-alias overriding). So for now we
// don't allow this (use the common variable mechanism instead).
//
- const variable&
+ LIBBUILD2_SYMEXPORT const variable&
insert_alias (const variable& var, string name);
// Insert a variable pattern. Any variable that matches this pattern
@@ -1115,7 +1137,7 @@ namespace build2
// for the insertion order (you probably want more specific first).
//
public:
- void
+ LIBBUILD2_SYMEXPORT void
insert_pattern (const string& pattern,
optional<const value_type*> type,
optional<bool> overridable,
@@ -1154,16 +1176,16 @@ namespace build2
rw (scope&) const {return const_cast<variable_pool&> (*this);}
private:
- static variable_pool instance;
+ LIBBUILD2_SYMEXPORT static variable_pool instance;
- variable&
+ LIBBUILD2_SYMEXPORT variable&
insert (string name,
const value_type*,
const variable_visibility* = nullptr,
const bool* overridable = nullptr,
bool pattern = true);
- void
+ LIBBUILD2_SYMEXPORT void
update (variable&,
const value_type*,
const variable_visibility* = nullptr,
@@ -1173,10 +1195,12 @@ namespace build2
//
friend class parser;
friend class scope;
- friend variable_overrides reset (const strings&);
+ friend LIBBUILD2_SYMEXPORT variable_overrides reset (const strings&);
public:
- static const variable_pool& cinstance; // For var_pool initialization.
+ // For var_pool initialization.
+ //
+ LIBBUILD2_SYMEXPORT static const variable_pool& cinstance;
// Variable map.
//
@@ -1243,7 +1267,7 @@ namespace build2
bool global_;
};
- extern const variable_pool& var_pool;
+ LIBBUILD2_SYMEXPORT extern const variable_pool& var_pool;
}
// variable_map
@@ -1275,7 +1299,7 @@ namespace butl
namespace build2
{
- class variable_map
+ class LIBBUILD2_SYMEXPORT variable_map
{
public:
struct value_data: value
@@ -1442,8 +1466,10 @@ namespace build2
// main()). This shard is also used for value typification (which is kind of
// like caching) during concurrent execution phases.
//
- extern size_t variable_cache_mutex_shard_size;
- extern unique_ptr<shared_mutex[]> variable_cache_mutex_shard;
+ LIBBUILD2_SYMEXPORT extern size_t variable_cache_mutex_shard_size;
+
+ LIBBUILD2_SYMEXPORT extern unique_ptr<shared_mutex[]>
+ variable_cache_mutex_shard;
template <typename K>
class variable_cache
@@ -1522,7 +1548,7 @@ namespace build2
map_type map_;
};
- class variable_type_map
+ class LIBBUILD2_SYMEXPORT variable_type_map
{
public:
using map_type = std::map<reference_wrapper<const target_type>,
@@ -1564,7 +1590,7 @@ namespace build2
};
}
-#include <build2/variable.ixx>
-#include <build2/variable.txx>
+#include <libbuild2/variable.ixx>
+#include <libbuild2/variable.txx>
-#endif // BUILD2_VARIABLE_HXX
+#endif // LIBBUILD2_VARIABLE_HXX
diff --git a/build2/variable.ixx b/libbuild2/variable.ixx
index 559151b..f0bde09 100644
--- a/build2/variable.ixx
+++ b/libbuild2/variable.ixx
@@ -1,9 +1,11 @@
-// file : build2/variable.ixx -*- C++ -*-
+// file : libbuild2/variable.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <type_traits> // is_same
+#include <libbuild2/export.hxx>
+
namespace build2
{
// value
@@ -150,6 +152,8 @@ namespace build2
// Find base if any.
//
+ // Note that here we use the value type address as type identity.
+ //
const value_type* b (v.type);
for (;
b != nullptr && b != &value_traits<T>::value_type;
@@ -271,7 +275,7 @@ namespace build2
typify (v, t, var);
}
- void
+ LIBBUILD2_SYMEXPORT void
typify (value&, const value_type&, const variable*, memory_order);
inline void
@@ -729,8 +733,7 @@ namespace build2
// Note that this will only move values. Keys (being const) are still
// copied.
//
- m.insert (m.end (),
- make_move_iterator (x.begin ()),
+ m.insert (make_move_iterator (x.begin ()),
make_move_iterator (x.end ()));
}
else
diff --git a/build2/variable.txx b/libbuild2/variable.txx
index 1aba99d..9b7490a 100644
--- a/build2/variable.txx
+++ b/libbuild2/variable.txx
@@ -1,8 +1,8 @@
-// file : build2/variable.txx -*- C++ -*-
+// file : libbuild2/variable.txx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/diagnostics.hxx>
+#include <libbuild2/diagnostics.hxx>
namespace build2
{
diff --git a/libbuild2/version.hxx b/libbuild2/version.hxx
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/libbuild2/version.hxx
diff --git a/build2/version.hxx.in b/libbuild2/version.hxx.in
index d6be346..1e448d8 100644
--- a/build2/version.hxx.in
+++ b/libbuild2/version.hxx.in
@@ -1,8 +1,8 @@
-// file : build2/version.hxx.in -*- C++ -*-
+// file : libbuild2/version.hxx.in -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_VERSION // Note: using the version macro itself.
+#ifndef LIBBUILD2_VERSION // Note: using the version macro itself.
// The numeric version format is AAAAABBBBBCCCCCDDDE where:
//
@@ -26,21 +26,21 @@
// NOTE: remember to also update "fake" bootstrap values in utility.hxx if
// changing anything here.
-#define BUILD2_VERSION $build2.version.project_number$ULL
-#define BUILD2_VERSION_STR "$build2.version.project$"
-#define BUILD2_VERSION_ID "$build2.version.project_id$"
+#define LIBBUILD2_VERSION $build2.version.project_number$ULL
+#define LIBBUILD2_VERSION_STR "$build2.version.project$"
+#define LIBBUILD2_VERSION_ID "$build2.version.project_id$"
-#define BUILD2_VERSION_MAJOR $build2.version.major$
-#define BUILD2_VERSION_MINOR $build2.version.minor$
-#define BUILD2_VERSION_PATCH $build2.version.patch$
+#define LIBBUILD2_VERSION_MAJOR $build2.version.major$
+#define LIBBUILD2_VERSION_MINOR $build2.version.minor$
+#define LIBBUILD2_VERSION_PATCH $build2.version.patch$
-#define BUILD2_PRE_RELEASE $build2.version.pre_release$
+#define LIBBUILD2_PRE_RELEASE $build2.version.pre_release$
-#define BUILD2_SNAPSHOT $build2.version.snapshot_sn$ULL
-#define BUILD2_SNAPSHOT_ID "$build2.version.snapshot_id$"
+#define LIBBUILD2_SNAPSHOT $build2.version.snapshot_sn$ULL
+#define LIBBUILD2_SNAPSHOT_ID "$build2.version.snapshot_id$"
#include <libbutl/version.hxx>
$libbutl.check(LIBBUTL_VERSION, LIBBUTL_SNAPSHOT)$
-#endif // BUILD2_VERSION
+#endif // LIBBUILD2_VERSION
diff --git a/old-tests/depdb/driver.cxx b/old-tests/depdb/driver.cxx
index b95d299..64668a1 100644
--- a/old-tests/depdb/driver.cxx
+++ b/old-tests/depdb/driver.cxx
@@ -6,10 +6,10 @@
#include <libbutl/filesystem.mxx>
-#include <build2/types.hxx>
-#include <build2/utility.hxx>
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
-#include <build2/depdb.hxx>
+#include <libbuild2/depdb.hxx>
using namespace std;
using namespace build2;
diff --git a/tests/libbuild2/buildfile b/tests/libbuild2/buildfile
new file mode 100644
index 0000000..4d3a42f
--- /dev/null
+++ b/tests/libbuild2/buildfile
@@ -0,0 +1,12 @@
+# file : tests/libbuild2/buildfile
+# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+import libs = build2%lib{build2}
+
+exe{driver}: {hxx cxx}{*} $libs testscript
+
+# Setup the test driver. Note that by default we test the build2 driver (see
+# build/root.build for details).
+#
+testscript@./: test = exe{driver}
diff --git a/tests/libbuild2/driver.cxx b/tests/libbuild2/driver.cxx
new file mode 100644
index 0000000..3df2fbe
--- /dev/null
+++ b/tests/libbuild2/driver.cxx
@@ -0,0 +1,24 @@
+// file : tests/libbuild2/driver.cxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/context.hxx> // sched, reset()
+#include <libbuild2/scheduler.hxx>
+
+using namespace build2;
+
+int
+main (int, char* argv[])
+{
+ // Fake build system driver, default verbosity.
+ //
+ init_diag (1);
+ init (argv[0]);
+ sched.startup (1); // Serial execution.
+ reset (strings ()); // No command line variables.
+
+ return 0;
+}
diff --git a/tests/libbuild2/testscript b/tests/libbuild2/testscript
new file mode 100644
index 0000000..35c2c5f
--- /dev/null
+++ b/tests/libbuild2/testscript
@@ -0,0 +1,7 @@
+# file : tests/libbuild2/testscript
+# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+: basic
+:
+$*
diff --git a/tests/test/script/builtin/cp.testscript b/tests/test/script/builtin/cp.testscript
index 5f69f05..aa16465 100644
--- a/tests/test/script/builtin/cp.testscript
+++ b/tests/test/script/builtin/cp.testscript
@@ -358,6 +358,18 @@ if ($cxx.target.class != 'windows')
EOE
}
+ # @@ Temporary disable the test as it may fail if the package is fetched
+ # from the git repository location. Note that the used `ls -l` command
+ # displays the filesystem entry modification time with the minute
+ # resolution and the build2 dist meta-operation doesn't preserve the
+ # directory modification time. That's why the test command may
+ # unexpectedly succeed.
+ #
+ # One way to fix it is to instruct ls to show time with at least the
+ # second resolution. There is no portable way for that across different
+ # OSes but all of them seems to provide some option to achieve that.
+ #
+#\
: dir
:
{
@@ -372,5 +384,6 @@ if ($cxx.target.class != 'windows')
%.+
EOE
}
+#\
}
}