xmake-io / luarocks-build-xmake

A luarocks build module based on xmake
https://xmake.io
Apache License 2.0
18 stars 1 forks source link

xmake backend will not copy lua code to lua directory `~/.local/share/lua` #2

Closed Freed-Wu closed 1 week ago

Freed-Wu commented 2 months ago

Xmake Version

2.9.4

Operating System Version and Architecture

NixOS

Describe Bug

For other backend, they will copy lua/* to luarocks's lua path such as ~/.local/share/lua. However, xmake only copy output/lib/*.so to luarocks's lib path such as ~/.local/lib/lua.

Expected Behavior

Like cmake backend. Such as:

rock_manifest = {
   ["cppinsights.nvim-scm-1.rockspec"] = "c1f48bdca17fa78cd5d3cd378b05271c",
   ftplugin = {
      ["cpp.lua"] = "e27626c1430f38ce6d98e2d092492369"
   },
   lib = {
      ["cppinsights.so"] = "13dbf183489c9e68972b905d9ce481e3"
   },
   lua = {
      cppinsights = {
         ["config.lua"] = "f03e71a515e4542cd8a38ac7a41c0654",
         nvim = {
            ["init.lua"] = "49071491749b746a3fed35a1e3a2db95"
         }
      }
   }
}

However, xmake will:

rock_manifest = {
   after = {
      plugin = {
         ["rime.lua"] = "cadf152f7b5fb43e2a96c8e500297aa0"
      }
   },
   lib = {
      ["rime.so"] = "6fd5e32362b3b68d86d1af39064d52bf"
   },
   ["rime.nvim-scm-1.rockspec"] = "22a0addcf7d0580cecd8c82912b269bf"
}

Miss lua directory.

Project Configuration

Refer https://github.com/Freed-Wu/rime.nvim

Additional Information and Error Logs

-

Freed-Wu commented 2 months ago

Now we have two methods:

  1. Modify upstream's code. Add
    local luadir = path.lua_dir(rockspec.name, rockspec.version)
    fs.copy_contents("lua", luadir)

to

~/.local/share/lua/5.1/luarocks/build/xmake.lua

  1. Add build.install.lua to downstream's code.

Weird: use build.modules to install lua files cannot work. Maybe another bug?