Browse Source

- host-tools.mk: add host-luarocks

master
vanhofen 6 years ago
parent
commit
5f190ff99b
  1. 14
      archive-configs/luarocks-config.lua
  2. 34
      archive-patches/luarocks-0001-allow-libluajit-detection.patch
  3. 42
      make/host-tools.mk

14
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]]

34
archive-patches/luarocks-0001-allow-libluajit-detection.patch

@ -0,0 +1,34 @@
From 961269271134e711bcfffebb0f179ffddcbf3d5a Mon Sep 17 00:00:00 2001
From: Francois Perrad <francois.perrad@gadz.org>
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 <francois.perrad@gadz.org>
---
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

42
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

Loading…
Cancel
Save