Ready for zig v0.13.

master
Philippe PITTOLI 2024-06-07 14:49:48 +02:00
parent b0a29f5800
commit 31e05ef1c2
4 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
const std = @import("std"); const std = @import("std");
const VERSION = "0.1.1"; const VERSION = "0.1.2";
// Although this function looks imperative, note that its job is to // Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external // declaratively construct a build graph that will be executed by an external
@ -21,7 +21,7 @@ pub fn build(b: *std.Build) void {
.name = "ipc", .name = "ipc",
// In this case the main source file is merely a path, however, in more // In this case the main source file is merely a path, however, in more
// complicated build scripts, this could be a generated file. // complicated build scripts, this could be a generated file.
.root_source_file = .{ .path = "src/bindings.zig" }, .root_source_file = .{ .cwd_relative = "src/bindings.zig" },
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });
@ -37,7 +37,7 @@ pub fn build(b: *std.Build) void {
const shared_lib = b.addSharedLibrary(.{ const shared_lib = b.addSharedLibrary(.{
.name = "ipc", .name = "ipc",
.root_source_file = .{ .path = "src/bindings.zig" }, .root_source_file = .{ .cwd_relative = "src/bindings.zig" },
.version = comptime (try std.SemanticVersion.parse(VERSION)), .version = comptime (try std.SemanticVersion.parse(VERSION)),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
@ -47,7 +47,7 @@ pub fn build(b: *std.Build) void {
// Creates a step for unit testing. // Creates a step for unit testing.
const main_tests = b.addTest(.{ const main_tests = b.addTest(.{
.root_source_file = .{ .path = "src/main.zig" }, .root_source_file = .{ .cwd_relative = "src/main.zig" },
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });

2
ipc.pc
View File

@ -3,6 +3,6 @@ libdir=/usr/local/lib
Name: LibIPC Name: LibIPC
Description: The simplest Inter Process Communication library Description: The simplest Inter Process Communication library
Version: 0.1.1 Version: 0.1.2
Libs: -L${libdir} -lipc Libs: -L${libdir} -lipc
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@ -48,7 +48,7 @@ serve-doc:
darkhttpd docs/ --addr $(DOC_HTTPD_ADDR) --port $(DOC_HTTPD_PORT) --log $(DOC_HTTPD_ACCESS_LOGS) darkhttpd docs/ --addr $(DOC_HTTPD_ADDR) --port $(DOC_HTTPD_PORT) --log $(DOC_HTTPD_ACCESS_LOGS)
PACKAGE ?= libipc PACKAGE ?= libipc
VERSION ?= 0.1.0 VERSION ?= 0.1.2
PKG = $(PACKAGE)-$(VERSION) PKG = $(PACKAGE)-$(VERSION)
dist-dir: dist-dir:
[ -d $(PKG) ] || ln -s . $(PKG) [ -d $(PKG) ] || ln -s . $(PKG)

View File

@ -78,8 +78,8 @@ test {
pub fn send_fd(sockfd: posix.socket_t, msg: []const u8, fd: posix.fd_t) void { pub fn send_fd(sockfd: posix.socket_t, msg: []const u8, fd: posix.fd_t) void {
var iov = [_]posix.iovec_const{ var iov = [_]posix.iovec_const{
.{ .{
.iov_base = msg.ptr, .base = msg.ptr,
.iov_len = msg.len, .len = msg.len,
}, },
}; };
@ -191,7 +191,7 @@ pub fn receive_fd(sockfd: posix.socket_t, buffer: []u8, msg_size: *usize) !posix
var msg_buffer = [_]u8{0} ** 1500; var msg_buffer = [_]u8{0} ** 1500;
var iov = [_]posix.iovec{ var iov = [_]posix.iovec{
.{ .iov_base = msg_buffer[0..], .iov_len = msg_buffer.len }, .{ .base = msg_buffer[0..], .len = msg_buffer.len },
}; };
var cmsg = Cmsghdr(posix.fd_t).init(.{ var cmsg = Cmsghdr(posix.fd_t).init(.{