-
Notifications
You must be signed in to change notification settings - Fork 696
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
basedir #4874
basedir #4874
Conversation
Cabal/Distribution/Simple/Setup.hs
Outdated
@@ -332,6 +332,12 @@ data ConfigFlags = ConfigFlags { | |||
|
|||
configDistPref :: Flag FilePath, -- ^"dist" prefix | |||
configCabalFilePath :: Flag FilePath, -- ^ Cabal file to use | |||
configBaseDir :: Flag FilePath, -- ^ The directory containing the |
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.
So now takeBaseName configCabalFilePath == configBaseDir
doesn't need to hold? I still don't quite understand why you need a new option and can't use takeBaseName $ configCabalFilePath
.
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.
You are not bound to have the configCabalFilePath
. E.g. given the following invocation:
defaultMainWithHooksNoReadArgs hooks gpd ["--basedir", "/path/to/happiness"]
you do not have the --cabalConfigFilePath
.
And I'm not sure we want to force providing the --cabalConfigFilePath
? If we can agree that we want to require the --cabalConfigFilePath
in those cases. I'm happy to change to takeBaseName
.
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.
You are not bound to have the
configCabalFilePath
.
But this isn't different from the situation when configBaseDir
is NoFlag
. Your example can be written as defaultMainWithHooksNoReadArgs hooks gpd ["--cabal-file", "/path/to/happiness/happiness.cabal"]
with --cabal-file
.
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.
You are right. the more verbose solution, might be the less error prone. Let's do it that way.
b37a97d
to
e0b806f
Compare
Cabal/Distribution/Simple.hs
Outdated
(programInvocation (sh {programOverrideEnv = overEnv}) args') | ||
{ progInvokeCwd = Just (baseDir lbi) } |
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.
I believe this change breaks on windows. I'm not sure exactly why yet.
25e6776
to
b8fe569
Compare
@angerman idk, it does this sometimes. Maybe connectivity issues between GH and Travis. Try making a small tweak (so that commit hash gets changed) and force-pushing. |
@angerman |
Let's see if this does the trick. |
7a1b873
to
e5fa845
Compare
Note to self: need to figure out why test fail. |
e5fa845
to
833bc6d
Compare
@23Skidoo, @ezyang this also fails with downstream travis. I'd really like to get this merged. As it's a prerequisite for the relocatable hadrian (building ghc with shake) snowleopard/hadrian#445 PR, and I'm trying to tie up loose ends here. |
I believe something on master started breaking windows :( |
6b2e2bd
to
caac29b
Compare
Rebased onto #5132 |
# Conflicts: # Cabal/Distribution/Simple.hs
If we have a cabalFilePath, just invoke the configure script there. Otherwise try to invoke it locally to the CWD. But don't try to shell out in a different directory, that would mess up the paths. In general we want to run /path/to/configure from the bulid directory (e.g. outside of the package folder).
caac29b
to
767efff
Compare
rebased onto master |
all green! |
@23Skidoo can we get this merged now? |
I'll merge this later today or tomorrow, there are some small changes I want to make. Sorry for the delay, I've been ill. |
@23Skidoo thanks! |
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.
I have some comments, but basically this is IMO mergeable.
srcHeaders <- forM relIncDirs $ \dir -> | ||
fmap (dir </>) . filter isHeader <$> listDirectory (baseDir lbi </> dir) | ||
`catchIO` (\_ -> return []) | ||
let commonHeaders = concat genHeaders `intersect` concat srcHeaders |
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.
This doesn't catch stuff like #include "foo/foo.h"
or #include "../../foo.h"
. The latter we can ignore I think, for the former we'll need to walk the directory recursively.
@@ -487,7 +493,13 @@ sanityCheckHookedBuildInfo pkg_descr (_, hookExes) | |||
|
|||
sanityCheckHookedBuildInfo _ _ = return () | |||
|
|||
-- | Try to read the 'localBuildInfoFile' | |||
tryGetBuildConfig :: UserHooks -> Verbosity -> FilePath |
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.
Weird, I was quite sure we already had this function somewhere...
getHookedBuildInfo verbosity | ||
readHookWithArgs get_verbosity get_dist_pref _ flags = do | ||
dist_dir <- findDistPrefOrDefault (get_dist_pref flags) | ||
getHookedBuildInfo (dist_dir </> "build") verbosity |
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.
I'm not totally keen on the fact that we're hardcoding "build"
everywhere. This works with new-build
directory structure, right?
getHookedBuildInfo :: Verbosity -> IO HookedBuildInfo | ||
getHookedBuildInfo verbosity = do | ||
maybe_infoFile <- defaultHookedPackageDesc | ||
getHookedBuildInfo :: FilePath -> Verbosity -> IO HookedBuildInfo |
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.
We should mention in the changelog/migration guide that this function has changed type.
@@ -1536,6 +1536,7 @@ findPackageDesc dir | |||
tryFindPackageDesc :: FilePath -> IO FilePath | |||
tryFindPackageDesc dir = either die return =<< findPackageDesc dir | |||
|
|||
{-# DEPRECATED defaultHookedPackageDesc "Use findHookedPackageDesc with the proper base directory instead" #-} | |||
-- |Optional auxiliary package information file (/pkgname/@.buildinfo@) |
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.
This should also be mentioned in the changelog.
Just waiting for it to go green now... |
Merged, thanks! |
++ PD.includeDirs bi | ||
-- potential includes generated by `configure' | ||
-- in the build directory | ||
++ [buildDir lbi </> dir | dir <- PD.includeDirs 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.
Don't you need to filter out absolute paths here as well?
Mac OS X regression caused by this: https://ghc.haskell.org/trac/ghc/ticket/14972 In general, the new files in |
I've created https://phabricator.haskell.org/D4553, which should ensure that what ever |
Please include the following checklist in your PR:
[ci skip]
is used to avoid triggering the build bots.Please also shortly describe how you tested your change. Bonus points for added tests!