From 759e8399e15ca570d3d67165664e43a17092c5b3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 21 Mar 2023 07:54:29 +0200 Subject: Add --archive-no-{cpu,os} pkg-bindist options --- bpkg/pkg-bindist.cli | 25 ++++++++++++++++++++----- bpkg/system-package-manager-archive.cxx | 7 +++++-- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/bpkg/pkg-bindist.cli b/bpkg/pkg-bindist.cli index 0ea51f9..8e34839 100644 --- a/bpkg/pkg-bindist.cli +++ b/bpkg/pkg-bindist.cli @@ -427,13 +427,16 @@ namespace bpkg \c{\i{cpu}-\i{os}[-\i{langrt}...]} - Where \ci{cpu} is the target CPU (for example, \cb{x86_64}), \ci{os} is + Where \ci{cpu} is the target CPU (for example, \cb{x86_64} or + \cb{aarch64}; omitted if \cb{--archive-no-cpu} is specified), \ci{os} is the \cb{ID} and \cb{VERSION_ID} components from \cb{os-release(5)} (or - equivalent, for example, \cb{debian11} or \cb{windows10}), and - \ci{langrt} are the language runtimes as mapped by the - \cb{--archive-lang*} options (for example, \cb{gcc12}, \cb{msvc17.4}). + equivalent, for example, \cb{debian11} or \cb{windows10}; omitted if + \cb{--archive-no-os} is specified), and \ci{langrt} are the language + runtimes as mapped by the \cb{--archive-lang*} options (for example, + \cb{gcc12} or \cb{msvc17.4}). - For example, given the following invocation on Debian 11: + For example, given the following invocation on Debian 11 running on + \cb{x86_64}: \ bpkg build libhello @@ -556,6 +559,18 @@ namespace bpkg for background." } + bool --archive-no-cpu + { + "Assume the package is CPU architecture-independent and omit it from + the binary package directory name and archive file base." + } + + bool --archive-no-os + { + "Assume the package is operating system-independent and omit it from + the binary package directory name and archive file base." + } + string --archive-build-meta { "", diff --git a/bpkg/system-package-manager-archive.cxx b/bpkg/system-package-manager-archive.cxx index 3f5143f..53ef481 100644 --- a/bpkg/system-package-manager-archive.cxx +++ b/bpkg/system-package-manager-archive.cxx @@ -505,8 +505,11 @@ namespace bpkg } else { - base += '-' + target.cpu; - base += '-' + os_release.name_id + os_release.version_id; + if (!ops->archive_no_cpu ()) + base += '-' + target.cpu; + + if (!ops->archive_no_os ()) + base += '-' + os_release.name_id + os_release.version_id; // First collect the interface languages and then add implementation. // This way if different languages map to the same runtimes (e.g., C and -- cgit v1.1