-
Notifications
You must be signed in to change notification settings - Fork 18
/
install.lua
42 lines (36 loc) · 997 Bytes
/
install.lua
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
--- Lake script to install script wrappers in bin
local exec, join = utils.execute, path.join
if arg[1] or LUA53 then
lua = 'lua53'
soar = 'soar53'
print 'installing Lua 5.3'
else
lua = 'lua52'
soar = 'soar52'
end
-- some platform-dependent swearing...
if WINDOWS then
bat_ext, all_args, shebang = '.bat',' %*', '@echo off\n'
else
bat_ext, all_args, shebang = '',' $*','#!/bin/sh\n'
end
local function bin_dir(f) return join('bin',f) end
local function make_wrapper(target,exe,name)
if not name then
local _
_, name = path.splitpath(target)
name = path.splitext(name)
end
target = path.abs(target)
if not exe then
exe = path.abs(bin_dir(lua))
end
local wrap = bin_dir (name)..bat_ext
file.write(wrap,shebang..exe..' '..target..all_args..'\n')
if not WINDOWS then
exec('chmod +x '..wrap)
end
end
make_wrapper ('tools/soar.lua')
make_wrapper ('tools/srlua.lua','lake')
make_wrapper 'lake'