configure: support out-of-source builds#1558
Merged
axboe merged 3 commits intoaxboe:masterfrom Mar 24, 2026
Merged
Conversation
Add support for out-of-source builds (e.g., mkdir build && cd build && ../configure && make). This is useful for maintaining parallel build configurations side-by-side (e.g., debug vs release with unique build dir names), and for packaging systems like Bazel that expect the source tree to remain clean. configure detects when it is invoked from a directory other than the source root, creates the necessary build subdirectories, and generates thin wrapper Makefiles that set $(root) and include the real Makefiles. All Makefiles now use $(root) to locate source-tree files (headers, linker maps, scripts, man pages) and VPATH to find source files for compilation. In-source builds continue to work as before with $(root) defaulting to "." or "..". Signed-off-by: Travis Downs <travis.downs@redpanda.com>
axboe
reviewed
Mar 24, 2026
.gitignore
Outdated
| cscope.out | ||
|
|
||
| # build directories | ||
| /build |
Owner
There was a problem hiding this comment.
Not sure we should add those, that's hard-wiring a convention that some may use? I know build/ is common with other build systems, but you could use anything here.
Contributor
Author
There was a problem hiding this comment.
Yeah, fair, I wasn't sure about this one, perhaps I did it more for my own convenience :).
I will remove this and users can add their own local ignores as necessary.
Owner
|
Overall looks very clean, I like it. Just one minor comment on the the gitignore parts. |
Test that out-of-source builds work in CI: configure from a separate build directory, build, install, link against the installed library, and verify nothing leaked into the source tree. Signed-off-by: Travis Downs <travis.downs@redpanda.com>
Signed-off-by: Travis Downs <travis.downs@redpanda.com>
f7120f8 to
ebbd32e
Compare
Contributor
Author
|
ebbd32e removes the .gitignore modifications. |
travisdowns
added a commit
to travisdowns/redpanda
that referenced
this pull request
Mar 25, 2026
Upgrade from 2.5 to 2.14 with a patch to work around out-of-source build issues (bazelbuild/bazel-central-registry#8079) which itself is hard to fix until BCR picks up axboe/liburing#1558.
7 tasks
travisdowns
added a commit
to travisdowns/redpanda
that referenced
this pull request
Mar 25, 2026
Upgrade from 2.5 to 2.14 with a patch to work around out-of-source build issues (bazelbuild/bazel-central-registry#8079) which itself is hard to fix until BCR picks up axboe/liburing#1558.
travisdowns
added a commit
to travisdowns/bazel-central-registry
that referenced
this pull request
Apr 1, 2026
Replace pushd/popd with symlink-based out-of-source build so that CWD does not change and relative paths (e.g., --sysroot) resolve correctly. Also simplify output copying to use parameter expansion instead of realpath. Upstream now supports out-of-source builds natively (axboe/liburing#1558) but that landed after the 2.14 release, so this workaround is needed for the current BCR version.
travisdowns
added a commit
to travisdowns/bazel-central-registry
that referenced
this pull request
Apr 1, 2026
Replace pushd/popd with symlink-based out-of-source build so that CWD does not change and relative paths (e.g., --sysroot) resolve correctly. Also simplify output copying to use parameter expansion instead of realpath. Upstream now supports out-of-source builds natively (axboe/liburing#1558) but that landed after the 2.14 release, so this workaround is needed for the current BCR version.
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.
This adds support for out-of-source builds, so you can do:
and keep the source tree completely clean.
This is a follow-up to the discussion in
#1557.
Out-of-source builds are useful for:
debug vs release, or sanitizer builds, each in their own build
directory)
remain unmodified, relying on relative paths for hermiticity
source tree
The approach is lightweight: configure detects when it is invoked
from outside the source root and generates thin wrapper Makefiles
that set a $(root) variable pointing back to the source tree. All
existing Makefiles are updated to use $(root) for source-tree
references and VPATH for finding source files. In-source builds
continue to work exactly as before.
Closes: #1557