Skip to content

Commit

Permalink
ADD a option to specified custom CFLAGS on install.
Browse files Browse the repository at this point in the history
APIcast has a issue that a custom CFLAGS need to be sent to gcc, in
luarocks we can use:

```
luarocks install XXX CFLAGS="XX"
```

But in this case we can't, so I added this new env variable to be able
to set custom CFLAGS

Signed-off-by: Eloy Coto <[email protected]>
  • Loading branch information
eloycoto committed Mar 2, 2020
1 parent 8039201 commit f97f5ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/rover/cli/install.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ local function format_status(status)
end

function mt:__call(options)
install.set_extra_cflags(os.getenv("EXTRA_CFLAGS"))
local lock = options.roverfile .. '.lock'
local lockfile = assert(rover_lock.read(lock))

Expand Down
8 changes: 8 additions & 0 deletions src/rover/install.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local next = next

local fs = require('luarocks.fs')
local build = require("luarocks.build")
local cfg = require("luarocks.cfg")
local repos = require("luarocks.repos")
local search = require('luarocks.search')

Expand Down Expand Up @@ -80,6 +81,13 @@ local function should_install(dep, desired_groups)
return false
end

function _M.set_extra_cflags(flag)
if not flag then
return
end

cfg.variables.CFLAGS = cfg.variables.CFLAGS .. " " .. flag
end

function _M:call(lock, force, groups)
local status = {}
Expand Down

0 comments on commit f97f5ff

Please sign in to comment.