YO
Allow me to spin you a short story. If you don’t want the leading up to the problem sweet nothings feel free to skip to “The Problem”.
So I plopped into my work desk today after work and said let’s mess with this interesting idea.
I discovered that he is using luajit
. Ok let’s install that.
Great, I can build it with make
cool.
zig build
→ oop this doesn’t work because make install
for luajit has installed c headers into a different directory than this guys build.zig
expects.
Let’s go the extra mile and try to encapsulate this in zig. Maybe even put in a PR.
I’d like to pull down this c code and therefore have these headers in a guaranteed location. Ok let’s try to do this with .zig.zon
.
The Problem
When I run zig fetch --save https://github.com/LuaJIT/LuaJIT/archive/87ae18af97fd4de790bb6c476b212e047689cc93.tar.gz
I’m greeted with the following error.
error: unable to determine name; fetched package has no build.zig.zon file
Is this intended? Am I to interpret this as zig.zon only being compatible with zig projects?
My goal here is to pull some c files down from a commit and then build with zig. (idk if I want to commit to dealing with actually doing the work of rewriting a complex makefile in zig, but this seems like I’m on a common path here.)
Is the intention that my current path is invalid? Am I doing something incorrect? Is there not a way to pull a repo without a build.zig.zon down?
The Assumed Solution
Ok so if I fork luajit and add a build.zig.zon
the fetch does in fact work. Or it at least updates my dependencies file correctly.
Ok sweet… where are my files. Oh, looks like they are in some cache somewhere. Let’s look through the cache. Oh no, the cache isn’t very legible I don’t know if it’s in the local or global cache. I think it’s meant to be in global? Is it doing some lazy loading or something and it see’s I haven’t actually tried to use it yet and it isn’t actually fetching?
The dreaded potential outcome
Is the only way to use the package manager to actually completely build a project in zig? That can be a heavy lift sometimes.
I’ve found the last 2 projects I’ve considered undertaking this effort for have all been running code generation tooling and that has scared me off.
I’d like to do this if possible.
The beautiful evanescent ideal future
I create a “default starting point” for creating zig extensions for neovim.
Or at least build upon this guy’s current work.