diff options
author | Charles Strahan <charles.c.strahan@gmail.com> | 2015-05-06 15:56:02 -0400 |
---|---|---|
committer | Charles Strahan <charles.c.strahan@gmail.com> | 2015-05-08 11:33:44 -0400 |
commit | 929dc4199a57b5d21eb72077f735eb33c4c7b09b (patch) | |
tree | 2d5ebe677c30872b8cc9a26a16498ea727789d6c /pkgs/development/compilers/ghcjs | |
parent | 9cb6ebe15ee0a272fe648f8806edbccddbb5c6c1 (diff) | |
download | nixpkgs-929dc4199a57b5d21eb72077f735eb33c4c7b09b.tar nixpkgs-929dc4199a57b5d21eb72077f735eb33c4c7b09b.tar.gz nixpkgs-929dc4199a57b5d21eb72077f735eb33c4c7b09b.tar.bz2 nixpkgs-929dc4199a57b5d21eb72077f735eb33c4c7b09b.tar.lz nixpkgs-929dc4199a57b5d21eb72077f735eb33c4c7b09b.tar.xz nixpkgs-929dc4199a57b5d21eb72077f735eb33c4c7b09b.tar.zst nixpkgs-929dc4199a57b5d21eb72077f735eb33c4c7b09b.zip |
ghcjs: properly wrap binaries in environment
This also: 1 Builds Setup.hs with ghcjs, which (among other things) defines __GHCJS__ and ghcjs_HOST_OS during pre-processing. 2 Fixes ghc-paths to point at ghcjs and use NIX_GHCJS_* env-vars. 3 Boots ghcjs into $prefix/lib/$compiler.
Diffstat (limited to 'pkgs/development/compilers/ghcjs')
-rw-r--r-- | pkgs/development/compilers/ghcjs/default.nix | 17 | ||||
-rw-r--r-- | pkgs/development/compilers/ghcjs/ghcjs.patch | 20 |
2 files changed, 22 insertions, 15 deletions
diff --git a/pkgs/development/compilers/ghcjs/default.nix b/pkgs/development/compilers/ghcjs/default.nix index 19308218788..24a361724ae 100644 --- a/pkgs/development/compilers/ghcjs/default.nix +++ b/pkgs/development/compilers/ghcjs/default.nix @@ -39,10 +39,6 @@ }: let version = "0.1.0"; - ghcArch = if pkgs.stdenv.system == "i686-linux" - then "i386-linux" - else pkgs.stdenv.system; - libDir = "share/ghcjs/${ghcArch}-${version}-${ghc.version}/ghcjs"; ghcjsBoot = fetchgit { url = git://github.com/ghcjs/ghcjs-boot.git; rev = "ab8765edcb507b8b810e3c324fd5bd5af2b69d8f"; # 7.10 branch @@ -84,14 +80,19 @@ in mkDerivation (rec { ]; patches = [ ./ghcjs.patch ]; postPatch = '' - substituteInPlace Setup.hs --replace "/usr/bin/env" "${coreutils}/bin/env" - substituteInPlace src/Compiler/Info.hs --replace "@PREFIX@" "$out" + substituteInPlace Setup.hs \ + --replace "/usr/bin/env" "${coreutils}/bin/env" + + substituteInPlace src/Compiler/Info.hs \ + --replace "@PREFIX@" "$out" \ + --replace "@VERSION@" "${version}" + substituteInPlace src-bin/Boot.hs \ --replace "@PREFIX@" "$out" \ --replace "@CC@" "${stdenv.cc}/bin/cc" ''; preBuild = '' - local topDir=$out/${libDir} + local topDir=$out/lib/ghcjs-${version} mkdir -p $topDir cp -r ${ghcjsBoot} $topDir/ghcjs-boot @@ -116,9 +117,9 @@ in mkDerivation (rec { --with-gmp-libraries ${gmp}/lib ''; passthru = { - inherit libDir; isGhcjs = true; nativeGhc = ghc; + inherit nodejs; }; homepage = "https://github.com/ghcjs/ghcjs"; diff --git a/pkgs/development/compilers/ghcjs/ghcjs.patch b/pkgs/development/compilers/ghcjs/ghcjs.patch index 618656f787c..751f114ba43 100644 --- a/pkgs/development/compilers/ghcjs/ghcjs.patch +++ b/pkgs/development/compilers/ghcjs/ghcjs.patch @@ -60,15 +60,21 @@ index 3c68dcf..64f3cf7 100644 , "--haddock-html" -- workaround for hoogle support being broken in haddock for GHC 7.10RC1 diff --git a/src/Compiler/Info.hs b/src/Compiler/Info.hs -index 33a401f..5d09c86 100644 +index 33a401f..79833c5 100644 --- a/src/Compiler/Info.hs +++ b/src/Compiler/Info.hs -@@ -49,7 +49,7 @@ compilerInfo nativeToo dflags = do +@@ -48,13 +48,7 @@ compilerInfo nativeToo dflags = do + -- | the directory to use if started without -B flag getDefaultTopDir :: IO FilePath - getDefaultTopDir = do +-getDefaultTopDir = do - appdir <- getAppUserDataDirectory "ghcjs" -+ let appdir = "@PREFIX@/share/ghcjs" - return (appdir </> subdir </> "ghcjs") - where - targetARCH = arch +- return (appdir </> subdir </> "ghcjs") +- where +- targetARCH = arch +- targetOS = os +- subdir = targetARCH ++ '-':targetOS ++ '-':getFullCompilerVersion ++getDefaultTopDir = return "@PREFIX@/lib/ghcjs-@VERSION@" + + getDefaultLibDir :: IO FilePath + getDefaultLibDir = getDefaultTopDir |