diff --git a/archive-configs/luarocks-config.lua b/archive-configs/luarocks-config.lua new file mode 100644 index 00000000..38b620ab --- /dev/null +++ b/archive-configs/luarocks-config.lua @@ -0,0 +1,14 @@ +-- cross-compilation +local function getenv(name) return os_getenv(name) or '' end +variables.LUA_INCDIR = getenv('TARGET_INCLUDE_DIR') +variables.LUA_LIBDIR = getenv('TARGET_LIB_DIR') +variables.CC = getenv('TARGET_CC') +variables.LD = getenv('TARGET_LD') +variables.CFLAGS = getenv('(TARGET_CFLAGS') +variables.LDFLAGS = getenv('(TARGET_LDFLAGS') +variables.LIBFLAG = [[-shared ]] .. getenv('TARGET_LDFLAGS') +external_deps_dirs = { getenv('TARGET_DIR') } +gcc_rpath = false +rocks_trees = { getenv('TARGET_DIR') } +wrap_bin_scripts = false +deps_mode = [[none]] diff --git a/archive-patches/luarocks-0001-allow-libluajit-detection.patch b/archive-patches/luarocks-0001-allow-libluajit-detection.patch new file mode 100644 index 00000000..5a7bc3f5 --- /dev/null +++ b/archive-patches/luarocks-0001-allow-libluajit-detection.patch @@ -0,0 +1,34 @@ +From 961269271134e711bcfffebb0f179ffddcbf3d5a Mon Sep 17 00:00:00 2001 +From: Francois Perrad +Date: Sun, 29 Jul 2018 11:17:34 +0200 +Subject: [PATCH] allow libluajit detection + +This detection was done only if luarocks is runned by luajit. +But on Buildroot, luarocks is always runned by lua. + +See https://github.com/luarocks/luarocks/pull/883 + +Signed-off-by: Francois Perrad +--- + src/luarocks/deps.lua | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua +index 8403f12..c1c0220 100644 +--- a/src/luarocks/deps.lua ++++ b/src/luarocks/deps.lua +@@ -544,10 +544,8 @@ function deps.check_lua(vars) + "lua-" .. cfg.lua_version, + "lua-" .. shortv, + "lua", ++ "luajit-" .. cfg.lua_version, + } +- if cfg.luajit_version then +- table.insert(libnames, 1, "luajit-" .. cfg.lua_version) +- end + local cache = {} + for _, libname in ipairs(libnames) do + local ok = check_external_dependency("LUA", { library = libname }, vars, "build", cache) +-- +2.17.1 + diff --git a/make/host-tools.mk b/make/host-tools.mk index 5e74e95a..913364e1 100644 --- a/make/host-tools.mk +++ b/make/host-tools.mk @@ -10,6 +10,7 @@ host-preqs: \ host_sumtool \ host_mkimage \ host_lua \ + host_luarocks \ host_zic \ host_parted \ host_mkfs.fat \ @@ -249,7 +250,7 @@ HOST_LUA_PATCH = lua-01-fix-LUA_ROOT.patch HOST_LUA_PATCH += lua-01-remove-readline.patch host_lua: $(HOST_LUA) -$(HOST_LUA): $(ARCHIVE)/lua-$(HOST_LUA_VER).tar.gz | $(TARGET_DIR) +$(HOST_LUA): $(ARCHIVE)/lua-$(HOST_LUA_VER).tar.gz | $(HOST_DIR) $(REMOVE)/lua-$(HOST_LUA_VER) $(UNTAR)/lua-$(HOST_LUA_VER).tar.gz $(CHDIR)/lua-$(HOST_LUA_VER); \ @@ -260,6 +261,45 @@ $(HOST_LUA): $(ARCHIVE)/lua-$(HOST_LUA_VER).tar.gz | $(TARGET_DIR) # ----------------------------------------------------------------------------- +HOST_LUAROCKS = $(HOST_DIR)/bin/luarocks +HOST_LUAROCKS_VER = 3.1.3 +HOST_LUAROCKS_SOURCE = luarocks-$(HOST_LUAROCKS_VER).tar.gz + +$(ARCHIVE)/$(HOST_LUAROCKS_SOURCE): + $(WGET) https://luarocks.github.io/luarocks/releases/$(HOST_LUAROCKS_SOURCE) + +HOST_LUAROCKS_PATCH = luarocks-0001-allow-libluajit-detection.patch + +HOST_LUAROCKS_CONFIG_FILE = $(HOST_DIR)/etc/luarocks/config-$(LUA_ABIVER).lua + +HOST_LUAROCKS_BUILDENV = \ + LUA_PATH="$(HOST_DIR)/share/lua/$(LUA_ABIVER)/?.lua" \ + TARGET_CC="$(TARGET)-gcc" \ + TARGET_LD="$(TARGET)-ld" \ + TARGET_CFLAGS="$(TARGET_CFLAGS)" \ + TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \ + TARGET_DIR="$(TARGET_DIR)" \ + TARGET_INCLUDE_DIR="$(TARGET_INCLUDE_DIR)" \ + TARGET_LIB_DIR="$(TARGET_LIB_DIR)" + +host_luarocks: $(HOST_LUAROCKS) +$(HOST_LUAROCKS): $(HOST_LUA) $(ARCHIVE)/$(HOST_LUAROCKS_SOURCE) | $(HOST_DIR) + $(REMOVE)/luarocks-$(HOST_LUAROCKS_VER) + $(UNTAR)/$(HOST_LUAROCKS_SOURCE) + $(CHDIR)/luarocks-$(HOST_LUAROCKS_VER); \ + $(call apply_patches, $(HOST_LUAROCKS_PATCH)); \ + ./configure $(SILENT_OPT) \ + --prefix=$(HOST_DIR) \ + --with-lua=$(HOST_DIR) \ + --rocks-tree=$(TARGET_DIR) \ + ; \ + $(MAKE) install + install -m 0644 $(CONFIGS)/luarocks-config.lua $(HOST_LUAROCKS_CONFIG_FILE) + $(REMOVE)/luarocks-$(HOST_LUAROCKS_VER) + $(TOUCH) + +# ----------------------------------------------------------------------------- + # helper target to create ccache links (make sure to have ccache installed in /usr/bin ;) ccache: find-ccache $(CCACHE) $(HOST_DIR)/bin @ln -sf $(CCACHE) $(HOST_DIR)/bin/cc