build system on MultICE cleanup

This commit is contained in:
Izaya 2017-06-26 12:49:56 +00:00
parent df6d6257f9
commit d5f77ef8c9
2 changed files with 17 additions and 5 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env lua5.2 --#!/usr/bin/env lua5.2
-- Initialization -- Initialization
log = "" log = ""
prefix=""
oldprint=print oldprint=print
function print(...) function print(...)
oldprint(...) oldprint(...)
@ -26,24 +27,32 @@ for k,v in ipairs(tA) do
cfgfile = v:sub(11) cfgfile = v:sub(11)
elseif v:sub(1,10) == "--modfile=" then elseif v:sub(1,10) == "--modfile=" then
modfile = v:sub(11) modfile = v:sub(11)
elseif v:sub(1,9) == "--prefix=" then
prefix=v:sub(10)
print("Prefix is: "..prefix)
end end
end end
end end
ss="" ss=""
cfgfile = cfgfile or "build.cfg" cfgfile = cfgfile or "build.cfg"
modfile = modfile or "modules.cfg" modfile = modfile or "modules.cfg"
cfgfile=prefix..cfgfile
modfile=prefix..modfile
cfg={} cfg={}
f=io.open(cfgfile,"rb") f=io.open(cfgfile,"rb")
repeat repeat
line = f:read("*l") line = f:read("*l")
print(line)
if line ~= nil then if line ~= nil then
w={} w={}
for wo in line:gmatch("%S+") do table.insert(w, wo) end for wo in line:gmatch("%S+") do table.insert(w, wo) end
cfg[w[1]] = w[2] cfg[w[1] or ""] = w[2] or ""
end end
until line == nil or line == "" until line == nil or line == ""
cfg.opath = cfg.opath or "kernel.lua" cfg.opath = cfg.opath or "kernel.lua"
cfg.ospath = cfg.ospath or "skernel.lua" cfg.ospath = cfg.ospath or "skernel.lua"
cfg.opath = prefix .. cfg.opath
cfg.ospath = prefix .. cfg.ospath
print() print()
-- Module list -- Module list
print("Reading modules to load") print("Reading modules to load")
@ -63,7 +72,7 @@ print(tostring(#tm).." modules to load.\n")
print("Loading modules") print("Loading modules")
for k,v in ipairs(tm) do for k,v in ipairs(tm) do
print(" - "..v.." - modules/"..v) print(" - "..v.." - modules/"..v)
f=io.open("modules/"..v,"rb") f=io.open(prefix.."modules/"..v,"rb")
if cfg.optimise == "yes" then if cfg.optimise == "yes" then
data = f:read("*a") data = f:read("*a")
else else
@ -92,7 +101,7 @@ for k,v in pairs(ts) do
ss=ss..v ss=ss..v
io.write(".") io.write(".")
end end
print() print("")
-- Output -- Output
print("Outputting to "..cfg.opath) print("Outputting to "..cfg.opath)
@ -125,7 +134,7 @@ end
-- Write log -- Write log
if cfg.log == "yes" then if cfg.log == "yes" then
f=io.open("build.log","wb") f=io.open(prefix.."build.log","wb")
f:write(log) f:write(log)
f:close() f:close()
end end

View File

@ -29,4 +29,7 @@ applications/skex2.lua
applications/luash.lua applications/luash.lua
applications/ircbridge.lua applications/ircbridge.lua
applications/autoluash.lua applications/autoluash.lua
util/build-wrapper-h.lua
util/build.lua
util/build-wrapper-e.lua
base/footer.lua base/footer.lua