made the build system capable of self-hosting

This commit is contained in:
Izaya 2017-07-31 13:04:44 +10:00
parent 838ed0fcc2
commit 0fe7982c45
4 changed files with 37 additions and 3 deletions

16
build.cfg Executable file
View File

@ -0,0 +1,16 @@
modules/debug/log.lua
modules/base/header.lua
modules/base/component.lua
modules/lib/fs.lua
modules/lib/buffer.lua
modules/lib/io.lua
modules/drivers/tty.lua
modules/lib/print.lua
modules/drivers/kbd.lua
modules/drivers/net.lua
modules/lib/readline.lua
modules/applications/luash.lua
modules/applications/genkernel.lua
modules/setup.lua
modules/base/footer.lua

3
genkernel.lua Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env lua
require "modules/applications/genkernel"
print(genkernel(...))

View File

@ -1,4 +1,2 @@
#!/bin/bash #!/bin/bash
echo "_OSVERSION=\"PsychOS $(git rev-parse HEAD | head -c 8)\"" ./genkernel.lua build.cfg "$(git rev-parse --short HEAD)" > kernel.lua
echo "_BD=\"$(date '+%Y/%m/%d %H:%M %z')\""
cat modules/debug/log.lua modules/base/header.lua modules/base/component.lua modules/lib/fs.lua modules/lib/buffer.lua modules/lib/io.lua modules/drivers/tty.lua modules/lib/print.lua modules/drivers/kbd.lua modules/drivers/net.lua modules/lib/readline.lua modules/applications/luash.lua modules/setup.lua modules/base/footer.lua

View File

@ -0,0 +1,17 @@
function genkernel(modlistf,kname)
local nk,f = "",io.open(modlistf,"rb")
nk=nk.."_OSVERSION=\"PsychOS "..(kname or "unknown").."\"\n"
nk=nk.."_BD=\""..os.date("%Y/%m/%d %H:%M %z").."\"\n"
local c=f:read("*a")
f:close()
n=1
for line in c:gmatch("[^\r\n]+") do
n=n+1
f=io.open(line,"rb")
if f then
nk=nk..f:read("*a")
f:close()
end
end
return nk
end