Skip to content

Add hidir setting - master branch#3968

Closed
christiaanb wants to merge 8 commits intohaskell:masterfrom
christiaanb:hidir-master
Closed

Add hidir setting - master branch#3968
christiaanb wants to merge 8 commits intohaskell:masterfrom
christiaanb:hidir-master

Conversation

@christiaanb
Copy link
Collaborator

This is the version of #3955 based against master (instead of v1.24.0.0)

This pull request:

@mention-bot
Copy link

@christiaanb, thanks for your PR! By analyzing the history of the files in this pull request, we identified @dcoutts, @hvr and @ezyang to be potential reviewers.

@23Skidoo
Copy link
Member

23Skidoo commented Oct 9, 2016

Is this ready for review or still WIP?

@christiaanb
Copy link
Collaborator Author

This is ready for review


.. option:: --hidir=dir

Interfaces of libraries are installed here.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expand this section a little bit to explain that normally hidir is the same as libdir <\> libsubdir, except on some broken systems where we must set libdir to "".

@23Skidoo
Copy link
Member

23Skidoo commented Oct 9, 2016

Looks OK to me. Just add a changelog note and this will be good to go.

@23Skidoo
Copy link
Member

Looks like there are failing tests.

@christiaanb
Copy link
Collaborator Author

Yes, the failing test was due to https://ci.appveyor.com/project/ezyang/cabal/build/1.0.1740, however, that seems to be fixed in the latest master. I've rebased, everything should go through.

@23Skidoo
Copy link
Member

I'm not sure your analysis is correct, but let's see.

@23Skidoo
Copy link
Member

Yep, still fails. Looks like the problem is that we're not filtering out --hidir when invoking Setup scripts compiled with versions of Cabal that don't support it.

@23Skidoo
Copy link
Member

@christiaanb Look at filterConfigureFlags to get an idea of how we usually deal with such problems.

@23Skidoo
Copy link
Member

Seems to be still not fully fixed.

@christiaanb
Copy link
Collaborator Author

OK, I need help... I thought that 3a3b99c ensures that the --hidir flag is not passed to older Cabal's. It seems that it is not enough. Can anyone see what I'm doing wrong?

@23Skidoo
Copy link
Member

I'll look into this later today or tomorrow.

@christiaanb
Copy link
Collaborator Author

OK, I figured it out, all tests are green now.

@23Skidoo
Copy link
Member

Nice. Are we OK with old Setups putting all .hi files in $libdir on macOS?

@christiaanb
Copy link
Collaborator Author

@23Skidoo No... that shouldn't happen. Although I see how my patch does that sigh

Although I have no idea how to fix that properly.

  • The problem is that I have no idea how and where to determine that the --libsubdir that we are passing to the Setup executable is accidentally equal to the default $libsubdir, or whether it is purposely set to a filepath that just happens to be equal to the $libsubdir specified by the user.

@23Skidoo
Copy link
Member

23Skidoo commented Oct 11, 2016

I think that you have to refactor the Flag type (or at least InstallDirs) to preserve that information. Then during config file/command line parsing you would remember whether it's set by user or uses the default value.

@dcoutts
Copy link
Contributor

dcoutts commented Oct 11, 2016

Ugg.

@23Skidoo do you recall how we used to make this work with ELF .so libs? I'm pretty sure they used to go into the $libdir not $libdir/$libsubdir. How did that work without us having a separate hidir?

@christiaanb
Copy link
Collaborator Author

I want to note that I'm not too happy with c0ab0e8 either. But I'm feeling a bit under the weather, and I only have time to work on this during the evening, and there's the pending GHC 8.0.2 release. I tried to refector Flag into

data Flag a = UserFlag a | DefaultFlag a | NoFlag

But that just turned into a big mess.

I guess I could revert c0ab0e8 and then we'll just end up putting .hi files in the same directory as the .dylib when we use a Setup build against an older version of Cabal

@23Skidoo
Copy link
Member

23Skidoo commented Oct 12, 2016

@dcoutts Not sure about that, but I've noticed that we have a dynlibdir field in InstallDirs. Maybe we can reuse that instead of adding hidir?

Also there's this comment by @ezyang in D.C.Install:

-- TODO: decide if we need the user to be able to control the libdir
-- for shared libs independently of the one for static libs. If so
-- it should also have a flag in the command line UI
-- For the moment use dynlibdir = libdir

@23Skidoo
Copy link
Member

@dcoutts Turns out that this comment was originally added by you in 0e5cf59 and 51d621e. So --dynlibdir is ignored by versions of Cabal released after 2009. It probably still makes sense to revive it instead of adding hidir, butt this won't help with backwards compat.

@ezyang
Copy link
Contributor

ezyang commented Oct 12, 2016

I tried to refector Flag into

Yeah, bad idea. If you want to do something like that, just do it for the particular field. (Have not been following convo, don't know the global picture.)

@christiaanb
Copy link
Collaborator Author

Given the problem of copying .hi files when using a Setup build again an older Cabal, I'm abandoning this PR. Instead, I'm reviving --dynlibdir: I'm building and testing it now and will submit a new PR soon.

@christiaanb
Copy link
Collaborator Author

The new PR is #3979

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants