diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e559513 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,35 @@ +name: Haskell Debugger CI +on: + push: + branches: + - master + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + if: github.ref != 'refs/heads/master' + steps: + - uses: DeterminateSystems/nix-installer-action@main + - uses: actions/checkout@v3.5.3 + - uses: cachix/install-nix-action@v25 + with: + nix_path: nixpkgs=channel:nixpkgs-unstable + + - name: Nix channel update + run: nix-channel --update + + - name: Cabal install + run: nix-env -iA pkgs.cabal-install -f . + + - name: Cabal update + run: cabal update + + - name: (x86 - C++) Build ext-stg-gc (souffle-produced reachability analysis for GC) + run: nix-build -A ext-stg-gc + + - name: (x86 - GHC 9.6.6) Build dap-estgi-server w/ nix + run: nix-build -A dap-estgi-server + + # - name: (x86 - GHC 9.6.6) Build dap-estgi-server w/ cabal + # run: nix-shell -p pkgs.ghc -p pkgs.bzip2.dev -p pkgs.zlib.dev --run 'cabal build dap-estgi-server' -I=. diff --git a/README.md b/README.md index 994a06f..388cdbd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# Haskell ESTGi Debugger +# Haskell ESTGi Debugger ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/haskell-debugger/haskell-estgi-debugger/main.yml?style=flat-square) + # Table of Contents 1. [Introduction](#introduction) diff --git a/cabal.project b/cabal.project index 7ad1190..cf5b037 100644 --- a/cabal.project +++ b/cabal.project @@ -1,34 +1,42 @@ -packages: dap-estgi-server +packages: + dap-estgi-server source-repository-package - type: git - location: https://github.com/TeofilC/digest - tag: ac9616b94cb8c4a9e07188d19979a6225ebd5a10 + type: git + location: https://github.com/david-christiansen/final-pretty-printer + tag: 048e8fa2d8b2b7a6f9e4e209db4f67361321eec8 source-repository-package - type: git - location: https://github.com/haskell-debugger/dap - tag: 3784cc0e703cbe300d4e4874328b8b8dd998ea5f + type: git + location: https://github.com/luc-tielen/souffle-haskell + tag: 268a11283ca9293b5eacabf7a0b79d9368232478 + +source-repository-package + type: git + location: https://github.com/TeofilC/digest + tag: 27ffb6396ef322c5185bc919cae563ac449ba235 + +source-repository-package + type: git + location: https://github.com/haskell-debugger/dap + tag: 99543ed source-repository-package type: git - location: https://github.com/grin-compiler/ghc-whole-program-compiler-project - tag: 80e408ebdeaf5c1cea72bfbf86823c32d4fdafbe + location: https://github.com/haskell-debugger/ghc-whole-program-compiler-project + tag: d058105b0bee1ab2e7c7aefd36bf9e0be6e840b7 subdir: external-stg external-stg-syntax external-stg-interpreter -source-repository-package - type: git - location: https://github.com/luc-tielen/souffle-haskell - tag: f8c9fc45eed709110af3d3301393f63f4535c71e +package external-stg-interpreter + flags: +external-ext-stg-gc -constraints: - type-errors-pretty == 0.0.1.2, - souffle-haskell == 3.4.0 +package external-stg-compiler + flags: +external-ext-stg-liveness package digest flags: -pkg-config -allow-newer: type-errors-pretty:base \ No newline at end of file +allow-newer: type-errors-pretty:base diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..2ca60cc --- /dev/null +++ b/default.nix @@ -0,0 +1,107 @@ +with (builtins.fromJSON (builtins.readFile ./nixpkgs.json)); + +{ nixpkgs ? builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; + inherit sha256; + } +}: + +let + # all the nix things + pkgs = import nixpkgs {}; + sources = builtins.fromJSON (builtins.readFile ./source.json); + + ghc-wpo-src = + pkgs.fetchFromGitHub sources.ghc-whole-program-compiler-project; + + # this is the reachability analysis binary (cretaed by souffle) that runs + # the mark n' sweep GC pass. This is call by the external-stg-intepreter. + ext-stg-gc = + pkgs.stdenv.mkDerivation { + name = "ext-stg-gc"; + src = "${ghc-wpo-src}/external-stg-interpreter"; + buildInputs = with pkgs; [ souffle openmpi ]; + buildPhase = '' + mkdir -pv $out/bin + g++ -fopenmp $src/datalog/ext-stg-gc.cpp \ + -Wl,-u,__factory_Sf_ext_stg_gc_instance \ + -std=c++17 \ + -o $out/bin/ext-stg-gc + ''; + }; + + overrides = self: super: with pkgs.haskell.lib; { + + type-errors-pretty = dontCheck ( + doJailbreak ( + self.callCabal2nix + "type-errors-pretty" + (pkgs.fetchFromGitHub sources.type-errors-pretty) + {} + ) + ); + + digest = + self.callCabal2nix + "digest" + (pkgs.fetchFromGitHub sources.digest) + {}; + + final-pretty-printer = doJailbreak ( + self.callCabal2nix + "final-pretty-printer" + (pkgs.fetchFromGitHub sources.final-pretty-printer) + {} + ); + + dap = doJailbreak ( + self.callCabal2nix + "dap" + (pkgs.fetchFromGitHub sources.dap) + {} + ); + + dap-estgi-server = + self.callCabal2nix + "dap-estgi-server" + ./dap-estgi-server + {}; + + external-stg = + self.callCabal2nix + "external-stg" + "${ghc-wpo-src}/external-stg" + {}; + + external-stg-syntax = + self.callCabal2nix + "external-stg-syntax" + "${ghc-wpo-src}/external-stg-syntax" + {}; + + external-stg-interpreter = + self.callCabal2nixWithOptions + "external-stg-interpreter" + "${ghc-wpo-src}/external-stg-interpreter" + "-fexternal-ext-stg-gc" + {}; + + souffle-haskell = + dontCheck + (doJailbreak + (self.callCabal2nix "souffle-haskell" + (pkgs.fetchFromGitHub sources.souffle-haskell) {} + )); + }; + + hPkgs = + pkgs.haskellPackages.override { inherit overrides; }; + +in + +# this is the set we export for CI, and for shell.nix +{ + inherit (hPkgs) dap-estgi-server; + inherit ext-stg-gc; + inherit pkgs; +} diff --git a/nixpkgs.json b/nixpkgs.json new file mode 100644 index 0000000..c2b4662 --- /dev/null +++ b/nixpkgs.json @@ -0,0 +1,4 @@ +{ + "rev" : "88e992074d86", + "sha256" : "sha256:1k5iv13faiyar5bsfw5klaz898662kcfyn85w5jrl2qkavf6y0y7" +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..9294ae8 --- /dev/null +++ b/shell.nix @@ -0,0 +1 @@ +(import ./default.nix {}).dap-estgi-server.env diff --git a/source.json b/source.json new file mode 100644 index 0000000..bfeb550 --- /dev/null +++ b/source.json @@ -0,0 +1,47 @@ +{ + "dap": { + "fetchSubmodules": true, + "leaveDotGit": false, + "owner": "haskell-debugger", + "repo": "dap", + "rev": "56d44d27c0cc509fc3e8198de448dbb2e9a6380f", + "sha256": "sha256-/FKfSyYJuzXqyBu/yFTlVBQYJ4SXgLGDzQ5xAdXajCE=" + }, + "digest": { + "fetchSubmodules": true, + "leaveDotGit": false, + "owner": "TeofilC", + "repo": "digest", + "rev": "ac9616b94cb8c4a9e07188d19979a6225ebd5a10", + "sha256": "sha256-2n2SV4GYAwd09QfWynlxgeCrsj49UI3He6X66ynqfSA=" + }, + "final-pretty-printer": { + "fetchSubmodules": true, + "leaveDotGit": false, + "owner": "david-christiansen", + "repo": "final-pretty-printer", + "rev": "048e8fa2d8b2b7a6f9e4e209db4f67361321eec8", + "sha256": "0d5ya1n85qgs59p2wlx501qa1nrlk7y20riydfknfqkr0fswcpnf" + }, + "ghc-whole-program-compiler-project": { + "fetchSubmodules": true, + "leaveDotGit": false, + "owner": "haskell-debugger", + "repo": "ghc-whole-program-compiler-project", + "rev": "65ecaed", + "sha256": "sha256-T9dUWUrGeva8ghwQ5Pu1paBbBgyjoTp3SQreHs94WRQ=" + }, + "souffle-haskell" : { + "owner" : "luc-tielen", + "repo" : "souffle-haskell", + "rev" : "268a11283ca9293b5eacabf7a0b79d9368232478", + "hash" : "sha256-n8qqNmrDNxLlM7FRfa1Da58jGCNWjBp9+B/yV3U98gg=" + }, + "type-errors-pretty": { + "fetchSubmodules": false, + "owner": "kowainik", + "repo": "type-errors-pretty", + "rev": "c85d6d0a7bf2278ddb03abddb5782a5b6095d343", + "sha256": "1yylw5c8ffzybcv7cm6ff0k88an4iz0fhc59md09s9zlns03f3d0" + } +}