[commit: ghc] wip/nfs-locking: Add `cabal new-build` based wrapper script (6432f0c)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:14:40 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/6432f0c241ea173bd5d7f7de4833085d6155c47f/ghc

>---------------------------------------------------------------

commit 6432f0c241ea173bd5d7f7de4833085d6155c47f
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sun Jan 24 10:43:43 2016 +0100

    Add `cabal new-build` based wrapper script
    
    This makes use of the new nix-store cache for the shake library and other
    pre-requisities, rather than using the reinstall-breakage-prone old-style
    global pkg-db


>---------------------------------------------------------------

6432f0c241ea173bd5d7f7de4833085d6155c47f
 .gitignore                     | 17 ++++++++++++-----
 build.sh => build.cabal-new.sh | 28 +++++++++++++++++++---------
 2 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/.gitignore b/.gitignore
index 6cc5501..967be07 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,14 @@
-.shake/
-.db/
+/.shake/
+/.db/
 cfg/system.config
+
+# build.cabal.sh specific
+/dist/
+/.cabal-sandbox/
 cabal.sandbox.config
-dist/
-.cabal-sandbox/
-.stack-work/
+
+# build.cabal-new.sh specific
+/dist-newstyle/
+
+# build.stack.sh specific
+/.stack-work/
diff --git a/build.sh b/build.cabal-new.sh
similarity index 60%
copy from build.sh
copy to build.cabal-new.sh
index 719e85e..96c194e 100755
--- a/build.sh
+++ b/build.cabal-new.sh
@@ -1,5 +1,8 @@
 #!/usr/bin/env bash
 
+# This wrapper scripts makes use of cabal 1.24+'s nix-store;
+# In order to clean/reset, remove the `dist-newstyle/` folder
+
 set -euo pipefail
 
 # readlink on os x, doesn't support -f, to prevent the
@@ -32,15 +35,22 @@ root="$(dirname "$(rl "$0")")"
 
 mkdir -p "$root/.shake"
 
-ghc                           \
-    "$root/src/Main.hs"       \
-    -Wall                     \
-    -i"$root/src"             \
-    -rtsopts                  \
-    -with-rtsopts=-I0         \
-    -outputdir="$root/.shake" \
-    -j -O                     \
-    -o "$root/.shake/build"
+# Notes/Random thoughts:
+#
+# - if ghc.git had a top-level `cabal.project` file, we could maybe avoid the
+# boilerplate above, as we could simply say `cabal exec ghc-shake` from within
+# any GHC folder not shadowed by a nearer shadowing `cabal.project` file.
+
+pushd "$root/"
+
+cabal new-build --disable-profiling --disable-documentation -j exe:ghc-shake
+
+PKGVER="$(awk '/^version:/ { print $2 }' shaking-up-ghc.cabal)"
+
+cp -v "$root/dist-newstyle/build/shaking-up-ghc-${PKGVER}/build/ghc-shake/ghc-shake" \
+      "$root/.shake/build"
+
+popd
 
 "$root/.shake/build"       \
     --lint                 \



More information about the ghc-commits mailing list