summaryrefslogtreecommitdiff
path: root/tools/build/example
diff options
context:
space:
mode:
Diffstat (limited to 'tools/build/example')
-rw-r--r--tools/build/example/boost-build.jam6
-rw-r--r--tools/build/example/built_tool/Jamroot.jam8
-rw-r--r--tools/build/example/built_tool/core/Jamfile.jam30
-rw-r--r--tools/build/example/built_tool/core/a.td0
-rw-r--r--tools/build/example/built_tool/core/core.cpp5
-rw-r--r--tools/build/example/built_tool/readme.txt5
-rw-r--r--tools/build/example/built_tool/tblgen/Jamfile.jam4
-rw-r--r--tools/build/example/built_tool/tblgen/tblgen.cpp9
-rw-r--r--tools/build/example/customization/class.verbatim7
-rw-r--r--tools/build/example/customization/codegen.cpp36
-rw-r--r--tools/build/example/customization/inline_file.py44
-rw-r--r--tools/build/example/customization/jamroot.jam9
-rw-r--r--tools/build/example/customization/readme.txt11
-rw-r--r--tools/build/example/customization/t1.verbatim2
-rw-r--r--tools/build/example/customization/t2.verbatim0
-rw-r--r--tools/build/example/customization/usage.verbatim5
-rw-r--r--tools/build/example/customization/verbatim.jam51
-rw-r--r--tools/build/example/customization/verbatim.py47
-rw-r--r--tools/build/example/generate/REAME.txt11
-rw-r--r--tools/build/example/generate/a.cpp10
-rw-r--r--tools/build/example/generate/gen.jam26
-rw-r--r--tools/build/example/generate/gen.py16
-rw-r--r--tools/build/example/generate/jamroot.jam9
-rw-r--r--tools/build/example/generator/README.txt6
-rw-r--r--tools/build/example/generator/foo.gci10
-rw-r--r--tools/build/example/generator/jamroot.jam6
-rw-r--r--tools/build/example/generator/soap.jam77
-rw-r--r--tools/build/example/gettext/jamfile.jam26
-rw-r--r--tools/build/example/gettext/jamroot.jam6
-rw-r--r--tools/build/example/gettext/main.cpp28
-rw-r--r--tools/build/example/gettext/readme.txt24
-rw-r--r--tools/build/example/gettext/russian.po21
-rw-r--r--tools/build/example/hello/hello.cpp16
-rw-r--r--tools/build/example/hello/jamroot.jam1
-rw-r--r--tools/build/example/hello/readme.txt7
-rw-r--r--tools/build/example/libraries/app/app.cpp15
-rw-r--r--tools/build/example/libraries/app/jamfile.jam9
-rw-r--r--tools/build/example/libraries/jamroot.jam4
-rw-r--r--tools/build/example/libraries/util/foo/bar.cpp13
-rw-r--r--tools/build/example/libraries/util/foo/include/lib1.h10
-rw-r--r--tools/build/example/libraries/util/foo/jamfile.jam9
-rw-r--r--tools/build/example/make/foo.py2
-rw-r--r--tools/build/example/make/jamroot.jam13
-rw-r--r--tools/build/example/make/main_cpp.pro1
-rw-r--r--tools/build/example/make/readme.txt7
-rw-r--r--tools/build/example/pch/include/pch.hpp19
-rw-r--r--tools/build/example/pch/jamroot.jam29
-rw-r--r--tools/build/example/pch/source/hello_world.cpp15
-rw-r--r--tools/build/example/python_modules/jamroot.jam8
-rw-r--r--tools/build/example/python_modules/python_helpers.jam15
-rw-r--r--tools/build/example/python_modules/python_helpers.py18
-rw-r--r--tools/build/example/python_modules/readme.txt16
-rw-r--r--tools/build/example/qt/README.txt20
-rw-r--r--tools/build/example/qt/qt3/hello/canvas.cpp73
-rw-r--r--tools/build/example/qt/qt3/hello/canvas.h35
-rw-r--r--tools/build/example/qt/qt3/hello/jamroot.jam13
-rw-r--r--tools/build/example/qt/qt3/hello/main.cpp36
-rw-r--r--tools/build/example/qt/qt3/moccable-cpp/jamroot.jam11
-rw-r--r--tools/build/example/qt/qt3/moccable-cpp/main.cpp41
-rw-r--r--tools/build/example/qt/qt3/uic/hello_world_widget.ui58
-rw-r--r--tools/build/example/qt/qt3/uic/jamroot.jam15
-rw-r--r--tools/build/example/qt/qt3/uic/main.cpp18
-rw-r--r--tools/build/example/qt/qt4/hello/arrow.cpp158
-rw-r--r--tools/build/example/qt/qt4/hello/arrow.h30
-rw-r--r--tools/build/example/qt/qt4/hello/jamroot.jam14
-rw-r--r--tools/build/example/qt/qt4/hello/main.cpp27
-rw-r--r--tools/build/example/qt/qt4/moccable-cpp/jamroot.jam18
-rw-r--r--tools/build/example/qt/qt4/moccable-cpp/main.cpp39
-rw-r--r--tools/build/example/qt/qt4/uic/hello_world_widget.ui55
-rw-r--r--tools/build/example/qt/qt4/uic/jamroot.jam18
-rw-r--r--tools/build/example/qt/qt4/uic/main.cpp23
-rw-r--r--tools/build/example/site-config.jam4
-rw-r--r--tools/build/example/testing/compile-fail.cpp16
-rw-r--r--tools/build/example/testing/fail.cpp16
-rw-r--r--tools/build/example/testing/jamroot.jam10
-rw-r--r--tools/build/example/testing/success.cpp16
-rw-r--r--tools/build/example/user-config.jam92
-rw-r--r--tools/build/example/variant/a.cpp7
-rw-r--r--tools/build/example/variant/jamfile.jam11
-rw-r--r--tools/build/example/variant/jamroot.jam14
-rw-r--r--tools/build/example/variant/libs/jamfile.jam6
-rw-r--r--tools/build/example/variant/libs/l.cpp9
-rw-r--r--tools/build/example/variant/readme.txt11
83 files changed, 1696 insertions, 0 deletions
diff --git a/tools/build/example/boost-build.jam b/tools/build/example/boost-build.jam
new file mode 100644
index 000000000..02abe407f
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+
+boost-build ../src/kernel ;
diff --git a/tools/build/example/built_tool/Jamroot.jam b/tools/build/example/built_tool/Jamroot.jam
new file mode 100644
index 000000000..c458650e8
--- /dev/null
+++ b/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/tools/build/example/built_tool/core/Jamfile.jam b/tools/build/example/built_tool/core/Jamfile.jam
new file mode 100644
index 000000000..2d96f7182
--- /dev/null
+++ b/tools/build/example/built_tool/core/Jamfile.jam
@@ -0,0 +1,30 @@
+
+import toolset ;
+
+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) > $(<)
+}
diff --git a/tools/build/example/built_tool/core/a.td b/tools/build/example/built_tool/core/a.td
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tools/build/example/built_tool/core/a.td
diff --git a/tools/build/example/built_tool/core/core.cpp b/tools/build/example/built_tool/core/core.cpp
new file mode 100644
index 000000000..31a133726
--- /dev/null
+++ b/tools/build/example/built_tool/core/core.cpp
@@ -0,0 +1,5 @@
+
+int main()
+{
+ return 0;
+}
diff --git a/tools/build/example/built_tool/readme.txt b/tools/build/example/built_tool/readme.txt
new file mode 100644
index 000000000..bbb9f9b3a
--- /dev/null
+++ b/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/tools/build/example/built_tool/tblgen/Jamfile.jam b/tools/build/example/built_tool/tblgen/Jamfile.jam
new file mode 100644
index 000000000..af4906278
--- /dev/null
+++ b/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/tools/build/example/built_tool/tblgen/tblgen.cpp b/tools/build/example/built_tool/tblgen/tblgen.cpp
new file mode 100644
index 000000000..fbd058133
--- /dev/null
+++ b/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/tools/build/example/customization/class.verbatim b/tools/build/example/customization/class.verbatim
new file mode 100644
index 000000000..5c0d7b803
--- /dev/null
+++ b/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/tools/build/example/customization/codegen.cpp b/tools/build/example/customization/codegen.cpp
new file mode 100644
index 000000000..6cdb45e4d
--- /dev/null
+++ b/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_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.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/tools/build/example/customization/inline_file.py b/tools/build/example/customization/inline_file.py
new file mode 100644
index 000000000..a48c5fc9d
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.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/tools/build/example/customization/jamroot.jam b/tools/build/example/customization/jamroot.jam
new file mode 100644
index 000000000..5e986d91c
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+import verbatim ;
+
+exe codegen : codegen.cpp class.verbatim usage.verbatim
+ t1.verbatim ;
+
diff --git a/tools/build/example/customization/readme.txt b/tools/build/example/customization/readme.txt
new file mode 100644
index 000000000..7ee04f1a2
--- /dev/null
+++ b/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
+Boost.Build. 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/tools/build/example/customization/t1.verbatim b/tools/build/example/customization/t1.verbatim
new file mode 100644
index 000000000..144540f29
--- /dev/null
+++ b/tools/build/example/customization/t1.verbatim
@@ -0,0 +1,2 @@
+t1
+//###include "t2.verbatim" \ No newline at end of file
diff --git a/tools/build/example/customization/t2.verbatim b/tools/build/example/customization/t2.verbatim
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tools/build/example/customization/t2.verbatim
diff --git a/tools/build/example/customization/usage.verbatim b/tools/build/example/customization/usage.verbatim
new file mode 100644
index 000000000..0fc4b4a37
--- /dev/null
+++ b/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/tools/build/example/customization/verbatim.jam b/tools/build/example/customization/verbatim.jam
new file mode 100644
index 000000000..931fdce33
--- /dev/null
+++ b/tools/build/example/customization/verbatim.jam
@@ -0,0 +1,51 @@
+# Copyright 2003, 2004 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 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 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" $(<) $(>)
+}
diff --git a/tools/build/example/customization/verbatim.py b/tools/build/example/customization/verbatim.py
new file mode 100644
index 000000000..be285976c
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.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/tools/build/example/generate/REAME.txt b/tools/build/example/generate/REAME.txt
new file mode 100644
index 000000000..fc2b20772
--- /dev/null
+++ b/tools/build/example/generate/REAME.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 Boost.Build 'virtual targets', which is more flexible.
+
+Please consult the docs for more explanations.
diff --git a/tools/build/example/generate/a.cpp b/tools/build/example/generate/a.cpp
new file mode 100644
index 000000000..364975671
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+ */
diff --git a/tools/build/example/generate/gen.jam b/tools/build/example/generate/gen.jam
new file mode 100644
index 000000000..73232aab5
--- /dev/null
+++ b/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/tools/build/example/generate/gen.py b/tools/build/example/generate/gen.py
new file mode 100644
index 000000000..09ee15b43
--- /dev/null
+++ b/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/tools/build/example/generate/jamroot.jam b/tools/build/example/generate/jamroot.jam
new file mode 100644
index 000000000..c48f2207b
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+import generate ;
+
+import gen ;
+
+generate a2 : a.cpp : <generating-rule>@gen.generate-example ;
diff --git a/tools/build/example/generator/README.txt b/tools/build/example/generator/README.txt
new file mode 100644
index 000000000..f26a856a5
--- /dev/null
+++ b/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/tools/build/example/generator/foo.gci b/tools/build/example/generator/foo.gci
new file mode 100644
index 000000000..2ccc45c6c
--- /dev/null
+++ b/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/tools/build/example/generator/jamroot.jam b/tools/build/example/generator/jamroot.jam
new file mode 100644
index 000000000..9703134db
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+import soap ;
+exe foo : foo.gci : <server>on ;
diff --git a/tools/build/example/generator/soap.jam b/tools/build/example/generator/soap.jam
new file mode 100644
index 000000000..d28bfdecc
--- /dev/null
+++ b/tools/build/example/generator/soap.jam
@@ -0,0 +1,77 @@
+# 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 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 ;
+
+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) $(<)
+}
diff --git a/tools/build/example/gettext/jamfile.jam b/tools/build/example/gettext/jamfile.jam
new file mode 100644
index 000000000..d5096df30
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.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/tools/build/example/gettext/jamroot.jam b/tools/build/example/gettext/jamroot.jam
new file mode 100644
index 000000000..862f8930c
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+
+using gettext ;
diff --git a/tools/build/example/gettext/main.cpp b/tools/build/example/gettext/main.cpp
new file mode 100644
index 000000000..6888e1aba
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/gettext/readme.txt b/tools/build/example/gettext/readme.txt
new file mode 100644
index 000000000..9c8fee6fd
--- /dev/null
+++ b/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
+Boost.Build.
+
+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/tools/build/example/gettext/russian.po b/tools/build/example/gettext/russian.po
new file mode 100644
index 000000000..daa7121c3
--- /dev/null
+++ b/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/tools/build/example/hello/hello.cpp b/tools/build/example/hello/hello.cpp
new file mode 100644
index 000000000..680802289
--- /dev/null
+++ b/tools/build/example/hello/hello.cpp
@@ -0,0 +1,16 @@
+// Copyright (c) 2003 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)
+//
+// http://www.boost.org
+//
+
+#include <iostream>
+
+int main()
+{
+ std::cout << "Hello!\n";
+ return 1;
+}
diff --git a/tools/build/example/hello/jamroot.jam b/tools/build/example/hello/jamroot.jam
new file mode 100644
index 000000000..672ec02e9
--- /dev/null
+++ b/tools/build/example/hello/jamroot.jam
@@ -0,0 +1 @@
+exe hello : hello.cpp ;
diff --git a/tools/build/example/hello/readme.txt b/tools/build/example/hello/readme.txt
new file mode 100644
index 000000000..f416be675
--- /dev/null
+++ b/tools/build/example/hello/readme.txt
@@ -0,0 +1,7 @@
+Copyright 2008 Jurko Gospodnetic
+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 a very basic Boost Build project set up so it compiles a
+single executable from a single source file.
diff --git a/tools/build/example/libraries/app/app.cpp b/tools/build/example/libraries/app/app.cpp
new file mode 100644
index 000000000..f62c1c35d
--- /dev/null
+++ b/tools/build/example/libraries/app/app.cpp
@@ -0,0 +1,15 @@
+// Copyright (c) 2003 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)
+//
+// http://www.boost.org
+//
+
+#include <lib1.h>
+
+int main()
+{
+ foo();
+}
diff --git a/tools/build/example/libraries/app/jamfile.jam b/tools/build/example/libraries/app/jamfile.jam
new file mode 100644
index 000000000..ed2054e13
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.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/tools/build/example/libraries/jamroot.jam b/tools/build/example/libraries/jamroot.jam
new file mode 100644
index 000000000..5e0dc4814
--- /dev/null
+++ b/tools/build/example/libraries/jamroot.jam
@@ -0,0 +1,4 @@
+
+use-project /library-example/foo : util/foo ;
+
+build-project app ;
diff --git a/tools/build/example/libraries/util/foo/bar.cpp b/tools/build/example/libraries/util/foo/bar.cpp
new file mode 100644
index 000000000..e6339ee9b
--- /dev/null
+++ b/tools/build/example/libraries/util/foo/bar.cpp
@@ -0,0 +1,13 @@
+// Copyright (c) 2003 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)
+//
+// http://www.boost.org
+//
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+void foo() {}
diff --git a/tools/build/example/libraries/util/foo/include/lib1.h b/tools/build/example/libraries/util/foo/include/lib1.h
new file mode 100644
index 000000000..50f5e19d2
--- /dev/null
+++ b/tools/build/example/libraries/util/foo/include/lib1.h
@@ -0,0 +1,10 @@
+// Copyright (c) 2003 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)
+//
+// http://www.boost.org
+//
+
+void foo();
diff --git a/tools/build/example/libraries/util/foo/jamfile.jam b/tools/build/example/libraries/util/foo/jamfile.jam
new file mode 100644
index 000000000..7b6359ea4
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+
+project
+ : usage-requirements <include>include ;
+
+lib bar : bar.cpp ;
diff --git a/tools/build/example/make/foo.py b/tools/build/example/make/foo.py
new file mode 100644
index 000000000..e4c0b824a
--- /dev/null
+++ b/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/tools/build/example/make/jamroot.jam b/tools/build/example/make/jamroot.jam
new file mode 100644
index 000000000..7bb98e353
--- /dev/null
+++ b/tools/build/example/make/jamroot.jam
@@ -0,0 +1,13 @@
+import feature ;
+import toolset ;
+
+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" "$(>)" "$(<)"
+}
diff --git a/tools/build/example/make/main_cpp.pro b/tools/build/example/make/main_cpp.pro
new file mode 100644
index 000000000..237c8ce18
--- /dev/null
+++ b/tools/build/example/make/main_cpp.pro
@@ -0,0 +1 @@
+int main() {}
diff --git a/tools/build/example/make/readme.txt b/tools/build/example/make/readme.txt
new file mode 100644
index 000000000..333c55a71
--- /dev/null
+++ b/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/tools/build/example/pch/include/pch.hpp b/tools/build/example/pch/include/pch.hpp
new file mode 100644
index 000000000..8f05cc43d
--- /dev/null
+++ b/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/tools/build/example/pch/jamroot.jam b/tools/build/example/pch/jamroot.jam
new file mode 100644
index 000000000..115164aae
--- /dev/null
+++ b/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_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.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/tools/build/example/pch/source/hello_world.cpp b/tools/build/example/pch/source/hello_world.cpp
new file mode 100644
index 000000000..f618056a0
--- /dev/null
+++ b/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_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+#include <pch.hpp>
+
+int main()
+{
+ TestClass c(1, 2);
+ return 0;
+}
diff --git a/tools/build/example/python_modules/jamroot.jam b/tools/build/example/python_modules/jamroot.jam
new file mode 100644
index 000000000..c53e75d58
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+import python_helpers ;
+
+ECHO "test1:" [ python_helpers.test1 ] ;
+ECHO "test2:" [ python_helpers.test2 1234 : 5678 ] ;
diff --git a/tools/build/example/python_modules/python_helpers.jam b/tools/build/example/python_modules/python_helpers.jam
new file mode 100644
index 000000000..5a79aeebf
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+import modules ;
+local here = [ modules.binding $(__name__) ] ;
+here = $(here:D) ;
+modules.poke : EXTRA_PYTHONPATH : $(here) ;
+
+# Import the Python rules to Boost.Build
+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/tools/build/example/python_modules/python_helpers.py b/tools/build/example/python_modules/python_helpers.py
new file mode 100644
index 000000000..8148f57c3
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+# Declare a couple of functions called from Boost.Build
+#
+# 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/tools/build/example/python_modules/readme.txt b/tools/build/example/python_modules/readme.txt
new file mode 100644
index 000000000..0fe6ee55e
--- /dev/null
+++ b/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 Boost.Build.
+
+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/tools/build/example/qt/README.txt b/tools/build/example/qt/README.txt
new file mode 100644
index 000000000..d187c31c3
--- /dev/null
+++ b/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 Boost.Build 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 Boost.Build 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/tools/build/example/qt/qt3/hello/canvas.cpp b/tools/build/example/qt/qt3/hello/canvas.cpp
new file mode 100644
index 000000000..c6d23c9d4
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/qt/qt3/hello/canvas.h b/tools/build/example/qt/qt3/hello/canvas.h
new file mode 100644
index 000000000..f9f950267
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/qt/qt3/hello/jamroot.jam b/tools/build/example/qt/qt3/hello/jamroot.jam
new file mode 100644
index 000000000..03be582e5
--- /dev/null
+++ b/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_1_0.txt
+# or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/qt/qt3/hello/main.cpp b/tools/build/example/qt/qt3/hello/main.cpp
new file mode 100644
index 000000000..8f1ffc2fb
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/qt/qt3/moccable-cpp/jamroot.jam b/tools/build/example/qt/qt3/moccable-cpp/jamroot.jam
new file mode 100644
index 000000000..85778da20
--- /dev/null
+++ b/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/tools/build/example/qt/qt3/moccable-cpp/main.cpp b/tools/build/example/qt/qt3/moccable-cpp/main.cpp
new file mode 100644
index 000000000..ed36f7469
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/qt/qt3/uic/hello_world_widget.ui b/tools/build/example/qt/qt3/uic/hello_world_widget.ui
new file mode 100644
index 000000000..26cc73487
--- /dev/null
+++ b/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/tools/build/example/qt/qt3/uic/jamroot.jam b/tools/build/example/qt/qt3/uic/jamroot.jam
new file mode 100644
index 000000000..d0b806294
--- /dev/null
+++ b/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_1_0.txt
+# or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/qt/qt3/uic/main.cpp b/tools/build/example/qt/qt3/uic/main.cpp
new file mode 100644
index 000000000..f2a08b5fa
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/qt/qt4/hello/arrow.cpp b/tools/build/example/qt/qt4/hello/arrow.cpp
new file mode 100644
index 000000000..e821b1690
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/qt/qt4/hello/arrow.h b/tools/build/example/qt/qt4/hello/arrow.h
new file mode 100644
index 000000000..d7743864f
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/qt/qt4/hello/jamroot.jam b/tools/build/example/qt/qt4/hello/jamroot.jam
new file mode 100644
index 000000000..83952f17b
--- /dev/null
+++ b/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/tools/build/example/qt/qt4/hello/main.cpp b/tools/build/example/qt/qt4/hello/main.cpp
new file mode 100644
index 000000000..df27444bd
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/qt/qt4/moccable-cpp/jamroot.jam b/tools/build/example/qt/qt4/moccable-cpp/jamroot.jam
new file mode 100644
index 000000000..d07b9c7d3
--- /dev/null
+++ b/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/tools/build/example/qt/qt4/moccable-cpp/main.cpp b/tools/build/example/qt/qt4/moccable-cpp/main.cpp
new file mode 100644
index 000000000..ffc96cc3e
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/qt/qt4/uic/hello_world_widget.ui b/tools/build/example/qt/qt4/uic/hello_world_widget.ui
new file mode 100644
index 000000000..67060b336
--- /dev/null
+++ b/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/tools/build/example/qt/qt4/uic/jamroot.jam b/tools/build/example/qt/qt4/uic/jamroot.jam
new file mode 100644
index 000000000..40675a72e
--- /dev/null
+++ b/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_1_0.txt
+# or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/qt/qt4/uic/main.cpp b/tools/build/example/qt/qt4/uic/main.cpp
new file mode 100644
index 000000000..fc72fd5e6
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.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/tools/build/example/site-config.jam b/tools/build/example/site-config.jam
new file mode 100644
index 000000000..ad22d6744
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
diff --git a/tools/build/example/testing/compile-fail.cpp b/tools/build/example/testing/compile-fail.cpp
new file mode 100644
index 000000000..cd3e09409
--- /dev/null
+++ b/tools/build/example/testing/compile-fail.cpp
@@ -0,0 +1,16 @@
+// Copyright (c) 2014 Rene Rivera
+//
+// 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)
+//
+// http://www.boost.org
+//
+
+#include <iostream>
+
+int main()
+{
+ std::cout << "Bye!\n";
+ return 1
+}
diff --git a/tools/build/example/testing/fail.cpp b/tools/build/example/testing/fail.cpp
new file mode 100644
index 000000000..f1efa1ee2
--- /dev/null
+++ b/tools/build/example/testing/fail.cpp
@@ -0,0 +1,16 @@
+// Copyright (c) 2014 Rene Rivera
+//
+// 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)
+//
+// http://www.boost.org
+//
+
+#include <iostream>
+
+int main()
+{
+ std::cout << "Bye!\n";
+ return 1;
+}
diff --git a/tools/build/example/testing/jamroot.jam b/tools/build/example/testing/jamroot.jam
new file mode 100644
index 000000000..047aff39c
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+using testing ;
+
+run success.cpp : : ;
+run-fail fail.cpp : : ;
+compile success.cpp : : success-compile ;
+compile-fail compile-fail.cpp ;
diff --git a/tools/build/example/testing/success.cpp b/tools/build/example/testing/success.cpp
new file mode 100644
index 000000000..e2fa7a4a9
--- /dev/null
+++ b/tools/build/example/testing/success.cpp
@@ -0,0 +1,16 @@
+// Copyright (c) 2014 Rene Rivera
+//
+// 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)
+//
+// http://www.boost.org
+//
+
+#include <iostream>
+
+int main()
+{
+ std::cout << "Hi!\n";
+ return 0;
+}
diff --git a/tools/build/example/user-config.jam b/tools/build/example/user-config.jam
new file mode 100644
index 000000000..fbbf13fd0
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+# This file is used to configure your Boost.Build 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 Boost.Build. See:
+#
+# http://www.boost.org/boost-build2/doc/html/bbv2/overview/configuration.html
+#
+# 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:
+#
+# http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html
+#
+
+# 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 paremeters 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:
+#
+# http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.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/tools/build/example/variant/a.cpp b/tools/build/example/variant/a.cpp
new file mode 100644
index 000000000..42b69f335
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+void l();
+int main() { l(); return 0; }
diff --git a/tools/build/example/variant/jamfile.jam b/tools/build/example/variant/jamfile.jam
new file mode 100644
index 000000000..9f8c580be
--- /dev/null
+++ b/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_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+
+# By default, build the project with the two variants we have defined in
+# jamroot.jam.
+
+project : default-build crazy super_release ;
+
+exe a : a.cpp libs//l ;
diff --git a/tools/build/example/variant/jamroot.jam b/tools/build/example/variant/jamroot.jam
new file mode 100644
index 000000000..e19476ccc
--- /dev/null
+++ b/tools/build/example/variant/jamroot.jam
@@ -0,0 +1,14 @@
+# Copyright 2004 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)
+
+
+# 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 get all properties
+# from parent variant.
+variant super_release : release : <define>USE_ASM ;
diff --git a/tools/build/example/variant/libs/jamfile.jam b/tools/build/example/variant/libs/jamfile.jam
new file mode 100644
index 000000000..4366b7624
--- /dev/null
+++ b/tools/build/example/variant/libs/jamfile.jam
@@ -0,0 +1,6 @@
+# Copyright 2004 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)
+
+
+lib l : l.cpp ;
diff --git a/tools/build/example/variant/libs/l.cpp b/tools/build/example/variant/libs/l.cpp
new file mode 100644
index 000000000..26cb4b1e6
--- /dev/null
+++ b/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_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+void l() {}
diff --git a/tools/build/example/variant/readme.txt b/tools/build/example/variant/readme.txt
new file mode 100644
index 000000000..5ab1b938a
--- /dev/null
+++ b/tools/build/example/variant/readme.txt
@@ -0,0 +1,11 @@
+Copyright 2004 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 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.
+
+See the jamroot.jam for the definitions.