ghcjs: init at 8.10.7

The src points to the obsidiansystems repo as it has the ghcjs ported from
8.10.5 to 8.10.7, and a bunch of other fixes (#812, #811, #809)

Divam ba25b274 feac31b1

+459
pkgs/development/compilers/ghcjs-ng/ghcjs-base.nix pkgs/development/compilers/ghcjs/ghcjs-base.nix
+8
pkgs/development/compilers/ghcjs/8.10/common-overrides.nix
··· 1 + { haskellLib }: 2 + 3 + let inherit (haskellLib) addBuildTools appendConfigureFlag dontHaddock doJailbreak; 4 + in self: super: { 5 + ghcjs = doJailbreak (super.ghcjs.overrideScope (self: super: { 6 + optparse-applicative = self.optparse-applicative_0_15_1_0; 7 + })); 8 + }
+60
pkgs/development/compilers/ghcjs/8.10/configured-ghcjs-src.nix
··· 1 + { perl 2 + , autoconf 3 + , automake 4 + , python3 5 + , gcc 6 + , cabal-install 7 + , runCommand 8 + , lib 9 + , stdenv 10 + 11 + , ghc 12 + , happy 13 + , alex 14 + 15 + , ghcjsSrc 16 + , version 17 + }: 18 + 19 + runCommand "configured-ghcjs-src" { 20 + nativeBuildInputs = [ 21 + perl 22 + autoconf 23 + automake 24 + python3 25 + ghc 26 + happy 27 + alex 28 + cabal-install 29 + ] ++ lib.optionals stdenv.isDarwin [ 30 + gcc # https://github.com/ghcjs/ghcjs/issues/663 31 + ]; 32 + inherit ghcjsSrc; 33 + } '' 34 + export HOME=$(pwd) 35 + mkdir $HOME/.cabal 36 + touch $HOME/.cabal/config 37 + cp -r "$ghcjsSrc" "$out" 38 + chmod -R +w "$out" 39 + cd "$out" 40 + 41 + # TODO: Find a better way to avoid impure version numbers 42 + sed -i 's/RELEASE=NO/RELEASE=YES/' ghc/configure.ac 43 + 44 + # These files are needed by ghc-boot package, and these are generated by the 45 + # make/hadrian build system when compiling ghc. Since we dont have access to 46 + # the generated code of the ghc while it got built, here is a little hack to 47 + # generate these again. 48 + runhaskell ${./generate_host_version.hs} 49 + mkdir -p utils/pkg-cache/ghc/libraries/ghc-boot/dist-install/build/GHC/Platform 50 + mv Host.hs utils/pkg-cache/ghc/libraries/ghc-boot/dist-install/build/GHC/Platform/Host.hs 51 + mv Version.hs utils/pkg-cache/ghc/libraries/ghc-boot/dist-install/build/GHC/Version.hs 52 + 53 + # The ghcjs has the following hardcoded paths of lib dir in its code. Patching 54 + # these to match the path expected by the nixpkgs's generic-builder, etc. 55 + sed -i 's/libSubDir = "lib"/libSubDir = "lib\/ghcjs-${version}"/' src-bin/Boot.hs 56 + sed -i 's@let libDir = takeDirectory haddockPath </> ".." </> "lib"@let libDir = takeDirectory haddockPath </> ".." </> "lib/ghcjs-${version}"@' src-bin/HaddockDriver.hs 57 + 58 + patchShebangs . 59 + ./utils/makePackages.sh copy 60 + ''
+114
pkgs/development/compilers/ghcjs/8.10/default.nix
··· 1 + { stdenv 2 + , pkgsHostHost 3 + , callPackage 4 + , fetchgit 5 + , ghcjsSrcJson ? null 6 + , ghcjsSrc ? fetchgit (builtins.fromJSON (builtins.readFile ghcjsSrcJson)) 7 + , bootPkgs 8 + , stage0 9 + , haskellLib 10 + , cabal-install 11 + , nodejs 12 + , makeWrapper 13 + , xorg 14 + , gmp 15 + , pkg-config 16 + , gcc 17 + , lib 18 + , ghcjsDepOverrides ? (_:_:{}) 19 + , haskell 20 + , linkFarm 21 + , buildPackages 22 + }: 23 + 24 + let 25 + passthru = { 26 + configuredSrc = callPackage ./configured-ghcjs-src.nix { 27 + inherit ghcjsSrc; 28 + inherit (bootPkgs) ghc alex; 29 + inherit (bootGhcjs) version; 30 + happy = bootPkgs.happy_1_19_12; 31 + }; 32 + bootPkgs = bootPkgs.extend (lib.foldr lib.composeExtensions (_:_:{}) [ 33 + (self: _: import stage0 { 34 + inherit (passthru) configuredSrc; 35 + inherit (self) callPackage; 36 + }) 37 + 38 + (callPackage ./common-overrides.nix { 39 + inherit haskellLib; 40 + }) 41 + ghcjsDepOverrides 42 + ]); 43 + 44 + targetPrefix = ""; 45 + inherit bootGhcjs; 46 + inherit (bootGhcjs) version; 47 + isGhcjs = true; 48 + 49 + enableShared = true; 50 + 51 + socket-io = pkgsHostHost.nodePackages."socket.io"; 52 + 53 + haskellCompilerName = "ghcjs-${bootGhcjs.version}"; 54 + }; 55 + 56 + bootGhcjs = haskellLib.justStaticExecutables passthru.bootPkgs.ghcjs; 57 + 58 + # This provides the stuff we need from the emsdk 59 + emsdk = linkFarm "emsdk" [ 60 + { name = "upstream/bin"; path = buildPackages.clang + "/bin";} 61 + { name = "upstream/emscripten"; path = buildPackages.emscripten + "/bin"; } 62 + ]; 63 + 64 + in stdenv.mkDerivation { 65 + name = bootGhcjs.name; 66 + src = passthru.configuredSrc; 67 + nativeBuildInputs = [ 68 + bootGhcjs 69 + passthru.bootPkgs.ghc 70 + cabal-install 71 + nodejs 72 + makeWrapper 73 + xorg.lndir 74 + gmp 75 + pkg-config 76 + ] ++ lib.optionals stdenv.isDarwin [ 77 + gcc # https://github.com/ghcjs/ghcjs/issues/663 78 + ]; 79 + dontConfigure = true; 80 + dontInstall = true; 81 + buildPhase = '' 82 + export HOME=$TMP 83 + mkdir $HOME/.cabal 84 + touch $HOME/.cabal/config 85 + cd lib/boot 86 + 87 + mkdir -p $out/bin 88 + mkdir -p $out/lib/${bootGhcjs.name} 89 + lndir ${bootGhcjs}/bin $out/bin 90 + chmod -R +w $out/bin 91 + rm $out/bin/ghcjs-boot 92 + cp ${bootGhcjs}/bin/ghcjs-boot $out/bin 93 + rm $out/bin/haddock 94 + cp ${bootGhcjs}/bin/haddock $out/bin 95 + cp ${bootGhcjs}/bin/private-ghcjs-hsc2hs $out/bin/ghcjs-hsc2hs 96 + 97 + wrapProgram $out/bin/ghcjs-boot --set ghcjs_libexecdir $out/bin 98 + 99 + wrapProgram $out/bin/ghcjs --add-flags "-B$out/lib/${bootGhcjs.name}" 100 + wrapProgram $out/bin/haddock --add-flags "-B$out/lib/${bootGhcjs.name}" 101 + wrapProgram $out/bin/ghcjs-pkg --add-flags "--global-package-db=$out/lib/${bootGhcjs.name}/package.conf.d" 102 + wrapProgram $out/bin/ghcjs-hsc2hs --add-flags "-I$out/lib/${bootGhcjs.name}/include --template=$out/lib/${bootGhcjs.name}/include/template-hsc.h" 103 + 104 + env PATH=$out/bin:$PATH $out/bin/ghcjs-boot --with-emsdk=${emsdk} --no-haddock 105 + ''; 106 + 107 + enableParallelBuilding = true; 108 + 109 + inherit passthru; 110 + 111 + # The emscripten is broken on darwin 112 + meta.platforms = lib.platforms.linux; 113 + meta.maintainers = with lib.maintainers; [ obsidian-systems-maintenance ]; 114 + }
+54
pkgs/development/compilers/ghcjs/8.10/generate_host_version.hs
··· 1 + -- Generate the Host.hs and Version.hs as done by hadrian/src/Rules/Generate.hs 2 + 3 + import GHC.Platform.Host 4 + import GHC.Version 5 + 6 + main = do 7 + writeFile "Version.hs" versionHs 8 + writeFile "Host.hs" platformHostHs 9 + 10 + -- | Generate @Version.hs@ files. 11 + versionHs :: String 12 + versionHs = unlines 13 + [ "module GHC.Version where" 14 + , "" 15 + , "import Prelude -- See Note [Why do we import Prelude here?]" 16 + , "" 17 + , "cProjectGitCommitId :: String" 18 + , "cProjectGitCommitId = " ++ show cProjectGitCommitId 19 + , "" 20 + , "cProjectVersion :: String" 21 + , "cProjectVersion = " ++ show cProjectVersion 22 + , "" 23 + , "cProjectVersionInt :: String" 24 + , "cProjectVersionInt = " ++ show cProjectVersionInt 25 + , "" 26 + , "cProjectPatchLevel :: String" 27 + , "cProjectPatchLevel = " ++ show cProjectPatchLevel 28 + , "" 29 + , "cProjectPatchLevel1 :: String" 30 + , "cProjectPatchLevel1 = " ++ show cProjectPatchLevel1 31 + , "" 32 + , "cProjectPatchLevel2 :: String" 33 + , "cProjectPatchLevel2 = " ++ show cProjectPatchLevel2 34 + ] 35 + 36 + -- | Generate @Platform/Host.hs@ files. 37 + platformHostHs :: String 38 + platformHostHs = unlines 39 + [ "module GHC.Platform.Host where" 40 + , "" 41 + , "import GHC.Platform" 42 + , "" 43 + , "cHostPlatformArch :: Arch" 44 + , "cHostPlatformArch = " ++ show cHostPlatformArch 45 + , "" 46 + , "cHostPlatformOS :: OS" 47 + , "cHostPlatformOS = " ++ show cHostPlatformOS 48 + , "" 49 + , "cHostPlatformMini :: PlatformMini" 50 + , "cHostPlatformMini = PlatformMini" 51 + , " { platformMini_arch = cHostPlatformArch" 52 + , " , platformMini_os = cHostPlatformOS" 53 + , " }" 54 + ]
+6
pkgs/development/compilers/ghcjs/8.10/git.json
··· 1 + { 2 + "url": "https://github.com/obsidiansystems/ghcjs", 3 + "rev": "9fc935f2c3ba6c33ec62eb83afc9f52a893eb68c", 4 + "sha256": "sha256:063dmir39c4i1z8ypnmq86g1x2vhqndmdpzc4hyzsy5jjqcbx6i3", 5 + "fetchSubmodules": true 6 + }
+77
pkgs/development/compilers/ghcjs/8.10/stage0.nix
··· 1 + { callPackage, configuredSrc }: 2 + 3 + { 4 + 5 + ghcjs = callPackage 6 + ({ mkDerivation, aeson, alex, array, attoparsec, base, base16-bytestring 7 + , base64-bytestring, binary, bytestring, Cabal, containers 8 + , cryptohash, data-default, deepseq, directory, executable-path 9 + , filepath, ghc-boot, ghc-boot-th, ghc-compact, ghc-heap, ghc-paths 10 + , ghci, happy, hashable, hpc, http-types, HUnit, lens, lib 11 + , lifted-base, mtl, network, optparse-applicative, parallel, parsec 12 + , process, random, safe, shelly, split, stringsearch, syb, tar 13 + , template-haskell, terminfo, test-framework, test-framework-hunit 14 + , text, time, transformers, unix, unix-compat, unordered-containers 15 + , vector, wai, wai-app-static, wai-extra, wai-websockets, warp 16 + , webdriver, websockets, wl-pprint-text, xhtml, yaml 17 + }: 18 + mkDerivation { 19 + pname = "ghcjs"; 20 + version = "8.10.7"; 21 + src = configuredSrc + /.; 22 + isLibrary = true; 23 + isExecutable = true; 24 + libraryHaskellDepends = [ 25 + aeson array attoparsec base base16-bytestring base64-bytestring 26 + binary bytestring Cabal containers cryptohash data-default deepseq 27 + directory filepath ghc-boot ghc-boot-th ghc-compact ghc-heap 28 + ghc-paths ghci hashable hpc lens mtl optparse-applicative parallel 29 + parsec process safe split stringsearch syb template-haskell 30 + terminfo text time transformers unix unordered-containers vector 31 + wl-pprint-text yaml 32 + ]; 33 + libraryToolDepends = [ alex happy ]; 34 + executableHaskellDepends = [ 35 + aeson array base binary bytestring Cabal containers deepseq 36 + directory executable-path filepath ghc-boot lens mtl 37 + optparse-applicative parsec process tar terminfo text time 38 + transformers unix unix-compat unordered-containers vector xhtml 39 + yaml 40 + ]; 41 + testHaskellDepends = [ 42 + aeson base bytestring data-default deepseq directory filepath 43 + http-types HUnit lens lifted-base network optparse-applicative 44 + process random shelly test-framework test-framework-hunit text time 45 + transformers unordered-containers wai wai-app-static wai-extra 46 + wai-websockets warp webdriver websockets yaml 47 + ]; 48 + description = "Haskell to JavaScript compiler"; 49 + license = lib.licenses.mit; 50 + }) {}; 51 + 52 + ghcjs-th = callPackage 53 + ({ mkDerivation, base, binary, bytestring, containers, ghc-prim 54 + , ghci, lib, template-haskell 55 + }: 56 + mkDerivation { 57 + pname = "ghcjs-th"; 58 + version = "0.1.0.0"; 59 + src = configuredSrc + /lib/ghcjs-th; 60 + libraryHaskellDepends = [ 61 + base binary bytestring containers ghc-prim ghci template-haskell 62 + ]; 63 + homepage = "http://github.com/ghcjs"; 64 + license = lib.licenses.mit; 65 + }) {}; 66 + 67 + ghcjs-prim = callPackage 68 + ({ mkDerivation, base, ghc-prim, lib }: 69 + mkDerivation { 70 + pname = "ghcjs-prim"; 71 + version = "0.1.1.0"; 72 + src = ./.; 73 + libraryHaskellDepends = [ base ghc-prim ]; 74 + homepage = "http://github.com/ghcjs"; 75 + license = lib.licenses.mit; 76 + }) {}; 77 + }
+14
pkgs/development/compilers/ghcjs/patches/vector-ghcjs-storable-set.patch
··· 1 + diff --git a/Data/Vector/Storable/Mutable.hs b/Data/Vector/Storable/Mutable.hs 2 + index 8b538bc..2b74fce 100644 3 + --- a/Data/Vector/Storable/Mutable.hs 4 + +++ b/Data/Vector/Storable/Mutable.hs 5 + @@ -197,7 +197,9 @@ storableSet (MVector n fp) x 6 + 1 -> storableSetAsPrim n fp x (undefined :: Word8) 7 + 2 -> storableSetAsPrim n fp x (undefined :: Word16) 8 + 4 -> storableSetAsPrim n fp x (undefined :: Word32) 9 + +#if !defined(ghcjs_HOST_OS) 10 + 8 -> storableSetAsPrim n fp x (undefined :: Word64) 11 + +#endif 12 + _ -> unsafeWithForeignPtr fp $ \p -> do 13 + poke p x 14 +
+109
pkgs/development/haskell-modules/configuration-ghcjs.nix
··· 1 + # GHCJS package fixes 2 + # 3 + # Please insert new packages *alphabetically* 4 + # in the OTHER PACKAGES section. 5 + { pkgs, haskellLib }: 6 + 7 + let 8 + removeLibraryHaskellDepends = pnames: depends: 9 + builtins.filter (e: !(builtins.elem (e.pname or "") pnames)) depends; 10 + in 11 + 12 + with haskellLib; 13 + 14 + self: super: 15 + 16 + ## GENERAL SETUP BASE PACKAGES 17 + { 18 + inherit (self.ghc.bootPkgs) 19 + jailbreak-cabal alex happy gtk2hs-buildtools rehoo hoogle; 20 + 21 + ghcjs-base = dontCheck (self.callPackage ../compilers/ghcjs/ghcjs-base.nix { 22 + fetchgit = pkgs.buildPackages.fetchgit; 23 + }); 24 + 25 + # GHCJS does not ship with the same core packages as GHC. 26 + # https://github.com/ghcjs/ghcjs/issues/676 27 + stm = doJailbreak self.stm_2_5_0_1; 28 + exceptions = dontCheck self.exceptions_0_10_4; 29 + 30 + ## OTHER PACKAGES 31 + 32 + # Runtime exception in tests, missing C API h$realloc 33 + base-compat-batteries = dontCheck super.base-compat-batteries; 34 + 35 + # nodejs crashes during test 36 + ChasingBottoms = dontCheck super.ChasingBottoms; 37 + 38 + # doctest doesn't work on ghcjs, but sometimes dontCheck doesn't seem to get rid of the dependency 39 + doctest = pkgs.lib.warn "ignoring dependency on doctest" null; 40 + 41 + ghcjs-dom = overrideCabal super.ghcjs-dom (drv: { 42 + libraryHaskellDepends = with self; [ 43 + ghcjs-base ghcjs-dom-jsffi text transformers 44 + ]; 45 + configureFlags = [ "-fjsffi" "-f-webkit" ]; 46 + }); 47 + 48 + ghcjs-dom-jsffi = overrideCabal super.ghcjs-dom-jsffi (drv: { 49 + libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ [ self.ghcjs-base self.text ]; 50 + broken = false; 51 + }); 52 + 53 + # https://github.com/Deewiant/glob/issues/39 54 + Glob = dontCheck super.Glob; 55 + 56 + # Test fails to compile during the hsc2hs stage 57 + hashable = dontCheck super.hashable; 58 + 59 + # uses doctest 60 + http-types = dontCheck super.http-types; 61 + 62 + jsaddle = overrideCabal super.jsaddle (drv: { 63 + libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ [ self.ghcjs-base ]; 64 + }); 65 + 66 + # Tests hang, possibly some issue with tasty and race(async) usage in the nonTerminating tests 67 + logict = dontCheck super.logict; 68 + 69 + patch = dontCheck super.patch; 70 + 71 + # TODO: tests hang 72 + pcre-light = dontCheck super.pcre-light; 73 + 74 + # Terminal test not supported on ghcjs 75 + QuickCheck = dontCheck super.QuickCheck; 76 + 77 + reflex = overrideCabal super.reflex (drv: { 78 + libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ [ self.ghcjs-base ]; 79 + }); 80 + 81 + reflex-dom = overrideCabal super.reflex-dom (drv: { 82 + libraryHaskellDepends = removeLibraryHaskellDepends ["jsaddle-webkit2gtk"] (drv.libraryHaskellDepends or []); 83 + }); 84 + 85 + # https://github.com/dreixel/syb/issues/21 86 + syb = dontCheck super.syb; 87 + 88 + # nodejs crashes during test 89 + scientific = dontCheck super.scientific; 90 + 91 + # Tests use TH which gives error 92 + tasty-quickcheck = dontCheck super.tasty-quickcheck; 93 + 94 + temporary = dontCheck super.temporary; 95 + 96 + # 2 tests fail, related to time precision 97 + time-compat = dontCheck super.time-compat; 98 + 99 + # TODO: The tests have a TH error, which has been fixed in ghc 100 + # https://gitlab.haskell.org/ghc/ghc/-/issues/15481 but somehow the issue is 101 + # still present here https://github.com/glguy/th-abstraction/issues/53 102 + th-abstraction = dontCheck super.th-abstraction; 103 + 104 + # https://github.com/haskell/vector/issues/410 105 + vector = appendPatch super.vector (../compilers/ghcjs/patches/vector-ghcjs-storable-set.patch) ; 106 + 107 + # Need hedgehog for tests, which fails to compile due to dep on concurrent-output 108 + zenc = dontCheck super.zenc; 109 + }
+17
pkgs/top-level/haskell-packages.nix
··· 8 8 "ghc8102BinaryMinimal" 9 9 "ghc8107Binary" 10 10 "ghc8107BinaryMinimal" 11 + "ghcjs" 12 + "ghcjs810" 11 13 "integer-simple" 12 14 "native-bignum" 13 15 "ghcHEAD" ··· 139 141 libffi = pkgs.libffi; 140 142 }; 141 143 144 + ghcjs = compiler.ghcjs810; 145 + ghcjs810 = callPackage ../development/compilers/ghcjs/8.10 { 146 + bootPkgs = packages.ghc8107; 147 + ghcjsSrcJson = ../development/compilers/ghcjs/8.10/git.json; 148 + stage0 = ../development/compilers/ghcjs/8.10/stage0.nix; 149 + }; 150 + 142 151 # The integer-simple attribute set contains all the GHC compilers 143 152 # build with integer-simple instead of integer-gmp. 144 153 integer-simple = let ··· 220 229 buildHaskellPackages = bh.packages.ghcHEAD; 221 230 ghc = bh.compiler.ghcHEAD; 222 231 compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { }; 232 + }; 233 + 234 + ghcjs = packages.ghcjs810; 235 + ghcjs810 = callPackage ../development/haskell-modules rec { 236 + buildHaskellPackages = ghc.bootPkgs; 237 + ghc = bh.compiler.ghcjs810; 238 + compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.10.x.nix { }; 239 + packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { }; 223 240 }; 224 241 225 242 # The integer-simple attribute set contains package sets for all the GHC compilers