From 754b69b88f8f1053e6452261e30cae9e10ca122c Mon Sep 17 00:00:00 2001 From: actboy168 Date: Sat, 2 Oct 2021 12:40:35 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BC=96=E8=AF=91=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- make/bootstrap.lua | 38 ++++++++++++++++++++++++++++++++++++++ make/install.lua | 12 ------------ 2 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 make/bootstrap.lua (limited to 'make') 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 -- cgit v1.2.3