aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbinary/all_in_one1
-rw-r--r--src/luarocks/core/cfg.lua4
-rw-r--r--src/luarocks/fs/unix.lua11
-rw-r--r--src/luarocks/fs/win32.lua11
4 files changed, 27 insertions, 0 deletions
diff --git a/binary/all_in_one b/binary/all_in_one
index 80712b13..3abbafa2 100755
--- a/binary/all_in_one
+++ b/binary/all_in_one
@@ -156,6 +156,7 @@ local function write_hardcoded_module(dir)
156 SYSTEM = system, 156 SYSTEM = system,
157 PROCESSOR = processor, 157 PROCESSOR = processor,
158 FORCE_CONFIG = FORCE_CONFIG, 158 FORCE_CONFIG = FORCE_CONFIG,
159 IS_BINARY = true,
159 160
160 SYSCONFDIR = if_platform("unix", SYSCONFDIR), 161 SYSCONFDIR = if_platform("unix", SYSCONFDIR),
161 162
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua
index b3561422..48aff4d8 100644
--- a/src/luarocks/core/cfg.lua
+++ b/src/luarocks/core/cfg.lua
@@ -542,6 +542,10 @@ function cfg.init(detected, warning)
542 cfg.program_series = program_series 542 cfg.program_series = program_series
543 cfg.major_version = major_version 543 cfg.major_version = major_version
544 544
545 if hardcoded.IS_BINARY then
546 cfg.is_binary = true
547 end
548
545 -- Use detected values as defaults, overridable via config files or CLI args 549 -- Use detected values as defaults, overridable via config files or CLI args
546 550
547 cfg.lua_version = detected.lua_version or hardcoded.LUA_VERSION or _VERSION:sub(5) 551 cfg.lua_version = detected.lua_version or hardcoded.LUA_VERSION or _VERSION:sub(5)
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua
index d62a93ca..53903f0c 100644
--- a/src/luarocks/fs/unix.lua
+++ b/src/luarocks/fs/unix.lua
@@ -88,12 +88,18 @@ function unix.wrap_script(script, target, deps_mode, name, version, ...)
88 "package.path="..util.LQ(lpath..";").."..package.path", 88 "package.path="..util.LQ(lpath..";").."..package.path",
89 "package.cpath="..util.LQ(lcpath..";").."..package.cpath", 89 "package.cpath="..util.LQ(lcpath..";").."..package.cpath",
90 } 90 }
91
92 local remove_interpreter = false
91 if target == "luarocks" or target == "luarocks-admin" then 93 if target == "luarocks" or target == "luarocks-admin" then
94 if cfg.is_binary then
95 remove_interpreter = true
96 end
92 luainit = { 97 luainit = {
93 "package.path="..util.LQ(package.path), 98 "package.path="..util.LQ(package.path),
94 "package.cpath="..util.LQ(package.cpath), 99 "package.cpath="..util.LQ(package.cpath),
95 } 100 }
96 end 101 end
102
97 if name and version then 103 if name and version then
98 local addctx = "local k,l,_=pcall(require,"..util.LQ("luarocks.loader")..") _=k " .. 104 local addctx = "local k,l,_=pcall(require,"..util.LQ("luarocks.loader")..") _=k " ..
99 "and l.add_context("..util.LQ(name)..","..util.LQ(version)..")" 105 "and l.add_context("..util.LQ(name)..","..util.LQ(version)..")"
@@ -107,6 +113,11 @@ function unix.wrap_script(script, target, deps_mode, name, version, ...)
107 script and fs.Q(script) or [[$([ "$*" ] || echo -i)]], 113 script and fs.Q(script) or [[$([ "$*" ] || echo -i)]],
108 ... 114 ...
109 } 115 }
116 if remove_interpreter then
117 table.remove(argv, 1)
118 table.remove(argv, 1)
119 table.remove(argv, 1)
120 end
110 121
111 wrapper:write("#!/bin/sh\n\n") 122 wrapper:write("#!/bin/sh\n\n")
112 wrapper:write("LUAROCKS_SYSCONFDIR="..fs.Q(cfg.sysconfdir) .. " ") 123 wrapper:write("LUAROCKS_SYSCONFDIR="..fs.Q(cfg.sysconfdir) .. " ")
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua
index ec75e605..f544393d 100644
--- a/src/luarocks/fs/win32.lua
+++ b/src/luarocks/fs/win32.lua
@@ -163,12 +163,18 @@ function win32.wrap_script(script, target, deps_mode, name, version, ...)
163 "package.path="..util.LQ(lpath..";").."..package.path", 163 "package.path="..util.LQ(lpath..";").."..package.path",
164 "package.cpath="..util.LQ(lcpath..";").."..package.cpath", 164 "package.cpath="..util.LQ(lcpath..";").."..package.cpath",
165 } 165 }
166
167 local remove_interpreter = false
166 if target == "luarocks" or target == "luarocks-admin" then 168 if target == "luarocks" or target == "luarocks-admin" then
169 if cfg.is_binary then
170 remove_interpreter = true
171 end
167 luainit = { 172 luainit = {
168 "package.path="..util.LQ(package.path), 173 "package.path="..util.LQ(package.path),
169 "package.cpath="..util.LQ(package.cpath), 174 "package.cpath="..util.LQ(package.cpath),
170 } 175 }
171 end 176 end
177
172 if name and version then 178 if name and version then
173 local addctx = "local k,l,_=pcall(require,'luarocks.loader') _=k " .. 179 local addctx = "local k,l,_=pcall(require,'luarocks.loader') _=k " ..
174 "and l.add_context('"..name.."','"..version.."')" 180 "and l.add_context('"..name.."','"..version.."')"
@@ -182,6 +188,11 @@ function win32.wrap_script(script, target, deps_mode, name, version, ...)
182 script and fs.Qb(script) or "%I%", 188 script and fs.Qb(script) or "%I%",
183 ... 189 ...
184 } 190 }
191 if remove_interpreter then
192 table.remove(argv, 1)
193 table.remove(argv, 1)
194 table.remove(argv, 1)
195 end
185 196
186 wrapper:write("@echo off\r\n") 197 wrapper:write("@echo off\r\n")
187 wrapper:write("setlocal\r\n") 198 wrapper:write("setlocal\r\n")