summaryrefslogtreecommitdiff
path: root/make/install.lua
blob: 4aa544de7c5dcec7bc40b8380d80e29fe8e3c9cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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'

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)

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)
end