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

Relax cabal version #56

Closed
wants to merge 1 commit into from
Closed

Relax cabal version #56

wants to merge 1 commit into from

Conversation

dmjio
Copy link

@dmjio dmjio commented Oct 31, 2016

Allows for building with 7.10.3, otherwise nixpkgs ghcjs version rejects this.

Allows for building with `7.10.3`, otherwise nixpkgs ghcjs version rejects this.
@dmjio
Copy link
Author

dmjio commented Oct 31, 2016

Haha, well this apparently breaks #42 if merged

@dmjio
Copy link
Author

dmjio commented Oct 31, 2016

I think we should revisit #42, since the parse error is caused by the line 575 in ghcjs-dom-jsffi

          -- Generated by domconv-webkit-jsffi

By removing that line, I was able to build successfully with cabal-1.22.

The following sed scripts (reverting cabal-version to 1.22, and removing line 575), allow ghcjs-dom-jsffi to be built by cabal 1.22, ghc 7.10.3 on nix (and use the ghcjsi repl).

ghcjs-dom-jsffi = overrideCabal super.ghcjs-dom-jsffi (drv: {                                                                                                                   
    isLibrary = true;                                                                                                                                                             
    libraryHaskellDepends = [ self.text self.base self.ghcjs-base self.ghcjs-prim self.ghc-prim ];                                                                                
    preConfigure = ''                                                                                                                                                             
      sed -i 's|cabal-version: >=1.24|cabal-version: >=1.22|' *.cabal                                                                                                             
      sed -i '575d' *.cabal                                                                                                                                                       
    '';                                                                                                                                                                           
  });     

cc @hamishmack

@dmjio
Copy link
Author

dmjio commented Oct 31, 2016

I propose we revert the cabal-version back to 1.22 and remove line 575. @hamishmack, with your permission I can submit a PR.

@dmjio
Copy link
Author

dmjio commented Oct 31, 2016

Also, since all of the modules from ghcjs-dom-jsffi are getting re-exported to ghcjs-dom, it has the same problem.

It seems like cabal is stripping the line, but that puts the module name awkwardly against the colon, causing a parse error:

":GHCJS.DOM.JSFFI.Generated.ANGLEInstancedArrays,"

There should be whitespace between the colon and the module name, think this has to do with https://github.com/ghcjs/domconv-webkit generation.

EDIT: Of course, all of this is fine in Cabal 1.24, but if we want to use 1.22 (w/ old GHC on nixpkgs) then we run into this issue. I think we should make this change because GHCJS's REPL currently hasn't been ported to GHC8 and it's a big part of workflow.

@hamishmack
Copy link
Member

Why can't we use Cabal 1.24 when building ghcjs-dom with GHC 7.10? That is what we do on travis for instance.

@3noch
Copy link

3noch commented Oct 31, 2016

@dmjio From nixpkgs-unstable several weeks ago:

(import <nixpkgs> {}).haskell.packages.ghc7103.cabal-install
«derivation /nix/store/3qsv40dpjz3dahk3jrhqb6963lfmq93g-cabal-install-1.24.0.0.drv»

@dmjio
Copy link
Author

dmjio commented Oct 31, 2016

@3noch, yes, and great point. I have cabal-install-1.24.0.0 installed into my nix profile, available anywhere. BUT, it appears, and I think this is specific to the way that nix builds ghcjs packages, that the version of cabal used is hard-coded to a previous version (1.22) . Here's my reasoning for that:

cabal get ghcjs-dom-jsffi
{ mkDerivation, base, ghc-prim, ghcjs-base, ghcjs-prim, stdenv
, text, transformers
}:
mkDerivation {
  pname = "ghcjs-dom-jsffi";
  version = "0.5.0.2";
  src = ./.;
  libraryHaskellDepends = [
    base ghc-prim ghcjs-base ghcjs-prim text transformers
  ];
  description = "DOM library using JSFFI and GHCJS";
  license = stdenv.lib.licenses.mit;
}

now build:

λ Davids-MacBook-Pro-3 ghcjs-dom-jsffi-0.5.0.2 →    nix-build --argstr compiler ghcjs                                                
these derivations will be built:
  /nix/store/lsy332vz0wzh5lpp6bzfifi40ccvw526-ghcjs-dom-jsffi-0.5.0.2.drv
building path(s) ‘/nix/store/bmw23n8cgdib62yblg5vsibkyjkxxf80-ghcjs-dom-jsffi-0.5.0.2’
setupCompilerEnvironmentPhase
Build with /nix/store/3wcmkv4zxnsr1acapsb3dyyk2pxaxng9-ghcjs-0.2.0.
unpacking sources
unpacking source archive /nix/store/w50hnii3xmmlm7hrmgfzar3ircnmrbiw-ghcjs-dom-jsffi-0.5.0.2
source root is ghcjs-dom-jsffi-0.5.0.2
patching sources
compileBuildDriverPhase
setupCompileFlags: -package-db=/private/var/folders/m_/z586qg2d7gg1flh7y3nvw5600000gn/T/nix-build-ghcjs-dom-jsffi-0.5.0.2.drv-0/package.conf.d -j8
[1 of 1] Compiling Main             ( Setup.lhs, /private/var/folders/m_/z586qg2d7gg1flh7y3nvw5600000gn/T/nix-build-ghcjs-dom-jsffi-0.5.0.2.drv-0/Main.o )
Linking Setup ...
configuring
configureFlags: --verbose --prefix=/nix/store/bmw23n8cgdib62yblg5vsibkyjkxxf80-ghcjs-dom-jsffi-0.5.0.2 --libdir=$prefix/lib/$compiler --libsubdir=$pkgid --with-gcc=clang --package-db=/private/var/folders/m_/z586qg2d7gg1flh7y3nvw5600000gn/T/nix-build-ghcjs-dom-jsffi-0.5.0.2.drv-0/package.conf.d --ghc-option=-optl=-Wl,-headerpad_max_install_names --disable-split-objs --disable-library-profiling --disable-executable-profiling --enable-shared --enable-library-vanilla --enable-executable-dynamic --disable-tests --with-hsc2hs=/nix/store/3lq4vnskmywlqxjprfjvy2plz6w02qk4-ghc-7.10.3/bin/hsc2hs --ghcjs
Warning: ghcjs-dom-jsffi.cabal: This package requires at least Cabal version
1.24
Configuring ghcjs-dom-jsffi-0.5.0.2...
Setup: This package description follows version 1.24 of the Cabal
specification. This tool only supports up to version 1.22.5.0.
builder for ‘/nix/store/lsy332vz0wzh5lpp6bzfifi40ccvw526-ghcjs-dom-jsffi-0.5.0.2.drv’ failed with exit code 1
error: build of ‘/nix/store/lsy332vz0wzh5lpp6bzfifi40ccvw526-ghcjs-dom-jsffi-0.5.0.2.drv’ failed

This line indicates that it's getting built with an early cabal

Setup: This package description follows version 1.24 of the Cabal
specification. This tool only supports up to version 1.22.5.0.

I'm still looking into it, but think we might be able to upgrade this somehow. cc @hamishmack

@dmjio
Copy link
Author

dmjio commented Oct 31, 2016

@hamishmack @3noch I can confirm 100% that new ghcjs packages, when evaluated with nix-build, all use cabal-1.22

mkdir new-proj && cd new-proj
cabal init
nix-build --argstr compiler ghcjs
...
`Using Cabal-1.22.5.0 compiled by ghc-7.10`

@3noch
Copy link

3noch commented Oct 31, 2016

@dmjio Oh dear.

@rvl
Copy link

rvl commented Nov 21, 2016

If you are able to use the ghcjs-8.0 branch, then check out the latest nixpkgs master. We merged NixOS/nixpkgs#20474 which lets ghcjs-dom build (using Cabal 1.24).

@hamishmack
Copy link
Member

Closing as I think nix has moved on to Cabal >= 1.24 now

@hamishmack hamishmack closed this Jan 19, 2017
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.

4 participants