aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV1K1NGbg <victor@ilchev.com>2024-08-15 14:44:10 +0300
committerV1K1NGbg <victor@ilchev.com>2024-08-15 14:44:10 +0300
commit23743dddc7619e728b47e6c765006d0da2a3aa16 (patch)
treecf23451b82c896c4cc372b0e2f5014234caec8bb
parent05d07042bef9b5ed400a5058ac7e4f2886d8d5ee (diff)
downloadluarocks-23743dddc7619e728b47e6c765006d0da2a3aa16.tar.gz
luarocks-23743dddc7619e728b47e6c765006d0da2a3aa16.tar.bz2
luarocks-23743dddc7619e728b47e6c765006d0da2a3aa16.zip
sanity check
-rw-r--r--src/luarocks/build/builtin.lua4
-rw-r--r--src/luarocks/build/builtin.tl4
-rw-r--r--src/luarocks/build/cmake.tl21
-rw-r--r--src/luarocks/core/cfg.d.tl3
-rw-r--r--src/luarocks/core/types/build.d.tl24
5 files changed, 43 insertions, 13 deletions
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua
index 478f45c1..76b50d9f 100644
--- a/src/luarocks/build/builtin.lua
+++ b/src/luarocks/build/builtin.lua
@@ -9,10 +9,8 @@ local builtin = {}
9 9
10 10
11 11
12local Install = i.Install
13 12
14 13
15local Build = b.Build
16 14
17 15
18 16
@@ -240,7 +238,7 @@ function builtin.run(rockspec, no_install)
240 add_flags(extras, "-I%s", incdirs) 238 add_flags(extras, "-I%s", incdirs)
241 return execute(variables.CC .. " " .. variables.CFLAGS, "-I" .. variables.LUA_INCDIR, "-c", source, "-o", object, _tl_table_unpack(extras)) 239 return execute(variables.CC .. " " .. variables.CFLAGS, "-I" .. variables.LUA_INCDIR, "-c", source, "-o", object, _tl_table_unpack(extras))
242 end 240 end
243 compile_library = function(library, objects, libraries, libdirs, name) 241 compile_library = function(library, objects, libraries, libdirs)
244 local extras = { _tl_table_unpack(objects) } 242 local extras = { _tl_table_unpack(objects) }
245 add_flags(extras, "-L%s", libdirs) 243 add_flags(extras, "-L%s", libdirs)
246 if cfg.gcc_rpath then 244 if cfg.gcc_rpath then
diff --git a/src/luarocks/build/builtin.tl b/src/luarocks/build/builtin.tl
index b0857363..2ab688dc 100644
--- a/src/luarocks/build/builtin.tl
+++ b/src/luarocks/build/builtin.tl
@@ -9,10 +9,8 @@ local type Rockspec = r.Rockspec
9 9
10local type i = require("luarocks.core.types.installs") 10local type i = require("luarocks.core.types.installs")
11local type Installs = i.Installs 11local type Installs = i.Installs
12local type Install = i.Install
13 12
14local type b = require("luarocks.core.types.build") 13local type b = require("luarocks.core.types.build")
15local type Build = b.Build
16local type BuiltinBuild = b.BuiltinBuild 14local type BuiltinBuild = b.BuiltinBuild
17local type Module = BuiltinBuild.Module 15local type Module = BuiltinBuild.Module
18 16
@@ -240,7 +238,7 @@ function builtin.run(rockspec: Rockspec, no_install: boolean): boolean, string,
240 add_flags(extras, "-I%s", incdirs) 238 add_flags(extras, "-I%s", incdirs)
241 return execute(variables.CC.." "..variables.CFLAGS, "-I"..variables.LUA_INCDIR, "-c", source, "-o", object, table.unpack(extras)) 239 return execute(variables.CC.." "..variables.CFLAGS, "-I"..variables.LUA_INCDIR, "-c", source, "-o", object, table.unpack(extras))
242 end 240 end
243 compile_library = function (library: string, objects: {string}, libraries: {string}, libdirs: {string}, name: string): boolean, string, string 241 compile_library = function (library: string, objects: {string}, libraries: {string}, libdirs: {string}): boolean, string, string
244 local extras = { table.unpack(objects) } 242 local extras = { table.unpack(objects) }
245 add_flags(extras, "-L%s", libdirs) 243 add_flags(extras, "-L%s", libdirs)
246 if cfg.gcc_rpath then 244 if cfg.gcc_rpath then
diff --git a/src/luarocks/build/cmake.tl b/src/luarocks/build/cmake.tl
index b7a4786e..b0307b08 100644
--- a/src/luarocks/build/cmake.tl
+++ b/src/luarocks/build/cmake.tl
@@ -6,13 +6,21 @@ local fs = require("luarocks.fs")
6local util = require("luarocks.util") 6local util = require("luarocks.util")
7local cfg = require("luarocks.core.cfg") 7local cfg = require("luarocks.core.cfg")
8 8
9local type r = require("luarocks.core.types.rockspec")
10local type Rockspec = r.Rockspec
11
12local type i = require("luarocks.core.types.installs")
13local type Installs = i.Installs
14
15local type b = require("luarocks.core.types.build")
16local type CMakeBuild = b.CMakeBuild
17
9--- Driver function for the "cmake" build back-end. 18--- Driver function for the "cmake" build back-end.
10-- @param rockspec table: the loaded rockspec. 19-- @param rockspec table: the loaded rockspec.
11-- @return boolean or (nil, string): true if no errors occurred, 20-- @return boolean or (nil, string): true if no errors occurred,
12-- nil and an error message otherwise. 21-- nil and an error message otherwise.
13function cmake.run(rockspec, no_install) 22function cmake.run(rockspec: Rockspec, no_install: boolean): boolean, string, string
14 assert(rockspec:type() == "rockspec") 23 local build = rockspec.build as CMakeBuild
15 local build = rockspec.build
16 local variables = build.variables or {} 24 local variables = build.variables or {}
17 25
18 -- Pass Env variables 26 -- Pass Env variables
@@ -28,8 +36,9 @@ function cmake.run(rockspec, no_install)
28 end 36 end
29 37
30 -- If inline cmake is present create CMakeLists.txt from it. 38 -- If inline cmake is present create CMakeLists.txt from it.
31 if type(build.cmake) == "string" then 39 local build_cmake = build.cmake
32 local cmake_handler = assert(io.open(fs.current_dir().."/CMakeLists.txt", "w")) 40 if build_cmake is string then
41 local cmake_handler = assert((io.open(fs.current_dir().."/CMakeLists.txt", "w")))
33 cmake_handler:write(build.cmake) 42 cmake_handler:write(build.cmake)
34 cmake_handler:close() 43 cmake_handler:close()
35 end 44 end
@@ -52,7 +61,7 @@ function cmake.run(rockspec, no_install)
52 return nil, "Failed cmake." 61 return nil, "Failed cmake."
53 end 62 end
54 63
55 local do_build, do_install 64 local do_build, do_install: boolean, boolean
56 if rockspec:format_is_at_least("3.0") then 65 if rockspec:format_is_at_least("3.0") then
57 do_build = (build.build_pass == nil) and true or build.build_pass 66 do_build = (build.build_pass == nil) and true or build.build_pass
58 do_install = (build.install_pass == nil) and true or build.install_pass 67 do_install = (build.install_pass == nil) and true or build.install_pass
diff --git a/src/luarocks/core/cfg.d.tl b/src/luarocks/core/cfg.d.tl
index f87cc1e9..1e03445a 100644
--- a/src/luarocks/core/cfg.d.tl
+++ b/src/luarocks/core/cfg.d.tl
@@ -83,6 +83,9 @@ local record cfg
83 gcc_rpath: boolean 83 gcc_rpath: boolean
84 link_lua_explicitly: boolean 84 link_lua_explicitly: boolean
85 obj_extension: string 85 obj_extension: string
86 -- cmake
87 cmake_generator: string
88 target_cpu: string
86end 89end
87 90
88return cfg \ No newline at end of file 91return cfg \ No newline at end of file
diff --git a/src/luarocks/core/types/build.d.tl b/src/luarocks/core/types/build.d.tl
index 98707c0b..061741bb 100644
--- a/src/luarocks/core/types/build.d.tl
+++ b/src/luarocks/core/types/build.d.tl
@@ -28,10 +28,32 @@ local record build
28 modules: {string: (string | Module)} 28 modules: {string: (string | Module)}
29 end 29 end
30 30
31
32 record CMakeBuild
33 is Build where self.type == "cmake"
34
35 cmake: string
36 variables: {string: string}
37 end
38
39 record CommandBuild
40 is Build where self.type == "command"
41
42 build_command: string
43 install_command: string
44 end
45
31 record MakeBuild 46 record MakeBuild
32 is Build where self.type == "make" 47 is Build where self.type == "make"
33 48
34 makefile: string --! 49 makefile: string
50 build_target: string
51 build_pass: boolean
52 install_target: string
53 install_pass: boolean
54 build_variables: {string} --!
55 install_variables: {string}
56 variables: {string: string}
35 end 57 end
36end 58end
37 59