2010-03-08 12:22:58 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Luajit < Formula
|
2010-09-10 05:37:52 +00:00
|
|
|
homepage 'http://luajit.org/luajit.html'
|
2013-06-06 17:24:51 +00:00
|
|
|
url 'http://luajit.org/download/LuaJIT-2.0.2.tar.gz'
|
|
|
|
sha1 'd21426c4fc6ad8888255139039a014f7e28e7300'
|
2012-04-19 02:37:43 +00:00
|
|
|
head 'http://luajit.org/git/luajit-2.0.git'
|
2010-03-08 12:22:58 +00:00
|
|
|
|
2012-10-21 20:03:46 +00:00
|
|
|
skip_clean 'lib/lua/5.1', 'share/lua/5.1'
|
2010-03-08 12:22:58 +00:00
|
|
|
|
2012-08-28 05:07:27 +00:00
|
|
|
option "enable-debug", "Build with debugging symbols"
|
2011-06-09 19:23:07 +00:00
|
|
|
|
2010-03-08 12:22:58 +00:00
|
|
|
def install
|
2013-11-12 17:50:44 +00:00
|
|
|
# 1 - Override the hardcoded gcc.
|
|
|
|
# 2 - Remove the '-march=i686' so we can set the march in cflags.
|
|
|
|
# Both changes should persist and were discussed upstream.
|
2012-03-31 23:31:51 +00:00
|
|
|
inreplace 'src/Makefile' do |f|
|
|
|
|
f.change_make_var! 'CC', ENV.cc
|
2012-10-23 00:47:03 +00:00
|
|
|
f.change_make_var! 'CCOPT_x86', ''
|
2011-06-09 19:23:07 +00:00
|
|
|
end
|
2011-08-24 04:31:05 +00:00
|
|
|
|
2013-11-12 17:50:44 +00:00
|
|
|
ENV.O2 # Respect the developer's choice.
|
|
|
|
|
|
|
|
args = %W[PREFIX=#{prefix}]
|
|
|
|
|
|
|
|
# This doesn't yet work under superenv because it removes '-g'
|
|
|
|
args << 'CCDEBUG=-g' if build.include? 'enable-debug'
|
2012-03-31 23:31:51 +00:00
|
|
|
|
2013-11-20 15:00:41 +00:00
|
|
|
system 'make', 'amalg', *args
|
|
|
|
system 'make', 'install', *args
|
2010-03-08 12:22:58 +00:00
|
|
|
end
|
2013-11-12 19:48:46 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
system "#{bin}/luajit", "-e", <<-EOS.strip
|
|
|
|
local ffi = require("ffi")
|
|
|
|
ffi.cdef("int printf(const char *fmt, ...);")
|
|
|
|
ffi.C.printf("Hello %s!\\n", "#{ENV['USER']}")
|
|
|
|
EOS
|
|
|
|
end
|
2010-03-08 12:22:58 +00:00
|
|
|
end
|