nix: improve docs and add support for wasi-libc
I forgot a few things in the flake file, but now everything should be included.
Этот коммит содержится в:
		
							родитель
							
								
									935a293106
								
							
						
					
					
						коммит
						2d4307647e
					
				
					 2 изменённых файлов: 19 добавлений и 2 удалений
				
			
		|  | @ -25,6 +25,11 @@ CLANG ?= $(call findLLVMTool,clang) | ||||||
| LLVM_AR ?= $(call findLLVMTool,llvm-ar) | LLVM_AR ?= $(call findLLVMTool,llvm-ar) | ||||||
| LLVM_NM ?= $(call findLLVMTool,llvm-nm) | LLVM_NM ?= $(call findLLVMTool,llvm-nm) | ||||||
| 
 | 
 | ||||||
|  | # Patch up Clang for Nix. | ||||||
|  | ifneq (, ${CLANG_RESOURCE_DIR}) | ||||||
|  |     CLANG := $(CLANG) -resource-dir ${CLANG_RESOURCE_DIR} | ||||||
|  | endif | ||||||
|  | 
 | ||||||
| # Go binary and GOROOT to select | # Go binary and GOROOT to select | ||||||
| GO ?= go | GO ?= go | ||||||
| export GOROOT = $(shell $(GO) env GOROOT) | export GOROOT = $(shell $(GO) env GOROOT) | ||||||
|  | @ -265,7 +270,7 @@ endif | ||||||
| wasi-libc: lib/wasi-libc/sysroot/lib/wasm32-wasi/libc.a | wasi-libc: lib/wasi-libc/sysroot/lib/wasm32-wasi/libc.a | ||||||
| lib/wasi-libc/sysroot/lib/wasm32-wasi/libc.a: | lib/wasi-libc/sysroot/lib/wasm32-wasi/libc.a: | ||||||
| 	@if [ ! -e lib/wasi-libc/Makefile ]; then echo "Submodules have not been downloaded. Please download them using:\n  git submodule update --init"; exit 1; fi | 	@if [ ! -e lib/wasi-libc/Makefile ]; then echo "Submodules have not been downloaded. Please download them using:\n  git submodule update --init"; exit 1; fi | ||||||
| 	cd lib/wasi-libc && $(MAKE) -j4 EXTRA_CFLAGS="-O2 -g -DNDEBUG -mnontrapping-fptoint -msign-ext" MALLOC_IMPL=none CC=$(CLANG) AR=$(LLVM_AR) NM=$(LLVM_NM) | 	cd lib/wasi-libc && $(MAKE) -j4 EXTRA_CFLAGS="-O2 -g -DNDEBUG -mnontrapping-fptoint -msign-ext" MALLOC_IMPL=none CC="$(CLANG)" AR=$(LLVM_AR) NM=$(LLVM_NM) | ||||||
| 
 | 
 | ||||||
| # Check for Node.js used during WASM tests. | # Check for Node.js used during WASM tests. | ||||||
| NODEJS_VERSION := $(word 1,$(subst ., ,$(shell node -v | cut -c 2-))) | NODEJS_VERSION := $(word 1,$(subst ., ,$(shell node -v | cut -c 2-))) | ||||||
|  |  | ||||||
							
								
								
									
										14
									
								
								flake.nix
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								flake.nix
									
										
									
									
									
								
							|  | @ -16,6 +16,17 @@ | ||||||
| # | # | ||||||
| #   tinygo version | #   tinygo version | ||||||
| # | # | ||||||
|  | # But you'll need a bit more to make TinyGo actually able to compile code: | ||||||
|  | # | ||||||
|  | #   make llvm-source              # fetch compiler-rt | ||||||
|  | #   git submodule update --init   # fetch lots of other libraries and SVD files | ||||||
|  | #   make gen-device -j4           # build src/device/*/*.go files | ||||||
|  | #   make wasi-libc                # build support for wasi/wasm | ||||||
|  | # | ||||||
|  | # With this, you should have an environment that can compile anything - except | ||||||
|  | # for the Xtensa architecture (ESP8266/ESP32) because support for that lives in | ||||||
|  | # a separate LLVM fork. | ||||||
|  | # | ||||||
| # You can also do many other things from this environment. Building and flashing | # You can also do many other things from this environment. Building and flashing | ||||||
| # should work as you're used to: it's not a VM or container so there are no | # should work as you're used to: it's not a VM or container so there are no | ||||||
| # access restrictions and you're running in the same host environment - just | # access restrictions and you're running in the same host environment - just | ||||||
|  | @ -55,7 +66,8 @@ | ||||||
|           shellHook= '' |           shellHook= '' | ||||||
|             # Ugly hack to make the Clang resources directory available. |             # Ugly hack to make the Clang resources directory available. | ||||||
|             # Perhaps there is a cleaner way to do it, but this works. |             # Perhaps there is a cleaner way to do it, but this works. | ||||||
|             export GOFLAGS="\"-ldflags=-X github.com/tinygo-org/tinygo/goenv.clangResourceDir=${llvmPackages_16.clang.cc.lib}/lib/clang/16"\" |             export CLANG_RESOURCE_DIR="${llvmPackages_16.clang.cc.lib}/lib/clang/16" | ||||||
|  |             export GOFLAGS="\"-ldflags=-X github.com/tinygo-org/tinygo/goenv.clangResourceDir=$CLANG_RESOURCE_DIR"\" | ||||||
|           ''; |           ''; | ||||||
|         }; |         }; | ||||||
|       } |       } | ||||||
|  |  | ||||||
		Загрузка…
	
	Создание таблицы
		
		Сослаться в новой задаче
	
	 Ayke van Laethem
						Ayke van Laethem