summaryrefslogtreecommitdiff
path: root/pkgs/force-riscv/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/force-riscv/default.nix')
-rw-r--r--pkgs/force-riscv/default.nix67
1 files changed, 67 insertions, 0 deletions
diff --git a/pkgs/force-riscv/default.nix b/pkgs/force-riscv/default.nix
new file mode 100644
index 0000000..35907ce
--- /dev/null
+++ b/pkgs/force-riscv/default.nix
@@ -0,0 +1,67 @@
+{ fetchFromGitHub, lib, makeWrapper, python3, stdenv }:
+with lib; stdenv.mkDerivation {
+ pname = "force-riscv";
+ version = "master-2023-01-31";
+
+ src = fetchFromGitHub {
+ repo = "force-riscv";
+ owner = "openhwgroup";
+
+ rev = "192bcc15e0dde8aaf25621da4317569b3f374047";
+ sha256 = "sha256-Eol973IMGRVAuw/rsYiK61+KVYkmbqq9yudaNbMCzJ0=";
+ };
+
+ buildInputs = [ python3 ];
+ nativeBuildInputs = [ makeWrapper ];
+
+ patches = [
+ ./remove-pyeval-initthreads.patch
+ ./wno-error-range-loop-construct.patch
+ ./imageio-include-string.patch
+ ./testio-include-string.patch
+ ./urbg-static-constexpr-min-max.patch
+ ];
+
+ postPatch = ''
+ patchShebangs utils/ fpix/utils/
+ '';
+
+ makeFlags = [
+ "FORCE_CC=${stdenv.cc.targetPrefix}c++"
+ "FORCE_PYTHON_LIB=${python3}/lib"
+ "FORCE_PYTHON_INC=${python3}/include/${python3.libPrefix}"
+ ];
+
+ # Ver setenv.bash
+ installPhase =
+ let
+ paths = [
+ "3rd_party/py"
+ "utils"
+ "utils/builder"
+ "utils/builder/test_builder"
+ "utils/builder/shared"
+ "utils/regression"
+ ];
+
+ pythonPath = concatStringsSep ":" (map (p: "$out/${p}") paths);
+ in
+ ''
+ mkdir -p $out/ $out/fpix/ $out/riscv/ $out/3rd_party/
+
+ # SimApiHANDCAR.so queda en bin (?), al parecer es así
+ cp -r bin/ py/ $out/
+ cp -r fpix/bin/ $out/fpix/
+
+ for BIN in $out/bin/friscv $out/fpix/bin/fpix_riscv; do
+ wrapProgram $BIN \
+ --prefix PYTHONPATH : ${pythonPath}
+ done
+
+ rm -r utils/handcar/make_area
+
+ cp -r 3rd_party/py/ $out/3rd_party/
+ cp -r config/ utils/ $out/
+ cp -r riscv/arch_data/ $out/riscv/
+ '';
+}