120 lines
3.1 KiB
Zig
120 lines
3.1 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const libsodium_dep = b.dependency(
|
|
"libsodium",
|
|
.{
|
|
.target = target,
|
|
.optimize = optimize,
|
|
.static = true,
|
|
.shared = false,
|
|
},
|
|
);
|
|
|
|
const exe = b.addExecutable(.{
|
|
.name = "vtund",
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
exe.linkLibrary(libsodium_dep.artifact("sodium"));
|
|
exe.linkLibC();
|
|
exe.addCSourceFiles(.{
|
|
.files = &.{
|
|
"auth.c",
|
|
"client.c",
|
|
//"freebsd/tun_dev.c",
|
|
"generic/pipe_dev.c",
|
|
"generic/pty_dev.c",
|
|
//"generic/tap_dev.c",
|
|
"generic/tcp_proto.c",
|
|
//"generic/tun_dev.c",
|
|
"generic/udp_proto.c",
|
|
"lfd_encrypt.c",
|
|
"lfd_lzo.c",
|
|
"lfd_shaper.c",
|
|
"lfd_zlib.c",
|
|
"lib.c",
|
|
"linkfd.c",
|
|
"linux/tap_dev.c",
|
|
"linux/tun_dev.c",
|
|
"llist.c",
|
|
"lock.c",
|
|
"main.c",
|
|
"netlib.c",
|
|
//"openbsd/tun_dev.c",
|
|
"server.c",
|
|
//"svr4/tap_dev.c",
|
|
//"svr4/tun_dev.c",
|
|
"tunnel.c",
|
|
|
|
"cfg_file.c",
|
|
"cfg_file.lex.c",
|
|
},
|
|
.flags = &.{
|
|
"-D_GNU_SOURCE",
|
|
"-fstack-protector-all",
|
|
"-fno-strict-overflow",
|
|
"-fno-strict-aliasing",
|
|
},
|
|
});
|
|
|
|
exe.addConfigHeader(b.addConfigHeader(.{
|
|
.include_path = "config.h",
|
|
}, .{
|
|
.VTUN_CONFIG_FILE = "/etc/vtund.conf",
|
|
.VTUN_PID_FILE = "/var/run/vtund.pid",
|
|
.VTUN_STAT_DIR = "/var/log/vtund",
|
|
.VTUN_LOCK_DIR = "/var/lock/vtund",
|
|
|
|
.ENABLE_NAT_HACK = 0,
|
|
.HAVE_ARPA_INET_H = 1,
|
|
.HAVE_FORK = 1,
|
|
|
|
//.HAVE_GETPT = 1, // pty tunnels
|
|
//.HAVE_GRANTPT = 1, // pty tunnels
|
|
|
|
.HAVE_INTTYPES_H = 1,
|
|
.HAVE_LINUX_IF_TUN_H = 1,
|
|
.HAVE_NETDB_H = 1,
|
|
.HAVE_NETINET_IN_H = 1,
|
|
.HAVE_NETINET_IN_SYSTM_H = 1,
|
|
.HAVE_NETINET_IP_H = 1,
|
|
.HAVE_NETINET_TCP_H = 1,
|
|
//.HAVE_PTSNAME = 1, // pty tunnels
|
|
.HAVE_RESOLV_H = 1,
|
|
.HAVE_SCHED_H = 1,
|
|
.HAVE_SHAPER = 1,
|
|
.HAVE_SODIUM = 1,
|
|
.HAVE_STDINT_H = 1,
|
|
.HAVE_STDIO_H = 1,
|
|
.HAVE_STDLIB_H = 1,
|
|
.HAVE_STRINGS_H = 1,
|
|
.HAVE_STRING_H = 1,
|
|
.HAVE_SYS_RESOURCE_H = 1,
|
|
.HAVE_SYS_STAT_H = 1,
|
|
.HAVE_SYS_TYPES_H = 1,
|
|
.HAVE_UNISTD_H = 1,
|
|
//.HAVE_UNLOCKPT = 1, // pty tunnels
|
|
.HAVE_VFORK = 1,
|
|
.HAVE_WORKING_FORK = 1,
|
|
.HAVE_WORKING_VFORK = 1,
|
|
.PACKAGE_BUGREPORT = "",
|
|
.PACKAGE_NAME = "vtun",
|
|
.PACKAGE_STRING = "vtun = 3",
|
|
.PACKAGE_TARNAME = "vtun",
|
|
.PACKAGE_URL = "",
|
|
.PACKAGE_VERSION = "3",
|
|
.STDC_HEADERS = 1,
|
|
.VTUN_VER = "3.X = 10/10/2024",
|
|
.YYTEXT_POINTER = 1,
|
|
}));
|
|
|
|
exe.addIncludePath(b.path("."));
|
|
|
|
b.installArtifact(exe);
|
|
}
|