summaryrefslogtreecommitdiffstats
path: root/src/boost/tools/build/example
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/boost/tools/build/example
parentInitial commit. (diff)
downloadceph-upstream/18.2.2.tar.xz
ceph-upstream/18.2.2.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/tools/build/example')
-rw-r--r--src/boost/tools/build/example/asciidoctor/example.adoc3
-rw-r--r--src/boost/tools/build/example/asciidoctor/example_manpage.adoc38
-rw-r--r--src/boost/tools/build/example/asciidoctor/jamroot.jam11
-rw-r--r--src/boost/tools/build/example/boost-build.jam6
-rw-r--r--src/boost/tools/build/example/built_tool/Jamroot.jam8
-rw-r--r--src/boost/tools/build/example/built_tool/core/Jamfile.jam39
-rw-r--r--src/boost/tools/build/example/built_tool/core/a.td0
-rw-r--r--src/boost/tools/build/example/built_tool/core/core.cpp5
-rw-r--r--src/boost/tools/build/example/built_tool/readme.txt5
-rw-r--r--src/boost/tools/build/example/built_tool/tblgen/Jamfile.jam4
-rw-r--r--src/boost/tools/build/example/built_tool/tblgen/tblgen.cpp9
-rw-r--r--src/boost/tools/build/example/complex-testing/compile-fail.cpp14
-rw-r--r--src/boost/tools/build/example/complex-testing/fail.cpp14
-rw-r--r--src/boost/tools/build/example/complex-testing/jamroot.jam15
-rw-r--r--src/boost/tools/build/example/complex-testing/post.cpp14
-rw-r--r--src/boost/tools/build/example/complex-testing/success.cpp14
-rw-r--r--src/boost/tools/build/example/customization/class.verbatim7
-rw-r--r--src/boost/tools/build/example/customization/codegen.cpp36
-rw-r--r--src/boost/tools/build/example/customization/inline_file.py44
-rw-r--r--src/boost/tools/build/example/customization/jamroot.jam9
-rw-r--r--src/boost/tools/build/example/customization/readme.txt11
-rw-r--r--src/boost/tools/build/example/customization/t1.verbatim2
-rw-r--r--src/boost/tools/build/example/customization/t2.verbatim0
-rw-r--r--src/boost/tools/build/example/customization/usage.verbatim5
-rw-r--r--src/boost/tools/build/example/customization/verbatim.jam61
-rw-r--r--src/boost/tools/build/example/customization/verbatim.py47
-rw-r--r--src/boost/tools/build/example/generate/README.txt11
-rw-r--r--src/boost/tools/build/example/generate/a.cpp10
-rw-r--r--src/boost/tools/build/example/generate/gen.jam26
-rw-r--r--src/boost/tools/build/example/generate/gen.py16
-rw-r--r--src/boost/tools/build/example/generate/jamroot.jam9
-rw-r--r--src/boost/tools/build/example/generator/README.txt6
-rw-r--r--src/boost/tools/build/example/generator/foo.gci10
-rw-r--r--src/boost/tools/build/example/generator/jamroot.jam6
-rw-r--r--src/boost/tools/build/example/generator/soap.jam86
-rw-r--r--src/boost/tools/build/example/gettext/jamfile.jam26
-rw-r--r--src/boost/tools/build/example/gettext/jamroot.jam6
-rw-r--r--src/boost/tools/build/example/gettext/main.cpp28
-rw-r--r--src/boost/tools/build/example/gettext/readme.txt24
-rw-r--r--src/boost/tools/build/example/gettext/russian.po21
-rw-r--r--src/boost/tools/build/example/hello/hello.cpp14
-rw-r--r--src/boost/tools/build/example/hello/jamroot.jam1
-rw-r--r--src/boost/tools/build/example/hello/readme.adoc46
-rw-r--r--src/boost/tools/build/example/libraries/app/app.cpp12
-rw-r--r--src/boost/tools/build/example/libraries/app/jamfile.jam9
-rw-r--r--src/boost/tools/build/example/libraries/jamroot.jam4
-rw-r--r--src/boost/tools/build/example/libraries/util/foo/bar.cpp10
-rw-r--r--src/boost/tools/build/example/libraries/util/foo/include/lib1.h7
-rw-r--r--src/boost/tools/build/example/libraries/util/foo/jamfile.jam9
-rw-r--r--src/boost/tools/build/example/make/foo.py2
-rw-r--r--src/boost/tools/build/example/make/jamroot.jam22
-rw-r--r--src/boost/tools/build/example/make/main_cpp.pro1
-rw-r--r--src/boost/tools/build/example/make/readme.txt7
-rw-r--r--src/boost/tools/build/example/named-install-dirs/a0
-rw-r--r--src/boost/tools/build/example/named-install-dirs/build.jam54
-rw-r--r--src/boost/tools/build/example/named-install-dirs/x/build.jam5
-rw-r--r--src/boost/tools/build/example/named-install-dirs/x/y/build.jam9
-rw-r--r--src/boost/tools/build/example/named-install-dirs/x/z/build.jam11
-rw-r--r--src/boost/tools/build/example/pch-multi/include/extra/meta.hpp17
-rw-r--r--src/boost/tools/build/example/pch-multi/include/pch.hpp19
-rw-r--r--src/boost/tools/build/example/pch-multi/include/std.hpp16
-rw-r--r--src/boost/tools/build/example/pch-multi/jamroot.jam30
-rw-r--r--src/boost/tools/build/example/pch-multi/source/hello_world.cpp17
-rw-r--r--src/boost/tools/build/example/pch/include/pch.hpp19
-rw-r--r--src/boost/tools/build/example/pch/jamroot.jam29
-rw-r--r--src/boost/tools/build/example/pch/source/hello_world.cpp15
-rw-r--r--src/boost/tools/build/example/pkg-config/debug-packages/debugged.pc4
-rw-r--r--src/boost/tools/build/example/pkg-config/jamroot.jam104
-rw-r--r--src/boost/tools/build/example/pkg-config/packages/debugged.pc4
-rw-r--r--src/boost/tools/build/example/pkg-config/packages/foobar.pc4
-rw-r--r--src/boost/tools/build/example/pkg-config/packages/mangled-mt.pc4
-rw-r--r--src/boost/tools/build/example/pkg-config/packages/mangled.pc4
-rw-r--r--src/boost/tools/build/example/pkg-config/packages/versioned.pc3
-rw-r--r--src/boost/tools/build/example/pkg-config/packages/with-var.pc4
-rw-r--r--src/boost/tools/build/example/pkg-config/test1.cpp11
-rw-r--r--src/boost/tools/build/example/pkg-config/test2.cpp12
-rw-r--r--src/boost/tools/build/example/pkg-config/test3.cpp12
-rw-r--r--src/boost/tools/build/example/pkg-config/test4.cpp11
-rw-r--r--src/boost/tools/build/example/pkg-config/test5.cpp12
-rw-r--r--src/boost/tools/build/example/python_modules/jamroot.jam8
-rw-r--r--src/boost/tools/build/example/python_modules/python_helpers.jam15
-rw-r--r--src/boost/tools/build/example/python_modules/python_helpers.py18
-rw-r--r--src/boost/tools/build/example/python_modules/readme.txt16
-rw-r--r--src/boost/tools/build/example/qt/README.txt20
-rw-r--r--src/boost/tools/build/example/qt/qt3/hello/canvas.cpp73
-rw-r--r--src/boost/tools/build/example/qt/qt3/hello/canvas.h35
-rw-r--r--src/boost/tools/build/example/qt/qt3/hello/jamroot.jam13
-rw-r--r--src/boost/tools/build/example/qt/qt3/hello/main.cpp36
-rw-r--r--src/boost/tools/build/example/qt/qt3/moccable-cpp/jamroot.jam11
-rw-r--r--src/boost/tools/build/example/qt/qt3/moccable-cpp/main.cpp41
-rw-r--r--src/boost/tools/build/example/qt/qt3/uic/hello_world_widget.ui58
-rw-r--r--src/boost/tools/build/example/qt/qt3/uic/jamroot.jam15
-rw-r--r--src/boost/tools/build/example/qt/qt3/uic/main.cpp18
-rw-r--r--src/boost/tools/build/example/qt/qt4/hello/arrow.cpp158
-rw-r--r--src/boost/tools/build/example/qt/qt4/hello/arrow.h30
-rw-r--r--src/boost/tools/build/example/qt/qt4/hello/jamroot.jam14
-rw-r--r--src/boost/tools/build/example/qt/qt4/hello/main.cpp27
-rw-r--r--src/boost/tools/build/example/qt/qt4/moccable-cpp/jamroot.jam18
-rw-r--r--src/boost/tools/build/example/qt/qt4/moccable-cpp/main.cpp39
-rw-r--r--src/boost/tools/build/example/qt/qt4/uic/hello_world_widget.ui55
-rw-r--r--src/boost/tools/build/example/qt/qt4/uic/jamroot.jam18
-rw-r--r--src/boost/tools/build/example/qt/qt4/uic/main.cpp23
-rw-r--r--src/boost/tools/build/example/sanitizers/jamroot.jam1
-rw-r--r--src/boost/tools/build/example/sanitizers/main.cpp9
-rw-r--r--src/boost/tools/build/example/sanitizers/readme.adoc64
-rw-r--r--src/boost/tools/build/example/sass/importing.scss3
-rw-r--r--src/boost/tools/build/example/sass/include/foobar.scss3
-rw-r--r--src/boost/tools/build/example/sass/jamroot.jam15
-rw-r--r--src/boost/tools/build/example/sass/singleton.sass12
-rw-r--r--src/boost/tools/build/example/sass/singleton.scss11
-rw-r--r--src/boost/tools/build/example/site-config.jam4
-rw-r--r--src/boost/tools/build/example/testing/compile-fail.cpp14
-rw-r--r--src/boost/tools/build/example/testing/fail.cpp14
-rw-r--r--src/boost/tools/build/example/testing/jamroot.jam10
-rw-r--r--src/boost/tools/build/example/testing/success.cpp15
-rw-r--r--src/boost/tools/build/example/time/hello.cpp12
-rw-r--r--src/boost/tools/build/example/time/jamroot.jam16
-rw-r--r--src/boost/tools/build/example/time/readme.qbk47
-rw-r--r--src/boost/tools/build/example/try_compile/Jamroot.jam29
-rw-r--r--src/boost/tools/build/example/try_compile/foo.cpp6
-rw-r--r--src/boost/tools/build/example/try_compile/main.cpp8
-rw-r--r--src/boost/tools/build/example/user-config.jam92
-rw-r--r--src/boost/tools/build/example/variant/a.cpp7
-rw-r--r--src/boost/tools/build/example/variant/jamfile.jam11
-rw-r--r--src/boost/tools/build/example/variant/jamroot.jam12
-rw-r--r--src/boost/tools/build/example/variant/libs/jamfile.jam8
-rw-r--r--src/boost/tools/build/example/variant/libs/l.cpp9
-rw-r--r--src/boost/tools/build/example/variant/readme.qbk94
128 files changed, 2565 insertions, 0 deletions
diff --git a/src/boost/tools/build/example/asciidoctor/example.adoc b/src/boost/tools/build/example/asciidoctor/example.adoc
new file mode 100644
index 000000000..1a7675c12
--- /dev/null
+++ b/src/boost/tools/build/example/asciidoctor/example.adoc
@@ -0,0 +1,3 @@
+= The Dangerous and Thrilling Documentation Chronicles
+
+This journey begins on a bleary Monday morning.
diff --git a/src/boost/tools/build/example/asciidoctor/example_manpage.adoc b/src/boost/tools/build/example/asciidoctor/example_manpage.adoc
new file mode 100644
index 000000000..88c535831
--- /dev/null
+++ b/src/boost/tools/build/example/asciidoctor/example_manpage.adoc
@@ -0,0 +1,38 @@
+= b2(1)
+Rene Rivera
+v0.0.0
+:doctype: manpage
+:manmanual: B2
+:mansource: B2
+:man-linkstyle: pass:[blue R < >]
+
+== NAME
+
+b2 - Boost Build
+
+== SYNOPSIS
+
+*b2* ['OPTION']... 'TARGET'...
+
+== OPTIONS
+
+*-n*::
+ Print out what would get built.
+
+== EXIT STATUS
+
+*0*::
+ Success.
+
+*1*::
+ Failure.
+
+== RESOURCES
+
+*Project web site:* http://boost.org
+
+== COPYING
+
+Copyright \(C) 2017 {author}. +
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE.txt or copy at https://www.bfgroup.xyz/b2/LICENSE.txt) \ No newline at end of file
diff --git a/src/boost/tools/build/example/asciidoctor/jamroot.jam b/src/boost/tools/build/example/asciidoctor/jamroot.jam
new file mode 100644
index 000000000..6b521acc5
--- /dev/null
+++ b/src/boost/tools/build/example/asciidoctor/jamroot.jam
@@ -0,0 +1,11 @@
+#|
+Copyright 2017 Rene Rivera
+Distributed under the Boost Software License, Version 1.0. (See
+accompanying file LICENSE.txt or copy at
+https://www.bfgroup.xyz/b2/LICENSE.txt)
+|#
+
+html example_html : example.adoc ;
+manpage example_1 : example_manpage.adoc ;
+pdf example_pdf : example.adoc ;
+docbook example_docbook : example.adoc ;
diff --git a/src/boost/tools/build/example/boost-build.jam b/src/boost/tools/build/example/boost-build.jam
new file mode 100644
index 000000000..21fe9782b
--- /dev/null
+++ b/src/boost/tools/build/example/boost-build.jam
@@ -0,0 +1,6 @@
+# Copyright 2002, 2003 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+boost-build ../src/kernel ;
diff --git a/src/boost/tools/build/example/built_tool/Jamroot.jam b/src/boost/tools/build/example/built_tool/Jamroot.jam
new file mode 100644
index 000000000..c458650e8
--- /dev/null
+++ b/src/boost/tools/build/example/built_tool/Jamroot.jam
@@ -0,0 +1,8 @@
+
+import feature ;
+
+feature.feature tblgen : : dependency free ;
+
+project built_tool ;
+
+build-project core ; \ No newline at end of file
diff --git a/src/boost/tools/build/example/built_tool/core/Jamfile.jam b/src/boost/tools/build/example/built_tool/core/Jamfile.jam
new file mode 100644
index 000000000..d4ec62382
--- /dev/null
+++ b/src/boost/tools/build/example/built_tool/core/Jamfile.jam
@@ -0,0 +1,39 @@
+
+import toolset ;
+import os ;
+
+project : requirements <tblgen>../tblgen//tblgen ;
+
+
+# Create a.c using a custom action defined below.
+make a.c : a.td : @tblgen ;
+
+# Use a.c in executable.
+exe core : core.cpp a.c ;
+
+# The action has to invoke the tool built in other
+# parts of the project. The <tblgen> feature is used
+# to specify the location of the tool, and the flags
+# statement below make the full path to the tool
+# available inside the action.
+toolset.flags tblgen COMMAND <tblgen> ;
+
+# We generally want a.c to be rebuilt when the tool changes.
+rule tblgen ( targets * : sources * : properties * )
+{
+ DEPENDS $(targets) : [ on $(targets) return $(COMMAND) ] ;
+}
+
+# The action that invokes the tool
+actions tblgen bind COMMAND
+{
+ $(COMMAND:E=tblgen) > $(<)
+}
+
+if [ os.name ] = VMS
+{
+ actions tblgen bind COMMAND
+ {
+ PIPE MCR $(COMMAND:WE=tblgen) > $(<:W)
+ }
+}
diff --git a/src/boost/tools/build/example/built_tool/core/a.td b/src/boost/tools/build/example/built_tool/core/a.td
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/boost/tools/build/example/built_tool/core/a.td
diff --git a/src/boost/tools/build/example/built_tool/core/core.cpp b/src/boost/tools/build/example/built_tool/core/core.cpp
new file mode 100644
index 000000000..31a133726
--- /dev/null
+++ b/src/boost/tools/build/example/built_tool/core/core.cpp
@@ -0,0 +1,5 @@
+
+int main()
+{
+ return 0;
+}
diff --git a/src/boost/tools/build/example/built_tool/readme.txt b/src/boost/tools/build/example/built_tool/readme.txt
new file mode 100644
index 000000000..bbb9f9b3a
--- /dev/null
+++ b/src/boost/tools/build/example/built_tool/readme.txt
@@ -0,0 +1,5 @@
+
+This example shows how to build an executable and then use it
+for generating other targets. The 'tblgen' subdirectory builds
+a tool, while the 'core' subdirectory uses that tool. Refer
+to core/Jamfile.jam for detailed comments. \ No newline at end of file
diff --git a/src/boost/tools/build/example/built_tool/tblgen/Jamfile.jam b/src/boost/tools/build/example/built_tool/tblgen/Jamfile.jam
new file mode 100644
index 000000000..af4906278
--- /dev/null
+++ b/src/boost/tools/build/example/built_tool/tblgen/Jamfile.jam
@@ -0,0 +1,4 @@
+
+project : requirements -<tblgen>tblgen//tblgen ;
+
+exe tblgen : tblgen.cpp ; \ No newline at end of file
diff --git a/src/boost/tools/build/example/built_tool/tblgen/tblgen.cpp b/src/boost/tools/build/example/built_tool/tblgen/tblgen.cpp
new file mode 100644
index 000000000..fbd058133
--- /dev/null
+++ b/src/boost/tools/build/example/built_tool/tblgen/tblgen.cpp
@@ -0,0 +1,9 @@
+
+#include <iostream>
+
+int main()
+{
+ std::cout << "int foo;\n";
+ return 0;
+}
+
diff --git a/src/boost/tools/build/example/complex-testing/compile-fail.cpp b/src/boost/tools/build/example/complex-testing/compile-fail.cpp
new file mode 100644
index 000000000..aa07d4e67
--- /dev/null
+++ b/src/boost/tools/build/example/complex-testing/compile-fail.cpp
@@ -0,0 +1,14 @@
+// Copyright (c) 2014 Rene Rivera
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include <iostream>
+#include <cstdlib>
+
+int main()
+{
+ std::cout << "Bye!\n";
+ return EXIT_FAILURE
+}
diff --git a/src/boost/tools/build/example/complex-testing/fail.cpp b/src/boost/tools/build/example/complex-testing/fail.cpp
new file mode 100644
index 000000000..ce8e2a189
--- /dev/null
+++ b/src/boost/tools/build/example/complex-testing/fail.cpp
@@ -0,0 +1,14 @@
+// Copyright (c) 2014 Rene Rivera
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include <iostream>
+#include <cstdlib>
+
+int main()
+{
+ std::cout << "Bye!\n";
+ return EXIT_FAILURE;
+}
diff --git a/src/boost/tools/build/example/complex-testing/jamroot.jam b/src/boost/tools/build/example/complex-testing/jamroot.jam
new file mode 100644
index 000000000..c180a2f6c
--- /dev/null
+++ b/src/boost/tools/build/example/complex-testing/jamroot.jam
@@ -0,0 +1,15 @@
+# Copyright 2016 Rene Rivera
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+using testing ;
+import property-set ;
+import path ;
+
+exe success : success.cpp ;
+
+run success : arg1 arg2 : : : success-a ;
+run success : arg3 arg4 : : : success-b ;
+
+run post.cpp : : success-a : : post-a ;
+run post.cpp : : success-b : : post-b ;
diff --git a/src/boost/tools/build/example/complex-testing/post.cpp b/src/boost/tools/build/example/complex-testing/post.cpp
new file mode 100644
index 000000000..d4af2afb4
--- /dev/null
+++ b/src/boost/tools/build/example/complex-testing/post.cpp
@@ -0,0 +1,14 @@
+// Copyright (c) 2014 Rene Rivera
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include <iostream>
+#include <cstdlib>
+
+int main(int argc, char *argv[])
+{
+ std::cout << argv[1] << "\n";
+ return EXIT_SUCCESS;
+}
diff --git a/src/boost/tools/build/example/complex-testing/success.cpp b/src/boost/tools/build/example/complex-testing/success.cpp
new file mode 100644
index 000000000..30df302c4
--- /dev/null
+++ b/src/boost/tools/build/example/complex-testing/success.cpp
@@ -0,0 +1,14 @@
+// Copyright (c) 2014 Rene Rivera
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include <iostream>
+#include <cstdlib>
+
+int main(int argc, char *argv[])
+{
+ std::cout << "Hi!\n";
+ return EXIT_SUCCESS;
+}
diff --git a/src/boost/tools/build/example/customization/class.verbatim b/src/boost/tools/build/example/customization/class.verbatim
new file mode 100644
index 000000000..5c0d7b803
--- /dev/null
+++ b/src/boost/tools/build/example/customization/class.verbatim
@@ -0,0 +1,7 @@
+class_template
+
+class %class_name% {
+public:
+ %class_name%() {}
+ ~%class_name%() {}
+}; \ No newline at end of file
diff --git a/src/boost/tools/build/example/customization/codegen.cpp b/src/boost/tools/build/example/customization/codegen.cpp
new file mode 100644
index 000000000..2c632e2d1
--- /dev/null
+++ b/src/boost/tools/build/example/customization/codegen.cpp
@@ -0,0 +1,36 @@
+// (C) Copyright Vladimir Prus, 2003
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+// Please see 'usage.verbatim' file for usage notes.
+
+#include <iostream>
+#include <string>
+#include <cstring>
+using std::cout;
+using std::string;
+using std::strlen;
+
+extern const char class_template[];
+extern const char usage[];
+
+int main(int ac, char* av[])
+{
+ if (av[1]) {
+
+ string class_name = av[1];
+ string s = class_template;
+
+ string::size_type n;
+ while((n = s.find("%class_name%")) != string::npos) {
+ s.replace(n, strlen("%class_name%"), class_name);
+ }
+ std::cout << "Output is:\n";
+ std::cout << s << "\n";
+ return 0;
+ } else {
+ std::cout << usage << "\n";
+ return 1;
+ }
+}
diff --git a/src/boost/tools/build/example/customization/inline_file.py b/src/boost/tools/build/example/customization/inline_file.py
new file mode 100644
index 000000000..77cd8cb29
--- /dev/null
+++ b/src/boost/tools/build/example/customization/inline_file.py
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+
+# Copyright 2003 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+import sys
+from string import strip
+
+def quote_line(line):
+
+ result = ""
+
+ for i in line:
+ if (i == '\\'):
+ result = result + '\\\\'
+ elif (i == '\"'):
+ result = result + '\\\"'
+ elif (i != '\r' and i != '\n'):
+ result = result + i;
+
+ return '\"' + result + '\\n\"'
+
+def quote_file(file):
+ result = ""
+
+ for i in file.readlines():
+ result = result + quote_line(i) + "\n"
+
+ return result
+
+if len(sys.argv) < 3:
+ print "Usage: inline_file.py output_c_file file_to_include"
+else:
+ output_c_file = sys.argv[1]
+ out_file = open(output_c_file, "w");
+
+ file_to_include = sys.argv[2]
+
+ in_file = open(file_to_include, "r");
+ variable_name = strip(in_file.readline())
+ out_file.write("extern const char %s[] = {\n%s};\n\n" % (variable_name, quote_file(in_file)))
+ in_file.close()
+ out_file.close()
diff --git a/src/boost/tools/build/example/customization/jamroot.jam b/src/boost/tools/build/example/customization/jamroot.jam
new file mode 100644
index 000000000..3568213c7
--- /dev/null
+++ b/src/boost/tools/build/example/customization/jamroot.jam
@@ -0,0 +1,9 @@
+# Copyright 2003 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+import verbatim ;
+
+exe codegen : codegen.cpp class.verbatim usage.verbatim
+ t1.verbatim ;
+
diff --git a/src/boost/tools/build/example/customization/readme.txt b/src/boost/tools/build/example/customization/readme.txt
new file mode 100644
index 000000000..6a799277a
--- /dev/null
+++ b/src/boost/tools/build/example/customization/readme.txt
@@ -0,0 +1,11 @@
+Copyright 2003 Vladimir Prus
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+
+This example show how to add a new target type and a new tool support to
+B2. Please refer to extender manual for a complete description of this
+example.
+
+Note that this example requires Python. If cygwin Python on Windows is to be
+used, please go to "verbatim.jam" and follow instructions there.
diff --git a/src/boost/tools/build/example/customization/t1.verbatim b/src/boost/tools/build/example/customization/t1.verbatim
new file mode 100644
index 000000000..144540f29
--- /dev/null
+++ b/src/boost/tools/build/example/customization/t1.verbatim
@@ -0,0 +1,2 @@
+t1
+//###include "t2.verbatim" \ No newline at end of file
diff --git a/src/boost/tools/build/example/customization/t2.verbatim b/src/boost/tools/build/example/customization/t2.verbatim
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/boost/tools/build/example/customization/t2.verbatim
diff --git a/src/boost/tools/build/example/customization/usage.verbatim b/src/boost/tools/build/example/customization/usage.verbatim
new file mode 100644
index 000000000..0fc4b4a37
--- /dev/null
+++ b/src/boost/tools/build/example/customization/usage.verbatim
@@ -0,0 +1,5 @@
+usage
+Usage: codegen class_name
+
+This program takes a template of C++ code and replaces of all occurrences of
+%class_name% with the passed 'class_name' parameter. \ No newline at end of file
diff --git a/src/boost/tools/build/example/customization/verbatim.jam b/src/boost/tools/build/example/customization/verbatim.jam
new file mode 100644
index 000000000..c529845df
--- /dev/null
+++ b/src/boost/tools/build/example/customization/verbatim.jam
@@ -0,0 +1,61 @@
+# Copyright 2003, 2004 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+# This file shows some of the primary customization mechanisms in B2 V2
+# and should serve as a basic for your own customization.
+# Each part has a comment describing its purpose, and you can pick the parts
+# which are relevant to your case, remove everything else, and then change names
+# and actions to taste.
+
+import os ;
+
+# Declare a new target type. This allows B2 to do something sensible
+# when targets with the .verbatim extension are found in sources.
+import type ;
+type.register VERBATIM : verbatim ;
+
+# Declare a dependency scanner for the new target type. The
+# 'inline-file.py' script does not handle includes, so this is
+# only for illustraction.
+import scanner ;
+# First, define a new class, derived from 'common-scanner',
+# that class has all the interesting logic, and we only need
+# to override the 'pattern' method which return regular
+# expression to use when scanning.
+class verbatim-scanner : common-scanner
+{
+ rule pattern ( )
+ {
+ return "//###include[ ]*\"([^\"]*)\"" ;
+ }
+}
+
+# Register the scanner class. The 'include' is
+# the property which specifies the search path
+# for includes.
+scanner.register verbatim-scanner : include ;
+# Assign the scanner class to the target type.
+# Now, all .verbatim sources will be scanned.
+# To test this, build the project, touch the
+# t2.verbatim file and build again.
+type.set-scanner VERBATIM : verbatim-scanner ;
+
+import generators ;
+generators.register-standard verbatim.inline-file : VERBATIM : CPP ;
+
+# Note: To use Cygwin Python on Windows change the following line
+# to "python inline_file.py $(<) $(>)"
+# Also, make sure that "python" in in PATH.
+actions inline-file
+{
+ "./inline_file.py" $(<) $(>)
+}
+
+if [ os.name ] = VMS
+{
+ actions inline-file
+ {
+ python inline_file.py $(<:W) $(>:W)
+ }
+}
diff --git a/src/boost/tools/build/example/customization/verbatim.py b/src/boost/tools/build/example/customization/verbatim.py
new file mode 100644
index 000000000..996577054
--- /dev/null
+++ b/src/boost/tools/build/example/customization/verbatim.py
@@ -0,0 +1,47 @@
+# Copyright 2010 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+# This file is only used with Python port of Boost.Build
+
+# This file shows some of the primary customization mechanisms in Boost.Build V2
+# and should serve as a basic for your own customization.
+# Each part has a comment describing its purpose, and you can pick the parts
+# which are relevant to your case, remove everything else, and then change names
+# and actions to taste.
+
+# Declare a new target type. This allows Boost.Build to do something sensible
+# when targets with the .verbatim extension are found in sources.
+import b2.build.type as type
+type.register("VERBATIM", ["verbatim"])
+
+# Declare a dependency scanner for the new target type. The
+# 'inline-file.py' script does not handle includes, so this is
+# only for illustraction.
+import b2.build.scanner as scanner;
+# First, define a new class, derived from 'common-scanner',
+# that class has all the interesting logic, and we only need
+# to override the 'pattern' method which return regular
+# expression to use when scanning.
+class VerbatimScanner(scanner.CommonScanner):
+
+ def pattern(self):
+ return "//###include[ ]*\"([^\"]*)\""
+
+scanner.register(VerbatimScanner, ["include"])
+type.set_scanner("VERBATIM", VerbatimScanner)
+
+import b2.build.generators as generators
+
+generators.register_standard("verbatim.inline-file",
+ ["VERBATIM"], ["CPP"])
+
+from b2.manager import get_manager
+
+get_manager().engine().register_action("verbatim.inline-file",
+"""
+./inline_file.py $(<) $(>)
+""")
+
+
+
diff --git a/src/boost/tools/build/example/generate/README.txt b/src/boost/tools/build/example/generate/README.txt
new file mode 100644
index 000000000..018cbb564
--- /dev/null
+++ b/src/boost/tools/build/example/generate/README.txt
@@ -0,0 +1,11 @@
+# Copyright 2007 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+This example shows the 'generate' rule, that allows you to construct target
+using any arbitrary set of transformation and commands.
+
+The rule is similar to 'make' and 'notfile', but unlike those, you can operate
+in terms of B2 'virtual targets', which is more flexible.
+
+Please consult the docs for more explanations.
diff --git a/src/boost/tools/build/example/generate/a.cpp b/src/boost/tools/build/example/generate/a.cpp
new file mode 100644
index 000000000..90dc5cc9b
--- /dev/null
+++ b/src/boost/tools/build/example/generate/a.cpp
@@ -0,0 +1,10 @@
+
+int main()
+{
+}
+
+/*
+Copyright 2007 Vladimir Prus
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+ */
diff --git a/src/boost/tools/build/example/generate/gen.jam b/src/boost/tools/build/example/generate/gen.jam
new file mode 100644
index 000000000..73232aab5
--- /dev/null
+++ b/src/boost/tools/build/example/generate/gen.jam
@@ -0,0 +1,26 @@
+
+import "class" : new ;
+import common ;
+
+rule generate-example ( project name : property-set : sources * )
+{
+ local result ;
+ for local s in $(sources)
+ {
+ #local source-name = [ $(s).name ] ;
+ #local source-action = [ $(s).action ] ;
+ #local source-properties = [ $(source-action).properties ] ;
+
+ # Create a new action, that takes the source target and runs the
+ # 'common.copy' command on it.
+ local a = [ new non-scanning-action $(s) : common.copy : $(property-set)
+ ] ;
+
+ # Create a target to represent the action result. Uses the target name
+ # passed here via the 'name' parameter and the same type and project as
+ # the source.
+ result += [ new file-target $(name) : [ $(s).type ] : $(project) : $(a)
+ ] ;
+ }
+ return $(result) ;
+} \ No newline at end of file
diff --git a/src/boost/tools/build/example/generate/gen.py b/src/boost/tools/build/example/generate/gen.py
new file mode 100644
index 000000000..09ee15b43
--- /dev/null
+++ b/src/boost/tools/build/example/generate/gen.py
@@ -0,0 +1,16 @@
+
+from b2.build.virtual_target import NonScanningAction, FileTarget
+
+def generate_example(project, name, ps, sources):
+
+ result = []
+ for s in sources:
+
+ a = NonScanningAction([s], "common.copy", ps)
+
+ # Create a target to represent the action result. Uses the target name
+ # passed here via the 'name' parameter and the same type and project as
+ # the source.
+ result.append(FileTarget(name, s.type(), project, a))
+
+ return result
diff --git a/src/boost/tools/build/example/generate/jamroot.jam b/src/boost/tools/build/example/generate/jamroot.jam
new file mode 100644
index 000000000..b190b322a
--- /dev/null
+++ b/src/boost/tools/build/example/generate/jamroot.jam
@@ -0,0 +1,9 @@
+# Copyright 2007 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+import generate ;
+
+import gen ;
+
+generate a2 : a.cpp : <generating-rule>@gen.generate-example ;
diff --git a/src/boost/tools/build/example/generator/README.txt b/src/boost/tools/build/example/generator/README.txt
new file mode 100644
index 000000000..f26a856a5
--- /dev/null
+++ b/src/boost/tools/build/example/generator/README.txt
@@ -0,0 +1,6 @@
+# Copyright 2006 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+This example shows how to declare a new generator class. It is necessary when
+generator's logic is more complex that just running a single tool.
diff --git a/src/boost/tools/build/example/generator/foo.gci b/src/boost/tools/build/example/generator/foo.gci
new file mode 100644
index 000000000..2ccc45c6c
--- /dev/null
+++ b/src/boost/tools/build/example/generator/foo.gci
@@ -0,0 +1,10 @@
+
+int main()
+{
+ return 0;
+}
+/*
+Copyright 2006 Vladimir Prus
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+ */
diff --git a/src/boost/tools/build/example/generator/jamroot.jam b/src/boost/tools/build/example/generator/jamroot.jam
new file mode 100644
index 000000000..b77c63ddb
--- /dev/null
+++ b/src/boost/tools/build/example/generator/jamroot.jam
@@ -0,0 +1,6 @@
+# Copyright 2006 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+import soap ;
+exe foo : foo.gci : <server>on ;
diff --git a/src/boost/tools/build/example/generator/soap.jam b/src/boost/tools/build/example/generator/soap.jam
new file mode 100644
index 000000000..d53f3a54d
--- /dev/null
+++ b/src/boost/tools/build/example/generator/soap.jam
@@ -0,0 +1,86 @@
+# Copyright 2006 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+# This is example of a fictional code generator tool.
+# It accepts a single input of type '.gci' and produces
+# either one or two outputs of type .cpp, depending
+# on the value of the feature <server-mode>
+#
+# This example is loosely based on gSOAP code generator.
+
+import type ;
+import generators ;
+import feature ;
+import common ;
+import "class" : new ;
+import os ;
+
+type.register GCI : gci ;
+
+feature.feature server : off on : incidental ;
+
+class soap-generator : generator
+{
+ import "class" : new ;
+
+ rule __init__ ( * : * )
+ {
+ generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
+ }
+
+ rule run ( project name ? : property-set : sources * )
+ {
+ if ! $(sources[2])
+ {
+ # Accept only single source.
+ local t = [ $(sources[1]).type ] ;
+ if $(t) = GCI
+ {
+ # The type is correct.
+
+ # If no output name is specified, guess it from sources.
+ if ! $(name)
+ {
+ name = [ generator.determine-output-name $(sources) ] ;
+ }
+
+ # Produce one output, using just copy.
+ local a = [ new action $(sources[1])
+ : common.copy : $(property-set) ] ;
+ local t = [ new file-target $(name) : CPP : $(project)
+ : $(a) ] ;
+
+ # If in server mode, create another output -- an
+ # empty file. If this were a real SOAP generator, we
+ # might have created a single action, and two targets
+ # both using that action.
+ local t2 ;
+ if [ $(property-set).get <server> ] = "on"
+ {
+ local a = [ new action : soap.touch : $(property-set) ] ;
+ t2 = [ new file-target $(name)_server : CPP : $(project)
+ : $(a) ] ;
+ }
+ return [ virtual-target.register $(t) ]
+ [ virtual-target.register $(t2) ] ;
+ }
+ }
+ }
+}
+
+generators.register [ new soap-generator soap.soap : GCI : CPP ] ;
+
+TOUCH = [ common.file-touch-command ] ;
+actions touch
+{
+ $(TOUCH) $(<)
+}
+
+if [ os.name ] = VMS
+{
+ actions touch
+ {
+ $(TOUCH) $(<:W)
+ }
+}
diff --git a/src/boost/tools/build/example/gettext/jamfile.jam b/src/boost/tools/build/example/gettext/jamfile.jam
new file mode 100644
index 000000000..c2a5e9bef
--- /dev/null
+++ b/src/boost/tools/build/example/gettext/jamfile.jam
@@ -0,0 +1,26 @@
+# Copyright 2003, 2006 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+# Declare a main target.
+exe main : main.cpp ;
+
+# Declare an action for updating translations
+# After changing main.cpp, invocation of
+#
+# bjam update-russian
+#
+# will update translations in russian.po
+gettext.update update-russian : russian.po main ;
+
+# Compiled message catalog.
+gettext.catalog russian : russian.po ;
+
+# A stage rule which installs message catalog to the
+# location gettext expects.
+stage messages-russian : russian
+ : <location>messages/ru_RU.KOI8-R/LC_MESSAGES
+ <name>main.mo
+ ;
+
diff --git a/src/boost/tools/build/example/gettext/jamroot.jam b/src/boost/tools/build/example/gettext/jamroot.jam
new file mode 100644
index 000000000..14f87bb78
--- /dev/null
+++ b/src/boost/tools/build/example/gettext/jamroot.jam
@@ -0,0 +1,6 @@
+# Copyright 2003 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+using gettext ;
diff --git a/src/boost/tools/build/example/gettext/main.cpp b/src/boost/tools/build/example/gettext/main.cpp
new file mode 100644
index 000000000..c44d02a81
--- /dev/null
+++ b/src/boost/tools/build/example/gettext/main.cpp
@@ -0,0 +1,28 @@
+// Copyright Vladimir Prus 2003.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+#include <locale.h>
+#include <libintl.h>
+#define i18n(s) gettext(s)
+
+#include <iostream>
+using namespace std;
+
+int main()
+{
+ // Specify that translations are stored in directory
+ // "messages".
+ bindtextdomain("main", "messages");
+ textdomain("main");
+
+ // Switch to russian locale.
+ setlocale(LC_MESSAGES, "ru_RU.KOI8-R");
+
+ // Output localized message.
+ std::cout << i18n("hello") << "\n";
+
+ return 0;
+}
diff --git a/src/boost/tools/build/example/gettext/readme.txt b/src/boost/tools/build/example/gettext/readme.txt
new file mode 100644
index 000000000..097e49b69
--- /dev/null
+++ b/src/boost/tools/build/example/gettext/readme.txt
@@ -0,0 +1,24 @@
+Copyright 2003 Vladimir Prus
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+
+This example shows how it is possible to use GNU gettext utilities with
+B2.
+
+A simple translation file is compiled and installed as message catalog for
+russian. The main application explicitly switches to russian locale and outputs
+the translation of "hello".
+
+To test:
+
+ bjam
+ bin/gcc/debug/main
+
+To test even more:
+
+ - add more localized strings to "main.cpp"
+ - run "bjam update-russian"
+ - edit "russian.po"
+ - run bjam
+ - run "main"
diff --git a/src/boost/tools/build/example/gettext/russian.po b/src/boost/tools/build/example/gettext/russian.po
new file mode 100644
index 000000000..daa7121c3
--- /dev/null
+++ b/src/boost/tools/build/example/gettext/russian.po
@@ -0,0 +1,21 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2003-07-01 15:45+0400\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: main.cpp:16
+msgid "hello"
+msgstr "international hello"
diff --git a/src/boost/tools/build/example/hello/hello.cpp b/src/boost/tools/build/example/hello/hello.cpp
new file mode 100644
index 000000000..888e78b1c
--- /dev/null
+++ b/src/boost/tools/build/example/hello/hello.cpp
@@ -0,0 +1,14 @@
+// Copyright (c) 2003 Vladimir Prus
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+// tag::source[]
+#include <iostream>
+
+int main()
+{
+ std::cout << "Hello!\n";
+}
+// end::source[]
diff --git a/src/boost/tools/build/example/hello/jamroot.jam b/src/boost/tools/build/example/hello/jamroot.jam
new file mode 100644
index 000000000..672ec02e9
--- /dev/null
+++ b/src/boost/tools/build/example/hello/jamroot.jam
@@ -0,0 +1 @@
+exe hello : hello.cpp ;
diff --git a/src/boost/tools/build/example/hello/readme.adoc b/src/boost/tools/build/example/hello/readme.adoc
new file mode 100644
index 000000000..d69f074e6
--- /dev/null
+++ b/src/boost/tools/build/example/hello/readme.adoc
@@ -0,0 +1,46 @@
+////
+Copyright 2008 Jurko Gospodnetic
+Copyright 2017 Rene Rivera
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+////
+
+= Hello
+
+This example shows a very basic Boost Build project set up so it compiles a
+single executable from a single source file:
+
+.`hello.cpp`
+[source,cpp]
+----
+include::../../example/hello/hello.cpp[tag=source]
+----
+
+Our `jamroot.jam` is minimal and only specifies one `exe` target for the
+program:
+
+.`jamroot.jam`
+[source,jam]
+----
+include::jamroot.jam[]
+----
+
+Building the example yields:
+
+[source,bash]
+----
+> cd /example/hello
+> b2
+...found 8 targets...
+...updating 4 targets...
+common.mkdir bin/clang-darwin-4.2.1
+common.mkdir bin/clang-darwin-4.2.1/debug
+clang-darwin.compile.c++ bin/clang-darwin-4.2.1/debug/hello.o
+clang-darwin.link bin/clang-darwin-4.2.1/debug/hello
+...updated 4 targets...
+> bin/clang-darwin-4.2.1/debug/hello
+Hello!
+----
+
+NOTE: The actual paths in the `bin` sub-directory will depend on your
+toolset.
diff --git a/src/boost/tools/build/example/libraries/app/app.cpp b/src/boost/tools/build/example/libraries/app/app.cpp
new file mode 100644
index 000000000..5e5d49fc0
--- /dev/null
+++ b/src/boost/tools/build/example/libraries/app/app.cpp
@@ -0,0 +1,12 @@
+// Copyright (c) 2003 Vladimir Prus
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include <lib1.h>
+
+int main()
+{
+ foo();
+}
diff --git a/src/boost/tools/build/example/libraries/app/jamfile.jam b/src/boost/tools/build/example/libraries/app/jamfile.jam
new file mode 100644
index 000000000..f91cd05d0
--- /dev/null
+++ b/src/boost/tools/build/example/libraries/app/jamfile.jam
@@ -0,0 +1,9 @@
+# Copyright 2002, 2003, 2005 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+# Declare a executable file, which uses a library. Note that
+# includes that for library will be automatically used
+# when compiling 'app.cpp'
+exe app : app.cpp /library-example/foo//bar ;
diff --git a/src/boost/tools/build/example/libraries/jamroot.jam b/src/boost/tools/build/example/libraries/jamroot.jam
new file mode 100644
index 000000000..5e0dc4814
--- /dev/null
+++ b/src/boost/tools/build/example/libraries/jamroot.jam
@@ -0,0 +1,4 @@
+
+use-project /library-example/foo : util/foo ;
+
+build-project app ;
diff --git a/src/boost/tools/build/example/libraries/util/foo/bar.cpp b/src/boost/tools/build/example/libraries/util/foo/bar.cpp
new file mode 100644
index 000000000..2d6eb730f
--- /dev/null
+++ b/src/boost/tools/build/example/libraries/util/foo/bar.cpp
@@ -0,0 +1,10 @@
+// Copyright (c) 2003 Vladimir Prus
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+void foo() {}
diff --git a/src/boost/tools/build/example/libraries/util/foo/include/lib1.h b/src/boost/tools/build/example/libraries/util/foo/include/lib1.h
new file mode 100644
index 000000000..9b0f98a5f
--- /dev/null
+++ b/src/boost/tools/build/example/libraries/util/foo/include/lib1.h
@@ -0,0 +1,7 @@
+// Copyright (c) 2003 Vladimir Prus
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+void foo();
diff --git a/src/boost/tools/build/example/libraries/util/foo/jamfile.jam b/src/boost/tools/build/example/libraries/util/foo/jamfile.jam
new file mode 100644
index 000000000..6741b1ca3
--- /dev/null
+++ b/src/boost/tools/build/example/libraries/util/foo/jamfile.jam
@@ -0,0 +1,9 @@
+# Copyright 2005 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+project
+ : usage-requirements <include>include ;
+
+lib bar : bar.cpp ;
diff --git a/src/boost/tools/build/example/make/foo.py b/src/boost/tools/build/example/make/foo.py
new file mode 100644
index 000000000..e4c0b824a
--- /dev/null
+++ b/src/boost/tools/build/example/make/foo.py
@@ -0,0 +1,2 @@
+import sys
+open(sys.argv[2], "w").write(open(sys.argv[1]).read())
diff --git a/src/boost/tools/build/example/make/jamroot.jam b/src/boost/tools/build/example/make/jamroot.jam
new file mode 100644
index 000000000..3f5ec5b56
--- /dev/null
+++ b/src/boost/tools/build/example/make/jamroot.jam
@@ -0,0 +1,22 @@
+import feature ;
+import toolset ;
+import os ;
+
+path-constant HERE : . ;
+make main.cpp : main_cpp.pro : @do-something ;
+
+feature.feature example.python.interpreter : : free ;
+
+toolset.flags do-something PYTHON : <example.python.interpreter> ;
+actions do-something
+{
+ "$(PYTHON:E=python)" "$(HERE)/foo.py" "$(>)" "$(<)"
+}
+
+if [ os.name ] = VMS
+{
+ actions do-something
+ {
+ $(PYTHON:E=python) $(HERE:W)foo.py $(>:W) $(<:W)
+ }
+}
diff --git a/src/boost/tools/build/example/make/main_cpp.pro b/src/boost/tools/build/example/make/main_cpp.pro
new file mode 100644
index 000000000..237c8ce18
--- /dev/null
+++ b/src/boost/tools/build/example/make/main_cpp.pro
@@ -0,0 +1 @@
+int main() {}
diff --git a/src/boost/tools/build/example/make/readme.txt b/src/boost/tools/build/example/make/readme.txt
new file mode 100644
index 000000000..333c55a71
--- /dev/null
+++ b/src/boost/tools/build/example/make/readme.txt
@@ -0,0 +1,7 @@
+Copyright 2002, 2005 Vladimir Prus
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+
+Example of using custom command to create one file from another, using the
+built-in 'make' rule.
diff --git a/src/boost/tools/build/example/named-install-dirs/a b/src/boost/tools/build/example/named-install-dirs/a
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/src/boost/tools/build/example/named-install-dirs/a
diff --git a/src/boost/tools/build/example/named-install-dirs/build.jam b/src/boost/tools/build/example/named-install-dirs/build.jam
new file mode 100644
index 000000000..00fe90128
--- /dev/null
+++ b/src/boost/tools/build/example/named-install-dirs/build.jam
@@ -0,0 +1,54 @@
+# showcasing several default install directories
+install a1 : a : <location>(bindir) ;
+install a2 : a : <location>(libdir)/a2 ;
+install (sbindir)/a3 : a ;
+
+# using a custom prefix; the file will be installed into foo/bar/bin/a4
+install (bindir)/a4 : a : <install-prefix>foo/bar ;
+
+# this one deduces installed package name to be the basename of the project
+# directory, so e.g. on Linux the file will be installed installed into
+# /usr/local/share/doc/<name of project's directory>/a5
+install (docdir)/a5 : a : <install-prefix>bar/baz ;
+
+# use a custom named directory; its default on Linux is /usr/local/share/xyz/
+import stage ;
+stage.add-install-dir foodir : xyz : datadir ;
+install (foodir)/a6 : a ;
+
+
+# another custom named directory, this one appends package name like docdir;
+# so, e.g. on Linux it defaults to /usr/local/lib/named-install-dirs
+stage.add-install-dir privatedir : "" : libdir : package-suffix ;
+install (privatedir)/a7 : a ;
+
+# using stage.get-package-name
+make a8 : a : @write-dirs : <staging-prefix>p/q/r <install-bindir>/bin ;
+
+rule write-dirs ( target : sources * : properties * )
+{
+ import property-set ;
+ import print ;
+ local ps = [ property-set.create $(properties) ] ;
+ local pn = [ stage.get-package-name $(ps) ] ;
+ print.output $(target) ;
+ print.text
+ [ stage.get-dir docdir : $(ps) : $(pn) ]
+ [ stage.get-dir docdir : $(ps) : $(pn) : staged ]
+ [ stage.get-dir docdir : $(ps) : $(pn) : relative ]
+ [ stage.get-dir docdir : $(ps) : $(pn) : relative staged ]
+ [ stage.get-dir bindir : $(ps) : $(pn) : relative ]
+ : overwrite
+ ;
+}
+
+# using staging prefix; on Linux installs into q/r/s/share/a9
+install (datarootdir)/a9 : a : <staging-prefix>q/r/s ;
+
+
+build-project x ;
+
+# Copyright 2020 Dmitry Arkhipov
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or copy at
+# https://www.bfgroup.xyz/b2/LICENSE.txt)
diff --git a/src/boost/tools/build/example/named-install-dirs/x/build.jam b/src/boost/tools/build/example/named-install-dirs/x/build.jam
new file mode 100644
index 000000000..ceb409242
--- /dev/null
+++ b/src/boost/tools/build/example/named-install-dirs/x/build.jam
@@ -0,0 +1,5 @@
+# this subproject showcases installed package name deduction
+
+project subx ;
+build-project y ;
+build-project z ;
diff --git a/src/boost/tools/build/example/named-install-dirs/x/y/build.jam b/src/boost/tools/build/example/named-install-dirs/x/y/build.jam
new file mode 100644
index 000000000..69e52d1dc
--- /dev/null
+++ b/src/boost/tools/build/example/named-install-dirs/x/y/build.jam
@@ -0,0 +1,9 @@
+# this subproject doesn't have a name, so its default package name is deduced
+# from its parent
+
+install (docdir)/y1 : ../../a ;
+
+# Copyright 2020 Dmitry Arkhipov
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or copy at
+# https://www.bfgroup.xyz/b2/LICENSE.txt)
diff --git a/src/boost/tools/build/example/named-install-dirs/x/z/build.jam b/src/boost/tools/build/example/named-install-dirs/x/z/build.jam
new file mode 100644
index 000000000..5eaf76a5a
--- /dev/null
+++ b/src/boost/tools/build/example/named-install-dirs/x/z/build.jam
@@ -0,0 +1,11 @@
+# this subproject does have a name, so its name is used as its default package
+# name
+
+project subz ;
+
+install (docdir)/z1 : ../../a ;
+
+# Copyright 2020 Dmitry Arkhipov
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or copy at
+# https://www.bfgroup.xyz/b2/LICENSE.txt)
diff --git a/src/boost/tools/build/example/pch-multi/include/extra/meta.hpp b/src/boost/tools/build/example/pch-multi/include/extra/meta.hpp
new file mode 100644
index 000000000..6a85b0886
--- /dev/null
+++ b/src/boost/tools/build/example/pch-multi/include/extra/meta.hpp
@@ -0,0 +1,17 @@
+/*
+ Copyright Rene Rivera 2019
+
+ Distributed under the Boost Software License, Version 1.0. (See
+ accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+#ifndef B2_EXAMPLE_PCH_MULTI_EXTRA_META_HPP
+#define B2_EXAMPLE_PCH_MULTI_EXTRA_META_HPP
+
+#include <type_traits>
+#include <functional>
+#include <typeindex>
+#include <tuple>
+
+#endif
diff --git a/src/boost/tools/build/example/pch-multi/include/pch.hpp b/src/boost/tools/build/example/pch-multi/include/pch.hpp
new file mode 100644
index 000000000..8f05cc43d
--- /dev/null
+++ b/src/boost/tools/build/example/pch-multi/include/pch.hpp
@@ -0,0 +1,19 @@
+/* Copyright 2006 Vladimir Prus
+
+ Distributed under the Boost Software License, Version 1.0. (See
+ accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+#ifdef BOOST_BUILD_PCH_ENABLED
+
+#ifdef FOO2
+int bar();
+#endif
+
+class TestClass {
+public:
+ TestClass(int, int) {}
+};
+
+#endif
diff --git a/src/boost/tools/build/example/pch-multi/include/std.hpp b/src/boost/tools/build/example/pch-multi/include/std.hpp
new file mode 100644
index 000000000..89e76bf6a
--- /dev/null
+++ b/src/boost/tools/build/example/pch-multi/include/std.hpp
@@ -0,0 +1,16 @@
+/*
+ Copyright Rene Rivera 2019
+
+ Distributed under the Boost Software License, Version 1.0. (See
+ accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+#ifndef B2_EXAMPLE_PCH_MULTI_STD_HPP
+#define B2_EXAMPLE_PCH_MULTI_STD_HPP
+
+#include <iostream>
+#include <vector>
+#include <algorithm>
+
+#endif
diff --git a/src/boost/tools/build/example/pch-multi/jamroot.jam b/src/boost/tools/build/example/pch-multi/jamroot.jam
new file mode 100644
index 000000000..6af21ff12
--- /dev/null
+++ b/src/boost/tools/build/example/pch-multi/jamroot.jam
@@ -0,0 +1,30 @@
+# Copyright 2006 Ilya Sokolov
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE.txt or copy at
+# https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+# pch ##########################################################################
+
+import pch ;
+
+local pchs ;
+for local hpp in [ glob-tree *.hpp ]
+{
+ cpp-pch $(hpp:B) : $(hpp) : <include>include ;
+ explicit $(hpp:B) ;
+ pchs += $(hpp:B) ;
+}
+alias headers : $(pchs) ;
+
+# exe ##########################################################################
+
+exe hello_world
+ : # sources
+ headers
+ source/hello_world.cpp
+ : # requirements
+ <include>include
+ : # default build
+ : # usage requirements
+ ;
diff --git a/src/boost/tools/build/example/pch-multi/source/hello_world.cpp b/src/boost/tools/build/example/pch-multi/source/hello_world.cpp
new file mode 100644
index 000000000..885208c1a
--- /dev/null
+++ b/src/boost/tools/build/example/pch-multi/source/hello_world.cpp
@@ -0,0 +1,17 @@
+/* Copyright 2006 Ilya Sokolov
+ Copyright 2006 Vladimir Prus
+
+ Distributed under the Boost Software License, Version 1.0. (See
+ accompanying file LICENSE.txt or copy at
+ https://www.bfgroup.xyz/b2/LICENSE.txt)
+*/
+
+#include <pch.hpp>
+#include <std.hpp>
+#include <extra/meta.hpp>
+
+int main()
+{
+ TestClass c(1, 2);
+ return 0;
+}
diff --git a/src/boost/tools/build/example/pch/include/pch.hpp b/src/boost/tools/build/example/pch/include/pch.hpp
new file mode 100644
index 000000000..8f05cc43d
--- /dev/null
+++ b/src/boost/tools/build/example/pch/include/pch.hpp
@@ -0,0 +1,19 @@
+/* Copyright 2006 Vladimir Prus
+
+ Distributed under the Boost Software License, Version 1.0. (See
+ accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+#ifdef BOOST_BUILD_PCH_ENABLED
+
+#ifdef FOO2
+int bar();
+#endif
+
+class TestClass {
+public:
+ TestClass(int, int) {}
+};
+
+#endif
diff --git a/src/boost/tools/build/example/pch/jamroot.jam b/src/boost/tools/build/example/pch/jamroot.jam
new file mode 100644
index 000000000..ad6595567
--- /dev/null
+++ b/src/boost/tools/build/example/pch/jamroot.jam
@@ -0,0 +1,29 @@
+# Copyright 2006 Ilya Sokolov
+#
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE.txt or copy at
+# https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+# pch ##########################################################################
+
+import pch ;
+
+cpp-pch pch
+ : # sources
+ include/pch.hpp
+ : # requirements
+ <include>include
+ ;
+explicit pch ;
+
+# exe ##########################################################################
+
+exe hello_world
+ : # sources
+ pch
+ source/hello_world.cpp
+ : # requirements
+ <include>include
+ : # default build
+ : # usage requirements
+ ;
diff --git a/src/boost/tools/build/example/pch/source/hello_world.cpp b/src/boost/tools/build/example/pch/source/hello_world.cpp
new file mode 100644
index 000000000..db8b91f2d
--- /dev/null
+++ b/src/boost/tools/build/example/pch/source/hello_world.cpp
@@ -0,0 +1,15 @@
+/* Copyright 2006 Ilya Sokolov
+ Copyright 2006 Vladimir Prus
+
+ Distributed under the Boost Software License, Version 1.0. (See
+ accompanying file LICENSE.txt or copy at
+ https://www.bfgroup.xyz/b2/LICENSE.txt)
+*/
+
+#include <pch.hpp>
+
+int main()
+{
+ TestClass c(1, 2);
+ return 0;
+}
diff --git a/src/boost/tools/build/example/pkg-config/debug-packages/debugged.pc b/src/boost/tools/build/example/pkg-config/debug-packages/debugged.pc
new file mode 100644
index 000000000..8b2d744ef
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/debug-packages/debugged.pc
@@ -0,0 +1,4 @@
+Name: debugged
+Version: 0.1
+Description: A package with separate debug version (debug version)
+Cflags: -DVARIANT=\"DEBUG\"
diff --git a/src/boost/tools/build/example/pkg-config/jamroot.jam b/src/boost/tools/build/example/pkg-config/jamroot.jam
new file mode 100644
index 000000000..ca945f9e3
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/jamroot.jam
@@ -0,0 +1,104 @@
+#|
+Copyright 2019 Dmitry Arkhipov
+Distributed under the Boost Software License, Version 1.0. (See
+accompanying file LICENSE.txt or copy at
+https://www.bfgroup.xyz/b2/LICENSE.txt)
+|#
+
+
+using pkg-config : : : <libdir>packages ;
+using pkg-config : debug : : <libdir>packages <path>debug-packages ;
+
+import common ;
+import pkg-config ;
+import property-set ;
+import testing ;
+import version ;
+
+
+project : requirements <variant>debug:<pkg-config>debug ;
+
+
+pkg-config.import debugged ;
+pkg-config.import foobar : requirements <version>>=0.3 ;
+pkg-config.import mangled : requirements <conditional>@mangle-name ;
+
+versioned =
+ [ pkg-config.import versioned
+ : usage-requirements <conditional>@versioned-api
+ ] ;
+
+with-var =
+ [ pkg-config.import with-var
+ : usage-requirements <conditional>@var-to-define
+ ] ;
+
+
+# test if a package is found at all
+run test1.cpp foobar ;
+
+# test if conditional requirement is applied
+run test2.cpp mangled
+ : target-name test2-1
+ : requirements <threading>single
+ : args SINGLE
+ ;
+
+run test2.cpp mangled
+ : target-name test2-2
+ : requirements <threading>multi
+ : args MULTI
+ ;
+
+# test if pkg-config configuration is properly inferred from property set
+run test3.cpp debugged
+ : target-name test3-1
+ : requirements <variant>release
+ : args RELEASE
+ ;
+
+run test3.cpp debugged
+ : target-name test3-2
+ : requirements <variant>debug
+ : args DEBUG
+ ;
+
+# test use of version method of pkg-config targets
+run test4.cpp versioned ;
+
+# test use of variable method of pkg-config targets
+run test5.cpp with-var ;
+
+
+rule mangle-name ( props * ) {
+ import feature ;
+ local name =
+ [ common.format-name
+ <base> <threading>
+ : mangled
+ : ""
+ : [ property-set.create $(props) ]
+ ] ;
+ return <name>$(name) ;
+}
+
+
+rule versioned-api ( props * ) {
+ local ps = [ property-set.create $(props) ] ;
+ local version = [ $(versioned).version $(ps) ] ;
+ if [ version.version-less $(version) : 2 ]
+ {
+ return <define>VERSIONED_API=1 ;
+ }
+ else
+ {
+ return <define>VERSIONED_API=2 ;
+ }
+}
+
+
+rule var-to-define ( props * ) {
+ local ps = [ property-set.create $(props) ] ;
+ local qwerty = [ $(with-var).variable qwerty : $(ps) ] ;
+ return <define>QWERTY=\\\"$(qwerty)\\\" ;
+}
diff --git a/src/boost/tools/build/example/pkg-config/packages/debugged.pc b/src/boost/tools/build/example/pkg-config/packages/debugged.pc
new file mode 100644
index 000000000..b22e10d8b
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/packages/debugged.pc
@@ -0,0 +1,4 @@
+Name: debugged
+Version: 0.1
+Description: A package with separate debug version (release version)
+Cflags: -DVARIANT=\"RELEASE\"
diff --git a/src/boost/tools/build/example/pkg-config/packages/foobar.pc b/src/boost/tools/build/example/pkg-config/packages/foobar.pc
new file mode 100644
index 000000000..f62cfc820
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/packages/foobar.pc
@@ -0,0 +1,4 @@
+Name: foobar
+Version: 0.3
+Description: The bar for your foo
+Cflags: -DQWERTY=\"uiop\"
diff --git a/src/boost/tools/build/example/pkg-config/packages/mangled-mt.pc b/src/boost/tools/build/example/pkg-config/packages/mangled-mt.pc
new file mode 100644
index 000000000..107b4d3d3
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/packages/mangled-mt.pc
@@ -0,0 +1,4 @@
+Name: mangled
+Version: 0.1
+Description: A package with mangled name (multi-threaded version)
+Cflags: -DTHREADING=\"MULTI\"
diff --git a/src/boost/tools/build/example/pkg-config/packages/mangled.pc b/src/boost/tools/build/example/pkg-config/packages/mangled.pc
new file mode 100644
index 000000000..76976ecc1
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/packages/mangled.pc
@@ -0,0 +1,4 @@
+Name: mangled
+Version: 0.1
+Description: A package with mangled name (single-threaded version)
+Cflags: -DTHREADING=\"SINGLE\"
diff --git a/src/boost/tools/build/example/pkg-config/packages/versioned.pc b/src/boost/tools/build/example/pkg-config/packages/versioned.pc
new file mode 100644
index 000000000..701f35146
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/packages/versioned.pc
@@ -0,0 +1,3 @@
+Name: versioned
+Version: 4.2
+Description: A package with versioned API
diff --git a/src/boost/tools/build/example/pkg-config/packages/with-var.pc b/src/boost/tools/build/example/pkg-config/packages/with-var.pc
new file mode 100644
index 000000000..4b3e2e558
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/packages/with-var.pc
@@ -0,0 +1,4 @@
+qwerty=UIOP
+Name: with-var
+Version: 0.1
+Description: A package that defines a custom variable
diff --git a/src/boost/tools/build/example/pkg-config/test1.cpp b/src/boost/tools/build/example/pkg-config/test1.cpp
new file mode 100644
index 000000000..c554928c0
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/test1.cpp
@@ -0,0 +1,11 @@
+// Copyright 2019 Dmitry Arkhipov
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+#include <string>
+
+int main() {
+ return QWERTY == std::string("uiop") ? EXIT_SUCCESS : EXIT_FAILURE ;
+}
diff --git a/src/boost/tools/build/example/pkg-config/test2.cpp b/src/boost/tools/build/example/pkg-config/test2.cpp
new file mode 100644
index 000000000..d8a987f0d
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/test2.cpp
@@ -0,0 +1,12 @@
+// Copyright 2019 Dmitry Arkhipov
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+#include <string>
+#include <iostream>
+
+int main(int, char const** argv) {
+ return THREADING == std::string(argv[1]) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/src/boost/tools/build/example/pkg-config/test3.cpp b/src/boost/tools/build/example/pkg-config/test3.cpp
new file mode 100644
index 000000000..e161cd00f
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/test3.cpp
@@ -0,0 +1,12 @@
+// Copyright 2019 Dmitry Arkhipov
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+#include <string>
+#include <iostream>
+
+int main(int, char const** argv) {
+ return VARIANT == std::string(argv[1]) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/src/boost/tools/build/example/pkg-config/test4.cpp b/src/boost/tools/build/example/pkg-config/test4.cpp
new file mode 100644
index 000000000..c8828b7f6
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/test4.cpp
@@ -0,0 +1,11 @@
+// Copyright 2019 Dmitry Arkhipov
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+#if VERSIONED_API < 2
+# error "API is too old"
+#endif
+
+int main() {}
diff --git a/src/boost/tools/build/example/pkg-config/test5.cpp b/src/boost/tools/build/example/pkg-config/test5.cpp
new file mode 100644
index 000000000..7b7f974d2
--- /dev/null
+++ b/src/boost/tools/build/example/pkg-config/test5.cpp
@@ -0,0 +1,12 @@
+// Copyright 2019 Dmitry Arkhipov
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+#include <string>
+#include <iostream>
+
+int main(int, char const** argv) {
+ return QWERTY == std::string("UIOP") ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/src/boost/tools/build/example/python_modules/jamroot.jam b/src/boost/tools/build/example/python_modules/jamroot.jam
new file mode 100644
index 000000000..29972a480
--- /dev/null
+++ b/src/boost/tools/build/example/python_modules/jamroot.jam
@@ -0,0 +1,8 @@
+# Copyright 2006 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+import python_helpers ;
+
+ECHO "test1:" [ python_helpers.test1 ] ;
+ECHO "test2:" [ python_helpers.test2 1234 : 5678 ] ;
diff --git a/src/boost/tools/build/example/python_modules/python_helpers.jam b/src/boost/tools/build/example/python_modules/python_helpers.jam
new file mode 100644
index 000000000..5519515f2
--- /dev/null
+++ b/src/boost/tools/build/example/python_modules/python_helpers.jam
@@ -0,0 +1,15 @@
+# Copyright 2006 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+import modules ;
+local here = [ modules.binding $(__name__) ] ;
+here = $(here:D) ;
+modules.poke : EXTRA_PYTHONPATH : $(here) ;
+
+# Import the Python rules to B2
+PYTHON_IMPORT_RULE python_helpers : test1 : python_helpers : test1 ;
+PYTHON_IMPORT_RULE python_helpers : test2 : python_helpers : test2 ;
+
+# Make the new rules accessible to everybody who imports us.
+EXPORT python_helpers : test1 test2 ;
diff --git a/src/boost/tools/build/example/python_modules/python_helpers.py b/src/boost/tools/build/example/python_modules/python_helpers.py
new file mode 100644
index 000000000..6fccd7e8c
--- /dev/null
+++ b/src/boost/tools/build/example/python_modules/python_helpers.py
@@ -0,0 +1,18 @@
+# Copyright 2006 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+# Declare a couple of functions called from B2
+#
+# Each function will receive as many arguments as there ":"-separated
+# arguments in bjam call. Each argument is a list of strings.
+# As a special exception (aka bug), if no arguments are passed in bjam,
+# Python function will be passed a single empty list.
+#
+# All Python functions must return a list of strings, which may be empty.
+
+def test1(l):
+ return ["foo", "bar"]
+
+def test2(l, l2):
+ return [l[0], l2[0]] \ No newline at end of file
diff --git a/src/boost/tools/build/example/python_modules/readme.txt b/src/boost/tools/build/example/python_modules/readme.txt
new file mode 100644
index 000000000..76b219117
--- /dev/null
+++ b/src/boost/tools/build/example/python_modules/readme.txt
@@ -0,0 +1,16 @@
+Copyright 2006 Vladimir Prus
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+
+This example shows how you can use Python modules from B2.
+
+In order to do this, you need to build bjam with Python support, by running:
+
+ ./build.sh --with-python=/usr
+
+in the jam/src directory (replace /usr with the root of your Python
+installation).
+
+The integration between Python and bjam is very basic now, but enough to be
+useful.
diff --git a/src/boost/tools/build/example/qt/README.txt b/src/boost/tools/build/example/qt/README.txt
new file mode 100644
index 000000000..d6977b584
--- /dev/null
+++ b/src/boost/tools/build/example/qt/README.txt
@@ -0,0 +1,20 @@
+Copyright 2005 Vladimir Prus
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+
+This directory contains B2 examples for the Qt library
+(http://www.trolltech.com/products/qt/index.html).
+
+The current examples are:
+ 1. Basic setup -- application with several sources and moccable header.
+ 2. Using of .ui source file.
+ 3. Running .cpp files via the moc tool.
+
+For convenience, there are examples both for 3.* and 4.* version of Qt, they are
+mostly identical and differ only in source code.
+
+All examples assumes that you just installed B2 and that QTDIR
+environment variables is set (typical values can be /usr/share/qt3 and
+/usr/share/qt4). After adding "using qt ..." to your user-config.jam, you would
+have to remove "using qt ; " statements from example Jamroot files.
diff --git a/src/boost/tools/build/example/qt/qt3/hello/canvas.cpp b/src/boost/tools/build/example/qt/qt3/hello/canvas.cpp
new file mode 100644
index 000000000..823e827a4
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt3/hello/canvas.cpp
@@ -0,0 +1,73 @@
+// Copyright Vladimir Prus 2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include "canvas.h"
+
+#include <qlabel.h>
+#include <qcanvas.h>
+#include <qlayout.h>
+
+Canvas::Canvas(QWidget* parent)
+: QWidget(parent)
+{
+ m_pen = QPen(QColor(255, 128, 128));
+ m_brushes = new QBrush[2];
+ m_brushes[0] = QBrush(QColor(255, 0, 0));
+ m_brushes[1] = QBrush(QColor(0, 255, 0));
+ m_current_brush = 0;
+
+ m_canvas = new QCanvas(this);
+ m_canvas->resize(4*1600, 600);
+
+ redraw();
+
+ QVBoxLayout* l = new QVBoxLayout(this);
+
+ m_canvas_view = new QCanvasView(m_canvas, this);
+ l->addWidget(m_canvas_view);
+ m_canvas_view->resize(rect().size());
+ m_canvas_view->show();
+}
+
+Canvas::~Canvas()
+{
+ delete m_brushes;
+}
+
+void Canvas::redraw()
+{
+ QCanvasItemList l = m_canvas->allItems();
+ for(QCanvasItemList::iterator i = l.begin(),
+ e = l.end(); i != e; ++i)
+ {
+ delete *i;
+ }
+
+ unsigned count = 0;
+ for (unsigned x = 10; x < 4*1600; x += 20)
+ for (unsigned y = 10; y < 600; y += 20) {
+ QCanvasRectangle* r = new QCanvasRectangle(x, y, 10, 10, m_canvas);
+ r->setPen(m_pen);
+ r->setBrush(m_brushes[m_current_brush]);
+ r->show();
+ ++count;
+ QCanvasText* t = new QCanvasText("D", m_canvas);
+ t->move(x, y);
+ t->show();
+ ++count;
+ }
+
+ (new QCanvasText(QString::number(count), m_canvas))->show();
+ m_canvas->setAllChanged();
+
+}
+
+void Canvas::change_color()
+{
+ m_current_brush = (m_current_brush + 1)%2;
+ redraw();
+ m_canvas->update();
+}
+
diff --git a/src/boost/tools/build/example/qt/qt3/hello/canvas.h b/src/boost/tools/build/example/qt/qt3/hello/canvas.h
new file mode 100644
index 000000000..865fc6549
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt3/hello/canvas.h
@@ -0,0 +1,35 @@
+// Copyright Vladimir Prus 2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+#ifndef CANVAS_VP_2004_08_31
+#define CANVAS_VP_2004_08_31
+
+#include <qmainwindow.h>
+#include <qpen.h>
+#include <qbrush.h>
+
+class Canvas : public QWidget
+{
+ Q_OBJECT
+public:
+ Canvas(QWidget* parent);
+
+ virtual ~Canvas();
+
+public slots:
+ void change_color();
+
+private:
+ void redraw();
+ class QCanvas* m_canvas;
+ class QCanvasView* m_canvas_view;
+ class QPen m_pen;
+ class QBrush* m_brushes;
+ int m_current_brush;
+};
+
+#endif
+
diff --git a/src/boost/tools/build/example/qt/qt3/hello/jamroot.jam b/src/boost/tools/build/example/qt/qt3/hello/jamroot.jam
new file mode 100644
index 000000000..09b3fef0c
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt3/hello/jamroot.jam
@@ -0,0 +1,13 @@
+# Copyright Vladimir Prus 2004.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt
+# or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+using qt ;
+
+project
+ # built MT version, unless asked otherwise.
+ : default-build <threading>multi
+ ;
+
+exe canvas : main.cpp canvas.cpp canvas.h : <library>/qt//qt ; \ No newline at end of file
diff --git a/src/boost/tools/build/example/qt/qt3/hello/main.cpp b/src/boost/tools/build/example/qt/qt3/hello/main.cpp
new file mode 100644
index 000000000..0f1c8c3f9
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt3/hello/main.cpp
@@ -0,0 +1,36 @@
+// Copyright Vladimir Prus 2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include "canvas.h"
+#include <qapplication.h>
+#include <qvbox.h>
+#include <qpushbutton.h>
+
+class Window : public QMainWindow
+{
+public:
+ Window()
+ {
+ setCaption("QCanvas test");
+ QVBox* vb = new QVBox(this);
+ setCentralWidget(vb);
+
+ Canvas* c = new Canvas(vb);
+ QPushButton* b = new QPushButton("Change color", vb);
+ connect(b, SIGNAL(clicked()), c, SLOT(change_color()));
+ }
+};
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ Window *w = new Window();
+
+ app.setMainWidget(w);
+ w->show();
+
+ return app.exec();
+}
+
diff --git a/src/boost/tools/build/example/qt/qt3/moccable-cpp/jamroot.jam b/src/boost/tools/build/example/qt/qt3/moccable-cpp/jamroot.jam
new file mode 100644
index 000000000..85778da20
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt3/moccable-cpp/jamroot.jam
@@ -0,0 +1,11 @@
+
+using qt ;
+import cast ;
+
+project
+ : default-build <threading>multi
+ ;
+
+exe main : main.cpp [ cast _ moccable-cpp : main.cpp ]
+ /qt//qt
+ ;
diff --git a/src/boost/tools/build/example/qt/qt3/moccable-cpp/main.cpp b/src/boost/tools/build/example/qt/qt3/moccable-cpp/main.cpp
new file mode 100644
index 000000000..63533ba58
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt3/moccable-cpp/main.cpp
@@ -0,0 +1,41 @@
+// Copyright Vladimir Prus 2005.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+
+#include <qwidget.h>
+#include <qpushbutton.h>
+#include <qapplication.h>
+
+#include <iostream>
+
+class My_widget : public QWidget
+{
+ Q_OBJECT
+public:
+ My_widget() : QWidget()
+ {
+ QPushButton* b = new QPushButton("Push me", this);
+
+ connect(b, SIGNAL(clicked()), this, SLOT(theSlot()));
+ }
+
+private slots:
+ void theSlot()
+ {
+ std::cout << "Clicked\n";
+ }
+
+};
+
+int main(int ac, char* av[])
+{
+ QApplication app(ac, av);
+ My_widget mw;
+ mw.show();
+ app.setMainWidget(&mw);
+ app.exec();
+}
+
+#include "main.moc"
diff --git a/src/boost/tools/build/example/qt/qt3/uic/hello_world_widget.ui b/src/boost/tools/build/example/qt/qt3/uic/hello_world_widget.ui
new file mode 100644
index 000000000..26cc73487
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt3/uic/hello_world_widget.ui
@@ -0,0 +1,58 @@
+<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
+<class>HelloWorldWidget</class>
+<comment>
+<!--
+ Copyright Felix E. Klee, 2003
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt
+ or copy at http://www.boost.org/LICENSE_1_0.txt)
+-->
+</comment>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>HelloWorldWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>124</width>
+ <height>63</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Hello World!</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>11</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Hello World!</string>
+ </property>
+ <property name="alignment">
+ <set>AlignCenter</set>
+ </property>
+ </widget>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>OkButton</cstring>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/src/boost/tools/build/example/qt/qt3/uic/jamroot.jam b/src/boost/tools/build/example/qt/qt3/uic/jamroot.jam
new file mode 100644
index 000000000..d53df7a58
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt3/uic/jamroot.jam
@@ -0,0 +1,15 @@
+# Copyright Felix E. Klee, 2003
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt
+# or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+# Tell that QT should be used. QTDIR will give installation
+# prefix.
+using qt ;
+
+project
+ : default-build <threading>multi
+ ;
+
+exe hello : main.cpp hello_world_widget.ui : <library>/qt//qt ;
+
diff --git a/src/boost/tools/build/example/qt/qt3/uic/main.cpp b/src/boost/tools/build/example/qt/qt3/uic/main.cpp
new file mode 100644
index 000000000..c48605574
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt3/uic/main.cpp
@@ -0,0 +1,18 @@
+// Copyright Felix E. Klee, 2003
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include "hello_world_widget.h"
+#include <qapplication.h>
+
+#include <qpushbutton.h>
+
+int main(int argc, char **argv) {
+ QApplication a(argc, argv);
+ HelloWorldWidget w;
+ QObject::connect(static_cast<QObject*>(w.OkButton), SIGNAL(clicked()), &w, SLOT(close()));
+ a.setMainWidget(&w);
+ w.show();
+ return a.exec();
+}
diff --git a/src/boost/tools/build/example/qt/qt4/hello/arrow.cpp b/src/boost/tools/build/example/qt/qt4/hello/arrow.cpp
new file mode 100644
index 000000000..5f36ed5a8
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt4/hello/arrow.cpp
@@ -0,0 +1,158 @@
+// Copyright Vladimir Prus 2005.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include "arrow.h"
+
+#include <QtGui/qapplication.h>
+
+#include <QtGui/qwidget.h>
+#include <QtGui/qpainter.h>
+#include <QtGui/qpainterpath.h>
+
+#include <stdlib.h>
+#include <math.h>
+
+Arrow_widget::Arrow_widget(QWidget* parent) : QWidget(parent), color_(0)
+{
+ QPalette pal = palette();
+ pal.setBrush(backgroundRole(), QBrush(Qt::white));
+ setPalette(pal);
+}
+
+void Arrow_widget::slotChangeColor()
+{
+ color_ = (color_ + 1) % 3;
+ update();
+}
+
+void
+Arrow_widget::draw_arrow(int x1, int y1, int x2, int y2, QPainter& painter)
+{
+ // The length of the from the tip of the arrow to the point
+ // where line starts.
+ const int arrowhead_length = 16;
+
+ QPainterPath arrow;
+ arrow.moveTo(x1, y1);
+
+ // Determine the angle of the straight line.
+ double a1 = (x2-x1);
+ double a2 = (y2-y1);
+ double b1 = 1;
+ double b2 = 0;
+
+ double straight_length = sqrt(a1*a1 + a2*a2);
+
+ double dot_product = a1*b1 + a2*b2;
+ double cosine = dot_product/
+ (sqrt(pow(a1, 2) + pow(a2, 2))*sqrt(b1 + b2));
+ double angle = acos(cosine);
+ if (y1 < y2)
+ {
+ angle = -angle;
+ }
+ double straight_angle = angle*180/M_PI;
+
+ double limit = 10;
+
+ double angle_to_vertical;
+ if (fabs(straight_angle) < 90)
+ angle_to_vertical = fabs(straight_angle);
+ else if (straight_angle > 0)
+ angle_to_vertical = 180-straight_angle;
+ else
+ angle_to_vertical = 180-(-straight_angle);
+
+ double angle_delta = 0;
+ if (angle_to_vertical > limit)
+ angle_delta = 30 * (angle_to_vertical - limit)/90;
+ double start_angle = straight_angle > 0
+ ? straight_angle - angle_delta :
+ straight_angle + angle_delta;
+
+
+ QMatrix m1;
+ m1.translate(x1, y1);
+ m1.rotate(-start_angle);
+
+ double end_angle = straight_angle > 0
+ ? (straight_angle + 180 + angle_delta) :
+ (straight_angle + 180 - angle_delta);
+
+ QMatrix m2;
+ m2.reset();
+ m2.translate(x2, y2);
+ m2.rotate(-end_angle);
+
+ arrow.cubicTo(m1.map(QPointF(straight_length/2, 0)),
+ m2.map(QPointF(straight_length/2, 0)),
+ m2.map(QPointF(arrowhead_length, 0)));
+
+ painter.save();
+ painter.setBrush(Qt::NoBrush);
+ painter.drawPath(arrow);
+ painter.restore();
+
+ painter.save();
+ painter.translate(x2, y2);
+
+ painter.rotate(-90);
+ painter.rotate(-end_angle);
+ painter.rotate(180);
+
+ QPolygon arrowhead(4);
+ arrowhead.setPoint(0, 0, 0);
+ arrowhead.setPoint(1, arrowhead_length/3, -arrowhead_length*5/4);
+ arrowhead.setPoint(2, 0, -arrowhead_length);
+ arrowhead.setPoint(3, -arrowhead_length/3, -arrowhead_length*5/4);
+
+ painter.drawPolygon(arrowhead);
+
+ painter.restore();
+
+}
+
+
+void Arrow_widget::paintEvent(QPaintEvent*)
+{
+ QPainter p(this);
+
+ p.setRenderHint(QPainter::Antialiasing);
+
+ int base_x = 550;
+ int base_y = 200;
+
+ if (color_ == 0)
+ p.setBrush(Qt::black);
+ else if (color_ == 1)
+ p.setBrush(Qt::green);
+ else if (color_ == 2)
+ p.setBrush(Qt::yellow);
+ else
+ p.setBrush(Qt::black);
+
+ for (int x_step = 0; x_step < 6; ++x_step)
+ {
+ for (int y_step = 1; y_step <= 3; ++y_step)
+ {
+ draw_arrow(base_x, base_y, base_x+x_step*100,
+ base_y - y_step*50, p);
+
+ draw_arrow(base_x, base_y, base_x+x_step*100,
+ base_y + y_step*50, p);
+
+ draw_arrow(base_x, base_y, base_x-x_step*100,
+ base_y + y_step*50, p);
+
+ draw_arrow(base_x, base_y, base_x-x_step*100,
+ base_y - y_step*50, p);
+ }
+ }
+
+ draw_arrow(50, 400, 1000, 450, p);
+ draw_arrow(1000, 400, 50, 450, p);
+
+}
+
diff --git a/src/boost/tools/build/example/qt/qt4/hello/arrow.h b/src/boost/tools/build/example/qt/qt4/hello/arrow.h
new file mode 100644
index 000000000..8375d13c9
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt4/hello/arrow.h
@@ -0,0 +1,30 @@
+// Copyright Vladimir Prus 2005.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include <QtGui/qapplication.h>
+
+#include <QtGui/qwidget.h>
+#include <QtGui/qpainter.h>
+#include <QtGui/qpainterpath.h>
+
+#include <stdlib.h>
+#include <math.h>
+
+class Arrow_widget : public QWidget
+{
+ Q_OBJECT
+public:
+ Arrow_widget(QWidget* parent = 0);
+
+public slots:
+ void slotChangeColor();
+
+private:
+ void draw_arrow(int x1, int y1, int x2, int y2, QPainter& painter);
+ void paintEvent(QPaintEvent*);
+
+private:
+ int color_;
+};
diff --git a/src/boost/tools/build/example/qt/qt4/hello/jamroot.jam b/src/boost/tools/build/example/qt/qt4/hello/jamroot.jam
new file mode 100644
index 000000000..83952f17b
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt4/hello/jamroot.jam
@@ -0,0 +1,14 @@
+
+import qt4 ;
+
+if ! [ qt4.initialized ]
+{
+ ECHO "Warning: Qt4 not initialized in user-config.jam" ;
+ ECHO "Assuming /space/p2/ghost/build/Qt4 as location." ;
+ ECHO "This is very likely won't work for you. " ;
+ using qt4 : /space/p2/ghost/build/Qt4 ;
+}
+
+project : requirements <threading>multi ;
+
+exe arrow : main.cpp arrow.cpp arrow.h /qt//QtGui ; \ No newline at end of file
diff --git a/src/boost/tools/build/example/qt/qt4/hello/main.cpp b/src/boost/tools/build/example/qt/qt4/hello/main.cpp
new file mode 100644
index 000000000..bf4913666
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt4/hello/main.cpp
@@ -0,0 +1,27 @@
+// Copyright Vladimir Prus 2005.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include "arrow.h"
+
+#include <QApplication>
+#include <QTimer>
+
+int main(int ac, char* av[])
+{
+ QApplication app(ac, av);
+ Arrow_widget* w = new Arrow_widget;
+ w->resize(1100, 480);
+
+ QTimer timer;
+ QObject::connect(&timer, SIGNAL(timeout()),
+ w, SLOT(slotChangeColor()));
+
+ timer.start(2000);
+
+ w->show();
+ app.exec();
+ return 0;
+}
+
diff --git a/src/boost/tools/build/example/qt/qt4/moccable-cpp/jamroot.jam b/src/boost/tools/build/example/qt/qt4/moccable-cpp/jamroot.jam
new file mode 100644
index 000000000..d07b9c7d3
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt4/moccable-cpp/jamroot.jam
@@ -0,0 +1,18 @@
+
+import qt4 ;
+if ! [ qt4.initialized ]
+{
+ ECHO "Warning: Qt4 not initialized in user-config.jam" ;
+ ECHO "Assuming /space/p2/ghost/build/Qt4 as location." ;
+ ECHO "This is very likely won't work for you. " ;
+ using qt4 : /space/p2/ghost/build/Qt4 ;
+}
+
+import cast ;
+exe main : main.cpp
+ [ cast _ moccable-cpp : main.cpp ]
+ /qt//QtGui
+ : <threading>multi
+ ;
+
+
diff --git a/src/boost/tools/build/example/qt/qt4/moccable-cpp/main.cpp b/src/boost/tools/build/example/qt/qt4/moccable-cpp/main.cpp
new file mode 100644
index 000000000..f8d4a43e2
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt4/moccable-cpp/main.cpp
@@ -0,0 +1,39 @@
+// Copyright Vladimir Prus 2005.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include <qwidget.h>
+#include <qpushbutton.h>
+#include <qapplication.h>
+
+#include <iostream>
+
+class My_widget : public QWidget
+{
+ Q_OBJECT
+public:
+ My_widget() : QWidget()
+ {
+ QPushButton* b = new QPushButton("Push me", this);
+
+ connect(b, SIGNAL(clicked()), this, SLOT(theSlot()));
+ }
+
+private slots:
+ void theSlot()
+ {
+ std::cout << "Clicked\n";
+ }
+
+};
+
+int main(int ac, char* av[])
+{
+ QApplication app(ac, av);
+ My_widget mw;
+ mw.show();
+ app.exec();
+}
+
+#include "main.moc"
diff --git a/src/boost/tools/build/example/qt/qt4/uic/hello_world_widget.ui b/src/boost/tools/build/example/qt/qt4/uic/hello_world_widget.ui
new file mode 100644
index 000000000..67060b336
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt4/uic/hello_world_widget.ui
@@ -0,0 +1,55 @@
+<ui version="4.0" >
+ <author></author>
+ <comment>
+<!--
+ Copyright Felix E. Klee, 2003
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt
+ or copy at http://www.boost.org/LICENSE_1_0.txt)
+-->
+ </comment>
+ <exportmacro></exportmacro>
+ <class>HelloWorldWidget</class>
+ <widget class="QWidget" name="HelloWorldWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>124</width>
+ <height>63</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Hello World!</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>11</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="TextLabel2" >
+ <property name="text" >
+ <string>Hello World!</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="OkButton" >
+ <property name="text" >
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/boost/tools/build/example/qt/qt4/uic/jamroot.jam b/src/boost/tools/build/example/qt/qt4/uic/jamroot.jam
new file mode 100644
index 000000000..5af938c95
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt4/uic/jamroot.jam
@@ -0,0 +1,18 @@
+# Copyright Felix E. Klee, 2003
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt
+# or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+import qt4 ;
+if ! [ qt4.initialized ]
+{
+ ECHO "Warning: Qt4 not initialized in user-config.jam" ;
+ ECHO "Assuming /space/p2/ghost/build/Qt4 as location." ;
+ ECHO "This is very likely won't work for you. " ;
+ using qt4 : /space/p2/ghost/build/Qt4 ;
+}
+
+project : requirements <threading>multi
+ ;
+
+exe hello : main.cpp hello_world_widget.ui : <library>/qt//QtGui ;
diff --git a/src/boost/tools/build/example/qt/qt4/uic/main.cpp b/src/boost/tools/build/example/qt/qt4/uic/main.cpp
new file mode 100644
index 000000000..6b217ec19
--- /dev/null
+++ b/src/boost/tools/build/example/qt/qt4/uic/main.cpp
@@ -0,0 +1,23 @@
+// Copyright Felix E. Klee, 2003
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include "ui_hello_world_widget.h"
+#include <qapplication.h>
+#include <qwidget.h>
+
+#include <qpushbutton.h>
+
+int main(int argc, char **argv) {
+ QApplication a(argc, argv);
+
+ QWidget w;
+ Ui::HelloWorldWidget wm;
+ wm.setupUi(&w);
+
+ QObject::connect(wm.OkButton, SIGNAL(clicked()), &w, SLOT(close()));
+
+ w.show();
+ return a.exec();
+}
diff --git a/src/boost/tools/build/example/sanitizers/jamroot.jam b/src/boost/tools/build/example/sanitizers/jamroot.jam
new file mode 100644
index 000000000..4b3bda916
--- /dev/null
+++ b/src/boost/tools/build/example/sanitizers/jamroot.jam
@@ -0,0 +1 @@
+exe main : main.cpp ;
diff --git a/src/boost/tools/build/example/sanitizers/main.cpp b/src/boost/tools/build/example/sanitizers/main.cpp
new file mode 100644
index 000000000..62e6f3b60
--- /dev/null
+++ b/src/boost/tools/build/example/sanitizers/main.cpp
@@ -0,0 +1,9 @@
+#include <iostream>
+
+// tag::source[]
+int main()
+{
+ char* c = nullptr;
+ std::cout << "Hello sanitizers\n " << *c;
+}
+// end::source[]
diff --git a/src/boost/tools/build/example/sanitizers/readme.adoc b/src/boost/tools/build/example/sanitizers/readme.adoc
new file mode 100644
index 000000000..efcc8c3a9
--- /dev/null
+++ b/src/boost/tools/build/example/sanitizers/readme.adoc
@@ -0,0 +1,64 @@
+////
+Copyright 2019 Damian Jarek
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+////
+
+= Sanitizers
+
+This example shows how to enable sanitizers when using a clang or gcc toolset
+
+.`main.cpp`
+[source,cpp]
+----
+include::../../example/sanitizers/main.cpp[tag=source]
+----
+
+Our `jamroot.jam` is minimal and only specifies one `exe` target for the
+program:
+
+.`jamroot.jam`
+[source,jam]
+----
+include::jamroot.jam[]
+----
+
+Sanitizers can be enabled by passing `on` or `norecover` to the appropriate sanitizer feature
+(e.g. `thread-sanitizer=on`). The `norecover` option causes the program to terminate after
+the first sanitizer issue is detected. The following example shows how to enable `address` and `undefined`
+sanitizers in a simple program:
+
+[source,bash]
+----
+> cd /example/sanitizers
+> b2 toolset=gcc address-sanitizer=norecover undefined-sanitizer=on
+...found 10 targets...
+...updating 7 targets...
+gcc.compile.c++ bin/gcc-7.3.0/debug/address-sanitizer-norecover/undefined-sanitizer-on/main.o
+gcc.link bin/gcc-7.3.0/debug/address-sanitizer-norecover/undefined-sanitizer-on/main
+...updated 7 targets...
+----
+
+Running the produced program may produce an output simillar to the following:
+
+[source,bash]
+----
+> ./bin/gcc-7.3.0/debug/address-sanitizer-norecover/undefined-sanitizer-on/main
+Hello sanitizers
+main.cpp:6:43: runtime error: load of null pointer of type 'char'
+ASAN:DEADLYSIGNAL
+=================================================================
+==29767==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x55ba7988af1b bp 0x7ffdf3d76560 sp 0x7ffdf3d76530 T0)
+==29767==The signal is caused by a READ memory access.
+==29767==Hint: address points to the zero page.
+ #0 0x55ba7988af1a in main /home/damian/projects/boost/tools/build/example/sanitizers/main.cpp:6
+ #1 0x7f42f2ba1b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
+ #2 0x55ba7988adb9 in _start (/home/damian/projects/boost/tools/build/example/sanitizers/bin/gcc-7.3.0/debug/address-sanitizer-norecover/undefined-sanitizer-on/main+0xdb9)
+
+AddressSanitizer can not provide additional info.
+SUMMARY: AddressSanitizer: SEGV /home/damian/projects/boost/tools/build/example/sanitizers/main.cpp:6 in main
+==29767==ABORTING
+----
+
+NOTE: The actual paths in the `bin` sub-directory will depend on your
+toolset and configuration. The presented output may vary depending on your compiler version.
diff --git a/src/boost/tools/build/example/sass/importing.scss b/src/boost/tools/build/example/sass/importing.scss
new file mode 100644
index 000000000..0c3586afc
--- /dev/null
+++ b/src/boost/tools/build/example/sass/importing.scss
@@ -0,0 +1,3 @@
+@import "foobar";
+
+body { color: red; }
diff --git a/src/boost/tools/build/example/sass/include/foobar.scss b/src/boost/tools/build/example/sass/include/foobar.scss
new file mode 100644
index 000000000..2c77cef1f
--- /dev/null
+++ b/src/boost/tools/build/example/sass/include/foobar.scss
@@ -0,0 +1,3 @@
+body {
+ border: { color: red; }
+}
diff --git a/src/boost/tools/build/example/sass/jamroot.jam b/src/boost/tools/build/example/sass/jamroot.jam
new file mode 100644
index 000000000..837477225
--- /dev/null
+++ b/src/boost/tools/build/example/sass/jamroot.jam
@@ -0,0 +1,15 @@
+#|
+Copyright 2017 Dmitry Arkhipov
+Distributed under the Boost Software License, Version 1.0. (See
+accompanying file LICENSE.txt or copy at
+https://www.bfgroup.xyz/b2/LICENSE.txt)
+|#
+
+css stylesheet1 : singleton.scss : <flags>"--precision 1" ;
+css stylesheet2 : singleton.sass ;
+css stylesheet3 : importing.scss : <include>include ;
+css stylesheet4
+ : singleton.scss
+ : <sass-style>expanded
+ <sass-line-numbers>off
+ ;
diff --git a/src/boost/tools/build/example/sass/singleton.sass b/src/boost/tools/build/example/sass/singleton.sass
new file mode 100644
index 000000000..455fefdd1
--- /dev/null
+++ b/src/boost/tools/build/example/sass/singleton.sass
@@ -0,0 +1,12 @@
+body
+ p
+ line-height: 1.5em
+
+ span
+ font-weight: 700
+ a
+ text-decoration: none
+
+ &:hover
+ text-decoration: underline
+ font-size: (10px/3)
diff --git a/src/boost/tools/build/example/sass/singleton.scss b/src/boost/tools/build/example/sass/singleton.scss
new file mode 100644
index 000000000..afe15e9c4
--- /dev/null
+++ b/src/boost/tools/build/example/sass/singleton.scss
@@ -0,0 +1,11 @@
+body {
+ p { line-height: 1.5em; }
+ span { font-weight: 700; }
+ a {
+ text-decoration: none;
+ &:hover {
+ text-decoration: underline;
+ font-size: (10px/3);
+ }
+ }
+}
diff --git a/src/boost/tools/build/example/site-config.jam b/src/boost/tools/build/example/site-config.jam
new file mode 100644
index 000000000..2bf5e5700
--- /dev/null
+++ b/src/boost/tools/build/example/site-config.jam
@@ -0,0 +1,4 @@
+# Copyright 2002, 2003 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
diff --git a/src/boost/tools/build/example/testing/compile-fail.cpp b/src/boost/tools/build/example/testing/compile-fail.cpp
new file mode 100644
index 000000000..aa07d4e67
--- /dev/null
+++ b/src/boost/tools/build/example/testing/compile-fail.cpp
@@ -0,0 +1,14 @@
+// Copyright (c) 2014 Rene Rivera
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include <iostream>
+#include <cstdlib>
+
+int main()
+{
+ std::cout << "Bye!\n";
+ return EXIT_FAILURE
+}
diff --git a/src/boost/tools/build/example/testing/fail.cpp b/src/boost/tools/build/example/testing/fail.cpp
new file mode 100644
index 000000000..ce8e2a189
--- /dev/null
+++ b/src/boost/tools/build/example/testing/fail.cpp
@@ -0,0 +1,14 @@
+// Copyright (c) 2014 Rene Rivera
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include <iostream>
+#include <cstdlib>
+
+int main()
+{
+ std::cout << "Bye!\n";
+ return EXIT_FAILURE;
+}
diff --git a/src/boost/tools/build/example/testing/jamroot.jam b/src/boost/tools/build/example/testing/jamroot.jam
new file mode 100644
index 000000000..7bbb2e619
--- /dev/null
+++ b/src/boost/tools/build/example/testing/jamroot.jam
@@ -0,0 +1,10 @@
+# Copyright 2014 Rene Rivera
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+using testing ;
+
+run success.cpp : : ;
+run-fail fail.cpp : : ;
+compile success.cpp : : success-compile ;
+compile-fail compile-fail.cpp ;
diff --git a/src/boost/tools/build/example/testing/success.cpp b/src/boost/tools/build/example/testing/success.cpp
new file mode 100644
index 000000000..0b75980ab
--- /dev/null
+++ b/src/boost/tools/build/example/testing/success.cpp
@@ -0,0 +1,15 @@
+// Copyright (c) 2014 Rene Rivera
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+//
+
+#include <iostream>
+#include <cstdlib>
+
+int main()
+{
+ std::cout << "Hi!\n";
+ return EXIT_SUCCESS;
+}
diff --git a/src/boost/tools/build/example/time/hello.cpp b/src/boost/tools/build/example/time/hello.cpp
new file mode 100644
index 000000000..b3392a3b3
--- /dev/null
+++ b/src/boost/tools/build/example/time/hello.cpp
@@ -0,0 +1,12 @@
+// Copyright (c) 2003 Vladimir Prus
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE.txt or copy at
+// https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#include <iostream>
+
+int main()
+{
+ std::cout << "Hello!\n";
+}
diff --git a/src/boost/tools/build/example/time/jamroot.jam b/src/boost/tools/build/example/time/jamroot.jam
new file mode 100644
index 000000000..52fc1b980
--- /dev/null
+++ b/src/boost/tools/build/example/time/jamroot.jam
@@ -0,0 +1,16 @@
+#|
+Distributed under the Boost Software License, Version 1.0. (See
+accompanying file LICENSE.txt or copy at
+https://www.bfgroup.xyz/b2/LICENSE.txt)
+|#
+
+#[jamroot
+#<< Import the time rule from the testing module.
+import testing ;
+
+#<< The target we are timing just builds a hello program.
+exe hello : hello.cpp ;
+
+#<< This target records the time to build the `hello` target.
+time hello.time : hello ;
+#]
diff --git a/src/boost/tools/build/example/time/readme.qbk b/src/boost/tools/build/example/time/readme.qbk
new file mode 100644
index 000000000..808a2ceec
--- /dev/null
+++ b/src/boost/tools/build/example/time/readme.qbk
@@ -0,0 +1,47 @@
+[/
+Copyright 2017 Rene Rivera
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+]
+
+[section Time Action]
+
+This example shows how to use the `testing.time` utility to show time
+information for building a target.
+
+Files:
+
+* [@../../example/time/jamroot.jam jamroot.jam]
+* [@../../example/time/hello.cpp hello.cpp]
+
+Our `jamroot.jam` specifies the target we build and the `time`
+declaration to time the target we build:
+
+[import jamroot.jam]
+
+[jamroot]
+
+Building the example yields:
+
+[teletype]
+```
+> cd /example/time
+> b2
+...found 9 targets...
+...updating 6 targets...
+common.mkdir bin
+common.mkdir bin/clang-darwin-4.2.1
+common.mkdir bin/clang-darwin-4.2.1/debug
+clang-darwin.compile.c++ bin/clang-darwin-4.2.1/debug/hello.o
+clang-darwin.link bin/clang-darwin-4.2.1/debug/hello
+testing.time bin/clang-darwin-4.2.1/debug/hello.time
+user: [hello] 0.013509
+system: [hello] 0.045641
+clock: [hello] 0.000000
+...updated 6 targets...
+```
+
+[note The actual paths in the `bin` sub-directory will depend on your
+toolset.]
+
+[endsect]
diff --git a/src/boost/tools/build/example/try_compile/Jamroot.jam b/src/boost/tools/build/example/try_compile/Jamroot.jam
new file mode 100644
index 000000000..3131e722e
--- /dev/null
+++ b/src/boost/tools/build/example/try_compile/Jamroot.jam
@@ -0,0 +1,29 @@
+
+# This example shows performing configure checks in B2,
+# e.g. to check for some system function or compiler quirk.
+
+# First, declare a metatarget that we'll try to build.
+obj foo : foo.cpp ;
+# Make it explicit so that it's only built if used by a configure check
+explicit foo ;
+
+# Declare a target that depends on configure check result.
+exe main
+ : main.cpp
+ # The check-target-builds invocation in requirements section will
+ # - build the specified metatarget
+ # - if it builds OK, add the properties in the second parameter
+ # - otherwise, add the properties in the third parameter
+ : [ check-target-builds foo : <define>FOO=1 : <define>FOO=0 ]
+ ;
+
+# To test this:
+#
+# 1. Build with "b2". You should see a "foo builds: yes" message, and running
+# the produced executable will show that FOO is set to 1.
+# 2. Modify foo.cpp to contain a compile error, rebuild with
+# "b2 -a --reconfigure". You should see a "foo builds: no" message, and running
+# the produced executable should show that FOO is now set to 0.
+#
+# The output from the check is not shown on the console, instead it is
+# redirected to the bin/config.log file
diff --git a/src/boost/tools/build/example/try_compile/foo.cpp b/src/boost/tools/build/example/try_compile/foo.cpp
new file mode 100644
index 000000000..c9107f937
--- /dev/null
+++ b/src/boost/tools/build/example/try_compile/foo.cpp
@@ -0,0 +1,6 @@
+
+
+int foo()
+{
+ return 0;
+} \ No newline at end of file
diff --git a/src/boost/tools/build/example/try_compile/main.cpp b/src/boost/tools/build/example/try_compile/main.cpp
new file mode 100644
index 000000000..12f64995b
--- /dev/null
+++ b/src/boost/tools/build/example/try_compile/main.cpp
@@ -0,0 +1,8 @@
+
+#include <iostream>
+using namespace std;
+
+int main()
+{
+ std::cout << "Foo: " << FOO << "\n";
+} \ No newline at end of file
diff --git a/src/boost/tools/build/example/user-config.jam b/src/boost/tools/build/example/user-config.jam
new file mode 100644
index 000000000..05d823da0
--- /dev/null
+++ b/src/boost/tools/build/example/user-config.jam
@@ -0,0 +1,92 @@
+# Copyright 2003, 2005 Douglas Gregor
+# Copyright 2004 John Maddock
+# Copyright 2002, 2003, 2004, 2007 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+# This file is used to configure your B2 installation. You can modify
+# this file in place, or you can place it in a permanent location so that it
+# does not get overwritten should you get a new version of B2. See:
+#
+# https://www.bfgroup.xyz/b2/manual/release/index.html#bbv2.overview.configuration
+#
+# for documentation about possible permanent locations.
+
+# This file specifies which toolsets (C++ compilers), libraries, and other
+# tools are available. Often, you should be able to just uncomment existing
+# example lines and adjust them to taste. The complete list of supported tools,
+# and configuration instructions can be found at:
+#
+# https://www.bfgroup.xyz/b2/manual/release/index.html#bbv2.reference.tools
+#
+
+# This file uses Jam language syntax to describe available tools. Mostly,
+# there are 'using' lines, that contain the name of the used tools, and
+# parameters to pass to those tools -- where parameters are separated by
+# semicolons. Important syntax notes:
+#
+# - Both ':' and ';' must be separated from other tokens by whitespace
+# - The '\' symbol is a quote character, so when specifying Windows paths you
+# should use '/' or '\\' instead.
+#
+# More details about the syntax can be found at:
+#
+# https://www.bfgroup.xyz/b2/manual/release/index.html#jam.language
+#
+
+# ------------------
+# GCC configuration.
+# ------------------
+
+# Configure gcc (default version).
+# using gcc ;
+
+# Configure specific gcc version, giving alternative name to use.
+# using gcc : 3.2 : g++-3.2 ;
+
+
+# -------------------
+# MSVC configuration.
+# -------------------
+
+# Configure msvc (default version, searched for in standard locations and PATH).
+# using msvc ;
+
+# Configure specific msvc version (searched for in standard locations and PATH).
+# using msvc : 8.0 ;
+
+
+# ----------------------
+# Borland configuration.
+# ----------------------
+# using borland ;
+
+
+# ----------------------
+# STLPort configuration.
+# ----------------------
+
+# Configure specifying location of STLPort headers. Libraries must be either
+# not needed or available to the compiler by default.
+# using stlport : : /usr/include/stlport ;
+
+# Configure specifying location of both headers and libraries explicitly.
+# using stlport : : /usr/include/stlport /usr/lib ;
+
+
+# -----------------
+# QT configuration.
+# -----------------
+
+# Configure assuming QTDIR gives the installation prefix.
+# using qt ;
+
+# Configure with an explicit installation prefix.
+# using qt : /usr/opt/qt ;
+
+# ---------------------
+# Python configuration.
+# ---------------------
+
+# Configure specific Python version.
+# using python : 3.1 : /usr/bin/python3 : /usr/include/python3.1 : /usr/lib ;
diff --git a/src/boost/tools/build/example/variant/a.cpp b/src/boost/tools/build/example/variant/a.cpp
new file mode 100644
index 000000000..e6abcf9c0
--- /dev/null
+++ b/src/boost/tools/build/example/variant/a.cpp
@@ -0,0 +1,7 @@
+// Copyright Vladimir Prus 2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+void l();
+int main() { l(); return 0; }
diff --git a/src/boost/tools/build/example/variant/jamfile.jam b/src/boost/tools/build/example/variant/jamfile.jam
new file mode 100644
index 000000000..6fd72adbd
--- /dev/null
+++ b/src/boost/tools/build/example/variant/jamfile.jam
@@ -0,0 +1,11 @@
+# Copyright 2004 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#[jamfile
+#<< By default, build the project with the two variants we have defined in jamroot.jam.
+project : default-build crazy super_release ;
+
+#<< We build an `a` exe target that links a built library. The library builds with the propagated properties of the exe.
+exe a : a.cpp libs//l ;
+#] \ No newline at end of file
diff --git a/src/boost/tools/build/example/variant/jamroot.jam b/src/boost/tools/build/example/variant/jamroot.jam
new file mode 100644
index 000000000..d20669789
--- /dev/null
+++ b/src/boost/tools/build/example/variant/jamroot.jam
@@ -0,0 +1,12 @@
+# Copyright 2004 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#[jamroot
+#<< Define a build variant which is just combination of four properties.
+variant crazy : <optimization>speed <inlining>off
+ <debug-symbols>on <profiling>on ;
+
+#<< Define a built variant inherited from 'release'. It defines one new property and gets all properties from the parent `release` variant.
+variant super_release : release : <define>USE_ASM ;
+#]
diff --git a/src/boost/tools/build/example/variant/libs/jamfile.jam b/src/boost/tools/build/example/variant/libs/jamfile.jam
new file mode 100644
index 000000000..5d6d42dbd
--- /dev/null
+++ b/src/boost/tools/build/example/variant/libs/jamfile.jam
@@ -0,0 +1,8 @@
+# Copyright 2004 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#[libs_jamfile
+#<< The library `l` just needs the sources. By default it will be a shared library.
+lib l : l.cpp ;
+#] \ No newline at end of file
diff --git a/src/boost/tools/build/example/variant/libs/l.cpp b/src/boost/tools/build/example/variant/libs/l.cpp
new file mode 100644
index 000000000..be3254ca8
--- /dev/null
+++ b/src/boost/tools/build/example/variant/libs/l.cpp
@@ -0,0 +1,9 @@
+// Copyright Vladimir Prus 2002-2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt
+// or copy at https://www.bfgroup.xyz/b2/LICENSE.txt)
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+void l() {}
diff --git a/src/boost/tools/build/example/variant/readme.qbk b/src/boost/tools/build/example/variant/readme.qbk
new file mode 100644
index 000000000..663219e34
--- /dev/null
+++ b/src/boost/tools/build/example/variant/readme.qbk
@@ -0,0 +1,94 @@
+[/
+Copyright 2004 Vladimir Prus
+Copyright 2017 Rene Rivera
+Distributed under the Boost Software License, Version 1.0.
+(See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+/]
+
+[section Build Variants]
+
+This example shows how user can create his own build variants. Two variants are
+defined: "crazy", which is just a random combination of properties, and
+"super-release", which is inherited from "release", and differs by a single
+define.
+
+Files:
+
+* [@../../example/variant/a.cpp a.cpp]
+* [@../../example/variant/jamroot.jam jamroot.jam]
+* [@../../example/variant/jamfile.jam jamfile.jam]
+* [@../../example/variant/libs/jamfile.jam libs/jamfile.jam]
+* [@../../example/variant/libs/l.cpp libs/l.cpp]
+
+[import jamroot.jam]
+[import jamfile.jam]
+[import libs/jamfile.jam]
+
+In this project the `jamroot.jam` specifies the custom build variants and the
+targets are specified in the two `jamfile.jam` files.
+
+[jamroot]
+
+The top-level `jamfile.jam`:
+
+[jamfile]
+
+And the library `jamfile.jam` that the top-level `jamfile.jam` refers to:
+
+[libs_jamfile]
+
+Building the example yields:
+
+[teletype]
+```
+> cd /example/variant
+> b2
+...found 20 targets...
+...updating 16 targets...
+common.mkdir bin
+common.mkdir bin/clang-darwin-4.2.1
+common.mkdir bin/clang-darwin-4.2.1/crazy
+clang-darwin.compile.c++ bin/clang-darwin-4.2.1/crazy/a.o
+common.mkdir libs/bin
+common.mkdir libs/bin/clang-darwin-4.2.1
+common.mkdir libs/bin/clang-darwin-4.2.1/crazy
+clang-darwin.compile.c++ libs/bin/clang-darwin-4.2.1/crazy/l.o
+clang-darwin.link.dll libs/bin/clang-darwin-4.2.1/crazy/libl.dylib
+clang-darwin.link bin/clang-darwin-4.2.1/crazy/a
+common.mkdir bin/clang-darwin-4.2.1/super_release
+clang-darwin.compile.c++ bin/clang-darwin-4.2.1/super_release/a.o
+common.mkdir libs/bin/clang-darwin-4.2.1/super_release
+clang-darwin.compile.c++ libs/bin/clang-darwin-4.2.1/super_release/l.o
+clang-darwin.link.dll libs/bin/clang-darwin-4.2.1/super_release/libl.dylib
+clang-darwin.link bin/clang-darwin-4.2.1/super_release/a
+...updated 16 targets...
+```
+
+As specified in the top-level `jamfile.jam` both custom variants where built
+by default. Once can override that by specifying the variant one wants to
+build directly on the command line with a `variant=super_release`. Or just
+with a `super_release` as variants can be referred to by their name only.
+For example using that argument yields:
+
+```
+> cd /example/variant
+> b2 super_release
+...found 14 targets...
+...updating 10 targets...
+common.mkdir bin
+common.mkdir bin/clang-darwin-4.2.1
+common.mkdir bin/clang-darwin-4.2.1/super_release
+clang-darwin.compile.c++ bin/clang-darwin-4.2.1/super_release/a.o
+common.mkdir libs/bin
+common.mkdir libs/bin/clang-darwin-4.2.1
+common.mkdir libs/bin/clang-darwin-4.2.1/super_release
+clang-darwin.compile.c++ libs/bin/clang-darwin-4.2.1/super_release/l.o
+clang-darwin.link.dll libs/bin/clang-darwin-4.2.1/super_release/libl.dylib
+clang-darwin.link bin/clang-darwin-4.2.1/super_release/a
+...updated 10 targets...
+```
+
+[note The actual paths in the `bin` sub-directory will depend on your
+toolset.]
+
+[endsect]