From 5a811cce1efc360a2bd4fe11ada581ceb2a1c764 Mon Sep 17 00:00:00 2001 From: Kristian Larsson Date: Tue, 27 Aug 2024 15:31:29 +0200 Subject: [PATCH] Do zig style deps for libuv & mbedtls --- build.zig | 15 +++++++++++++++ build.zig.zon | 13 +++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 build.zig.zon diff --git a/build.zig b/build.zig index 003d29d..1ae6ef3 100644 --- a/build.zig +++ b/build.zig @@ -5,6 +5,16 @@ pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); const target = b.standardTargetOptions(.{}); + const dep_libmbedtls = b.dependency("libmbedtls", .{ + .target = target, + .optimize = optimize, + }); + + const dep_libuv = b.dependency("libuv", .{ + .target = target, + .optimize = optimize, + }); + const lib = b.addStaticLibrary(.{ .name = "tlsuv", .target = target, @@ -78,6 +88,11 @@ pub fn build(b: *std.Build) void { lib.addIncludePath(b.path("../../depsout/include")); lib.installHeader(b.path("deps/uv_link_t/include/uv_link_t.h"), "uv_link_t.h"); lib.installHeadersDirectory(b.path("include/tlsuv"), "tlsuv", .{}); + + lib.linkLibrary(dep_libmbedtls.artifact("mbedcrypto")); + lib.linkLibrary(dep_libmbedtls.artifact("mbedtls")); + lib.linkLibrary(dep_libmbedtls.artifact("mbedx509")); + lib.linkLibrary(dep_libuv.artifact("uv")); lib.linkLibC(); b.installArtifact(lib); diff --git a/build.zig.zon b/build.zig.zon new file mode 100644 index 0000000..81eca41 --- /dev/null +++ b/build.zig.zon @@ -0,0 +1,13 @@ +.{ + .name = "tlsuv", + .version = "0.0.0", + .dependencies = .{ + .libmbedtls = .{ + .path = "../mbedtls/", + }, + .libuv = .{ + .path = "../libuv/", + }, + }, + .paths = .{""}, +}