build libnss_turbo.so.2.0.0
This commit is contained in:
parent
78ac541e49
commit
9f884b96f7
35
build.zig
35
build.zig
@ -1,4 +1,5 @@
|
||||
const std = @import("std");
|
||||
const builtin = std.builtin;
|
||||
const zbs = std.build;
|
||||
|
||||
pub fn build(b: *zbs.Builder) void {
|
||||
@ -42,6 +43,24 @@ pub fn build(b: *zbs.Builder) void {
|
||||
cmph.addIncludeDir("deps/cmph/src");
|
||||
cmph.addIncludeDir("include/deps/cmph");
|
||||
|
||||
const bdz = b.addStaticLibrary("bdz", null);
|
||||
bdz.setTarget(target);
|
||||
bdz.setBuildMode(mode);
|
||||
bdz.linkLibC();
|
||||
bdz.addCSourceFiles(&.{
|
||||
"deps/cmph/src/bdz.c",
|
||||
"deps/cmph/src/bdz_ph.c",
|
||||
"deps/cmph/src/hash.c",
|
||||
"deps/cmph/src/jenkins_hash.c",
|
||||
}, &.{
|
||||
"-W",
|
||||
"-Wno-unused-function",
|
||||
//"-DDEBUG",
|
||||
});
|
||||
bdz.omit_frame_pointer = true;
|
||||
bdz.addIncludeDir("deps/cmph/src");
|
||||
bdz.addIncludeDir("include/deps/cmph");
|
||||
|
||||
{
|
||||
const exe = b.addExecutable("turbo-unix2db", "src/unix2db.zig");
|
||||
exe.setTarget(target);
|
||||
@ -57,6 +76,22 @@ pub fn build(b: *zbs.Builder) void {
|
||||
exe.install();
|
||||
}
|
||||
|
||||
{
|
||||
const so = b.addSharedLibrary("nss_turbo", "src/libnss.zig", .{
|
||||
.versioned = builtin.Version{
|
||||
.major = 2,
|
||||
.minor = 0,
|
||||
.patch = 0,
|
||||
},
|
||||
});
|
||||
so.linkLibC();
|
||||
so.linkLibrary(bdz);
|
||||
so.addIncludeDir("deps/cmph/src");
|
||||
so.setTarget(target);
|
||||
so.setBuildMode(mode);
|
||||
so.install();
|
||||
}
|
||||
|
||||
{
|
||||
const src_test = b.addTest("src/test_all.zig");
|
||||
addCmphDeps(src_test, cmph);
|
||||
|
@ -28,7 +28,7 @@ const ENV_OMIT_MEMBERS = "TURBONSS_OMIT_MEMBERS";
|
||||
|
||||
export var turbonss_db_path: [:0]const u8 = "/etc/turbonss/db.turbo";
|
||||
|
||||
pub var log_level: std.log.Level = .err;
|
||||
//pub var log_level: std.log.Level = .err;
|
||||
|
||||
// State is a type of the global variable holding the process state:
|
||||
// the DB handle and all the iterators.
|
||||
@ -52,23 +52,23 @@ var global_init = once(init);
|
||||
|
||||
// assigns State from environment variables et al
|
||||
fn init() void {
|
||||
if (os.getenvZ(ENV_LOGLEVEL)) |env| {
|
||||
const got = mem.sliceTo(env, 0);
|
||||
if (mem.eql(u8, got, "0")) {
|
||||
log_level = .err;
|
||||
} else if (mem.eql(u8, got, "1")) {
|
||||
log_level = .warn;
|
||||
} else if (mem.eql(u8, got, "2")) {
|
||||
log_level = .info;
|
||||
} else if (mem.eql(u8, got, "3")) {
|
||||
log_level = .debug;
|
||||
} else {
|
||||
std.debug.print(
|
||||
"warning: unrecognized {s}={s}. Expected between 0 and 3\n",
|
||||
.{ ENV_LOGLEVEL, got },
|
||||
);
|
||||
}
|
||||
}
|
||||
//if (os.getenvZ(ENV_LOGLEVEL)) |env| {
|
||||
// const got = mem.sliceTo(env, 0);
|
||||
// if (mem.eql(u8, got, "0")) {
|
||||
// log_level = .err;
|
||||
// } else if (mem.eql(u8, got, "1")) {
|
||||
// log_level = .warn;
|
||||
// } else if (mem.eql(u8, got, "2")) {
|
||||
// log_level = .info;
|
||||
// } else if (mem.eql(u8, got, "3")) {
|
||||
// log_level = .debug;
|
||||
// } else {
|
||||
// std.debug.print(
|
||||
// "warning: unrecognized {s}={s}. Expected between 0 and 3\n",
|
||||
// .{ ENV_LOGLEVEL, got },
|
||||
// );
|
||||
// }
|
||||
//}
|
||||
|
||||
const omit_members = blk: {
|
||||
if (os.getenvZ(ENV_OMIT_MEMBERS)) |env| {
|
||||
|
Loading…
Reference in New Issue
Block a user