File tree Expand file tree Collapse file tree 7 files changed +86
-8
lines changed
Expand file tree Collapse file tree 7 files changed +86
-8
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ configure_make(
3232 ],
3333 visibility = ["//visibility:public"],
3434 deps = [
35- "@openresty//:luajit",
35+ "@lua",
36+ "@openresty//:luajit", # still need luajit for headers
3637 ],
3738)
3839
@@ -46,6 +47,7 @@ kong_template_genrule(
4647 "//conditions:default": [
4748 "@luarocks//:luarocks_host",
4849 "@openresty//:luajit",
50+ "@lua//:lua",
4951 ],
5052 }),
5153 is_executable = True,
@@ -58,6 +60,7 @@ kong_template_genrule(
5860 "@kong//:any-cross": [
5961 "@luarocks//:luarocks_host",
6062 "@openresty//:luajit",
63+ "@lua//:lua",
6164 ],
6265 "//conditions:default": [],
6366 }),
@@ -86,6 +89,7 @@ kong_template_genrule(
8689 "//conditions:default": [
8790 "@luarocks//:luarocks_host",
8891 "@openresty//:luajit",
92+ "@lua//:lua",
8993 ],
9094 }),
9195 is_executable = True,
@@ -102,6 +106,7 @@ kong_template_genrule(
102106 "@//:any-cross": [
103107 "@luarocks//:luarocks_host",
104108 "@openresty//:luajit",
109+ "@lua//:lua",
105110 ],
106111 "//conditions:default": [],
107112 }),
Original file line number Diff line number Diff line change 1+ load ("@bazel_skylib//rules:build_test.bzl" , "build_test" )
2+
3+ exports_files (
4+ [
5+ "BUILD.lua.bazel" ,
6+ ],
7+ visibility = ["//visibility:public" ],
8+ )
9+
10+ build_test (
11+ name = "build" ,
12+ targets = [
13+ "@lua//:lua" ,
14+ ],
15+ visibility = ["//:__pkg__" ],
16+ )
Original file line number Diff line number Diff line change 1+ load("@kong_bindings//:variables.bzl", "KONG_VAR")
2+ load("@rules_foreign_cc//foreign_cc:defs.bzl", "make")
3+
4+ filegroup(
5+ name = "all_srcs",
6+ srcs = glob(
7+ include = ["**"],
8+ exclude = ["*.bazel"],
9+ ),
10+ )
11+
12+ make(
13+ name = "lua",
14+ args = select({
15+ "@platforms//os:macos": [
16+ "AR=/usr/bin/ar",
17+ ],
18+ "//conditions:default": [
19+ ],
20+ }),
21+ lib_source = ":all_srcs",
22+ out_binaries = [
23+ "lua",
24+ ],
25+ targets = [
26+ "-j" + KONG_VAR["NPROC"],
27+ "install INSTALL_TOP=$$INSTALLDIR",
28+ ],
29+ visibility = ["//visibility:public"],
30+ )
31+
32+ filegroup(
33+ name = "lua_dir",
34+ srcs = [
35+ ":lua",
36+ ],
37+ output_group = "gen_dir",
38+ )
Original file line number Diff line number Diff line change 1+ """A module defining the third party dependency LUA"""
2+
3+ load ("@bazel_tools//tools/build_defs/repo:http.bzl" , "http_archive" )
4+ load ("@bazel_tools//tools/build_defs/repo:utils.bzl" , "maybe" )
5+ load ("@kong_bindings//:variables.bzl" , "KONG_VAR" )
6+
7+ def lua_repositories ():
8+ maybe (
9+ http_archive ,
10+ name = "lua" ,
11+ build_file = "//build/luarocks/lua:BUILD.lua.bazel" ,
12+ strip_prefix = "lua-5.4.7" ,
13+ sha256 = "9fbf5e28ef86c69858f6d3d34eccc32e911c1a28b4120ff3e84aaa70cfbf1e30" ,
14+ urls = [
15+ "https://www.lua.org/ftp/lua-5.4.7.tar.gz" ,
16+ ],
17+ )
Original file line number Diff line number Diff line change 11"""A module defining the third party dependency luarocks"""
22
33load ("@bazel_tools//tools/build_defs/repo:http.bzl" , "http_archive" )
4+ load ("//build/luarocks/lua:lua_repositories.bzl" , "lua_repositories" )
45load ("@kong_bindings//:variables.bzl" , "KONG_VAR" )
56
67def luarocks_repositories ():
8+ lua_repositories ()
9+
710 version = KONG_VAR ["LUAROCKS" ]
811
912 http_archive (
Original file line number Diff line number Diff line change @@ -5,8 +5,7 @@ libexpat_path="{{@@libexpat//:libexpat}}"
55libxml2_path=" invalid"
66openssl_path=" {{@@openssl//:openssl}}"
77luarocks_host_path=" {{@@luarocks//:luarocks_host}}"
8- luajit_path=" {{@@openresty//:luajit}}"
9- kongrocks_path=" invalid"
8+ lua_path=" {{@@lua//:lua}}"
109cross_deps_libyaml_path=" {{@@cross_deps_libyaml//:libyaml}}"
1110CC={{CC}}
1211LD={{LD}}
@@ -88,7 +87,7 @@ variables = {
8887
8988LUAROCKS_HOST=$luarocks_host_path
9089
91- host_luajit =$root_path /$luajit_path /bin/luajit
90+ host_lua =$root_path /$lua_path /bin/lua
9291
9392cat << EOF > $@
9493LIB_RPATH=$LIB_RPATH
114113# force the interpreter here instead of invoking luarocks directly,
115114# some distros has BINPRM_BUF_SIZE smaller than the shebang generated,
116115# which is usually more than 160 bytes
117- $host_luajit $root_path /$LUAROCKS_HOST /bin/luarocks \$ private_rocks_args \$ @ \\
116+ $host_lua $root_path /$LUAROCKS_HOST /bin/luarocks \$ private_rocks_args \$ @ \\
118117 OPENSSL_DIR=$OPENSSL_DIR \\
119118 CRYPTO_DIR=$OPENSSL_DIR \\
120119 EXPAT_DIR=$EXPAT_DIR \\
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ install_destdir="{{install_destdir}}"
66build_destdir=" {{build_destdir}}"
77
88luarocks_exec=" {{@@luarocks//:luarocks_exec}}"
9- luajit_path =" {{@@openresty //:luajit }}"
9+ lua_path =" {{@@lua //:lua }}"
1010luarocks_host_path=" {{@@luarocks//:luarocks_host}}"
1111luarocks_wrap_script=" {{@@//build/luarocks:luarocks_wrap_script.lua}}"
1212# template variables ends
@@ -19,7 +19,7 @@ $luarocks_exec install "luarocks $luarocks_version"
1919
2020# use host configuration to invoke luarocks API to wrap a correct bin/luarocks script
2121rocks_tree=$( dirname $luarocks_exec ) /luarocks_tree
22- host_luajit= $luajit_path /bin/luajit
22+ host_lua= $lua_path /bin/lua
2323
2424host_luarocks_tree=$luarocks_host_path
2525export LUA_PATH=" $build_destdir /share/lua/5.1/?.lua;$build_destdir /share/lua/5.1/?/init.lua;$host_luarocks_tree /share/lua/5.1/?.lua;$host_luarocks_tree /share/lua/5.1/?/init.lua;;"
@@ -32,7 +32,7 @@ rocks_trees = {
3232EOF
3333export LUAROCKS_CONFIG=$ROCKS_CONFIG
3434
35- $host_luajit $luarocks_wrap_script \
35+ $host_lua $luarocks_wrap_script \
3636 luarocks $rocks_tree $install_destdir > $@ .tmp 2>&1
3737
3838# write the luarocks config with host configuration
You can’t perform that action at this time.
0 commit comments