diff options
Diffstat (limited to 'make')
-rw-r--r-- | make/bootstrap.lua | 38 | ||||
-rw-r--r-- | make/install.lua | 12 |
2 files changed, 38 insertions, 12 deletions
diff --git a/make/bootstrap.lua b/make/bootstrap.lua new file mode 100644 index 00000000..2bbd64f0 --- /dev/null +++ b/make/bootstrap.lua @@ -0,0 +1,38 @@ +local i = 1
+while true do
+ if arg[i] == '-E' then
+ elseif arg[i] == '-e' then
+ i = i + 1
+ local expr = assert(arg[i], "'-e' needs argument")
+ assert(load(expr, "=(command line)"))()
+ else
+ break
+ end
+ i = i + 1
+end
+
+if arg[i] == nil then
+ return
+end
+
+for j = -1, #arg do
+ arg[j - i] = arg[j]
+end
+for j = #arg - i + 1, #arg do
+ arg[j] = nil
+end
+
+local root; do
+ local sep = package.config:sub(1,1)
+ local pattern = "["..sep.."][^"..sep.."]+"
+ root = package.cpath:match("(.+)"..pattern..pattern..pattern.."$")
+end
+
+local fs = require "bee.filesystem"
+fs.current_path(fs.path(root))
+
+package.path = table.concat({
+ root .. "/script/?.lua",
+ root .. "/script/?/init.lua",
+}, ";")
+assert(loadfile(arg[0]))(table.unpack(arg))
diff --git a/make/install.lua b/make/install.lua index e8078770..c7f3b3a1 100644 --- a/make/install.lua +++ b/make/install.lua @@ -1,20 +1,8 @@ -local builddir = ... local fs = require 'bee.filesystem' local pf = require 'bee.platform' - local CWD = fs.current_path() local output = CWD / 'bin' / pf.OS -local bindir = CWD / builddir / 'bin' -local exe = pf.OS == 'Windows' and ".exe" or "" -local dll = pf.OS == 'Windows' and ".dll" or ".so" -local OVERWRITE = fs.copy_options.overwrite_existing - -fs.create_directories(output) -fs.copy_file(bindir / 'lpeglabel'..dll, output / 'lpeglabel'..dll, OVERWRITE) -fs.copy_file(bindir / 'bee'..dll, output / 'bee'..dll, OVERWRITE) -fs.copy_file(bindir / 'lua'..exe, output / 'lua-language-server'..exe, OVERWRITE) if pf.OS == 'Windows' then - fs.copy_file(bindir / 'lua54'..dll, output / 'lua54'..dll, OVERWRITE) require 'msvc'.copy_vcrt('x64', output) end |