From 078e42b295eb2d05cdd4a99a9c76a84a45292cb3 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 2 Sep 2019 11:57:02 -0300 Subject: Ensure scripts add the prefix to the package path This reverts the removal from e9215f139be7afa3af116a2039594362e4f1f2be but keeps the addition of the custom package loader as that is a more robust approach. I'm not a super fan of this approach because in a cross-compiling scenario it does leak the host package.path into the output of commands such as `luarocks path` and building the `bin` wrappers, but at least it is less broken than the 3.2.0 behavior, as reported by @fperrad in issue #1070. --- GNUmakefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GNUmakefile b/GNUmakefile index cd9e5a8f..251ab00d 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -69,6 +69,7 @@ $(builddir)/luarocks: src/bin/luarocks config.unix 'package.loaded["luarocks.core.hardcoded"] = { '\ "$$([ -n "$(FORCE_CONFIG)" ] && printf 'FORCE_CONFIG = true, ')"\ 'SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\ + 'package.path=[[$(luadir)/?.lua;]] .. package.path\n'; \ 'local list = package.searchers or package.loaders; table.insert(list, 1, function(name) if name:match("^luarocks%%.") then return loadfile([[$(luadir)/]] .. name:gsub([[%%.]], [[/]]) .. [[.lua]]) end end)\n'; \ tail -n +2 src/bin/luarocks \ )> "$@" @@ -79,6 +80,7 @@ $(builddir)/luarocks-admin: src/bin/luarocks-admin config.unix 'package.loaded["luarocks.core.hardcoded"] = { '\ "$$([ -n "$(FORCE_CONFIG)" ] && printf 'FORCE_CONFIG = true, ')"\ 'SYSCONFDIR = [[$(luarocksconfdir)]] }\n'\ + 'package.path=[[$(luadir)/?.lua;]] .. package.path\n'; \ 'local list = package.searchers or package.loaders; table.insert(list, 1, function(name) if name:match("^luarocks%%.") then return loadfile([[$(luadir)/]] .. name:gsub([[%%.]], [[/]]) .. [[.lua]]) end end)\n'; \ tail -n +2 src/bin/luarocks-admin \ )> "$@" -- cgit v1.2.3-55-g6feb