On Thu, Jul 14, 2011 at 3:58 AM, Wesley Smith <[email protected]> wrote:
> where does luarocks cache its working path?
>
> for example, I have a rock with:
>
> build = {
>        type = "none",
>        install = {
>                lib = {
>                        opengl = "opengl.so"
>                },
>        }
> }
>
>
> If I run luarocks make and am not in the directory where opengl.so is
> located, I get errors despite the rockspec path I gave having the same
> directory as opengl.so.  In other words, I'm trying to figure out how
> to tell luarocks that opengl.so is next to the rockspec.

Answering the general question about working dir in LuaRocks:

That depends whether it is using LuaFileSystem or not. If
LuaFileSystem is available, then the working path is the actual
working path of the process. If LuaFileSystem is not available then we
don't have lfs.chdir and we can only use external commands, so
LuaRocks keeps an internal stack of directories and internally
prepends a "cd directory; " to every os.execute.

Specifically about 'luarocks make':

This one was designed to work somewhat like GNU Make, so the commands
are relative to the current directory. GNU make has a -C flag that
basically does a chdir in the very beginning, but I figured that this
would be unnecessary since if you are invoking 'luarocks make' in a
shell script you can 'cd' (or 'pushd'/'popd') yourself; if you are
calling it from within a Lua script you can do the same with
LuaFileSystem.

> FWIW, I'm hacking on the luarocks source, so if there's a way through
> any of the modules to affect where luarocks searches for this file
> during the make command, I can definitely do that.

How are you calling 'luarocks make'? In any case, 'luarocks make' is
basically a frontend to build.build_rockspec(), so you could just do
something like:

fs.change_dir(dir.dir_name(rockspec_path))
build.build_rockspec(rockspec_path, false, true)
fs.pop_dir()

Hope that helps!

-- 
-- Hisham
http://hisham.hm/ - http://colorbleed.com.br/

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Luarocks-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply via email to