feat(pkg): relocatable compiler support#13321
Draft
Alizter wants to merge 7 commits intoocaml:mainfrom
Draft
Conversation
d5b4236 to
4804dc0
Compare
Alizter
referenced
this pull request
Jan 15, 2026
According to [1] and [2], `build-id` is a SHA256 hash identifying the precise package version with all its dependencies. Consumers of this variable, such as the process.sh script in [3], use this to identify specific packages in existing opam switches. In [3] this is used to find an already-built relocatable OCaml compiler. In dune we wish to re-use [3] for choosing the relocatable compiler, therefore we need to substitute the value with something that will not be picked up as a hash from an existing opam valuation of build-id. For now we choose a magic number that is easily recognizable in case anything needs to be debugged. [1] https://github.com/ocaml/opam/blob/master/src/state/opamPackageVar.ml [2] https://github.com/ocaml/opam/wiki/Spec-for-Extended-package-specific-variables [3] https://github.com/dra27/opam-repository/tree/relocatable Addressing relevant concern in: - #13229
96d4bac to
eaaebab
Compare
Alizter
commented
Jan 26, 2026
b604e28 to
4fcca47
Compare
4fcca47 to
ead22d4
Compare
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
When a package is absent from the solution, its 'installed' variable is known to be false. This change evaluates it at solve time in both filter contexts and string interpolation contexts, enabling further simplification. Signed-off-by: Ali Caglayan <alizter@gmail.com>
…solve time Extends the absent package variable evaluation to also handle 'pinned' and 'enable' variables, which are also false for absent packages. Also skips wrapping constant filters with catch_undefined_var since they cannot throw undefined variable exceptions. Signed-off-by: Ali Caglayan <alizter@gmail.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
ead22d4 to
e389f75
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.
This PR adds a way for us to detect if a compiler in our "package universe" is relocatable. Knowing this means we can avoid the use of our toolchains functionality and instead build the compiler like a regular package.
The current chosen heuristic for knowing so is by inspecting if we have the
reloctable-compilermeta-package available (for interoperability with David's relocatable opam repository) or by checking the compiler version to be 5.5, the next release of the compiler which is relocatable.We add a test checking the checking behaviour and making sure that compiler-like packages are able to be cached in these cases.
To try it out for yourself, put the following in
dune-workspace: