diff options
| author | Philipp Janda <siffiejoe@gmx.net> | 2013-09-26 09:02:33 +0200 |
|---|---|---|
| committer | Philipp Janda <siffiejoe@gmx.net> | 2013-09-26 09:02:33 +0200 |
| commit | 4745a6e42598414fb38565c75e84bd13723372ba (patch) | |
| tree | 7a74038ae3237bd55c32e386ecf2e685c8643539 /src | |
| parent | f63fa840457558595364eec980082f9ae921d086 (diff) | |
| download | luarocks-4745a6e42598414fb38565c75e84bd13723372ba.tar.gz luarocks-4745a6e42598414fb38565c75e84bd13723372ba.tar.bz2 luarocks-4745a6e42598414fb38565c75e84bd13723372ba.zip | |
support for tables in (runtime_)external_deps_subdirs.*
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/cfg.lua | 17 | ||||
| -rw-r--r-- | src/luarocks/deps.lua | 36 |
2 files changed, 44 insertions, 9 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 8e26bb46..9227db4b 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
| @@ -437,6 +437,23 @@ if detected.solaris then | |||
| 437 | defaults.variables.MAKE = "gmake" | 437 | defaults.variables.MAKE = "gmake" |
| 438 | end | 438 | end |
| 439 | 439 | ||
| 440 | if type(site_config.LUAROCKS_ADD_LIB_SUBDIRS) == "table" and next(site_config.LUAROCKS_ADD_LIB_SUBDIRS) ~= nil then | ||
| 441 | local lib = defaults.external_deps_subdirs.lib | ||
| 442 | if type(lib) ~= "table" then | ||
| 443 | lib = { lib } | ||
| 444 | end | ||
| 445 | local rt_lib = defaults.runtime_external_deps_subdirs.lib | ||
| 446 | if type(rt_lib) ~= "table" then | ||
| 447 | rt_lib = { rt_lib } | ||
| 448 | end | ||
| 449 | for i,v in ipairs(site_config.LUAROCKS_ADD_LIB_SUBDIRS) do | ||
| 450 | lib[#lib+1] = v | ||
| 451 | rt_lib[#rt_lib+1] = v | ||
| 452 | end | ||
| 453 | defaults.external_deps_subdirs.lib = lib | ||
| 454 | defaults.runtime_external_deps_subdirs.lib = rt_lib | ||
| 455 | end | ||
| 456 | |||
| 440 | -- Expose some more values detected by LuaRocks for use by rockspec authors. | 457 | -- Expose some more values detected by LuaRocks for use by rockspec authors. |
| 441 | defaults.variables.LIB_EXTENSION = defaults.lib_extension | 458 | defaults.variables.LIB_EXTENSION = defaults.lib_extension |
| 442 | defaults.variables.OBJ_EXTENSION = defaults.obj_extension | 459 | defaults.variables.OBJ_EXTENSION = defaults.obj_extension |
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 |
