build2/libbuild2-config.install.scope-no-update-for-install.patch
Matthew Krupcale babacf4446 Update to v0.14.0
* .gitignore, sources: Update to v0.14.0
 * bpkg-openssl-3-pkeyutl.patch, libbutl-openssl-info-overloads.patch: add patches for OpenSSL v3.0 support [1]
 * build2-disable-test-cc-modules-ppc64le.patch: add patch to disable failing C++ modules tests on PPC64LE
 * build2.spec:
    - Update to v0.14.0
    - Re-enable bootstrap required for this releas
    - Update comments on libbutl license
    - Use config.install.etc for specifying system configuration file directory
    - Use config.install.scope to prevent installing statically built, bundled libodb [2,3]
 * libbuild2-config.install.scope-no-update-for-install.patch: add patch to make config.install.scope not apply during update-for-install pre-operation [3]
 * macros.build2:
    - Use config.install.legal for specifying system configuration file directory

[1] https://lists.build2.org/archives/users/2021-November/000923.html
[2] https://lists.build2.org/archives/announce/2021/000021.html
[3] https://lists.build2.org/archives/users/2021-November/000919.html
2022-01-23 18:36:38 -05:00

127 lines
4.8 KiB
Diff

From 65f77bb9a9556033a0bfb7401dd9a00120e27524 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov <boris@codesynthesis.com>
Date: Thu, 4 Nov 2021 13:41:23 +0200
Subject: Do not apply install scope to update-for-install pre-operation
---
libbuild2/cc/link-rule.cxx | 7 +++++++
libbuild2/cc/pkgconfig.cxx | 38 ++++++++++++++++++++++++++------------
libbuild2/install/rule.cxx | 4 ++--
libbuild2/install/utility.hxx | 4 ++++
4 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx
index fa9a1f1..79de01c 100644
--- a/libbuild2/cc/link-rule.cxx
+++ b/libbuild2/cc/link-rule.cxx
@@ -2379,6 +2379,13 @@ namespace build2
// install or no install, the reason is unless and until we are updating
// for install, we have no idea where-to things will be installed.
//
+ // There is a further complication: we may have no intention of
+ // installing the library but still need to update it for install (see
+ // install_scope() for background). In which case we may still not have
+ // the installation directories. We handle this in pkconfig_save() by
+ // skipping the generation of .pc files (and letting the install rule
+ // complain if we do end up trying to install them).
+ //
if (for_install && lt.library () && !lt.utility)
{
bool la (lt.static_library ());
diff --git a/libbuild2/cc/pkgconfig.cxx b/libbuild2/cc/pkgconfig.cxx
index 3033a2b..54fc05f 100644
--- a/libbuild2/cc/pkgconfig.cxx
+++ b/libbuild2/cc/pkgconfig.cxx
@@ -1461,18 +1461,6 @@ namespace build2
/* */ pcs::static_type)));
assert (t != nullptr);
- // This is the lib{} group if we are generating the common file and the
- // target itself otherwise.
- //
- const file& g (common ? l.group->as<file> () : l);
-
- // By default we assume things go into install.{include, lib}.
- //
- using install::resolve_dir;
-
- dir_path idir (resolve_dir (g, cast<dir_path> (g["install.include"])));
- dir_path ldir (resolve_dir (g, cast<dir_path> (g["install.lib"])));
-
const path& p (t->path ());
// If we are uninstalling, skip regenerating the file if it already
@@ -1485,6 +1473,32 @@ namespace build2
return;
}
+ // This is the lib{} group if we are generating the common file and the
+ // target itself otherwise.
+ //
+ const file& g (common ? l.group->as<file> () : l);
+
+ // By default we assume things go into install.{include, lib}.
+ //
+ // If include.lib does not resolve, then assume this is update-for-
+ // install without actual install and remove the file if it exists.
+ //
+ // @@ Shouldn't we use target's install value rather than install.lib
+ // in case it gets installed into a custom location?
+ //
+ using install::resolve_dir;
+
+ dir_path ldir (resolve_dir (g,
+ cast<dir_path> (g["install.lib"]),
+ false /* fail_unknown */));
+ if (ldir.empty ())
+ {
+ rmfile (ctx, p, 3 /* verbosity */);
+ return;
+ }
+
+ dir_path idir (resolve_dir (g, cast<dir_path> (g["install.include"])));
+
// Note that generation can take some time if we have a large number of
// prerequisite libraries.
//
diff --git a/libbuild2/install/rule.cxx b/libbuild2/install/rule.cxx
index 2d81067..d4c70c0 100644
--- a/libbuild2/install/rule.cxx
+++ b/libbuild2/install/rule.cxx
@@ -105,7 +105,7 @@ namespace build2
// iterates over all its members.
//
if (!is)
- is = install_scope (t);
+ is = a.operation () != update_id ? install_scope (t) : nullptr;
const target* pt (filter (*is, a, t, i));
if (pt == nullptr)
@@ -366,7 +366,7 @@ namespace build2
// iterates over all its members.
//
if (!is)
- is = install_scope (t);
+ is = a.operation () != update_id ? install_scope (t) : nullptr;
const target* pt (filter (*is, a, t, i));
diff --git a/libbuild2/install/utility.hxx b/libbuild2/install/utility.hxx
index cc5cd53..52b9a54 100644
--- a/libbuild2/install/utility.hxx
+++ b/libbuild2/install/utility.hxx
@@ -61,6 +61,10 @@ namespace build2
// belong to projects outside of this scope. If it's NULL, install
// prerequisites from all projects. See also config.install.scope.
//
+ // Note that this should not apply to update-for-install. Failed that we
+ // may end up using incompatibly-built prerequisites (e.g., a library) in
+ // a target built for install (e.g., an executable).
+ //
LIBBUILD2_SYMEXPORT const scope*
install_scope (const target&);
--
cgit v1.1