build: prepare for subtree split#276
Draft
Sjors wants to merge 2 commits into
Draft
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process. LLM Linter (✨ experimental)Possible typos and grammar issues:
2026-05-12 09:59:26 |
Move the library sources (CMakeLists.txt, cmake/, include/, pkgconfig/,
src/, test/) under a single lib/ prefix so that
git subtree split --prefix=lib -b lib
produces a 'lib' branch containing only the files needed for a full
library build and install. Downstream projects consuming libmultiprocess
as a git subtree can pull from this branch and avoid churn from changes
to CI scripts, README, doc/, examples, shell.nix and other files that
are not part of the library itself.
A new top-level CMakeLists.txt wrapper preserves 'cmake -S .' for
standalone builds; this is also the only way to build the example/
subdirectory, which lives outside lib/ since downstream subtree
consumers do not need it. See comments in CMakeLists.txt and
lib/CMakeLists.txt for details on how lib/ adapts between the two
build modes.
The bulk of this commit is a pure file move (renames only). Outside
the move itself, only minimal touch-ups were necessary in
lib/CMakeLists.txt and ci/scripts/{ci,bitcoin_core_ci}.sh.
0e96999 to
d8364e5
Compare
Bitcoin Core's cmake/libmultiprocess.cmake currently references the mpcalculator, mpprinter and mpexample targets, which no longer exist in the subtree (the example/ directory lives outside the 'lib' branch). Strip the offending line as part of replace_subtree so the bitcoin-core CI job configures cleanly. Remove this workaround once a matching Bitcoin Core PR has landed.
d8364e5 to
66d7b48
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We can use a subtree split to export only a subset of this repository to downstream projects. The only thing we need to do is publish and maintain a branch, e.g.
lib, generated as follows:I published such a branch here: https://github.com/Sjors/libmultiprocess/commits/lib/
Commits that don't touch the prefix directory are skipped entirely. Others are stripped of content outside the prefix. This of course breaks PGP signatures, but the
libbranch commits are deterministically generated. On the Bitcoin Core side I plan to update the subtree linter to verify this.Because we can only export one directory, this PR moves the following library sources to
lib/:This leaves examples, documentation and CI outside the export. Tests could be moved out as well, but it seems useful to offer downstream projects an easy way to run these tests as part of their own CI.
A new top-level CMakeLists.txt wrapper preserves 'cmake -S .' for standalone builds; this is also the only way to build the example/ subdirectory. See comments in CMakeLists.txt and lib/CMakeLists.txt for details on how lib/ adapts between the two build modes. This can use some CMake expertise eyes. Most of the existing
CMakeList.txtcontent is simply moved, so it's best reviewed with--color-moved=dimmed-zebra.Commit 66d7b48 can be avoided if we drop examples from
cmake/libmultiprocess.cmakein Bitcoin Core in a separate PR first.Bitcoin Core side: Sjors/bitcoin#113 (will upstream later)
Fixes #232