-
Notifications
You must be signed in to change notification settings - Fork 725
Filter out files that are not ending in .c from c-sources #9200
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
Changes from 2 commits
a275708
b212885
ca584d3
d2831d8
eee9fc9
af40adb
a73d8c3
128e56d
9e79a1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -707,33 +707,39 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do | |
| -- build any C sources | ||
| unless (not has_code || null (cSources libBi)) $ do | ||
| info verbosity "Building C Sources..." | ||
| sequence_ | ||
| [ do let baseCcOpts = Internal.componentCcGhcOptions verbosity implInfo | ||
| lbi libBi clbi relLibTargetDir filename | ||
| vanillaCcOpts = if isGhcDynamic | ||
| -- Dynamic GHC requires C sources to be built | ||
| -- with -fPIC for REPL to work. See #2207. | ||
| then baseCcOpts { ghcOptFPic = toFlag True } | ||
| else baseCcOpts | ||
| profCcOpts = vanillaCcOpts `mappend` mempty { | ||
| ghcOptProfilingMode = toFlag True, | ||
| ghcOptObjSuffix = toFlag "p_o" | ||
| } | ||
| sharedCcOpts = vanillaCcOpts `mappend` mempty { | ||
| ghcOptFPic = toFlag True, | ||
| ghcOptDynLinkMode = toFlag GhcDynamicOnly, | ||
| ghcOptObjSuffix = toFlag "dyn_o" | ||
| } | ||
| odir = fromFlag (ghcOptObjDir vanillaCcOpts) | ||
| createDirectoryIfMissingVerbose verbosity True odir | ||
| let runGhcProgIfNeeded ccOpts = do | ||
| needsRecomp <- checkNeedsRecompilation filename ccOpts | ||
| when needsRecomp $ runGhcProg ccOpts | ||
| runGhcProgIfNeeded vanillaCcOpts | ||
| unless forRepl $ | ||
| whenSharedLib forceSharedLib (runGhcProgIfNeeded sharedCcOpts) | ||
| unless forRepl $ whenProfLib (runGhcProgIfNeeded profCcOpts) | ||
| | filename <- cSources libBi] | ||
| let (cSrcs', others) = partition (\filepath -> ".c"`isSuffixOf` filepath) (cSources libBi) | ||
| unless (null others) $ do | ||
| let files = intercalate ", " others | ||
| let libraryName = case libName lib of | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The output is unsatisfying. Especially because it is:
So the output would be:
The double single quotes are not a mistake. And if it's the main library, it only outputs "library", which breaks the flow of the sentence.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is any better? Otherwise, it's ok.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or rephrase as "The following files listed in the c-sources of the library 'lib2' will not be used"
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fgaz I don't understand what this suggestion is addressing, sorry
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you phrase it like that, you can use
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But we lose the "main" bit, which is fairly important.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. I wonder if
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes indeed, we will have to formalise a bit more the presentation layer for cabal-install. |
||
| LMainLibName -> "the main library" | ||
| LSubLibName name -> "library " <> prettyShow name | ||
| warn verbosity $ "The following files listed in " <> libraryName <> "'s c-sources will not be used: " <> files | ||
| forM_ cSrcs' $ \filename -> do | ||
| let baseCcOpts = Internal.componentCcGhcOptions verbosity implInfo | ||
| lbi libBi clbi relLibTargetDir filename | ||
| vanillaCcOpts = if isGhcDynamic | ||
| -- Dynamic GHC requires C sources to be built | ||
| -- with -fPIC for REPL to work. See #2207. | ||
| then baseCcOpts { ghcOptFPic = toFlag True } | ||
| else baseCcOpts | ||
| profCcOpts = vanillaCcOpts `mappend` mempty { | ||
| ghcOptProfilingMode = toFlag True, | ||
| ghcOptObjSuffix = toFlag "p_o" | ||
| } | ||
| sharedCcOpts = vanillaCcOpts `mappend` mempty { | ||
| ghcOptFPic = toFlag True, | ||
| ghcOptDynLinkMode = toFlag GhcDynamicOnly, | ||
| ghcOptObjSuffix = toFlag "dyn_o" | ||
| } | ||
| odir = fromFlag (ghcOptObjDir vanillaCcOpts) | ||
| createDirectoryIfMissingVerbose verbosity True odir | ||
| let runGhcProgIfNeeded ccOpts = do | ||
| needsRecomp <- checkNeedsRecompilation filename ccOpts | ||
| when needsRecomp $ runGhcProg ccOpts | ||
| runGhcProgIfNeeded vanillaCcOpts | ||
| unless forRepl $ | ||
| whenSharedLib forceSharedLib (runGhcProgIfNeeded sharedCcOpts) | ||
| unless forRepl $ whenProfLib (runGhcProgIfNeeded profCcOpts) | ||
|
|
||
| -- build any JS sources | ||
| unless (not has_code || not hasJsSupport || null (jsSources libBi)) $ do | ||
|
|
@@ -1528,31 +1534,34 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do | |
|
|
||
| -- build any C sources | ||
| unless (null cSrcs) $ do | ||
| info verbosity "Building C Sources..." | ||
| sequence_ | ||
| [ do let baseCcOpts = Internal.componentCcGhcOptions verbosity implInfo | ||
| info verbosity "Building C Sources..." | ||
| let (cSrcs', others) = partition (\filepath -> ".c"`isSuffixOf` filepath) cSrcs | ||
| unless (null others) $ do | ||
| let files = intercalate ", " others | ||
| warn verbosity $ "The following files listed in c-sources will not be used: " <> files | ||
| forM_ cSrcs' $ \filename -> do | ||
| let baseCcOpts = Internal.componentCcGhcOptions verbosity implInfo | ||
| lbi bnfo clbi tmpDir filename | ||
| vanillaCcOpts = if isGhcDynamic | ||
| -- Dynamic GHC requires C sources to be built | ||
| -- with -fPIC for REPL to work. See #2207. | ||
| then baseCcOpts { ghcOptFPic = toFlag True } | ||
| else baseCcOpts | ||
| profCcOpts = vanillaCcOpts `mappend` mempty { | ||
| ghcOptProfilingMode = toFlag True | ||
| } | ||
| sharedCcOpts = vanillaCcOpts `mappend` mempty { | ||
| ghcOptFPic = toFlag True, | ||
| ghcOptDynLinkMode = toFlag GhcDynamicOnly | ||
| } | ||
| opts | needProfiling = profCcOpts | ||
| | needDynamic = sharedCcOpts | ||
| | otherwise = vanillaCcOpts | ||
| odir = fromFlag (ghcOptObjDir opts) | ||
| createDirectoryIfMissingVerbose verbosity True odir | ||
| needsRecomp <- checkNeedsRecompilation filename opts | ||
| when needsRecomp $ | ||
| runGhcProg opts | ||
| | filename <- cSrcs ] | ||
| let vanillaCcOpts = if isGhcDynamic | ||
| -- Dynamic GHC requires C sources to be built | ||
| -- with -fPIC for REPL to work. See #2207. | ||
| then baseCcOpts { ghcOptFPic = toFlag True } | ||
| else baseCcOpts | ||
| let profCcOpts = vanillaCcOpts `mappend` mempty { | ||
| ghcOptProfilingMode = toFlag True | ||
| } | ||
| let sharedCcOpts = vanillaCcOpts `mappend` mempty { | ||
| ghcOptFPic = toFlag True, | ||
| ghcOptDynLinkMode = toFlag GhcDynamicOnly | ||
| } | ||
| let opts | needProfiling = profCcOpts | ||
| | needDynamic = sharedCcOpts | ||
| | otherwise = vanillaCcOpts | ||
| let odir = fromFlag (ghcOptObjDir opts) | ||
| createDirectoryIfMissingVerbose verbosity True odir | ||
| needsRecomp <- checkNeedsRecompilation filename opts | ||
| when needsRecomp $ | ||
| runGhcProg opts | ||
|
|
||
| -- TODO: problem here is we need the .c files built first, so we can load them | ||
| -- with ghci, but .c files can depend on .h files generated by ghc by ffi | ||
|
|
||
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.
Why is
LocalBuildInfochanging?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.
No idea
Uh oh!
There was an error while loading. Please reload this page.
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.
Try rebasing, it should disappearThere 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 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.
@andreabedini I'm saying that because this appears to be based on an old commit with a different structured hash (
0xbb22... doesn't appear anywhere in HEAD)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.
@fgaz rebasing on current 3.10 you mean?
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.
Nevermind, I grepped the wrong branch 🙈