Reputation: 1463
Following this example, I've just created a rockspec for a rock with just .lua files. I don't need to build anything, so I set the build option to
build = {
type = "none",
install = {
lua = {
"a.lua",
"b.lua",
...
}
}
}
When I run luarocks make
it works. However, I noticed that all the files are dumped into my /home/<username>/torch/install/share/lua/5.1/
directory. I'd like for them to be in ../share/lua/5.1/<package_name>
directory. I tried doing something like
lua = {
["<package_name>"] = "a.lua",
...
or
lua = {
["<package_name>.<package_name>"] = "a.lua",
...
but neither method works.
Is there a way to put these files in a directory in the rockspec?
Upvotes: 2
Views: 340
Reputation: 4271
It's easy using the builtin
build mode of rockspecs:
-- ...
build = {
type = "builtin",
modules = {
["mypackage.a"] = "a.lua",
["mypackage.b"] = "b.lua"
}
}
This should install a.lua
as .../share/lua/5.1/mypackage/a.lua
and b.lua
as .../share/lua/5.1/mypackage/b.lua
, so that require("mypackage.a")
(or require("mypackage.b")
) just works.
Upvotes: 4