From 5de2615fa3d91bb96e112403d4f68dd4012141ff Mon Sep 17 00:00:00 2001 From: Yves-Stan Le Cornec Date: Mon, 25 Oct 2021 13:32:19 +0200 Subject: [PATCH] WIP: Add bazel build files --- .bazelrc | 6 + .envrc | 1 - .github/workflows/pipeline.yml | 47 + .gitignore | 4 +- BUILD | 0 WORKSPACE | 361 ++++++ asterius/BUILD.bazel | 153 +++ asterius/boot.sh | 42 +- bazel.md | 40 + bazel/bazel_build/BUILD | 208 ++++ .../bazel_build/launch_ahc_boot_from_utils.sh | 21 + bazel/bazel_build/utils.bzl | 127 +++ bazel/bazel_build/wrappers/ahc | 4 + bazel/bazel_build/wrappers/ahc-cabal | 4 + bazel/bazel_build/wrappers/ahc-dist | 4 + bazel/bazel_build/wrappers/ahc-ld | 5 + bazel/bazel_build/wrappers/ahc-link | 4 + bazel/bazel_build/wrappers/ahc-pkg | 4 + bazel/bazel_build/wrappers/setup_env.sh | 7 + bazel/bazel_build_files/BUILD_ghc-asterius | 22 + .../bazel_build_files/BUILD_ghc-boot-asterius | 25 + .../BUILD_ghc-boot-th-asterius | 25 + .../bazel_build_files/BUILD_ghc-heap-asterius | 27 + bazel/bazel_build_files/BUILD_ghci-asterius | 21 + .../BUILD_template-haskell-asterius | 25 + bazel/bazel_utils/bazel_build_shell.nix | 6 + bazel/bazel_utils/make_packages_nix.py | 14 + bazel/bazel_utils/make_packages_wrapper.sh | 10 + bazel/bazel_utils/nixpkgs/default.nix | 9 + bazel/bazel_utils/packaging/BUILD.bazel | 38 + .../packaging/asterius_bundle.BUILD.bazel | 78 ++ bazel/bazel_utils/packaging/bundle-apps.sh | 145 +++ bazel/bazel_utils/packaging/package-app.sh | 254 +++++ bazel/bazel_utils/packaging/packaging.bzl | 110 ++ .../packaging/wasm_cc_toolchain.bzl | 163 +++ bazel/bazel_utils/sh/BUILD.bazel | 23 + bazel/bazel_utils/sh/mktar.sh | 45 + bazel/bazel_utils/sh/mktgz.sh | 53 + bazel/bazel_utils/sh/sh.bzl | 70 ++ bazel/bazel_utils/sh/test.sh.tpl | 57 + bazel/make_packages_utils.bzl | 82 ++ ghc-toolkit/BUILD.bazel | 1012 +++++++++++++++++ ghc-toolkit/cabal.project.local | 1 + ghc-toolkit/configure | 0 .../Language/Haskell/GHC/Toolkit/BuildInfo.hs | 15 +- nix/BUILD | 1 + nix/bazel-nix-shell.nix | 46 + nix/bazel_deps.nix | 47 + nix/binaryenOverlay.nix | 18 + nix/default.nix | 1 + nix/sources.json | 26 + nix/sources.nix | 174 +++ shell.nix | 35 + utils/make-packages.py | 5 +- wasm-toolkit/BUILD.bazel | 37 + 55 files changed, 3752 insertions(+), 10 deletions(-) create mode 100644 .bazelrc delete mode 100644 .envrc create mode 100644 BUILD create mode 100644 WORKSPACE create mode 100644 asterius/BUILD.bazel create mode 100644 bazel.md create mode 100644 bazel/bazel_build/BUILD create mode 100755 bazel/bazel_build/launch_ahc_boot_from_utils.sh create mode 100644 bazel/bazel_build/utils.bzl create mode 100755 bazel/bazel_build/wrappers/ahc create mode 100755 bazel/bazel_build/wrappers/ahc-cabal create mode 100755 bazel/bazel_build/wrappers/ahc-dist create mode 100755 bazel/bazel_build/wrappers/ahc-ld create mode 100755 bazel/bazel_build/wrappers/ahc-link create mode 100755 bazel/bazel_build/wrappers/ahc-pkg create mode 100644 bazel/bazel_build/wrappers/setup_env.sh create mode 100755 bazel/bazel_build_files/BUILD_ghc-asterius create mode 100755 bazel/bazel_build_files/BUILD_ghc-boot-asterius create mode 100755 bazel/bazel_build_files/BUILD_ghc-boot-th-asterius create mode 100755 bazel/bazel_build_files/BUILD_ghc-heap-asterius create mode 100755 bazel/bazel_build_files/BUILD_ghci-asterius create mode 100755 bazel/bazel_build_files/BUILD_template-haskell-asterius create mode 100644 bazel/bazel_utils/bazel_build_shell.nix create mode 100644 bazel/bazel_utils/make_packages_nix.py create mode 100755 bazel/bazel_utils/make_packages_wrapper.sh create mode 100644 bazel/bazel_utils/nixpkgs/default.nix create mode 100644 bazel/bazel_utils/packaging/BUILD.bazel create mode 100644 bazel/bazel_utils/packaging/asterius_bundle.BUILD.bazel create mode 100755 bazel/bazel_utils/packaging/bundle-apps.sh create mode 100755 bazel/bazel_utils/packaging/package-app.sh create mode 100644 bazel/bazel_utils/packaging/packaging.bzl create mode 100644 bazel/bazel_utils/packaging/wasm_cc_toolchain.bzl create mode 100644 bazel/bazel_utils/sh/BUILD.bazel create mode 100755 bazel/bazel_utils/sh/mktar.sh create mode 100755 bazel/bazel_utils/sh/mktgz.sh create mode 100644 bazel/bazel_utils/sh/sh.bzl create mode 100755 bazel/bazel_utils/sh/test.sh.tpl create mode 100644 bazel/make_packages_utils.bzl create mode 100644 ghc-toolkit/BUILD.bazel create mode 100644 ghc-toolkit/cabal.project.local create mode 100644 ghc-toolkit/configure create mode 100644 nix/BUILD create mode 100644 nix/bazel-nix-shell.nix create mode 100644 nix/bazel_deps.nix create mode 100644 nix/binaryenOverlay.nix create mode 120000 nix/default.nix create mode 100644 nix/sources.json create mode 100644 nix/sources.nix create mode 100644 shell.nix create mode 100644 wasm-toolkit/BUILD.bazel diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 00000000..f7e3288c --- /dev/null +++ b/.bazelrc @@ -0,0 +1,6 @@ +# User Configuration +# ------------------ +build --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host +run --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host + +try-import %workspace%/.bazelrc.local diff --git a/.envrc b/.envrc deleted file mode 100644 index cc13bf62..00000000 --- a/.envrc +++ /dev/null @@ -1 +0,0 @@ -export PATH=$(stack exec printenv PATH) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 3086e311..f6ea6cd9 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -4,10 +4,52 @@ on: - push - pull_request +env: + # Bump this number to invalidate the GH actions cache + cache-version: 0 + jobs: + bazel: + name: bazel + strategy: + fail-fast: false + matrix: + os: [ubuntu] + runs-on: ${{ matrix.os }}-latest + steps: + - uses: actions/checkout@v2 + - name: Mount Bazel cache + uses: actions/cache@v2 + with: + path: ~/repo-cache + key: repo-cache-${{ runner.os }}-nixpkgs-${{ env.cache-version }} + - uses: cachix/install-nix-action@v12 + with: + nix_path: nixpkgs=./bazel_utils/nixpkgs/default.nix + # - name: Configure + # run: | + # case ${{ matrix.os }} in + # macos) BUILD_CONFIG=macos-nixpkgs;; + # ubuntu) BUILD_CONFIG=linux-nixpkgs;; + # esac + # cat >.bazelrc.local </dev/null || \ + source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ + source "$0.runfiles/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e +# --- end runfiles.bash initialization v2 --- + +# Make sure that runfiles and tools are still found after we change directory. +case "$(uname -s)" in + Darwin) + abspath() { python -c 'import os.path, sys; sys.stdout.write(os.path.abspath(sys.argv[1]))' "$@"; } + canonicalpath() { python -c 'import os.path, sys; sys.stdout.write(os.path.realpath(sys.argv[1]))' "$@"; } + ;; + *) + abspath() { realpath -s "$@"; } + canonicalpath() { readlink -f "$@"; } + ;; +esac + +if [[ -n ${RUNFILES_DIR:-} ]]; then + export RUNFILES_DIR=$(abspath $RUNFILES_DIR) +fi +if [[ -n ${RUNFILES_MANIFEST_FILE:-} ]]; then + export RUNFILES_DIR=$(abspath $RUNFILES_MANIFEST_FILE) +fi + +case "$(uname -s)" in + Darwin|Linux) + # find tar + tar=$(abspath $(rlocation tar/bin/tar)) + gzip=$(abspath $(rlocation gzip/bin/gzip)) + mktgz=$(abspath $(rlocation bazel_asterius/bazel/bazel_utils/sh/mktgz)) + ;; + CYGWIN*|MINGW*|MSYS*) + tar=$(abspath $(rlocation tar/usr/bin/tar.exe)) + gzip=$(abspath $(rlocation gzip/urs/bin/gzip.exe)) + mktgz=$(abspath $(rlocation bazel_asterius/bazel/bazel_utils/sh/mktgz.exe)) + ;; +esac + +set -eou pipefail + +set -x +WORKDIR="$(mktemp -d)" +trap "rm -rf $WORKDIR" EXIT + + +OUT=$(abspath $1) +shift 1 + +# Copy in resources, if any. +if [ $# -gt 0 ]; then + for res in $*; do + if [[ "$res" == *.tar.gz ]]; then + # If a resource is a tarball, e.g., because it originates from another + # rule we extract it. + # $tar xf "$res" --strip-components=3 -C "$WORKDIR" + $tar xf "$res" -C "$WORKDIR" + else + echo "res = $res" + cp -aL "$res" "$WORKDIR" + fi + done +fi + +# Rename BUILD file. +if [ -f "$WORKDIR/asterius_bundle.BUILD.bazel" ]; then + mv "$WORKDIR/asterius_bundle.BUILD.bazel" "$WORKDIR/BUILD.bazel" +fi + +# build a wasi_sdk_path folder with the right structure, +# because we now use the wrapper scripts and not the binaries directly. + +# mkdir -p "$WORKDIR/wasi_sdk_path/bin" +# ln -s "../../ressources/wasilibc/wasi-sdk-12.0/bin/git-clang-format" "$WORKDIR/wasi_sdk_path/bin/git-clang-format" +# ln -s "../../ar" "$WORKDIR/wasi_sdk_path/bin/ar" +# ln -s "../../clang" "$WORKDIR/wasi_sdk_path/bin/clang" +# ln -s "../../clang-11" "$WORKDIR/wasi_sdk_path/bin/clang-11" +# ln -s "../../clang-cl" "$WORKDIR/wasi_sdk_path/bin/clang-cl" +# ln -s "../../clang-format" "$WORKDIR/wasi_sdk_path/bin/clang-format" +# ln -s "../../ld64.lld" "$WORKDIR/wasi_sdk_path/bin/ld64.lld" +# ln -s "../../lld-link" "$WORKDIR/wasi_sdk_path/bin/lld-link" +# ln -s "../../llvn-cxxfilt" "$WORKDIR/wasi_sdk_path/bin/llvm-cxxfilt" +# ln -s "../../llvn-nm" "$WORKDIR/wasi_sdk_path/bin/llvm-nm" +# ln -s "../../llvn-objdump" "$WORKDIR/wasi_sdk_path/bin/llvm-objdump" +# ln -s "../../llvn-size" "$WORKDIR/wasi_sdk_path/bin/llvm-size" +# ln -s "../../llvn-strip" "$WORKDIR/wasi_sdk_path/bin/llvm-strip" +# ln -s "../../objcopy" "$WORKDIR/wasi_sdk_path/bin/objcopy" +# ln -s "../../strings" "$WORKDIR/wasi_sdk_path/bin/strings" +# ln -s "../../wasm-ld" "$WORKDIR/wasi_sdk_path/bin/wasm-ld" +# ln -s "../../c++filt" "$WORKDIR/wasi_sdk_path/bin/c++filt" +# ln -s "../../clang++" "$WORKDIR/wasi_sdk_path/bin/clang++" +# ln -s "../../clang-apply-replacements" "$WORKDIR/wasi_sdk_path/bin/clang-apply-replacements" +# ln -s "../../clang-cpp" "$WORKDIR/wasi_sdk_path/bin/clang-cpp" +# ln -s "../../clang-tidy" "$WORKDIR/wasi_sdk_path/bin/clang-tidy" +# ln -s "../../ld.lld" "$WORKDIR/wasi_sdk_path/bin/ld.lld" +# ln -s "../../lld" "$WORKDIR/wasi_sdk_path/bin/lld" +# ln -s "../../llvm-ar" "$WORKDIR/wasi_sdk_path/bin/llvm-ar" +# ln -s "../../llvm-dwarfdump" "$WORKDIR/wasi_sdk_path/bin/llvm-dwarfdump" +# ln -s "../../llvm-objcopy" "$WORKDIR/wasi_sdk_path/bin/llvm-objcopy" +# ln -s "../../llvm-ranlib" "$WORKDIR/wasi_sdk_path/bin/llvm-ranlib" +# ln -s "../../llvm-strings" "$WORKDIR/wasi_sdk_path/bin/llvm-strings" +# ln -s "../../nm" "$WORKDIR/wasi_sdk_path/bin/nm" +# ln -s "../../objdump" "$WORKDIR/wasi_sdk_path/bin/objdump" +# ln -s "../../size" "$WORKDIR/wasi_sdk_path/bin/size" +# ln -s "../../strip" "$WORKDIR/wasi_sdk_path/bin/strip" + +# ln -s "../resources/wasilibc/wasi-sdk-12.0/lib" "$WORKDIR/wasi_sdk_path/lib" +# ln -s "resources/wasilibc/wasi-sdk-12.0/lib" "$WORKDIR/lib" +# ln -s "../resources/wasilibc/wasi-sdk-12.0/share" "$WORKDIR/wasi_sdk_path/share" + +if [ -f "$WORKDIR/wasi_folder/resources/wasilibc/wasi-sdk-12.1g41fa3294474c/lib" ]; then + ln -s "wasi_folder/resources/wasilibc/wasi-sdk-12.1g41fa3294474c/lib" "$WORKDIR/lib" + # ln -s "wasi_folder/resources/wasilibc/wasi-sdk-12.1g41fa3294474c/lib" "$WORKDIR/bin/lib" +fi + +# Some of the binaries may need to be in the same folder to work together. +# Since all of them need to be called throught the wrapper scripts, +# next to each binary, we add symlinks to the wrapper script of the other ones. + +for target_dir_abs in $WORKDIR/bin_*; do + target_dir=$(basename $target_dir_abs) + echo "target_dir=$target_dir" + target=${target_dir:4} + echo "target=$target" + for src_dir_abs in $WORKDIR/bin_*; do + src_dir=$(basename $src_dir_abs) + echo "src_dir=$src_dir" + src=${src_dir:4} + echo "src=$src" + if [ $target != $src ]; then + ln -s "../$target" "$src_dir_abs/$target" + fi + done +done + +# $mktgz $OUT -C "$WORKDIR" . +$mktgz $OUT -C "$WORKDIR" . diff --git a/bazel/bazel_utils/packaging/package-app.sh b/bazel/bazel_utils/packaging/package-app.sh new file mode 100755 index 00000000..5444a740 --- /dev/null +++ b/bazel/bazel_utils/packaging/package-app.sh @@ -0,0 +1,254 @@ +#!/usr/bin/env bash +# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# package-app + +# On Linux and MacOS we handle dynamically linked binaries as follows: +# 1. Create a temporary directory and lib directory +# 2. Copy the binary to the temporary directory +# 3. Use platform specific tools to extract names of the +# dynamic libraries and copy them to lib directory. +# 4. Create a wrapper or patch the binary. +# 5. Create tarball out of the temporary directory. +# 6. Clean up. + +# On Windows we only handle statically linked binaries +# (Haskell binaries are linked statically on Windows) so we +# just copy the binary and the resources and create a tarball from that. + +# Copy-pasted from the Bazel Bash runfiles library v2. +set -xe +set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash +source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ + source "$0.runfiles/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e +# --- end runfiles.bash initialization v2 --- + +# Make sure that runfiles and tools are still found after we change directory. +case "$(uname -s)" in + Darwin) + abspath() { python -c 'import os.path, sys; sys.stdout.write(os.path.abspath(sys.argv[1]))' "$@"; } + canonicalpath() { python -c 'import os.path, sys; sys.stdout.write(os.path.realpath(sys.argv[1]))' "$@"; } + ;; + *) + abspath() { realpath -s "$@"; } + canonicalpath() { readlink -f "$@"; } + ;; +esac + +if [[ -n ${RUNFILES_DIR:-} ]]; then + export RUNFILES_DIR=$(abspath $RUNFILES_DIR) +fi +if [[ -n ${RUNFILES_MANIFEST_FILE:-} ]]; then + export RUNFILES_DIR=$(abspath $RUNFILES_MANIFEST_FILE) +fi + +case "$(uname -s)" in + Darwin|Linux) + # find tar + tar=$(abspath $(rlocation tar/bin/tar)) + gzip=$(abspath $(rlocation gzip/bin/gzip)) + mktgz=$(abspath $(rlocation bazel_asterius/bazel/bazel_utils/sh/mktgz)) + patchelf=$(abspath $(rlocation patchelf/bin/patchelf)) + ldd=$(abspath $(rlocation glibc-bin/bin/ldd)) + rev=$(abspath $(rlocation utillinux/bin/rev)) + ;; + CYGWIN*|MINGW*|MSYS*) + tar=$(abspath $(rlocation tar/usr/bin/tar.exe)) + gzip=$(abspath $(rlocation gzip/urs/bin/gzip.exe)) + mktgz=$(abspath $(rlocation bazel_asterius/bazel/bazel_utils/sh/mktgz.exe)) + ldd=$(abspath $(rlocation glibc-bin/bin/ldd.exe)) + rev=$(abspath $(rlocation utilslinux/bin/rev.exe)) + ;; +esac + +set -eou pipefail + +WORKDIR="$(mktemp -d)" +trap "rm -rf $WORKDIR" EXIT + +SRC=$(abspath $1) +OUT=$(abspath $2) +shift 2 +NAME=$(basename $SRC) +mkdir -p $WORKDIR/$NAME/dynlib +mkdir -p "$WORKDIR/$NAME/bin_$NAME" +export ORIGIN=$(dirname $(canonicalpath $SRC)) # for rpaths relative to binary + +# Copy in resources, if any. +if [ $# -gt 0 ]; then + mkdir -p $WORKDIR/$NAME/resources + for res in $*; do + if [[ "$res" == *.tar.gz ]]; then + # If a resource is a tarball, e.g., because it originates from another + # rule we extract it. + $tar xf "$res" --strip-components=1 -C "$WORKDIR/$NAME/resources" + else + cp -aL "$res" "$WORKDIR/$NAME/resources" + fi + done +fi + +# Copy the binary, patch it, and create a wrapper script if necessary. +if [ "$(uname -s)" == "Linux" ]; then + binary="$WORKDIR/$NAME/bin_$NAME/$NAME" + cp $SRC $binary + chmod u+w $binary + rpaths_binary=$($patchelf --print-rpath "$binary"|tr ':' ' ') + function copy_deps { + local from target needed libOK rpaths interpreter + from=$1 + target=$2 + needed=$($patchelf --print-needed "$from") + rpaths="$($patchelf --print-rpath "$from"|tr ':' ' ') $rpaths_binary" + + for lib in $needed; do + if [ ! -f "$target/$lib" ]; then + libOK=0 + for rpath in $rpaths; do + rpath="$(eval echo $rpath)" # expand variables, e.g. $ORIGIN + if [ -e "$rpath/$lib" ]; then + libOK=1 + if [ "$lib" != "ld-linux-x86-64.so.2" ]; then + # clear the old rpaths (silence stderr as it always warns + # with "working around a Linux kernel bug". + cp "$rpath/$lib" "$target/$lib" + chmod u+w "$target/$lib" + $patchelf --set-rpath '$ORIGIN' "$target/$lib" 2> /dev/null + copy_deps "$rpath/$lib" "$target" + else + cp -f "$rpath/$lib" "$WORKDIR/$NAME/$lib" + chmod u+w "$WORKDIR/$NAME/$lib" + fi + break + fi + done + if [ $libOK -ne 1 ]; then + libPath=$($ldd "$from" | grep "$lib" | $rev | cut -d " " -f2 | $rev | xargs) + echo "libPath=$libPath" + if [ -e "$libPath" ]; then + libOK=1 + if [ "$lib" != "ld-linux-x86-64.so.2" ]; then + # clear the old rpaths (silence stderr as it always warns + # with "working around a Linux kernel bug". + cp "$libPath" "$target/$lib" + chmod u+w "$target/$lib" + $patchelf --set-rpath '$ORIGIN' "$target/$lib" 2> /dev/null + copy_deps "$libPath" "$target" + else + cp -f "$libPath" "$WORKDIR/$NAME/$lib" + chmod u+w "$WORKDIR/$NAME/$lib" + fi + fi + fi + if [ $libOK -ne 1 ]; then + echo "ERROR: Dynamic library $lib for $from not found from RPATH!" + echo "RPATH=$rpaths" + return 1 + fi + fi + done + } + + # Copy the binary's dynamic library dependencies. + copy_deps "$binary" "$WORKDIR/$NAME/dynlib" + + # Workaround for dynamically loaded name service switch libraries + (shopt -s nullglob + for rpath in $rpaths_binary; do + for nss in $rpath/libnss_dns* $rpath/libnss_files* $rpath/libresolv*; do + cp -af "$nss" "$WORKDIR/$NAME/dynlib" + done + done + ) + + $patchelf --set-rpath '$ORIGIN/dynlib' "$binary" + $patchelf --set-interpreter ld-undefined.so "$binary" + + # Link resources directory to lib, as that'll be the actual + # binary's location. + test -d "$WORKDIR/$NAME/resources" && + ln -s "../resources" "$WORKDIR/$NAME/dynlib/resources" + + # Create the wrapper script + wrapper="$WORKDIR/$NAME/$NAME" + cat > "$wrapper" < 1: + first_file = files[0].path + prefix_end = first_file.index(r.label.package) + # e.g. package foo/bar, + # first file at bazel-out/k8-fastbuild/bleh/foo/bar/baz/quux + # return path as bazel-out/k8-fastbuild/bleh/foo/bar. + return first_file[0:(prefix_end + len(r.label.package) + len(r.label.workspace_root))] + else: + return files[0].path + +package_app = rule( + implementation = _package_app_impl, + attrs = dict({ + "binary": attr.label( + cfg = "target", + executable = True, + allow_files = True, + ), + "resources": attr.label_list( + allow_files = True, + ), + "package_app": attr.label( + default = Label("//bazel/bazel_utils/packaging:package-app"), + cfg = "host", + executable = True, + allow_files = True, + ), + }), + outputs = { + "out": "%{name}.tar.gz", + }, + toolchains = ["@rules_sh//sh/posix:toolchain_type"], +) +"""Package a binary along with its dynamic library dependencies and data dependencies + into a tarball. The data dependencies are placed in 'resources' directory. +""" + + +bundle_apps = rule( + implementation = _bundle_apps_impl, + attrs = dict({ + "packaged_apps": attr.label_list( + cfg = "target", + allow_files = True, + ), + "bundle_apps": attr.label( + default = Label("//bazel/bazel_utils/packaging:bundle-apps"), + cfg = "exec", + executable = True, + allow_files = True, + ), + }), + outputs = { + "out": "%{name}.tar.gz", + }, + toolchains = ["@rules_sh//sh/posix:toolchain_type"], +) +""" +Bundle packages created by the package_app rule into one tarball. +""" diff --git a/bazel/bazel_utils/packaging/wasm_cc_toolchain.bzl b/bazel/bazel_utils/packaging/wasm_cc_toolchain.bzl new file mode 100644 index 00000000..9bb6db31 --- /dev/null +++ b/bazel/bazel_utils/packaging/wasm_cc_toolchain.bzl @@ -0,0 +1,163 @@ +load("@bazel_skylib//lib:paths.bzl", "paths") + +load( + "@bazel_tools//tools/build_defs/cc:action_names.bzl", + "ACTION_NAMES", +) + +load( + "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", + "tool_path", + "feature", + "flag_group", + "flag_set", +) + +def _impl(ctx): + # posix = ctx.toolchains["@rules_sh//sh/posix:toolchain_type"] + # ar_path = posix.commands["ar"] + tool_paths = [ + tool_path( + name = "gcc", + path = "bin/clang", + ), + tool_path( + name = "ld", + path = "bin/wasm-ld", + ), + tool_path( + name = "ar", + path = "bin/ar", + ), + tool_path( + name = "cpp", + path = "bin/clang++", + ), + tool_path( + name = "gcov", + path = "gcov_not_supported.sh", + ), + tool_path( + name = "nm", + path = "bin/nm", + ), + tool_path( + name = "objdump", + path = "bin/objdump", + ), + tool_path( + name = "strip", + path = "bin/strip", + ), + ] + + sysroot = paths.dirname(paths.dirname(ctx.file.file_from_wasi_sysroot_include.path)) + print("sysroot =", sysroot) + asterius_include = paths.dirname(ctx.file.file_from_asterius_libs_include.path) + default_flags = feature( + name = "default_flags", + enabled = True, + flag_sets = [ + flag_set( + actions = [ + #ACTION_NAMES.c_compile, + #ACTION_NAMES.cpp_compile, + # ACTION_NAMES.linkstamp_compile + # ACTION_NAMES.cc_flags_make_variable + # ACTION_NAMES.cpp_module_codegen + # ACTION_NAMES.cpp_header_parsing + # ACTION_NAMES.cpp_module_compile + # ACTION_NAMES.assemble + # ACTION_NAMES.preprocess_assemble + # ACTION_NAMES.llvm_cov + # ACTION_NAMES.lto_indexing + # ACTION_NAMES.lto_backend + # ACTION_NAMES.lto_index_for_executable + # ACTION_NAMES.lto_index_for_dynamic_library + # ACTION_NAMES.lto_index_for_nodeps_dynamic_library + # ACTION_NAMES.cpp_link_executable + # ACTION_NAMES.cpp_link_dynamic_library + # ACTION_NAMES.cpp_link_nodeps_dynamic_library + # ACTION_NAMES.cpp_link_static_library + # ACTION_NAMES.strip + # ACTION_NAMES.objc_archive + # ACTION_NAMES.objc_compile + # ACTION_NAMES.objc_executable + # ACTION_NAMES.objc_fully_link + # ACTION_NAMES.objcpp_compile + # ACTION_NAMES.objcpp_executable + # ACTION_NAMES.clif_match + ACTION_NAMES.assemble, + ACTION_NAMES.preprocess_assemble, + ACTION_NAMES.linkstamp_compile, + ACTION_NAMES.c_compile, + ACTION_NAMES.cpp_compile, + ACTION_NAMES.cpp_header_parsing, + ACTION_NAMES.cpp_module_compile, + ACTION_NAMES.cpp_module_codegen, + ACTION_NAMES.lto_backend, + ACTION_NAMES.clif_match, + ], + flag_groups = [ + flag_group( + flags = [ + # "-lstdc++", + "--sysroot={}".format(sysroot), + "-I{}".format(asterius_include), + # "-Oz", + "-flto", + "-no-canonical-prefixes", + "-isystem", + "{}/lib/clang/12.0.0/include".format(paths.dirname(paths.dirname(sysroot))) + ], + ), + ], + ), + ], + ) + return cc_common.create_cc_toolchain_config_info( + ctx = ctx, + toolchain_identifier = "webassembly_bundle", + host_system_name = "local", + target_system_name = "wasm64", + target_cpu = "wasm64", + target_libc = "unknown", + compiler = "wasi", + abi_version = "unknown", + abi_libc_version = "unknown", + tool_paths = tool_paths, + features = [default_flags], + builtin_sysroot = sysroot, + # cxx_builtin_include_directories = [ + # "%sysroot%/lib/clang/12.0.0/include", + # "lib/clang/12.0.0/include", + + # # "external/asterius_bundle_rules_haskell_ghc_nixpkgs_haskell_toolchain/bin/lib/clang/12.0.0/include/", + # # "%package(@asterius_bundle_rules_haskell_ghc_nixpkgs_haskell_toolchain//)%/bin/lib/clang/12.0.0/include", + # # "%package(//)%/bin/lib/clang/12.0.0/include", + # # "%package(@asterius_bundle_rules_haskell_ghc_nixpkgs_haskell_toolchain//bin/lib/clang/12.0.0/include)%", + # # "/home/stan/.cache/bazel/_bazel_stan/3c7d084a53b480b3a5081e4bf80f09ce/external/asterius_bundle_rules_haskell_ghc_nixpkgs_haskell_toolchain/bin/lib/clang/12.0.0/include", + + # ] + ) #+ [platform_common.ToolchainInfo(name = "dummy_cpp_toolchain")] + + +cc_toolchain_config = rule( + implementation = _impl, + attrs = { + "file_from_asterius_libs_include": attr.label( + mandatory = True, + allow_single_file = True, + doc = "a file of the asterius libs include folder, to recover the path of this folder", + ), + "file_from_wasi_sysroot_include": attr.label( + mandatory = True, + allow_single_file = True, + doc = "a file from the wasi sysroot include folder, to recover the path of this folder", + ) + }, + provides = [CcToolchainConfigInfo], + # toolchains = [ + # "@rules_sh//sh/posix:toolchain_type", + # ], +) diff --git a/bazel/bazel_utils/sh/BUILD.bazel b/bazel/bazel_utils/sh/BUILD.bazel new file mode 100644 index 00000000..0ff22ef3 --- /dev/null +++ b/bazel/bazel_utils/sh/BUILD.bazel @@ -0,0 +1,23 @@ +# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +exports_files(["test.sh.tpl"]) + +sh_binary( + name = "mktar", + srcs = ["mktar.sh"], + data = ["@tar//:bin/tar"], + visibility = ["//visibility:public"], + deps = ["@bazel_tools//tools/bash/runfiles"], +) + +sh_binary( + name = "mktgz", + srcs = ["mktgz.sh"], + data = [ + "@gzip//:bin/gzip", + "@tar//:bin/tar", + ], + visibility = ["//visibility:public"], + deps = ["@bazel_tools//tools/bash/runfiles"], +) diff --git a/bazel/bazel_utils/sh/mktar.sh b/bazel/bazel_utils/sh/mktar.sh new file mode 100755 index 00000000..94845344 --- /dev/null +++ b/bazel/bazel_utils/sh/mktar.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Copy-pasted from the Bazel Bash runfiles library v2. +set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash +source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ + source "$0.runfiles/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e +# --- end runfiles.bash initialization v2 --- + +set -euo pipefail +usage() { + cat >&2 <<'EOF' +usage: mktar OUTPUT ARGS... + +Creates an uncompressed tarball in OUTPUT passing ARGS to tar. The created +tarball is reproducible, i.e. it does not contain any timestamps or similar +non-deterministic inputs. See https://reproducible-builds.org/docs/archives/ +EOF +} +trap usage ERR + +case "$(uname -s)" in + Darwin|Linux) + tar=$(rlocation tar_dev_env/tar) + ;; + CYGWIN*|MINGW*|MSYS*) + tar=$(rlocation tar_dev_env/usr/bin/tar.exe) + ;; +esac + +$tar cf "$1" "${@:2}" \ + --owner="0" \ + --group="0" \ + --numeric-owner \ + --mtime="2000-01-01 00:00Z" \ + --no-acls \ + --no-xattrs \ + --no-selinux \ + --sort="name" \ + --format=ustar diff --git a/bazel/bazel_utils/sh/mktgz.sh b/bazel/bazel_utils/sh/mktgz.sh new file mode 100755 index 00000000..71df6dff --- /dev/null +++ b/bazel/bazel_utils/sh/mktgz.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Copy-pasted from the Bazel Bash runfiles library v2. +set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash +source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ + source "$0.runfiles/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e +# --- end runfiles.bash initialization v2 --- + +set -euo pipefail +usage() { + cat >&2 <<'EOF' +usage: mktgz OUTPUT ARGS... + +Creates a gzip compressed tarball in OUTPUT passing ARGS to tar. The created +tarball is reproducible, i.e. it does not contain any timestamps or similar +non-deterministic inputs. See https://reproducible-builds.org/docs/archives/ +EOF +} +trap usage ERR + +case "$(uname -s)" in + Darwin|Linux) + tar=$(rlocation tar/bin/tar) + gzip=$(rlocation gzip/bin/gzip) + ;; + CYGWIN*|MINGW*|MSYS*) + tar=$(rlocation tar/usr/bin/tar.exe) + gzip=$(rlocation gzip/usr/bin/gzip.exe) + ;; +esac + +# using posix format to allow for long link names +# for reproducibility added pax-option copy-pasted from here: +# http://h2.jaguarpaw.co.uk/posts/reproducible-tar/ + +$tar c "${@:2}" \ + --owner="0" \ + --group="0" \ + --numeric-owner \ + --mtime="2000-01-01 00:00Z" \ + --no-acls \ + --no-xattrs \ + --no-selinux \ + --sort="name" \ + --format=posix \ + --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime,delete=mtime \ + | $gzip -n > "$1" diff --git a/bazel/bazel_utils/sh/sh.bzl b/bazel/bazel_utils/sh/sh.bzl new file mode 100644 index 00000000..ecf8a4c8 --- /dev/null +++ b/bazel/bazel_utils/sh/sh.bzl @@ -0,0 +1,70 @@ +# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +load("@os_info//:os_info.bzl", "os_name") + +def _sh_inline_script_impl(ctx): + cmd = ctx.attr.cmd + cmd = ctx.expand_location(cmd, ctx.attr.data) + cmd = ctx.expand_make_variables("cmd", cmd, {}) + ctx.actions.expand_template( + template = ctx.file._template, + output = ctx.outputs.output, + is_executable = True, + substitutions = { + "%cmd%": cmd, + "%os%": os_name, + }, + ) + + runfiles = ctx.runfiles(files = [ctx.outputs.output] + ctx.files.data) + for data_dep in ctx.attr.data: + runfiles = runfiles.merge(data_dep[DefaultInfo].default_runfiles) + + return DefaultInfo( + files = depset([ctx.outputs.output]), + runfiles = runfiles, + ) + +_sh_inline_script = rule( + _sh_inline_script_impl, + attrs = { + "cmd": attr.string( + mandatory = True, + ), + "data": attr.label_list( + allow_files = True, + ), + "output": attr.output( + mandatory = True, + ), + "_template": attr.label( + allow_single_file = True, + default = "//bazel_tools/sh:test.sh.tpl", + ), + }, +) + +def sh_inline_test( + name, + cmd, + data = [], + toolchains = [], + **kwargs): + testonly = kwargs.pop("testonly", True) + _sh_inline_script( + name = name + "_script", + cmd = cmd, + output = name + ".sh", + data = data, + testonly = testonly, + toolchains = toolchains, + ) + native.sh_test( + name = name, + data = data, + deps = ["@bazel_tools//tools/bash/runfiles"], + srcs = [name + ".sh"], + testonly = testonly, + **kwargs + ) diff --git a/bazel/bazel_utils/sh/test.sh.tpl b/bazel/bazel_utils/sh/test.sh.tpl new file mode 100755 index 00000000..eb40035d --- /dev/null +++ b/bazel/bazel_utils/sh/test.sh.tpl @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# Copy-pasted from the Bazel Bash runfiles library v2. +set +e +set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash +source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \ + source "$0.runfiles/$f" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \ + { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e +# --- end runfiles.bash initialization v2 --- +canonicalize_rlocation() { + # Note (MK): This is a fun one: Let’s say $TEST_WORKSPACE is "compatibility" + # and the argument points to a target from an external workspace, e.g., + # @daml-sdk-0.0.0//:daml. Then the short path will point to + # ../daml-sdk-0.0.0/daml. Putting things together we end up with + # compatibility/../daml-sdk-0.0.0/daml. On Linux and MacOS this works + # just fine. However, on windows we need to normalize the path + # or rlocation will fail to find the path in the manifest file. + rlocation $(realpath -L -s -m --relative-to=$PWD $TEST_WORKSPACE/$1) +} +get_exe() { + # Usage: get_exe FILE... + # + # On Windows: Return the FILE ending on .exe or the first argument. + # On Unix: Return the first argument. + + # Note (AH): Bazel `sh_binary` targets produce multiple outputs. + # On Unix `script`, and `script.sh`. + # On Windows `script`, `script.exe`, and `script.sh`. + # Assuming `srcs = ["script.sh"]`. + # This is an issue for macros like `client_server_test` which would like + # to determine the path to executables such as. + # `$$(canonicalize_rlocation $(rootpath {client}))`. + # For a `sh_binary` generated `{client}` this fails since `$(rootpath )` is + # not applicable to a target with multiple outputs and we have to use + # `$(rootpaths )` instead. This happens to work on Unix because the first + # item returned by `$(rootpaths )` is correctly executable. However, on + # Windows the required `.exe` wrapper is only the second item returned by + # `$(rootpaths )` and consequently the obtained `$client` path cannot be + # executed on Windows. + # See https://github.com/bazelbuild/bazel/issues/11820. + if [[ %os% = windows ]]; then + for arg in "$@"; do + if [[ $arg = *.exe ]]; then + echo "$arg" + return + fi + done + echo "$1" + else + echo "$1" + fi +} +set -e +%cmd% +# vim: ft=sh diff --git a/bazel/make_packages_utils.bzl b/bazel/make_packages_utils.bzl new file mode 100644 index 00000000..c1c01d08 --- /dev/null +++ b/bazel/make_packages_utils.bzl @@ -0,0 +1,82 @@ +load("@bazel_skylib//lib:new_sets.bzl", "sets") +load("@bazel_skylib//lib:paths.bzl", "paths") + +def paths_of_tools(repository_ctx): + path = sets.make() + ld_library_path = sets.make() + for label in repository_ctx.attr.binaries: + sets.insert(path, str(repository_ctx.path(label).dirname)) + + path_string = ":".join(sets.to_list(path)) + + print("end path = ", path_string) + return {"PATH_BZL": path_string} + +def _make_packages_impl(repository_ctx): + + # bash + bash_path = repository_ctx.path(repository_ctx.attr._bash) + + # nix + nix_folder = repository_ctx.path(repository_ctx.attr.nix_shell_file).dirname + repository_ctx.symlink(nix_folder, "nix") + + utils_folder = "{}/utils".format(nix_folder.dirname) + repository_ctx.symlink(utils_folder, "utils") + + nix_shell_executable = repository_ctx.path(repository_ctx.attr.nix_shell_binary) + nix_path = repository_ctx.path(repository_ctx.attr.nixpkgs).dirname + + # repository_ctx.symlink("/home/stan/src/asterius/shell.nix", "shell.nix") + make_packages_path = repository_ctx.path("utils/make-packages.py") + make_packages_wrapper = repository_ctx.path(repository_ctx.attr._make_packages_wrapper) + # cmd = "NIX_PATH={} {}".format(nix_path, make_packages_path) + + # set_path_path = repository_ctx.path(repository_ctx.attr._set_path) + + cmd = "{} {}".format(make_packages_wrapper, make_packages_path) + + out = repository_ctx.execute( + # [nix_shell_executable, "nix/bazel-nix-shell.nix", "--pure", "--run", cmd], + [bash_path, "-v", "-c", cmd], + timeout=600, + quiet=False, + working_directory="", + environment = dict(paths_of_tools(repository_ctx), NIX_PATH = str(nix_path)) + ) + print("stderr =", out.stderr) + print("stdout =", out.stdout) + print("return code =", out.return_code) + if out.return_code != 0: + fail("call to make_packages failed") + + + build_files_folder = "{}/bazel/bazel_build_files".format(nix_folder.dirname) + build_directories = [ + "ghc-asterius", + "ghc-boot-th-asterius", + "ghc-boot-asterius", + "ghc-heap-asterius", + "ghci-asterius", + "template-haskell-asterius", + ] + for d in build_directories: + repository_ctx.symlink("{}/BUILD_{}".format(build_files_folder, d), "{}/BUILD.bazel".format(d)) + +make_packages = repository_rule( + implementation=_make_packages_impl, + local=False, + attrs={ + "nix_shell_binary": attr.label(allow_single_file = True, mandatory=True), + "nixpkgs":attr.label(allow_single_file = True, mandatory=True), + "nix_shell_file": attr.label(allow_single_file = True, mandatory=True), + "_make_packages_wrapper":attr.label( + allow_single_file = True, + default = "//:bazel/bazel_utils/make_packages_wrapper.sh"), + "_bash": attr.label( + allow_single_file = True, + default = "@bash//:bin/bash" + ), + "binaries": attr.label_list(), + } +) diff --git a/ghc-toolkit/BUILD.bazel b/ghc-toolkit/BUILD.bazel new file mode 100644 index 00000000..900310fa --- /dev/null +++ b/ghc-toolkit/BUILD.bazel @@ -0,0 +1,1012 @@ +load( + "@rules_haskell//haskell:cabal.bzl", + "haskell_cabal_library", +) + +haskell_cabal_library( + name = "ghc-toolkit", + srcs = glob(["**"]), + version = "0.0.1", + # cabalopts = ["--ghc-option=-Wall"], + deps = ["@make_packages//ghc-asterius"], + visibility = [ + # "//asterius:__pkg__", + "//visibility:public", + ], + cabalopts = ["--ghc-option=-j4"], +) + + +filegroup( + name = "ghc-toolkit-datafiles", + srcs = [ + "boot-libs/asterius-prelude/asterius-prelude.cabal", + "boot-libs/asterius-prelude/CHANGELOG.md", + "boot-libs/asterius-prelude/LICENSE", + "boot-libs/asterius-prelude/README.md", + "boot-libs/asterius-prelude/src/Asterius/Aeson.hs", + "boot-libs/asterius-prelude/src/Asterius/ByteString.hs", + "boot-libs/asterius-prelude/src/Asterius/Text.hs", + "boot-libs/asterius-prelude/src/Asterius/UTF8.hs", + "boot-libs/base/aclocal.m4", + "boot-libs/base/Asterius/Magic.hs", + "boot-libs/base/Asterius/TopHandler.hs", + "boot-libs/base/Asterius/Types.hs", + "boot-libs/base/Asterius/Types/JSArray.hs", + "boot-libs/base/Asterius/Types/JSException.hs", + "boot-libs/base/Asterius/Types/JSFunction.hs", + "boot-libs/base/Asterius/Types/JSObject.hs", + "boot-libs/base/Asterius/Types/JSString.hs", + "boot-libs/base/Asterius/Types/JSUint8Array.hs", + "boot-libs/base/Asterius/Types/JSVal.hs", + "boot-libs/base/autom4te.cache/output.0", + "boot-libs/base/autom4te.cache/output.1", + "boot-libs/base/autom4te.cache/requests", + "boot-libs/base/autom4te.cache/traces.0", + "boot-libs/base/autom4te.cache/traces.1", + "boot-libs/base/base.buildinfo.in", + "boot-libs/base/base.cabal", + "boot-libs/base/cbits/CastFloatWord.cmm", + "boot-libs/base/cbits/consUtils.c", + "boot-libs/base/cbits/DarwinUtils.c", + "boot-libs/base/cbits/fs.c", + "boot-libs/base/cbits/iconv.c", + "boot-libs/base/cbits/inputReady.c", + "boot-libs/base/cbits/JSVal.cmm", + "boot-libs/base/cbits/md5.c", + "boot-libs/base/cbits/PrelIOUtils.c", + "boot-libs/base/cbits/primFloat.c", + "boot-libs/base/cbits/README.Unicode", + "boot-libs/base/cbits/SetEnv.c", + "boot-libs/base/cbits/sysconf.c", + "boot-libs/base/cbits/ubconfc", + "boot-libs/base/cbits/WCsubst.c", + "boot-libs/base/cbits/Win32Utils.c", + "boot-libs/base/changelog.md", + "boot-libs/base/codepages/Makefile", + "boot-libs/base/codepages/MakeTable.hs", + "boot-libs/base/config.guess", + "boot-libs/base/config.sub", + "boot-libs/base/configure", + "boot-libs/base/configure.ac", + "boot-libs/base/Control/Applicative.hs", + "boot-libs/base/Control/Arrow.hs", + "boot-libs/base/Control/Category.hs", + "boot-libs/base/Control/Concurrent.hs", + "boot-libs/base/Control/Concurrent/Chan.hs", + "boot-libs/base/Control/Concurrent/MVar.hs", + "boot-libs/base/Control/Concurrent/QSem.hs", + "boot-libs/base/Control/Concurrent/QSemN.hs", + "boot-libs/base/Control/Exception.hs", + "boot-libs/base/Control/Exception/Base.hs", + "boot-libs/base/Control/Monad.hs", + "boot-libs/base/Control/Monad/Fail.hs", + "boot-libs/base/Control/Monad/Fix.hs", + "boot-libs/base/Control/Monad/Instances.hs", + "boot-libs/base/Control/Monad/IO/Class.hs", + "boot-libs/base/Control/Monad/ST.hs", + "boot-libs/base/Control/Monad/ST/Imp.hs", + "boot-libs/base/Control/Monad/ST/Lazy.hs", + "boot-libs/base/Control/Monad/ST/Lazy/Imp.hs", + "boot-libs/base/Control/Monad/ST/Lazy/Safe.hs", + "boot-libs/base/Control/Monad/ST/Lazy/Unsafe.hs", + "boot-libs/base/Control/Monad/ST/Safe.hs", + "boot-libs/base/Control/Monad/ST/Strict.hs", + "boot-libs/base/Control/Monad/ST/Unsafe.hs", + "boot-libs/base/Control/Monad/Zip.hs", + "boot-libs/base/Data/Bifoldable.hs", + "boot-libs/base/Data/Bifunctor.hs", + "boot-libs/base/Data/Bitraversable.hs", + "boot-libs/base/Data/Bits.hs", + "boot-libs/base/Data/Bool.hs", + "boot-libs/base/Data/Char.hs", + "boot-libs/base/Data/Coerce.hs", + "boot-libs/base/Data/Complex.hs", + "boot-libs/base/Data/Data.hs", + "boot-libs/base/Data/Dynamic.hs", + "boot-libs/base/Data/Either.hs", + "boot-libs/base/Data/Eq.hs", + "boot-libs/base/Data/Fixed.hs", + "boot-libs/base/Data/Foldable.hs", + "boot-libs/base/Data/Function.hs", + "boot-libs/base/Data/Functor.hs", + "boot-libs/base/Data/Functor/Classes.hs", + "boot-libs/base/Data/Functor/Compose.hs", + "boot-libs/base/Data/Functor/Const.hs", + "boot-libs/base/Data/Functor/Contravariant.hs", + "boot-libs/base/Data/Functor/Identity.hs", + "boot-libs/base/Data/Functor/Product.hs", + "boot-libs/base/Data/Functor/Sum.hs", + "boot-libs/base/Data/Functor/Utils.hs", + "boot-libs/base/Data/Int.hs", + "boot-libs/base/Data/IORef.hs", + "boot-libs/base/Data/Ix.hs", + "boot-libs/base/Data/Kind.hs", + "boot-libs/base/Data/List.hs", + "boot-libs/base/Data/List/NonEmpty.hs", + "boot-libs/base/Data/Maybe.hs", + "boot-libs/base/Data/Monoid.hs", + "boot-libs/base/Data/OldList.hs", + "boot-libs/base/Data/Ord.hs", + "boot-libs/base/Data/Proxy.hs", + "boot-libs/base/Data/Ratio.hs", + "boot-libs/base/Data/Semigroup.hs", + "boot-libs/base/Data/Semigroup/Internal.hs", + "boot-libs/base/Data/Semigroup/Internal.hs-boot", + "boot-libs/base/Data/STRef.hs", + "boot-libs/base/Data/STRef/Lazy.hs", + "boot-libs/base/Data/STRef/Strict.hs", + "boot-libs/base/Data/String.hs", + "boot-libs/base/Data/Traversable.hs", + "boot-libs/base/Data/Tuple.hs", + "boot-libs/base/Data/Type/Bool.hs", + "boot-libs/base/Data/Type/Coercion.hs", + "boot-libs/base/Data/Type/Equality.hs", + "boot-libs/base/Data/Typeable.hs", + "boot-libs/base/Data/Typeable/Internal.hs", + "boot-libs/base/Data/Unique.hs", + "boot-libs/base/Data/Version.hs", + "boot-libs/base/Data/Void.hs", + "boot-libs/base/Data/Word.hs", + "boot-libs/base/Debug/Trace.hs", + "boot-libs/base/Debug/Trace.hs-boot", + "boot-libs/base/Foreign.hs", + "boot-libs/base/Foreign/C.hs", + "boot-libs/base/Foreign/C/Error.hs", + "boot-libs/base/Foreign/C/String.hs", + "boot-libs/base/Foreign/C/Types.hs", + "boot-libs/base/Foreign/Concurrent.hs", + "boot-libs/base/Foreign/ForeignPtr.hs", + "boot-libs/base/Foreign/ForeignPtr/Imp.hs", + "boot-libs/base/Foreign/ForeignPtr/Safe.hs", + "boot-libs/base/Foreign/ForeignPtr/Unsafe.hs", + "boot-libs/base/Foreign/Marshal.hs", + "boot-libs/base/Foreign/Marshal/Alloc.hs", + "boot-libs/base/Foreign/Marshal/Array.hs", + "boot-libs/base/Foreign/Marshal/Error.hs", + "boot-libs/base/Foreign/Marshal/Pool.hs", + "boot-libs/base/Foreign/Marshal/Safe.hs", + "boot-libs/base/Foreign/Marshal/Unsafe.hs", + "boot-libs/base/Foreign/Marshal/Utils.hs", + "boot-libs/base/Foreign/Ptr.hs", + "boot-libs/base/Foreign/Safe.hs", + "boot-libs/base/Foreign/StablePtr.hs", + "boot-libs/base/Foreign/Storable.hs", + "boot-libs/base/GHC/Arr.hs", + "boot-libs/base/GHC/Base.hs", + "boot-libs/base/GHC/Base.hs-boot", + "boot-libs/base/GHC/ByteOrder.hs", + "boot-libs/base/GHC/Char.hs", + "boot-libs/base/GHC/Clock.hsc", + "boot-libs/base/GHC/Conc.hs", + "boot-libs/base/GHC/Conc/IO.hs", + "boot-libs/base/GHC/Conc/Signal.hs", + "boot-libs/base/GHC/Conc/Sync.hs", + "boot-libs/base/GHC/Conc/Windows.hs", + "boot-libs/base/GHC/ConsoleHandler.hs", + "boot-libs/base/GHC/Constants.hs", + "boot-libs/base/GHC/Desugar.hs", + "boot-libs/base/GHC/Enum.hs", + "boot-libs/base/GHC/Environment.hs", + "boot-libs/base/GHC/Err.hs", + "boot-libs/base/GHC/Event.hs", + "boot-libs/base/GHC/Event/Arr.hs", + "boot-libs/base/GHC/Event/Array.hs", + "boot-libs/base/GHC/Event/Control.hs", + "boot-libs/base/GHC/Event/EPoll.hsc", + "boot-libs/base/GHC/Event/Internal.hs", + "boot-libs/base/GHC/Event/IntTable.hs", + "boot-libs/base/GHC/Event/KQueue.hsc", + "boot-libs/base/GHC/Event/Manager.hs", + "boot-libs/base/GHC/Event/Poll.hsc", + "boot-libs/base/GHC/Event/PSQ.hs", + "boot-libs/base/GHC/Event/Thread.hs", + "boot-libs/base/GHC/Event/TimerManager.hs", + "boot-libs/base/GHC/Event/Unique.hs", + "boot-libs/base/GHC/Exception.hs", + "boot-libs/base/GHC/Exception.hs-boot", + "boot-libs/base/GHC/Exception/Type.hs", + "boot-libs/base/GHC/Exception/Type.hs-boot", + "boot-libs/base/GHC/ExecutionStack.hs", + "boot-libs/base/GHC/ExecutionStack/Internal.hsc", + "boot-libs/base/GHC/Exts.hs", + "boot-libs/base/GHC/Fingerprint.hs", + "boot-libs/base/GHC/Fingerprint.hs-boot", + "boot-libs/base/GHC/Fingerprint/Type.hs", + "boot-libs/base/GHC/Float.hs", + "boot-libs/base/GHC/Float/ConversionUtils.hs", + "boot-libs/base/GHC/Float/RealFracMethods.hs", + "boot-libs/base/GHC/Foreign.hs", + "boot-libs/base/GHC/ForeignPtr.hs", + "boot-libs/base/GHC/Generics.hs", + "boot-libs/base/GHC/GHCi.hs", + "boot-libs/base/GHC/GHCi/Helpers.hs", + "boot-libs/base/GHC/Int.hs", + "boot-libs/base/GHC/IO.hs", + "boot-libs/base/GHC/IO.hs-boot", + "boot-libs/base/GHC/IO/Buffer.hs", + "boot-libs/base/GHC/IO/BufferedIO.hs", + "boot-libs/base/GHC/IO/Device.hs", + "boot-libs/base/GHC/IO/Encoding.hs", + "boot-libs/base/GHC/IO/Encoding.hs-boot", + "boot-libs/base/GHC/IO/Encoding/CodePage.hs", + "boot-libs/base/GHC/IO/Encoding/CodePage/API.hs", + "boot-libs/base/GHC/IO/Encoding/CodePage/Table.hs", + "boot-libs/base/GHC/IO/Encoding/Failure.hs", + "boot-libs/base/GHC/IO/Encoding/Iconv.hs", + "boot-libs/base/GHC/IO/Encoding/Latin1.hs", + "boot-libs/base/GHC/IO/Encoding/Types.hs", + "boot-libs/base/GHC/IO/Encoding/UTF16.hs", + "boot-libs/base/GHC/IO/Encoding/UTF32.hs", + "boot-libs/base/GHC/IO/Encoding/UTF8.hs", + "boot-libs/base/GHC/IO/Exception.hs", + "boot-libs/base/GHC/IO/Exception.hs-boot", + "boot-libs/base/GHC/IO/FD.hs", + "boot-libs/base/GHC/IO/Handle.hs", + "boot-libs/base/GHC/IO/Handle.hs-boot", + "boot-libs/base/GHC/IO/Handle/FD.hs", + "boot-libs/base/GHC/IO/Handle/FD.hs-boot", + "boot-libs/base/GHC/IO/Handle/Internals.hs", + "boot-libs/base/GHC/IO/Handle/Lock.hsc", + "boot-libs/base/GHC/IO/Handle/Text.hs", + "boot-libs/base/GHC/IO/Handle/Types.hs", + "boot-libs/base/GHC/IO/IOMode.hs", + "boot-libs/base/GHC/IO/Unsafe.hs", + "boot-libs/base/GHC/IOArray.hs", + "boot-libs/base/GHC/IORef.hs", + "boot-libs/base/GHC/List.hs", + "boot-libs/base/GHC/Maybe.hs", + "boot-libs/base/GHC/MVar.hs", + "boot-libs/base/GHC/Natural.hs", + "boot-libs/base/GHC/Num.hs", + "boot-libs/base/GHC/OldList.hs", + "boot-libs/base/GHC/OverloadedLabels.hs", + "boot-libs/base/GHC/Pack.hs", + "boot-libs/base/GHC/Profiling.hs", + "boot-libs/base/GHC/Ptr.hs", + "boot-libs/base/GHC/Read.hs", + "boot-libs/base/GHC/Real.hs", + "boot-libs/base/GHC/Real.hs-boot", + "boot-libs/base/GHC/Records.hs", + "boot-libs/base/GHC/ResponseFile.hs", + "boot-libs/base/GHC/RTS/Flags.hsc", + "boot-libs/base/GHC/Show.hs", + "boot-libs/base/GHC/ST.hs", + "boot-libs/base/GHC/Stable.hs", + "boot-libs/base/GHC/StableName.hs", + "boot-libs/base/GHC/Stack.hs", + "boot-libs/base/GHC/Stack/CCS.hs-boot", + "boot-libs/base/GHC/Stack/CCS.hsc", + "boot-libs/base/GHC/Stack/Types.hs", + "boot-libs/base/GHC/StaticPtr.hs", + "boot-libs/base/GHC/StaticPtr/Internal.hs", + "boot-libs/base/GHC/Stats.hsc", + "boot-libs/base/GHC/Storable.hs", + "boot-libs/base/GHC/STRef.hs", + "boot-libs/base/GHC/TopHandler.hs", + "boot-libs/base/GHC/TypeLits.hs", + "boot-libs/base/GHC/TypeNats.hs", + "boot-libs/base/GHC/Unicode.hs", + "boot-libs/base/GHC/Weak.hs", + "boot-libs/base/GHC/Windows.hs", + "boot-libs/base/GHC/Word.hs", + "boot-libs/base/include/consUtils.h", + "boot-libs/base/include/CTypes.h", + "boot-libs/base/include/EventConfig.h.in", + "boot-libs/base/include/fs.h", + "boot-libs/base/include/HsBase.h", + "boot-libs/base/include/HsBaseConfig.h.in", + "boot-libs/base/include/HsEvent.h", + "boot-libs/base/include/ieee-flpt.h", + "boot-libs/base/include/md5.h", + "boot-libs/base/include/WCsubst.h", + "boot-libs/base/install-sh", + "boot-libs/base/LICENSE", + "boot-libs/base/Numeric.hs", + "boot-libs/base/Numeric/Natural.hs", + "boot-libs/base/Prelude.hs", + "boot-libs/base/prologue.txt", + "boot-libs/base/Setup.hs", + "boot-libs/base/System/Console/GetOpt.hs", + "boot-libs/base/System/CPUTime.hsc", + "boot-libs/base/System/CPUTime/Posix/ClockGetTime.hsc", + "boot-libs/base/System/CPUTime/Posix/RUsage.hsc", + "boot-libs/base/System/CPUTime/Posix/Times.hsc", + "boot-libs/base/System/CPUTime/Unsupported.hs", + "boot-libs/base/System/CPUTime/Utils.hs", + "boot-libs/base/System/CPUTime/Windows.hsc", + "boot-libs/base/System/Environment.hs", + "boot-libs/base/System/Environment/Blank.hsc", + "boot-libs/base/System/Environment/ExecutablePath.hsc", + "boot-libs/base/System/Exit.hs", + "boot-libs/base/System/Info.hs", + "boot-libs/base/System/IO.hs", + "boot-libs/base/System/IO/Error.hs", + "boot-libs/base/System/IO/Unsafe.hs", + "boot-libs/base/System/Mem.hs", + "boot-libs/base/System/Mem/StableName.hs", + "boot-libs/base/System/Mem/Weak.hs", + "boot-libs/base/System/Posix/Internals.hs", + "boot-libs/base/System/Posix/Types.hs", + "boot-libs/base/System/Timeout.hs", + "boot-libs/base/tests/addr001.hs", + "boot-libs/base/tests/addr001.stdout", + "boot-libs/base/tests/addr001.stdout-alpha-dec-osf3", + "boot-libs/base/tests/addr001.stdout-mips-sgi-irix", + "boot-libs/base/tests/addr001.stdout-ws-64", + "boot-libs/base/tests/addr001.stdout-x86_64-unknown-openbsd", + "boot-libs/base/tests/all.T", + "boot-libs/base/tests/assert.hs", + "boot-libs/base/tests/assert.stderr", + "boot-libs/base/tests/CatEntail.hs", + "boot-libs/base/tests/CatPairs.hs", + "boot-libs/base/tests/char001.hs", + "boot-libs/base/tests/char001.stdout", + "boot-libs/base/tests/char002.hs", + "boot-libs/base/tests/char002.stdout", + "boot-libs/base/tests/Concurrent/4876.stdout", + "boot-libs/base/tests/Concurrent/all.T", + "boot-libs/base/tests/Concurrent/Chan001.hs", + "boot-libs/base/tests/Concurrent/Chan001.stdout", + "boot-libs/base/tests/Concurrent/Chan002.hs", + "boot-libs/base/tests/Concurrent/Chan002.stdout", + "boot-libs/base/tests/Concurrent/Chan003.hs", + "boot-libs/base/tests/Concurrent/Chan003.stdout", + "boot-libs/base/tests/Concurrent/Makefile", + "boot-libs/base/tests/Concurrent/MVar001.hs", + "boot-libs/base/tests/Concurrent/MVar001.stdout", + "boot-libs/base/tests/Concurrent/ThreadDelay001.hs", + "boot-libs/base/tests/CPUTime001.hs", + "boot-libs/base/tests/CPUTime001.stdout", + "boot-libs/base/tests/cstring001.hs", + "boot-libs/base/tests/data-fixed-show-read.hs", + "boot-libs/base/tests/data-fixed-show-read.stdout", + "boot-libs/base/tests/dynamic001.hs", + "boot-libs/base/tests/dynamic001.stdout", + "boot-libs/base/tests/dynamic002.hs", + "boot-libs/base/tests/dynamic002.stdout", + "boot-libs/base/tests/dynamic003.hs", + "boot-libs/base/tests/dynamic003.stdout", + "boot-libs/base/tests/dynamic004.hs", + "boot-libs/base/tests/dynamic004.stdout", + "boot-libs/base/tests/dynamic005.hs", + "boot-libs/base/tests/dynamic005.stdout", + "boot-libs/base/tests/echo001.hs", + "boot-libs/base/tests/echo001.stdout", + "boot-libs/base/tests/enum01.hs", + "boot-libs/base/tests/enum01.stdout", + "boot-libs/base/tests/enum01.stdout-alpha-dec-osf3", + "boot-libs/base/tests/enum01.stdout-ws-64", + "boot-libs/base/tests/enum02.hs", + "boot-libs/base/tests/enum02.stdout", + "boot-libs/base/tests/enum02.stdout-alpha-dec-osf3", + "boot-libs/base/tests/enum02.stdout-mips-sgi-irix", + "boot-libs/base/tests/enum02.stdout-ws-64", + "boot-libs/base/tests/enum02.stdout-x86_64-unknown-openbsd", + "boot-libs/base/tests/enum03.hs", + "boot-libs/base/tests/enum03.stdout", + "boot-libs/base/tests/enum03.stdout-alpha-dec-osf3", + "boot-libs/base/tests/enum03.stdout-mips-sgi-irix", + "boot-libs/base/tests/enum03.stdout-ws-64", + "boot-libs/base/tests/enum03.stdout-x86_64-unknown-openbsd", + "boot-libs/base/tests/enum04.hs", + "boot-libs/base/tests/enum04.stdout", + "boot-libs/base/tests/enum_processor.bat", + "boot-libs/base/tests/enum_processor.py", + "boot-libs/base/tests/enumDouble.hs", + "boot-libs/base/tests/enumDouble.stdout", + "boot-libs/base/tests/enumNumeric.hs", + "boot-libs/base/tests/enumNumeric.stdout", + "boot-libs/base/tests/enumRatio.hs", + "boot-libs/base/tests/enumRatio.stdout", + "boot-libs/base/tests/exceptionsrun001.hs", + "boot-libs/base/tests/exceptionsrun001.stdout", + "boot-libs/base/tests/exceptionsrun002.hs", + "boot-libs/base/tests/exceptionsrun002.stdout", + "boot-libs/base/tests/fixed.hs", + "boot-libs/base/tests/fixed.stdout", + "boot-libs/base/tests/fixUsingLazyST.stdout", + "boot-libs/base/tests/foldableArray.hs", + "boot-libs/base/tests/foldableArray.stdout", + "boot-libs/base/tests/fromJust.hs", + "boot-libs/base/tests/fromJust.stderr", + "boot-libs/base/tests/functorOperators.hs", + "boot-libs/base/tests/functorOperators.stdout", + "boot-libs/base/tests/genericNegative001.hs", + "boot-libs/base/tests/genericNegative001.stdout", + "boot-libs/base/tests/hGetBuf002.hs", + "boot-libs/base/tests/hGetBuf002.stdout", + "boot-libs/base/tests/hGetBuf003.hs", + "boot-libs/base/tests/hGetBuf003.stdout", + "boot-libs/base/tests/hPutBuf001.hs", + "boot-libs/base/tests/hPutBuf001.stdout", + "boot-libs/base/tests/hPutBuf002.hs", + "boot-libs/base/tests/hPutBuf002.stdout", + "boot-libs/base/tests/hTell001.hs", + "boot-libs/base/tests/hTell001.stdout", + "boot-libs/base/tests/hTell002.hs", + "boot-libs/base/tests/hTell002.stdout", + "boot-libs/base/tests/hWaitForInput-accurate-socket.hs", + "boot-libs/base/tests/hWaitForInput-accurate-socket.stdout", + "boot-libs/base/tests/inits.hs", + "boot-libs/base/tests/IO/all.T", + "boot-libs/base/tests/IO/concio001.hs", + "boot-libs/base/tests/IO/concio001.stdout", + "boot-libs/base/tests/IO/concio001.thr.stdout", + "boot-libs/base/tests/IO/concio002.hs", + "boot-libs/base/tests/IO/concio002.stdout", + "boot-libs/base/tests/IO/countReaders001.hs", + "boot-libs/base/tests/IO/countReaders001.stdout", + "boot-libs/base/tests/IO/decodingerror001.hs", + "boot-libs/base/tests/IO/decodingerror001.in1", + "boot-libs/base/tests/IO/decodingerror001.in2", + "boot-libs/base/tests/IO/decodingerror001.stdout", + "boot-libs/base/tests/IO/decodingerror002.hs", + "boot-libs/base/tests/IO/decodingerror002.in", + "boot-libs/base/tests/IO/decodingerror002.stdout", + "boot-libs/base/tests/IO/encoded-data/CP1251-UTF8.txt", + "boot-libs/base/tests/IO/encoded-data/CP1251.txt", + "boot-libs/base/tests/IO/encoded-data/CP936-UTF8.txt", + "boot-libs/base/tests/IO/encoded-data/CP936.txt", + "boot-libs/base/tests/IO/encoding001.hs", + "boot-libs/base/tests/IO/encoding002.hs", + "boot-libs/base/tests/IO/encoding002.stdout", + "boot-libs/base/tests/IO/encoding003.hs", + "boot-libs/base/tests/IO/encoding003.stdout", + "boot-libs/base/tests/IO/encoding004.hs", + "boot-libs/base/tests/IO/encoding004.stdout", + "boot-libs/base/tests/IO/encoding005.hs", + "boot-libs/base/tests/IO/encoding005.stdout", + "boot-libs/base/tests/IO/encodingerror001.hs", + "boot-libs/base/tests/IO/encodingerror001.stdout", + "boot-libs/base/tests/IO/environment001.hs", + "boot-libs/base/tests/IO/environment001.stdout", + "boot-libs/base/tests/IO/finalization001.hs", + "boot-libs/base/tests/IO/finalization001.stdout", + "boot-libs/base/tests/IO/hClose001.hs", + "boot-libs/base/tests/IO/hClose001.stdout", + "boot-libs/base/tests/IO/hClose002.hs", + "boot-libs/base/tests/IO/hClose002.stdout", + "boot-libs/base/tests/IO/hClose002.stdout-i386-unknown-solaris2", + "boot-libs/base/tests/IO/hClose002.stdout-x86_64-unknown-solaris2", + "boot-libs/base/tests/IO/hClose003.hs", + "boot-libs/base/tests/IO/hClose003.stdout", + "boot-libs/base/tests/IO/hDuplicateTo001.hs", + "boot-libs/base/tests/IO/hDuplicateTo001.stderr", + "boot-libs/base/tests/IO/hFileSize001.hs", + "boot-libs/base/tests/IO/hFileSize001.stdout", + "boot-libs/base/tests/IO/hFileSize002.hs", + "boot-libs/base/tests/IO/hFileSize002.stdout", + "boot-libs/base/tests/IO/hFlush001.hs", + "boot-libs/base/tests/IO/hFlush001.stdout", + "boot-libs/base/tests/IO/hGetBuf001.hs", + "boot-libs/base/tests/IO/hGetBuf001.stdout", + "boot-libs/base/tests/IO/hGetBuffering001.hs", + "boot-libs/base/tests/IO/hGetBuffering001.stdout", + "boot-libs/base/tests/IO/hGetChar001.hs", + "boot-libs/base/tests/IO/hGetChar001.stdin", + "boot-libs/base/tests/IO/hGetChar001.stdout", + "boot-libs/base/tests/IO/hGetLine001.hs", + "boot-libs/base/tests/IO/hGetLine001.stdout", + "boot-libs/base/tests/IO/hGetLine002.hs", + "boot-libs/base/tests/IO/hGetLine002.stdin", + "boot-libs/base/tests/IO/hGetLine002.stdout", + "boot-libs/base/tests/IO/hGetLine003.hs", + "boot-libs/base/tests/IO/hGetLine003.stdin", + "boot-libs/base/tests/IO/hGetLine003.stdout", + "boot-libs/base/tests/IO/hGetPosn001.hs", + "boot-libs/base/tests/IO/hGetPosn001.in", + "boot-libs/base/tests/IO/hGetPosn001.stdout", + "boot-libs/base/tests/IO/hIsEOF001.hs", + "boot-libs/base/tests/IO/hIsEOF001.stdout", + "boot-libs/base/tests/IO/hIsEOF002.hs", + "boot-libs/base/tests/IO/hIsEOF002.stdout", + "boot-libs/base/tests/IO/hReady001.hs", + "boot-libs/base/tests/IO/hReady001.stdout", + "boot-libs/base/tests/IO/hReady002.hs", + "boot-libs/base/tests/IO/hReady002.stdout", + "boot-libs/base/tests/IO/hSeek001.hs", + "boot-libs/base/tests/IO/hSeek001.in", + "boot-libs/base/tests/IO/hSeek001.stdout", + "boot-libs/base/tests/IO/hSeek002.hs", + "boot-libs/base/tests/IO/hSeek002.stdout", + "boot-libs/base/tests/IO/hSeek003.hs", + "boot-libs/base/tests/IO/hSeek003.stdout", + "boot-libs/base/tests/IO/hSeek004.hs", + "boot-libs/base/tests/IO/hSeek004.stdout", + "boot-libs/base/tests/IO/hSetBuffering002.hs", + "boot-libs/base/tests/IO/hSetBuffering002.stdout", + "boot-libs/base/tests/IO/hSetBuffering003.hs", + "boot-libs/base/tests/IO/hSetBuffering003.stderr", + "boot-libs/base/tests/IO/hSetBuffering003.stdout", + "boot-libs/base/tests/IO/hSetBuffering004.hs", + "boot-libs/base/tests/IO/hSetBuffering004.stdout", + "boot-libs/base/tests/IO/hSetEncoding001.hs", + "boot-libs/base/tests/IO/hSetEncoding001.in", + "boot-libs/base/tests/IO/hSetEncoding001.stdout", + "boot-libs/base/tests/IO/hSetEncoding002.hs", + "boot-libs/base/tests/IO/hSetEncoding002.stdout", + "boot-libs/base/tests/IO/ioeGetErrorString001.hs", + "boot-libs/base/tests/IO/ioeGetErrorString001.stdout", + "boot-libs/base/tests/IO/ioeGetFileName001.hs", + "boot-libs/base/tests/IO/ioeGetFileName001.stdout", + "boot-libs/base/tests/IO/ioeGetHandle001.hs", + "boot-libs/base/tests/IO/ioeGetHandle001.stdout", + "boot-libs/base/tests/IO/IOError001.hs", + "boot-libs/base/tests/IO/IOError001.stdout", + "boot-libs/base/tests/IO/IOError002.hs", + "boot-libs/base/tests/IO/IOError002.stdout", + "boot-libs/base/tests/IO/isEOF001.hs", + "boot-libs/base/tests/IO/isEOF001.stdout", + "boot-libs/base/tests/IO/latin1", + "boot-libs/base/tests/IO/Makefile", + "boot-libs/base/tests/IO/misc001.hs", + "boot-libs/base/tests/IO/newline001.hs", + "boot-libs/base/tests/IO/openFile001.hs", + "boot-libs/base/tests/IO/openFile001.stdout", + "boot-libs/base/tests/IO/openFile002.hs", + "boot-libs/base/tests/IO/openFile002.stderr", + "boot-libs/base/tests/IO/openFile003.hs", + "boot-libs/base/tests/IO/openFile003.stdout", + "boot-libs/base/tests/IO/openFile003.stdout-mingw32", + "boot-libs/base/tests/IO/openFile003.stdout-mips-sgi-irix", + "boot-libs/base/tests/IO/openFile003.stdout-sparc-sun-solaris2", + "boot-libs/base/tests/IO/openFile004.hs", + "boot-libs/base/tests/IO/openFile004.stdout", + "boot-libs/base/tests/IO/openFile005.hs", + "boot-libs/base/tests/IO/openFile005.stdout", + "boot-libs/base/tests/IO/openFile006.hs", + "boot-libs/base/tests/IO/openFile006.stdout", + "boot-libs/base/tests/IO/openFile007.hs", + "boot-libs/base/tests/IO/openFile007.stdout", + "boot-libs/base/tests/IO/openFile008.hs", + "boot-libs/base/tests/IO/openTempFile001.hs", + "boot-libs/base/tests/IO/putStr001.hs", + "boot-libs/base/tests/IO/putStr001.stdout", + "boot-libs/base/tests/IO/readFile001.hs", + "boot-libs/base/tests/IO/readFile001.stdout", + "boot-libs/base/tests/IO/readwrite001.hs", + "boot-libs/base/tests/IO/readwrite001.stdout", + "boot-libs/base/tests/IO/readwrite002.hs", + "boot-libs/base/tests/IO/readwrite002.stdout", + "boot-libs/base/tests/IO/readwrite003.hs", + "boot-libs/base/tests/IO/readwrite003.stdout", + "boot-libs/base/tests/IO/T12010/cbits/initWinSock.c", + "boot-libs/base/tests/IO/T12010/Makefile", + "boot-libs/base/tests/IO/T12010/T12010.hsc", + "boot-libs/base/tests/IO/T12010/test.T", + "boot-libs/base/tests/IO/T17414.hs", + "boot-libs/base/tests/IO/T2122.hs", + "boot-libs/base/tests/IO/T3307.hs", + "boot-libs/base/tests/IO/T3307.stdout", + "boot-libs/base/tests/IO/T4144.hs", + "boot-libs/base/tests/IO/T4144.stdout", + "boot-libs/base/tests/IO/T4808.hs", + "boot-libs/base/tests/IO/T4808.stderr", + "boot-libs/base/tests/IO/T4808.stdout", + "boot-libs/base/tests/IO/T4855.hs", + "boot-libs/base/tests/IO/T4855.stderr", + "boot-libs/base/tests/IO/T4895.hs", + "boot-libs/base/tests/IO/T4895.stdout", + "boot-libs/base/tests/IO/T7853.hs", + "boot-libs/base/tests/IO/T7853.stdout", + "boot-libs/base/tests/IO/utf8-test", + "boot-libs/base/tests/ioref001.hs", + "boot-libs/base/tests/ioref001.stdout", + "boot-libs/base/tests/isSuffixOf.hs", + "boot-libs/base/tests/isSuffixOf.stdout", + "boot-libs/base/tests/ix001.hs", + "boot-libs/base/tests/ix001.stdout", + "boot-libs/base/tests/lazySTexamples.hs", + "boot-libs/base/tests/lazySTexamples.stderr", + "boot-libs/base/tests/lazySTexamples.stdout", + "boot-libs/base/tests/length001.hs", + "boot-libs/base/tests/length001.stdout", + "boot-libs/base/tests/lex001.hs", + "boot-libs/base/tests/lex001.stdout", + "boot-libs/base/tests/list001.hs", + "boot-libs/base/tests/list001.stdout", + "boot-libs/base/tests/list002.hs", + "boot-libs/base/tests/list002.stdout", + "boot-libs/base/tests/list003.hs", + "boot-libs/base/tests/list003.stdout", + "boot-libs/base/tests/Makefile", + "boot-libs/base/tests/memo001.hs", + "boot-libs/base/tests/memo001.stdout", + "boot-libs/base/tests/memo002.hs", + "boot-libs/base/tests/memo002.stdout", + "boot-libs/base/tests/Memo1.lhs", + "boot-libs/base/tests/Memo2.lhs", + "boot-libs/base/tests/Numeric/all.T", + "boot-libs/base/tests/Numeric/Makefile", + "boot-libs/base/tests/Numeric/num001.hs", + "boot-libs/base/tests/Numeric/num001.stdout", + "boot-libs/base/tests/Numeric/num002.hs", + "boot-libs/base/tests/Numeric/num002.stdout", + "boot-libs/base/tests/Numeric/num002.stdout-alpha-dec-osf3", + "boot-libs/base/tests/Numeric/num002.stdout-mips-sgi-irix", + "boot-libs/base/tests/Numeric/num002.stdout-ws-64", + "boot-libs/base/tests/Numeric/num002.stdout-x86_64-unknown-openbsd", + "boot-libs/base/tests/Numeric/num003.hs", + "boot-libs/base/tests/Numeric/num003.stdout", + "boot-libs/base/tests/Numeric/num003.stdout-alpha-dec-osf3", + "boot-libs/base/tests/Numeric/num003.stdout-mips-sgi-irix", + "boot-libs/base/tests/Numeric/num003.stdout-ws-64", + "boot-libs/base/tests/Numeric/num003.stdout-x86_64-unknown-openbsd", + "boot-libs/base/tests/Numeric/num004.hs", + "boot-libs/base/tests/Numeric/num004.stdout", + "boot-libs/base/tests/Numeric/num004.stdout-alpha-dec-osf3", + "boot-libs/base/tests/Numeric/num004.stdout-mips-sgi-irix", + "boot-libs/base/tests/Numeric/num004.stdout-ws-64", + "boot-libs/base/tests/Numeric/num004.stdout-x86_64-unknown-openbsd", + "boot-libs/base/tests/Numeric/num005.hs", + "boot-libs/base/tests/Numeric/num005.stdout", + "boot-libs/base/tests/Numeric/num005.stdout-alpha-dec-osf3", + "boot-libs/base/tests/Numeric/num005.stdout-mips-sgi-irix", + "boot-libs/base/tests/Numeric/num005.stdout-ws-64", + "boot-libs/base/tests/Numeric/num005.stdout-x86_64-unknown-openbsd", + "boot-libs/base/tests/Numeric/num006.hs", + "boot-libs/base/tests/Numeric/num006.stdout", + "boot-libs/base/tests/Numeric/num007.hs", + "boot-libs/base/tests/Numeric/num007.stdout", + "boot-libs/base/tests/Numeric/num008.hs", + "boot-libs/base/tests/Numeric/num008.stdout", + "boot-libs/base/tests/Numeric/num009.hs", + "boot-libs/base/tests/Numeric/num009.stdout", + "boot-libs/base/tests/Numeric/num009.stdout-i386-unknown-mingw32", + "boot-libs/base/tests/Numeric/num010.hs", + "boot-libs/base/tests/Numeric/num010.stdout", + "boot-libs/base/tests/Numeric/sqrt.hs", + "boot-libs/base/tests/Numeric/sqrt.stdout", + "boot-libs/base/tests/performGC001.hs", + "boot-libs/base/tests/qsem001.hs", + "boot-libs/base/tests/qsem001.stdout", + "boot-libs/base/tests/qsemn001.hs", + "boot-libs/base/tests/qsemn001.stdout", + "boot-libs/base/tests/quotOverflow.hs", + "boot-libs/base/tests/quotOverflow.stdout", + "boot-libs/base/tests/rand001.hs", + "boot-libs/base/tests/rand001.stdout", + "boot-libs/base/tests/ratio001.hs", + "boot-libs/base/tests/ratio001.stdout", + "boot-libs/base/tests/readDouble001.hs", + "boot-libs/base/tests/readDouble001.stdout", + "boot-libs/base/tests/readFixed001.hs", + "boot-libs/base/tests/readFixed001.stdout", + "boot-libs/base/tests/readFloat.hs", + "boot-libs/base/tests/readFloat.stderr", + "boot-libs/base/tests/readInteger001.hs", + "boot-libs/base/tests/readInteger001.stdout", + "boot-libs/base/tests/readLitChar.hs", + "boot-libs/base/tests/readLitChar.stdout", + "boot-libs/base/tests/reads001.hs", + "boot-libs/base/tests/reads001.stdout", + "boot-libs/base/tests/show001.hs", + "boot-libs/base/tests/show001.stdout", + "boot-libs/base/tests/showDouble.hs", + "boot-libs/base/tests/showDouble.stdout", + "boot-libs/base/tests/stableptr001.hs", + "boot-libs/base/tests/stableptr001.stdout", + "boot-libs/base/tests/stableptr003.hs", + "boot-libs/base/tests/stableptr004.hs", + "boot-libs/base/tests/stableptr004.stdout", + "boot-libs/base/tests/stableptr005.hs", + "boot-libs/base/tests/stableptr005.stdout", + "boot-libs/base/tests/System/all.T", + "boot-libs/base/tests/System/exitWith001.hs", + "boot-libs/base/tests/System/getArgs001.hs", + "boot-libs/base/tests/System/getArgs001.stdout", + "boot-libs/base/tests/System/getEnv001.hs", + "boot-libs/base/tests/System/getEnv001.stdout", + "boot-libs/base/tests/System/Makefile", + "boot-libs/base/tests/System/system001.hs", + "boot-libs/base/tests/System/system001.stdout", + "boot-libs/base/tests/System/T5930.hs", + "boot-libs/base/tests/System/T5930.stdout", + "boot-libs/base/tests/System/Timeout001.hs", + "boot-libs/base/tests/T10149.hs", + "boot-libs/base/tests/T10149.stdout", + "boot-libs/base/tests/T10412.hs", + "boot-libs/base/tests/T10412.stdout", + "boot-libs/base/tests/T11334a.hs", + "boot-libs/base/tests/T11334a.stdout", + "boot-libs/base/tests/T11555.hs", + "boot-libs/base/tests/T11555.stdout", + "boot-libs/base/tests/T11760.hs", + "boot-libs/base/tests/T11760.stdout", + "boot-libs/base/tests/T12494.hs", + "boot-libs/base/tests/T12494.stdout", + "boot-libs/base/tests/T12852.hs", + "boot-libs/base/tests/T12852.stdout", + "boot-libs/base/tests/T12874.hs", + "boot-libs/base/tests/T12874.stdout", + "boot-libs/base/tests/T13097.hs", + "boot-libs/base/tests/T13097.stdout", + "boot-libs/base/tests/T13167.hs", + "boot-libs/base/tests/T13167.stdout", + "boot-libs/base/tests/T13191.hs", + "boot-libs/base/tests/T13191.stdout", + "boot-libs/base/tests/T13525.hs", + "boot-libs/base/tests/T13896.hs", + "boot-libs/base/tests/T14425.hs", + "boot-libs/base/tests/T14425.stdout", + "boot-libs/base/tests/T15349.hs", + "boot-libs/base/tests/T15349.stderr", + "boot-libs/base/tests/T16111.hs", + "boot-libs/base/tests/T16111.stderr", + "boot-libs/base/tests/T16943a.hs", + "boot-libs/base/tests/T16943a.stdout", + "boot-libs/base/tests/T16943b.hs", + "boot-libs/base/tests/T16943b.stdout", + "boot-libs/base/tests/T2528.hs", + "boot-libs/base/tests/T2528.stdout", + "boot-libs/base/tests/T3474.hs", + "boot-libs/base/tests/T3474.stdout", + "boot-libs/base/tests/T4006.hs", + "boot-libs/base/tests/T4006.stdout", + "boot-libs/base/tests/T5943.hs", + "boot-libs/base/tests/T5943.stdout", + "boot-libs/base/tests/T5962.hs", + "boot-libs/base/tests/T5962.stdout", + "boot-libs/base/tests/T7034.hs", + "boot-libs/base/tests/T7034.stdout", + "boot-libs/base/tests/T7457.hs", + "boot-libs/base/tests/T7457.stdout", + "boot-libs/base/tests/T7653.hs", + "boot-libs/base/tests/T7773.hs", + "boot-libs/base/tests/T7773.stdout", + "boot-libs/base/tests/T7787.hs", + "boot-libs/base/tests/T7787.stdout", + "boot-libs/base/tests/T8089.hs", + "boot-libs/base/tests/T8684.hs", + "boot-libs/base/tests/T8766.hs", + "boot-libs/base/tests/T8766.stdout", + "boot-libs/base/tests/T9111.hs", + "boot-libs/base/tests/T9395.hs", + "boot-libs/base/tests/T9395.stderr", + "boot-libs/base/tests/T9532.hs", + "boot-libs/base/tests/T9532.stdout", + "boot-libs/base/tests/T9586.hs", + "boot-libs/base/tests/T9681.hs", + "boot-libs/base/tests/T9681.stderr", + "boot-libs/base/tests/T9826.hs", + "boot-libs/base/tests/T9826.stdout", + "boot-libs/base/tests/T9848.hs", + "boot-libs/base/tests/T9848.stdout", + "boot-libs/base/tests/take001.hs", + "boot-libs/base/tests/take001.stdout", + "boot-libs/base/tests/tempfiles.hs", + "boot-libs/base/tests/tempfiles.stdout", + "boot-libs/base/tests/tempfiles.stdout-mingw32", + "boot-libs/base/tests/Text.Printf/all.T", + "boot-libs/base/tests/Text.Printf/Makefile", + "boot-libs/base/tests/Text.Printf/T1548.hs", + "boot-libs/base/tests/Text.Printf/T1548.stdout", + "boot-libs/base/tests/text001.hs", + "boot-libs/base/tests/text001.stdout", + "boot-libs/base/tests/topHandler01.hs", + "boot-libs/base/tests/topHandler01.stdout", + "boot-libs/base/tests/topHandler02.hs", + "boot-libs/base/tests/topHandler03.hs", + "boot-libs/base/tests/topHandler04.hs", + "boot-libs/base/tests/topHandler04.stderr", + "boot-libs/base/tests/trace001.hs", + "boot-libs/base/tests/trace001.stderr", + "boot-libs/base/tests/trace001.stdout", + "boot-libs/base/tests/tup001.hs", + "boot-libs/base/tests/tup001.stdout", + "boot-libs/base/tests/unicode001.hs", + "boot-libs/base/tests/unicode001.stdout", + "boot-libs/base/tests/unicode002.hs", + "boot-libs/base/tests/unicode002.stdout", + "boot-libs/base/tests/weak001.hs", + "boot-libs/base/Text/ParserCombinators/ReadP.hs", + "boot-libs/base/Text/ParserCombinators/ReadPrec.hs", + "boot-libs/base/Text/Printf.hs", + "boot-libs/base/Text/Read.hs", + "boot-libs/base/Text/Read/Lex.hs", + "boot-libs/base/Text/Show.hs", + "boot-libs/base/Text/Show/Functions.hs", + "boot-libs/base/Type/Reflection.hs", + "boot-libs/base/Type/Reflection/Unsafe.hs", + "boot-libs/base/Unsafe/Coerce.hs", + "boot-libs/cabal.config", + "boot-libs/ghc-boot-th/changelog.md", + "boot-libs/ghc-boot-th/ghc-boot-th.cabal", + "boot-libs/ghc-boot-th/ghc-boot-th.cabal.in", + "boot-libs/ghc-boot-th/GHC/ForeignSrcLang/Type.hs", + "boot-libs/ghc-boot-th/GHC/LanguageExtensions/Type.hs", + "boot-libs/ghc-boot-th/GHC/Lexeme.hs", + "boot-libs/ghc-boot-th/LICENSE", + "boot-libs/ghc-boot/changelog.md", + "boot-libs/ghc-boot/ghc-boot.cabal", + "boot-libs/ghc-boot/ghc-boot.cabal.in", + "boot-libs/ghc-boot/GHC/ForeignSrcLang.hs", + "boot-libs/ghc-boot/GHC/HandleEncoding.hs", + "boot-libs/ghc-boot/GHC/LanguageExtensions.hs", + "boot-libs/ghc-boot/GHC/PackageDb.hs", + "boot-libs/ghc-boot/GHC/Serialized.hs", + "boot-libs/ghc-boot/LICENSE", + "boot-libs/ghc-heap/cbits/HeapPrim.cmm", + "boot-libs/ghc-heap/ghc-heap.cabal", + "boot-libs/ghc-heap/ghc-heap.cabal.in", + "boot-libs/ghc-heap/GHC/Exts/Heap.hs", + "boot-libs/ghc-heap/GHC/Exts/Heap/Closures.hs", + "boot-libs/ghc-heap/GHC/Exts/Heap/ClosureTypes.hs", + "boot-libs/ghc-heap/GHC/Exts/Heap/Constants.hsc", + "boot-libs/ghc-heap/GHC/Exts/Heap/InfoTable.hsc", + "boot-libs/ghc-heap/GHC/Exts/Heap/InfoTable/Types.hsc", + "boot-libs/ghc-heap/GHC/Exts/Heap/InfoTableProf.hsc", + "boot-libs/ghc-heap/GHC/Exts/Heap/Utils.hsc", + "boot-libs/ghc-heap/LICENSE", + "boot-libs/ghc-heap/Setup.hs", + "boot-libs/ghc-heap/tests/all.T", + "boot-libs/ghc-heap/tests/heap_all.hs", + "boot-libs/ghc-heap/tests/heap_all.stdout", + "boot-libs/ghc-heap/tests/Makefile", + "boot-libs/ghc-prim/cbits/atomic.c", + "boot-libs/ghc-prim/cbits/bswap.c", + "boot-libs/ghc-prim/cbits/clz.c", + "boot-libs/ghc-prim/cbits/ctz.c", + "boot-libs/ghc-prim/cbits/debug.c", + "boot-libs/ghc-prim/cbits/longlong.c", + "boot-libs/ghc-prim/cbits/pdep.c", + "boot-libs/ghc-prim/cbits/pext.c", + "boot-libs/ghc-prim/cbits/popcnt.c", + "boot-libs/ghc-prim/cbits/word2float.c", + "boot-libs/ghc-prim/changelog.md", + "boot-libs/ghc-prim/ghc-prim.cabal", + "boot-libs/ghc-prim/GHC/Classes.hs", + "boot-libs/ghc-prim/GHC/CString.hs", + "boot-libs/ghc-prim/GHC/Debug.hs", + "boot-libs/ghc-prim/GHC/IntWord64.hs", + "boot-libs/ghc-prim/GHC/Magic.hs", + "boot-libs/ghc-prim/GHC/PrimopWrappers.hs", + "boot-libs/ghc-prim/GHC/Tuple.hs", + "boot-libs/ghc-prim/GHC/Types.hs", + "boot-libs/ghc-prim/LICENSE", + "boot-libs/ghc-prim/Setup.hs", + "boot-libs/ghc-prim/tests/T6026.hs", + "boot-libs/ghc-prim/tests/T6026.stdout", + "boot-libs/ghci/Asterius/GHCi.hs", + "boot-libs/ghci/changelog.md", + "boot-libs/ghci/ghci.cabal", + "boot-libs/ghci/ghci.cabal.in", + "boot-libs/ghci/GHCi/BinaryArray.hs", + "boot-libs/ghci/GHCi/BreakArray.hs", + "boot-libs/ghci/GHCi/CreateBCO.hs", + "boot-libs/ghci/GHCi/FFI.hsc", + "boot-libs/ghci/GHCi/InfoTable.hsc", + "boot-libs/ghci/GHCi/Message.hs", + "boot-libs/ghci/GHCi/ObjLink.hs", + "boot-libs/ghci/GHCi/RemoteTypes.hs", + "boot-libs/ghci/GHCi/ResolvedBCO.hs", + "boot-libs/ghci/GHCi/Run.hs", + "boot-libs/ghci/GHCi/Signals.hs", + "boot-libs/ghci/GHCi/StaticPtrTable.hs", + "boot-libs/ghci/GHCi/TH.hs", + "boot-libs/ghci/GHCi/TH/Binary.hs", + "boot-libs/ghci/LICENSE", + "boot-libs/ghci/SizedSeq.hs", + "boot-libs/integer-simple/changelog.md", + "boot-libs/integer-simple/GHC/Integer.hs", + "boot-libs/integer-simple/GHC/Integer/Logarithms.hs", + "boot-libs/integer-simple/GHC/Integer/Logarithms/Internals.hs", + "boot-libs/integer-simple/GHC/Integer/Simple/Internals.hs", + "boot-libs/integer-simple/GHC/Integer/Type.hs", + "boot-libs/integer-simple/integer-simple.cabal", + "boot-libs/integer-simple/LICENSE", + "boot-libs/integer-simple/Setup.hs", + "boot-libs/rts/Apply.cmm", + "boot-libs/rts/AutoApply.cmm", + "boot-libs/rts/AutoApply.h", + "boot-libs/rts/BeginPrivate.h", + "boot-libs/rts/Compact.cmm", + "boot-libs/rts/EndPrivate.h", + "boot-libs/rts/Exception.cmm", + "boot-libs/rts/HeapStackCheck.cmm", + "boot-libs/rts/PrimOps.cmm", + "boot-libs/rts/RaiseAsync.h", + "boot-libs/rts/rts.conf", + "boot-libs/rts/sm/ShouldCompact.h", + "boot-libs/rts/SMPClosureOps.h", + "boot-libs/rts/StgMiscClosures.cmm", + "boot-libs/rts/StgStartup.cmm", + "boot-libs/rts/StgStdThunks.cmm", + "boot-libs/rts/Updates.cmm", + "boot-libs/rts/Updates.h", + "boot-libs/template-haskell/changelog.md", + "boot-libs/template-haskell/Language/Haskell/TH.hs", + "boot-libs/template-haskell/Language/Haskell/TH/LanguageExtensions.hs", + "boot-libs/template-haskell/Language/Haskell/TH/Lib.hs", + "boot-libs/template-haskell/Language/Haskell/TH/Lib/Internal.hs", + "boot-libs/template-haskell/Language/Haskell/TH/Lib/Map.hs", + "boot-libs/template-haskell/Language/Haskell/TH/Ppr.hs", + "boot-libs/template-haskell/Language/Haskell/TH/PprLib.hs", + "boot-libs/template-haskell/Language/Haskell/TH/Quote.hs", + "boot-libs/template-haskell/Language/Haskell/TH/Syntax.hs", + "boot-libs/template-haskell/LICENSE", + "boot-libs/template-haskell/prologue.txt", + "boot-libs/template-haskell/Setup.hs", + "boot-libs/template-haskell/template-haskell.cabal", + "boot-libs/template-haskell/tests/all.T", + "boot-libs/template-haskell/tests/dataToExpQUnit.hs", + "boot-libs/template-haskell/tests/dataToExpQUnit.stderr", + "boot-libs/template-haskell/tests/Makefile", + "ghc-libdir/include/Cmm.h", + "ghc-libdir/include/DerivedConstants.h", + "ghc-libdir/include/ffi.h", + "ghc-libdir/include/ffitarget.h", + "ghc-libdir/include/ghcautoconf.h", + "ghc-libdir/include/ghcconfig.h", + "ghc-libdir/include/ghcplatform.h", + "ghc-libdir/include/ghcversion.h", + "ghc-libdir/include/HsFFI.h", + "ghc-libdir/include/MachDeps.h", + "ghc-libdir/include/Rts.h", + "ghc-libdir/include/rts/Adjustor.h", + "ghc-libdir/include/rts/BlockSignals.h", + "ghc-libdir/include/rts/Bytecodes.h", + "ghc-libdir/include/rts/Config.h", + "ghc-libdir/include/rts/Constants.h", + "ghc-libdir/include/rts/EventLogFormat.h", + "ghc-libdir/include/rts/EventLogWriter.h", + "ghc-libdir/include/rts/FileLock.h", + "ghc-libdir/include/rts/Flags.h", + "ghc-libdir/include/rts/GetTime.h", + "ghc-libdir/include/rts/Globals.h", + "ghc-libdir/include/rts/Hpc.h", + "ghc-libdir/include/rts/IOManager.h", + "ghc-libdir/include/rts/Libdw.h", + "ghc-libdir/include/rts/LibdwPool.h", + "ghc-libdir/include/rts/Linker.h", + "ghc-libdir/include/rts/Main.h", + "ghc-libdir/include/rts/Messages.h", + "ghc-libdir/include/rts/OSThreads.h", + "ghc-libdir/include/rts/Parallel.h", + "ghc-libdir/include/rts/PrimFloat.h", + "ghc-libdir/include/rts/prof/CCS.h", + "ghc-libdir/include/rts/prof/LDV.h", + "ghc-libdir/include/rts/Profiling.h", + "ghc-libdir/include/rts/Signals.h", + "ghc-libdir/include/rts/SpinLock.h", + "ghc-libdir/include/rts/StableName.h", + "ghc-libdir/include/rts/StablePtr.h", + "ghc-libdir/include/rts/StaticPtrTable.h", + "ghc-libdir/include/rts/storage/Block.h", + "ghc-libdir/include/rts/storage/ClosureMacros.h", + "ghc-libdir/include/rts/storage/Closures.h", + "ghc-libdir/include/rts/storage/ClosureTypes.h", + "ghc-libdir/include/rts/storage/FunTypes.h", + "ghc-libdir/include/rts/storage/GC.h", + "ghc-libdir/include/rts/storage/Heap.h", + "ghc-libdir/include/rts/storage/InfoTables.h", + "ghc-libdir/include/rts/storage/MBlock.h", + "ghc-libdir/include/rts/storage/TSO.h", + "ghc-libdir/include/rts/Threads.h", + "ghc-libdir/include/rts/Ticky.h", + "ghc-libdir/include/rts/Time.h", + "ghc-libdir/include/rts/Timer.h", + "ghc-libdir/include/rts/TTY.h", + "ghc-libdir/include/rts/Types.h", + "ghc-libdir/include/rts/Utils.h", + "ghc-libdir/include/RtsAPI.h", + "ghc-libdir/include/Stg.h", + "ghc-libdir/include/stg/DLL.h", + "ghc-libdir/include/stg/HaskellMachRegs.h", + "ghc-libdir/include/stg/MachRegs.h", + "ghc-libdir/include/stg/MiscClosures.h", + "ghc-libdir/include/stg/Prim.h", + "ghc-libdir/include/stg/Regs.h", + "ghc-libdir/include/stg/RtsMachRegs.h", + "ghc-libdir/include/stg/SMP.h", + "ghc-libdir/include/stg/Ticky.h", + "ghc-libdir/include/stg/Types.h", + "ghc-libdir/llvm-passes", + "ghc-libdir/llvm-targets", + "ghc-libdir/platformConstants", + "ghc-libdir/settings", + "ghc-libdir/template-hsc.h", + ], + visibility = ["//bazel/bazel_build:__pkg__"], + ) diff --git a/ghc-toolkit/cabal.project.local b/ghc-toolkit/cabal.project.local new file mode 100644 index 00000000..a558e04b --- /dev/null +++ b/ghc-toolkit/cabal.project.local @@ -0,0 +1 @@ +ignore-project: False diff --git a/ghc-toolkit/configure b/ghc-toolkit/configure new file mode 100644 index 00000000..e69de29b diff --git a/ghc-toolkit/src/Language/Haskell/GHC/Toolkit/BuildInfo.hs b/ghc-toolkit/src/Language/Haskell/GHC/Toolkit/BuildInfo.hs index 0d0a2a03..650d8795 100644 --- a/ghc-toolkit/src/Language/Haskell/GHC/Toolkit/BuildInfo.hs +++ b/ghc-toolkit/src/Language/Haskell/GHC/Toolkit/BuildInfo.hs @@ -7,6 +7,7 @@ where import Paths_ghc_toolkit import System.FilePath +import System.Environment import System.IO.Unsafe bootLibsPath :: FilePath @@ -15,6 +16,18 @@ bootLibsPath = dataDir "boot-libs" sandboxGhcLibDir :: FilePath sandboxGhcLibDir = dataDir "ghc-libdir" +getDataDirFromEnv = do + e <- getEnvironment + let l = [(k, v) | (k, v) <- e, k == "ASTERIUS_DATA_DIR"] + case l of + [] -> do + error "tmp no env" + datadir <- Paths_ghc_toolkit.getDataDir + pure datadir + [(_, datadir)] -> + pure datadir + {-# NOINLINE dataDir #-} dataDir :: FilePath -dataDir = unsafePerformIO getDataDir +-- dataDir = unsafePerformIO getDataDir +dataDir = unsafePerformIO getDataDirFromEnv diff --git a/nix/BUILD b/nix/BUILD new file mode 100644 index 00000000..d6435daf --- /dev/null +++ b/nix/BUILD @@ -0,0 +1 @@ +exports_files(glob(["*.nix",])) diff --git a/nix/bazel-nix-shell.nix b/nix/bazel-nix-shell.nix new file mode 100644 index 00000000..a20ffb6a --- /dev/null +++ b/nix/bazel-nix-shell.nix @@ -0,0 +1,46 @@ +({ sources ? import ./sources.nix { } +, pkgs ? import sources.nixpkgs { + overlays = [ + (import ./binaryenOverlay.nix) + ]; + } +}: +with pkgs; +pkgs.mkShell { + nativeBuildInputs = [ + haskellPackages.alex + bash + nix + cabal-install + autoconf + automake + binaryen + binutils + gcc + haskell.compiler.ghc884 + git + gmp.dev + haskellPackages.happy + ncurses.dev + nodejs-15_x + (python39.withPackages (ps: with ps; [ + recommonmark + sphinx + ])) + stack + zlib.dev + ]; + + shellHook = '' + #export SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" + #export NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" + + # One of the two must be enabled for git clone to work (in the utils/make-packages.py) + export GIT_SSL_CAINFO="/etc/ssl/certs/ca-certificates.crt" + #export GIT_SSL_NO_VERIFY=true + + + #export NIX_PATH="nixpkgs=/home/stan/test/bazel/workspace_rules/bazel-workspace_rules/external/rules_haskell/nixpkgs" + #export NIX_PATH="nixpkgs=/home/stan/src/asterius/nix" +''; +}){} diff --git a/nix/bazel_deps.nix b/nix/bazel_deps.nix new file mode 100644 index 00000000..c74d5cdd --- /dev/null +++ b/nix/bazel_deps.nix @@ -0,0 +1,47 @@ +({ sources ? import ./sources.nix {} +, config +, overlays +, pkgs ? import sources.nixpkgs { + overlays = [ + (import ./binaryenOverlay.nix) + ]; + } + }: + +with pkgs; +let wasi-sdk = stdenv.mkDerivation rec { + # wasi-sdk is a runtime dependency of asterius + + name = "wasi-sdk${version}"; + version = "12.1"; + src = fetchurl { + urls = ["https://github.com/tweag/wasi-sdk/releases/download/210113/wasi-sdk-12.1g41fa3294474c-linux.tar.gz"]; + sha256 = "0ncyv3c6v9klcws87q206mx0s66yph7yjqrzlkayamkdidcxkg80"; + + }; + + nativeBuildInputs = [ + unzip + autoPatchelfHook + + ]; + + buildInputs = [ + stdenv.cc.cc.lib + ]; + + unpackPhase = '' + tar xf $src + ''; + + installPhase = '' + mkdir -p $out && cp -r * $out/ + ''; + + meta = with lib; { + description = "wasi-sdk"; + platforms = platforms.linux; + }; +}; in +(pkgs//{wasi-sdk = wasi-sdk;}) +) diff --git a/nix/binaryenOverlay.nix b/nix/binaryenOverlay.nix new file mode 100644 index 00000000..df5c8252 --- /dev/null +++ b/nix/binaryenOverlay.nix @@ -0,0 +1,18 @@ +self: super: +{ + binaryen = super.binaryen.overrideAttrs (_: { + version = "99"; + src = self.fetchFromGitHub { + owner = "WebAssembly"; + repo = "binaryen"; + rev = "version_99"; + sha256 = "1a6ixxm1f8mrr9mn6a0pimajdzsdr4w1qhr92skxq67168vvc1ic"; + }; + patches = [ + (self.fetchpatch { + url = "https://patch-diff.githubusercontent.com/raw/WebAssembly/binaryen/pull/3482.patch"; + sha256 = "0s79qw6dm13ralk12wa00cw7az9gd3jvwp904jm1zrdjg6cjp3wa"; + }) + ]; + }); +} diff --git a/nix/default.nix b/nix/default.nix new file mode 120000 index 00000000..639bbd56 --- /dev/null +++ b/nix/default.nix @@ -0,0 +1 @@ +bazel_deps.nix \ No newline at end of file diff --git a/nix/sources.json b/nix/sources.json new file mode 100644 index 00000000..35792684 --- /dev/null +++ b/nix/sources.json @@ -0,0 +1,26 @@ +{ + "niv": { + "branch": "master", + "description": "Easy dependency management for Nix projects", + "homepage": "https://github.com/nmattia/niv", + "owner": "nmattia", + "repo": "niv", + "rev": "af958e8057f345ee1aca714c1247ef3ba1c15f5e", + "sha256": "1qjavxabbrsh73yck5dcq8jggvh3r2jkbr6b5nlz5d9yrqm9255n", + "type": "tarball", + "url": "https://github.com/nmattia/niv/archive/af958e8057f345ee1aca714c1247ef3ba1c15f5e.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, + "nixpkgs": { + "branch": "nixpkgs-unstable", + "description": "Nix Packages collection", + "homepage": "", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5268ee2ebacbc73875be42d71e60c2b5c1b5a1c7", + "sha256": "080fvmg0i6z01h6adddfrjp1bbbjhhqk32ks6ch9gv689645ccfq", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5268ee2ebacbc73875be42d71e60c2b5c1b5a1c7.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + } +} diff --git a/nix/sources.nix b/nix/sources.nix new file mode 100644 index 00000000..1938409d --- /dev/null +++ b/nix/sources.nix @@ -0,0 +1,174 @@ +# This file has been generated by Niv. + +let + + # + # The fetchers. fetch_ fetches specs of type . + # + + fetch_file = pkgs: name: spec: + let + name' = sanitizeName name + "-src"; + in + if spec.builtin or true then + builtins_fetchurl { inherit (spec) url sha256; name = name'; } + else + pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; + + fetch_tarball = pkgs: name: spec: + let + name' = sanitizeName name + "-src"; + in + if spec.builtin or true then + builtins_fetchTarball { name = name'; inherit (spec) url sha256; } + else + pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; + + fetch_git = name: spec: + let + ref = + if spec ? ref then spec.ref else + if spec ? branch then "refs/heads/${spec.branch}" else + if spec ? tag then "refs/tags/${spec.tag}" else + abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"; + in + builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; }; + + fetch_local = spec: spec.path; + + fetch_builtin-tarball = name: throw + ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`. + $ niv modify ${name} -a type=tarball -a builtin=true''; + + fetch_builtin-url = name: throw + ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`. + $ niv modify ${name} -a type=file -a builtin=true''; + + # + # Various helpers + # + + # https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695 + sanitizeName = name: + ( + concatMapStrings (s: if builtins.isList s then "-" else s) + ( + builtins.split "[^[:alnum:]+._?=-]+" + ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name) + ) + ); + + # The set of packages used when specs are fetched using non-builtins. + mkPkgs = sources: system: + let + sourcesNixpkgs = + import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; }; + hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; + hasThisAsNixpkgsPath = == ./.; + in + if builtins.hasAttr "nixpkgs" sources + then sourcesNixpkgs + else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then + import {} + else + abort + '' + Please specify either (through -I or NIX_PATH=nixpkgs=...) or + add a package called "nixpkgs" to your sources.json. + ''; + + # The actual fetching function. + fetch = pkgs: name: spec: + + if ! builtins.hasAttr "type" spec then + abort "ERROR: niv spec ${name} does not have a 'type' attribute" + else if spec.type == "file" then fetch_file pkgs name spec + else if spec.type == "tarball" then fetch_tarball pkgs name spec + else if spec.type == "git" then fetch_git name spec + else if spec.type == "local" then fetch_local spec + else if spec.type == "builtin-tarball" then fetch_builtin-tarball name + else if spec.type == "builtin-url" then fetch_builtin-url name + else + abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; + + # If the environment variable NIV_OVERRIDE_${name} is set, then use + # the path directly as opposed to the fetched source. + replace = name: drv: + let + saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; + ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; + in + if ersatz == "" then drv else + # this turns the string into an actual Nix path (for both absolute and + # relative paths) + if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; + + # Ports of functions for older nix versions + + # a Nix version of mapAttrs if the built-in doesn't exist + mapAttrs = builtins.mapAttrs or ( + f: set: with builtins; + listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)) + ); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 + range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 + stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 + stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); + concatMapStrings = f: list: concatStrings (map f list); + concatStrings = builtins.concatStringsSep ""; + + # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331 + optionalAttrs = cond: as: if cond then as else {}; + + # fetchTarball version that is compatible between all the versions of Nix + builtins_fetchTarball = { url, name ? null, sha256 }@attrs: + let + inherit (builtins) lessThan nixVersion fetchTarball; + in + if lessThan nixVersion "1.12" then + fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) + else + fetchTarball attrs; + + # fetchurl version that is compatible between all the versions of Nix + builtins_fetchurl = { url, name ? null, sha256 }@attrs: + let + inherit (builtins) lessThan nixVersion fetchurl; + in + if lessThan nixVersion "1.12" then + fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) + else + fetchurl attrs; + + # Create the final "sources" from the config + mkSources = config: + mapAttrs ( + name: spec: + if builtins.hasAttr "outPath" spec + then abort + "The values in sources.json should not have an 'outPath' attribute" + else + spec // { outPath = replace name (fetch config.pkgs name spec); } + ) config.sources; + + # The "config" used by the fetchers + mkConfig = + { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null + , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile) + , system ? builtins.currentSystem + , pkgs ? mkPkgs sources system + }: rec { + # The sources, i.e. the attribute set of spec name to spec + inherit sources; + + # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers + inherit pkgs; + }; + +in +mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..25df1430 --- /dev/null +++ b/shell.nix @@ -0,0 +1,35 @@ +{ sources ? import ./nix/sources.nix { } +, pkgs ? import sources.nixpkgs { + overlays = [ + (import ./nix/binaryenOverlay.nix) + ]; + } +}: +(pkgs.buildFHSUserEnv { + name = "hs-fhs"; + targetPkgs = ps: (with ps; [ + haskellPackages.alex + autoconf + automake + binaryen + binutils + gcc + haskell.compiler.ghc884 + git + gmp.dev + haskellPackages.happy + ncurses.dev + nodejs-15_x + (python39.withPackages (ps: with ps; [ + recommonmark + sphinx + ])) + stack + zlib.dev + ]); + profile = '' + export LANG=en_US.utf8 + unset NIX_SSL_CERT_FILE + unset SSL_CERT_FILE + ''; +}).env diff --git a/utils/make-packages.py b/utils/make-packages.py index 11b2bc02..f3a4a61d 100755 --- a/utils/make-packages.py +++ b/utils/make-packages.py @@ -102,6 +102,7 @@ def patch_hadrian(): with open(os.path.join(ghc_repo_path, "hadrian", "stack.yaml"), mode="w") as f: f.write("resolver: lts-16.29\n") + f.write("dump-logs: all\n") with open(os.path.join(ghc_repo_path, "hadrian", "src", "Oracles", "Setting.hs"), mode="r") as h: @@ -121,11 +122,11 @@ def patch_hadrian(): def make_hadrian(): patch_hadrian() - subprocess.run([hadrian_path, "--version"], cwd=ghc_repo_path, check=True) + subprocess.run([hadrian_path, "--version", "--verbose"], cwd=ghc_repo_path, check=True) def make_autogen(): - subprocess.run([hadrian_path, "-j"] + ghc_autogen_files + + subprocess.run([hadrian_path, "--verbose", "-j"] + ghc_autogen_files + ghc_pkg_autogen_files, cwd=ghc_repo_path, check=True) diff --git a/wasm-toolkit/BUILD.bazel b/wasm-toolkit/BUILD.bazel new file mode 100644 index 00000000..a17344c0 --- /dev/null +++ b/wasm-toolkit/BUILD.bazel @@ -0,0 +1,37 @@ +load( + "@rules_haskell//haskell:defs.bzl", + "haskell_toolchain_library", + "haskell_library", + "haskell_binary", + "haskell_repl", +) + +load( + "@rules_haskell//haskell:cabal.bzl", + "haskell_cabal_library", + ) + +haskell_toolchain_library(name = "binary") +haskell_toolchain_library(name = "bytestring") +haskell_toolchain_library(name = "directory") +haskell_toolchain_library(name = "filepath") +haskell_toolchain_library(name = "process") +haskell_toolchain_library(name = "base") + +haskell_cabal_library( + name = "wasm-toolkit", + srcs = glob(["wasm-toolkit.cabal", "src/**", "LICENSE"]), + version = "0.0.1", + cabalopts = ["--ghc-option=-Wall"], + haddock = False, + verbose = True, + deps = [":base", ":binary", ":bytestring", ":directory", ":filepath", ":process"], + visibility = ["//asterius:__pkg__"], +) + + +# haskell_binary( +# name = "bin", +# deps = [":base", ":lib-0.1.0.0"], +# srcs = ["Main.hs"], +# )