Allow pre-build rules to generate autogen extra sources files#11573
Open
sheaf wants to merge 2 commits into
Open
Allow pre-build rules to generate autogen extra sources files#11573sheaf wants to merge 2 commits into
sheaf wants to merge 2 commits into
Conversation
91b3755 to
3b46b10
Compare
5169edc to
78d6613
Compare
78d6613 to
4548738
Compare
zlonast
reviewed
May 24, 2026
zlonast
approved these changes
May 24, 2026
tdammers
approved these changes
May 27, 2026
4548738 to
00ab6d5
Compare
With this commit, the SetupHooks API now considers all extra source files placed in the autogen directory for the component to be additional demands on pre-build rules. For example, a pre-build rule that generates a C or JavaScript source file (putting it in the appropriate autogen module for the component) will now be run, while it used to not be run before (as it used to be considered "not demanded"). In addition, 'extra-bundled-libraries' also add demands. Any file in the autogenerated directory for the component whose name matches with a library name specified in 'extra-bundled-libraries' (ignoring file extension) will provide a rule demand. Fixes haskell#10791 Fixes haskell#11607
32a772c to
0a10884
Compare
0a10884 to
3d6cb13
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 fixes #11607 and #10791, making it possible to write pre-build rules that generate files other
than Haskell files: non-Haskell source files and extra library files.
Because there is no counterpart to
autogen-modulesfor non-Haskell sourcefiles, authors of pre-build rules will need to proceed in two steps:
In a per-component pre-configure hook, the files the author desires to generate
must be added to the relevant fields, e.g. the
cSourcesfield ofBuildInfo.These files must be relative to
autogenCompModulesDir.Pre-build rules generating these files will now be demanded. This avoids
getting an error message "The following pre-build rules are not demanded
and will not be run".
Note that include files (such as
.hfiles) are a bit different: any fileslisted under
includes/autogen-includesare required at configure time.This gives
SetupHooksauthors two choices: either list the include files inautogen-includesbut generate them in a pre-configure hook, or don't list themthere and generate them in a pre-build rule, relying on the files getting picked
up from included directories (this may be brittle).
Template Α: This PR modifies behaviour or interface
significance: significantin the changelog file.