Interesting! I'll take a closer look at this and run some tests when I get back to Rio next week.
Thanks, -- Hisham On Tue, Jan 8, 2013 at 4:27 PM, Reuben Thomas <r...@sc3d.org> wrote: > Luarocks currently makes a fairly weak guess at where to find libraries on > Unix: it uses the prefixes "/usr" and "/usr/local", or whatever is > configured, and appends "lib" to each. This fails, for example, to find many > libraries on a modern multi-arch Ubuntu/Debian setup, where many libraries > are under /usr/lib/ARCH. > > Of course, it's possible to configure for this case, but that only works > per-user or at best per-system. I think it's easy to go one better, and also > cope with other cases, like finding per-user libraries: if CC is gcc, then > the following command: > > lua -e 'require "std"; s = io.shell("gcc -print-search-dirs|grep > ^libraries"):gsub ("^libraries: =",""); for _, d in ipairs(s:split(":")) do > print (io.shell("readlink -m " .. d):chomp ()) end' > > produces a comprehensive list of directories. (Here I use stdlib to get > string.split and io.shell; from looking at LuaRocks, code to construct a > list of library directories would be something like: > > local libs, s = {}, io.popen("gcc -print-search-dirs|grep > ^libraries"):read("*a"):gsub ("^libraries: =",""); for _, d in > ipairs(split_string(s, ":")) do libs:insert(io.popen("readlink -m " .. > d):read("*a"):gsub ("\n$","")) end > > I guess this would need to be integrated into deps.lua/check_external_deps. > Luarocks currently allows the prefix and subdirs.lib to be customized > individually, where here we get a list of complete directories. Hence, I > would move the checking for different types of dependency (currently handled > by the table "dirs") outside the loop over cfg.external_dep_dirs, so that > each type of dependency is checked separately, and then allow each to have > its own default. If no value is provided by the user for EITHER > external_dep_dirs OR subdirs.libdir is customized, then the above list of > dirs can be used (setting external_dep_dirs to the list returned by the > above code, and subdirs.lib to ""). > > Similar code could be used to generate more intelligent defaults for headers > by parsing the output of "cpp -v" and for binaries by parsing $PATH (the > last is not even GCC-specific). > > -- > http://rrt.sc3d.org > > ------------------------------------------------------------------------------ > Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS > and more. Get SQL Server skills now (including 2012) with LearnDevNow - > 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts. > SALE $99.99 this month only - learn more at: > http://p.sf.net/sfu/learnmore_122512 > _______________________________________________ > Luarocks-developers mailing list > Luarocks-developers@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/luarocks-developers > ------------------------------------------------------------------------------ Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS and more. Get SQL Server skills now (including 2012) with LearnDevNow - 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only - learn more at: http://p.sf.net/sfu/learnmore_122512 _______________________________________________ Luarocks-developers mailing list Luarocks-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/luarocks-developers