diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/lua.rb | 4 | ||||
| -rw-r--r-- | Library/Formula/luarocks.rb | 38 |
2 files changed, 40 insertions, 2 deletions
diff --git a/Library/Formula/lua.rb b/Library/Formula/lua.rb index 1d2cf89b8..b62ac6db6 100644 --- a/Library/Formula/lua.rb +++ b/Library/Formula/lua.rb @@ -31,6 +31,10 @@ class Lua < Formula s.gsub! "INSTALL_MAN= ${prefix}/man/man1", "INSTALL_MAN= ${prefix}/share/man/man1" end + # this ensures that this symlinking for lua starts at lib/lua/5.1 and not + # below that, thus making luarocks work + (HOMEBREW_PREFIX/"lib/lua"/version.split('.')[0..1].join('.')).mkpath + system "make", "macosx", "INSTALL_TOP=#{prefix}", "INSTALL_MAN=#{man1}" system "make", "install", "INSTALL_TOP=#{prefix}", "INSTALL_MAN=#{man1}" diff --git a/Library/Formula/luarocks.rb b/Library/Formula/luarocks.rb index 3f7e5dabd..7507fe5dd 100644 --- a/Library/Formula/luarocks.rb +++ b/Library/Formula/luarocks.rb @@ -11,6 +11,10 @@ class Luarocks < Formula fails_with_llvm "Lua itself compiles with llvm, but may fail when other software trys to link." + def patches + DATA if HOMEBREW_PREFIX.to_s == '/usr/local' + end + def options [['--with-luajit', 'Use LuaJIT instead of the stock Lua.']] end @@ -18,7 +22,7 @@ class Luarocks < Formula def install # Install to the Cellar, but direct modules to HOMEBREW_PREFIX args = ["--prefix=#{prefix}", - "--rocks-tree=#{HOMEBREW_PREFIX}/lib/luarocks", + "--rocks-tree=#{HOMEBREW_PREFIX}", "--sysconfdir=#{etc}/luarocks"] if use_luajit? @@ -31,9 +35,39 @@ class Luarocks < Formula system "make install" end + def caveats; <<-EOS.undent + Luarocks now "just works" but this means any rocks you installed previously + will need to be moved from `lib/luarocks/lib/luarocks` to `lib/luarocks`. + You'll probably have a better time of it all if you just reinstall them. + EOS + end + def test opoo "Luarocks test script installs 'lpeg'" system "luarocks install lpeg" - system "lua", "-lluarocks.loader", "-llpeg", "-e", 'print ("Hello World!")' + system "lua", "-llpeg", "-e", 'print ("Hello World!")' end end + + +# this patch because we set the permissions of /usr/local to root owned +# not user writable to be "good" citizens of /usr/local. Actually LUA is being +# pedantic since all the directories it wants under /usr/local are writable +# so we just return true. Naughty, but I don't know LUA and don't want to +# write a better patch. +__END__ +diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua +index 3a547fe..ca4ddc5 100644 +--- a/src/luarocks/fs/lua.lua ++++ b/src/luarocks/fs/lua.lua +@@ -619,10 +619,5 @@ end + -- @return boolean or (boolean, string): true on success, false on failure, + -- plus an error message. + function check_command_permissions(flags) +- local root_dir = path.root_dir(cfg.rocks_dir) +- if not flags["local"] and not fs.is_writable(root_dir) then +- return nil, "Your user does not have write permissions in " .. root_dir .. +- " \n-- you may want to run as a privileged user or use your local tree with --local." +- end + return true + end |
