view share/lua/5.2/luarocks/build/command.lua @ 5034:4bcb3e18525b

<mroman_> learn chuchich\xc3\xa4schtli is spoken as \xcb\x88\xcf\x87\xca\x8a\xcf\x87\xcb\x90i\xcb\x8c\xcf\x87\xc3\xa6\xca\x83\xcb\x90tli
author HackBot
date Wed, 08 Oct 2014 12:43:38 +0000
parents d137f631bad5
children
line wrap: on
line source


--- Build back-end for raw listing of commands in rockspec files.
module("luarocks.build.command", package.seeall)

local fs = require("luarocks.fs")
local util = require("luarocks.util")

--- Driver function for the "command" build back-end.
-- @param rockspec table: the loaded rockspec.
-- @return boolean or (nil, string): true if no errors ocurred,
-- nil and an error message otherwise.
function run(rockspec)
   assert(type(rockspec) == "table")

   local build = rockspec.build
   
   util.variable_substitutions(build, rockspec.variables)
   
   if build.build_command then
      util.printout(build.build_command)
      if not fs.execute(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
         return nil, "Failed installing."
      end
   end
   return true
end