From ea35a6cd96aaabe899ad7e140f5ad2af33bbca86 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Sun, 23 Oct 2016 02:39:16 +0300 Subject: luarocks: move most of the patch to config.lua See https://github.com/keplerproject/luarocks/pull/491#issuecomment-246206471 --- plugins/luarocks/luarocks-1-fixes.patch | 55 --------------------------------- plugins/luarocks/luarocks.mk | 49 +++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 55 deletions(-) diff --git a/plugins/luarocks/luarocks-1-fixes.patch b/plugins/luarocks/luarocks-1-fixes.patch index 346f77a..1d6d28f 100644 --- a/plugins/luarocks/luarocks-1-fixes.patch +++ b/plugins/luarocks/luarocks-1-fixes.patch @@ -25,16 +25,6 @@ diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 1111111..2222222 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua -@@ -120,6 +120,9 @@ elseif system and system:match("^MINGW") then - cfg.platforms.windows = true - cfg.platforms.mingw32 = true - cfg.platforms.win32 = true -+elseif system and system:match("^MXE") then -+ cfg.platforms.unix = true -+ cfg.platforms.mxe = true - else - cfg.platforms.unix = true - -- Fall back to Unix in unknown systems. @@ -137,6 +140,7 @@ local platform_order = { linux = 7, macosx = 8, @@ -43,48 +33,3 @@ index 1111111..2222222 100644 -- Windows win32 = 10, mingw32 = 11, -@@ -509,6 +513,44 @@ if cfg.platforms.unix then - defaults.web_browser = "xdg-open" - end - -+if cfg.platforms.mxe then -+ local MXE_ROOT, MXE_TARGET = -+ assert(site_config.LUAROCKS_PREFIX:match('^(.*)/usr/([^/]+)$')) -+ defaults.lib_extension = "dll" -+ defaults.external_lib_extension = "dll" -+ defaults.obj_extension = "obj" -+ defaults.external_deps_dirs = { site_config.LUAROCKS_PREFIX } -+ defaults.arch = "mxe-" .. MXE_TARGET -+ defaults.platforms = {"unix", "mxe"} -+ -- LUA_INCDIR and LUA_LIBDIR are defined in site_config.lua -+ defaults.variables.LUA_BINDIR = site_config.LUAROCKS_PREFIX .. "/bin" -+ defaults.cmake_generator = "Unix Makefiles" -+ defaults.variables.MAKE = os.getenv("MAKE") -+ defaults.variables.CMAKE = MXE_ROOT .. "/usr/bin/" .. MXE_TARGET .. "-cmake" -+ defaults.variables.CC = MXE_ROOT .. "/usr/bin/" .. MXE_TARGET .. "-gcc" -+ defaults.variables.LD = defaults.variables.CC -+ defaults.variables.CFLAGS = "-O2" -+ defaults.variables.LIBFLAG = "-shared" -+ defaults.variables.LUALIB = "liblua.dll.a" -+ -+ defaults.export_path = "SET PATH=%s" -+ defaults.export_path_separator = ";" -+ defaults.export_lua_path = "SET LUA_PATH=%s" -+ defaults.export_lua_cpath = "SET LUA_CPATH=%s" -+ defaults.wrapper_suffix = ".bat" -+ -+ defaults.external_deps_patterns = { -+ bin = { "?.exe", "?.bat" }, -+ lib = { "?.dll.a", "lib?.dll.a" }, -+ include = { "?.h" } -+ } -+ defaults.runtime_external_deps_patterns = { -+ bin = { "?.exe", "?.bat" }, -+ lib = { "?.dll" }, -+ include = { "?.h" } -+ } -+end -+ - if cfg.platforms.cygwin then - defaults.lib_extension = "so" -- can be overridden in the config file for mingw builds - defaults.arch = "cygwin-"..cfg.target_cpu diff --git a/plugins/luarocks/luarocks.mk b/plugins/luarocks/luarocks.mk index 75bfc02..2056549 100644 --- a/plugins/luarocks/luarocks.mk +++ b/plugins/luarocks/luarocks.mk @@ -20,6 +20,9 @@ endef # shared-only because Lua loads modules in runtime define $(PKG)_BUILD_SHARED + # Remove LuaRocks config because we change it after installation + rm -f '$(PREFIX)/$(TARGET)/etc/luarocks/config-$(lua_SHORTVER).lua' + cd '$(1)' && ./configure \ --prefix='$(PREFIX)/$(TARGET)' \ --rocks-tree='$(PREFIX)/$(TARGET)' \ @@ -33,6 +36,52 @@ define $(PKG)_BUILD_SHARED LUAROCKS_UNAME_M="$(TARGET)" $(MAKE) -C '$(1)' install + # Generate LuaRocks config. + ( \ + echo '-- WARNING! This file is autogenerated by luarocks.mk.'; \ + echo '-- It will be overwritten by `make luarocks`'; \ + cat '$(PREFIX)/$(TARGET)/etc/luarocks/config-$(lua_SHORTVER).lua'; \ + echo 'lib_extension = "dll"'; \ + echo 'external_lib_extension = "dll"'; \ + echo 'obj_extension = "obj"'; \ + echo 'external_deps_dirs = { "$(PREFIX)" }'; \ + echo 'arch = "mxe-$(TARGET)"'; \ + echo 'platforms = {'; \ + echo ' unix = true,'; \ + echo ' mxe = true,'; \ + echo '}'; \ + echo 'cmake_generator = "Unix Makefiles"'; \ + echo 'variables = {'; \ + echo ' LUA_BINDIR = "$(PREFIX)/bin",'; \ + echo ' MAKE = "$(MAKE)",'; \ + echo ' CMAKE = "$(PREFIX)/bin/$(TARGET)-cmake",'; \ + echo ' CC = "$(PREFIX)/bin/$(TARGET)-gcc",'; \ + echo ' CXX = "$(PREFIX)/bin/$(TARGET)-g++",'; \ + echo ' LD = "$(PREFIX)/bin/$(TARGET)-gcc",'; \ + echo ' CFLAGS = "-O2",'; \ + echo ' LIBFLAG = "-shared",'; \ + echo ' LUALIB = "liblua.dll.a",'; \ + echo '}'; \ + echo 'export_path = "SET PATH=%s"'; \ + echo 'export_path_separator = ";"'; \ + echo 'export_lua_path = "SET LUA_PATH=%s"'; \ + echo 'export_lua_cpath = "SET LUA_CPATH=%s"'; \ + echo 'wrapper_suffix = ".bat"'; \ + echo 'external_deps_patterns = {'; \ + echo ' bin = { "?.exe", "?.bat" },'; \ + echo ' lib = { "?.dll.a", "lib?.dll.a" },'; \ + echo ' include = { "?.h" }'; \ + echo '}'; \ + echo 'runtime_external_deps_patterns = {'; \ + echo ' bin = { "?.exe", "?.bat" },'; \ + echo ' lib = { "?.dll" },'; \ + echo ' include = { "?.h" }'; \ + echo '}'; \ + ) \ + > '$(BUILD_DIR)/config.lua' + mv '$(BUILD_DIR)/config.lua' \ + '$(PREFIX)/$(TARGET)/etc/luarocks/config-$(lua_SHORTVER).lua' + # move installed lua file luarocks to luarocks.lua mv '$(PREFIX)/$(TARGET)/bin/luarocks' '$(PREFIX)/$(TARGET)/bin/luarocks.lua' -- cgit v0.12