diff options
-rw-r--r-- | src/luarocks/build/command.tl (renamed from src/luarocks/build/command.lua) | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/luarocks/build/command.lua b/src/luarocks/build/command.tl index b0c4aa79..10f8bb94 100644 --- a/src/luarocks/build/command.lua +++ b/src/luarocks/build/command.tl | |||
@@ -1,23 +1,33 @@ | |||
1 | 1 | ||
2 | local type Build = require("luarocks.core.types.build").Build | ||
3 | |||
2 | --- Build back-end for raw listing of commands in rockspec files. | 4 | --- Build back-end for raw listing of commands in rockspec files. |
3 | local command = {} | 5 | local record command |
6 | record CommandBuild | ||
7 | is Build where self.type == "command" | ||
8 | |||
9 | build_command: string | ||
10 | install_command: string | ||
11 | end | ||
12 | end | ||
4 | 13 | ||
5 | local fs = require("luarocks.fs") | 14 | local fs = require("luarocks.fs") |
6 | local util = require("luarocks.util") | 15 | local util = require("luarocks.util") |
7 | local cfg = require("luarocks.core.cfg") | 16 | local cfg = require("luarocks.core.cfg") |
8 | 17 | ||
18 | local type Rockspec = require("luarocks.core.types.rockspec").Rockspec | ||
19 | |||
9 | --- Driver function for the "command" build back-end. | 20 | --- Driver function for the "command" build back-end. |
10 | -- @param rockspec table: the loaded rockspec. | 21 | -- @param rockspec table: the loaded rockspec. |
11 | -- @return boolean or (nil, string): true if no errors occurred, | 22 | -- @return boolean or (nil, string): true if no errors occurred, |
12 | -- nil and an error message otherwise. | 23 | -- nil and an error message otherwise. |
13 | function command.run(rockspec, not_install) | 24 | function command.run(rockspec: Rockspec, not_install: boolean): boolean, string, string |
14 | assert(rockspec:type() == "rockspec") | ||
15 | 25 | ||
16 | local build = rockspec.build | 26 | local build = rockspec.build as command.CommandBuild |
17 | 27 | ||
18 | util.variable_substitutions(build, rockspec.variables) | 28 | util.variable_substitutions(build as {string: string}, rockspec.variables) |
19 | 29 | ||
20 | local env = { | 30 | local env: {string: string} = { |
21 | CC = cfg.variables.CC, | 31 | CC = cfg.variables.CC, |
22 | --LD = cfg.variables.LD, | 32 | --LD = cfg.variables.LD, |
23 | --CFLAGS = cfg.variables.CFLAGS, | 33 | --CFLAGS = cfg.variables.CFLAGS, |