diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/cfg.lua | 4 | ||||
-rw-r--r-- | src/luarocks/deps.lua | 36 | ||||
-rw-r--r-- | src/luarocks/fs/unix.lua | 6 | ||||
-rw-r--r-- | src/luarocks/fs/win32.lua | 9 |
4 files changed, 33 insertions, 22 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 8e26bb46..94afe0a0 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -254,12 +254,12 @@ local defaults = { | |||
254 | STATFLAG = "-c '%a'", | 254 | STATFLAG = "-c '%a'", |
255 | }, | 255 | }, |
256 | 256 | ||
257 | external_deps_subdirs = { | 257 | external_deps_subdirs = site_config.LUAROCKS_EXTERNAL_DEPS_SUBDIRS or { |
258 | bin = "bin", | 258 | bin = "bin", |
259 | lib = "lib", | 259 | lib = "lib", |
260 | include = "include" | 260 | include = "include" |
261 | }, | 261 | }, |
262 | runtime_external_deps_subdirs = { | 262 | runtime_external_deps_subdirs = site_config.LUAROCKS_RUNTIME_EXTERNAL_DEPS_SUBDIRS or { |
263 | bin = "bin", | 263 | bin = "bin", |
264 | lib = "lib", | 264 | lib = "lib", |
265 | include = "include" | 265 | include = "include" |
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index f24dc507..7f3b44f2 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
@@ -583,7 +583,19 @@ function check_external_deps(rockspec, mode) | |||
583 | prefix = prefix.prefix | 583 | prefix = prefix.prefix |
584 | end | 584 | end |
585 | for dirname, dirdata in pairs(dirs) do | 585 | for dirname, dirdata in pairs(dirs) do |
586 | dirdata.dir = vars[name.."_"..dirname] or dir.path(prefix, dirdata.subdir) | 586 | local paths |
587 | local path_var_value = vars[name.."_"..dirname] | ||
588 | if path_var_value then | ||
589 | paths = { path_var_value } | ||
590 | elseif type(dirdata.subdir) == "table" then | ||
591 | paths = {} | ||
592 | for i,v in ipairs(dirdata.subdir) do | ||
593 | paths[i] = dir.path(prefix, v) | ||
594 | end | ||
595 | else | ||
596 | paths = { dir.path(prefix, dirdata.subdir) } | ||
597 | end | ||
598 | dirdata.dir = paths[1] | ||
587 | local file = files[dirdata.testfile] | 599 | local file = files[dirdata.testfile] |
588 | if file then | 600 | if file then |
589 | local files = {} | 601 | local files = {} |
@@ -605,16 +617,22 @@ function check_external_deps(rockspec, mode) | |||
605 | if f:match("%.so$") or f:match("%.dylib$") or f:match("%.dll$") then | 617 | if f:match("%.so$") or f:match("%.dylib$") or f:match("%.dll$") then |
606 | f = f:gsub("%.[^.]+$", "."..cfg.external_lib_extension) | 618 | f = f:gsub("%.[^.]+$", "."..cfg.external_lib_extension) |
607 | end | 619 | end |
608 | if f:match("%*") then | 620 | for _, d in ipairs(paths) do |
609 | local replaced = f:gsub("%.", "%%."):gsub("%*", ".*") | 621 | if f:match("%*") then |
610 | for _, entry in ipairs(fs.list_dir(dirdata.dir)) do | 622 | local replaced = f:gsub("%.", "%%."):gsub("%*", ".*") |
611 | if entry:match(replaced) then | 623 | for _, entry in ipairs(fs.list_dir(d)) do |
612 | found = true | 624 | if entry:match(replaced) then |
613 | break | 625 | found = true |
626 | break | ||
627 | end | ||
614 | end | 628 | end |
629 | else | ||
630 | found = fs.is_file(dir.path(d, f)) | ||
631 | end | ||
632 | if found then | ||
633 | dirdata.dir = d | ||
634 | break | ||
615 | end | 635 | end |
616 | else | ||
617 | found = fs.is_file(dir.path(dirdata.dir, f)) | ||
618 | end | 636 | end |
619 | if found then | 637 | if found then |
620 | break | 638 | break |
diff --git a/src/luarocks/fs/unix.lua b/src/luarocks/fs/unix.lua index cccbbd33..5b9a11b5 100644 --- a/src/luarocks/fs/unix.lua +++ b/src/luarocks/fs/unix.lua | |||
@@ -53,15 +53,13 @@ function wrap_script(file, dest, name, version) | |||
53 | 53 | ||
54 | local base = dir.base_name(file) | 54 | local base = dir.base_name(file) |
55 | local wrapname = fs.is_dir(dest) and dest.."/"..base or dest | 55 | local wrapname = fs.is_dir(dest) and dest.."/"..base or dest |
56 | local lpath, lcpath = cfg.package_paths() | ||
56 | local wrapper = io.open(wrapname, "w") | 57 | local wrapper = io.open(wrapname, "w") |
57 | if not wrapper then | 58 | if not wrapper then |
58 | return nil, "Could not open "..wrapname.." for writing." | 59 | return nil, "Could not open "..wrapname.." for writing." |
59 | end | 60 | end |
60 | wrapper:write("#!/bin/sh\n\n") | 61 | wrapper:write("#!/bin/sh\n\n") |
61 | wrapper:write('LUA_PATH="'..package.path..';$LUA_PATH"\n') | 62 | wrapper:write('exec "'..dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)..'" -e \'package.path=[['..lpath..';]]..package.path\' -e \'package.cpath=[['..lcpath..';]]..package.cpath\' -lluarocks.loader -e\'luarocks.loader.add_context([['..name..']],[['..version..']])\' "'..file..'" "$@"\n') |
62 | wrapper:write('LUA_CPATH="'..package.cpath..';$LUA_CPATH"\n') | ||
63 | wrapper:write('export LUA_PATH LUA_CPATH\n') | ||
64 | wrapper:write('exec "'..dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)..'" -lluarocks.loader -e\'luarocks.loader.add_context([['..name..']],[['..version..']])\' "'..file..'" "$@"\n') | ||
65 | wrapper:close() | 63 | wrapper:close() |
66 | if fs.chmod(wrapname, "0755") then | 64 | if fs.chmod(wrapname, "0755") then |
67 | return true | 65 | return true |
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua index 2bc595f6..8f14239d 100644 --- a/src/luarocks/fs/win32.lua +++ b/src/luarocks/fs/win32.lua | |||
@@ -63,18 +63,13 @@ function wrap_script(file, dest, name, version) | |||
63 | local base = dir.base_name(file) | 63 | local base = dir.base_name(file) |
64 | local wrapname = fs.is_dir(dest) and dest.."/"..base or dest | 64 | local wrapname = fs.is_dir(dest) and dest.."/"..base or dest |
65 | wrapname = wrapname..".bat" | 65 | wrapname = wrapname..".bat" |
66 | local lpath, lcpath = cfg.package_paths() | ||
66 | local wrapper = io.open(wrapname, "w") | 67 | local wrapper = io.open(wrapname, "w") |
67 | if not wrapper then | 68 | if not wrapper then |
68 | return nil, "Could not open "..wrapname.." for writing." | 69 | return nil, "Could not open "..wrapname.." for writing." |
69 | end | 70 | end |
70 | wrapper:write("@echo off\n") | 71 | wrapper:write("@echo off\n") |
71 | wrapper:write("setlocal\n") | 72 | wrapper:write('"'..dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)..'" -e "package.path=[['..lpath..';]]..package.path" -e "package.cpath=[['..lcpath..';]]..package.cpath" -lluarocks.loader -e"luarocks.loader.add_context([['..name..']],[['..version..']])" "'..file..'" %*\n') |
72 | wrapper:write('set LUA_PATH='..package.path..";%LUA_PATH%\n") | ||
73 | wrapper:write('set LUA_CPATH='..package.cpath..";%LUA_CPATH%\n") | ||
74 | wrapper:write('if not "%LUA_PATH_5_2%"=="" set LUA_PATH_5_2='..package.path..";%LUA_PATH_5_2%\n") | ||
75 | wrapper:write('if not "%LUA_CPATH_5_2%"=="" set LUA_CPATH_5_2='..package.cpath..";%LUA_CPATH_5_2%\n") | ||
76 | wrapper:write('"'..dir.path(cfg.variables["LUA_BINDIR"], cfg.lua_interpreter)..'" -lluarocks.loader -e"luarocks.loader.add_context([['..name..']],[['..version..']])" "'..file..'" %*\n') | ||
77 | wrapper:write("endlocal\n") | ||
78 | wrapper:close() | 73 | wrapper:close() |
79 | return true | 74 | return true |
80 | end | 75 | end |