push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
diff --git a/GNUmakefile b/GNUmakefile
index f078bde5..901c8e08 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -21,11 +21,6 @@ LLVM_VERSIONS = 19 18 17 16 15
errifempty = $(if $(1),$(1),$(error $(2)))
detect = $(shell which $(call errifempty,$(firstword $(foreach p,$(2),$(shell command -v $(p) 2> /dev/null && echo $(p)))),failed to locate $(1) at any of: $(2)))
toolSearchPathsVersion = $(1)-$(2)
-ifeq ($(uname),Darwin)
- # Also explicitly search Brew's copy, which is not in PATH by default.
- BREW_PREFIX := $(shell brew --prefix)
- toolSearchPathsVersion += $(BREW_PREFIX)/opt/llvm@$(2)/bin/$(1)-$(2) $(BREW_PREFIX)/opt/llvm@$(2)/bin/$(1)
-endif
# First search for a custom built copy, then move on to explicitly version-tagged binaries, then just see if the tool is in path with its normal name.
findLLVMTool = $(call detect,$(1),$(abspath llvm-build/bin/$(1)) $(foreach ver,$(LLVM_VERSIONS),$(call toolSearchPathsVersion,$(1),$(ver))) $(1))
CLANG ?= $(call findLLVMTool,clang)
@@ -942,10 +937,9 @@ endif
wasmtest:
$(GO) test ./tests/wasm
-build/release: tinygo gen-device $(if $(filter 1,$(USE_SYSTEM_BINARYEN)),,binaryen)
+build/release:
@mkdir -p build/release/tinygo/bin
@mkdir -p build/release/tinygo/lib/bdwgc
- @mkdir -p build/release/tinygo/lib/clang/include
@mkdir -p build/release/tinygo/lib/CMSIS/CMSIS
@mkdir -p build/release/tinygo/lib/macos-minimal-sdk
@mkdir -p build/release/tinygo/lib/mingw-w64/mingw-w64-crt/crt
@@ -968,7 +962,6 @@ ifneq ($(USE_SYSTEM_BINARYEN),1)
@cp -p build/wasm-opt$(EXE) build/release/tinygo/bin
endif
@cp -rp lib/bdwgc/* build/release/tinygo/lib/bdwgc
- @cp -p $(abspath $(CLANG_SRC))/lib/Headers/*.h build/release/tinygo/lib/clang/include
@cp -rp lib/CMSIS/CMSIS/Include build/release/tinygo/lib/CMSIS/CMSIS
@cp -rp lib/CMSIS/README.md build/release/tinygo/lib/CMSIS
@cp -rp lib/macos-minimal-sdk/* build/release/tinygo/lib/macos-minimal-sdk
@@ -1060,8 +1053,7 @@ endif
@cp -rp lib/wasi-libc/libc-top-half/musl/src/unistd build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
@cp -rp lib/wasi-libc/libc-top-half/sources build/release/tinygo/lib/wasi-libc/libc-top-half
@cp -rp lib/wasi-cli/wit build/release/tinygo/lib/wasi-cli/wit
- @cp -rp llvm-project/compiler-rt/lib/builtins build/release/tinygo/lib/compiler-rt-builtins
- @cp -rp llvm-project/compiler-rt/LICENSE.TXT build/release/tinygo/lib/compiler-rt-builtins
+ @cp -rp lib/compiler-rt-builtins build/release/tinygo/lib/compiler-rt-builtins
@cp -rp src build/release/tinygo/src
@cp -rp targets build/release/tinygo/targets

View File

@@ -0,0 +1,150 @@
{
stdenv,
lib,
buildGoModule,
fetchFromGitHub,
makeWrapper,
llvmPackages_20,
go,
xar,
binaryen,
avrdude,
gdb,
openocd,
runCommand,
tinygoTests ? [ "smoketest" ],
}:
let
# nixpkgs typically updates default llvm version faster than tinygo releases
# which ends up breaking this build. Use fixed version for each release.
llvmMajor = lib.versions.major llvm.version;
inherit (llvmPackages_20)
llvm
clang
compiler-rt
lld
;
# only doing this because only on darwin placing clang.cc in nativeBuildInputs
# doesn't build
bootstrapTools = runCommand "tinygo-bootstrap-tools" { } ''
mkdir -p $out
ln -s ${lib.getBin clang.cc}/bin/clang $out/clang-${llvmMajor}
'';
in
buildGoModule rec {
pname = "tinygo";
version = "0.39.0";
src = fetchFromGitHub {
owner = "tinygo-org";
repo = "tinygo";
tag = "v${version}";
hash = "sha256-uooBZl4u9EHfs1DTI/dQ9Uz1uVOmRcIClEMB7D1q8Lk=";
fetchSubmodules = true;
# The public hydra server on `hydra.nixos.org` is configured with
# `max_output_size` of 3GB. The purpose of this `postFetch` step
# is to stay below that limit and save 4.1GiB and 428MiB in output
# size respectively. These folders are not referenced in tinygo.
postFetch = ''
rm -r $out/lib/cmsis-svd/data/{SiliconLabs,Freescale}
'';
};
vendorHash = "sha256-Vae7IFACioxH4E61GX/X7G19/ITbajp96VNUhliV8ls=";
patches = [
./0001-GNUmakefile.patch
];
nativeCheckInputs = [ binaryen ];
nativeBuildInputs = [
makeWrapper
lld
];
buildInputs = [
llvm
clang.cc
]
++ lib.optionals stdenv.hostPlatform.isDarwin [ xar ];
doCheck = (stdenv.buildPlatform.canExecute stdenv.hostPlatform);
inherit tinygoTests;
allowGoReference = true;
ldflags = [
"-X github.com/tinygo-org/tinygo/goenv.TINYGOROOT=${placeholder "out"}/share/tinygo"
"-X github.com/tinygo-org/tinygo/goenv.clangResourceDir=${clang.cc.lib}/lib/clang/${llvmMajor}"
];
tags = [ "llvm${llvmMajor}" ];
subPackages = [ "." ];
# Output contains static libraries for different arm cpus
# and stripping could mess up these so only strip the compiler
stripDebugList = [ "bin" ];
postPatch = ''
# Borrow compiler-rt builtins from our source
# See https://github.com/tinygo-org/tinygo/pull/2471
mkdir -p lib/compiler-rt-builtins
cp -a ${compiler-rt.src}/compiler-rt/lib/builtins/* lib/compiler-rt-builtins/
substituteInPlace GNUmakefile \
--replace "build/release/tinygo/bin" "$out/bin" \
--replace "build/release/" "$out/share/"
'';
preBuild = ''
export PATH=${bootstrapTools}:$PATH
export HOME=$TMPDIR
ldflags=("''$ldflags[@]/\"-buildid=\"")
'';
postBuild = ''
# Move binary
mkdir -p build
mv $GOPATH/bin/tinygo build/tinygo
make gen-device -j $NIX_BUILD_CORES
export TINYGOROOT=$(pwd)
'';
checkPhase = lib.optionalString (tinygoTests != [ ] && tinygoTests != null) ''
make ''${tinygoTests[@]} TINYGO="$(pwd)/build/tinygo" MD5SUM=md5sum XTENSA=0
'';
# GDB upstream does not support ARM darwin
runtimeDeps = [
go
clang.cc
lld
avrdude
openocd
binaryen
]
++ lib.optionals (!(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)) [ gdb ];
installPhase = ''
runHook preInstall
make build/release USE_SYSTEM_BINARYEN=1
wrapProgram $out/bin/tinygo \
--prefix PATH : ${lib.makeBinPath runtimeDeps}
runHook postInstall
'';
meta = with lib; {
homepage = "https://tinygo.org/";
description = "Go compiler for small places";
license = licenses.bsd3;
maintainers = with maintainers; [
muscaln
];
};
}