mirror of
https://github.com/boostorg/build.git
synced 2026-01-19 04:02:14 +00:00
Do direct build system bootstrap loading.
This removes the use of the boost-build rule to direct the loading of the bootstrap.jam file. The file is now searched for directly based on the b2 executable location and other criteria. This makes the installed b2 the canonical way to use b2.
This commit is contained in:
@@ -181,8 +181,8 @@ feature.feature b2-install-layout : standard portable : incidental propagated ;
|
||||
|
||||
add-install-dir b2prefix-standard : : prefix ;
|
||||
add-install-dir b2bindir-standard : : bindir ;
|
||||
add-install-dir b2coredir-standard : boost-build/src : datarootdir ;
|
||||
add-install-dir b2examplesdir-standard : boost-build/examples : datarootdir ;
|
||||
add-install-dir b2coredir-standard : b2/src : datarootdir ;
|
||||
add-install-dir b2examplesdir-standard : b2/examples : datarootdir ;
|
||||
|
||||
add-install-dir b2prefix-portable : : prefix ;
|
||||
add-install-dir b2bindir-portable : : b2prefix-portable ;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# Copyright 2001, 2002 Dave Abrahams
|
||||
# Copyright 2002 Rene Rivera
|
||||
# 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)
|
||||
|
||||
|
||||
boost-build src/kernel ;
|
||||
@@ -16,7 +16,7 @@ $ b2 -dconsole
|
||||
Breakpoint 1 set at gcc.init
|
||||
(b2db) run
|
||||
Starting program: /usr/bin/b2
|
||||
Breakpoint 1, gcc.init ( ) at /usr/share/boost-build/tools/gcc.jam:74
|
||||
Breakpoint 1, gcc.init ( ) at /usr/share/b2/tools/gcc.jam:74
|
||||
74 local tool-command = ;
|
||||
(b2db) quit
|
||||
....
|
||||
|
||||
@@ -3,12 +3,23 @@
|
||||
|
||||
== Version 4.9.0
|
||||
|
||||
This release has mostly internal cleanups and restructuring. The most
|
||||
significant being: fixing all memory leaks, automatic build system
|
||||
startup with the `boost-build` rule.
|
||||
|
||||
* Add `minimal` and `debug` options for `optimization` feature.
|
||||
-- _René Ferdinand Rivera Morell_
|
||||
* Add Rocket Lake, Alder Lake, Sapphire Rapids and Zen 3 instruction sets.
|
||||
-- _Andrey Semashev_
|
||||
* Remove all, on-exit, memory leaks and fix all ASAN errors.
|
||||
-- _René Ferdinand Rivera Morell_
|
||||
* Remove use of `boost-build.jam` as a initialization configuration file.
|
||||
-- _René Ferdinand Rivera Morell_
|
||||
|
||||
WARNING: This release removes the use of `boost-build.jam` and the
|
||||
`boost-build` rule for initialization. The `boost-build.jam` is still
|
||||
searched for and loaded to not break existing operations. But is considered
|
||||
deprecated and will be removed in a future release.
|
||||
|
||||
== Version 4.8.2
|
||||
|
||||
|
||||
@@ -8,40 +8,20 @@
|
||||
=== Initialization
|
||||
|
||||
Immediately upon starting, the B2 engine (*`b2`*) loads the Jam
|
||||
code that implements the build system. To do this, it searches for a
|
||||
file called `boost-build.jam`, first in the invocation directory, then
|
||||
in its parent and so forth up to the filesystem root, and finally in the
|
||||
directories specified by the environment variable BOOST_BUILD_PATH. On
|
||||
Unix BOOST_BUILD_PATH defaults to `/usr/share/boost-build`. When
|
||||
found, the file is interpreted, and should specify the build system
|
||||
location by calling the boost-build rule:
|
||||
|
||||
[source]
|
||||
----
|
||||
rule boost-build ( location ? )
|
||||
----
|
||||
|
||||
If location is a relative path, it is treated as relative to the
|
||||
directory of `boost-build.jam`. The directory specified by that location
|
||||
and the directories in BOOST_BUILD_PATH are then searched for a file
|
||||
called `bootstrap.jam`, which is expected to bootstrap the build system.
|
||||
This arrangement allows the build system to work without any
|
||||
command-line or environment variable settings. For example, if the build
|
||||
system files were located in a directory "build-system/" at your project
|
||||
root, you might place a `boost-build.jam` at the project root
|
||||
containing:
|
||||
|
||||
[source]
|
||||
----
|
||||
boost-build build-system ;
|
||||
----
|
||||
|
||||
In this case, running *`b2`* anywhere in the project tree will
|
||||
automatically find the build system.
|
||||
code that implements the build system. To do this, it searches for the
|
||||
build system `bootstrap.jam` file in specific installation locations.
|
||||
The search is based on the location of the `b2(.exe)` executable
|
||||
location.
|
||||
|
||||
The default `bootstrap.jam`, after loading some standard definitions,
|
||||
loads both `site-config.jam` and `user-config.jam`.
|
||||
|
||||
NOTE: To maintain backward compatibility the file called
|
||||
`boost-build.jam`, is loaded if present. The search starts first in the
|
||||
invocation directory, then in its parent and so forth up to the filesystem
|
||||
root, and finally in the directories specified by the environment variable
|
||||
BOOST_BUILD_PATH. On Unix BOOST_BUILD_PATH defaults to `/usr/share/b2`.
|
||||
|
||||
[[bbv2.reference.rules]]
|
||||
== Builtin rules
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# 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 ;
|
||||
@@ -12,7 +12,7 @@ import numbers ;
|
||||
.minor = "9" ;
|
||||
|
||||
|
||||
rule boost-build ( )
|
||||
rule build ( )
|
||||
{
|
||||
return "$(.major).$(.minor)-git" ;
|
||||
}
|
||||
@@ -22,7 +22,7 @@ rule print ( )
|
||||
{
|
||||
if [ verify-engine-version ]
|
||||
{
|
||||
ECHO "B2" [ boost-build ] ;
|
||||
ECHO "B2" [ build ] ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ rule verify-engine-version ( )
|
||||
l = $(l:D) ;
|
||||
ECHO "warning: mismatched versions of B2 engine and core" ;
|
||||
ECHO "warning: B2 engine ($(e)) is $(v:J=.)" ;
|
||||
ECHO "warning: B2 core (at $(l)) is" [ boost-build ] ;
|
||||
ECHO "warning: B2 core (at $(l)) is" [ build ] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
# Boost library support module.
|
||||
#
|
||||
# This module allows to use the boost library from boost-build projects. The
|
||||
# This module allows to use the boost library from B2 projects. The
|
||||
# location of a boost source tree or the path to a pre-built version of the
|
||||
# library can be configured from either site-config.jam or user-config.jam. If
|
||||
# no location is configured the module looks for a BOOST_ROOT environment
|
||||
|
||||
@@ -189,7 +189,6 @@ set B2_CXXFLAGS=%B2_CXXFLAGS% -DNDEBUG
|
||||
@echo ON
|
||||
%B2_CXX% %CXXFLAGS% %B2_CXXFLAGS% %B2_SOURCES% %B2_CXX_LINK%
|
||||
dir *.exe
|
||||
copy /b .\b2.exe .\bjam.exe
|
||||
|
||||
:Finish
|
||||
@exit /b %ERRORLEVEL%
|
||||
|
||||
@@ -495,7 +495,6 @@ modules/set.cpp \
|
||||
else B2_CXXFLAGS="${B2_CXXFLAGS_RELEASE} -DNDEBUG"
|
||||
fi
|
||||
( B2_VERBOSE_OPT=${TRUE} echo_run ${B2_CXX} ${B2_CXXFLAGS} ${B2_SOURCES} -o b2 )
|
||||
( B2_VERBOSE_OPT=${TRUE} echo_run cp b2 bjam )
|
||||
}
|
||||
|
||||
if test_true ${B2_VERBOSE_OPT} ; then
|
||||
|
||||
@@ -43,100 +43,9 @@ void b2::startup::load_builtins()
|
||||
|
||||
LIST *b2::startup::builtin_boost_build(FRAME *frame, int flags)
|
||||
{
|
||||
b2::jam::list dir_arg{lol_get(frame->args, 0)};
|
||||
std::string dir;
|
||||
if (!dir_arg.empty()) dir = b2::jam::object(*dir_arg.begin());
|
||||
|
||||
b2::jam::variable dot_bootstrap_file{".bootstrap-file"};
|
||||
if (dot_bootstrap_file)
|
||||
{
|
||||
err_printf(
|
||||
"Error: Illegal attempt to re-bootstrap the build system by invoking\n"
|
||||
"\n"
|
||||
" 'boost-build '%s' ;\n"
|
||||
"\n"
|
||||
"Please consult the documentation at "
|
||||
"'https://www.bfgroup.xyz/b2/'.\n\n",
|
||||
dir.c_str());
|
||||
return L0;
|
||||
}
|
||||
|
||||
// # Add the given directory to the path so we can find the build system. If
|
||||
// # dir is empty, has no effect.
|
||||
b2::jam::variable dot_boost_build_file{".boost-build-file"};
|
||||
b2::jam::list dot_boost_build_file_val{static_cast<b2::jam::list>(dot_boost_build_file)};
|
||||
std::string boost_build_jam = b2::jam::object{*dot_boost_build_file_val.begin()};
|
||||
std::string boost_build_dir;
|
||||
if (b2::paths::is_rooted(dir))
|
||||
boost_build_dir = dir;
|
||||
else
|
||||
boost_build_dir = b2::paths::normalize(
|
||||
std::string{boost_build_jam}+"/../"+dir);
|
||||
b2::jam::list search_path{b2::jam::object{boost_build_dir}};
|
||||
b2::jam::variable BOOST_BUILD_PATH{"BOOST_BUILD_PATH"};
|
||||
search_path.append(BOOST_BUILD_PATH);
|
||||
|
||||
// We set the global, and env, BOOST_BUILD_PATH so that the loading of the
|
||||
// build system finds the initial set of modules needed for starting it up.
|
||||
BOOST_BUILD_PATH = search_path;
|
||||
|
||||
// The code that loads the rest of B2, in particular the site-config.jam
|
||||
// and user-config.jam configuration files uses os.environ, so we need to
|
||||
// update the value there.
|
||||
b2::jam::variable dot_ENVIRON__BOOST_BUILD_PATH{".ENVIRON", "BOOST_BUILD_PATH"};
|
||||
dot_ENVIRON__BOOST_BUILD_PATH = search_path;
|
||||
|
||||
// # Try to find the build system bootstrap file 'bootstrap.jam'.
|
||||
std::string bootstrap_file;
|
||||
for (auto path: search_path)
|
||||
{
|
||||
std::string file = b2::jam::object{path};
|
||||
file = b2::paths::normalize(file+"/bootstrap.jam");
|
||||
if (b2::filesys::is_file(file))
|
||||
{
|
||||
bootstrap_file = file;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// # There is no bootstrap.jam we can find, exit with an error.
|
||||
if (bootstrap_file.empty())
|
||||
{
|
||||
err_printf(
|
||||
"Unable to load B2: could not find build system.\n"
|
||||
"-----------------------------------------------\n"
|
||||
"%s attempted to load the build system by invoking\n"
|
||||
"\n"
|
||||
" 'boost-build %s ;'\n"
|
||||
"\n"
|
||||
"but we were unable to find 'bootstrap.jam' in the specified directory "
|
||||
"or in BOOST_BUILD_PATH:\n",
|
||||
boost_build_jam.c_str(), dir.c_str());
|
||||
for (auto path: search_path)
|
||||
{
|
||||
std::string file = b2::jam::object{path};
|
||||
err_printf(" %s\n", file.c_str());
|
||||
}
|
||||
err_puts(
|
||||
"Please consult the documentation at "
|
||||
"'https://www.bfgroup.xyz/b2/'.\n\n");
|
||||
return L0;
|
||||
}
|
||||
|
||||
// Set the bootstrap=file var as it's used by the build system to refer to
|
||||
// the rest of the build system files.
|
||||
dot_bootstrap_file = b2::jam::list{b2::jam::object{bootstrap_file}};
|
||||
|
||||
// Show where we found it, if asked.
|
||||
b2::jam::variable dot_OPTION__debug_configuration{".OPTION", "debug-configration"};
|
||||
if (dot_OPTION__debug_configuration)
|
||||
{
|
||||
out_printf("notice: loading B2 from %s\n", bootstrap_file.c_str());
|
||||
}
|
||||
|
||||
// # Load the build system, now that we know where to start from.
|
||||
parse_file(b2::jam::object{bootstrap_file}, frame);
|
||||
|
||||
// Do nothing, but keep the rule, for backwards compatability.
|
||||
// But do record the path passed in as a fallback to the loading.
|
||||
b2::jam::variable(".boost-build-dir") = b2::jam::list(lol_get(frame->args, 0));
|
||||
return L0;
|
||||
}
|
||||
|
||||
@@ -156,16 +65,25 @@ bool b2::startup::bootstrap(FRAME *frame)
|
||||
}
|
||||
}
|
||||
|
||||
// We use the executable path as a root for searches.
|
||||
char *b2_exe_path_pchar = executable_path(saved_argv0);
|
||||
const std::string b2_exe_path{b2_exe_path_pchar};
|
||||
if (b2_exe_path_pchar)
|
||||
{
|
||||
std::free(b2_exe_path_pchar);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for a boost-build.jam file to load in various locations. This is
|
||||
* solely for backwards compatiblity. The boost-build.jam file found is
|
||||
* loaded, but the `boost-build` invocation in it is ignored.
|
||||
*/
|
||||
|
||||
const std::string boost_build_jam{"boost-build.jam"};
|
||||
std::string b2_file_path;
|
||||
|
||||
// Attempt to find the `boost-build.jam` boot file in work directory tree.
|
||||
// I.e. in current directory and ancestor directories.
|
||||
if (b2_file_path.empty())
|
||||
{
|
||||
std::string work_dir{b2::paths::normalize(b2::cwd_str()) + "/"};
|
||||
@@ -187,6 +105,7 @@ bool b2::startup::bootstrap(FRAME *frame)
|
||||
}
|
||||
|
||||
// Check relative to the executable for portable install location.
|
||||
// ~b2(.exe)/.b2/kernel/boost-build.jam
|
||||
if (b2_file_path.empty())
|
||||
{
|
||||
const std::string path{
|
||||
@@ -197,16 +116,19 @@ bool b2::startup::bootstrap(FRAME *frame)
|
||||
}
|
||||
|
||||
// Check relative to the executable for portable install location.
|
||||
// /usr/share/b2/src/kernel/boost-build.jam
|
||||
if (b2_file_path.empty())
|
||||
{
|
||||
const std::string path{
|
||||
b2::paths::normalize(
|
||||
b2_exe_path + "/../../share/boost-build/src/kernel/" + boost_build_jam)};
|
||||
b2_exe_path + "/../../share/b2/src/kernel/" + boost_build_jam)};
|
||||
if (b2::filesys::is_file(path))
|
||||
b2_file_path = path;
|
||||
}
|
||||
|
||||
// Check the BOOST_BUILD_PATH (and BOOST_ROOT) paths.
|
||||
// $(BOOST_BUILD_PATH)/boost-build.jam
|
||||
// $(BOOST_ROOT)/boost-build.jam
|
||||
if (b2_file_path.empty())
|
||||
{
|
||||
b2::jam::list BOOST_BUILD_PATH = b2::jam::variable{"BOOST_BUILD_PATH"};
|
||||
@@ -224,47 +146,132 @@ bool b2::startup::bootstrap(FRAME *frame)
|
||||
}
|
||||
}
|
||||
|
||||
// Indicate a load failure when we can't find the build file.
|
||||
if (b2_file_path.empty())
|
||||
{
|
||||
const char * not_found_error =
|
||||
"Unable to load B2: could not find 'boost-build.jam'\n"
|
||||
"---------------------------------------------------\n"
|
||||
"Attempted search from '%s' up to the root "
|
||||
"at '%s'\n"
|
||||
"Please consult the documentation at "
|
||||
"'https://www.bfgroup.xyz/b2/'.\n\n";
|
||||
err_printf(not_found_error, b2::cwd_str().c_str(), b2_exe_path.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Show where we found it, if asked.
|
||||
if (dot_OPTION__debug_configuration)
|
||||
if (!b2_file_path.empty() && dot_OPTION__debug_configuration)
|
||||
{
|
||||
out_printf("notice: found boost-build.jam at %s\n", b2_file_path.c_str());
|
||||
}
|
||||
|
||||
// Load the build system bootstrap file we found. But check we did that.
|
||||
b2::jam::variable dot_boost_build_file{".boost-build-file"};
|
||||
dot_boost_build_file = b2_file_path;
|
||||
b2::jam::object b2_file_path_sym{b2_file_path};
|
||||
parse_file(b2_file_path_sym, frame);
|
||||
b2::jam::list dot_dot_bootstrap_file_val = b2::jam::variable{".bootstrap-file"};
|
||||
if (dot_dot_bootstrap_file_val.empty())
|
||||
// Load the boost-build file if we find it for backwards compatability. We ignore
|
||||
// the `boost-build ..` invocation it does. Preferring to find our own bootstrap
|
||||
// engine file.
|
||||
if (!b2_file_path.empty())
|
||||
{
|
||||
b2::jam::variable dot_boost_build_file{".boost-build-file"};
|
||||
dot_boost_build_file = b2_file_path;
|
||||
b2::jam::object b2_file_path_sym{b2_file_path};
|
||||
parse_file(b2_file_path_sym, frame);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for a bootstrap.jam file to load in various locations. The
|
||||
* `bootstrap.jam` is the starting point of loading the build system.
|
||||
*/
|
||||
|
||||
const std::string bootstrap_jam{"bootstrap.jam"};
|
||||
std::string bootstrap_file;
|
||||
std::string bootstrap_files_searched;
|
||||
|
||||
// Check various locations relative to executable.
|
||||
if (bootstrap_file.empty())
|
||||
{
|
||||
const char * dirs[] = {
|
||||
// Check relative to the executable for portable install location.
|
||||
".b2/kernel/",
|
||||
// Check relative to the exec for system install location.
|
||||
"../share/b2/kernel/",
|
||||
// Check relative to the exec for legacy install location.
|
||||
"../share/b2/src/kernel/",
|
||||
// Check development location relative to executable in src/engine.
|
||||
"../kernel/",
|
||||
// Check development location relative to executable at root.
|
||||
"src/kernel/",
|
||||
// Check for special Boost location.
|
||||
"tools/build/src/kernel/"
|
||||
};
|
||||
for (auto dir: dirs)
|
||||
{
|
||||
const std::string path{
|
||||
b2::paths::normalize(
|
||||
b2_exe_path + "/../" + dir + bootstrap_jam)};
|
||||
if (b2::filesys::is_file(path))
|
||||
{
|
||||
bootstrap_file = path;
|
||||
break;
|
||||
}
|
||||
bootstrap_files_searched += " " + path + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Check the development tree for the bootstrap to support not-installed
|
||||
// b2 executable locations. I.e. when building b2 with b2 for engine
|
||||
// development.
|
||||
if (bootstrap_file.empty())
|
||||
{
|
||||
std::string work_dir(b2::paths::normalize(b2_exe_path + "/../"));
|
||||
while (bootstrap_file.empty() && !work_dir.empty())
|
||||
{
|
||||
bootstrap_files_searched += " " + work_dir + "src/kernel/" + bootstrap_jam + "\n";
|
||||
if (b2::filesys::is_file(work_dir + "src/kernel/" + bootstrap_jam))
|
||||
bootstrap_file = work_dir + "src/kernel/" + bootstrap_jam;
|
||||
else if (work_dir.length() == 1 && work_dir[0] == '/')
|
||||
work_dir.clear();
|
||||
else
|
||||
{
|
||||
auto parent_pos = work_dir.rfind('/', work_dir.length() - 2);
|
||||
if (parent_pos != std::string::npos)
|
||||
work_dir.erase(parent_pos + 1);
|
||||
else
|
||||
work_dir.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Last resort, search in the directory referenced by the boost-build rule.
|
||||
if (bootstrap_file.empty())
|
||||
{
|
||||
b2::jam::list dot_boost_build_dir
|
||||
= b2::jam::variable(".boost-build-dir");
|
||||
if (!dot_boost_build_dir.empty())
|
||||
{
|
||||
std::string dir = b2::jam::object(*dot_boost_build_dir.begin());
|
||||
if (!b2_file_path.empty() && b2::paths::is_relative(dir))
|
||||
dir = b2_file_path + "/../" + dir;
|
||||
const std::string path
|
||||
= b2::paths::normalize(dir + "/" + bootstrap_jam);
|
||||
bootstrap_files_searched += " " + path + "\n";
|
||||
if (b2::filesys::is_file(path))
|
||||
bootstrap_file = path;
|
||||
}
|
||||
}
|
||||
|
||||
// Failed to find the build files to load.
|
||||
if (bootstrap_file.empty())
|
||||
{
|
||||
err_printf(
|
||||
"Unable to load B2\n"
|
||||
"-----------------\n"
|
||||
"'%s' was found by searching from %s up to the root.\n"
|
||||
"\n"
|
||||
"However, it failed to call the 'boost-build' rule to indicate "
|
||||
"the location of the build system.\n"
|
||||
"\n"
|
||||
"No 'bootstrap.jam' was found by searching for:\n"
|
||||
"%s\n"
|
||||
"Please consult the documentation at "
|
||||
"'https://www.bfgroup.xyz/b2/'.\n\n",
|
||||
b2_file_path.c_str(), b2::cwd_str().c_str());
|
||||
bootstrap_files_searched.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Show where we found the bootstrap, if asked.
|
||||
if (!bootstrap_file.empty() && dot_OPTION__debug_configuration)
|
||||
{
|
||||
out_printf("notice: loading B2 from %s\n", bootstrap_file.c_str());
|
||||
}
|
||||
|
||||
// Set the bootstrap=file var as it's used by the build system to refer to
|
||||
// the rest of the build system files.
|
||||
b2::jam::variable dot_bootstrap_file{".bootstrap-file"};
|
||||
dot_bootstrap_file = b2::jam::list{b2::jam::object{bootstrap_file}};
|
||||
|
||||
// Load the build system bootstrap file we found.
|
||||
parse_file(b2::jam::object{bootstrap_file}, frame);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# Copyright 2003 Dave Abrahams
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
|
||||
boost-build . ;
|
||||
@@ -1,14 +0,0 @@
|
||||
# Copyright 2002, 2003 Dave Abrahams
|
||||
# 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)
|
||||
|
||||
# Assume BOOST_BUILD_PATH point to the 'test' directory.
|
||||
# We need to leave 'test' there, so that 'test-config.jam'
|
||||
# can be found, but also add parent directory, to find
|
||||
# all the other modules.
|
||||
|
||||
BOOST_BUILD_PATH = $(BOOST_BUILD_PATH)/.. $(BOOST_BUILD_PATH) ;
|
||||
|
||||
# Find the boost build system in the ../kernel directory.
|
||||
boost-build ../src/kernel ;
|
||||
@@ -346,8 +346,7 @@ def test_global_config():
|
||||
t.write("project-config.jam", "ECHO bad ;")
|
||||
t.run_build_system(["--config=my-config.jam", "--debug-configuration"],
|
||||
match=TestCmd.match_re, stdout=
|
||||
r"""notice: found boost-build\.jam at .*
|
||||
notice: loading B2 from .*
|
||||
r"""notice: loading B2 from .*
|
||||
notice: Searching '.*' for all-config configuration file 'my-config\.jam'\.
|
||||
notice: Loading all-config configuration file 'my-config\.jam' from '.*'\.
|
||||
Loading my-config
|
||||
@@ -357,8 +356,7 @@ Done
|
||||
""")
|
||||
t.run_build_system(["--config=", "--debug-configuration"],
|
||||
match=TestCmd.match_re, stdout=
|
||||
r"""notice: found boost-build\.jam at .*
|
||||
notice: loading B2 from .*
|
||||
r"""notice: loading B2 from .*
|
||||
notice: Configuration file loading explicitly disabled.
|
||||
Done
|
||||
""")
|
||||
|
||||
@@ -13,10 +13,9 @@ import BoostBuild
|
||||
import os
|
||||
import re
|
||||
|
||||
t = BoostBuild.Tester(["-d+1"], pass_toolset=0)
|
||||
t = BoostBuild.Tester(["-d+1", "-f", "bare.jam"], pass_toolset=0)
|
||||
|
||||
t.write("boost-build.jam", "boost-build . ;")
|
||||
t.write("bootstrap.jam", """\
|
||||
t.write("bare.jam", """\
|
||||
# Top-level rule causing a target to be built by invoking the specified action.
|
||||
rule make ( target : sources * : act )
|
||||
{
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# Copyright 2002 Dave Abrahams
|
||||
# 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)
|
||||
|
||||
# Emulate v1 behavior; with the boost-build file in the boost root directory.
|
||||
boost-build build ;
|
||||
@@ -1,6 +0,0 @@
|
||||
# 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)
|
||||
|
||||
# The presence of this file emulates the Boost 1.27.0 release
|
||||
include $(BOOST_ROOT)/tools/build/bootstrap.jam ;
|
||||
@@ -1,7 +0,0 @@
|
||||
# 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)
|
||||
|
||||
ECHO build system bootstrapped ;
|
||||
DEPENDS all : nothing ;
|
||||
NOTFILE nothing ;
|
||||
@@ -1,5 +0,0 @@
|
||||
# Copyright 2002 Dave Abrahams
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
|
||||
boost-build ;
|
||||
@@ -1,6 +0,0 @@
|
||||
# Copyright 2002 Dave Abrahams
|
||||
# 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)
|
||||
|
||||
boost-build ../boost-root/build ;
|
||||
@@ -1,5 +0,0 @@
|
||||
Copyright 2002 Dave Abrahams
|
||||
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 here so that cvs update -P won't fail to create a directory
|
||||
@@ -1,6 +0,0 @@
|
||||
# Copyright 2002 Dave Abrahams
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
|
||||
# Bootstrap file not found via implicit lookup in BOOST_BUILD_PATH
|
||||
boost-build ;
|
||||
@@ -1,5 +0,0 @@
|
||||
Copyright 2002 Dave Abrahams
|
||||
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 here so cvs update -P will create the directory.
|
||||
@@ -1,6 +0,0 @@
|
||||
# Copyright 2002 Dave Abrahams
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
|
||||
# Bootstrap file not found via explicit lookup in .
|
||||
boost-build . ;
|
||||
@@ -1,5 +0,0 @@
|
||||
# Copyright 2002 Dave Abrahams
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
|
||||
|
||||
# Call to boost-build is intentionally missing
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright 2002 Dave Abrahams
|
||||
# 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)
|
||||
|
||||
import BoostBuild
|
||||
import os.path
|
||||
import re
|
||||
|
||||
|
||||
def check_for_existing_boost_build_jam(t):
|
||||
"""
|
||||
This test depends on no boost-build.jam file existing in any of the
|
||||
folders along the current folder's path. If it does exist, not only would
|
||||
this test fail but it could point to a completely wrong Boost Build
|
||||
installation, thus causing headaches when attempting to diagnose the
|
||||
problem. That is why we explicitly check for this scenario.
|
||||
|
||||
"""
|
||||
problem = find_up_to_root(t.workdir, "boost-build.jam")
|
||||
if problem:
|
||||
BoostBuild.annotation("misconfiguration", """\
|
||||
This test expects to be run from a folder with no 'boost-build.jam' file in any
|
||||
of the folders along its path.
|
||||
|
||||
Working folder:
|
||||
'%s'
|
||||
|
||||
Problematic boost-build.jam found at:
|
||||
'%s'
|
||||
|
||||
Please remove this file or change the test's working folder and rerun the test.
|
||||
""" % (t.workdir, problem))
|
||||
t.fail_test(1, dump_stdio=False, dump_stack=False)
|
||||
|
||||
|
||||
def find_up_to_root(folder, name):
|
||||
last = ""
|
||||
while last != folder:
|
||||
candidate = os.path.join(folder, name)
|
||||
if os.path.exists(candidate):
|
||||
return candidate
|
||||
last = folder
|
||||
folder = os.path.dirname(folder)
|
||||
|
||||
|
||||
def match_re(actual, expected):
|
||||
return re.match(expected, actual, re.DOTALL) != None
|
||||
|
||||
|
||||
t = BoostBuild.Tester(match=match_re, boost_build_path="", pass_toolset=0)
|
||||
t.set_tree("startup")
|
||||
check_for_existing_boost_build_jam(t)
|
||||
|
||||
t.run_build_system(status=1, stderr=
|
||||
r"""Unable to load B2: could not find 'boost-build\.jam'
|
||||
.*Attempted search from .* up to the root at '.*'""")
|
||||
|
||||
t.run_build_system(status=1, subdir="no-bootstrap1",
|
||||
stderr=
|
||||
r"""Unable to load B2: could not find build system\.
|
||||
-----------------------------------------------
|
||||
.*attempted to load the build system by invoking
|
||||
.*'boost-build ;'
|
||||
.*but we were unable to find 'bootstrap\.jam' in the specified directory or in BOOST_BUILD_PATH:""")
|
||||
|
||||
# Descend to a subdirectory which /does not/ contain a boost-build.jam file,
|
||||
# and try again to test the crawl-up behavior.
|
||||
t.run_build_system(status=1, subdir=os.path.join("no-bootstrap1", "subdir"),
|
||||
stderr=r"Unable to load B2: could not find build system\."
|
||||
r".*attempted to load the build system by invoking"
|
||||
r".*'boost-build ;'"
|
||||
r".*but we were unable to find 'bootstrap\.jam' in the specified directory or in BOOST_BUILD_PATH:")
|
||||
|
||||
t.run_build_system(status=1, subdir="no-bootstrap2",
|
||||
stderr=r"Unable to load B2: could not find build system\."
|
||||
r".*attempted to load the build system by invoking"
|
||||
r".*'boost-build \. ;'"
|
||||
r".*but we were unable to find 'bootstrap\.jam' in the specified directory or in BOOST_BUILD_PATH:")
|
||||
|
||||
t.run_build_system(status=1, subdir='no-bootstrap3', stderr=
|
||||
r"""Unable to load B2
|
||||
.*boost-build\.jam' was found.*
|
||||
However, it failed to call the 'boost-build' rule to indicate the location of the build system.""")
|
||||
|
||||
# Test bootstrapping based on BOOST_BUILD_PATH.
|
||||
t.run_build_system(["-sBOOST_BUILD_PATH=../boost-root/build"],
|
||||
subdir="bootstrap-env", stdout="build system bootstrapped")
|
||||
|
||||
# Test bootstrapping based on an explicit path in boost-build.jam.
|
||||
t.run_build_system(subdir="bootstrap-explicit",
|
||||
stdout="build system bootstrapped")
|
||||
|
||||
t.cleanup()
|
||||
@@ -154,7 +154,7 @@ def reorder_tests(tests, first_test):
|
||||
return tests
|
||||
|
||||
|
||||
critical_tests = ["unit_tests", "module_actions", "startup_v2", "core_d12",
|
||||
critical_tests = ["unit_tests", "module_actions", "core_d12",
|
||||
"core_typecheck", "core_delete_module", "core_language", "core_arguments",
|
||||
"core_varnames", "core_import_module"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user