-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Expand file tree
/
Copy pathBUILD.luarocks.bazel
More file actions
112 lines (107 loc) · 3.26 KB
/
Copy pathBUILD.luarocks.bazel
File metadata and controls
112 lines (107 loc) · 3.26 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
load("@kong//build:build_system.bzl", "kong_template_genrule")
load("@kong_bindings//:variables.bzl", "KONG_VAR")
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
filegroup(
name = "all_srcs",
srcs = glob(
include = ["**"],
exclude = ["*.bazel"],
),
)
# This rules is used to bootstrap luarocks to install rocks dependencies
# A different rule is used to install luarocks in the release artifact
# so that we got correct interpreter path, lua paths, etc.
configure_make(
name = "luarocks_host",
configure_command = "configure",
configure_in_place = True,
configure_options = [
"--with-lua=$$EXT_BUILD_DEPS/lua",
"--with-lua-include=$$EXT_BUILD_DEPS/lua/include",
],
lib_source = ":all_srcs",
out_bin_dir = "",
out_binaries = ["bin/luarocks"], # fake binary
out_data_dirs = ["luarocks"], # mark all files as data
targets = [
"build",
"install",
],
visibility = ["//visibility:public"],
deps = [
"@lua",
],
)
kong_template_genrule(
name = "luarocks_exec",
srcs = [
"@libexpat",
"@openssl",
] + select({
"@kong//:any-cross": ["@cross_deps_libyaml//:libyaml"],
"//conditions:default": [
"@luarocks//:luarocks_host",
"@openresty//:luajit",
"@lua//:lua",
],
}),
is_executable = True,
output = "luarocks_exec.sh",
substitutions = {
"{{lib_rpath}}": "%s/kong/lib" % KONG_VAR["INSTALL_DESTDIR"],
},
template = "@//build/luarocks:templates/luarocks_exec.sh",
tools = select({
"@kong//:any-cross": [
"@luarocks//:luarocks_host",
"@openresty//:luajit",
"@lua//:lua",
],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
)
kong_template_genrule(
name = "luarocks_make",
srcs = [
"@kong//:rockspec_srcs",
"@luarocks//:luarocks_exec",
"@luarocks//:luarocks_target", # to avoid concurrency issue, run this after luarocks_target
],
is_executable = True,
output = "luarocks_make.log",
progress_message = "Luarocks: Install Kong rocks dependencies",
template = "@//build/luarocks:templates/luarocks_make.sh",
visibility = ["//visibility:public"],
)
# install luarocks itself in target configuration
kong_template_genrule(
name = "luarocks_target",
srcs = [":luarocks_exec"] + select({
"@kong//:any-cross": [],
"//conditions:default": [
"@luarocks//:luarocks_host",
"@openresty//:luajit",
"@lua//:lua",
],
}),
is_executable = True,
output = "luarocks_target.log",
progress_message = "Luarocks: Install luarocks with target configuration",
substitutions = {
"{{install_destdir}}": KONG_VAR["INSTALL_DESTDIR"],
"{{luarocks_version}}": KONG_VAR["LUAROCKS"],
},
template = "@//build/luarocks:templates/luarocks_target.sh",
tools = [
"@//build/luarocks:luarocks_wrap_script.lua",
] + select({
"@//:any-cross": [
"@luarocks//:luarocks_host",
"@openresty//:luajit",
"@lua//:lua",
],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
)