Skip to content

Commit 46c6a0b

Browse files
authored
Merge pull request #683 from lightpanda-io/libc_v8_out_path_include_os
include OS in libc_v8 lib path
2 parents ab8da39 + f4a27af commit 46c6a0b

File tree

4 files changed

+33
-17
lines changed

4 files changed

+33
-17
lines changed

.github/actions/install/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ inputs:
1717
zig-v8:
1818
description: 'zig v8 version to install'
1919
required: false
20-
default: 'v0.1.23'
20+
default: 'v0.1.24'
2121
v8:
2222
description: 'v8 version to install'
2323
required: false
@@ -59,11 +59,11 @@ runs:
5959
- name: install v8
6060
shell: bash
6161
run: |
62-
mkdir -p v8/out/debug/obj/zig/
63-
ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/debug/obj/zig/libc_v8.a
62+
mkdir -p v8/out/${{ inputs.os }}/debug/obj/zig/
63+
ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/${{ inputs.os }}/debug/obj/zig/libc_v8.a
6464
65-
mkdir -p v8/out/release/obj/zig/
66-
ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/release/obj/zig/libc_v8.a
65+
mkdir -p v8/out/${{ inputs.os }}/release/obj/zig/
66+
ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/${{ inputs.os }}/release/obj/zig/libc_v8.a
6767
6868
- name: libiconv
6969
shell: bash

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG ZIG=0.14.0
55
ARG ZIG_MINISIG=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U
66
ARG ARCH=x86_64
77
ARG V8=11.1.134
8-
ARG ZIG_V8=v0.1.23
8+
ARG ZIG_V8=v0.1.24
99

1010
RUN apt-get update -yq && \
1111
apt-get install -yq xz-utils \
@@ -57,8 +57,8 @@ RUN make install-libiconv && \
5757

5858
# download and install v8
5959
RUN curl --fail -L -o libc_v8.a https://github.com/lightpanda-io/zig-v8-fork/releases/download/${ZIG_V8}/libc_v8_${V8}_linux_${ARCH}.a && \
60-
mkdir -p v8/build/${ARCH}-linux/release/ninja/obj/zig/ && \
61-
mv libc_v8.a v8/build/${ARCH}-linux/release/ninja/obj/zig/libc_v8.a
60+
mkdir -p v8/out/linux/release/obj/zig/ && \
61+
mv libc_v8.a v8/out/linux/release/obj/zig/libc_v8.a
6262

6363
# build release
6464
RUN make build

build.zig

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,30 @@ fn common(b: *std.Build, opts: *std.Build.Step.Options, step: *std.Build.Step.Co
170170
mod.addImport("v8", v8_mod);
171171
}
172172

173-
const lib_path = try std.fmt.allocPrint(
174-
mod.owner.allocator,
175-
"v8/out/{s}/obj/zig/libc_v8.a",
176-
.{if (mod.optimize.? == .Debug) "debug" else "release"},
177-
);
178173
mod.link_libcpp = true;
179-
mod.addObjectFile(mod.owner.path(lib_path));
174+
175+
{
176+
const release_dir = if (mod.optimize.? == .Debug) "debug" else "release";
177+
const os = switch (target.result.os.tag) {
178+
.linux => "linux",
179+
.macos => "macos",
180+
else => return error.UnsupportedPlatform,
181+
};
182+
var lib_path = try std.fmt.allocPrint(
183+
mod.owner.allocator,
184+
"v8/out/{s}/{s}/obj/zig/libc_v8.a",
185+
.{ os, release_dir },
186+
);
187+
std.fs.cwd().access(lib_path, .{}) catch {
188+
// legacy path
189+
lib_path = try std.fmt.allocPrint(
190+
mod.owner.allocator,
191+
"v8/out/{s}/obj/zig/libc_v8.a",
192+
.{release_dir},
193+
);
194+
};
195+
mod.addObjectFile(mod.owner.path(lib_path));
196+
}
180197

181198
switch (target.result.os.tag) {
182199
.macos => {
@@ -188,7 +205,6 @@ fn common(b: *std.Build, opts: *std.Build.Step.Options, step: *std.Build.Step.Co
188205
}
189206

190207
mod.addImport("build_config", opts.createModule());
191-
mod.addObjectFile(mod.owner.path(lib_path));
192208
}
193209

194210
fn moduleNetSurf(b: *std.Build, step: *std.Build.Step.Compile, target: std.Build.ResolvedTarget) !void {

build.zig.zon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
.hash = "tigerbeetle_io-0.0.0-ViLgxpyRBAB5BMfIcj3KMXfbJzwARs9uSl8aRy2OXULd",
1414
},
1515
.v8 = .{
16-
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/240140e5b3e5a8e5e51cbdd36bc120bf28ae5c31.tar.gz",
17-
.hash = "v8-0.0.0-xddH64eyAwBcX7e2x5tv9MhT0MgQbshP2rb19blo06Db",
16+
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/e38cb27ddb044c6afbf8a938b293721b9804405e.tar.gz",
17+
.hash = "v8-0.0.0-xddH6_GzAwCaz83JWuw3sepOGq0I7C_CmfOwA1Gb9q3y",
1818
},
1919
//.v8 = .{ .path = "../zig-v8-fork" },
2020
//.tigerbeetle_io = .{ .path = "../tigerbeetle-io" },

0 commit comments

Comments
 (0)