1# Copyright (c) 2009-2021, Google LLC
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are met:
6#     * Redistributions of source code must retain the above copyright
7#       notice, this list of conditions and the following disclaimer.
8#     * Redistributions in binary form must reproduce the above copyright
9#       notice, this list of conditions and the following disclaimer in the
10#       documentation and/or other materials provided with the distribution.
11#     * Neither the name of Google LLC nor the
12#       names of its contributors may be used to endorse or promote products
13#       derived from this software without specific prior written permission.
14#
15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18# DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY
19# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26package(
27    default_visibility = ["//visibility:public"],
28)
29
30cc_library(
31    name = "liblua_headers",
32    hdrs = [
33        "src/lauxlib.h",
34        "src/lua.h",
35        "src/lua.hpp",
36        "src/luaconf.h",
37        "src/lualib.h",
38    ],
39    defines = ["LUA_USE_LINUX"],
40    includes = ["src"],
41)
42
43cc_library(
44    name = "liblua",
45    srcs = [
46        "src/lapi.c",
47        "src/lapi.h",
48        "src/lauxlib.c",
49        "src/lauxlib.h",
50        "src/lbaselib.c",
51        "src/lbitlib.c",
52        "src/lcode.c",
53        "src/lcode.h",
54        "src/lcorolib.c",
55        "src/lctype.c",
56        "src/lctype.h",
57        "src/ldblib.c",
58        "src/ldebug.c",
59        "src/ldebug.h",
60        "src/ldo.c",
61        "src/ldo.h",
62        "src/ldump.c",
63        "src/lfunc.c",
64        "src/lfunc.h",
65        "src/lgc.c",
66        "src/lgc.h",
67        "src/linit.c",
68        "src/liolib.c",
69        "src/llex.c",
70        "src/llex.h",
71        "src/llimits.h",
72        "src/lmathlib.c",
73        "src/lmem.c",
74        "src/lmem.h",
75        "src/loadlib.c",
76        "src/lobject.c",
77        "src/lobject.h",
78        "src/lopcodes.c",
79        "src/lopcodes.h",
80        "src/loslib.c",
81        "src/lparser.c",
82        "src/lparser.h",
83        "src/lstate.c",
84        "src/lstate.h",
85        "src/lstring.c",
86        "src/lstring.h",
87        "src/lstrlib.c",
88        "src/ltable.c",
89        "src/ltable.h",
90        "src/ltablib.c",
91        "src/ltm.c",
92        "src/ltm.h",
93        "src/lundump.c",
94        "src/lundump.h",
95        "src/lvm.c",
96        "src/lvm.h",
97        "src/lzio.c",
98        "src/lzio.h",
99    ],
100    hdrs = [
101        "src/lauxlib.h",
102        "src/lua.h",
103        "src/lua.hpp",
104        "src/luaconf.h",
105        "src/lualib.h",
106    ],
107    defines = ["LUA_USE_LINUX"],
108    includes = ["src"],
109    linkopts = [
110        "-lm",
111        "-ldl",
112    ],
113)
114
115cc_binary(
116    name = "lua",
117    srcs = [
118        "src/lua.c",
119    ],
120    linkopts = [
121        "-lreadline",
122        "-rdynamic",
123    ],
124    deps = [
125        ":liblua",
126    ],
127)
128