2020-08-22 10:39:15 +00:00
#!/bin/sh
mkdir -p dist
rm -r dist/*
cp src/polychoron.lua dist/startup
cp -r src/xlib/ dist
cp -r src/signing-key.tbl dist
cp -r src/LICENSES dist
2021-01-29 23:33:15 +00:00
cp -r src/stdlib.hvl dist
2020-08-22 10:39:15 +00:00
cp -r src/bin/ dist
cp src/potatobios.lua dist/
2021-03-31 18:58:54 +00:00
npx luabundler bundle src/main.lua -p "src/lib/?.lua" | perl -pe 'chomp if eof' > dist/autorun_full.lua
WORK = $( pwd )
cd ./minify
2022-02-20 14:32:14 +00:00
lua5.1 CommandLineMinify.lua " $WORK /dist/autorun_full.lua " " $WORK /dist/autorun.lua " " $WORK /dist/autorun.lua.map "
lua5.1 CommandLineMinify.lua " $WORK /dist/potatobios.lua " " $WORK /dist/pb_tmp.lua " " $WORK /dist/potatobios.lua.map "
2021-03-31 18:58:54 +00:00
mv " $WORK /dist/pb_tmp.lua " " $WORK /dist/potatobios.lua "
cd " $WORK "
rm dist/autorun_full.lua
2020-08-22 10:39:15 +00:00
sed -i '19iif _G.package and _G.package.loaded[package] then loadedModule = _G.package.loaded[package] end if _G.package and _G.package.preload[package] then local pkg = _G.package.preload[package](_G.package) _G.package.loaded[package] = pkg loadedModule = pkg end' dist/autorun.lua
echo -n "(...)" >> dist/autorun.lua
./generate_manifest.py " $@ "