few of us write packages of greater complexity. So it should just be
a matter of replacing the contents of the src directory in the Lua
distribution with one's own stuff and changing some target names.
Apart from the word 'just', luabuild does something like that.
It's a fact of life that (even in the POSIX world) things are different and build scripts need to know the differences. Even if it's just one header, that header can move all over the place and might have a different name (e.g. building against tcl). Lua is blessedly simple in comparison to many packages.