git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #30214 from cocreature/ghcjs

ghcjs/ghcjsHEAD: Use separate patch files to fix build of ghcjs

commitf9090c3332c9eff8fc15c72395b6a4f617fb9fe9 authorPeter Simons <simons@cryp.to> dateTue 17 Oct 2017, 10:44 (9 years ago) parent85a1c9e78aa7f2
3 files changed+106
pkgs/development/compilers/ghcjs/ghcjs-head.patch+86 pkgs/development/compilers/ghcjs/ghcjs.patch+18 pkgs/development/compilers/ghcjs/head.nix+2
pkgs/development/compilers/ghcjs/ghcjs-head.patchnew file+86
@@ -0,0 +1,86 @@
1+diff --git a/src-bin/Boot.hs b/src-bin/Boot.hs
2+index db8b12e..7b815c5 100644
3+--- a/src-bin/Boot.hs
4++++ b/src-bin/Boot.hs
5+@@ -540,9 +540,7 @@ initPackageDB :: B ()
6+ initPackageDB = do
7+ msg info "creating package databases"
8+ initDB "--global" <^> beLocations . blGlobalDB
9+- traverseOf_ _Just initUser <^> beLocations . blUserDBDir
10+ where
11+- initUser dir = rm_f (dir </> "package.conf") >> initDB "--user" (dir </> "package.conf.d")
12+ initDB dbName db = do
13+ rm_rf db >> mkdir_p db
14+ ghcjs_pkg_ ["init", toTextI db] `catchAny_` return ()
15+@@ -566,29 +564,22 @@ installDevelopmentTree = subTop $ do
16+ msgD info $ "preparing development boot tree"
17+ checkpoint' "ghcjs-boot-git" "ghcjs-boot repository already cloned and prepared" $ do
18+ testGit "ghcjs-boot" >>= \case
19+- Just False -> failWith "ghcjs-boot already exists and is not a git repository"
20+- Just True -> do
21+- msg info "ghcjs-boot repository already exists but checkpoint not reached, cleaning first, then cloning"
22+- rm_rf "ghcjs-boot"
23++ Just _ -> do
24++ msg info "ghcjs-boot repository already exists; initializing ghcjs-boot"
25+ initGhcjsBoot
26+ Nothing -> do
27+ msgD info "cloning ghcjs-boot git repository"
28+ initGhcjsBoot
29+ checkpoint' "shims-git" "shims repository already cloned" $ do
30+ testGit "shims" >>= \case
31+- Just False -> failWith "shims already exists and is not a git repository"
32+- Just True -> do
33+- msgD info "shims repository already exists but checkpoint not reached, cleaning first, then cloning"
34+- rm_rf "shims"
35+- cloneGit shimsDescr "shims" bsrcShimsDevBranch bsrcShimsDev
36++ Just _ -> do
37++ msgD info "shims repository already exists; moving on"
38+ Nothing -> do
39+ msgD info "cloning shims git repository"
40+ cloneGit shimsDescr "shims" bsrcShimsDevBranch bsrcShimsDev
41+ where
42+ initGhcjsBoot = sub $ do
43+- cloneGit bootDescr "ghcjs-boot" bsrcBootDevBranch bsrcBootDev
44+ cd "ghcjs-boot"
45+- git_ ["submodule", "update", "--init", "--recursive"]
46+ mapM_ patchPackage =<< allPackages
47+ preparePrimops
48+ buildGenPrim
49+@@ -1201,14 +1192,14 @@ cabalInstallFlags parmakeGhcjs = do
50+ , "--avoid-reinstalls"
51+ , "--builddir", "dist"
52+ , "--with-compiler", ghcjs ^. pgmLocText
53++ , "--with-gcc", "@CC@"
54+ , "--with-hc-pkg", ghcjsPkg ^. pgmLocText
55+- , "--prefix", toTextI instDir
56++ , "--prefix", "@PREFIX@"
57++ , "--libdir", "$prefix/lib/$compiler"
58++ , "--libsubdir", "$pkgid"
59+ , bool haddock "--enable-documentation" "--disable-documentation"
60+ , "--haddock-html"
61+--- workaround for hoogle support being broken in haddock for GHC 7.10RC1
62+-#if !(__GLASGOW_HASKELL__ >= 709)
63+ , "--haddock-hoogle"
64+-#endif
65+ , "--haddock-hyperlink-source"
66+ -- don't slow down Windows builds too much, on other platforms we get this more
67+ -- or less for free, thanks to dynamic-too
68+diff --git a/src/Compiler/Info.hs b/src/Compiler/Info.hs
69+index 33a401f..e2405a7 100644
70+--- a/src/Compiler/Info.hs
71++++ b/src/Compiler/Info.hs
72+@@ -48,13 +48,7 @@ compilerInfo nativeToo dflags = do
73+
74+ -- | the directory to use if started without -B flag
75+ getDefaultTopDir :: IO FilePath
76+-getDefaultTopDir = do
77+- appdir <- getAppUserDataDirectory "ghcjs"
78+- return (appdir </> subdir </> "ghcjs")
79+- where
80+- targetARCH = arch
81+- targetOS = os
82+- subdir = targetARCH ++ '-':targetOS ++ '-':getFullCompilerVersion
83++getDefaultTopDir = return "@PREFIX@/lib/ghcjs-@VERSION@"
84+
85+ getDefaultLibDir :: IO FilePath
86+ getDefaultLibDir = getDefaultTopDir
pkgs/development/compilers/ghcjs/ghcjs.patch+18
@@ -46,6 +46,24 @@ index db8b12e..7b815c5 100644
4646 mapM_ patchPackage =<< allPackages
4747 preparePrimops
4848 buildGenPrim
49+@@ -1141,7 +1132,7 @@ cabalStage1 pkgs = sub $ do
50+ globalFlags <- cabalGlobalFlags
51+ flags <- cabalInstallFlags (length pkgs == 1)
52+ let args = globalFlags ++ ("install" : pkgs) ++
53+- [ "--solver=topdown" -- the modular solver refuses to install stage1 packages
54++ [ "--allow-boot-library-installs"
55+ ] ++ map ("--configure-option="<>) configureOpts ++ flags
56+ checkInstallPlan pkgs args
57+ cabal_ args
58+@@ -1162,7 +1153,7 @@ cabalInstall pkgs = do
59+ -- uses somewhat fragile parsing of --dry-run output, find a better way
60+ checkInstallPlan :: [Package] -> [Text] -> B ()
61+ checkInstallPlan pkgs opts = do
62+- plan <- cabal (opts ++ ["-v2", "--dry-run"])
63++ plan <- cabal (opts ++ ["-vverbose+nowrap", "--dry-run"])
64+ when (hasReinstalls plan || hasUnexpectedInstalls plan || hasNewVersion plan) (err plan)
65+ where
66+ hasReinstalls = T.isInfixOf "(reinstall)" -- reject reinstalls
4967@@ -1201,14 +1192,14 @@ cabalInstallFlags parmakeGhcjs = do
5068 , "--avoid-reinstalls"
5169 , "--builddir", "dist"
pkgs/development/compilers/ghcjs/head.nix+2
@@ -45,4 +45,6 @@ bootPkgs.callPackage ./base.nix {
4545 "unix"
4646 ];
4747 stage2 = import ./head_stage2.nix;
48+
49+ patches = [ ./ghcjs-head.patch ];
4850}