summaryrefslogtreecommitdiff
path: root/make
diff options
context:
space:
mode:
authorPeter Young <young40@gmail.com>2019-04-14 21:57:20 +0800
committerPeter Young <young40@gmail.com>2019-04-14 21:57:20 +0800
commit4e06f26edc732ccf0475b817d0a13e1d70b6dc5d (patch)
treeb3442b7b98dba421e9c8006ecbc9c3cd2d01ffa3 /make
parent44fd89dc0e5a41e2922dfd5bb6f8c05eccf9dbea (diff)
downloadlua-language-server-4e06f26edc732ccf0475b817d0a13e1d70b6dc5d.zip
支持macOS
Diffstat (limited to 'make')
-rw-r--r--make/install.lua44
1 files changed, 29 insertions, 15 deletions
diff --git a/make/install.lua b/make/install.lua
index 448c266f..4aa544de 100644
--- a/make/install.lua
+++ b/make/install.lua
@@ -1,27 +1,41 @@
local fs = require 'bee.filesystem'
local sp = require 'bee.subprocess'
+local is_macos = package.cpath:sub(-3) == '.so'
+
local CWD = fs.current_path()
local output = CWD / 'server' / 'bin'
local bindir = CWD / 'build' / 'msvc' / 'bin'
-fs.create_directories(output)
-fs.copy_file(bindir / 'lni.dll', output / 'lni.dll', true)
-fs.copy_file(bindir / 'lpeglabel.dll', output / 'lpeglabel.dll', true)
-fs.copy_file(bindir / 'bee.dll', output / 'bee.dll', true)
-fs.copy_file(bindir / 'lua54.dll', output / 'lua54.dll', true)
-fs.copy_file(bindir / 'lua.exe', output / 'lua-language-server.exe', true)
+local lib_ext = ".dll"
+local exc_ext = ".exe"
+if is_macos then
+ bindir = CWD / 'build' / 'macos' / 'bin'
+ lib_ext = ".so"
+ exc_ext = ""
+end
+
+fs.create_directories(output)
+fs.copy_file(bindir / 'lni'..lib_ext, output / 'lni'..lib_ext, true)
+fs.copy_file(bindir / 'lpeglabel'..lib_ext, output / 'lpeglabel'..lib_ext, true)
+fs.copy_file(bindir / 'bee'..lib_ext, output / 'bee'..lib_ext, true)
+fs.copy_file(bindir / 'lua'..exc_ext, output / 'lua-language-server'..exc_ext, true)
-local process = assert(sp.spawn {
- bindir / 'rcedit.exe',
- output / 'lua-language-server.exe',
- '--set-icon',
- CWD / 'images' / 'icon.ico'
-})
-assert(process:wait())
+if not is_macos then
+ fs.copy_file(bindir / 'lua54'..lib_ext, output / 'lua54'..lib_ext, true)
+end
+if not is_macos then
+ local process = assert(sp.spawn {
+ bindir / 'rcedit.exe',
+ output / 'lua-language-server.exe',
+ '--set-icon',
+ CWD / 'images' / 'icon.ico'
+ })
+ assert(process:wait())
-local msvc_crt = dofile 'make/msvc_crt.lua'
-msvc_crt('x86', output)
+ local msvc_crt = dofile 'make/msvc_crt.lua'
+ msvc_crt('x86', output)
+end