From 4caed823a8c762676fe57ff646bf19b6c14e9f6e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 27 Aug 2019 00:21:41 +0300 Subject: Don't set import.build2 variable in cross-compiled build2 --- libbuild2/buildfile | 13 +++++++------ libbuild2/context.cxx | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libbuild2/buildfile b/libbuild2/buildfile index deda991..3c4566a 100644 --- a/libbuild2/buildfile +++ b/libbuild2/buildfile @@ -73,13 +73,14 @@ obja{*}: cxx.poptions += -DLIBBUILD2_STATIC_BUILD objs{*}: cxx.poptions += -DLIBBUILD2_SHARED_BUILD # Pass our compiler target to be used as build2 host and our out_root to -# be used as the build system import path. +# be used as the build system import path (not forgetting to escape +# backslashes on Windows). # -obj{context}: -{ - cxx.poptions += "-DBUILD2_HOST_TRIPLET=\"$cxx.target\"" - cxx.poptions += "-DBUILD2_IMPORT_PATH=\"$out_root\"" -} +obj{context}: cxx.poptions += "-DBUILD2_HOST_TRIPLET=\"$cxx.target\"" + +if ($cxx.target == $build.host) + obj{context}: cxx.poptions += \ + "-DBUILD2_IMPORT_PATH=\"$regex.replace($out_root, '\\', '\\\\')\"" obja{context}: cxx.poptions += -DLIBBUILD2_STATIC_BUILD objs{context}: cxx.poptions += -DLIBBUILD2_SHARED_BUILD diff --git a/libbuild2/context.cxx b/libbuild2/context.cxx index a715c59..87685ef 100644 --- a/libbuild2/context.cxx +++ b/libbuild2/context.cxx @@ -129,7 +129,7 @@ namespace build2 // var_import_build2 = &vp.insert ("import.build2"); -#ifndef BUILD2_BOOTSTRAP +#ifdef BUILD2_IMPORT_PATH if (!build_installed) gs.assign (var_import_build2) = abs_dir_path (BUILD2_IMPORT_PATH); #endif -- cgit v1.1