Skip to contentSkip to conversation

Adjust Luarocks support to per-package folder

PATCH New Thomas Petazzoni 2 participants 8 messages Nov 19, 2018 – Nov 21, 2018

lore
Share & tools
lore
#0 lore raw

cover Adjust Luarocks support to per-package folder

Hello,

Based on Fran?ois Perrad's feedback, this small patch series reworks how Luarocks is used to make it compatible with per-package folders. It is sent as a separate series, because it can be applied independently from the per-package series itself.

Thanks,

Thomas

Thomas Petazzoni (2):
package/pkg-luarocks: drop flock at installation time package/luarocks: rework configuration file for per-package folders

 package/luarocks/0002-getenv-in-config.patch | 31 ++++++++++++++++++++
 package/luarocks/luarocks-br-config.lua      | 12 ++++++++
 package/luarocks/luarocks.mk                 | 21 +++++--------
 package/pkg-luarocks.mk                      |  2 +-
 4 files changed, 52 insertions(+), 14 deletions(-)
 create mode 100644 package/luarocks/0002-getenv-in-config.patch
 create mode 100644 package/luarocks/luarocks-br-config.lua
Signature · 1 line
2.19.1
#1 lore raw

PATCH 1/2 package/pkg-luarocks: drop flock at installation time

In commit 22b327fc743b48a33aec0a9190bd67118641b294 ("pkg-luarocks: fix top-level parallel makefile support"), a flock on $(TARGET_DIR) was added to ensure that two Luarocks packages are not installed at the same time.

However, to support top-level parallel build, we have now clearly decided that per-package folders is a requirement. Therefore, TARGET_DIR is anyway going to be different for each package, making this flock unnecessary.

Trying to use top-level parallel build without per-package folder is simply not supported, so this commit drops the unnecessary flock.

---
 package/pkg-luarocks.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-luarocks.mk +1 -1
index 29c5e66cd1..f0985433b7 100644
@@ -63,7 +63,7 @@ endif
 #
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
-	cd $$($(2)_SRCDIR) && $$(LUAROCKS_RUN_ENV) flock $$(TARGET_DIR) \
+	cd $$($(2)_SRCDIR) && $$(LUAROCKS_RUN_ENV) \
 		$$(LUAROCKS_RUN_CMD) make --keep $$($(2)_ROCKSPEC) $$($(2)_BUILD_OPTS)
 endef
 endif
Signature · 1 line
2.19.1
#2 lore raw

PATCH 1/2 package/pkg-luarocks: drop flock at installation time

Le lun. 19 nov. 2018 ? 11:32, Thomas Petazzoni <[email protected]> a ?crit :

Quoted 10 lines

In commit 22b327fc743b48a33aec0a9190bd67118641b294 ("pkg-luarocks: fix top-level parallel makefile support"), a flock on $(TARGET_DIR) was added to ensure that two Luarocks packages are not installed at the same time.

However, to support top-level parallel build, we have now clearly decided that per-package folders is a requirement. Therefore, TARGET_DIR is anyway going to be different for each package, making this flock unnecessary.

Quoted 5 lines

Trying to use top-level parallel build without per-package folder is simply not supported, so this commit drops the unnecessary flock.

---

Quoted 16 lines
 package/pkg-luarocks.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-luarocks.mk +1 -1
index 29c5e66cd1..f0985433b7 100644
@@ -63,7 +63,7 @@ endif
 #
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
-       cd $$($(2)_SRCDIR) && $$(LUAROCKS_RUN_ENV) flock $$(TARGET_DIR) \
+       cd $$($(2)_SRCDIR) && $$(LUAROCKS_RUN_ENV) \
                $$(LUAROCKS_RUN_CMD) make --keep $$($(2)_ROCKSPEC)
 $$($(2)_BUILD_OPTS)
 endef
Quoted 5 lines

endif
--
2.19.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181119/3b6f5b56/attachment.html>

author Applied
#3 lore raw

PATCH 1/2 package/pkg-luarocks: drop flock at installation time

In reply to Thomas Petazzoni

Hello,

Quoted 10 lines · Thomas Petazzoni

In commit 22b327fc743b48a33aec0a9190bd67118641b294 ("pkg-luarocks: fix top-level parallel makefile support"), a flock on $(TARGET_DIR) was added to ensure that two Luarocks packages are not installed at the same time.

However, to support top-level parallel build, we have now clearly decided that per-package folders is a requirement. Therefore, TARGET_DIR is anyway going to be different for each package, making this flock unnecessary.

Quoted 7 lines

Trying to use top-level parallel build without per-package folder is simply not supported, so this commit drops the unnecessary flock.

---
 package/pkg-luarocks.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to next, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 2/2 package/luarocks: rework configuration file for per-package folders

In reply to Thomas Petazzoni

Currently, luarocks.mk generates a configuration file with hardcoded STAGING_DIR, TARGET_DIR, TARGET_CC, LUAROCKS_CFLAGS and TARGET_LDFLAGS values. This is not compatible with per-package folders, where the value of STAGING_DIR, TARGET_DIR, TARGET_CC and possibly TARGET_CFLAGS/TARGET_LDFLAGS may be different from one package to the other.

Based on input from Fran?ois Perrad, this commit:

- Ensures that the getenv() function can be used in the sandboxed environment used when reading the Luarocks configuration file.

- Changes the Luarocks configuration file to use getenv() for the appropriate variables. Since the contents of this file is not fixed, it is no longer generated by luarocks.mk using a series of 'echo' but simply concatanated with the rest of the Luarocks configuration file.

- Adjusts LUAROCKS_RUNV_ENV so that the necessary environment variables are now passed.

---
 package/luarocks/0002-getenv-in-config.patch | 31 ++++++++++++++++++++
 package/luarocks/luarocks-br-config.lua      | 12 ++++++++
 package/luarocks/luarocks.mk                 | 21 +++++--------
 3 files changed, 51 insertions(+), 13 deletions(-)
 create mode 100644 package/luarocks/0002-getenv-in-config.patch
 create mode 100644 package/luarocks/luarocks-br-config.lua
package/luarocks/0002-getenv-in-config.patch new file +31 -0
new file mode 100644
index 0000000000..9113724dfd
@@ -0,0 +1,31 @@
+From 3d855e0c678b241f4f9b9c596c409da3a27411aa Mon Sep 17 00:00:00 2001
+From: Francois Perrad <[email protected]>
+Date: Fri, 16 Nov 2018 19:57:47 +0100
+Subject: [PATCH] Allow using getenv in configuration file
+
+This commit adds getenv() in the sandboxed environment used when
+loading a config file, which allows to get environment variables from
+a luarocks configuration file.
+
+Signed-off-by: Francois Perrad <[email protected]>
+[Thomas: slightly improved commit title/log]
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ src/luarocks/core/cfg.lua | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua
+index 3237786..9bc0d22 100644
+--- a/src/luarocks/core/cfg.lua
++++ b/src/luarocks/core/cfg.lua
+@@ -89,6 +89,7 @@ do
+    local function env_for_config_file(cfg, platforms)
+       local e
+       e = {
++         getenv = os.getenv,
+          home = cfg.home,
+          lua_version = cfg.lua_version,
+          platforms = util.make_shallow_copy(platforms),
+-- 
+2.17.1
+
package/luarocks/luarocks-br-config.lua new file +12 -0
new file mode 100644
index 0000000000..39d6eaad12
@@ -0,0 +1,12 @@
+-- BR cross-compilation
+variables.LUA_INCDIR = getenv('STAGING_DIR') .. [[/usr/include]]
+variables.LUA_LIBDIR = getenv('STAGING_DIR') .. [[/usr/lib]]
+variables.CC = getenv('TARGET_CC')
+variables.LD = getenv('TARGET_CC')
+variables.CFLAGS = getenv('TARGET_CFLAGS')
+variables.LIBFLAG = [[-shared ]] .. getenv('TARGET_LDFLAGS')
+external_deps_dirs = { getenv('STAGING_DIR') .. [[/usr]] }
+gcc_rpath = false
+rocks_trees = { getenv('TARGET_DIR') .. [[/usr]] }
+wrap_bin_scripts = false
+deps_mode = [[none]]
package/luarocks/luarocks.mk +8 -13
index cfef8f19b3..1577189007 100644
@@ -30,23 +30,18 @@ endef
 define HOST_LUAROCKS_INSTALL_CMDS
 	rm -f $(LUAROCKS_CONFIG_FILE)
 	$(MAKE1) -C $(@D) install
-	echo "-- BR cross-compilation"                                  >> $(LUAROCKS_CONFIG_FILE)
-	echo "variables.LUA_INCDIR = [[$(STAGING_DIR)/usr/include]]"    >> $(LUAROCKS_CONFIG_FILE)
-	echo "variables.LUA_LIBDIR = [[$(STAGING_DIR)/usr/lib]]"        >> $(LUAROCKS_CONFIG_FILE)
-	echo "variables.CC = [[$(TARGET_CC)]]"                          >> $(LUAROCKS_CONFIG_FILE)
-	echo "variables.LD = [[$(TARGET_CC)]]"                          >> $(LUAROCKS_CONFIG_FILE)
-	echo "variables.CFLAGS = [[$(LUAROCKS_CFLAGS)]]"                >> $(LUAROCKS_CONFIG_FILE)
-	echo "variables.LIBFLAG = [[-shared $(TARGET_LDFLAGS)]]"        >> $(LUAROCKS_CONFIG_FILE)
-	echo "external_deps_dirs = { [[$(STAGING_DIR)/usr]] }"          >> $(LUAROCKS_CONFIG_FILE)
-	echo "gcc_rpath = false"                                        >> $(LUAROCKS_CONFIG_FILE)
-	echo "rocks_trees = { [[$(TARGET_DIR)/usr]] }"                  >> $(LUAROCKS_CONFIG_FILE)
-	echo "wrap_bin_scripts = false"                                 >> $(LUAROCKS_CONFIG_FILE)
-	echo "deps_mode = [[none]]"                                     >> $(LUAROCKS_CONFIG_FILE)
+	cat $(HOST_LUAROCKS_PKGDIR)/luarocks-br-config.lua >> $(LUAROCKS_CONFIG_FILE)
 endef
 
 $(eval $(host-generic-package))
 
-LUAROCKS_RUN_ENV = LUA_PATH="$(HOST_DIR)/share/lua/$(LUAINTERPRETER_ABIVER)/?.lua"
+LUAROCKS_RUN_ENV = \
+	LUA_PATH="$(HOST_DIR)/share/lua/$(LUAINTERPRETER_ABIVER)/?.lua" \
+	STAGING_DIR="$(STAGING_DIR)" \
+	TARGET_DIR="$(TARGET_DIR)" \
+	TARGET_CC="$(TARGET_CC)" \
+	TARGET_CFLAGS="$(LUAROCKS_CFLAGS)" \
+	TARGET_LDFLAGS="$(TARGET_LDFLAGS)"
 LUAROCKS_RUN_CMD = $(LUA_RUN) $(HOST_DIR)/bin/luarocks
 
 define LUAROCKS_FINALIZE_TARGET
Signature · 1 line
2.19.1
#5 lore raw

PATCH 2/2 package/luarocks: rework configuration file for per-package folders

Le lun. 19 nov. 2018 ? 11:32, Thomas Petazzoni <[email protected]> a ?crit :

Quoted 38 lines

Currently, luarocks.mk generates a configuration file with hardcoded STAGING_DIR, TARGET_DIR, TARGET_CC, LUAROCKS_CFLAGS and TARGET_LDFLAGS values. This is not compatible with per-package folders, where the value of STAGING_DIR, TARGET_DIR, TARGET_CC and possibly TARGET_CFLAGS/TARGET_LDFLAGS may be different from one package to the other.

Based on input from Fran?ois Perrad, this commit:

- Ensures that the getenv() function can be used in the sandboxed environment used when reading the Luarocks configuration file.

- Changes the Luarocks configuration file to use getenv() for the appropriate variables. Since the contents of this file is not fixed, it is no longer generated by luarocks.mk using a series of 'echo' but simply concatanated with the rest of the Luarocks configuration file.

- Adjusts LUAROCKS_RUNV_ENV so that the necessary environment variables are now passed.

---
 package/luarocks/0002-getenv-in-config.patch | 31 ++++++++++++++++++++
 package/luarocks/luarocks-br-config.lua      | 12 ++++++++
 package/luarocks/luarocks.mk                 | 21 +++++--------
 3 files changed, 51 insertions(+), 13 deletions(-)
 create mode 100644 package/luarocks/0002-getenv-in-config.patch
 create mode 100644 package/luarocks/luarocks-br-config.lua
package/luarocks/0002-getenv-in-config.patch new file +0 -0
new file mode 100644
index 0000000000..9113724dfd

package/luarocks/0002-getenv-in-config.patch line 9

Quoted 9 lines
package/luarocks/0002-getenv-in-config.patch new file +9 -0
@@ -0,0 +1,31 @@
+From 3d855e0c678b241f4f9b9c596c409da3a27411aa Mon Sep 17 00:00:00 2001
+From: Francois Perrad <[email protected]>
+Date: Fri, 16 Nov 2018 19:57:47 +0100
+Subject: [PATCH] Allow using getenv in configuration file
+
+This commit adds getenv() in the sandboxed environment used when
+loading a config file, which allows to get environment variables from
+a luarocks configuration file.
+

In fact, this patch is useless, the sandbox environment contains a field os_getenv.
Just use os_getenv instead of getenv in luarocks-br-config.lua.

Another point, without defining a lot variables, the command somewhere_host/bin/luarocks --help fails
with the message : attemps to concatenate a nil value (when loading the config file)

So, add something like this, on the top of luarocks-br-config.lua :
local function getenv (name) return os_getenv(name) or '' end

By this way, the buildroot addon still works (
https://patchwork.ozlabs.org/patch/995892/).

Fran?ois

Quoted 7 lines
package/luarocks/0002-getenv-in-config.patch new file +6 -0
+Signed-off-by: Francois Perrad <[email protected]>
+[Thomas: slightly improved commit title/log]
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ src/luarocks/core/cfg.lua | 1 +
+ 1 file changed, 1 insertion(+)

package/luarocks/0002-getenv-in-config.patch line 25

Quoted 10 lines
package/luarocks/0002-getenv-in-config.patch new file +10 -0
+
+diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua
+index 3237786..9bc0d22 100644
+--- a/src/luarocks/core/cfg.lua
++++ b/src/luarocks/core/cfg.lua
+@@ -89,6 +89,7 @@ do
+    local function env_for_config_file(cfg, platforms)
+       local e
+       e = {
++         getenv = os.getenv,

+ home = cfg.home,

Quoted 75 lines
package/luarocks/0002-getenv-in-config.patch new file +5 -0
+          lua_version = cfg.lua_version,
+          platforms = util.make_shallow_copy(platforms),
+--
+2.17.1
+
package/luarocks/luarocks-br-config.lua new file +12 -0
new file mode 100644
index 0000000000..39d6eaad12
@@ -0,0 +1,12 @@
+-- BR cross-compilation
+variables.LUA_INCDIR = getenv('STAGING_DIR') .. [[/usr/include]]
+variables.LUA_LIBDIR = getenv('STAGING_DIR') .. [[/usr/lib]]
+variables.CC = getenv('TARGET_CC')
+variables.LD = getenv('TARGET_CC')
+variables.CFLAGS = getenv('TARGET_CFLAGS')
+variables.LIBFLAG = [[-shared ]] .. getenv('TARGET_LDFLAGS')
+external_deps_dirs = { getenv('STAGING_DIR') .. [[/usr]] }
+gcc_rpath = false
+rocks_trees = { getenv('TARGET_DIR') .. [[/usr]] }
+wrap_bin_scripts = false
+deps_mode = [[none]]
package/luarocks/luarocks.mk +0 -11
index cfef8f19b3..1577189007 100644
@@ -30,23 +30,18 @@ endef
 define HOST_LUAROCKS_INSTALL_CMDS
        rm -f $(LUAROCKS_CONFIG_FILE)
        $(MAKE1) -C $(@D) install
-       echo "-- BR cross-compilation"                                  >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "variables.LUA_INCDIR = [[$(STAGING_DIR)/usr/include]]"    >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "variables.LUA_LIBDIR = [[$(STAGING_DIR)/usr/lib]]"        >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "variables.CC = [[$(TARGET_CC)]]"                          >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "variables.LD = [[$(TARGET_CC)]]"                          >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "variables.CFLAGS = [[$(LUAROCKS_CFLAGS)]]"                >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "variables.LIBFLAG = [[-shared $(TARGET_LDFLAGS)]]"        >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "external_deps_dirs = { [[$(STAGING_DIR)/usr]] }"          >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "gcc_rpath = false"                                        >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "rocks_trees = { [[$(TARGET_DIR)/usr]] }"                  >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "wrap_bin_scripts = false"                                 >>

$(LUAROCKS_CONFIG_FILE)
- echo "deps_mode = [[none]]" >>
$(LUAROCKS_CONFIG_FILE)
+ cat $(HOST_LUAROCKS_PKGDIR)/luarocks-br-config.lua >>
$(LUAROCKS_CONFIG_FILE)
endef

$(eval $(host-generic-package))

-LUAROCKS_RUN_ENV = LUA_PATH="$(HOST_DIR)/share/lua/$(LUAINTERPRETER_ABIVER)/?.lua"

package/luarocks/luarocks.mk +7 -1
+LUAROCKS_RUN_ENV = \
+       LUA_PATH="$(HOST_DIR)/share/lua/$(LUAINTERPRETER_ABIVER)/?.lua" \
+       STAGING_DIR="$(STAGING_DIR)" \
+       TARGET_DIR="$(TARGET_DIR)" \
+       TARGET_CC="$(TARGET_CC)" \
+       TARGET_CFLAGS="$(LUAROCKS_CFLAGS)" \
+       TARGET_LDFLAGS="$(TARGET_LDFLAGS)"
 LUAROCKS_RUN_CMD = $(LUA_RUN) $(HOST_DIR)/bin/luarocks
 
 define LUAROCKS_FINALIZE_TARGET
--
Quoted 3 lines

2.19.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181119/b44b683d/attachment.html>

#6 lore raw

PATCH 2/2 package/luarocks: rework configuration file for per-package folders

Hello Fran?ois,

Quoted 11 lines · Fran?ois Perrad

In fact, this patch is useless, the sandbox environment contains a field os_getenv.
Just use os_getenv instead of getenv in luarocks-br-config.lua.

Another point, without defining a lot variables, the command somewhere_host/bin/luarocks --help fails
with the message : attemps to concatenate a nil value (when loading the config file)

So, add something like this, on the top of luarocks-br-config.lua :
local function getenv (name) return os_getenv(name) or '' end

Thanks for the feedback! I will send an updated version soon.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

PATCH 2/2 package/luarocks: rework configuration file for per-package folders

In reply to Thomas Petazzoni

Le lun. 19 nov. 2018 ? 11:32, Thomas Petazzoni <[email protected]> a ?crit :

Quoted 76 lines

Currently, luarocks.mk generates a configuration file with hardcoded STAGING_DIR, TARGET_DIR, TARGET_CC, LUAROCKS_CFLAGS and TARGET_LDFLAGS values. This is not compatible with per-package folders, where the value of STAGING_DIR, TARGET_DIR, TARGET_CC and possibly TARGET_CFLAGS/TARGET_LDFLAGS may be different from one package to the other.

Based on input from Fran?ois Perrad, this commit:

- Ensures that the getenv() function can be used in the sandboxed environment used when reading the Luarocks configuration file.

- Changes the Luarocks configuration file to use getenv() for the appropriate variables. Since the contents of this file is not fixed, it is no longer generated by luarocks.mk using a series of 'echo' but simply concatanated with the rest of the Luarocks configuration file.

- Adjusts LUAROCKS_RUNV_ENV so that the necessary environment variables are now passed.

---
 package/luarocks/0002-getenv-in-config.patch | 31 ++++++++++++++++++++
 package/luarocks/luarocks-br-config.lua      | 12 ++++++++
 package/luarocks/luarocks.mk                 | 21 +++++--------
 3 files changed, 51 insertions(+), 13 deletions(-)
 create mode 100644 package/luarocks/0002-getenv-in-config.patch
 create mode 100644 package/luarocks/luarocks-br-config.lua
package/luarocks/0002-getenv-in-config.patch new file +31 -0
new file mode 100644
index 0000000000..9113724dfd
@@ -0,0 +1,31 @@
+From 3d855e0c678b241f4f9b9c596c409da3a27411aa Mon Sep 17 00:00:00 2001
+From: Francois Perrad <[email protected]>
+Date: Fri, 16 Nov 2018 19:57:47 +0100
+Subject: [PATCH] Allow using getenv in configuration file
+
+This commit adds getenv() in the sandboxed environment used when
+loading a config file, which allows to get environment variables from
+a luarocks configuration file.
+
+Signed-off-by: Francois Perrad <[email protected]>
+[Thomas: slightly improved commit title/log]
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ src/luarocks/core/cfg.lua | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua
+index 3237786..9bc0d22 100644
+--- a/src/luarocks/core/cfg.lua
++++ b/src/luarocks/core/cfg.lua
+@@ -89,6 +89,7 @@ do
+    local function env_for_config_file(cfg, platforms)
+       local e
+       e = {
++         getenv = os.getenv,
+          home = cfg.home,
+          lua_version = cfg.lua_version,
+          platforms = util.make_shallow_copy(platforms),
+--
+2.17.1
+
package/luarocks/luarocks-br-config.lua new file +0 -0
new file mode 100644
index 0000000000..39d6eaad12

package/luarocks/luarocks-br-config.lua line 1

Quoted 1 line
package/luarocks/luarocks-br-config.lua new file +1 -0
@@ -0,0 +1,12 @@
+-- BR cross-compilation

Another detail, the notation [[string]] was useful when echoing from luarocks.mk.
Now, you could just simple or double quote string.

Fran?ois

Quoted 62 lines
package/luarocks/luarocks-br-config.lua new file +11 -0
+variables.LUA_INCDIR = getenv('STAGING_DIR') .. [[/usr/include]]
+variables.LUA_LIBDIR = getenv('STAGING_DIR') .. [[/usr/lib]]
+variables.CC = getenv('TARGET_CC')
+variables.LD = getenv('TARGET_CC')
+variables.CFLAGS = getenv('TARGET_CFLAGS')
+variables.LIBFLAG = [[-shared ]] .. getenv('TARGET_LDFLAGS')
+external_deps_dirs = { getenv('STAGING_DIR') .. [[/usr]] }
+gcc_rpath = false
+rocks_trees = { getenv('TARGET_DIR') .. [[/usr]] }
+wrap_bin_scripts = false
+deps_mode = [[none]]
package/luarocks/luarocks.mk +0 -11
index cfef8f19b3..1577189007 100644
@@ -30,23 +30,18 @@ endef
 define HOST_LUAROCKS_INSTALL_CMDS
        rm -f $(LUAROCKS_CONFIG_FILE)
        $(MAKE1) -C $(@D) install
-       echo "-- BR cross-compilation"                                  >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "variables.LUA_INCDIR = [[$(STAGING_DIR)/usr/include]]"    >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "variables.LUA_LIBDIR = [[$(STAGING_DIR)/usr/lib]]"        >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "variables.CC = [[$(TARGET_CC)]]"                          >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "variables.LD = [[$(TARGET_CC)]]"                          >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "variables.CFLAGS = [[$(LUAROCKS_CFLAGS)]]"                >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "variables.LIBFLAG = [[-shared $(TARGET_LDFLAGS)]]"        >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "external_deps_dirs = { [[$(STAGING_DIR)/usr]] }"          >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "gcc_rpath = false"                                        >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "rocks_trees = { [[$(TARGET_DIR)/usr]] }"                  >>
 $(LUAROCKS_CONFIG_FILE)
-       echo "wrap_bin_scripts = false"                                 >>

$(LUAROCKS_CONFIG_FILE)
- echo "deps_mode = [[none]]" >>
$(LUAROCKS_CONFIG_FILE)
+ cat $(HOST_LUAROCKS_PKGDIR)/luarocks-br-config.lua >>
$(LUAROCKS_CONFIG_FILE)
endef

$(eval $(host-generic-package))

-LUAROCKS_RUN_ENV = LUA_PATH="$(HOST_DIR)/share/lua/$(LUAINTERPRETER_ABIVER)/?.lua"

package/luarocks/luarocks.mk +7 -1
+LUAROCKS_RUN_ENV = \
+       LUA_PATH="$(HOST_DIR)/share/lua/$(LUAINTERPRETER_ABIVER)/?.lua" \
+       STAGING_DIR="$(STAGING_DIR)" \
+       TARGET_DIR="$(TARGET_DIR)" \
+       TARGET_CC="$(TARGET_CC)" \
+       TARGET_CFLAGS="$(LUAROCKS_CFLAGS)" \
+       TARGET_LDFLAGS="$(TARGET_LDFLAGS)"
 LUAROCKS_RUN_CMD = $(LUA_RUN) $(HOST_DIR)/bin/luarocks
 
 define LUAROCKS_FINALIZE_TARGET
--
Quoted 3 lines

2.19.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20181121/cf4eb325/attachment.html>