This commit is contained in:
cannoli-fruit 2026-06-30 01:43:59 -04:00
commit f4d69b664c
9 changed files with 494 additions and 0 deletions

57
bldit.lua Normal file
View file

@ -0,0 +1,57 @@
bldit_version = "1.1.3"
package_version = "1.1.3"
dependencies = {}
exec_name = "ray"
targets = {
default = {
build = function()
e,h,c = os.execute("rm -fr build")
if c ~= 0 and c ~= nil then
print("Build Error")
print("GIVEN UP")
return c
end
e,h,c = os.execute("mkdir build")
if c ~= 0 and c ~= nil then
print("Build Error")
print("GIVEN UP")
return c
end
cmd = [[find src -type f -name "*.c" -print]]
p = io.popen(cmd)
assert(p, "File detection error, GIVEN UP")
for f in p:lines() do
base = f:match("([^/]+)%.c$")
obj = "build/"..base..".o"
cc = "cc -c '"..f.."' -o '"..obj.."'"
e,h,c = os.execute(cc)
if c ~= 0 and c ~= nil then
print("Compilation Error")
print("GIVEN UP")
return c
end
end
p:close()
libs = "-lm"
e,h,c = os.execute("cc build/*.o "..libs.." -o "..exec_name)
if c ~= 0 and c ~= nil then
print("Compilation Error")
print("GIVEN UP")
return c
end
return 0
end,
install = function()
e,h,c = os.execute("cp "..exec_name.." /bin")
return c or 0
end,
uninstall = function()
e,h,c = os.execute("rm /bin"..exec_name)
return c or 0
end,
}
}