mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
Merge pull request #104 from Browsercore/zig-version
Use fixed zig version
This commit is contained in:
31
Makefile
31
Makefile
@@ -23,7 +23,36 @@ help:
|
|||||||
|
|
||||||
# $(ZIG) commands
|
# $(ZIG) commands
|
||||||
# ------------
|
# ------------
|
||||||
.PHONY: build build-release run run-release shell test bench
|
.PHONY: build build-release run run-release shell test bench download-zig
|
||||||
|
|
||||||
|
zig_version = $(shell grep 'recommended_zig_version = "' "vendor/jsruntime-lib/build.zig" | cut -d'"' -f2)
|
||||||
|
kernel = $(shell uname -ms)
|
||||||
|
|
||||||
|
## Download the zig recommended version
|
||||||
|
download-zig:
|
||||||
|
ifeq ($(kernel), Darwin x86_64)
|
||||||
|
$(eval target="macos")
|
||||||
|
$(eval arch="x86_64")
|
||||||
|
else ifeq ($(kernel), Darwin arm64)
|
||||||
|
$(eval target="macos")
|
||||||
|
$(eval arch="aarch64")
|
||||||
|
else ifeq ($(kernel), Linux aarch64)
|
||||||
|
$(eval target="linux")
|
||||||
|
$(eval arch="aarch64")
|
||||||
|
else ifeq ($(kernel), Linux arm64)
|
||||||
|
$(eval target="linux")
|
||||||
|
$(eval arch="aarch64")
|
||||||
|
else ifeq ($(kernel), Linux x86_64)
|
||||||
|
$(eval target="linux")
|
||||||
|
$(eval arch="x86_64")
|
||||||
|
else
|
||||||
|
$(error "Unhandled kernel: $(kernel)")
|
||||||
|
endif
|
||||||
|
$(eval url = "https://ziglang.org/builds/zig-$(target)-$(arch)-$(zig_version).tar.xz")
|
||||||
|
$(eval dest = "/tmp/zig-$(target)-$(arch)-$(zig_version).tar.xz")
|
||||||
|
@printf "\e[36mDownload zig version $(zig_version)...\e[0m\n"
|
||||||
|
@curl -o "$(dest)" -L "$(url)" || (printf "\e[33mBuild ERROR\e[0m\n"; exit 1;)
|
||||||
|
@printf "\e[33mDownloaded $(dest)\e[0m\n"
|
||||||
|
|
||||||
## Build in debug mode
|
## Build in debug mode
|
||||||
build:
|
build:
|
||||||
|
|||||||
19
build.zig
19
build.zig
@@ -1,10 +1,29 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
const jsruntime_path = "vendor/jsruntime-lib/";
|
const jsruntime_path = "vendor/jsruntime-lib/";
|
||||||
const jsruntime = @import("vendor/jsruntime-lib/build.zig");
|
const jsruntime = @import("vendor/jsruntime-lib/build.zig");
|
||||||
const jsruntime_pkgs = jsruntime.packages(jsruntime_path);
|
const jsruntime_pkgs = jsruntime.packages(jsruntime_path);
|
||||||
|
|
||||||
|
/// Do not rename this constant. It is scanned by some scripts to determine
|
||||||
|
/// which zig version to install.
|
||||||
|
const recommended_zig_version = jsruntime.recommended_zig_version;
|
||||||
|
|
||||||
pub fn build(b: *std.build.Builder) !void {
|
pub fn build(b: *std.build.Builder) !void {
|
||||||
|
switch (comptime builtin.zig_version.order(std.SemanticVersion.parse(recommended_zig_version) catch unreachable)) {
|
||||||
|
.eq => {},
|
||||||
|
.lt => {
|
||||||
|
@compileError("The minimum version of Zig required to compile is '" ++ recommended_zig_version ++ "', found '" ++ builtin.zig_version_string ++ "'.");
|
||||||
|
},
|
||||||
|
.gt => {
|
||||||
|
std.debug.print(
|
||||||
|
"WARNING: Recommended Zig version '{s}', but found '{s}', build may fail...\n\n",
|
||||||
|
.{ recommended_zig_version, builtin.zig_version_string },
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const mode = b.standardOptimizeOption(.{});
|
const mode = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
|
|||||||
2
vendor/jsruntime-lib
vendored
2
vendor/jsruntime-lib
vendored
Submodule vendor/jsruntime-lib updated: d63b0a592f...254739a972
Reference in New Issue
Block a user