Skip to content

Commit

Permalink
feat: don't depend on luarocks-build-rust-mlua
Browse files Browse the repository at this point in the history
This uses a Makefile instead.
Using `luarocks-build-rust-mlua` has some downsides:

- Users have to install it (this seems to cause problems on some
  systems), even if they are pulling the binary rock.
  This is because luarocks doesn't have a separate
  `build_dependencies` table.
- On the GitHub Actions Windows runner, luarocks fails to build
  this with `luarocks-build-rust-mlua`.
  I don't know if this is an issue for Windows in general, but
  this might fix it.
  • Loading branch information
mrcjkb authored and vhyrro committed Mar 3, 2024
1 parent 34f072d commit 0df05df
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

build:
ifeq ($(findstring "/5.1",$(INST_LIBDIR)),)
cargo build --release --features lua51
else ifeq ($(findstring "/5.2",$(INST_LIBDIR)),)
cargo build --release --features lua52
else ifeq ($(findstring "/5.3",$(INST_LIBDIR)),)
cargo build --release --features lua53
else ifeq ($(findstring "/5.4",$(INST_LIBDIR)),)
cargo build --release --features lua54
endif

install:
mkdir -p $(INST_LIBDIR)
@if [ -f target/release/libtoml_edit.so ]; then cp target/release/libtoml_edit.so $(INST_LIBDIR)/toml_edit.so; fi
@if [ -f target/release/libtoml_edit.dylib ]; then cp target/release/libtoml_edit.dylib $(INST_LIBDIR)/toml_edit.dylib; fi
@if [ -f target/release/libtoml_edit.dll ]; then cp target/release/libtoml_edit.dll $(INST_LIBDIR)/toml_edit.dll; fi
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,5 @@ luarocks make --tree=luarocks
luarocks test
```

> [!NOTE]
>
> You may need to `luarocks install --local luarocks-build-rust-mlua`.
[luarocks-shield]: https://img.shields.io/luarocks/v/neorg/toml-edit?logo=lua&color=purple&style=for-the-badge
[luarocks-url]: https://luarocks.org/modules/neorg/toml-edit
1 change: 0 additions & 1 deletion nix/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
};
nativeCheckInputs = with luaself;
[
luarocks-build-rust-mlua
busted
]
++ oa.nativeCheckInputs;
Expand Down
9 changes: 4 additions & 5 deletions toml-edit-dev-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ description = {

dependencies = {
"lua >= 5.1",
"luarocks-build-rust-mlua",
}

test_dependencies = {
"lua >= 5.1",
"luarocks-build-rust-mlua",
}

build = {
type = "rust-mlua",
modules = {
"toml_edit"
type = "make",
install_variables = {
INST_PREFIX='$(PREFIX)',
INST_LIBDIR='$(LIBDIR)',
},
}

0 comments on commit 0df05df

Please sign in to comment.