mirror of
https://github.com/allyourcodebase/lua.git
synced 2026-05-01 11:17:58 +02:00
Compare commits
5 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5a5a4135cb | ||
|
|
0b43bb0279 | ||
|
|
75b67d3cae | ||
|
|
7697bec841 | ||
|
|
56b987be70 |
3 changed files with 26 additions and 27 deletions
|
|
@ -1,9 +1,6 @@
|
||||||
# Lua
|
# Lua
|
||||||
## 5.4.7
|
## 5.4.7
|
||||||
|
|
||||||
## Warning
|
|
||||||
due to a bug in the 0.13.0 release of the zig compiler you will need the development version of zig in order to build the lua54.dll on windows.
|
|
||||||
|
|
||||||
## Build Instructions
|
## Build Instructions
|
||||||
To build all targets run
|
To build all targets run
|
||||||
```sh
|
```sh
|
||||||
|
|
@ -35,5 +32,5 @@ const lua_dep = b.dependency("lua", .{
|
||||||
.target = target,
|
.target = target,
|
||||||
.release = optimize != .Debug,
|
.release = optimize != .Debug,
|
||||||
});
|
});
|
||||||
const lua_lib = lua_dep.artifact("lua");
|
const lua_lib = lua_dep.artifact(if (target.result.os.tag == .windows) "lua54" else "lua");
|
||||||
```
|
```
|
||||||
|
|
|
||||||
40
build.zig
40
build.zig
|
|
@ -19,17 +19,17 @@ pub fn build(b: *Build) !void {
|
||||||
const build_shared = b.option(bool, "shared", "build as shared library") orelse target.result.isMinGW();
|
const build_shared = b.option(bool, "shared", "build as shared library") orelse target.result.isMinGW();
|
||||||
const use_readline =
|
const use_readline =
|
||||||
if (target.result.os.tag == .linux)
|
if (target.result.os.tag == .linux)
|
||||||
b.option(bool, "use_readline", "readline support for linux") orelse false
|
b.option(bool, "use_readline", "readline support for linux") orelse false
|
||||||
else
|
else
|
||||||
null;
|
null;
|
||||||
|
|
||||||
const lua_src = b.dependency("lua", .{});
|
const lua_src = b.dependency("lua", .{});
|
||||||
|
|
||||||
const lib =
|
const lib =
|
||||||
b.addStaticLibrary(artifactOptions(
|
b.addStaticLibrary(artifactOptions(
|
||||||
.{ .shared = false },
|
.{ .shared = false },
|
||||||
.{ .target = target, .optimize = optimize },
|
.{ .target = target, .optimize = optimize },
|
||||||
));
|
));
|
||||||
const shared = if (build_shared)
|
const shared = if (build_shared)
|
||||||
b.addSharedLibrary(artifactOptions(
|
b.addSharedLibrary(artifactOptions(
|
||||||
.{ .shared = true },
|
.{ .shared = true },
|
||||||
|
|
@ -65,44 +65,44 @@ pub fn build(b: *Build) !void {
|
||||||
t.addIncludePath(lua_src.path("src"));
|
t.addIncludePath(lua_src.path("src"));
|
||||||
switch (target.result.os.tag) {
|
switch (target.result.os.tag) {
|
||||||
.aix => {
|
.aix => {
|
||||||
t.defineCMacro("LUA_USE_POSIX", null);
|
t.root_module.addCMacro("LUA_USE_POSIX", "");
|
||||||
t.defineCMacro("LUA_USE_DLOPEN", null);
|
t.root_module.addCMacro("LUA_USE_DLOPEN", "");
|
||||||
t.linkSystemLibrary("dl");
|
t.linkSystemLibrary("dl");
|
||||||
},
|
},
|
||||||
.freebsd, .netbsd, .openbsd => {
|
.freebsd, .netbsd, .openbsd => {
|
||||||
t.defineCMacro("LUA_USE_LINUX", null);
|
t.root_module.addCMacro("LUA_USE_LINUX", "");
|
||||||
t.defineCMacro("LUA_USE_READLINE", null);
|
t.root_module.addCMacro("LUA_USE_READLINE", "");
|
||||||
t.addIncludePath(.{ .cwd_relative = "/usr/include/edit" });
|
t.addIncludePath(.{ .cwd_relative = "/usr/include/edit" });
|
||||||
t.linkSystemLibrary("edit");
|
t.linkSystemLibrary("edit");
|
||||||
},
|
},
|
||||||
.ios => {
|
.ios => {
|
||||||
t.defineCMacro("LUA_USE_IOS", null);
|
t.root_module.addCMacro("LUA_USE_IOS", "");
|
||||||
},
|
},
|
||||||
.linux => {
|
.linux => {
|
||||||
t.defineCMacro("LUA_USE_LINUX", null);
|
t.root_module.addCMacro("LUA_USE_LINUX", "");
|
||||||
t.linkSystemLibrary("dl");
|
t.linkSystemLibrary("dl");
|
||||||
if (use_readline.?) {
|
if (use_readline.?) {
|
||||||
t.defineCMacro("LUA_USE_READLINE", null);
|
t.root_module.addCMacro("LUA_USE_READLINE", "");
|
||||||
t.linkSystemLibrary("readline");
|
t.linkSystemLibrary("readline");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.macos => {
|
.macos => {
|
||||||
t.defineCMacro("LUA_USE_MACOSX", null);
|
t.root_module.addCMacro("LUA_USE_MACOSX", "");
|
||||||
t.defineCMacro("LUA_USE_READLINE", null);
|
t.root_module.addCMacro("LUA_USE_READLINE", "");
|
||||||
t.linkSystemLibrary("readline");
|
t.linkSystemLibrary("readline");
|
||||||
},
|
},
|
||||||
.solaris => {
|
.solaris => {
|
||||||
t.defineCMacro("LUA_USE_POSIX", null);
|
t.root_module.addCMacro("LUA_USE_POSIX", "");
|
||||||
t.defineCMacro("LUA_USE_DLOPEN", null);
|
t.root_module.addCMacro("LUA_USE_DLOPEN", "");
|
||||||
t.defineCMacro("_REENTRANT", null);
|
t.root_module.addCMacro("_REENTRANT", "");
|
||||||
t.linkSystemLibrary("dl");
|
t.linkSystemLibrary("dl");
|
||||||
},
|
},
|
||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (target.result.isMinGW()) {
|
if (target.result.isMinGW()) {
|
||||||
lib.defineCMacro("LUA_BUILD_AS_DLL", null);
|
lib.root_module.addCMacro("LUA_BUILD_AS_DLL", "");
|
||||||
exe.defineCMacro("LUA_BUILD_AS_DLL", null);
|
exe.root_module.addCMacro("LUA_BUILD_AS_DLL", "");
|
||||||
}
|
}
|
||||||
if (shared) |s| {
|
if (shared) |s| {
|
||||||
s.addCSourceFiles(.{
|
s.addCSourceFiles(.{
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
.{
|
.{
|
||||||
.name = "lua",
|
.name = .lua,
|
||||||
|
|
||||||
.version = "5.4.7",
|
.version = "5.4.7",
|
||||||
|
.fingerprint = 0xd671372bcadcaace,
|
||||||
|
|
||||||
|
.minimum_zig_version = "0.14.0",
|
||||||
|
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.lua = .{
|
.lua = .{
|
||||||
.url = "https://www.lua.org/ftp/lua-5.4.7.tar.gz",
|
.url = "https://www.lua.org/ftp/lua-5.4.7.tar.gz",
|
||||||
.hash = "12206df90729936e110f5d2574437be370fc4367b5f44afcc77749ac421547bc8ff0",
|
.hash = "N-V-__8AAIMvFABt-Qcpk24RD10ldEN743D8Q2e19Er8x3dJ",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue