diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-10-29 12:42:15 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-10-29 12:42:15 +0200 |
commit | beedc17766c58799eae1919cb471f686b8286363 (patch) | |
tree | 2d23aac9cc76808e0d71121c1ca5666063b850e5 /libbuild2/install/rule.hxx | |
parent | 86e96b929031e7edc4ac1319e0fd42e8bb854146 (diff) |
Regularize and make accessible install/uninstall primitives
Diffstat (limited to 'libbuild2/install/rule.hxx')
-rw-r--r-- | libbuild2/install/rule.hxx | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/libbuild2/install/rule.hxx b/libbuild2/install/rule.hxx index c7e6a17..56d3970 100644 --- a/libbuild2/install/rule.hxx +++ b/libbuild2/install/rule.hxx @@ -158,7 +158,32 @@ namespace build2 // The verbosity argument specified the level to start printing the // command at. Note that these functions respect the dry_run flag. - // Install a symlink: base/link -> target. + // Install (create) a directory: + // + // install -d <dir> + // + static void + install_d (const scope& rs, + const install_dir& base, + const dir_path& dir, + uint16_t verbosity = 1); + + // Install a file: + // + // install <file> <base>/ # if <name> is empty + // install <file> <base>/<name> # if <name> is not empty + // + static void + install_f (const scope& rs, + const install_dir& base, + const path& name, + const file& target, + const path& file, + uint16_t verbosity = 1); + + // Install (make) a symlink: + // + // ln -s <target> <base>/<link> // static void install_l (const scope& rs, @@ -167,10 +192,10 @@ namespace build2 const path& link, uint16_t verbosity = 1); - // Uninstall a file or symlink: + // Uninstall (remove) a file or symlink: // - // uninstall <target> <base>/ rm <base>/<target>.leaf (); name empty - // uninstall <target> <name> rm <base>/<name>; target can be NULL + // uninstall <target> <base>/ # rm <base>/<target>.leaf (); name empty + // uninstall <target> <name> # rm <base>/<name>; target can be NULL // // Return false if nothing has been removed (i.e., the file does not // exist). @@ -182,6 +207,20 @@ namespace build2 const path& name, uint16_t verbosity = 1); + // Uninstall (remove) an empty directory. + // + // uninstall -d <dir> + // + // We try to remove all the directories between base and dir but not base + // itself unless base == dir. Return false if nothing has been removed + // (i.e., the directories do not exist or are not empty). + // + static bool + uninstall_d (const scope& rs, + const install_dir& base, + const dir_path& dir, + uint16_t verbosity = 1); + target_state perform_install (action, const target&) const; |