-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
67 lines (60 loc) · 1.57 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{ stdenv
, runCommand
, lib
, cmake
, coreutils
, python3
, git
, fetchFromGitHub
, ninja
}:
let
llvm = stdenv.mkDerivation rec {
pname = "llvm-project";
version = "unstable-2023-05-02";
requiredSystemFeatures = [ "big-parallel" ];
nativeBuildInputs = [ cmake ninja python3 ];
src = fetchFromGitHub {
owner = "llvm";
repo = pname;
rev = "8f966cedea594d9a91e585e88a80a42c04049e6c";
hash = "sha256-g2cYk3/iyUvmIG0QCQpYmWj4L2H4znx9KbuA5TvIjrc=";
};
cmakeDir = "../llvm";
cmakeFlags = [
"-DLLVM_ENABLE_BINDINGS=OFF"
"-DLLVM_ENABLE_OCAMLDOC=OFF"
"-DLLVM_BUILD_EXAMPLES=OFF"
"-DLLVM_ENABLE_PROJECTS=mlir;clang"
"-DLLVM_TARGETS_TO_BUILD=host;RISCV"
"-DLLVM_INSTALL_UTILS=ON"
];
checkTarget = "check-mlir check-clang";
postInstall = ''
cp include/llvm/Config/config.h $out/include/llvm/Config
'';
};
mlir_dir = runCommand "mlir_dir" { } ''
mkdir -p $out
ln -s ${llvm.src}/* $out
cp -r ${llvm} $out/build
'';
in
stdenv.mkDerivation rec {
pname = "buddy-mlir";
version = "unstable-2023-05-26";
src = fetchFromGitHub {
owner = "buddy-compiler";
repo = pname;
rev = "74c18e6963cf4781be254d3c5d963b36c0642ba4";
hash = "sha256-Wx/QQrELfOT0h4B8hF9EPZKn4yVHBZeYh3Wm85Jpq60=";
};
ninjaFlags = [ "buddy-translate" ];
requiredSystemFeatures = [ "big-parallel" ];
nativeBuildInputs = [ cmake ninja ];
passthru = { inherit llvm; };
cmakeFlags = [
"-DMLIR_DIR=${mlir_dir}/build/lib/cmake/mlir"
"-DLLVM_DIR=${mlir_dir}/build/lib/cmake/llvm"
];
}