From c4b392a179048f936c062f5ffccc2bc25627e500 Mon Sep 17 00:00:00 2001 From: polwex Date: Mon, 6 Oct 2025 01:01:41 +0700 Subject: working --- vere/ext/natpmp/build.zig | 37 +++++++++++++++++++++++++++++++++++++ vere/ext/natpmp/build.zig.zon | 14 ++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 vere/ext/natpmp/build.zig create mode 100644 vere/ext/natpmp/build.zig.zon (limited to 'vere/ext/natpmp') diff --git a/vere/ext/natpmp/build.zig b/vere/ext/natpmp/build.zig new file mode 100644 index 0000000..2a44dee --- /dev/null +++ b/vere/ext/natpmp/build.zig @@ -0,0 +1,37 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + + const lib = b.addStaticLibrary(.{ + .name = "natpmp", + .target = target, + .optimize = optimize, + }); + + const dep_c = b.dependency("natpmp", .{ + .target = target, + .optimize = optimize, + }); + + lib.addIncludePath(dep_c.path("include")); + + lib.addCSourceFiles(.{ + .root = dep_c.path(""), + .files = &.{ + "natpmp.c", + "getgateway.c", + }, + .flags = &.{ + "-fno-sanitize=all", + }, + }); + + lib.installHeader(dep_c.path("natpmp.h"), "natpmp.h"); + lib.installHeader(dep_c.path("getgateway.h"), "getgateway.h"); + lib.installHeader(dep_c.path("natpmp_declspec.h"), "natpmp_declspec.h"); + + lib.linkLibC(); + b.installArtifact(lib); +} diff --git a/vere/ext/natpmp/build.zig.zon b/vere/ext/natpmp/build.zig.zon new file mode 100644 index 0000000..038468f --- /dev/null +++ b/vere/ext/natpmp/build.zig.zon @@ -0,0 +1,14 @@ +.{ + .name = "natpmp", + .version = "0.0.1", + .dependencies = .{ + .natpmp = .{ + .url = "https://mirrors.wikimedia.org/ubuntu/ubuntu/pool/main/libn/libnatpmp/libnatpmp_20230423.orig.tar.gz", + // .url = "https://debian.mirror.root.lu/debian/pool/main/libn/libnatpmp/libnatpmp_20230423.orig.tar.gz", + .hash = "N-V-__8AAKudAQA_d3eW8d8dskxBlLzGBg0qe-4u6ohSfCM2", + }, + }, + .paths = .{ + "", + }, +} -- cgit v1.2.3