diff options
author | Ayke van Laethem <aykevanlaethem@gmail.com> | 2023-10-20 18:25:49 +0200 |
---|---|---|
committer | Ayke van Laethem <aykevanlaethem@gmail.com> | 2024-03-04 20:17:45 +0100 |
commit | edcd078d3806741902e0ea62d7cc9686f82dd3cb (patch) | |
tree | 6d5c7677a13eeb8b9219356e449f2560141dd040 /pkgs/development/compilers | |
parent | c8f5054348a4d7670f565633f9c920e4709e383c (diff) | |
download | nixlib-edcd078d3806741902e0ea62d7cc9686f82dd3cb.tar nixlib-edcd078d3806741902e0ea62d7cc9686f82dd3cb.tar.gz nixlib-edcd078d3806741902e0ea62d7cc9686f82dd3cb.tar.bz2 nixlib-edcd078d3806741902e0ea62d7cc9686f82dd3cb.tar.lz nixlib-edcd078d3806741902e0ea62d7cc9686f82dd3cb.tar.xz nixlib-edcd078d3806741902e0ea62d7cc9686f82dd3cb.tar.zst nixlib-edcd078d3806741902e0ea62d7cc9686f82dd3cb.zip |
tinygo: use our own wasi-libc build (not the Nix version)
We need our own build because we modify the build flags in a particular way. Also, we've only tested wasi-libc at the version pinned in the submodule, later versions may or may not work correctly.
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r-- | pkgs/development/compilers/tinygo/default.nix | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/pkgs/development/compilers/tinygo/default.nix b/pkgs/development/compilers/tinygo/default.nix index 9a2739f1b74b..034d444e83c8 100644 --- a/pkgs/development/compilers/tinygo/default.nix +++ b/pkgs/development/compilers/tinygo/default.nix @@ -7,7 +7,6 @@ , llvmPackages , go , xar -, wasi-libc , binaryen , avrdude , gdb @@ -66,12 +65,6 @@ buildGoModule rec { stripDebugList = [ "bin" ]; postPatch = '' - # Copy wasi-libc, symlink seems not working - rm -rf lib/wasi-libc/* - mkdir -p lib/wasi-libc/sysroot/lib/wasm32-wasi lib/wasi-libc/sysroot/include - cp -a ${wasi-libc}/lib/* lib/wasi-libc/sysroot/lib/wasm32-wasi/ - cp -a ${wasi-libc.dev}/include/* lib/wasi-libc/sysroot/include/ - # Borrow compiler-rt builtins from our source # See https://github.com/tinygo-org/tinygo/pull/2471 mkdir -p lib/compiler-rt-builtins @@ -92,6 +85,14 @@ buildGoModule rec { mkdir -p build mv $GOPATH/bin/tinygo build/tinygo + # Build our own custom wasi-libc. + # This is necessary because we modify the build a bit for our needs (disable + # heap, enable debug symbols, etc). + make wasi-libc \ + CLANG="${lib.getBin clang.cc}/bin/clang -resource-dir ${clang.cc.lib}/lib/clang/${llvmMajor}" \ + LLVM_AR=${lib.getBin llvm}/bin/llvm-ar \ + LLVM_NM=${lib.getBin llvm}/bin/llvm-nm + make gen-device -j $NIX_BUILD_CORES export TINYGOROOT=$(pwd) @@ -116,8 +117,6 @@ buildGoModule rec { runHook postInstall ''; - disallowedReferences = [ wasi-libc ]; - meta = with lib; { homepage = "https://tinygo.org/"; description = "Go compiler for small places"; |