-
Notifications
You must be signed in to change notification settings - Fork 701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement {cmm.asm}-{options,sources} for real #6033
Conversation
🤔 |
TIL about Draft PRs, nice feature. |
I've added some missing C-- bits to @hvr's patch: https://github.com/hsyl20/cabal/tree/hsyl20-asm-cmm-sources |
@hsyl20 thank you! I'll look at your branch asap and will cherry-pick the delta into this PR if it looks good |
🎉 |
@hsyl20 I tested the code a bit, and it works partly; specifically |
ghcOptPackages = toNubListR $ mkGhcOptPackages clbi, | ||
ghcOptOptimisation = toGhcOptimisation (withOptimization lbi), | ||
ghcOptDebugInfo = toFlag (withDebugInfo lbi), | ||
ghcOptExtra = hcOptions GHC bi, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops I forgot to fix this while copy-pasting from the other cases: s/hcOptions GHC bi/cmmOptions bi/
I guess it should fix cmm-options passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah... this is the kind of bugs I was worried about... :-)
I've rebased and updated the PR to include your fixup suggestion; I'm currently testdriving this locally
I'm also going to un-DRAFT this PR to invite more code-review
While those buildinfo fields were added to the parser some time ago via 57d7f28 and 4a28765 that work was never completed by implementing the necessary build/sdist logic in Cabal. This commit remedies this oversight by implementing and wiring up the missing build logic. *WARNING* this commit is still very WIP; ASM works mostly; C-- support is still incomplete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good modulo one comment.
-- information. | ||
addExtraAsmSources :: BuildInfo -> [FilePath] -> BuildInfo | ||
addExtraAsmSources bi extras = bi { asmSources = new } | ||
where new = Set.toList $ old `Set.union` exs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I have both preprocessor-generated asm-sources
and cmm-sources
, won't this add the union of these to the LBI's asmSources
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this probably will break if I have any preprocessor-generated C files at all.
Would be also nice to see a test case, would be even nicer if the test case had a custom preprocessor that generated |
@@ -216,7 +216,13 @@ buildComponent verbosity numJobs pkg_descr lbi suffixes | |||
setupMessage' verbosity "Building" (packageId pkg_descr) | |||
(componentLocalName clbi) (maybeComponentInstantiatedWith clbi) | |||
let libbi = libBuildInfo lib | |||
lib' = lib { libBuildInfo = addExtraCxxSources (addExtraCSources libbi extras) extras } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@23Skidoo based on your observation, wasn't this line already broken? i.e. the same FilePaths (i.e. extras
) being added to cxx and c sources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, looks like it.
While those buildinfo fields were added to the parser some time ago via 57d7f28 and 4a28765 that work was never completed by implementing the necessary build/sdist logic in Cabal. This commit remedies this oversight by implementing and wiring up the missing build logic. NOTE: This is a backport of (at time of writing) unfinished #6033 to the 3.0 branch Specifically preprocessor-generated asm/cmm-sources need more work. Co-authored-by: Sylvain Henry <sylvain@haskus.fr>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no tests.
While those buildinfo fields were added to the parser some time ago via 57d7f28 and 4a28765 that work was never completed by implementing the necessary build/sdist logic in Cabal. This commit remedies this oversight by implementing and wiring up the missing build logic. NOTE: This is a backport of (at time of writing) unfinished haskell#6033 to the 3.0 branch Specifically preprocessor-generated asm/cmm-sources need more work. Co-authored-by: Sylvain Henry <sylvain@haskus.fr>
These are only supported properly starting with cabal-version:3.0 (which has been enforced by Hackage as well -- via this very patch). See #6033 for details
These are only supported properly starting with cabal-version:3.0 (which has been enforced by Hackage as well -- via this very patch). See haskell#6033 for details
These are only supported properly starting with cabal-version:3.0 (which has been enforced by Hackage as well -- via this very patch). See haskell#6033 for details
These are only supported properly starting with cabal-version:3.0 (which has been enforced by Hackage as well -- via this very patch). See haskell#6033 for details
These are only supported properly starting with cabal-version:3.0 (which has been enforced by Hackage as well -- via this very patch). See haskell#6033 for details
While those buildinfo fields were added to the parser some time
ago via 57d7f28 and
4a28765 that work was never completed
by implementing the necessary build/sdist logic in Cabal.
This commit remedies this oversight by implementing and wiring up the
missing build logic.
cc @erikd
Things that work now (i.e. that I tested manually; these should be turned into testsuite tests long-term):
cmm-sources
andasm-sources
are compiled (in a separate phase likec-sources
are) and the resulting object files are linked into the respective component (i.e. likec-sources
)cabal sdist
properly includescmm-sources
andasm-sources
in the src-distcmm-options
are passed (directly) to GHC when compilingcmm-sources
asm-options
are passed (via-opta
) to GHC when compilingasm-sources
filesghc-options
are NOT passed to compilation ofcmm-sources
/asm-sources