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.
This commit is contained in:
Ayke van Laethem 2023-10-20 18:25:49 +02:00
parent c8f5054348
commit edcd078d38
No known key found for this signature in database
GPG Key ID: E97FF5335DFDFDED
2 changed files with 8 additions and 10 deletions

View File

@ -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";

View File

@ -17209,7 +17209,6 @@ with pkgs;
tinygo = callPackage ../development/compilers/tinygo {
llvmPackages = llvmPackages_17;
wasi-libc = pkgsCross.wasi32.wasilibc;
};
tinyscheme = callPackage ../development/interpreters/tinyscheme { };