From 89bbf07466169fbd36a0c93b583074d18eeab7d3 Mon Sep 17 00:00:00 2001 From: Carson Katri Date: Tue, 16 Sep 2025 12:41:50 -0400 Subject: [PATCH 01/10] Add support for building on iOS --- Makefile | 77 ++++++++++++++++++++++------------------ build.zig | 96 ++++++++++++++++++++++++++++++++++++-------------- build.zig.zon | 2 +- src/app.zig | 5 +++ src/server.zig | 13 +++++-- 5 files changed, 128 insertions(+), 65 deletions(-) diff --git a/Makefile b/Makefile index 0034f6b91..56a8d838f 100644 --- a/Makefile +++ b/Makefile @@ -9,24 +9,29 @@ F= # OS and ARCH kernel = $(shell uname -ms) ifeq ($(kernel), Darwin arm64) - OS := macos - ARCH := aarch64 + OS ?= macos + ARCH ?= aarch64 else ifeq ($(kernel), Darwin x86_64) - OS := macos - ARCH := x86_64 + OS ?= macos + ARCH ?= x86_64 else ifeq ($(kernel), Linux aarch64) - OS := linux - ARCH := aarch64 + OS ?= linux + ARCH ?= aarch64 else ifeq ($(kernel), Linux arm64) - OS := linux - ARCH := aarch64 + OS ?= linux + ARCH ?= aarch64 else ifeq ($(kernel), Linux x86_64) - OS := linux - ARCH := x86_64 + OS ?= linux + ARCH ?= x86_64 else $(error "Unhandled kernel: $(kernel)") endif +MAKE ?= make +CMAKE ?= cmake +AUTOCONF_FLAGS ?= +CFLAGS ?= +LDFLAGS ?= # Infos # ----- @@ -156,38 +161,40 @@ _install-netsurf: clean-netsurf mkdir -p $(BC_NS) && \ cp -R vendor/netsurf/share $(BC_NS) && \ export PREFIX=$(BC_NS) && \ - export OPTLDFLAGS="-L$(ICONV)/lib" && \ - export OPTCFLAGS="$(OPTCFLAGS) -I$(ICONV)/include" && \ + export OPTLDFLAGS="$(LDFLAGS) -L$(ICONV)/lib" && \ + export OPTCFLAGS="$(CFLAGS) $(OPTCFLAGS) -I$(ICONV)/include" && \ printf "\e[33mInstalling libwapcaplet...\e[0m\n" && \ cd vendor/netsurf/libwapcaplet && \ - BUILDDIR=$(BC_NS)/build/libwapcaplet make install && \ + BUILDDIR=$(BC_NS)/build/libwapcaplet $(MAKE) install && \ cd ../libparserutils && \ printf "\e[33mInstalling libparserutils...\e[0m\n" && \ - BUILDDIR=$(BC_NS)/build/libparserutils make install && \ + BUILDDIR=$(BC_NS)/build/libparserutils $(MAKE) install && \ cd ../libhubbub && \ printf "\e[33mInstalling libhubbub...\e[0m\n" && \ - BUILDDIR=$(BC_NS)/build/libhubbub make install && \ + BUILDDIR=$(BC_NS)/build/libhubbub $(MAKE) install && \ rm src/treebuilder/autogenerated-element-type.c && \ cd ../libdom && \ printf "\e[33mInstalling libdom...\e[0m\n" && \ - BUILDDIR=$(BC_NS)/build/libdom make install && \ - printf "\e[33mRunning libdom example...\e[0m\n" && \ - cd examples && \ - $(ZIG) cc \ - -I$(ICONV)/include \ - -I$(BC_NS)/include \ - -L$(ICONV)/lib \ - -L$(BC_NS)/lib \ - -liconv \ - -ldom \ - -lhubbub \ - -lparserutils \ - -lwapcaplet \ - -o a.out \ - dom-structure-dump.c \ - $(ICONV)/lib/libiconv.a && \ - ./a.out > /dev/null && \ - rm a.out && \ + BUILDDIR=$(BC_NS)/build/libdom $(MAKE) install && \ + if [ -z "$${SKIP_EXAMPLES}" ]; then \ + printf "\e[33mRunning libdom example...\e[0m\n" && \ + cd examples && \ + $(ZIG) cc \ + -I$(ICONV)/include \ + -I$(BC_NS)/include \ + -L$(ICONV)/lib \ + -L$(BC_NS)/lib \ + -liconv \ + -ldom \ + -lhubbub \ + -lparserutils \ + -lwapcaplet \ + -o a.out \ + dom-structure-dump.c \ + $(ICONV)/lib/libiconv.a && \ + ./a.out > /dev/null && \ + rm a.out; \ + fi && \ printf "\e[36mDone NetSurf $(OS)\e[0m\n" clean-netsurf: @@ -211,7 +218,7 @@ endif build-libiconv: clean-libiconv @cd vendor/libiconv/libiconv-1.17 && \ - ./configure --prefix=$(ICONV) --enable-static && \ + ./configure --prefix=$(ICONV) --enable-static $(AUTOCONF_FLAGS) && \ make && make install install-libiconv: download-libiconv build-libiconv @@ -231,7 +238,7 @@ MIMALLOC := $(BC)vendor/mimalloc/out/$(OS)-$(ARCH) _build_mimalloc: clean-mimalloc @mkdir -p $(MIMALLOC)/build && \ cd $(MIMALLOC)/build && \ - cmake -DMI_BUILD_SHARED=OFF -DMI_BUILD_OBJECT=OFF -DMI_BUILD_TESTS=OFF -DMI_OVERRIDE=OFF $(OPTS) ../../.. && \ + $(CMAKE) -DMI_BUILD_SHARED=OFF -DMI_BUILD_OBJECT=OFF -DMI_BUILD_TESTS=OFF -DMI_OVERRIDE=OFF $(OPTS) ../../.. && \ make && \ mkdir -p $(MIMALLOC)/lib diff --git a/build.zig b/build.zig index 22ebb542b..d4e83b6e2 100644 --- a/build.zig +++ b/build.zig @@ -62,28 +62,36 @@ pub fn build(b: *Build) !void { try addDependencies(b, lightpanda_module, opts); { - // browser - // ------- - - // compile and install - const exe = b.addExecutable(.{ - .name = "lightpanda", - .use_llvm = true, - .root_module = lightpanda_module, - }); - b.installArtifact(exe); + // static lib + // ---------- - // run - const run_cmd = b.addRunArtifact(exe); - if (b.args) |args| { - run_cmd.addArgs(args); - } - - // step - const run_step = b.step("run", "Run the app"); - run_step.dependOn(&run_cmd.step); + const lib = b.addLibrary(.{ .name = "lightpanda", .root_module = lightpanda_module, .use_llvm = true, .linkage = .static }); + b.installArtifact(lib); } + // { + // // browser + // // ------- + + // // compile and install + // const exe = b.addExecutable(.{ + // .name = "lightpanda", + // .use_llvm = true, + // .root_module = lightpanda_module, + // }); + // b.installArtifact(exe); + + // // run + // const run_cmd = b.addRunArtifact(exe); + // if (b.args) |args| { + // run_cmd.addArgs(args); + // } + + // // step + // const run_step = b.step("run", "Run the app"); + // run_step.dependOn(&run_cmd.step); + // } + { // tests // ---- @@ -176,6 +184,7 @@ fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !vo const os = switch (target.result.os.tag) { .linux => "linux", .macos => "macos", + .ios => "ios", else => return error.UnsupportedPlatform, }; var lib_path = try std.fmt.allocPrint( @@ -199,6 +208,12 @@ fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !vo mod.addSystemFrameworkPath(.{ .cwd_relative = "/System/Library/Frameworks" }); mod.linkFramework("CoreFoundation", .{}); }, + .ios => { + const sdk_path = try std.process.getEnvVarOwned(mod.owner.allocator, "SDK"); + const framework_path = try std.fmt.allocPrint(mod.owner.allocator, "{s}/System/Library/Frameworks", .{sdk_path}); + mod.addSystemFrameworkPath(.{ .cwd_relative = framework_path }); + mod.linkFramework("CoreFoundation", .{}); + }, else => {}, } } @@ -393,6 +408,13 @@ fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !vo mod.linkFramework("CoreFoundation", .{}); mod.linkFramework("SystemConfiguration", .{}); }, + .ios => { + const sdk_path = try std.process.getEnvVarOwned(mod.owner.allocator, "SDK"); + const framework_path = try std.fmt.allocPrint(mod.owner.allocator, "{s}/System/Library/Frameworks", .{sdk_path}); + mod.addSystemFrameworkPath(.{ .cwd_relative = framework_path }); + mod.linkFramework("CoreFoundation", .{}); + mod.linkFramework("SystemConfiguration", .{}); + }, else => {}, } } @@ -400,19 +422,33 @@ fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !vo fn moduleNetSurf(b: *Build, mod: *Build.Module) !void { const target = mod.resolved_target.?; - const os = target.result.os.tag; - const arch = target.result.cpu.arch; + const os = switch (target.result.os.tag) { + .linux => "linux", + .macos => "macos", + .ios => switch (target.result.abi) { + .simulator => "iphonesimulator", + else => return error.UnsupportedPlatform, + }, + else => return error.UnsupportedPlatform, + }; + const arch = switch (target.result.os.tag) { + .ios => switch (target.result.cpu.arch) { + .aarch64 => "arm64", + else => @tagName(target.result.cpu.arch), + }, + else => @tagName(target.result.cpu.arch), + }; // iconv const libiconv_lib_path = try std.fmt.allocPrint( b.allocator, "vendor/libiconv/out/{s}-{s}/lib/libiconv.a", - .{ @tagName(os), @tagName(arch) }, + .{ os, arch }, ); const libiconv_include_path = try std.fmt.allocPrint( b.allocator, "vendor/libiconv/out/{s}-{s}/lib/libiconv.a", - .{ @tagName(os), @tagName(arch) }, + .{ os, arch }, ); mod.addObjectFile(b.path(libiconv_lib_path)); mod.addIncludePath(b.path(libiconv_include_path)); @@ -423,7 +459,7 @@ fn moduleNetSurf(b: *Build, mod: *Build.Module) !void { const lib_path = try std.fmt.allocPrint( b.allocator, mimalloc ++ "/out/{s}-{s}/lib/libmimalloc.a", - .{ @tagName(os), @tagName(arch) }, + .{ os, arch }, ); mod.addObjectFile(b.path(lib_path)); mod.addIncludePath(b.path(mimalloc ++ "/include")); @@ -434,7 +470,7 @@ fn moduleNetSurf(b: *Build, mod: *Build.Module) !void { const ns_include_path = try std.fmt.allocPrint( b.allocator, ns ++ "/out/{s}-{s}/include", - .{ @tagName(os), @tagName(arch) }, + .{ os, arch }, ); mod.addIncludePath(b.path(ns_include_path)); @@ -448,7 +484,7 @@ fn moduleNetSurf(b: *Build, mod: *Build.Module) !void { const ns_lib_path = try std.fmt.allocPrint( b.allocator, ns ++ "/out/{s}-{s}/lib/" ++ lib ++ ".a", - .{ @tagName(os), @tagName(arch) }, + .{ os, arch }, ); mod.addObjectFile(b.path(ns_lib_path)); mod.addIncludePath(b.path(ns ++ "/" ++ lib ++ "/src")); @@ -521,7 +557,7 @@ fn buildMbedtls(b: *Build, m: *Build.Module) !void { mbedtls.addIncludePath(b.path(root ++ "include")); mbedtls.addIncludePath(b.path(root ++ "library")); - mbedtls.addCSourceFiles(.{ .flags = &.{}, .files = &.{ + mbedtls.addCSourceFiles(.{ .flags = &.{"-Wno-nullability-completeness"}, .files = &.{ root ++ "library/aes.c", root ++ "library/aesni.c", root ++ "library/aesce.c", @@ -675,6 +711,12 @@ fn buildNghttp2(b: *Build, m: *Build.Module) !void { } fn buildCurl(b: *Build, m: *Build.Module) !void { + if (m.resolved_target.?.result.os.tag == .ios) { + const sdk_path = try std.process.getEnvVarOwned(b.allocator, "SDK"); + const include_path = try std.fmt.allocPrint(b.allocator, "{s}/usr/include", .{sdk_path}); + m.addIncludePath(.{ .cwd_relative = include_path }); + } + const curl = b.addLibrary(.{ .name = "curl", .root_module = m, diff --git a/build.zig.zon b/build.zig.zon index 6e4f544b9..91870738b 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -8,7 +8,7 @@ .url = "https://github.com/lightpanda-io/zig-v8-fork/archive/305bb3706716d32d59b2ffa674731556caa1002b.tar.gz", .hash = "v8-0.0.0-xddH63bVAwBSEobaUok9J0er1FqsvEujCDDVy6ItqKQ5", }, - //.v8 = .{ .path = "../zig-v8-fork" } + //.v8 = .{ .path = "../zig-v8-fork" }, .@"ada-singleheader" = .{ .url = "https://github.com/ada-url/ada/releases/download/v3.3.0/singleheader.zip", .hash = "N-V-__8AAPmhFAAw64ALjlzd5YMtzpSrmZ6KymsT84BKfB4s", diff --git a/src/app.zig b/src/app.zig index 719dd9b72..624b0b27e 100644 --- a/src/app.zig +++ b/src/app.zig @@ -98,6 +98,11 @@ fn getAndMakeAppDir(allocator: Allocator) ?[]const u8 { if (@import("builtin").is_test) { return allocator.dupe(u8, "/tmp") catch unreachable; } + + if (@import("builtin").os.tag == .ios) { + return null; // getAppDataDir is not available on iOS + } + const app_dir_path = std.fs.getAppDataDir(allocator, "lightpanda") catch |err| { log.warn(.app, "get data dir", .{ .err = err }); return null; diff --git a/src/server.zig b/src/server.zig index 1719e11df..845b4f460 100644 --- a/src/server.zig +++ b/src/server.zig @@ -75,8 +75,17 @@ pub const Server = struct { self.listener = listener; try posix.setsockopt(listener, posix.SOL.SOCKET, posix.SO.REUSEADDR, &std.mem.toBytes(@as(c_int, 1))); - if (@hasDecl(posix.TCP, "NODELAY")) { - try posix.setsockopt(listener, posix.IPPROTO.TCP, posix.TCP.NODELAY, &std.mem.toBytes(@as(c_int, 1))); + switch (builtin.os.tag) { + .ios => { + // TCP.NODELAY is not defined for iOS in posix module + const TCP_NODELAY = 0x01; + try posix.setsockopt(listener, posix.IPPROTO.TCP, TCP_NODELAY, &std.mem.toBytes(@as(c_int, 1))); + }, + else => { + if (@hasDecl(posix.TCP, "NODELAY")) { + try posix.setsockopt(listener, posix.IPPROTO.TCP, posix.TCP.NODELAY, &std.mem.toBytes(@as(c_int, 1))); + } + }, } try posix.bind(listener, &address.any, address.getOsSockLen()); From 67eb795ac15e00d4e521591ba11bbd11455103c5 Mon Sep 17 00:00:00 2001 From: Carson Katri Date: Tue, 16 Sep 2025 13:26:30 -0400 Subject: [PATCH 02/10] Remove static lib --- build.zig | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/build.zig b/build.zig index d4e83b6e2..cd8bf2e3c 100644 --- a/build.zig +++ b/build.zig @@ -62,35 +62,27 @@ pub fn build(b: *Build) !void { try addDependencies(b, lightpanda_module, opts); { - // static lib - // ---------- + // browser + // ------- - const lib = b.addLibrary(.{ .name = "lightpanda", .root_module = lightpanda_module, .use_llvm = true, .linkage = .static }); - b.installArtifact(lib); - } + // compile and install + const exe = b.addExecutable(.{ + .name = "lightpanda", + .use_llvm = true, + .root_module = lightpanda_module, + }); + b.installArtifact(exe); - // { - // // browser - // // ------- - - // // compile and install - // const exe = b.addExecutable(.{ - // .name = "lightpanda", - // .use_llvm = true, - // .root_module = lightpanda_module, - // }); - // b.installArtifact(exe); - - // // run - // const run_cmd = b.addRunArtifact(exe); - // if (b.args) |args| { - // run_cmd.addArgs(args); - // } - - // // step - // const run_step = b.step("run", "Run the app"); - // run_step.dependOn(&run_cmd.step); - // } + // run + const run_cmd = b.addRunArtifact(exe); + if (b.args) |args| { + run_cmd.addArgs(args); + } + + // step + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); + } { // tests From 4ee19ffc0f2c35c7b1c97940bb2920db75706eb2 Mon Sep 17 00:00:00 2001 From: Carson Katri Date: Thu, 18 Sep 2025 16:36:03 -0400 Subject: [PATCH 03/10] Add getAppDir implementation for iOS --- src/.DS_Store | Bin 0 -> 6148 bytes src/app.zig | 18 +++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 src/.DS_Store diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..8c89251d50d708be60be611e3be26b0189bce62b GIT binary patch literal 6148 zcmeHKy-EW?5T4B?8Wlu46^pYG#42DVDrbyOU?bR=KUBzhA&H1!aiA}tg<$6+_yEDi z!p25RAHY|z^_$)G-1SbeQABoN_uJc<+3(v)vYR6!Q9fvth{lMhh{l*7Mwemi=a#aZ zo|y&;xki_o)M@RMHtJC-+D*6$xC;EW3h-}tkZRPShz`m4{f2ERb@Xg19T7&AO05;u z;3;lR_HPH5?^d&-8sCU&@A7G(*~VimLmt(sL2Y%8Xix5?{O&RN7dDqqW>+M?&I_Y= z-n7@^^RAdL54I}xsA@45ycyGHa;`1*M;@0XXOe5OX8A4N0-v|w-34p!!%oG(yy-J} z!;9#6LG3lkHF>lA7O(KJG(PVR9ne0Q_b8;MwQKM6Asu0A7`RXN{$U+c$>&j)9`Bm< z3_(egT4+#%afgm9O;ozfjxu!}Jtw*{)-$zz9ck&Kfb|umzApN%rAs`W+g?-8T<_-X zJ7VOUI31y{mw$fU7`K0X`pmG{!(zK#nt#tKzB3CWCgG_%leC_=Jh-k0Gd0)?)36>t@> zE8wZeF~0xTKY#zXliZW5fUCg2s({E>HY#OoN#Cuh&GB99qiv(Haa^oWrl8Z;u^jMK dJb@++KA#7`Kx3>BGcfl@K$gLEt^&VWfmea-->U!s literal 0 HcmV?d00001 diff --git a/src/app.zig b/src/app.zig index 624b0b27e..9ced67a77 100644 --- a/src/app.zig +++ b/src/app.zig @@ -94,16 +94,24 @@ pub const App = struct { } }; +fn getAppDir(allocator: Allocator) ![]const u8 { + if (@import("builtin").os.tag == .ios) { + // std.fs.getAppDataDir is not available on iOS, so we inline the same macOS implementation here. + const home_dir = std.posix.getenv("HOME") orelse { + return error.AppDataDirUnavailable; + }; + return std.fs.path.join(allocator, &[_][]const u8{ home_dir, "Library", "Application Support", "lightpanda" }); + } else { + return try std.fs.getAppDataDir(allocator, "lightpanda"); + } +} + fn getAndMakeAppDir(allocator: Allocator) ?[]const u8 { if (@import("builtin").is_test) { return allocator.dupe(u8, "/tmp") catch unreachable; } - if (@import("builtin").os.tag == .ios) { - return null; // getAppDataDir is not available on iOS - } - - const app_dir_path = std.fs.getAppDataDir(allocator, "lightpanda") catch |err| { + const app_dir_path = getAppDir(allocator) catch |err| { log.warn(.app, "get data dir", .{ .err = err }); return null; }; From 808c3632bb1cb77db3794335aef0b5b1eda7de6e Mon Sep 17 00:00:00 2001 From: Carson Katri Date: Thu, 18 Sep 2025 16:39:07 -0400 Subject: [PATCH 04/10] Only use -Wno-nullability-completeness on iOS --- build.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.zig b/build.zig index cd8bf2e3c..ff5e13c50 100644 --- a/build.zig +++ b/build.zig @@ -549,7 +549,12 @@ fn buildMbedtls(b: *Build, m: *Build.Module) !void { mbedtls.addIncludePath(b.path(root ++ "include")); mbedtls.addIncludePath(b.path(root ++ "library")); - mbedtls.addCSourceFiles(.{ .flags = &.{"-Wno-nullability-completeness"}, .files = &.{ + const flags: []const []const u8 = if (m.resolved_target.?.result.os.tag == .ios) + &.{"-Wno-nullability-completeness"} + else + &.{}; + + mbedtls.addCSourceFiles(.{ .flags = flags, .files = &.{ root ++ "library/aes.c", root ++ "library/aesni.c", root ++ "library/aesce.c", From 75c87b3a972ed69f4bc98579ea4ef5299c1fdf50 Mon Sep 17 00:00:00 2001 From: Carson Katri Date: Thu, 18 Sep 2025 16:45:44 -0400 Subject: [PATCH 05/10] Add build static-lib step --- build.zig | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/build.zig b/build.zig index ff5e13c50..4f3e163bb 100644 --- a/build.zig +++ b/build.zig @@ -149,6 +149,25 @@ pub fn build(b: *Build) !void { const build_step = b.step("build-v8", "Build v8"); build_step.dependOn(&build_v8.step); } + + { + // static lib + // ------- + const static_lib_module = b.addModule("lightpanda", .{ + .root_source_file = b.path("src/lib.zig"), + .target = target, + .optimize = optimize, + .link_libc = true, + .link_libcpp = true, + }); + try addDependencies(b, static_lib_module, opts); + + const lib = b.addLibrary(.{ .name = "lightpanda", .root_module = static_lib_module, .use_llvm = true, .linkage = .static }); + lib.bundle_compiler_rt = true; + const install_artifact = b.addInstallArtifact(lib, .{}); + const build_step = b.step("static-lib", "Build static lib"); + build_step.dependOn(&install_artifact.step); + } } fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !void { From cf822707f84cf51d6ca8d28eacd2a8fc681cc34c Mon Sep 17 00:00:00 2001 From: Carson Katri Date: Tue, 7 Oct 2025 08:32:02 -0400 Subject: [PATCH 06/10] Add missing lib.zig file --- src/.DS_Store | Bin 6148 -> 0 bytes src/lib.zig | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/.DS_Store create mode 100644 src/lib.zig diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index 8c89251d50d708be60be611e3be26b0189bce62b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKy-EW?5T4B?8Wlu46^pYG#42DVDrbyOU?bR=KUBzhA&H1!aiA}tg<$6+_yEDi z!p25RAHY|z^_$)G-1SbeQABoN_uJc<+3(v)vYR6!Q9fvth{lMhh{l*7Mwemi=a#aZ zo|y&;xki_o)M@RMHtJC-+D*6$xC;EW3h-}tkZRPShz`m4{f2ERb@Xg19T7&AO05;u z;3;lR_HPH5?^d&-8sCU&@A7G(*~VimLmt(sL2Y%8Xix5?{O&RN7dDqqW>+M?&I_Y= z-n7@^^RAdL54I}xsA@45ycyGHa;`1*M;@0XXOe5OX8A4N0-v|w-34p!!%oG(yy-J} z!;9#6LG3lkHF>lA7O(KJG(PVR9ne0Q_b8;MwQKM6Asu0A7`RXN{$U+c$>&j)9`Bm< z3_(egT4+#%afgm9O;ozfjxu!}Jtw*{)-$zz9ck&Kfb|umzApN%rAs`W+g?-8T<_-X zJ7VOUI31y{mw$fU7`K0X`pmG{!(zK#nt#tKzB3CWCgG_%leC_=Jh-k0Gd0)?)36>t@> zE8wZeF~0xTKY#zXliZW5fUCg2s({E>HY#OoN#Cuh&GB99qiv(Haa^oWrl8Z;u^jMK dJb@++KA#7`Kx3>BGcfl@K$gLEt^&VWfmea-->U!s diff --git a/src/lib.zig b/src/lib.zig new file mode 100644 index 000000000..e69de29bb From 59bdeee902e66d1e6bfc511b3181d7ab3f364898 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 3 Nov 2025 17:17:40 +0100 Subject: [PATCH 07/10] update zig-v8 --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 91870738b..92ae3aff0 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -5,8 +5,8 @@ .fingerprint = 0xda130f3af836cea0, .dependencies = .{ .v8 = .{ - .url = "https://github.com/lightpanda-io/zig-v8-fork/archive/305bb3706716d32d59b2ffa674731556caa1002b.tar.gz", - .hash = "v8-0.0.0-xddH63bVAwBSEobaUok9J0er1FqsvEujCDDVy6ItqKQ5", + .url = "https://github.com/lightpanda-io/zig-v8-fork/archive/3488a447a389a26e90325858c755d3f61045e15e.tar.gz", + .hash = "v8-0.0.0-xddH6zXaAwD5MA_ZuW77ypvHFks4JzhNIQ12p8V2hymO", }, //.v8 = .{ .path = "../zig-v8-fork" }, .@"ada-singleheader" = .{ From 8d86b324e19eb585b7d4feed507c69e886f3f7e9 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 3 Nov 2025 17:24:26 +0100 Subject: [PATCH 08/10] ci: add ios lib build --- .github/workflows/build.yml | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df16af4c9..dbe2eb493 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -175,3 +175,44 @@ jobs: allowUpdates: true artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }} tag: nightly + + build-aarch64-ios: + env: + OS: ios + ARCH: aarch64 + TARGET_ENVIRONMENT: simulator + + # macos-15 runs on arm CPU. see + # https://github.com/actions/runner-images?tab=readme-ov-file + runs-on: macos-15 + timeout-minutes: 15 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + # fetch submodules recusively, to get zig-js-runtime submodules also. + submodules: recursive + + - uses: ./.github/actions/install + with: + os: ${{env.OS}} + arch: ${{env.ARCH}} + + - name: zig build + run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) static-build + + - name: Rename binary + run: mv zig-out/lib/liblightpanda.a liblightpanda-${{ env.ARCH }}-${{ env.OS }}.a + + - name: upload on s3 + run: | + export DIR=`git show --no-patch --no-notes --pretty='%cs_%h'` + aws s3 cp --storage-class=GLACIER_IR liblightpanda-${{ env.ARCH }}-${{ env.OS }}.a s3://lpd-nightly-build/${DIR}/liblightpanda-${{ env.ARCH }}-${{ env.OS }}.a + + - name: Upload the build + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }} + tag: nightly From 34116c7b82cfb37c3fa7b7b4c6014397b4460bad Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 3 Nov 2025 17:26:14 +0100 Subject: [PATCH 09/10] add comment into lib.zig --- src/lib.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.zig b/src/lib.zig index e69de29bb..423820fb3 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -0,0 +1,2 @@ +// Empty file used to include `extern` definitions. +// See https://github.com/lightpanda-io/browser/pull/1054#issuecomment-3309681117 From 5583c653e1fda86546b2796985568766d6227b21 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 3 Nov 2025 17:28:49 +0100 Subject: [PATCH 10/10] WIP REMOVE ME --- .github/workflows/build.yml | 341 ++++++++++++++++++------------------ 1 file changed, 172 insertions(+), 169 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dbe2eb493..478e54b6a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,168 +13,171 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + permissions: contents: write jobs: - build-linux-x86_64: - env: - ARCH: x86_64 - OS: linux - - runs-on: ubuntu-22.04 - timeout-minutes: 15 - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - # fetch submodules recusively, to get zig-js-runtime submodules also. - submodules: recursive - - - uses: ./.github/actions/install - with: - os: ${{env.OS}} - arch: ${{env.ARCH}} - - - name: zig build - run: zig build --release=safe -Doptimize=ReleaseSafe -Dcpu=x86_64 -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) - - - name: Rename binary - run: mv zig-out/bin/lightpanda lightpanda-${{ env.ARCH }}-${{ env.OS }} - - - name: upload on s3 - run: | - export DIR=`git show --no-patch --no-notes --pretty='%cs_%h'` - aws s3 cp --storage-class=GLACIER_IR lightpanda-${{ env.ARCH }}-${{ env.OS }} s3://lpd-nightly-build/${DIR}/lightpanda-${{ env.ARCH }}-${{ env.OS }} - - - name: Upload the build - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }} - tag: nightly - - build-linux-aarch64: - env: - ARCH: aarch64 - OS: linux - - runs-on: ubuntu-22.04-arm - timeout-minutes: 15 - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - # fetch submodules recusively, to get zig-js-runtime submodules also. - submodules: recursive - - - uses: ./.github/actions/install - with: - os: ${{env.OS}} - arch: ${{env.ARCH}} - - - name: zig build - run: zig build --release=safe -Doptimize=ReleaseSafe -Dcpu=generic -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) - - - name: Rename binary - run: mv zig-out/bin/lightpanda lightpanda-${{ env.ARCH }}-${{ env.OS }} - - - name: upload on s3 - run: | - export DIR=`git show --no-patch --no-notes --pretty='%cs_%h'` - aws s3 cp --storage-class=GLACIER_IR lightpanda-${{ env.ARCH }}-${{ env.OS }} s3://lpd-nightly-build/${DIR}/lightpanda-${{ env.ARCH }}-${{ env.OS }} - - - name: Upload the build - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }} - tag: nightly - - build-macos-aarch64: - env: - ARCH: aarch64 - OS: macos - - # macos-14 runs on arm CPU. see - # https://github.com/actions/runner-images?tab=readme-ov-file - runs-on: macos-14 - timeout-minutes: 15 - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - # fetch submodules recusively, to get zig-js-runtime submodules also. - submodules: recursive - - - uses: ./.github/actions/install - with: - os: ${{env.OS}} - arch: ${{env.ARCH}} - - - name: zig build - run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) - - - name: Rename binary - run: mv zig-out/bin/lightpanda lightpanda-${{ env.ARCH }}-${{ env.OS }} - - - name: upload on s3 - run: | - export DIR=`git show --no-patch --no-notes --pretty='%cs_%h'` - aws s3 cp --storage-class=GLACIER_IR lightpanda-${{ env.ARCH }}-${{ env.OS }} s3://lpd-nightly-build/${DIR}/lightpanda-${{ env.ARCH }}-${{ env.OS }} - - - name: Upload the build - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }} - tag: nightly - - build-macos-x86_64: - env: - ARCH: x86_64 - OS: macos - - # macos-13 runs on x86 CPU. see - # https://github.com/actions/runner-images?tab=readme-ov-file - # If we want to build for macos-14 or superior, we need to switch to - # macos-14-large. - # No need for now, but maybe we will need it in the short term. - runs-on: macos-13 - timeout-minutes: 15 - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - # fetch submodules recusively, to get zig-js-runtime submodules also. - submodules: recursive - - - uses: ./.github/actions/install - with: - os: ${{env.OS}} - arch: ${{env.ARCH}} - - - name: zig build - run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) - - - name: Rename binary - run: mv zig-out/bin/lightpanda lightpanda-${{ env.ARCH }}-${{ env.OS }} - - - name: upload on s3 - run: | - export DIR=`git show --no-patch --no-notes --pretty='%cs_%h'` - aws s3 cp --storage-class=GLACIER_IR lightpanda-${{ env.ARCH }}-${{ env.OS }} s3://lpd-nightly-build/${DIR}/lightpanda-${{ env.ARCH }}-${{ env.OS }} - - - name: Upload the build - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }} - tag: nightly + # build-linux-x86_64: + # env: + # ARCH: x86_64 + # OS: linux + + # runs-on: ubuntu-22.04 + # timeout-minutes: 15 + + # steps: + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # # fetch submodules recusively, to get zig-js-runtime submodules also. + # submodules: recursive + + # - uses: ./.github/actions/install + # with: + # os: ${{env.OS}} + # arch: ${{env.ARCH}} + + # - name: zig build + # run: zig build --release=safe -Doptimize=ReleaseSafe -Dcpu=x86_64 -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) + + # - name: Rename binary + # run: mv zig-out/bin/lightpanda lightpanda-${{ env.ARCH }}-${{ env.OS }} + + # - name: upload on s3 + # run: | + # export DIR=`git show --no-patch --no-notes --pretty='%cs_%h'` + # aws s3 cp --storage-class=GLACIER_IR lightpanda-${{ env.ARCH }}-${{ env.OS }} s3://lpd-nightly-build/${DIR}/lightpanda-${{ env.ARCH }}-${{ env.OS }} + + # - name: Upload the build + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }} + # tag: nightly + + # build-linux-aarch64: + # env: + # ARCH: aarch64 + # OS: linux + + # runs-on: ubuntu-22.04-arm + # timeout-minutes: 15 + + # steps: + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # # fetch submodules recusively, to get zig-js-runtime submodules also. + # submodules: recursive + + # - uses: ./.github/actions/install + # with: + # os: ${{env.OS}} + # arch: ${{env.ARCH}} + + # - name: zig build + # run: zig build --release=safe -Doptimize=ReleaseSafe -Dcpu=generic -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) + + # - name: Rename binary + # run: mv zig-out/bin/lightpanda lightpanda-${{ env.ARCH }}-${{ env.OS }} + + # - name: upload on s3 + # run: | + # export DIR=`git show --no-patch --no-notes --pretty='%cs_%h'` + # aws s3 cp --storage-class=GLACIER_IR lightpanda-${{ env.ARCH }}-${{ env.OS }} s3://lpd-nightly-build/${DIR}/lightpanda-${{ env.ARCH }}-${{ env.OS }} + + # - name: Upload the build + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }} + # tag: nightly + + # build-macos-aarch64: + # env: + # ARCH: aarch64 + # OS: macos + + # # macos-14 runs on arm CPU. see + # # https://github.com/actions/runner-images?tab=readme-ov-file + # runs-on: macos-14 + # timeout-minutes: 15 + + # steps: + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # # fetch submodules recusively, to get zig-js-runtime submodules also. + # submodules: recursive + + # - uses: ./.github/actions/install + # with: + # os: ${{env.OS}} + # arch: ${{env.ARCH}} + + # - name: zig build + # run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) + + # - name: Rename binary + # run: mv zig-out/bin/lightpanda lightpanda-${{ env.ARCH }}-${{ env.OS }} + + # - name: upload on s3 + # run: | + # export DIR=`git show --no-patch --no-notes --pretty='%cs_%h'` + # aws s3 cp --storage-class=GLACIER_IR lightpanda-${{ env.ARCH }}-${{ env.OS }} s3://lpd-nightly-build/${DIR}/lightpanda-${{ env.ARCH }}-${{ env.OS }} + + # - name: Upload the build + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }} + # tag: nightly + + # build-macos-x86_64: + # env: + # ARCH: x86_64 + # OS: macos + + # # macos-13 runs on x86 CPU. see + # # https://github.com/actions/runner-images?tab=readme-ov-file + # # If we want to build for macos-14 or superior, we need to switch to + # # macos-14-large. + # # No need for now, but maybe we will need it in the short term. + # runs-on: macos-13 + # timeout-minutes: 15 + + # steps: + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # # fetch submodules recusively, to get zig-js-runtime submodules also. + # submodules: recursive + + # - uses: ./.github/actions/install + # with: + # os: ${{env.OS}} + # arch: ${{env.ARCH}} + + # - name: zig build + # run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) + + # - name: Rename binary + # run: mv zig-out/bin/lightpanda lightpanda-${{ env.ARCH }}-${{ env.OS }} + + # - name: upload on s3 + # run: | + # export DIR=`git show --no-patch --no-notes --pretty='%cs_%h'` + # aws s3 cp --storage-class=GLACIER_IR lightpanda-${{ env.ARCH }}-${{ env.OS }} s3://lpd-nightly-build/${DIR}/lightpanda-${{ env.ARCH }}-${{ env.OS }} + + # - name: Upload the build + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }} + # tag: nightly build-aarch64-ios: env: @@ -205,14 +208,14 @@ jobs: - name: Rename binary run: mv zig-out/lib/liblightpanda.a liblightpanda-${{ env.ARCH }}-${{ env.OS }}.a - - name: upload on s3 - run: | - export DIR=`git show --no-patch --no-notes --pretty='%cs_%h'` - aws s3 cp --storage-class=GLACIER_IR liblightpanda-${{ env.ARCH }}-${{ env.OS }}.a s3://lpd-nightly-build/${DIR}/liblightpanda-${{ env.ARCH }}-${{ env.OS }}.a - - - name: Upload the build - uses: ncipollo/release-action@v1 - with: - allowUpdates: true - artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }} - tag: nightly + # - name: upload on s3 + # run: | + # export DIR=`git show --no-patch --no-notes --pretty='%cs_%h'` + # aws s3 cp --storage-class=GLACIER_IR liblightpanda-${{ env.ARCH }}-${{ env.OS }}.a s3://lpd-nightly-build/${DIR}/liblightpanda-${{ env.ARCH }}-${{ env.OS }}.a + + # - name: Upload the build + # uses: ncipollo/release-action@v1 + # with: + # allowUpdates: true + # artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }} + # tag: nightly