From 25a1d588a90067574f211f3638cafab27b771a27 Mon Sep 17 00:00:00 2001 From: nikneym Date: Thu, 2 Oct 2025 18:23:30 +0300 Subject: [PATCH] integrate ada-url dependency to build system --- build.zig | 25 +++++++++++++++++++++++++ build.zig.zon | 4 ++++ 2 files changed, 29 insertions(+) diff --git a/build.zig b/build.zig index 3437dfad..9d4594fb 100644 --- a/build.zig +++ b/build.zig @@ -384,6 +384,7 @@ fn addDependencies(b: *Build, mod: *Build.Module, opts: *Build.Step.Options) !vo try buildMbedtls(b, mod); try buildNghttp2(b, mod); try buildCurl(b, mod); + try buildAda(b, mod); switch (target.result.os.tag) { .macos => { @@ -849,3 +850,27 @@ fn buildCurl(b: *Build, m: *Build.Module) !void { }, }); } + +pub fn buildAda(b: *Build, m: *Build.Module) !void { + const ada_dep = b.dependency("ada-singleheader", .{}); + const ada = b.addLibrary(.{ + .name = "ada", + .linkage = .static, + .root_module = b.createModule(.{ + .target = m.resolved_target, + .optimize = m.optimize, + .link_libcpp = true, + }), + }); + + // Expose "ada_c.h". + ada.installHeader(ada_dep.path("ada_c.h"), "ada_c.h"); + + ada.root_module.addCSourceFiles(.{ + .root = ada_dep.path(""), + .files = &.{"ada.cpp"}, + .flags = &.{"-std=c++20"}, + }); + + m.linkLibrary(ada); +} diff --git a/build.zig.zon b/build.zig.zon index 9d57095f..6e4f544b 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -9,5 +9,9 @@ .hash = "v8-0.0.0-xddH63bVAwBSEobaUok9J0er1FqsvEujCDDVy6ItqKQ5", }, //.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", + }, }, }