From b55e0afbfa0183d570d8a05cf93bfdaddcccf113 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 7 Mar 2023 07:43:25 +0200 Subject: Add new include_arch/config.install.include_arch installation location It is mean for target architecture-specific headers. --- NEWS | 16 ++++++++ doc/manual.cli | 100 +++++++++++++++++++++++++++------------------ libbuild2/install/init.cxx | 72 ++++++++++++++++---------------- 3 files changed, 114 insertions(+), 74 deletions(-) diff --git a/NEWS b/NEWS index ef9a8fd..6a7cbcd 100644 --- a/NEWS +++ b/NEWS @@ -49,6 +49,22 @@ Version 0.16.0 For details, see the print_diag() API description in diagnostics.hxx. See also GH issue #40 for additional background/details. + * New include_arch installation location and the corresponding + config.install.include_arch configuration variable. + + This location is meant for architecture-specific files, such as + configuration headers. By default it's the same as the standard include + location but can be configured by the user to a different value (for + example, /usr/include/x86_64-linux-gnu/) for platforms that support + multiple architectures from the same installation location. This is how + one would normally use it from a buildfile: + + # The configuration header may contain target architecture-specific + # information so install it into include_arch/ instead of include/. + # + h{*}: install = include/libhello/ + h{config}: install = include_arch/libhello/ + * The in.substitution variable has been renamed to in.mode. The original name is still recognized for backwards compatibility. diff --git a/doc/manual.cli b/doc/manual.cli index ad440c1..5a2d35b 100644 --- a/doc/manual.cli +++ b/doc/manual.cli @@ -2312,36 +2312,39 @@ If the value of the \c{install} variable is not \c{false}, then it is normally a relative path with the first path component being one of these names: \ -name default override ----- ------- -------- +name default override +---- ------- -------- root config.install.root -data_root root/ config.install.data_root -exec_root root/ config.install.exec_root +data_root root/ config.install.data_root +exec_root root/ config.install.exec_root -bin exec_root/bin/ config.install.bin -sbin exec_root/sbin/ config.install.sbin -lib exec_root/lib/ config.install.lib -libexec exec_root/libexec// config.install.libexec -pkgconfig lib/pkgconfig/ config.install.pkgconfig +bin exec_root/bin/ config.install.bin +sbin exec_root/sbin/ config.install.sbin +lib exec_root/lib/ config.install.lib +libexec exec_root/libexec// config.install.libexec +pkgconfig lib/pkgconfig/ config.install.pkgconfig -etc data_root/etc/ config.install.etc -include data_root/include/ config.install.include -share data_root/share/ config.install.share -data share// config.install.data +etc data_root/etc/ config.install.etc +include data_root/include/ config.install.include +include_arch include/ config.install.include_arch +share data_root/share/ config.install.share +data share// config.install.data -doc share/doc// config.install.doc -legal doc/ config.install.legal -man share/man/ config.install.man -man man/man/ config.install.man +doc share/doc// config.install.doc +legal doc/ config.install.legal +man share/man/ config.install.man +man man/man/ config.install.man \ Let's see what's going on here: The default install directory tree is derived from the \c{config.install.root} value but the location of each node in this tree can be overridden by the user that installs our project using the -corresponding \c{config.install.*} variables. In our \c{buildfiles}, in turn, -we use the node names instead of actual directories. As an example, here is a -\c{buildfile} fragment from the source directory of our \c{libhello} project: +corresponding \c{config.install.*} variables (see the \l{#module-install +\c{install}} module documentation for details on their meaning). In our +\c{buildfiles}, in turn, we use the node names instead of actual +directories. As an example, here is a \c{buildfile} fragment from the source +directory of our \c{libhello} project: \ hxx{*}: @@ -6133,28 +6136,45 @@ of the Introduction, the \c{install} module defines the following standard installation locations: \ -name default config.* override ----- ------- ----------------- -root install.root +name default config.install.* + (c.i.*) override +---- ------- ---------------- +root c.i.root -data_root root/ install.data_root -exec_root root/ install.exec_root +data_root root/ c.i.data_root +exec_root root/ c.i.exec_root -bin exec_root/bin/ install.bin -sbin exec_root/sbin/ install.sbin -lib exec_root/lib// install.lib -libexec exec_root/libexec/// install.libexec -pkgconfig lib/pkgconfig/ install.pkgconfig +bin exec_root/bin/ c.i.bin +sbin exec_root/sbin/ c.i.sbin +lib exec_root/lib// c.i.lib +libexec exec_root/libexec/// c.i.libexec +pkgconfig lib/pkgconfig/ c.i.pkgconfig -etc data_root/etc/ install.etc -include data_root/include// install.include -share data_root/share/ install.share -data share/// install.data +etc data_root/etc/ c.i.etc +include data_root/include// c.i.include +include_arch include/ c.i.include_arch +share data_root/share/ c.i.share +data share/// c.i.data -doc share/doc/// install.doc -legal doc/ install.legal -man share/man/ install.man -man man/man/ install.man +doc share/doc/// c.i.doc +legal doc/ c.i.legal +man share/man/ c.i.man +man man/man/ c.i.man +\ + +The \c{include_arch} location is meant for architecture-specific files, such +as configuration headers. By default it's the same as \c{include} but can be +configured by the user to a different value (for example, +\c{/usr/include/x86_64-linux-gnu/}) for platforms that support multiple +architectures from the same installation location. This is how one would +normally use it from a \c{buildfile}: + +\ +# The configuration header may contain target architecture-specific +# information so install it into include_arch/ instead of include/. +# +h{*}: install = include/libhello/ +h{config}: install = include_arch/libhello/ \ The \c{}, \c{}, and \c{} substitutions in these @@ -6175,7 +6195,9 @@ The private installation subdirectory is specified with the directory and may include multiple components. For example: \ -$ b install config.install.root=/usr/local/ config.install.private=hello/ +$ b install \ + config.install.root=/usr/local/ \ + config.install.private=hello/ \ \N|If you are relying on your system's dynamic linker defaults to diff --git a/libbuild2/install/init.cxx b/libbuild2/install/init.cxx index 0f8b1be..92c2790 100644 --- a/libbuild2/install/init.cxx +++ b/libbuild2/install/init.cxx @@ -285,24 +285,25 @@ namespace build2 // #define DIR(N, V) static const dir_path dir_##N (V) - DIR (data_root, dir_path ("root")); - DIR (exec_root, dir_path ("root")); - - DIR (sbin, dir_path ("exec_root") /= "sbin"); - DIR (bin, dir_path ("exec_root") /= "bin"); - DIR (lib, (dir_path ("exec_root") /= "lib") /= ""); - DIR (libexec, ((dir_path ("exec_root") /= "libexec") /= "") /= ""); - DIR (pkgconfig, dir_path ("lib") /= "pkgconfig"); - - DIR (etc, dir_path ("data_root") /= "etc"); - DIR (include, (dir_path ("data_root") /= "include") /= ""); - DIR (share, dir_path ("data_root") /= "share"); - DIR (data, (dir_path ("share") /= "") /= ""); - - DIR (doc, ((dir_path ("share") /= "doc") /= "") /= ""); - DIR (legal, dir_path ("doc")); - DIR (man, dir_path ("share") /= "man"); - DIR (man1, dir_path ("man") /= "man1"); + DIR (data_root, dir_path ("root")); + DIR (exec_root, dir_path ("root")); + + DIR (sbin, dir_path ("exec_root") /= "sbin"); + DIR (bin, dir_path ("exec_root") /= "bin"); + DIR (lib, (dir_path ("exec_root") /= "lib") /= ""); + DIR (libexec, ((dir_path ("exec_root") /= "libexec") /= "") /= ""); + DIR (pkgconfig, dir_path ("lib") /= "pkgconfig"); + + DIR (etc, dir_path ("data_root") /= "etc"); + DIR (include, (dir_path ("data_root") /= "include") /= ""); + DIR (include_arch, dir_path ("include")); + DIR (share, dir_path ("data_root") /= "share"); + DIR (data, (dir_path ("share") /= "") /= ""); + + DIR (doc, ((dir_path ("share") /= "doc") /= "") /= ""); + DIR (legal, dir_path ("doc")); + DIR (man, dir_path ("share") /= "man"); + DIR (man1, dir_path ("man") /= "man1"); #undef DIR @@ -583,28 +584,29 @@ namespace build2 // Global config.install.* values. // - set_dir (s, p, rs, "", abs_dir_path (), false, "644", "755", cmd); + set_dir (s, p, rs, "", abs_dir_path (), false, "644", "755", cmd); - set_dir (s, p, rs, "root", abs_dir_path ()); + set_dir (s, p, rs, "root", abs_dir_path ()); - set_dir (s, p, rs, "data_root", dir_data_root); - set_dir (s, p, rs, "exec_root", dir_exec_root, false, "755"); + set_dir (s, p, rs, "data_root", dir_data_root); + set_dir (s, p, rs, "exec_root", dir_exec_root, false, "755"); - set_dir (s, p, rs, "sbin", dir_sbin); - set_dir (s, p, rs, "bin", dir_bin); - set_dir (s, p, rs, "lib", dir_lib); - set_dir (s, p, rs, "libexec", dir_libexec); - set_dir (s, p, rs, "pkgconfig", dir_pkgconfig, false, "644"); + set_dir (s, p, rs, "sbin", dir_sbin); + set_dir (s, p, rs, "bin", dir_bin); + set_dir (s, p, rs, "lib", dir_lib); + set_dir (s, p, rs, "libexec", dir_libexec); + set_dir (s, p, rs, "pkgconfig", dir_pkgconfig, false, "644"); - set_dir (s, p, rs, "etc", dir_etc); - set_dir (s, p, rs, "include", dir_include); - set_dir (s, p, rs, "share", dir_share); - set_dir (s, p, rs, "data", dir_data); + set_dir (s, p, rs, "etc", dir_etc); + set_dir (s, p, rs, "include", dir_include); + set_dir (s, p, rs, "include_arch", dir_include_arch); + set_dir (s, p, rs, "share", dir_share); + set_dir (s, p, rs, "data", dir_data); - set_dir (s, p, rs, "doc", dir_doc); - set_dir (s, p, rs, "legal", dir_legal); - set_dir (s, p, rs, "man", dir_man); - set_dir (s, p, rs, "man1", dir_man1); + set_dir (s, p, rs, "doc", dir_doc); + set_dir (s, p, rs, "legal", dir_legal); + set_dir (s, p, rs, "man", dir_man); + set_dir (s, p, rs, "man1", dir_man1); } // Configure "installability" for built-in target types. -- cgit v1.1