aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/cfg.lua54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index d2858cca..476bfbc3 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -10,19 +10,19 @@ local rawset, next, table, pairs, require, io, os, setmetatable, pcall, ipairs,
10-- 10--
11-- End-users shouldn't edit this file. They can override any defaults 11-- End-users shouldn't edit this file. They can override any defaults
12-- set in this file using their system-wide $LUAROCKS_SYSCONFIG file 12-- set in this file using their system-wide $LUAROCKS_SYSCONFIG file
13-- (see luarocks.config) or their user-specific configuration file 13-- (see luarocks.site_config) or their user-specific configuration file
14-- (~/.luarocks/config.lua on Unix or %APPDATA%/luarocks/config.lua on 14-- (~/.luarocks/config.lua on Unix or %APPDATA%/luarocks/config.lua on
15-- Windows). 15-- Windows).
16module("luarocks.cfg") 16module("luarocks.cfg")
17 17
18-- Load site-local global configurations 18-- Load site-local global configurations
19local ok, config = pcall(require, "luarocks.config") 19local ok, site_config = pcall(require, "luarocks.site_config")
20if not ok then 20if not ok then
21 io.stderr:write("Site-local luarocks/config.lua file not found. Incomplete installation?\n") 21 io.stderr:write("Site-local luarocks/site_config.lua file not found. Incomplete installation?\n")
22 config = {} 22 site_config = {}
23end 23end
24 24
25_M.config = config 25_M.site_config = site_config
26 26
27program_version = "2.0.5" 27program_version = "2.0.5"
28user_agent = "LuaRocks/"..program_version 28user_agent = "LuaRocks/"..program_version
@@ -46,12 +46,12 @@ local detected = {}
46local system,proc 46local system,proc
47 47
48-- A proper installation of LuaRocks will hardcode the system 48-- A proper installation of LuaRocks will hardcode the system
49-- and proc values with config.LUAROCKS_UNAME_S and config.LUAROCKS_UNAME_M, 49-- and proc values with site_config.LUAROCKS_UNAME_S and site_config.LUAROCKS_UNAME_M,
50-- so that this detection does not run every time. When it is 50-- so that this detection does not run every time. When it is
51-- performed, we use the Unix way to identify the system, 51-- performed, we use the Unix way to identify the system,
52-- even on Windows (assuming UnxUtils or Cygwin). 52-- even on Windows (assuming UnxUtils or Cygwin).
53system = config.LUAROCKS_UNAME_S or io.popen("uname -s"):read("*l") 53system = site_config.LUAROCKS_UNAME_S or io.popen("uname -s"):read("*l")
54proc = config.LUAROCKS_UNAME_M or io.popen("uname -m"):read("*l") 54proc = site_config.LUAROCKS_UNAME_M or io.popen("uname -m"):read("*l")
55if proc:match("i[%d]86") then 55if proc:match("i[%d]86") then
56 proc = "x86" 56 proc = "x86"
57elseif proc:match("amd64") or proc:match("x86_64") then 57elseif proc:match("amd64") or proc:match("x86_64") then
@@ -105,9 +105,9 @@ end
105variables = {} 105variables = {}
106rocks_trees = {} 106rocks_trees = {}
107 107
108persist.load_into_table(config.LUAROCKS_SYSCONFIG or sys_config_file, _M) 108persist.load_into_table(site_config.LUAROCKS_SYSCONFIG or sys_config_file, _M)
109 109
110if not config.LUAROCKS_FORCE_CONFIG then 110if not site_config.LUAROCKS_FORCE_CONFIG then
111 home_config_file = os.getenv("LUAROCKS_CONFIG") or home_config_file 111 home_config_file = os.getenv("LUAROCKS_CONFIG") or home_config_file
112 local home_overrides = persist.load_into_table(home_config_file, { home = home }) 112 local home_overrides = persist.load_into_table(home_config_file, { home = home })
113 if home_overrides then 113 if home_overrides then
@@ -120,8 +120,8 @@ if not next(rocks_trees) then
120 if home_tree then 120 if home_tree then
121 table.insert(rocks_trees, home_tree) 121 table.insert(rocks_trees, home_tree)
122 end 122 end
123 if config.LUAROCKS_ROCKS_TREE then 123 if site_config.LUAROCKS_ROCKS_TREE then
124 table.insert(rocks_trees, config.LUAROCKS_ROCKS_TREE) 124 table.insert(rocks_trees, site_config.LUAROCKS_ROCKS_TREE)
125 end 125 end
126end 126end
127 127
@@ -146,9 +146,9 @@ local defaults = {
146 }, 146 },
147 147
148 lua_extension = "lua", 148 lua_extension = "lua",
149 lua_interpreter = config.LUA_INTERPRETER or "lua", 149 lua_interpreter = site_config.LUA_INTERPRETER or "lua",
150 downloader = config.LUAROCKS_DOWNLOADER or "wget", 150 downloader = site_config.LUAROCKS_DOWNLOADER or "wget",
151 md5checker = config.LUAROCKS_MD5CHECKER or "md5sum", 151 md5checker = site_config.LUAROCKS_MD5CHECKER or "md5sum",
152 152
153 variables = { 153 variables = {
154 MAKE = "make", 154 MAKE = "make",
@@ -213,15 +213,15 @@ if detected.windows then
213 defaults.external_lib_extension = "dll" 213 defaults.external_lib_extension = "dll"
214 defaults.obj_extension = "obj" 214 defaults.obj_extension = "obj"
215 defaults.external_deps_dirs = { "c:/external/" } 215 defaults.external_deps_dirs = { "c:/external/" }
216 defaults.variables.LUA_BINDIR = config.LUA_BINDIR and config.LUA_BINDIR:gsub("\\", "/") or "c:/lua5.1/bin" 216 defaults.variables.LUA_BINDIR = site_config.LUA_BINDIR and site_config.LUA_BINDIR:gsub("\\", "/") or "c:/lua5.1/bin"
217 defaults.variables.LUA_INCDIR = config.LUA_INCDIR and config.LUA_INCDIR:gsub("\\", "/") or "c:/lua5.1/include" 217 defaults.variables.LUA_INCDIR = site_config.LUA_INCDIR and site_config.LUA_INCDIR:gsub("\\", "/") or "c:/lua5.1/include"
218 defaults.variables.LUA_LIBDIR = config.LUA_LIBDIR and config.LUA_LIBDIR:gsub("\\", "/") or "c:/lua5.1/lib" 218 defaults.variables.LUA_LIBDIR = site_config.LUA_LIBDIR and site_config.LUA_LIBDIR:gsub("\\", "/") or "c:/lua5.1/lib"
219 defaults.cmake_generator = "MinGW Makefiles" 219 defaults.cmake_generator = "MinGW Makefiles"
220 defaults.makefile = "Makefile.win" 220 defaults.makefile = "Makefile.win"
221 defaults.variables.MAKE = "nmake" -- TODO: Split Windows flavors between mingw and msvc 221 defaults.variables.MAKE = "nmake" -- TODO: Split Windows flavors between mingw and msvc
222 defaults.variables.CC = "cl" 222 defaults.variables.CC = "cl"
223 defaults.variables.RC = "rc" 223 defaults.variables.RC = "rc"
224 defaults.variables.WRAPPER = config.LUAROCKS_PREFIX .. "\\2.0\\rclauncher.obj" 224 defaults.variables.WRAPPER = site_config.LUAROCKS_PREFIX .. "\\2.0\\rclauncher.obj"
225 defaults.variables.LD = "link" 225 defaults.variables.LD = "link"
226 defaults.variables.MT = "mt" 226 defaults.variables.MT = "mt"
227 defaults.variables.CFLAGS = "/MD /O2" 227 defaults.variables.CFLAGS = "/MD /O2"
@@ -249,15 +249,15 @@ if detected.mingw32 then
249 defaults.external_lib_extension = "dll" 249 defaults.external_lib_extension = "dll"
250 defaults.obj_extension = "o" 250 defaults.obj_extension = "o"
251 defaults.external_deps_dirs = { "c:/external/" } 251 defaults.external_deps_dirs = { "c:/external/" }
252 defaults.variables.LUA_BINDIR = config.LUA_BINDIR and config.LUA_BINDIR:gsub("\\", "/") or "c:/lua5.1/bin" 252 defaults.variables.LUA_BINDIR = site_config.LUA_BINDIR and site_config.LUA_BINDIR:gsub("\\", "/") or "c:/lua5.1/bin"
253 defaults.variables.LUA_INCDIR = config.LUA_INCDIR and config.LUA_INCDIR:gsub("\\", "/") or "c:/lua5.1/include" 253 defaults.variables.LUA_INCDIR = site_config.LUA_INCDIR and site_config.LUA_INCDIR:gsub("\\", "/") or "c:/lua5.1/include"
254 defaults.variables.LUA_LIBDIR = config.LUA_LIBDIR and config.LUA_LIBDIR:gsub("\\", "/") or "c:/lua5.1/lib" 254 defaults.variables.LUA_LIBDIR = site_config.LUA_LIBDIR and site_config.LUA_LIBDIR:gsub("\\", "/") or "c:/lua5.1/lib"
255 defaults.cmake_generator = "MinGW Makefiles" 255 defaults.cmake_generator = "MinGW Makefiles"
256 defaults.make = "mingw32-make" -- TODO: Split Windows flavors between mingw and msvc 256 defaults.make = "mingw32-make" -- TODO: Split Windows flavors between mingw and msvc
257 defaults.makefile = "Makefile.win" 257 defaults.makefile = "Makefile.win"
258 defaults.variables.CC = "mingw32-gcc" 258 defaults.variables.CC = "mingw32-gcc"
259 defaults.variables.RC = "windres" 259 defaults.variables.RC = "windres"
260 defaults.variables.WRAPPER = config.LUAROCKS_PREFIX .. "\\2.0\\rclauncher.o" 260 defaults.variables.WRAPPER = site_config.LUAROCKS_PREFIX .. "\\2.0\\rclauncher.o"
261 defaults.variables.LD = "mingw32-gcc" 261 defaults.variables.LD = "mingw32-gcc"
262 defaults.variables.CFLAGS = "-O2" 262 defaults.variables.CFLAGS = "-O2"
263 defaults.variables.LIBFLAG = "-shared" 263 defaults.variables.LIBFLAG = "-shared"
@@ -281,9 +281,9 @@ if detected.unix then
281 defaults.external_lib_extension = "so" 281 defaults.external_lib_extension = "so"
282 defaults.obj_extension = "o" 282 defaults.obj_extension = "o"
283 defaults.external_deps_dirs = { "/usr/local", "/usr" } 283 defaults.external_deps_dirs = { "/usr/local", "/usr" }
284 defaults.variables.LUA_BINDIR = config.LUA_BINDIR or "/usr/local/bin" 284 defaults.variables.LUA_BINDIR = site_config.LUA_BINDIR or "/usr/local/bin"
285 defaults.variables.LUA_INCDIR = config.LUA_INCDIR or "/usr/local/include" 285 defaults.variables.LUA_INCDIR = site_config.LUA_INCDIR or "/usr/local/include"
286 defaults.variables.LUA_LIBDIR = config.LUA_LIBDIR or "/usr/local/lib" 286 defaults.variables.LUA_LIBDIR = site_config.LUA_LIBDIR or "/usr/local/lib"
287 defaults.variables.CFLAGS = "-O2" 287 defaults.variables.CFLAGS = "-O2"
288 defaults.cmake_generator = "Unix Makefiles" 288 defaults.cmake_generator = "Unix Makefiles"
289 defaults.platforms = { "unix" } 289 defaults.platforms = { "unix" }
@@ -356,7 +356,7 @@ end
356defaults.variables.LUA = defaults.lua_interpreter 356defaults.variables.LUA = defaults.lua_interpreter
357defaults.variables.LIB_EXTENSION = defaults.lib_extension 357defaults.variables.LIB_EXTENSION = defaults.lib_extension
358defaults.variables.OBJ_EXTENSION = defaults.obj_extension 358defaults.variables.OBJ_EXTENSION = defaults.obj_extension
359defaults.variables.LUAROCKS_PREFIX = config.LUAROCKS_PREFIX 359defaults.variables.LUAROCKS_PREFIX = site_config.LUAROCKS_PREFIX
360 360
361-- Use defaults: 361-- Use defaults:
362 362