summaryrefslogtreecommitdiff
path: root/make/install.lua
blob: 8d6e6764062a1d68da943ea9ac12119e81979bbe (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
local platform = ...
local fs = require 'bee.filesystem'
local sp = require 'bee.subprocess'
local pf = require 'bee.platform'

local CWD = fs.current_path()
local output = CWD / 'server' / pf.OS / 'bin'
local bindir = CWD / 'build' / platform / 'bin'
local exe = platform == 'msvc' and ".exe" or ""
local dll = platform == 'msvc' and ".dll" or ".so"

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 / 'lua'..exe, output / 'lua-language-server'..exe, true)

local bootstrap = CWD / "3rd" / "bee.lua" / "bootstrap"
fs.copy_file(bootstrap / "main.lua",      CWD / 'build' / "main.lua",   true)
fs.copy_file(bindir / ('bee'..dll),       CWD / 'build' / ('bee'..dll), true)
fs.copy_file(bindir / ('bootstrap'..exe), CWD / 'build' / ('lua'..exe), true)
if platform == 'msvc' then
    fs.copy_file(bindir / 'lua54.dll',    CWD / 'build' / 'lua54.dll',  true)
end

if platform == 'msvc' then
    fs.copy_file(bindir / 'lua54'..dll, output / 'lua54'..dll, true)
    require 'msvc'.copy_crtdll('x64', output)

    local process = assert(sp.spawn {
        bindir / 'rcedit.exe',
        output / 'lua-language-server.exe',
        '--set-icon',
        CWD / 'images' / 'icon.ico'
    })
    assert(process:wait())
end