Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / compilers / tinygo / 0001-Makefile.patch
blob342cce788ba37c639dae4c6db83ae7bddec94a94
1 From ef066db7f5cb7f551f88fb218c82fc947e464425 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Mustafa=20=C3=87al=C4=B1=C5=9Fkan?= <muscaln@protonmail.com>
3 Date: Sun, 3 Jul 2022 14:30:51 +0300
4 Subject: [PATCH 1/3] Makefile
7 diff --git a/Makefile b/Makefile
8 index 60a5a574..904d2db5 100644
9 --- a/Makefile
10 +++ b/Makefile
11 @@ -14,11 +14,6 @@ LLVM_VERSIONS = 14 13 12 11
12 errifempty = $(if $(1),$(1),$(error $(2)))
13 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)))
14 toolSearchPathsVersion = $(1)-$(2)
15 -ifeq ($(shell uname -s),Darwin)
16 - # Also explicitly search Brew's copy, which is not in PATH by default.
17 - BREW_PREFIX := $(shell brew --prefix)
18 - toolSearchPathsVersion += $(BREW_PREFIX)/opt/llvm@$(2)/bin/$(1)-$(2) $(BREW_PREFIX)/opt/llvm@$(2)/bin/$(1)
19 -endif
20 # 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.
21 findLLVMTool = $(call detect,$(1),$(abspath llvm-build/bin/$(1)) $(foreach ver,$(LLVM_VERSIONS),$(call toolSearchPathsVersion,$(1),$(ver))) $(1))
22 CLANG ?= $(call findLLVMTool,clang)
23 @@ -707,9 +702,8 @@ endif
24 wasmtest:
25 $(GO) test ./tests/wasm
27 -build/release: tinygo gen-device wasi-libc $(if $(filter 1,$(USE_SYSTEM_BINARYEN)),,binaryen)
28 +build/release:
29 @mkdir -p build/release/tinygo/bin
30 - @mkdir -p build/release/tinygo/lib/clang/include
31 @mkdir -p build/release/tinygo/lib/CMSIS/CMSIS
32 @mkdir -p build/release/tinygo/lib/macos-minimal-sdk
33 @mkdir -p build/release/tinygo/lib/mingw-w64/mingw-w64-crt/lib-common
34 @@ -721,15 +715,8 @@ build/release: tinygo gen-device wasi-libc $(if $(filter 1,$(USE_SYSTEM_BINARYEN
35 @mkdir -p build/release/tinygo/lib/picolibc/newlib/libc
36 @mkdir -p build/release/tinygo/lib/picolibc/newlib/libm
37 @mkdir -p build/release/tinygo/lib/wasi-libc
38 - @mkdir -p build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0
39 - @mkdir -p build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0plus
40 - @mkdir -p build/release/tinygo/pkg/thumbv7em-unknown-unknown-eabi-cortex-m4
41 @echo copying source files
42 @cp -p build/tinygo$(EXE) build/release/tinygo/bin
43 -ifneq ($(USE_SYSTEM_BINARYEN),1)
44 - @cp -p build/wasm-opt$(EXE) build/release/tinygo/bin
45 -endif
46 - @cp -p $(abspath $(CLANG_SRC))/lib/Headers/*.h build/release/tinygo/lib/clang/include
47 @cp -rp lib/CMSIS/CMSIS/Include build/release/tinygo/lib/CMSIS/CMSIS
48 @cp -rp lib/CMSIS/README.md build/release/tinygo/lib/CMSIS
49 @cp -rp lib/macos-minimal-sdk/* build/release/tinygo/lib/macos-minimal-sdk
50 @@ -768,16 +755,9 @@ endif
51 @cp -rp lib/picolibc/newlib/libm/common build/release/tinygo/lib/picolibc/newlib/libm
52 @cp -rp lib/picolibc-stdio.c build/release/tinygo/lib
53 @cp -rp lib/wasi-libc/sysroot build/release/tinygo/lib/wasi-libc/sysroot
54 - @cp -rp llvm-project/compiler-rt/lib/builtins build/release/tinygo/lib/compiler-rt-builtins
55 - @cp -rp llvm-project/compiler-rt/LICENSE.TXT build/release/tinygo/lib/compiler-rt-builtins
56 + @cp -rp lib/compiler-rt-builtins build/release/tinygo/lib/compiler-rt-builtins
57 @cp -rp src build/release/tinygo/src
58 @cp -rp targets build/release/tinygo/targets
59 - ./build/release/tinygo/bin/tinygo build-library -target=cortex-m0 -o build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0/compiler-rt compiler-rt
60 - ./build/release/tinygo/bin/tinygo build-library -target=cortex-m0plus -o build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0plus/compiler-rt compiler-rt
61 - ./build/release/tinygo/bin/tinygo build-library -target=cortex-m4 -o build/release/tinygo/pkg/thumbv7em-unknown-unknown-eabi-cortex-m4/compiler-rt compiler-rt
62 - ./build/release/tinygo/bin/tinygo build-library -target=cortex-m0 -o build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0/picolibc picolibc
63 - ./build/release/tinygo/bin/tinygo build-library -target=cortex-m0plus -o build/release/tinygo/pkg/thumbv6m-unknown-unknown-eabi-cortex-m0plus/picolibc picolibc
64 - ./build/release/tinygo/bin/tinygo build-library -target=cortex-m4 -o build/release/tinygo/pkg/thumbv7em-unknown-unknown-eabi-cortex-m4/picolibc picolibc
66 release:
67 tar -czf build/release.tar.gz -C build/release tinygo
68 --
69 2.37.2