about summary refs log tree commit diff
path: root/pkgs/development/compilers/ghcjs
diff options
context:
space:
mode:
authorMoritz Kiefer <moritz.kiefer@purelyfunctional.org>2017-10-08 11:26:25 +0200
committerMoritz Kiefer <moritz.kiefer@purelyfunctional.org>2017-10-08 11:26:25 +0200
commit78aa7f2338a4c1b9700b561cb123c6dc9ef053b6 (patch)
treeef74d1c6fece02848737223d76d87968b56c3f36 /pkgs/development/compilers/ghcjs
parenteedc4e5203b1786aa87a1e40b558e126b7b53cd8 (diff)
downloadnixlib-78aa7f2338a4c1b9700b561cb123c6dc9ef053b6.tar
nixlib-78aa7f2338a4c1b9700b561cb123c6dc9ef053b6.tar.gz
nixlib-78aa7f2338a4c1b9700b561cb123c6dc9ef053b6.tar.bz2
nixlib-78aa7f2338a4c1b9700b561cb123c6dc9ef053b6.tar.lz
nixlib-78aa7f2338a4c1b9700b561cb123c6dc9ef053b6.tar.xz
nixlib-78aa7f2338a4c1b9700b561cb123c6dc9ef053b6.tar.zst
nixlib-78aa7f2338a4c1b9700b561cb123c6dc9ef053b6.zip
ghcjs/ghcjsHEAD: Use separate patch files to fix build of ghcjs
Diffstat (limited to 'pkgs/development/compilers/ghcjs')
-rw-r--r--pkgs/development/compilers/ghcjs/ghcjs-head.patch86
-rw-r--r--pkgs/development/compilers/ghcjs/ghcjs.patch18
-rw-r--r--pkgs/development/compilers/ghcjs/head.nix2
3 files changed, 106 insertions, 0 deletions
diff --git a/pkgs/development/compilers/ghcjs/ghcjs-head.patch b/pkgs/development/compilers/ghcjs/ghcjs-head.patch
new file mode 100644
index 000000000000..bbb5b30468cb
--- /dev/null
+++ b/pkgs/development/compilers/ghcjs/ghcjs-head.patch
@@ -0,0 +1,86 @@
+diff --git a/src-bin/Boot.hs b/src-bin/Boot.hs
+index db8b12e..7b815c5 100644
+--- a/src-bin/Boot.hs
++++ b/src-bin/Boot.hs
+@@ -540,9 +540,7 @@ initPackageDB :: B ()
+ initPackageDB = do
+   msg info "creating package databases"
+   initDB "--global" <^> beLocations . blGlobalDB
+-  traverseOf_ _Just initUser <^> beLocations . blUserDBDir
+   where
+-    initUser dir = rm_f (dir </> "package.conf") >> initDB "--user" (dir </> "package.conf.d")
+     initDB dbName db = do
+       rm_rf db >> mkdir_p db
+       ghcjs_pkg_ ["init", toTextI db] `catchAny_` return ()
+@@ -566,29 +564,22 @@ installDevelopmentTree = subTop $ do
+   msgD info $ "preparing development boot tree"
+   checkpoint' "ghcjs-boot-git" "ghcjs-boot repository already cloned and prepared" $ do
+     testGit "ghcjs-boot" >>= \case
+-      Just False -> failWith "ghcjs-boot already exists and is not a git repository"
+-      Just True  -> do
+-        msg info "ghcjs-boot repository already exists but checkpoint not reached, cleaning first, then cloning"
+-        rm_rf "ghcjs-boot"
++      Just _ -> do
++        msg info "ghcjs-boot repository already exists; initializing ghcjs-boot"
+         initGhcjsBoot
+       Nothing    -> do
+         msgD info "cloning ghcjs-boot git repository"
+         initGhcjsBoot
+   checkpoint' "shims-git" "shims repository already cloned" $ do
+     testGit "shims" >>= \case
+-      Just False -> failWith "shims already exists and is not a git repository"
+-      Just True  -> do
+-        msgD info "shims repository already exists but checkpoint not reached, cleaning first, then cloning"
+-        rm_rf "shims"
+-        cloneGit shimsDescr "shims" bsrcShimsDevBranch bsrcShimsDev
++      Just _ -> do
++        msgD info "shims repository already exists; moving on"
+       Nothing    -> do
+         msgD info "cloning shims git repository"
+         cloneGit shimsDescr "shims" bsrcShimsDevBranch bsrcShimsDev
+   where
+     initGhcjsBoot = sub $ do
+-      cloneGit bootDescr "ghcjs-boot"  bsrcBootDevBranch bsrcBootDev
+       cd "ghcjs-boot"
+-      git_ ["submodule", "update", "--init", "--recursive"]
+       mapM_ patchPackage =<< allPackages
+       preparePrimops
+       buildGenPrim
+@@ -1201,14 +1192,14 @@ cabalInstallFlags parmakeGhcjs = do
+            , "--avoid-reinstalls"
+            , "--builddir",      "dist"
+            , "--with-compiler", ghcjs ^. pgmLocText
++           , "--with-gcc",      "@CC@"
+            , "--with-hc-pkg",   ghcjsPkg ^. pgmLocText
+-           , "--prefix",        toTextI instDir
++           , "--prefix",        "@PREFIX@"
++           , "--libdir",        "$prefix/lib/$compiler"
++           , "--libsubdir",     "$pkgid"
+            , bool haddock "--enable-documentation" "--disable-documentation"
+            , "--haddock-html"
+--- workaround for hoogle support being broken in haddock for GHC 7.10RC1
+-#if !(__GLASGOW_HASKELL__ >= 709)
+            , "--haddock-hoogle"
+-#endif
+            , "--haddock-hyperlink-source"
+ -- don't slow down Windows builds too much, on other platforms we get this more
+ -- or less for free, thanks to dynamic-too
+diff --git a/src/Compiler/Info.hs b/src/Compiler/Info.hs
+index 33a401f..e2405a7 100644
+--- a/src/Compiler/Info.hs
++++ b/src/Compiler/Info.hs
+@@ -48,13 +48,7 @@ compilerInfo nativeToo dflags = do
+ 
+ -- | the directory to use if started without -B flag
+ getDefaultTopDir :: IO FilePath
+-getDefaultTopDir = do
+-  appdir <- getAppUserDataDirectory "ghcjs"
+-  return (appdir </> subdir </> "ghcjs")
+-      where
+-        targetARCH = arch
+-        targetOS   = os
+-        subdir     = targetARCH ++ '-':targetOS ++ '-':getFullCompilerVersion
++getDefaultTopDir = return "@PREFIX@/lib/ghcjs-@VERSION@"
+ 
+ getDefaultLibDir :: IO FilePath
+ getDefaultLibDir = getDefaultTopDir
diff --git a/pkgs/development/compilers/ghcjs/ghcjs.patch b/pkgs/development/compilers/ghcjs/ghcjs.patch
index bbb5b30468cb..9f4fa3a8b7ae 100644
--- a/pkgs/development/compilers/ghcjs/ghcjs.patch
+++ b/pkgs/development/compilers/ghcjs/ghcjs.patch
@@ -46,6 +46,24 @@ index db8b12e..7b815c5 100644
        mapM_ patchPackage =<< allPackages
        preparePrimops
        buildGenPrim
+@@ -1141,7 +1132,7 @@ cabalStage1 pkgs = sub $ do
+   globalFlags <- cabalGlobalFlags
+   flags <- cabalInstallFlags (length pkgs == 1)
+   let args = globalFlags ++ ("install" : pkgs) ++
+-             [ "--solver=topdown" -- the modular solver refuses to install stage1 packages
++             [ "--allow-boot-library-installs"
+              ] ++ map ("--configure-option="<>) configureOpts ++ flags
+   checkInstallPlan pkgs args
+   cabal_ args
+@@ -1162,7 +1153,7 @@ cabalInstall pkgs = do
+ -- uses somewhat fragile parsing of --dry-run output, find a better way
+ checkInstallPlan :: [Package] -> [Text] -> B ()
+ checkInstallPlan pkgs opts = do
+-  plan <- cabal (opts ++ ["-v2", "--dry-run"])
++  plan <- cabal (opts ++ ["-vverbose+nowrap", "--dry-run"])
+   when (hasReinstalls plan || hasUnexpectedInstalls plan || hasNewVersion plan) (err plan)
+   where
+     hasReinstalls = T.isInfixOf "(reinstall)"   -- reject reinstalls
 @@ -1201,14 +1192,14 @@ cabalInstallFlags parmakeGhcjs = do
             , "--avoid-reinstalls"
             , "--builddir",      "dist"
diff --git a/pkgs/development/compilers/ghcjs/head.nix b/pkgs/development/compilers/ghcjs/head.nix
index 7f725a3a9adf..2cf6c8b39c24 100644
--- a/pkgs/development/compilers/ghcjs/head.nix
+++ b/pkgs/development/compilers/ghcjs/head.nix
@@ -45,4 +45,6 @@ bootPkgs.callPackage ./base.nix {
     "unix"
   ];
   stage2 = import ./head_stage2.nix;
+
+  patches = [ ./ghcjs-head.patch ];
 }