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:
parent
c8f5054348
commit
edcd078d38
@ -7,7 +7,6 @@
|
|||||||
, llvmPackages
|
, llvmPackages
|
||||||
, go
|
, go
|
||||||
, xar
|
, xar
|
||||||
, wasi-libc
|
|
||||||
, binaryen
|
, binaryen
|
||||||
, avrdude
|
, avrdude
|
||||||
, gdb
|
, gdb
|
||||||
@ -66,12 +65,6 @@ buildGoModule rec {
|
|||||||
stripDebugList = [ "bin" ];
|
stripDebugList = [ "bin" ];
|
||||||
|
|
||||||
postPatch = ''
|
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
|
# Borrow compiler-rt builtins from our source
|
||||||
# See https://github.com/tinygo-org/tinygo/pull/2471
|
# See https://github.com/tinygo-org/tinygo/pull/2471
|
||||||
mkdir -p lib/compiler-rt-builtins
|
mkdir -p lib/compiler-rt-builtins
|
||||||
@ -92,6 +85,14 @@ buildGoModule rec {
|
|||||||
mkdir -p build
|
mkdir -p build
|
||||||
mv $GOPATH/bin/tinygo build/tinygo
|
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
|
make gen-device -j $NIX_BUILD_CORES
|
||||||
|
|
||||||
export TINYGOROOT=$(pwd)
|
export TINYGOROOT=$(pwd)
|
||||||
@ -116,8 +117,6 @@ buildGoModule rec {
|
|||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
disallowedReferences = [ wasi-libc ];
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://tinygo.org/";
|
homepage = "https://tinygo.org/";
|
||||||
description = "Go compiler for small places";
|
description = "Go compiler for small places";
|
||||||
|
@ -17209,7 +17209,6 @@ with pkgs;
|
|||||||
|
|
||||||
tinygo = callPackage ../development/compilers/tinygo {
|
tinygo = callPackage ../development/compilers/tinygo {
|
||||||
llvmPackages = llvmPackages_17;
|
llvmPackages = llvmPackages_17;
|
||||||
wasi-libc = pkgsCross.wasi32.wasilibc;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
tinyscheme = callPackage ../development/interpreters/tinyscheme { };
|
tinyscheme = callPackage ../development/interpreters/tinyscheme { };
|
||||||
|
Loading…
Reference in New Issue
Block a user