refactor: rename lib and restructure pkg/

This commit is contained in:
Nurul Huda (Apon) 2026-07-16 02:27:13 +06:00
parent b0064649dc
commit d844d2a5fc
No known key found for this signature in database
GPG key ID: 5D3F1DE2855A2F79
17 changed files with 11 additions and 13 deletions

View file

@ -7,7 +7,7 @@ pub fn build(b: *std.Build) !void {
const force_build_rust = b.option(bool, "build-rust", "Always build Rust library from source") orelse false; const force_build_rust = b.option(bool, "build-rust", "Always build Rust library from source") orelse false;
// --- Rust C ABI & Pre-built via temporal-rs subpackage --- // // --- Rust C ABI & Pre-built via temporal-rs subpackage --- //
const temporal = b.dependency("temporal", .{ const libtemporal = b.dependency("libtemporal", .{
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
.@"build-rust" = force_build_rust, .@"build-rust" = force_build_rust,
@ -19,7 +19,7 @@ pub fn build(b: *std.Build) !void {
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });
mod.addImport("temporal_rs", temporal.module("temporal_rs")); mod.addImport("libtemporal", libtemporal.module("libtemporal"));
// --- Zig Executable: temporalz --- // // --- Zig Executable: temporalz --- //
const exe = b.addExecutable(.{ const exe = b.addExecutable(.{

View file

@ -4,8 +4,8 @@
.fingerprint = 0xd8d79d59acc4faae, .fingerprint = 0xd8d79d59acc4faae,
.minimum_zig_version = "0.17.0-dev.1398+cb5635714", .minimum_zig_version = "0.17.0-dev.1398+cb5635714",
.dependencies = .{ .dependencies = .{
.temporal = .{ .libtemporal = .{
.path = "pkg/temporal", .path = "lib",
}, },
}, },
.paths = .{ .paths = .{
@ -14,6 +14,6 @@
"README.md", "README.md",
"LICENCE", "LICENCE",
"src", "src",
"pkg", "lib",
}, },
} }

View file

@ -2,7 +2,6 @@
.name = .temporalz_example, .name = .temporalz_example,
.version = "0.1.2", .version = "0.1.2",
.fingerprint = 0x686c9dfc777f9593, .fingerprint = 0x686c9dfc777f9593,
.minimum_zig_version = "0.17.0-dev.1398+cb5635714",
.dependencies = .{ .dependencies = .{
.temporalz = .{ .temporalz = .{
.path = "../", .path = "../",

View file

@ -25,7 +25,7 @@ pub fn build(b: *std.Build) !void {
var selected_lib_file: std.Build.LazyPath = undefined; var selected_lib_file: std.Build.LazyPath = undefined;
if (!force_build_rust) { if (!force_build_rust) {
const libtemporal_dep = b.lazyDependency("libtemporal", .{}); const libtemporal_dep = b.lazyDependency("prebuilt_libtemporal", .{});
if (libtemporal_dep) |dep| { if (libtemporal_dep) |dep| {
const lib_file_candidate = dep.path(prebuilt_lib_path); const lib_file_candidate = dep.path(prebuilt_lib_path);
if (dep.builder.root.access(b.graph.io, prebuilt_lib_path, .{})) { if (dep.builder.root.access(b.graph.io, prebuilt_lib_path, .{})) {
@ -59,7 +59,7 @@ pub fn build(b: *std.Build) !void {
b.getInstallStep().dependOn(&install_lib.step); b.getInstallStep().dependOn(&install_lib.step);
// --- Zig Module --- // // --- Zig Module --- //
const mod = b.addModule("temporal_rs", .{ const mod = b.addModule("libtemporal", .{
.root_source_file = b.path("src/root.zig"), .root_source_file = b.path("src/root.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,

View file

@ -1,14 +1,13 @@
.{ .{
.name = .temporal, .name = .libtemporal,
.version = "0.2.0", .version = "0.2.0",
.fingerprint = 0xd5dcf3f41df6b117, .fingerprint = 0xded01f16f20c2a64,
.minimum_zig_version = "0.17.0-dev.1398+cb5635714",
.dependencies = .{ .dependencies = .{
.temporal_rs = .{ .temporal_rs = .{
.url = "git+https://github.com/boa-dev/temporal?ref=v0.2.3#c003cc92325e19b26f8ee2f85e4a47d98cbcc781", .url = "git+https://github.com/boa-dev/temporal?ref=v0.2.3#c003cc92325e19b26f8ee2f85e4a47d98cbcc781",
.hash = "N-V-__8AAPLKOQDfJ5TYhiiy_6a_dZqUmo9K4e8Xhjfup3fd", .hash = "N-V-__8AAPLKOQDfJ5TYhiiy_6a_dZqUmo9K4e8Xhjfup3fd",
}, },
.libtemporal = .{ .prebuilt_libtemporal = .{
.url = "https://github.com/nurulhudaapon/temporalz/releases/download/v0.2.3/libtemporal.tar.gz", .url = "https://github.com/nurulhudaapon/temporalz/releases/download/v0.2.3/libtemporal.tar.gz",
.hash = "N-V-__8AADYZ_AXnqpmkTa49ZQ6lEQlDXWRLthyxEbgse3Hi", .hash = "N-V-__8AADYZ_AXnqpmkTa49ZQ6lEQlDXWRLthyxEbgse3Hi",
.lazy = true, .lazy = true,

View file

@ -1,6 +1,6 @@
const std = @import("std"); const std = @import("std");
pub const c = @import("temporal_rs").c; pub const c = @import("libtemporal").c;
pub const to_string_rounding_options_auto: c.ToStringRoundingOptions = .{ pub const to_string_rounding_options_auto: c.ToStringRoundingOptions = .{
.precision = .{ .is_minute = false, .precision = toOption(c.OptionU8, null) }, .precision = .{ .is_minute = false, .precision = toOption(c.OptionU8, null) },