Zig build system updated: can compile static binaries.
This commit is contained in:
		
							parent
							
								
									0585110df4
								
							
						
					
					
						commit
						b567a25969
					
				
					 3 changed files with 12 additions and 1 deletions
				
			
		|  | @ -1,6 +1,7 @@ | ||||||
| ifdef STATIC | ifdef STATIC | ||||||
| STATIC_BUILD ?= -static | STATIC_BUILD ?= -static | ||||||
| CRYSTAL_STATIC_BUILD ?= --static | CRYSTAL_STATIC_BUILD ?= --static | ||||||
|  | ZIG_STATIC_BUILD ?= -Dstatic=true | ||||||
| endif | endif | ||||||
| 
 | 
 | ||||||
| # For interactive completion in the shell. | # For interactive completion in the shell. | ||||||
|  |  | ||||||
|  | @ -58,4 +58,12 @@ pub fn build(b: *std.Build) void { | ||||||
|         .optimize = optimize, |         .optimize = optimize, | ||||||
|     }); |     }); | ||||||
|     link_and_install(pongd_exe); |     link_and_install(pongd_exe); | ||||||
|  | 
 | ||||||
|  |     const is_static = b.option(bool, "static", "Compile static binaries.") orelse false; | ||||||
|  |     if (is_static) { | ||||||
|  |         ipcd_exe.linkage = .static; | ||||||
|  |         tcpd_exe.linkage = .static; | ||||||
|  |         pong_exe.linkage = .static; | ||||||
|  |         pongd_exe.linkage = .static; | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,9 +1,11 @@ | ||||||
| all: build | all: build | ||||||
| 
 | 
 | ||||||
|  | include ../mk/makefile.utils | ||||||
|  | 
 | ||||||
| update-libipc: | update-libipc: | ||||||
| 	git submodule update | 	git submodule update | ||||||
| 
 | 
 | ||||||
| ZIG_OPTS  ?= | ZIG_OPTS  ?= | ||||||
| ZIG_OPTIM ?= ReleaseSafe | ZIG_OPTIM ?= ReleaseSafe | ||||||
| build: | build: | ||||||
| 	zig build -Doptimize=$(ZIG_OPTIM) $(ZIG_OPTS) | 	zig build -Doptimize=$(ZIG_OPTIM) $(ZIG_OPTS) $(ZIG_STATIC_BUILD) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue