Skip to content
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

Cabal postCopy hook doesn't get run #1016

Closed
mgsloan opened this issue Sep 20, 2015 · 7 comments
Closed

Cabal postCopy hook doesn't get run #1016

mgsloan opened this issue Sep 20, 2015 · 7 comments
Milestone

Comments

@mgsloan
Copy link
Contributor

mgsloan commented Sep 20, 2015

stack install nearly works for building ghcjs, but it doesn't use runhaskell Setup.hs copy to install the binaries, and so the ghcjs wrapper scripts don't get installed. See the ghcjs Setup.hs file

@mgsloan mgsloan added this to the P2: Should milestone Sep 20, 2015
@mgsloan mgsloan changed the title Setup.hs postCopy hook doesn't get run Cabal postCopy hook doesn't get run Sep 20, 2015
@snoyberg
Copy link
Contributor

That's very strange, are you suing that runhaskell Setup.hs install is not calling the postCopy hook?

@mgsloan
Copy link
Contributor Author

mgsloan commented Sep 20, 2015

Ahah, that is indeed exactly what's happening: https://mail.haskell.org/pipermail/cabal-devel/2010-July/006535.html

Summary is that runhaskell Setup.hs install doesn't call the postCopy hook, just the postInst hook. So, given that this behavior isn't going to change, I'd say this is a bug with GHCJS's Setup.hs. I'll open a PR fixing that.

@mgsloan
Copy link
Contributor Author

mgsloan commented Sep 20, 2015

PR for ghcjs: ghcjs/ghcjs#402

@mgsloan
Copy link
Contributor Author

mgsloan commented Sep 22, 2015

Ok, that worked for stack build, but not for stack install, since for install, it copies the binaries here. GHCJS's postCopy / postInstall hook adds more files to the bin directory and uses absolute paths in the wrapper scripts, so in order for it to work correctly, it also needs to be invoked for the final part of

So, it seems like the right thing to do is to invoke runhaskell Setup.hs copy, but this doesn't seem to directly work out. I've tried using Cabal copy with the flags that I'd think would make it work, but I get:

mgsloan@computer:~/user/Downloads/ghcjs-0.1.0$ runhaskell Setup.hs copy --destdir=~/.stack/programs/x86_64-linux/ghcjs-0.1.0_ghc-7.10.2/ --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/
Installing library in
~/.stack/programs/x86_64-linux/ghcjs-0.1.0_ghc-7.10.2/home/mgsloan/user/Downloads/ghcjs-0.1.0/.stack-work/install/x86_64-linux/lts-3.4/7.10.2/lib/x86_64-linux-ghc-7.10.2/ghcjs-0.1.0-DQPG8NNmyXW45lzfCqtgbc
Installing executable(s) in
~/.stack/programs/x86_64-linux/ghcjs-0.1.0_ghc-7.10.2/home/mgsloan/user/Downloads/ghcjs-0.1.0/.stack-work/install/x86_64-linux/lts-3.4/7.10.2/bin
Warning: The directory
~/.stack/programs/x86_64-linux/ghcjs-0.1.0_ghc-7.10.2/home/mgsloan/user/Downloads/ghcjs-0.1.0/.stack-work/install/x86_64-linux/lts-3.4/7.10.2/bin
is not in the system search path.

Note the path ~/.stack/programs/x86_64-linux/ghcjs-0.1.0_ghc-7.10.2/home/mgsloan/user/Downloads/ghcjs-0.1.0/.stack-work/install/x86_64-linux/lts-3.4/7.10.2/lib/x86_64-linux-ghc-7.10.2/ghcjs-0.1.0-DQPG8NNmyXW45lzfCqtgbc - looks like what's happening is that the configured install dir is getting appended with the requested destination dir. So, I think we'd need to do another configure in order to use copy for this.

@snoyberg thoughts?

@mgsloan mgsloan reopened this Sep 22, 2015
@snoyberg
Copy link
Contributor

I don't get it.

  1. Why do you need to use stack install for ghcjs? Keeping it local to the resolver seems correct to me.
  2. What's wrong with the original absolute paths being used? Does something actually break?

@mgsloan
Copy link
Contributor Author

mgsloan commented Sep 22, 2015

  1. Keeping it local to the resolver doesn't work for a few reasons:
    • Which resolver would we look in for our copy of ghcjs? We know to use GHCJS when you specify the ghcjs-0.1.0_ghc-7.10.2 resolver. Which snapshot do we look in for GHCJS?

    • I'm reusing the existing code for maintaining tools in ~/.stack/programs/

    • It's fine to not have it be resolver-local, as long as we

      • Add a stack.yaml file to ghcjs (I found that simply resolver: lts-3.4 was good enough)

      This way, there will always be a canonical set of dependencies for a given ghcjs version.

  2. Nothing breaks with the original absolute paths, except that initially they pointed into /tmp/! Infact, my current workaround is to unpack the source tarball into a folder such as .stack/programs/x86_64-linux/ghcjs-0.1.0_ghc-7.10.2/src. Then, I use stack --local-bin-path=... install.

Besides these specific details related to setting up GHCJS, here's the problem:

stack install doesn't invoke Setup.hs when copying binaries to the local-bin-path. It does, however, invoke it when copying them to local-install-root.

@mgsloan
Copy link
Contributor Author

mgsloan commented Sep 22, 2015

Looks like this will be resolved by #848

@mgsloan mgsloan closed this as completed Sep 22, 2015
mgsloan added a commit to mgsloan/ghcjs that referenced this issue Sep 24, 2015
mgsloan added a commit to mgsloan/ghcjs that referenced this issue Sep 24, 2015
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

No branches or pull requests

2 participants