tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
tinygo: 0.37.0 -> 0.39.0
Mustafa Çalışkan
6 months ago
d7d09402
847ca079
+18
-25
2 changed files
expand all
collapse all
unified
split
pkgs
by-name
ti
tinygo
0001-GNUmakefile.patch
package.nix
+10
-12
pkgs/by-name/ti/tinygo/0001-GNUmakefile.patch
···
1
1
diff --git a/GNUmakefile b/GNUmakefile
2
2
+
index f078bde5..901c8e08 100644
2
3
--- a/GNUmakefile
3
4
+++ b/GNUmakefile
4
4
-
@@ -14,11 +14,6 @@ LLVM_VERSIONS = 19 18 17 16 15
5
5
+
@@ -21,11 +21,6 @@ LLVM_VERSIONS = 19 18 17 16 15
5
6
errifempty = $(if $(1),$(1),$(error $(2)))
6
7
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)))
7
8
toolSearchPathsVersion = $(1)-$(2)
8
8
-
-ifeq ($(shell uname -s),Darwin)
9
9
+
-ifeq ($(uname),Darwin)
9
10
- # Also explicitly search Brew's copy, which is not in PATH by default.
10
11
- BREW_PREFIX := $(shell brew --prefix)
11
12
- toolSearchPathsVersion += $(BREW_PREFIX)/opt/llvm@$(2)/bin/$(1)-$(2) $(BREW_PREFIX)/opt/llvm@$(2)/bin/$(1)
···
13
14
# 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.
14
15
findLLVMTool = $(call detect,$(1),$(abspath llvm-build/bin/$(1)) $(foreach ver,$(LLVM_VERSIONS),$(call toolSearchPathsVersion,$(1),$(ver))) $(1))
15
16
CLANG ?= $(call findLLVMTool,clang)
16
16
-
@@ -939,10 +934,9 @@ endif
17
17
+
@@ -942,10 +937,9 @@ endif
17
18
wasmtest:
18
19
$(GO) test ./tests/wasm
19
20
20
20
-
-build/release: tinygo gen-device wasi-libc $(if $(filter 1,$(USE_SYSTEM_BINARYEN)),,binaryen)
21
21
+
-build/release: tinygo gen-device $(if $(filter 1,$(USE_SYSTEM_BINARYEN)),,binaryen)
21
22
+build/release:
22
23
@mkdir -p build/release/tinygo/bin
23
24
@mkdir -p build/release/tinygo/lib/bdwgc
24
25
- @mkdir -p build/release/tinygo/lib/clang/include
25
26
@mkdir -p build/release/tinygo/lib/CMSIS/CMSIS
26
27
@mkdir -p build/release/tinygo/lib/macos-minimal-sdk
27
27
-
@mkdir -p build/release/tinygo/lib/mingw-w64/mingw-w64-crt/lib-common
28
28
-
@@ -964,7 +958,6 @@ ifneq ($(USE_SYSTEM_BINARYEN),1)
28
28
+
@mkdir -p build/release/tinygo/lib/mingw-w64/mingw-w64-crt/crt
29
29
+
@@ -968,7 +962,6 @@ ifneq ($(USE_SYSTEM_BINARYEN),1)
29
30
@cp -p build/wasm-opt$(EXE) build/release/tinygo/bin
30
31
endif
31
32
@cp -rp lib/bdwgc/* build/release/tinygo/lib/bdwgc
···
33
34
@cp -rp lib/CMSIS/CMSIS/Include build/release/tinygo/lib/CMSIS/CMSIS
34
35
@cp -rp lib/CMSIS/README.md build/release/tinygo/lib/CMSIS
35
36
@cp -rp lib/macos-minimal-sdk/* build/release/tinygo/lib/macos-minimal-sdk
36
36
-
@@ -1026,8 +1019,7 @@ endif
37
37
-
@cp -rp lib/wasi-libc/libc-top-half/musl/include build/release/tinygo/lib/wasi-libc/libc-top-half/musl
38
38
-
@cp -rp lib/wasi-libc/sysroot build/release/tinygo/lib/wasi-libc/sysroot
37
37
+
@@ -1060,8 +1053,7 @@ endif
38
38
+
@cp -rp lib/wasi-libc/libc-top-half/musl/src/unistd build/release/tinygo/lib/wasi-libc/libc-top-half/musl/src
39
39
+
@cp -rp lib/wasi-libc/libc-top-half/sources build/release/tinygo/lib/wasi-libc/libc-top-half
39
40
@cp -rp lib/wasi-cli/wit build/release/tinygo/lib/wasi-cli/wit
40
41
- @cp -rp llvm-project/compiler-rt/lib/builtins build/release/tinygo/lib/compiler-rt-builtins
41
42
- @cp -rp llvm-project/compiler-rt/LICENSE.TXT build/release/tinygo/lib/compiler-rt-builtins
···
43
44
@cp -rp src build/release/tinygo/src
44
45
@cp -rp targets build/release/tinygo/targets
45
46
46
46
-
--
47
47
-
2.48.1
48
48
-
+8
-13
pkgs/by-name/ti/tinygo/package.nix
···
4
4
buildGoModule,
5
5
fetchFromGitHub,
6
6
makeWrapper,
7
7
-
llvmPackages,
7
7
+
llvmPackages_20,
8
8
go,
9
9
xar,
10
10
binaryen,
···
16
16
}:
17
17
18
18
let
19
19
+
# nixpkgs typically updates default llvm version faster than tinygo releases
20
20
+
# which ends up breaking this build. Use fixed version for each release.
19
21
llvmMajor = lib.versions.major llvm.version;
20
20
-
inherit (llvmPackages)
22
22
+
inherit (llvmPackages_20)
21
23
llvm
22
24
clang
23
25
compiler-rt
···
34
36
35
37
buildGoModule rec {
36
38
pname = "tinygo";
37
37
-
version = "0.37.0";
39
39
+
version = "0.39.0";
38
40
39
41
src = fetchFromGitHub {
40
42
owner = "tinygo-org";
41
43
repo = "tinygo";
42
44
tag = "v${version}";
43
43
-
hash = "sha256-I/9JXjt6aF/80Mh3iRgUYXv4l+m3XIpmKsIBviOuWCo=";
45
45
+
hash = "sha256-uooBZl4u9EHfs1DTI/dQ9Uz1uVOmRcIClEMB7D1q8Lk=";
44
46
fetchSubmodules = true;
45
47
# The public hydra server on `hydra.nixos.org` is configured with
46
48
# `max_output_size` of 3GB. The purpose of this `postFetch` step
···
51
53
'';
52
54
};
53
55
54
54
-
vendorHash = "sha256-juADakh+s8oEY9UXUwxknvVeL1TgB/zRi8Xtzt/4qPA=";
56
56
+
vendorHash = "sha256-Vae7IFACioxH4E61GX/X7G19/ITbajp96VNUhliV8ls=";
55
57
56
58
patches = [
57
59
./0001-GNUmakefile.patch
···
76
78
"-X github.com/tinygo-org/tinygo/goenv.TINYGOROOT=${placeholder "out"}/share/tinygo"
77
79
"-X github.com/tinygo-org/tinygo/goenv.clangResourceDir=${clang.cc.lib}/lib/clang/${llvmMajor}"
78
80
];
81
81
+
tags = [ "llvm${llvmMajor}" ];
79
82
subPackages = [ "." ];
80
83
81
84
# Output contains static libraries for different arm cpus
···
104
107
# Move binary
105
108
mkdir -p build
106
109
mv $GOPATH/bin/tinygo build/tinygo
107
107
-
108
108
-
# Build our own custom wasi-libc.
109
109
-
# This is necessary because we modify the build a bit for our needs (disable
110
110
-
# heap, enable debug symbols, etc).
111
111
-
make wasi-libc \
112
112
-
CLANG="${lib.getBin clang.cc}/bin/clang -resource-dir ${clang.cc.lib}/lib/clang/${llvmMajor}" \
113
113
-
LLVM_AR=${lib.getBin llvm}/bin/llvm-ar \
114
114
-
LLVM_NM=${lib.getBin llvm}/bin/llvm-nm
115
110
116
111
make gen-device -j $NIX_BUILD_CORES
117
112