build(lua): add rockspec

This commit is contained in:
əlemi 2024-09-10 13:57:50 +02:00
parent 65721f3e6a
commit 95c9897b10
Signed by: alemi
GPG key ID: A4895B84D311642C
4 changed files with 51 additions and 19 deletions

20
dist/lua/README.md vendored
View file

@ -8,20 +8,12 @@ This is important because Lua looks up the constructor symbol based on filename.
Type hints are provided in `annotations.lua`, just include them in your language server: `---@module 'annotations'`.
## Example loader
A simple loader is provided here:
## LuaRocks
`codemp` is available as a rock on [LuaRocks](https://luarocks.org/modules/alemi/codemp)
```lua
---@module 'annotations'
## Manual bundling
LuaRocks compiles from source, which only works if have the rust toolchain available. To provide a reasonable NeoVim experience, we provide pre-built binaries.
---@return Codemp
local function load()
local native, _ = require("codemp.native")
return native
end
return {
load = load,
}
```
> Download latest build and annotations from [here](https://codemp.dev/releases/lua/)
You will need a loader file to provide annotations: you can use provided `codemp.lua`

5
dist/lua/build.sh vendored
View file

@ -1,5 +0,0 @@
#!/bin/sh
cd ../..
cargo build --release --features=lua
mv ./target/release/libcodemp.so ./dist/lua/codemp_native.so

40
dist/lua/codemp-0.0.1-1.rockspec vendored Normal file
View file

@ -0,0 +1,40 @@
package = "codemp"
version = "0.0.1-1"
source = {
-- url = "git+https://github.com/hexedtech/codemp",
url = "git+file:///home/alemi/source/work/codemp/lib",
branch = "ci",
}
dependencies = {
"Lua >= 5.1",
"luarocks-build-rust-mlua",
}
description = {
summary = "code multiplexer -- lua bindings",
detailed = [[
codemp is a cooperative live editing framework by hexed.technology
it provides a batteries-included CRDT-powered client capable of keeping
in sync local buffers and sharing cursor event to all workspace members.
this is a native lua library, completely written in Rust
]],
homepage = "https://code.mp",
license = "GPL-3.0",
-- labels = { "codemp", "cooperative", "ffi", "editor", "rust" },
maintainer = "alemi <me@alemi.dev>",
}
build = {
type = "rust-mlua",
modules = {
["codemp_native"] = "codemp",
},
target_path = "../..",
include = {
"codemp.lua",
"annotations.lua",
}
}

5
dist/lua/codemp.lua vendored Normal file
View file

@ -0,0 +1,5 @@
---@module 'annotations'
---@type Codemp
local native = require('codemp.native')
return native