From 3ba17db6300d7e0cfc4fa001b5a8eb91bf417ea3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 12 Oct 2022 08:31:54 +0200 Subject: Switch to public/private variables model Now unqualified variables are project-private and can be typified. --- libbuild2/install/init.cxx | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'libbuild2/install/init.cxx') diff --git a/libbuild2/install/init.cxx b/libbuild2/install/init.cxx index ef9de05..35c2d13 100644 --- a/libbuild2/install/init.cxx +++ b/libbuild2/install/init.cxx @@ -250,6 +250,21 @@ namespace build2 context& ctx (rs.ctx); + // Enter module variables (note that init() below enters some more). + // + auto& vp (rs.var_pool ()); + + // The install variable is a path, not dir_path, since it can be used + // to both specify the target directory (to install with the same file + // name) or target file (to install with a different name). And the + // way we distinguish between the two is via the presence/absence of + // the trailing directory separator. + // + // Plus it can have the special true/false values when acting as a + // operation variable. + // + auto& ovar (vp.insert ("install", variable_visibility::target)); + // Register the install function family if this is the first instance of // the install modules. // @@ -258,9 +273,9 @@ namespace build2 // Register our operations. // - rs.insert_operation (install_id, op_install); - rs.insert_operation (uninstall_id, op_uninstall); - rs.insert_operation (update_for_install_id, op_update_for_install); + rs.insert_operation (install_id, op_install, &ovar); + rs.insert_operation (uninstall_id, op_uninstall, &ovar); + rs.insert_operation (update_for_install_id, op_update_for_install, &ovar); } static const path cmd ("install"); @@ -317,13 +332,6 @@ namespace build2 // Note that the set_dir() calls below enter some more. // { - // The install variable is a path, not dir_path, since it can be used - // to both specify the target directory (to install with the same file - // name) or target file (to install with a different name). And the - // way we distinguish between the two is via the presence/absence of - // the trailing directory separator. - // - vp.insert ("install", variable_visibility::target); vp.insert ("for_install", variable_visibility::prereq); vp.insert ("install.mode"); vp.insert ("install.subdirs"); -- cgit v1.1