mirror of
https://github.com/allyourcodebase/lua.git
synced 2026-05-01 11:17:58 +02:00
Merge d6254e1434 into 5a5a4135cb
This commit is contained in:
commit
a4a0cde26c
2 changed files with 40 additions and 80 deletions
112
build.zig
112
build.zig
|
|
@ -6,7 +6,7 @@ const OptimizeMode = std.builtin.OptimizeMode;
|
|||
const version = std.SemanticVersion{
|
||||
.major = 5,
|
||||
.minor = 4,
|
||||
.patch = 7,
|
||||
.patch = 8,
|
||||
};
|
||||
const lib_name = "lua";
|
||||
const exe_name = lib_name ++ "_exe";
|
||||
|
|
@ -25,26 +25,44 @@ pub fn build(b: *Build) !void {
|
|||
|
||||
const lua_src = b.dependency("lua", .{});
|
||||
|
||||
const lib =
|
||||
b.addStaticLibrary(artifactOptions(
|
||||
.{ .shared = false },
|
||||
.{ .target = target, .optimize = optimize },
|
||||
));
|
||||
const lib = b.addLibrary(.{
|
||||
.name = lib_name,
|
||||
.linkage = .static,
|
||||
.root_module = b.createModule(.{
|
||||
.link_libc = true,
|
||||
.optimize = optimize,
|
||||
.target = target,
|
||||
}),
|
||||
});
|
||||
const shared = if (build_shared)
|
||||
b.addSharedLibrary(artifactOptions(
|
||||
.{ .shared = true },
|
||||
.{ .target = target, .optimize = optimize },
|
||||
))
|
||||
b.addLibrary(.{
|
||||
.name = lib_name ++ "54",
|
||||
.linkage = .dynamic,
|
||||
.root_module = b.createModule(.{
|
||||
.link_libc = true,
|
||||
.optimize = optimize,
|
||||
.target = target,
|
||||
.strip = if (target.result.os.tag == .windows) true else null,
|
||||
}),
|
||||
})
|
||||
else
|
||||
null;
|
||||
const exe = b.addExecutable(artifactOptions(.exe, .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
}));
|
||||
const exec = b.addExecutable(artifactOptions(.exec, .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
}));
|
||||
const exe = b.addExecutable(.{
|
||||
.name = exe_name,
|
||||
.root_module = b.createModule(.{
|
||||
.link_libc = true,
|
||||
.optimize = optimize,
|
||||
.target = target,
|
||||
}),
|
||||
});
|
||||
const exec = b.addExecutable(.{
|
||||
.name = compiler_name,
|
||||
.root_module = b.createModule(.{
|
||||
.link_libc = true,
|
||||
.optimize = optimize,
|
||||
.target = target,
|
||||
}),
|
||||
});
|
||||
if (!target.result.isMinGW()) {
|
||||
lib.linkSystemLibrary("m");
|
||||
exe.linkSystemLibrary("m");
|
||||
|
|
@ -170,64 +188,6 @@ pub fn build(b: *Build) !void {
|
|||
});
|
||||
unpack_step.dependOn(&unpack_cmd.step);
|
||||
}
|
||||
const ArtifactTarget = union(enum) {
|
||||
// True if shared options
|
||||
shared: bool,
|
||||
exe,
|
||||
exec,
|
||||
};
|
||||
const ArtifactTargetOptions = struct {
|
||||
target: ResolvedTarget,
|
||||
optimize: OptimizeMode,
|
||||
};
|
||||
fn artifactOptions(comptime options: ArtifactTarget, opts: ArtifactTargetOptions) switch (options) {
|
||||
.exe, .exec => Build.ExecutableOptions,
|
||||
.shared => |shared| if (shared)
|
||||
Build.SharedLibraryOptions
|
||||
else
|
||||
Build.StaticLibraryOptions,
|
||||
} {
|
||||
const t = opts.target.result.os.tag;
|
||||
return switch (options) {
|
||||
.shared => |shared| if (shared) blk: {
|
||||
switch (t) {
|
||||
.windows => break :blk .{
|
||||
.name = lib_name ++ "54",
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
.strip = true,
|
||||
},
|
||||
else => break :blk .{
|
||||
.name = lib_name,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
},
|
||||
}
|
||||
} else blk: {
|
||||
switch (t) {
|
||||
else => break :blk .{
|
||||
.name = lib_name,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
},
|
||||
}
|
||||
},
|
||||
.exe => switch (t) {
|
||||
else => .{
|
||||
.name = exe_name,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
},
|
||||
},
|
||||
.exec => switch (t) {
|
||||
else => .{
|
||||
.name = compiler_name,
|
||||
.target = opts.target,
|
||||
.optimize = opts.optimize,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const cflags = [_][]const u8{
|
||||
"-std=gnu99",
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
.{
|
||||
.name = .lua,
|
||||
.version = "5.4.7",
|
||||
.version = "5.4.8",
|
||||
.fingerprint = 0xd671372bcadcaace,
|
||||
|
||||
.minimum_zig_version = "0.14.0",
|
||||
.minimum_zig_version = "0.15.0",
|
||||
|
||||
.dependencies = .{
|
||||
.lua = .{
|
||||
.url = "https://www.lua.org/ftp/lua-5.4.7.tar.gz",
|
||||
.hash = "N-V-__8AAIMvFABt-Qcpk24RD10ldEN743D8Q2e19Er8x3dJ",
|
||||
.url = "https://www.lua.org/ftp/lua-5.4.8.tar.gz",
|
||||
.hash = "N-V-__8AAKEzFAAA695b9LXBhUSVK5MAV_VKSm1mEj3Acbze",
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue