I'm creating a Neovim plugin with the nvim_oxi crate.
It builds a C dynamic library that can be loaded and used by Neovim's Lua API.
cargo generates a cdylib artifact named libexample.so for example, but I want to remove the lib prefix because when I call require("example") in Lua, it looks for example.so, not libexample.so.
If I want to do something like this, is it common practice to write a shell script that wraps cargo build? Or does Cargo support something like a post-build hook, or a way to set the artifact name for a cdylib?
Is there a way to get the file path of the artifact generated by cargo build, so that I can rename it? (Ideally, the method should work for both debug and release builds.)
alternatively, you can tell lua to search for libexample.so by modifying package.cpath, for example, append './lib?.so' to the default value:
package.cpath = package.cpath .. ';./lib?.so'
local example = require 'example'
using scripts to automate project specific tasks is very common. for example, you can create a release.sh script in the project root directory like this: