Skip to content

Commit 8ed66e2

Browse files
committed
fix(luarocks): rely on luarocks wrapping for luarocks package
1 parent eb66d4b commit 8ed66e2

4 files changed

Lines changed: 25 additions & 28 deletions

File tree

.github/rockspec.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ build = {
3636
copy_directories = $copy_directories,
3737
build_variables = {
3838
LUA_INCDIR="$(LUA_INCDIR)",
39+
LIBFLAG="$(LIBFLAG)",
3940
},
4041
install_variables = {
42+
WRAP = "false",
4143
LIBDIR="$(LIBDIR)",
4244
BINDIR="$(BINDIR)",
4345
LUADIR="$(LUADIR)",

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,16 @@ ifdef LUADIR
100100
endif
101101
ifdef BINDIR
102102
@mkdir -p "$(BINDIR)";
103+
ifneq ($(WRAP),false)
103104
ifeq ($(filter /%,$(LUA)),)
104105
@echo '$(FIX_SHEBANG)' | $(LUA) - "/usr/bin/env $(LUA)" "$(abspath $(LIBDIR))" > "$(BINDIR)/tomlua"
105106
else
106107
@echo '$(FIX_SHEBANG)' | $(LUA) - "$(LUA)" "$(abspath $(LIBDIR))" > "$(BINDIR)/tomlua"
107108
endif
108109
@cat "$(SRC)/bin/tomlua" >> "$(BINDIR)/tomlua";
110+
else
111+
@cat "$(SRC)/bin/tomlua" > "$(BINDIR)/tomlua";
112+
endif
109113
@chmod +x "$(BINDIR)/tomlua";
110114
@echo "Installed binary to $(BINDIR)";
111115
endif

flake.nix

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,33 @@
2626
};
2727
APPNAME = "tomlua";
2828
overlay = final: prev: let
29-
luaCallPackageFn = { toLuaModule, lua, }:
30-
toLuaModule (lua.stdenv.mkDerivation (finalAttrs: {
29+
luaCallPackageFn = { buildLuarocksPackage, }:
30+
buildLuarocksPackage {
3131
pname = APPNAME;
32-
version = "${(finalAttrs.passthru.luaModule or lua).luaversion}.dev";
32+
version = "scm-1";
3333
src = self;
3434
doCheck = false;
35-
__structuredAttrs = true;
36-
strictDeps = true;
37-
propagatedBuildInputs = [ (finalAttrs.passthru.luaModule or lua) ];
38-
env = {
39-
LUA = (finalAttrs.passthru.luaModule or lua).interpreter;
40-
LUA_INC = (finalAttrs.passthru.luaModule or lua) + "/include";
41-
BINDIR = placeholder "out" + "/bin";
42-
LIBDIR = placeholder "out" + "/lib/lua/" + (finalAttrs.passthru.luaModule or lua).luaversion;
43-
LUADIR = placeholder "out" + "/share/lua/" + (finalAttrs.passthru.luaModule or lua).luaversion;
44-
LIBFLAG = if (finalAttrs.passthru.luaModule or lua).stdenv.isDarwin then "-bundle -undefined dynamic_lookup" else "-shared";
45-
};
35+
checkPhase = ''
36+
runHook preCheck
37+
runHook postCheck
38+
'';
39+
installCheckPhase = ''
40+
runHook preInstallCheck
41+
make test
42+
runHook postInstallCheck
43+
'';
44+
postConfigure = ''
45+
chmod +w "$rockspecFilename"
46+
echo "deploy = { wrap_bin_scripts = false, }" >> "$rockspecFilename"
47+
'';
4648
meta = {
4749
mainProgram = "tomlua";
4850
maintainers = [ lib.maintainers.birdee ];
4951
license = lib.licenses.mit;
5052
homepage = "https://github.com/BirdeeHub/tomlua";
5153
description = "Speedy toml parsing for lua, implemented in C";
5254
};
53-
}));
55+
};
5456
# lua5_1 = prev.lua5_1.override { packageOverrides };
5557
l_pkg_main = builtins.mapAttrs (
5658
n: _: (prev.lib.attrByPath [ n "override" ] null prev) {

tomlua-scm-1.rockspec

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ build = {
2121
type = "make",
2222
build_variables = {
2323
LUA_INCDIR="$(LUA_INCDIR)",
24+
LIBFLAG="$(LIBFLAG)",
2425
},
2526
install_variables = {
27+
WRAP = "false",
2628
LIBDIR="$(LIBDIR)",
2729
BINDIR="$(BINDIR)",
2830
LUADIR="$(LUADIR)",
@@ -33,16 +35,3 @@ test = {
3335
type = "command",
3436
command = "make test",
3537
}
36-
37-
-- How do I specify CFLAGS -O3 and maybe -flto here?
38-
-- build = {
39-
-- type = "builtin",
40-
-- modules = {
41-
-- tomlua = {
42-
-- "./src/tomlua.c",
43-
-- "./src/decode.c",
44-
-- "./src/encode.c",
45-
-- "./src/dates.c",
46-
-- },
47-
-- }
48-
-- }

0 commit comments

Comments
 (0)