build/luarocks: apply "Fix siteconfig" patch

upstream: https://github.com/luarocks/luarocks/pull/774
This commit is contained in:
Justin M. Keyes 2018-03-08 23:57:08 +01:00
parent 496b0f944f
commit 90963a9c55
3 changed files with 35 additions and 5 deletions

View File

@ -50,11 +50,9 @@ endif()
option(USE_EXISTING_SRC_DIR "Skip download of deps sources in case of existing source directory." OFF)
if(WIN32)
find_package(Git)
if(NOT Git_FOUND)
message(FATAL_ERROR "Git is required to apply patches for Windows.")
endif()
find_package(Git)
if(NOT Git_FOUND)
message(FATAL_ERROR "Git is required to apply patches to bundled dependencies")
endif()
if(UNIX)

View File

@ -70,6 +70,10 @@ if(UNIX OR (MINGW AND CMAKE_CROSSCOMPILING))
endif()
BuildLuarocks(
PATCH_COMMAND
${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/luarocks init
COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/luarocks apply
${CMAKE_CURRENT_SOURCE_DIR}/patches/luarocks-Fix-siteconfig.patch
CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/src/luarocks/configure
--prefix=${HOSTDEPS_INSTALL_DIR} --force-config ${LUAROCKS_OPTS}
INSTALL_COMMAND ${MAKE_PRG} bootstrap)

View File

@ -0,0 +1,28 @@
From dad6687372b1568f1543388d5014190a076e388a Mon Sep 17 00:00:00 2001
Date: Thu, 8 Mar 2018 22:50:52 +0100
Subject: [PATCH] Fix site_config
---
src/luarocks/cfg.lua | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index 1d5c9872e205..aa34a4f9748b 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -23,10 +23,10 @@ local version_suffix = cfg.lua_version:gsub("%.", "_")
-- Load site-local global configurations
local ok, site_config = pcall(require, "luarocks.site_config_"..version_suffix)
-if not ok then
+if not ok or type(site_config) ~= "table" then
ok, site_config = pcall(require, "luarocks.site_config")
end
-if not ok then
+if not ok or type(site_config) ~= "table" then
io.stderr:write("Site-local luarocks/site_config.lua file not found. Incomplete installation?\n")
site_config = {}
end
--
2.7.4