1
0
mirror of https://github.com/Adorable-Catgirl/Zorya-NEO.git synced 2024-11-14 22:38:07 +11:00
Zorya-NEO/release.lua

51 lines
2.1 KiB
Lua
Raw Normal View History

2020-01-09 15:01:35 +11:00
--Makes a release CPIO
2020-01-15 12:07:27 +11:00
local start = os.time()
function status(s)
io.stderr:write(s.."\n")
end
status("Cleaning last build...")
2020-01-09 15:01:35 +11:00
os.execute("rm -rf pkg")
2020-03-22 16:27:43 +11:00
os.execute("rm -rf release")
2020-01-15 12:07:27 +11:00
status("Making directories...")
2020-01-09 15:01:35 +11:00
os.execute("mkdir -p pkg/mods")
os.execute("mkdir -p pkg/lib")
os.execute("mkdir -p pkg/bios")
2020-03-22 16:27:43 +11:00
os.execute("mkdir -p release")
2020-01-15 12:07:27 +11:00
status("Building EEPROM...")
2020-01-09 15:01:35 +11:00
os.execute("luacomp src/loader.lua -O pkg/bios/managed.bios")
2020-03-19 08:02:05 +11:00
os.execute("luacomp src/zy-neo/zinit.lua -O debug.lua")
2020-01-15 12:07:27 +11:00
if (os.execute("[[ $(stat --printf=%s pkg/bios/managed.bios) > 4096 ]]")) then
io.stderr:write("WARNING: BIOS is over 4KiB!\n")
end
status("\n\nBuilding modules.")
2020-01-09 15:01:35 +11:00
if (os.execute("stat mods 1>/dev/null 2>&1")) then
for l in io.popen("ls mods"):lines() do
2020-01-15 12:07:27 +11:00
status("MOD\t"..l)
2020-04-11 01:38:52 +10:00
if (os.execute("stat mods/"..l.."/.nomin 1>/dev/null 2>&1")) then
os.execute("sh -c 'cd mods/"..l.."; luacomp -mnone init.lua | lua ../../utils/zlua.lua > ../../pkg/mods/"..l..".zy2m'")
else
os.execute("sh -c 'cd mods/"..l.."; luacomp -mluamin init.lua | lua ../../utils/zlua.lua > ../../pkg/mods/"..l..".zy2m'")
end
2020-01-09 15:01:35 +11:00
end
end
2020-01-15 12:07:27 +11:00
status("Module build complete.\n\nBuilding libraries.")
2020-01-09 15:01:35 +11:00
if (os.execute("stat lib 1>/dev/null 2>&1")) then
for l in io.popen("ls lib"):lines() do
2020-01-15 12:07:27 +11:00
status("LIB\t"..l)
2020-03-13 08:01:05 +11:00
os.execute("sh -c 'cd lib/"..l.."; luacomp -mluamin init.lua | lua ../../utils/zlua.lua > ../../pkg/lib/"..l..".zy2l'")
2020-01-09 15:01:35 +11:00
end
end
2020-01-15 12:07:27 +11:00
status("Library build complete.\n\nBuilding installer...")
2020-01-09 15:01:35 +11:00
os.execute("cp utils/ser.lua pkg/init.lua")
os.execute("cp -r installer_dat pkg")
2020-01-15 12:07:27 +11:00
status("Packing installer...")
2020-03-22 16:27:43 +11:00
os.execute("cd pkg; find * -depth | lua ../utils/make_tsar.lua | lua ../utils/mkselfextract.lua > ../release/zorya-neo-installer.lua")
2020-03-20 07:50:37 +11:00
status("Making OpenOS util installer...")
2020-03-22 16:27:43 +11:00
os.execute("cd util; find * -depth | lua ../utils/make_tsar.lua | lua ../utils/mkselfextract.lua > ../release/zorya-neo-utils-installer.lua")
print("Making update tsar...")
os.execute("cd pkg; find bios lib mods -depth | lua ../utils/make_tsar.lua > ../release/zorya-neo-update.tsar")
2020-01-15 12:07:27 +11:00
status("Build complete.")
status(string.format("Took %ds.", os.time()-start))