1# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6declare_args() {
7  skia_use_system_lua = is_official_build
8}
9
10import("../third_party.gni")
11
12if (skia_use_system_lua) {
13  system("lua") {
14    libs = [ "lua" ]
15  }
16} else {
17  third_party("lua") {
18    public_include_dirs = [ "../externals/lua" ]
19
20    sources = [
21      "../externals/lua/lapi.c",
22      "../externals/lua/lauxlib.c",
23      "../externals/lua/lbaselib.c",
24      "../externals/lua/lbitlib.c",
25      "../externals/lua/lcode.c",
26      "../externals/lua/lcorolib.c",
27      "../externals/lua/lctype.c",
28      "../externals/lua/ldblib.c",
29      "../externals/lua/ldebug.c",
30      "../externals/lua/ldo.c",
31      "../externals/lua/ldump.c",
32      "../externals/lua/lfunc.c",
33      "../externals/lua/lgc.c",
34      "../externals/lua/linit.c",
35      "../externals/lua/liolib.c",
36      "../externals/lua/llex.c",
37      "../externals/lua/lmathlib.c",
38      "../externals/lua/lmem.c",
39      "../externals/lua/loadlib.c",
40      "../externals/lua/lobject.c",
41      "../externals/lua/lopcodes.c",
42      "../externals/lua/loslib.c",
43      "../externals/lua/lparser.c",
44      "../externals/lua/lstate.c",
45      "../externals/lua/lstring.c",
46      "../externals/lua/lstrlib.c",
47      "../externals/lua/ltable.c",
48      "../externals/lua/ltablib.c",
49      "../externals/lua/ltm.c",
50      "../externals/lua/lundump.c",
51      "../externals/lua/lutf8lib.c",
52      "../externals/lua/lvm.c",
53      "../externals/lua/lzio.c",
54    ]
55
56    if (!is_win) {
57      # Prefer mkstemp() over tmpnam().  This isn't super important,
58      # but it does stifle an annoying GNU linker warning.
59      defines = [ "LUA_USE_POSIX=1" ]
60    }
61  }
62}
63