-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static build #GSoC #712
base: master
Are you sure you want to change the base?
Static build #GSoC #712
Conversation
@@ -389,17 +390,18 @@ end | |||
-- @return boolean or (nil, string, exitcode): True if build was successful; nil and an | |||
-- error message otherwise. exitcode is optionally returned. | |||
function build.command(flags, name, version) | |||
local deps_mode = deps.get_deps_mode(flags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this line you can also pass deps_mode
directly to manif.check_dependencies
below.
--- Driver function for the builtin build back-end. | ||
-- @param rockspec table: the loaded rockspec. | ||
-- @param flags table: the flags table passed to run() drivers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This annotation seems to be in the wrong commit.
@@ -49,7 +49,8 @@ To install rocks, you'll normally want to use the "install" and | |||
]] | |||
|
|||
--- Driver function for "make" command. | |||
-- @param name string: A local rockspec. | |||
-- @param flags table: the flags table passed to run() drivers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Annotation change in wrong commit?
src/luarocks/build/builtin.lua
Outdated
local extras = {} | ||
add_flags(extras, "-D%s", defines, variables) | ||
add_flags(extras, "-I%s", incdirs, variables) | ||
return execute(variables.CC.." "..variables.CFLAGS, "-I"..variables.LUA_INCDIR, "-c", source, "-o", object, unpack(extras)) | ||
end | ||
if flags["static"] then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can create this function unconditionally. Only the calling of it needs to be conditional on flags
.
Also, any idea on why the Travis build failed? |
Could be a bug in the relatively recently released LuaJIT 2.1.0-beta3. |
Yes. there is a bug in lua-cjson that makes it incompatible with the latest luajit 2.1. It's a known issues that can be ignored. LuaJIT/LuaJIT#325 |
end | ||
local ok = compile_object(object, source, info.defines, info.incdirs) | ||
if not ok then | ||
return nil, "Failed compiling object "..object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, build_objects
can return nil
and error message, but callers do not check it, causing an error later when nil
is used instead of objects
array, like in the travis failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I add control of nil
objects before calling build_objects
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it should be after build_objects
. Just like build_objects
catches that compile_object
can return nil
and propagates the error, builtin.run
should check if build_objects
returned nil
and handle it.
@daurnimator right. Tweaking |
4279a20
to
dd7a061
Compare
src/luarocks/static_flags.lua
Outdated
|
||
if #rockspec.dependencies > 0 then | ||
for _, dep in ipairs(rockspec.dependencies) do | ||
if not dep.name:match("lua$") then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be recursive. i.e. we also need flags of dependencies of dependencies ....... of dependencies
17de702
to
2f7341a
Compare
7ec7652
to
f5843c2
Compare
src/luarocks/static_flags.lua
Outdated
if not fs.exists(lib_name) then | ||
return nil, "Library ".. lib_name .." is missing. Verify location of library or create it with 'luarocks make --static <module>'." | ||
end | ||
table.insert(libs_table, "luarocks-"..module_name..".a") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use lib_name
here?
647422c
to
051b392
Compare
e237af3
to
0477604
Compare
LuaRocks currently builds Lua modules as dynamic libraries. The aim of this PR is to add support for building static libraries and create new command
static_flags
to list all dependencies (static libs with specific flags) for module. Idea of this project is by @daurnimator and was implemented as a part of Google Summer of Code internship. #GSoChttps://summerofcode.withgoogle.com/projects/#5735758504656896