Debian Codegraph @

wasm/src/wasi-sdk-static.nix

raw
1 { stdenv, fetchFromGitHub, fetchgit, fetchurl, lib, cmake, git, perl, ninja, python3 }:
2
3 let wasilibc = fetchFromGitHub {
4 owner = "WebAssembly";
5 repo = "wasi-libc";
6 rev = "ad5133410f66b93a2381db5b542aad5e0964db96";
7 sha256 = "sha256-gw6flqJv4x//V3FdqDx6yXhYVQjJ2S2xx0tZShFjmsQ=";
8 };
9
10 llvm-project = fetchFromGitHub {
11 owner = "llvm";
12 repo = "llvm-project";
13 rev = "309f1e4ac8cca1ba1f0e28eeae8e2926dc387d04";
14 sha256 = "WwDcWRf7Gu7b2a17mHbke31xSHDYA7CHEi28gR+Zd90=";
15 };
16
17 config = fetchgit {
18 url = "https://git.savannah.gnu.org/git/config.git";
19 rev = "2593751ef276497e312d7c4ce7fd049614c7bf80";
20 sha256 = "1sh410ncfs9fwxw03m1r4lcm10iv305g0jb2bb2yvgzlpb28lsz9";
21 };
22
23 in stdenv.mkDerivation {
24 name = "wasi-sdk-0.0.0";
25 src = fetchFromGitHub {
26 owner = "WebAssembly";
27 repo = "wasi-sdk";
28 rev = "77ba98a998cb9f2a63ab3a5f94bbabd069f65ff0";
29 sha256 = "sha256-IG0kxt6geu1Y7qHWSWjp0LrPevU8eC+kCS/yZD/j5YE=";
30 fetchSubmodules = false;
31 };
32
33 dontUseCmakeConfigure = true;
34 dontUseNinjaBuild = true;
35 dontUseNinjaInstall = true;
36 dontStrip = true;
37 PREFIX = "${placeholder "out"}";
38
39 postPatch = ''
40 rm -rf src/*
41 cp -rf ${wasilibc} src/wasi-libc
42 cp -rf ${llvm-project} src/llvm-project
43 cp -rf ${config} src/config
44 chmod -R +rw src/
45 substituteInPlace Makefile \
46 --replace 'DESTDIR=$(abspath build/install)' \
47 'DESTDIR=' \
48 --replace 'install-clang ' 'install-clang install-llc install-opt '
49 '';
50
51 buildInputs = [ cmake git perl ninja python3 ];
52 installPhase = "true";
53 }