Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove vendored code and update to latest module api #43

Merged
merged 5 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
466 changes: 226 additions & 240 deletions build.zig

Large diffs are not rendered by default.

35 changes: 33 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
.{
.name = "ziglua",
.description = "Zig bindings for the Lua C API",
.version = "0.1.0",
.paths = .{ "" },
.paths = .{""},

.dependencies = .{

// We do not use the lua.org version of Lua 5.1.5 because there is a known security issue
// (CVE-2014-5461) that will not be backported. This is the most resonable solution at
// the moment. Maybe there will be a way to apply a patch with the build system in the
// future.
.lua51 = .{
.url = "https://github.com/natecraddock/lua/archive/refs/tags/5.1.5-1.tar.gz",
.hash = "12203fe1feebb81635f8df5a5a7242733e441fe3f3043989c8e6b4d6720e96988813",
},

.lua52 = .{
.url = "https://www.lua.org/ftp/lua-5.2.4.tar.gz",
.hash = "1220d5b2b39738f0644d9ed5b7431973f1a16b937ef86d4cf85887ef3e9fda7a3379",
},

.lua53 = .{
.url = "https://www.lua.org/ftp/lua-5.3.6.tar.gz",
.hash = "1220937a223531ef6b3fea8f653dc135310b0e84805e7efa148870191f5ab915c828",
},

.lua54 = .{
.url = "https://www.lua.org/ftp/lua-5.4.6.tar.gz",
.hash = "1220f93ada1fa077ab096bf88a5b159ad421dbf6a478edec78ddb186d0c21d3476d9",
},

.luau = .{
.url = "https://github.com/luau-lang/luau/archive/refs/tags/0.607.tar.gz",
.hash = "122003818ff2aa912db37d4bbda314ff9ff70d03d9243af4b639490be98e2bfa7cb6",
},
},
}
53 changes: 0 additions & 53 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,59 +10,6 @@ This documentation provides

Documentation on each individual function is found in the source code.

## Build Documentation

Example `build.zig.zon` file. The hash in the url is the hash of the commit you are using.

```
.{
.name = "myproject",
.version = "0.0.1",
.dependencies = .{
.ziglua = .{
.url = "https://github.com/natecraddock/ziglua/archive/ab111adb06d2d4dc187ee9e1e352617ca8659155.tar.gz",
.hash = "12206cf9e90462ee6e14f593ea6e0802b9fe434429ba10992a1451e32900f741005c",
},
}
}
```

Example usage in `build.zig`.

```zig
pub fn build(b: *std.Build) void {
// ... snip ...

const ziglua = b.dependency("ziglua", .{
.target = target,
.optimize = optimize,
});

// ... snip ...

// add the ziglua module and lua artifact
exe.addModule("ziglua", ziglua.module("ziglua"));
exe.linkLibrary(ziglua.artifact("lua"));

}
```

There are currently two additional options that can be passed to `b.dependency()`:

* `.version`: Set the Lua version to build and embed. Defaults to `.lua_54`. Possible values are `.lua_51`, `.lua_52`, `.lua_53`, and `.lua_54`.
* `.shared`: Defaults to `false` for embedding in a Zig program. Set to `true` to dynamically link the Lua source code (useful for creating shared modules).

For example, here is a `b.dependency()` call that and links against a shared Lua 5.2 library:

```zig
const ziglua = b.dependency("ziglua", .{
.target = target,
.optimize = optimize,
.version = .lua52,
.shared = true,
});
```

## Moving from the C API to Zig

While efforts have been made to keep the Ziglua API similar to the C API, many changes have been made including:
Expand Down
34 changes: 0 additions & 34 deletions lib/lua-5.1/COPYRIGHT

This file was deleted.

128 changes: 0 additions & 128 deletions lib/lua-5.1/Makefile

This file was deleted.

37 changes: 0 additions & 37 deletions lib/lua-5.1/README

This file was deleted.

Loading