forked from LuaDist/lzlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lakefile
63 lines (52 loc) · 1.55 KB
/
lakefile
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
PROJECT = 'zlib'
IF=choose
J=path.join
if LUA_VER == '5.3' then
LUA_NEED = 'lua53'
LUA_DIR = ENV.LUA_DIR_5_3 or ENV.LUA_DIR
LUA_RUNNER = 'lua53'
elseif LUA_VER == '5.2' then
LUA_NEED = 'lua52'
LUA_DIR = ENV.LUA_DIR_5_2 or ENV.LUA_DIR
LUA_RUNNER = 'lua52'
else
LUA_NEED = 'lua'
LUA_DIR = ENV.LUA_DIR
LUA_RUNNER = 'lua'
end
DYNAMIC = DYNAMIC or false
ZLIB_NEED = IF(DYNAMIC, 'zlib-static-md', 'zlib-static-mt')
INSTALL_DIR = INSTALL_DIR or J(LUA_DIR,'libs',PROJECT)
build = c.shared{PROJECT,
-- base = 'src',
src = '*.c',
needs = { LUA_NEED, ZLIB_NEED },
dynamic = DYNAMIC,
strip = true,
defines = IF(MSVC, "STRUCT_INT=__int64"),
libflags = IF(MSVC, "/EXPORT:luaopen_" .. PROJECT),
}
target('build', build)
install = target('install', {
file.group{odir=J(INSTALL_DIR, 'share');src = build };
file.group{odir=J(INSTALL_DIR, 'share');src = 'gzip.lua' };
file.group{odir=J(INSTALL_DIR, 'test'); src = 'test_*.lua'};
})
local function run(file, cwd)
print()
print("run " .. file)
if not TESTING then
if cwd then lake.chdir(cwd) end
os.execute( LUA_RUNNER .. ' ' .. file )
if cwd then lake.chdir("<") end
print()
end
end
target('test', install, function()
local test_dir = J(INSTALL_DIR,'test')
run(J(test_dir,'test_zlib3.lua'), test_dir)
run(J(test_dir,'test_zlib2.lua'), test_dir)
run(J(test_dir,'test_prologue.lua'), test_dir)
run(J(test_dir,'test_gzip.lua'), test_dir)
run(J(test_dir,'test_crc32.lua'), test_dir)
end)