OC-Tsuki/.buildactions/11_kernel.lua
Jane Roxanne e44d6177a0 kio++
2020-06-02 01:14:26 -05:00

50 lines
1.3 KiB
Lua

local TSUKI_RELEASE = "0.0.1"
local tz = os.date("%z")
tz = tz:sub(1, 3)..":"..tz:sub(4)
local TSUKI_VERSION = "Lua 5.3 "..os.date("%Y-%m-%dT%H:%M:%S")..tz
local TSUKI_TARGET = os.getenv("TSUKI_TARGET") or "OC"
function actions.kernel(dbg)
os.execute("mkdir -p build/kernel")
print("Compiling kernel...")
local h = io.open("build/kernel/tkrnl.velx", "wb")
h:write(velx_multistep("ksrc/init.lua", ".doc", {
TSUKI_RELEASE = TSUKI_RELEASE,
TSUKI_VERSION = TSUKI_VERSION,
TSUKI_TARGET = TSUKI_TARGET,
PRINT_DMESG_LEVEL = ((dbg and 0) or 1)
}, {
precomp = function()
print("Compiling kernel...")
end,
postcomp = function(krnl)
os.execute("mkdir .doc")
local h = io.open("build/kernel/debug.lua", "w")
h:write(krnl)
h:close()
print("Generating docs and stripping comments...")
h = io.popen("lua utils/gendocs.lua .doc 2>.ktmp", "w")
h:write(krnl)
h:close()
h = io.open(".ktmp", "rb")
local data = h:read("*a")
h:close()
os.execute("rm -rf .ktmp")
return data
end,
prearc = function()
print("Storing docs...")
end,
postarc = function()
os.execute("rm -rf .doc")
end,
prez = function()
print("Compressing kernel...")
end,
postz = function()
print("Writing kernel out...")
end
}))
end
actions[#actions+1] = "kernel"