diff options
| author | Dominyk Tiller | 2014-10-09 22:48:35 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2014-10-10 00:42:06 +0100 |
| commit | 1c8a841dfe5c9b52f1ba4a4231e26a4f604bded8 (patch) | |
| tree | fbcacb67888045179e74600637307fbe622f0a72 /Library | |
| parent | 5bdc4311bb82bd09ad2bf61ac9fdfaf79ccb78ae (diff) | |
| download | homebrew-1c8a841dfe5c9b52f1ba4a4231e26a4f604bded8.tar.bz2 | |
lua* improvements.
Fix some issues with luarocks looking for the wrong version and cleanup
the lua and lua51 formulae.
Closes #32354.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/lua.rb | 27 | ||||
| -rw-r--r-- | Library/Formula/lua51.rb | 33 | ||||
| -rw-r--r-- | Library/Formula/luarocks.rb | 72 |
3 files changed, 46 insertions, 86 deletions
diff --git a/Library/Formula/lua.rb b/Library/Formula/lua.rb index 2b6043d78..762febde7 100644 --- a/Library/Formula/lua.rb +++ b/Library/Formula/lua.rb @@ -1,9 +1,10 @@ -require 'formula' +require "formula" class Lua < Formula - homepage 'http://www.lua.org/' - url 'http://www.lua.org/ftp/lua-5.2.3.tar.gz' - sha1 '926b7907bc8d274e063d42804666b40a3f3c124c' + homepage "http://www.lua.org/" + url "http://www.lua.org/ftp/lua-5.2.3.tar.gz" + mirror "https://mirrors.kernel.org/debian/pool/main/l/lua5.2/lua5.2_5.2.3.orig.tar.gz" + sha1 "926b7907bc8d274e063d42804666b40a3f3c124c" revision 1 fails_with :llvm do @@ -12,8 +13,8 @@ class Lua < Formula end option :universal - option 'with-completion', 'Enables advanced readline support' - option 'without-sigaction', 'Revert to ANSI signal instead of improved POSIX sigaction' + option "with-completion", "Enables advanced readline support" + option "without-sigaction", "Revert to ANSI signal instead of improved POSIX sigaction" # Be sure to build a dylib, or else runtime modules will pull in another static copy of liblua = crashy # See: https://github.com/Homebrew/homebrew/pull/5043 @@ -36,14 +37,14 @@ class Lua < Formula ENV.universal_binary if build.universal? # Use our CC/CFLAGS to compile. - inreplace 'src/Makefile' do |s| - s.remove_make_var! 'CC' - s.change_make_var! 'CFLAGS', "#{ENV.cflags} -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS)" - s.change_make_var! 'MYLDFLAGS', ENV.ldflags + inreplace "src/Makefile" do |s| + s.remove_make_var! "CC" + s.change_make_var! "CFLAGS", "#{ENV.cflags} -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS)" + s.change_make_var! "MYLDFLAGS", ENV.ldflags end # Fix path in the config header - inreplace 'src/luaconf.h', '/usr/local', HOMEBREW_PREFIX + inreplace "src/luaconf.h", "/usr/local", HOMEBREW_PREFIX # We ship our own pkg-config file as Lua no longer provide them upstream. system "make", "macosx", "INSTALL_TOP=#{prefix}", "INSTALL_MAN=#{man1}" @@ -82,6 +83,10 @@ class Lua < Formula Cflags: -I${includedir} EOS end + + test do + system "#{bin}/lua", "-e", "print ('Ducks are cool')" + end end __END__ diff --git a/Library/Formula/lua51.rb b/Library/Formula/lua51.rb index e20e9a952..eea99e023 100644 --- a/Library/Formula/lua51.rb +++ b/Library/Formula/lua51.rb @@ -1,11 +1,12 @@ -require 'formula' +require "formula" class Lua51 < Formula # 5.2 is not fully backwards compatible so we must retain 2 Luas for now. # The transition has begun. Lua will now become Lua51, and Lua52 will become Lua. - homepage 'http://www.lua.org/' - url 'http://www.lua.org/ftp/lua-5.1.5.tar.gz' - sha1 'b3882111ad02ecc6b972f8c1241647905cb2e3fc' + homepage "http://www.lua.org/" + url "http://www.lua.org/ftp/lua-5.1.5.tar.gz" + mirror "https://mirrors.kernel.org/debian/pool/main/l/lua5.1/lua5.1_5.1.5.orig.tar.gz" + sha1 "b3882111ad02ecc6b972f8c1241647905cb2e3fc" bottle do sha1 "2b64683201c6ae570760a4b60406e6f3ab26d9df" => :mavericks @@ -19,8 +20,8 @@ class Lua51 < Formula end option :universal - option 'with-completion', 'Enables advanced readline support' - option 'without-sigaction', 'Revert to ANSI signal instead of improved POSIX sigaction' + option "with-completion", "Enables advanced readline support" + option "without-sigaction", "Revert to ANSI signal instead of improved POSIX sigaction" # Be sure to build a dylib, or else runtime modules will pull in another static copy of liblua = crashy # See: https://github.com/Homebrew/homebrew/pull/5043 @@ -44,18 +45,18 @@ class Lua51 < Formula ENV.universal_binary if build.universal? # Use our CC/CFLAGS to compile. - inreplace 'src/Makefile' do |s| - s.remove_make_var! 'CC' - s.change_make_var! 'CFLAGS', "#{ENV.cflags} $(MYCFLAGS)" - s.change_make_var! 'MYLDFLAGS', ENV.ldflags - s.sub! 'MYCFLAGS_VAL', "-fno-common -DLUA_USE_LINUX" + inreplace "src/Makefile" do |s| + s.remove_make_var! "CC" + s.change_make_var! "CFLAGS", "#{ENV.cflags} $(MYCFLAGS)" + s.change_make_var! "MYLDFLAGS", ENV.ldflags + s.sub! "MYCFLAGS_VAL", "-fno-common -DLUA_USE_LINUX" end # Fix path in the config header - inreplace 'src/luaconf.h', '/usr/local', HOMEBREW_PREFIX + inreplace "src/luaconf.h", "/usr/local", HOMEBREW_PREFIX # Fix paths in the .pc - inreplace 'etc/lua.pc' do |s| + inreplace "etc/lua.pc" do |s| s.gsub! "prefix= /usr/local", "prefix=#{HOMEBREW_PREFIX}" s.gsub! "INSTALL_MAN= ${prefix}/man/man1", "INSTALL_MAN= ${prefix}/share/man/man1" s.gsub! "INSTALL_INC= ${prefix}/include", "INSTALL_INC= ${prefix}/include/lua-5.1" @@ -66,7 +67,7 @@ class Lua51 < Formula system "make", "macosx", "INSTALL_TOP=#{prefix}", "INSTALL_MAN=#{man1}", "INSTALL_INC=#{include}/lua-5.1" system "make", "install", "INSTALL_TOP=#{prefix}", "INSTALL_MAN=#{man1}", "INSTALL_INC=#{include}/lua-5.1" - (lib+"pkgconfig").install 'etc/lua.pc' + (lib+"pkgconfig").install "etc/lua.pc" # Renaming from Lua to Lua51. # Note that the naming must be both lua-version & lua.version. @@ -84,9 +85,7 @@ class Lua51 < Formula end test do - output = `#{bin}/lua-5.1 -e "for i=0,9 do io.write(i) end"` - assert_equal "0123456789", output - assert_equal 0, $?.exitstatus + system "#{bin}/lua5.1", "-e", "print ('Ducks are cool')" end end diff --git a/Library/Formula/luarocks.rb b/Library/Formula/luarocks.rb index 492d65fe0..1a000174f 100644 --- a/Library/Formula/luarocks.rb +++ b/Library/Formula/luarocks.rb @@ -1,19 +1,10 @@ -require 'formula' +require "formula" class Luarocks < Formula homepage "http://luarocks.org" - - stable do - url "http://luarocks.org/releases/luarocks-2.2.0.tar.gz" - sha1 "e2de00f070d66880f3766173019c53a23229193d" - - # Remove writability checks in the install script. - # Homebrew checks that its install targets are writable, or fails with - # appropriate messaging if not. The check that luarocks does has been - # seen to have false positives, so remove it. - # TODO: better document the false positive cases, or remove this patch. - patch :DATA - end + url "http://luarocks.org/releases/luarocks-2.2.0.tar.gz" + sha1 "e2de00f070d66880f3766173019c53a23229193d" + revision 1 bottle do sha1 "eabd3d0f2bb7979ac831ce948e8d288569d2a0c8" => :mavericks @@ -23,7 +14,7 @@ class Luarocks < Formula head "https://github.com/keplerproject/luarocks.git" - depends_on 'lua' + depends_on "lua" fails_with :llvm do cause "Lua itself compiles with llvm, but may fail when other software tries to link." @@ -31,14 +22,18 @@ class Luarocks < Formula def install # Install to the Cellar, but direct modules to HOMEBREW_PREFIX + # Specify where the Lua is to avoid accidental conflict. + lua_prefix = Formula["lua"].opt_prefix + args = ["--prefix=#{prefix}", "--rocks-tree=#{HOMEBREW_PREFIX}", - "--lua-version=5.2", - "--sysconfdir=#{etc}/luarocks"] + "--sysconfdir=#{etc}/luarocks", + "--with-lua=#{lua_prefix}", + "--lua-version=5.2"] system "./configure", *args - system "make" - system "make install" + system "make", "build" + system "make", "install" end def caveats; <<-EOS.undent @@ -50,45 +45,6 @@ class Luarocks < Formula end test do - opoo "Luarocks test script installs 'lpeg'" - system "#{bin}/luarocks", "install", "lpeg" - system "lua", "-llpeg", "-e", 'print ("Hello World!")' + system "#{bin}/luarocks", "install", "say" end end - -__END__ -diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua -index b261905..f396030 100644 ---- a/src/luarocks/fs/lua.lua -+++ b/src/luarocks/fs/lua.lua -@@ -791,31 +791,7 @@ end - -- @return boolean or (boolean, string): true on success, false on failure, - -- plus an error message. - function fs_lua.check_command_permissions(flags) -- local root_dir = path.root_dir(cfg.rocks_dir) -- local ok = true -- local err = "" -- for _, dir in ipairs { cfg.rocks_dir, root_dir } do -- if fs.exists(dir) and not fs.is_writable(dir) then -- ok = false -- err = "Your user does not have write permissions in " .. dir -- break -- end -- end -- local root_parent = dir.dir_name(root_dir) -- if ok and not fs.exists(root_dir) and not fs.is_writable(root_parent) then -- ok = false -- err = root_dir.." does not exist and your user does not have write permissions in " .. root_parent -- end -- if ok then -- return true -- else -- if flags["local"] then -- err = err .. " \n-- please check your permissions." -- else -- err = err .. " \n-- you may want to run as a privileged user or use your local tree with --local." -- end -- return nil, err -- end -+ return true - end |
