2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-08-31 22:31:54 +00:00
|
|
|
|
|
|
|
class Lua <Formula
|
2009-11-21 17:06:11 +00:00
|
|
|
url 'http://www.lua.org/ftp/lua-5.1.4.tar.gz'
|
|
|
|
homepage 'http://www.lua.org/'
|
|
|
|
md5 'd0870f2de55d59c1c8419f36e8fac150'
|
2010-06-19 00:07:32 +00:00
|
|
|
|
2010-06-29 20:15:10 +00:00
|
|
|
# Skip cleaning both empty folders and bin/libs so external symbols still work.
|
|
|
|
def skip_clean? path; true; end
|
2009-08-31 22:31:54 +00:00
|
|
|
|
|
|
|
def install
|
2010-07-16 21:19:14 +00:00
|
|
|
# Apply patch-level 2
|
|
|
|
cd 'src' do
|
|
|
|
curl "http://www.lua.org/ftp/patch-lua-5.1.4-2", "-O"
|
|
|
|
`patch < patch-lua-5.1.4-2`
|
|
|
|
end
|
|
|
|
|
2010-06-19 00:07:32 +00:00
|
|
|
# Use our CC/CFLAGS to compile.
|
|
|
|
inreplace 'src/Makefile' do |s|
|
|
|
|
s.remove_make_var! 'CC'
|
|
|
|
s.change_make_var! 'CFLAGS', "#{ENV['CFLAGS']} $(MYCFLAGS)"
|
|
|
|
end
|
2010-02-19 19:19:01 +00:00
|
|
|
|
2010-06-19 00:07:32 +00:00
|
|
|
# Fix path in the config header
|
2009-09-15 09:23:24 +00:00
|
|
|
inreplace 'src/luaconf.h', '/usr/local', HOMEBREW_PREFIX
|
2009-09-05 03:05:08 +00:00
|
|
|
|
2010-06-19 00:07:32 +00:00
|
|
|
# Fix paths in the .pc
|
|
|
|
inreplace 'etc/lua.pc' do |s|
|
|
|
|
s.gsub! "prefix= /usr/local", "prefix=#{HOMEBREW_PREFIX}"
|
2010-07-16 21:19:14 +00:00
|
|
|
s.gsub! "INSTALL_MAN= ${prefix}/man/man1", "INSTALL_MAN= ${prefix}/share/man/man1"
|
2010-06-19 00:07:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
system "make", "macosx", "INSTALL_TOP=#{prefix}", "INSTALL_MAN=#{man1}"
|
|
|
|
system "make", "install", "INSTALL_TOP=#{prefix}", "INSTALL_MAN=#{man1}"
|
2009-09-05 03:05:08 +00:00
|
|
|
|
2009-12-11 17:53:27 +00:00
|
|
|
(lib+"pkgconfig").install 'etc/lua.pc'
|
2009-08-31 22:31:54 +00:00
|
|
|
end
|
|
|
|
end
|