aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-08-24 16:37:29 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-08-28 15:01:48 +0300
commitea24f530048cbce0c5335ca3fd3632c8ce34315a (patch)
tree3f7153cad1c3e34da5e992fe53db104512d7af71
parentd07521c67db21aa02dddf9615dce9f9f3dfe784c (diff)
Move bin build system module to separate library
-rw-r--r--bootstrap-mingw.bat2
-rw-r--r--bootstrap-msvc.bat2
-rw-r--r--bootstrap.gmake2
-rwxr-xr-xbootstrap.sh2
-rw-r--r--build2/b.cxx13
-rw-r--r--build2/bin/init.hxx100
-rw-r--r--build2/buildfile2
-rw-r--r--build2/cc/common.hxx2
-rw-r--r--build2/cc/compile-rule.cxx2
-rw-r--r--build2/cc/gcc.cxx2
-rw-r--r--build2/cc/install-rule.cxx2
-rw-r--r--build2/cc/link-rule.cxx2
-rw-r--r--build2/cc/module.cxx2
-rw-r--r--build2/cc/msvc.cxx2
-rw-r--r--build2/cc/pkgconfig.cxx2
-rw-r--r--build2/cc/utility.cxx4
-rw-r--r--build2/cc/utility.hxx2
-rw-r--r--build2/cc/windows-rpath.cxx2
-rw-r--r--libbuild2/bash/export.hxx4
-rw-r--r--libbuild2/bin/buildfile69
-rw-r--r--libbuild2/bin/export.hxx38
-rw-r--r--libbuild2/bin/guess.cxx (renamed from build2/bin/guess.cxx)4
-rw-r--r--libbuild2/bin/guess.hxx (renamed from build2/bin/guess.hxx)8
-rw-r--r--libbuild2/bin/init.cxx (renamed from build2/bin/init.cxx)31
-rw-r--r--libbuild2/bin/init.hxx40
-rw-r--r--libbuild2/bin/rule.cxx (renamed from build2/bin/rule.cxx)4
-rw-r--r--libbuild2/bin/rule.hxx (renamed from build2/bin/rule.hxx)12
-rw-r--r--libbuild2/bin/target.cxx (renamed from build2/bin/target.cxx)4
-rw-r--r--libbuild2/bin/target.hxx (renamed from build2/bin/target.hxx)70
-rw-r--r--libbuild2/buildfile2
-rw-r--r--libbuild2/export.hxx4
-rw-r--r--libbuild2/in/export.hxx4
-rw-r--r--libbuild2/module.cxx1
-rw-r--r--libbuild2/version/export.hxx4
-rw-r--r--tests/libbuild2/buildfile2
-rw-r--r--tests/libbuild2/driver.cxx2
36 files changed, 271 insertions, 179 deletions
diff --git a/bootstrap-mingw.bat b/bootstrap-mingw.bat
index 46eb0a4..7fb8ec3 100644
--- a/bootstrap-mingw.bat
+++ b/bootstrap-mingw.bat
@@ -61,7 +61,6 @@ if "_%libbutl%_" == "__" (
rem All the source directories.
rem
set "src=build2"
-set "src=%src% build2\bin"
set "src=%src% build2\c"
set "src=%src% build2\cc"
set "src=%src% build2\cxx"
@@ -72,6 +71,7 @@ set "src=%src% libbuild2\dist"
set "src=%src% libbuild2\test"
set "src=%src% libbuild2\test\script"
set "src=%src% libbuild2\install"
+set "src=%src% libbuild2\bin"
set "src=%src% libbuild2\version"
set "src=%src% libbuild2\in"
diff --git a/bootstrap-msvc.bat b/bootstrap-msvc.bat
index 9fed752..4341098 100644
--- a/bootstrap-msvc.bat
+++ b/bootstrap-msvc.bat
@@ -92,7 +92,6 @@ if "_%libbutl%_" == "__" (
rem All the source directories.
rem
set "src=build2"
-set "src=%src% build2\bin"
set "src=%src% build2\c"
set "src=%src% build2\cc"
set "src=%src% build2\cxx"
@@ -103,6 +102,7 @@ set "src=%src% libbuild2\dist"
set "src=%src% libbuild2\test"
set "src=%src% libbuild2\test\script"
set "src=%src% libbuild2\install"
+set "src=%src% libbuild2\bin"
set "src=%src% libbuild2\version"
set "src=%src% libbuild2\in"
diff --git a/bootstrap.gmake b/bootstrap.gmake
index 6a2ca69..c27a965 100644
--- a/bootstrap.gmake
+++ b/bootstrap.gmake
@@ -130,7 +130,6 @@ endif
# Note: list nested subdirectories first (used in clean).
#
build2_sub := \
-bin \
c \
cc \
cxx
@@ -141,6 +140,7 @@ dist \
test/script \
test \
install \
+bin \
version \
in
diff --git a/bootstrap.sh b/bootstrap.sh
index 6eb570f..3614e93 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -117,7 +117,6 @@ if test -z "$libbutl"; then
fi
src="build2/*.cxx"
-src="$src build2/bin/*.cxx"
src="$src build2/c/*.cxx"
src="$src build2/cc/*.cxx"
src="$src build2/cxx/*.cxx"
@@ -128,6 +127,7 @@ src="$src libbuild2/dist/*.cxx"
src="$src libbuild2/test/*.cxx"
src="$src libbuild2/test/script/*.cxx"
src="$src libbuild2/install/*.cxx"
+src="$src libbuild2/bin/*.cxx"
src="$src libbuild2/version/*.cxx"
src="$src libbuild2/in/*.cxx"
diff --git a/build2/b.cxx b/build2/b.cxx
index 27a9cd0..78f6248 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -53,6 +53,7 @@
#include <libbuild2/install/init.hxx>
#include <libbuild2/in/init.hxx>
+#include <libbuild2/bin/init.hxx>
#include <libbuild2/version/init.hxx>
#ifndef BUILD2_BOOTSTRAP
@@ -61,7 +62,6 @@
# include <build2/cli/init.hxx>
#endif
-#include <build2/bin/init.hxx>
#include <build2/c/init.hxx>
#include <build2/cc/init.hxx>
#include <build2/cxx/init.hxx>
@@ -519,19 +519,10 @@ main (int argc, char* argv[])
load (&test::build2_test_load);
load (&install::build2_install_load);
+ load (&bin::build2_bin_load);
load (&version::build2_version_load);
load (&in::build2_in_load);
- TMP_LOAD (bin_vars, "bin.vars", bin::vars_init);
- TMP_LOAD (bin_config, "bin.config", bin::config_init);
- TMP_LOAD (bin, "bin", bin::init);
- TMP_LOAD (bin_ar_config, "bin.ar.config", bin::ar_config_init);
- TMP_LOAD (bin_ar, "bin.ar", bin::ar_init);
- TMP_LOAD (bin_ld_config, "bin.ld.config", bin::ld_config_init);
- TMP_LOAD (bin_ld, "bin.ld", bin::ld_init);
- TMP_LOAD (bin_rc_config, "bin.rc.config", bin::rc_config_init);
- TMP_LOAD (bin_rc, "bin.rc", bin::rc_init);
-
TMP_LOAD (cc_core_vars, "cc.core.vars", cc::core_vars_init);
TMP_LOAD (cc_core_guess, "cc.core.guess", cc::core_guess_init);
TMP_LOAD (cc_core_config, "cc.core.config", cc::core_config_init);
diff --git a/build2/bin/init.hxx b/build2/bin/init.hxx
deleted file mode 100644
index 989dcaf..0000000
--- a/build2/bin/init.hxx
+++ /dev/null
@@ -1,100 +0,0 @@
-// file : build2/bin/init.hxx -*- C++ -*-
-// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
-// license : MIT; see accompanying LICENSE file
-
-#ifndef BUILD2_BIN_INIT_HXX
-#define BUILD2_BIN_INIT_HXX
-
-#include <libbuild2/types.hxx>
-#include <libbuild2/utility.hxx>
-
-#include <libbuild2/module.hxx>
-
-namespace build2
-{
- namespace bin
- {
- bool
- vars_init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&);
-
- bool
- config_init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&);
-
- bool
- init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&);
-
- bool
- ar_config_init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&);
-
- bool
- ar_init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&);
-
- bool
- ld_config_init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&);
-
- bool
- ld_init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&);
-
- bool
- rc_config_init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&);
-
- bool
- rc_init (scope&,
- scope&,
- const location&,
- unique_ptr<module_base>&,
- bool,
- bool,
- const variable_map&);
- }
-}
-
-#endif // BUILD2_BIN_INIT_HXX
diff --git a/build2/buildfile b/build2/buildfile
index 196c485..1f956a3 100644
--- a/build2/buildfile
+++ b/build2/buildfile
@@ -8,7 +8,7 @@ import libs += libpkgconf%lib{pkgconf}
include ../libbuild2/
libs += ../libbuild2/lib{build2}
-for m: bash in version
+for m: bash bin in version
{
include ../libbuild2/$m/
libs += ../libbuild2/$m/lib{build2-$m}
diff --git a/build2/cc/common.hxx b/build2/cc/common.hxx
index b24eb7d..527c31a 100644
--- a/build2/cc/common.hxx
+++ b/build2/cc/common.hxx
@@ -11,7 +11,7 @@
#include <libbuild2/context.hxx>
#include <libbuild2/variable.hxx>
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/target.hxx>
#include <build2/cc/types.hxx>
#include <build2/cc/guess.hxx> // compiler_id
diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx
index fa43533..5d4c838 100644
--- a/build2/cc/compile-rule.cxx
+++ b/build2/cc/compile-rule.cxx
@@ -18,7 +18,7 @@
#include <libbuild2/config/utility.hxx> // create_project()
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/target.hxx>
#include <build2/cc/parser.hxx>
#include <build2/cc/target.hxx> // h
diff --git a/build2/cc/gcc.cxx b/build2/cc/gcc.cxx
index e6d7101..a979b2d 100644
--- a/build2/cc/gcc.cxx
+++ b/build2/cc/gcc.cxx
@@ -8,7 +8,7 @@
#include <libbuild2/filesystem.hxx>
#include <libbuild2/diagnostics.hxx>
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/target.hxx>
#include <build2/cc/types.hxx>
diff --git a/build2/cc/install-rule.cxx b/build2/cc/install-rule.cxx
index 9e52501..876e780 100644
--- a/build2/cc/install-rule.cxx
+++ b/build2/cc/install-rule.cxx
@@ -6,7 +6,7 @@
#include <libbuild2/algorithm.hxx>
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/target.hxx>
#include <build2/cc/utility.hxx>
#include <build2/cc/link-rule.hxx> // match()
diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx
index ce5fce9..adf76d1 100644
--- a/build2/cc/link-rule.cxx
+++ b/build2/cc/link-rule.cxx
@@ -18,7 +18,7 @@
#include <libbuild2/filesystem.hxx>
#include <libbuild2/diagnostics.hxx>
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/target.hxx>
#include <build2/cc/target.hxx> // c, pc*
#include <build2/cc/utility.hxx>
diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx
index bd853cc..478cabe 100644
--- a/build2/cc/module.cxx
+++ b/build2/cc/module.cxx
@@ -9,7 +9,7 @@
#include <libbuild2/scope.hxx>
#include <libbuild2/diagnostics.hxx>
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/target.hxx>
#include <build2/cc/target.hxx> // pc*
diff --git a/build2/cc/msvc.cxx b/build2/cc/msvc.cxx
index 7d8c3f5..886975a 100644
--- a/build2/cc/msvc.cxx
+++ b/build2/cc/msvc.cxx
@@ -11,7 +11,7 @@
#include <libbuild2/filesystem.hxx>
#include <libbuild2/diagnostics.hxx>
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/target.hxx>
#include <build2/cc/types.hxx>
diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx
index 3b4c711..0ebf818 100644
--- a/build2/cc/pkgconfig.cxx
+++ b/build2/cc/pkgconfig.cxx
@@ -19,7 +19,7 @@
#include <libbuild2/install/utility.hxx>
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/target.hxx>
#include <build2/cc/types.hxx>
#include <build2/cc/target.hxx> // pc
diff --git a/build2/cc/utility.cxx b/build2/cc/utility.cxx
index e9d4ce3..f17d1b0 100644
--- a/build2/cc/utility.cxx
+++ b/build2/cc/utility.cxx
@@ -8,8 +8,8 @@
#include <libbuild2/variable.hxx>
#include <libbuild2/algorithm.hxx> // search()
-#include <build2/bin/rule.hxx>
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/rule.hxx>
+#include <libbuild2/bin/target.hxx>
using namespace std;
diff --git a/build2/cc/utility.hxx b/build2/cc/utility.hxx
index 6222b5f..002dea7 100644
--- a/build2/cc/utility.hxx
+++ b/build2/cc/utility.hxx
@@ -9,7 +9,7 @@
#include <libbuild2/utility.hxx>
#include <libbuild2/target.hxx>
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/target.hxx>
#include <build2/cc/types.hxx>
diff --git a/build2/cc/windows-rpath.cxx b/build2/cc/windows-rpath.cxx
index 4478f7d..c4ef358 100644
--- a/build2/cc/windows-rpath.cxx
+++ b/build2/cc/windows-rpath.cxx
@@ -11,7 +11,7 @@
#include <libbuild2/filesystem.hxx>
#include <libbuild2/diagnostics.hxx>
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/target.hxx>
#include <build2/cc/link-rule.hxx>
diff --git a/libbuild2/bash/export.hxx b/libbuild2/bash/export.hxx
index d87e677..f971b2a 100644
--- a/libbuild2/bash/export.hxx
+++ b/libbuild2/bash/export.hxx
@@ -1,3 +1,7 @@
+// file : libbuild2/bash/export.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
#pragma once
// Normally we don't export class templates (but do complete specializations),
diff --git a/libbuild2/bin/buildfile b/libbuild2/bin/buildfile
new file mode 100644
index 0000000..e490214
--- /dev/null
+++ b/libbuild2/bin/buildfile
@@ -0,0 +1,69 @@
+# file : libbuild2/bin/buildfile
+# copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+import int_libs = libbutl%lib{butl}
+
+include ../
+int_libs += ../lib{build2}
+
+./: lib{build2-bin}: libul{build2-bin}: {hxx ixx txx cxx}{** -**.test...} \
+ $int_libs
+
+# Unit tests.
+#
+exe{*.test}:
+{
+ test = true
+ install = false
+}
+
+for t: cxx{**.test...}
+{
+ d = $directory($t)
+ n = $name($t)...
+
+ ./: $d/exe{$n}: $t $d/{hxx ixx txx}{+$n} $d/testscript{+$n}
+ $d/exe{$n}: libul{build2-bin}: bin.whole = false
+}
+
+# Build options.
+#
+obja{*}: cxx.poptions += -DLIBBUILD2_BIN_STATIC_BUILD
+objs{*}: cxx.poptions += -DLIBBUILD2_BIN_SHARED_BUILD
+
+# Export options.
+#
+lib{build2-bin}:
+{
+ cxx.export.poptions = "-I$out_root" "-I$src_root"
+ cxx.export.libs = $int_libs
+}
+
+liba{build2-bin}: cxx.export.poptions += -DLIBBUILD2_BIN_STATIC
+libs{build2-bin}: cxx.export.poptions += -DLIBBUILD2_BIN_SHARED
+
+# For pre-releases use the complete version to make sure they cannot be used
+# in place of another pre-release or the final version. See the version module
+# for details on the version.* variable values.
+#
+# And because this is a build system module, we also embed the same value as
+# the interface version (note that we cannot use build.version.interface for
+# bundled modules because we could be built with a different version of the
+# build system).
+#
+ver = ($version.pre_release \
+ ? "$version.project_id" \
+ : "$version.major.$version.minor")
+
+lib{build2-bin}: bin.lib.version = @"-$ver"
+libs{build2-bin}: bin.lib.load_suffix = "-$ver"
+
+# Install into the libbuild2/bin/ subdirectory of, say, /usr/include/
+# recreating subdirectories.
+#
+{hxx ixx txx}{*}:
+{
+ install = include/libbuild2/bin/
+ install.subdirs = true
+}
diff --git a/libbuild2/bin/export.hxx b/libbuild2/bin/export.hxx
new file mode 100644
index 0000000..944a756
--- /dev/null
+++ b/libbuild2/bin/export.hxx
@@ -0,0 +1,38 @@
+// file : libbuild2/bin/export.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#pragma once
+
+// Normally we don't export class templates (but do complete specializations),
+// inline functions, and classes with only inline member functions. Exporting
+// classes that inherit from non-exported/imported bases (e.g., std::string)
+// will end up badly. The only known workarounds are to not inherit or to not
+// export. Also, MinGW GCC doesn't like seeing non-exported functions being
+// used before their inline definition. The workaround is to reorder code. In
+// the end it's all trial and error.
+
+#if defined(LIBBUILD2_BIN_STATIC) // Using static.
+# define LIBBUILD2_BIN_SYMEXPORT
+#elif defined(LIBBUILD2_BIN_STATIC_BUILD) // Building static.
+# define LIBBUILD2_BIN_SYMEXPORT
+#elif defined(LIBBUILD2_BIN_SHARED) // Using shared.
+# ifdef _WIN32
+# define LIBBUILD2_BIN_SYMEXPORT __declspec(dllimport)
+# else
+# define LIBBUILD2_BIN_SYMEXPORT
+# endif
+#elif defined(LIBBUILD2_BIN_SHARED_BUILD) // Building shared.
+# ifdef _WIN32
+# define LIBBUILD2_BIN_SYMEXPORT __declspec(dllexport)
+# else
+# define LIBBUILD2_BIN_SYMEXPORT
+# endif
+#else
+// If none of the above macros are defined, then we assume we are being used
+// by some third-party build system that cannot/doesn't signal the library
+// type. Note that this fallback works for both static and shared but in case
+// of shared will be sub-optimal compared to having dllimport.
+//
+# define LIBBUILD2_BIN_SYMEXPORT // Using static or shared.
+#endif
diff --git a/build2/bin/guess.cxx b/libbuild2/bin/guess.cxx
index d1b1545..68ef827 100644
--- a/build2/bin/guess.cxx
+++ b/libbuild2/bin/guess.cxx
@@ -1,8 +1,8 @@
-// file : build2/bin/guess.cxx -*- C++ -*-
+// file : libbuild2/bin/guess.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/bin/guess.hxx>
+#include <libbuild2/bin/guess.hxx>
#include <libbuild2/diagnostics.hxx>
diff --git a/build2/bin/guess.hxx b/libbuild2/bin/guess.hxx
index a3b2b34..0e04ba5 100644
--- a/build2/bin/guess.hxx
+++ b/libbuild2/bin/guess.hxx
@@ -1,9 +1,9 @@
-// file : build2/bin/guess.hxx -*- C++ -*-
+// file : libbuild2/bin/guess.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_BIN_GUESS_HXX
-#define BUILD2_BIN_GUESS_HXX
+#ifndef LIBBUILD2_BIN_GUESS_HXX
+#define LIBBUILD2_BIN_GUESS_HXX
#include <libbuild2/types.hxx>
#include <libbuild2/utility.hxx>
@@ -105,4 +105,4 @@ namespace build2
}
}
-#endif // BUILD2_BIN_GUESS_HXX
+#endif // LIBBUILD2_BIN_GUESS_HXX
diff --git a/build2/bin/init.cxx b/libbuild2/bin/init.cxx
index 54bd84a..d56e0a5 100644
--- a/build2/bin/init.cxx
+++ b/libbuild2/bin/init.cxx
@@ -2,7 +2,7 @@
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/bin/init.hxx>
+#include <libbuild2/bin/init.hxx>
#include <map>
@@ -17,9 +17,9 @@
#include <libbuild2/install/rule.hxx>
#include <libbuild2/install/utility.hxx>
-#include <build2/bin/rule.hxx>
-#include <build2/bin/guess.hxx>
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/rule.hxx>
+#include <libbuild2/bin/guess.hxx>
+#include <libbuild2/bin/target.hxx>
using namespace std;
using namespace butl;
@@ -936,5 +936,28 @@ namespace build2
return true;
}
+
+ static const module_functions mod_functions[] =
+ {
+ // NOTE: don't forget to also update the documentation in init.hxx if
+ // changing anything here.
+
+ {"bin.vars", nullptr, vars_init},
+ {"bin.config", nullptr, config_init},
+ {"bin", nullptr, init},
+ {"bin.ar.config", nullptr, ar_config_init},
+ {"bin.ar", nullptr, ar_init},
+ {"bin.ld.config", nullptr, ld_config_init},
+ {"bin.ld", nullptr, ld_init},
+ {"bin.rc.config", nullptr, rc_config_init},
+ {"bin.rc", nullptr, rc_init},
+ {nullptr, nullptr, nullptr}
+ };
+
+ const module_functions*
+ build2_bin_load ()
+ {
+ return mod_functions;
+ }
}
}
diff --git a/libbuild2/bin/init.hxx b/libbuild2/bin/init.hxx
new file mode 100644
index 0000000..41580df
--- /dev/null
+++ b/libbuild2/bin/init.hxx
@@ -0,0 +1,40 @@
+// file : libbuild2/bin/init.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef LIBBUILD2_BIN_INIT_HXX
+#define LIBBUILD2_BIN_INIT_HXX
+
+#include <libbuild2/types.hxx>
+#include <libbuild2/utility.hxx>
+
+#include <libbuild2/module.hxx>
+
+#include <libbuild2/bin/export.hxx>
+
+namespace build2
+{
+ namespace bin
+ {
+ // Module `bin` does not require bootstrapping.
+ //
+ // Submodules:
+ //
+ // `bin.vars` -- registers some variables.
+ // `bin.config` -- loads bin.vars and sets some variables.
+ // `bin.ar.config` -- loads bin.config and registers/sets more variables.
+ // `bin.ar` -- loads bin and bin.ar.config.
+ // `bin.ld.config` -- loads bin.config and registers/sets more variables.
+ // `bin.ld` -- loads bin and bin.ld.config and registers more
+ // target types for msvc.
+ // `bin.rc.config` -- loads bin.config and registers/sets more variables.
+ // `bin.rc` -- loads bin and bin.rc.config.
+ // `bin` -- loads bin.config and registers target types and
+ // rules.
+ //
+ extern "C" LIBBUILD2_BIN_SYMEXPORT const module_functions*
+ build2_bin_load ();
+ }
+}
+
+#endif // LIBBUILD2_BIN_INIT_HXX
diff --git a/build2/bin/rule.cxx b/libbuild2/bin/rule.cxx
index 42ba86a..8c1174a 100644
--- a/build2/bin/rule.cxx
+++ b/libbuild2/bin/rule.cxx
@@ -2,14 +2,14 @@
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/bin/rule.hxx>
+#include <libbuild2/bin/rule.hxx>
#include <libbuild2/scope.hxx>
#include <libbuild2/target.hxx>
#include <libbuild2/algorithm.hxx>
#include <libbuild2/diagnostics.hxx>
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/target.hxx>
using namespace std;
diff --git a/build2/bin/rule.hxx b/libbuild2/bin/rule.hxx
index 4230933..cfd096d 100644
--- a/build2/bin/rule.hxx
+++ b/libbuild2/bin/rule.hxx
@@ -1,15 +1,17 @@
-// file : build2/bin/rule.hxx -*- C++ -*-
+// file : libbuild2/bin/rule.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_BIN_RULE_HXX
-#define BUILD2_BIN_RULE_HXX
+#ifndef LIBBUILD2_BIN_RULE_HXX
+#define LIBBUILD2_BIN_RULE_HXX
#include <libbuild2/types.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/rule.hxx>
+#include <libbuild2/bin/export.hxx>
+
namespace build2
{
namespace bin
@@ -31,7 +33,7 @@ namespace build2
// Pass-through to group members rule, similar to alias.
//
- class lib_rule: public rule
+ class LIBBUILD2_BIN_SYMEXPORT lib_rule: public rule
{
public:
lib_rule () {}
@@ -60,4 +62,4 @@ namespace build2
}
}
-#endif // BUILD2_BIN_RULE_HXX
+#endif // LIBBUILD2_BIN_RULE_HXX
diff --git a/build2/bin/target.cxx b/libbuild2/bin/target.cxx
index 9074317..dd8a947 100644
--- a/build2/bin/target.cxx
+++ b/libbuild2/bin/target.cxx
@@ -1,8 +1,8 @@
-// file : build2/bin/target.cxx -*- C++ -*-
+// file : libbuild2/bin/target.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <build2/bin/target.hxx>
+#include <libbuild2/bin/target.hxx>
#include <libbuild2/context.hxx>
diff --git a/build2/bin/target.hxx b/libbuild2/bin/target.hxx
index 45229ce..3b1708a 100644
--- a/build2/bin/target.hxx
+++ b/libbuild2/bin/target.hxx
@@ -1,22 +1,26 @@
-// file : build2/bin/target.hxx -*- C++ -*-
+// file : libbuild2/bin/target.hxx -*- C++ -*-
// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#ifndef BUILD2_BIN_TARGET_HXX
-#define BUILD2_BIN_TARGET_HXX
+#ifndef LIBBUILD2_BIN_TARGET_HXX
+#define LIBBUILD2_BIN_TARGET_HXX
#include <libbuild2/types.hxx>
#include <libbuild2/utility.hxx>
#include <libbuild2/target.hxx>
+#include <libbuild2/bin/export.hxx>
+
namespace build2
{
namespace bin
{
// The obj{} target group.
//
- class objx: public file // Common base of all objX{} object files.
+ // Common base of all objX{} object files.
+ //
+ class LIBBUILD2_BIN_SYMEXPORT objx: public file
{
public:
using file::file;
@@ -25,7 +29,7 @@ namespace build2
static const target_type static_type;
};
- class obje: public objx
+ class LIBBUILD2_BIN_SYMEXPORT obje: public objx
{
public:
using objx::objx;
@@ -35,7 +39,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class obja: public objx
+ class LIBBUILD2_BIN_SYMEXPORT obja: public objx
{
public:
using objx::objx;
@@ -45,7 +49,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class objs: public objx
+ class LIBBUILD2_BIN_SYMEXPORT objs: public objx
{
public:
using objx::objx;
@@ -55,7 +59,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class obj: public target
+ class LIBBUILD2_BIN_SYMEXPORT obj: public target
{
public:
using target::target;
@@ -92,7 +96,9 @@ namespace build2
// header and module BMIs, you should check for headers first. Note also
// that in case of a header unit there may be no obj*{}.
//
- class bmix: public file // Common base of all bmiX{} interface files.
+ // Common base of all bmiX{} interface files.
+ //
+ class LIBBUILD2_BIN_SYMEXPORT bmix: public file
{
public:
using file::file;
@@ -101,7 +107,9 @@ namespace build2
static const target_type static_type;
};
- class hbmix: public bmix // Common base of all hbmiX{} interface files.
+ // Common base of all hbmiX{} interface files.
+ //
+ class LIBBUILD2_BIN_SYMEXPORT hbmix: public bmix
{
public:
using bmix::bmix;
@@ -110,7 +118,7 @@ namespace build2
static const target_type static_type;
};
- class bmie: public bmix
+ class LIBBUILD2_BIN_SYMEXPORT bmie: public bmix
{
public:
using bmix::bmix;
@@ -120,7 +128,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class hbmie: public hbmix
+ class LIBBUILD2_BIN_SYMEXPORT hbmie: public hbmix
{
public:
using hbmix::hbmix;
@@ -130,7 +138,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class bmia: public bmix
+ class LIBBUILD2_BIN_SYMEXPORT bmia: public bmix
{
public:
using bmix::bmix;
@@ -140,7 +148,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class hbmia: public hbmix
+ class LIBBUILD2_BIN_SYMEXPORT hbmia: public hbmix
{
public:
using hbmix::hbmix;
@@ -150,7 +158,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class bmis: public bmix
+ class LIBBUILD2_BIN_SYMEXPORT bmis: public bmix
{
public:
using bmix::bmix;
@@ -160,7 +168,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class hbmis: public hbmix
+ class LIBBUILD2_BIN_SYMEXPORT hbmis: public hbmix
{
public:
using hbmix::hbmix;
@@ -170,7 +178,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class bmi: public target
+ class LIBBUILD2_BIN_SYMEXPORT bmi: public target
{
public:
using target::target;
@@ -180,7 +188,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class hbmi: public target
+ class LIBBUILD2_BIN_SYMEXPORT hbmi: public target
{
public:
using target::target;
@@ -197,7 +205,7 @@ namespace build2
// which we use, for example, to have installed lib{} prerequisites that
// are matched by the fallback file rule.
//
- class libx: public mtime_target
+ class LIBBUILD2_BIN_SYMEXPORT libx: public mtime_target
{
public:
using mtime_target::mtime_target;
@@ -228,7 +236,9 @@ namespace build2
//
// {libue libul}{foo}: cxx{*}
//
- class libux: public file // Common base of all libuX{} static libraries.
+ // Common base of all libuX{} static libraries.
+ //
+ class LIBBUILD2_BIN_SYMEXPORT libux: public file
{
public:
using file::file;
@@ -237,7 +247,7 @@ namespace build2
static const target_type static_type;
};
- class libue: public libux
+ class LIBBUILD2_BIN_SYMEXPORT libue: public libux
{
public:
using libux::libux;
@@ -247,7 +257,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class libua: public libux
+ class LIBBUILD2_BIN_SYMEXPORT libua: public libux
{
public:
using libux::libux;
@@ -257,7 +267,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class libus: public libux
+ class LIBBUILD2_BIN_SYMEXPORT libus: public libux
{
public:
using libux::libux;
@@ -267,7 +277,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class libul: public libx
+ class LIBBUILD2_BIN_SYMEXPORT libul: public libx
{
public:
using libx::libx;
@@ -279,7 +289,7 @@ namespace build2
// The lib{} target group.
//
- class liba: public file
+ class LIBBUILD2_BIN_SYMEXPORT liba: public file
{
public:
using file::file;
@@ -289,7 +299,7 @@ namespace build2
virtual const target_type& dynamic_type () const {return static_type;}
};
- class libs: public file
+ class LIBBUILD2_BIN_SYMEXPORT libs: public file
{
public:
using file::file;
@@ -309,7 +319,7 @@ namespace build2
const libs* s = nullptr;
};
- class lib: public libx, public lib_members
+ class LIBBUILD2_BIN_SYMEXPORT lib: public libx, public lib_members
{
public:
using libx::libx;
@@ -326,7 +336,7 @@ namespace build2
// Windows import library.
//
- class libi: public file
+ class LIBBUILD2_BIN_SYMEXPORT libi: public file
{
public:
using file::file;
@@ -338,7 +348,7 @@ namespace build2
// Windows module definition (.def).
//
- class def: public file
+ class LIBBUILD2_BIN_SYMEXPORT def: public file
{
public:
using file::file;
@@ -350,4 +360,4 @@ namespace build2
}
}
-#endif // BUILD2_BIN_TARGET_HXX
+#endif // LIBBUILD2_BIN_TARGET_HXX
diff --git a/libbuild2/buildfile b/libbuild2/buildfile
index 3ad2f9b..57f4895 100644
--- a/libbuild2/buildfile
+++ b/libbuild2/buildfile
@@ -5,7 +5,7 @@
# NOTE: remember to update bundled_modules in libbuild2/modules.cxx if adding
# a new module.
#
-./: lib{build2} bash/ in/ version/
+./: lib{build2} bash/ bin/ in/ version/
import int_libs = libbutl%lib{butl}
diff --git a/libbuild2/export.hxx b/libbuild2/export.hxx
index 514c845..fa44df9 100644
--- a/libbuild2/export.hxx
+++ b/libbuild2/export.hxx
@@ -1,3 +1,7 @@
+// file : libbuild2/export.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
#pragma once
// Normally we don't export class templates (but do complete specializations),
diff --git a/libbuild2/in/export.hxx b/libbuild2/in/export.hxx
index 47909e7..776f647 100644
--- a/libbuild2/in/export.hxx
+++ b/libbuild2/in/export.hxx
@@ -1,3 +1,7 @@
+// file : libbuild2/in/export.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
#pragma once
// Normally we don't export class templates (but do complete specializations),
diff --git a/libbuild2/module.cxx b/libbuild2/module.cxx
index 9f951c3..bb7c61d 100644
--- a/libbuild2/module.cxx
+++ b/libbuild2/module.cxx
@@ -38,6 +38,7 @@ namespace build2
//
static const char* bundled_modules[] = {
"bash",
+ "bin",
"in",
"version"
};
diff --git a/libbuild2/version/export.hxx b/libbuild2/version/export.hxx
index c76cd8a..d6bb001 100644
--- a/libbuild2/version/export.hxx
+++ b/libbuild2/version/export.hxx
@@ -1,3 +1,7 @@
+// file : libbuild2/version/export.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
#pragma once
// Normally we don't export class templates (but do complete specializations),
diff --git a/tests/libbuild2/buildfile b/tests/libbuild2/buildfile
index bd22b4c..beb82b2 100644
--- a/tests/libbuild2/buildfile
+++ b/tests/libbuild2/buildfile
@@ -4,7 +4,7 @@
import libs = build2%lib{build2}
-for m: bash in version
+for m: bash bin in version
import libs += build2%lib{build2-$m}
exe{driver}: {hxx cxx}{*} $libs testscript
diff --git a/tests/libbuild2/driver.cxx b/tests/libbuild2/driver.cxx
index a70e707..93c145a 100644
--- a/tests/libbuild2/driver.cxx
+++ b/tests/libbuild2/driver.cxx
@@ -9,6 +9,7 @@
#include <libbuild2/scheduler.hxx>
#include <libbuild2/in/init.hxx>
+#include <libbuild2/bin/init.hxx>
#include <libbuild2/bash/init.hxx>
#include <libbuild2/version/init.hxx>
@@ -23,6 +24,7 @@ main (int, char* argv[])
init (nullptr, argv[0]);
bash::build2_bash_load ();
+ bin::build2_bin_load ();
in::build2_in_load ();
version::build2_version_load ();