1 | # Copyright 2003 Dave Abrahams |
---|
2 | # Copyright 2003, 2005, 2006 Rene Rivera |
---|
3 | # Copyright 2003, 2005, 2006 Vladimir Prus |
---|
4 | # Distributed under the Boost Software License, Version 1.0. |
---|
5 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) |
---|
6 | |
---|
7 | # First of all, check the jam version |
---|
8 | |
---|
9 | if $(JAM_VERSION:J="") < 030112 |
---|
10 | { |
---|
11 | ECHO "error: Boost.Jam version 3.1.12 or later required" ; |
---|
12 | EXIT ; |
---|
13 | } |
---|
14 | |
---|
15 | local required-rules = GLOB-RECURSIVELY HAS_NATIVE_RULE ; |
---|
16 | |
---|
17 | for local r in $(required-rules) |
---|
18 | { |
---|
19 | if ! $(r) in [ RULENAMES ] |
---|
20 | { |
---|
21 | ECHO "error: builtin rule '$(r)' is not present" ; |
---|
22 | ECHO "error: your version of bjam is likely out of date" ; |
---|
23 | ECHO "error: please get a fresh version from CVS." ; |
---|
24 | EXIT ; |
---|
25 | } |
---|
26 | } |
---|
27 | |
---|
28 | local native = |
---|
29 | regex transform 2 |
---|
30 | ; |
---|
31 | while $(native) |
---|
32 | { |
---|
33 | if ! [ HAS_NATIVE_RULE $(native[1]) : |
---|
34 | $(native[2]) : |
---|
35 | $(native[3]) ] |
---|
36 | { |
---|
37 | ECHO "error: missing native rule '$(native[1]).$(native[2])'" ; |
---|
38 | ECHO "error: or interface version of that rule is too low" ; |
---|
39 | ECHO "error: your version of bjam is likely out of date" ; |
---|
40 | ECHO "error: please get a fresh version from CVS." ; |
---|
41 | EXIT ; |
---|
42 | } |
---|
43 | native = $(native[4-]) ; |
---|
44 | } |
---|
45 | |
---|
46 | # Check that the builtin .ENVIRON module is present. We don't have a |
---|
47 | # builtin to check that a module is present, so we assume that the PATH |
---|
48 | # environment variable is always set and verify that the .ENVIRON module |
---|
49 | # has non-empty value of that variable. |
---|
50 | module .ENVIRON |
---|
51 | { |
---|
52 | local p = $(PATH) $(Path) $(path) ; |
---|
53 | if ! $(p) |
---|
54 | { |
---|
55 | ECHO "error: no builtin module .ENVIRON is found" ; |
---|
56 | ECHO "error: your version of bjam is likely out of date" ; |
---|
57 | ECHO "error: please get a fresh version from CVS." ; |
---|
58 | EXIT ; |
---|
59 | } |
---|
60 | } |
---|
61 | |
---|
62 | # Check that @() functionality is present. Similarly to modules, |
---|
63 | # we don't have a way to test that directly. Instead we check that |
---|
64 | # $(TMPNAME) functionality is present which was added at roughly |
---|
65 | # the same time (more precisely it was added just before). |
---|
66 | { |
---|
67 | if ! $(TMPNAME) |
---|
68 | { |
---|
69 | ECHO "error: no @() functionality found" ; |
---|
70 | ECHO "error: your version of bjam is likely out of date" ; |
---|
71 | ECHO "error: please get a fresh version from CVS." ; |
---|
72 | EXIT ; |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | |
---|
77 | |
---|
78 | # Bootstrap the module system. Then bring the import rule into the global module. |
---|
79 | # |
---|
80 | SEARCH on <module@>modules.jam = $(.bootstrap-file:D) ; |
---|
81 | module modules { include <module@>modules.jam ; } |
---|
82 | IMPORT modules : import : : import ; |
---|
83 | |
---|
84 | { |
---|
85 | # Add module subdirectories to the BOOST_BUILD_PATH, which allows |
---|
86 | # us to make an incremental refactoring step by moving modules to |
---|
87 | # the appropriate subdirectories, thereby achieving some physical |
---|
88 | # separation of different layers without changing all of our code |
---|
89 | # to specify subdirectories in import statements or use an extra |
---|
90 | # level of qualification on imported names. |
---|
91 | |
---|
92 | local subdirs = |
---|
93 | kernel # only the most-intrinsic modules: modules, errors |
---|
94 | util # low-level substrate: string/number handling, etc. |
---|
95 | build # essential elements of the build system architecture |
---|
96 | tools # toolsets for handling specific build jobs and targets. |
---|
97 | |
---|
98 | new # until we get everything sorted out, there is |
---|
99 | # still some code here |
---|
100 | |
---|
101 | . # build-system.jam lives here |
---|
102 | |
---|
103 | ; |
---|
104 | local whereami = [ NORMALIZE_PATH $(.bootstrap-file:DT) ] ; |
---|
105 | BOOST_BUILD_PATH += $(whereami:D)/$(subdirs) ; |
---|
106 | |
---|
107 | modules.poke .ENVIRON : BOOST_BUILD_PATH : $(BOOST_BUILD_PATH) ; |
---|
108 | } |
---|
109 | |
---|
110 | # Reload the modules, to clean up things. The modules module can tolerate |
---|
111 | # being included twice. |
---|
112 | # |
---|
113 | import modules ; |
---|
114 | |
---|
115 | # Process option plugins first to alow them to prevent loading |
---|
116 | # the rest of the build system. |
---|
117 | # |
---|
118 | import option ; |
---|
119 | local dont-build = [ option.process ] ; |
---|
120 | |
---|
121 | # Should we skip building, i.e. loding the build system, according |
---|
122 | # to the options processed? |
---|
123 | # |
---|
124 | if ! $(dont-build) |
---|
125 | { |
---|
126 | # Allow users to override the build system file from the |
---|
127 | # command-line (mostly for testing) |
---|
128 | local build-system = [ MATCH --build-system=(.*) : $(ARGV) ] ; |
---|
129 | build-system ?= build-system ; |
---|
130 | |
---|
131 | # Use last element in case of multiple command-line options |
---|
132 | import $(build-system[-1]) ; |
---|
133 | } |
---|
134 | |
---|