From 1c2fe8bad11a343c63e658cf43dcbf30c930eec5 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Sun, 24 Jun 2018 19:13:40 -0300 Subject: command: auto-export some standard variables --- src/luarocks/build/command.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/luarocks/build/command.lua b/src/luarocks/build/command.lua index 23d6d80d..2a581a39 100644 --- a/src/luarocks/build/command.lua +++ b/src/luarocks/build/command.lua @@ -4,6 +4,7 @@ local command = {} local fs = require("luarocks.fs") local util = require("luarocks.util") +local cfg = require("luarocks.core.cfg") --- Driver function for the "command" build back-end. -- @param rockspec table: the loaded rockspec. @@ -15,16 +16,22 @@ function command.run(rockspec) local build = rockspec.build util.variable_substitutions(build, rockspec.variables) - + + local env = { + CC = cfg.variables.CC, + LD = cfg.variables.LD, + CFLAGS = cfg.variables.CFLAGS, + } + if build.build_command then util.printout(build.build_command) - if not fs.execute(build.build_command) then + if not fs.execute_env(env, build.build_command) then return nil, "Failed building." end end if build.install_command then util.printout(build.install_command) - if not fs.execute(build.install_command) then + if not fs.execute_env(env, build.install_command) then return nil, "Failed installing." end end -- cgit v1.2.3-55-g6feb