Commit 6432f0c2 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺
Browse files

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
parent f9e51091
# specific
# specific
# specific
#!/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
# need of installing coreutils (e.g. through brew, just
# for readlink, we use the follownig substitute.
# source:
function rl {
cd "$(dirname "$TARGET_FILE")"
TARGET_FILE="$(basename "$TARGET_FILE")"
# Iterate down a (possible) chain of symlinks
while [ -L "$TARGET_FILE" ]
TARGET_FILE="$(readlink "$TARGET_FILE")"
cd "$(dirname "$TARGET_FILE")"
TARGET_FILE="$(basename "$TARGET_FILE")"
# Compute the canonicalized name by finding the physical path
# for the directory we're in and appending the target file.
PHYS_DIR="$(pwd -P)"
echo "$RESULT"
root="$(dirname "$(rl "$0")")"
mkdir -p "$root/.shake"
# 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" \
--lint \
--directory "$root/.." \
--colour \
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment