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'
|
2012-06-20 07:10:49 +00:00
|
|
|
url 'http://luajit.org/download/LuaJIT-2.0.0-beta10.tar.gz'
|
|
|
|
sha1 '560d06621ea616bea1d67867faa235d608040396'
|
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
|
|
|
|
2011-04-01 12:57:51 +00:00
|
|
|
# Skip cleaning both empty folders and bin/libs so external symbols still work.
|
|
|
|
skip_clean :all
|
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
|
2012-03-31 23:31:51 +00:00
|
|
|
# 1 - Remove the '-O2' so we can set Og if needed. Leave the -fomit part.
|
|
|
|
# 2 - Override the hardcoded gcc.
|
|
|
|
# 3 - Remove the '-march=i686' so we can set the march in cflags.
|
|
|
|
# All three changes should persist and were discussed upstream.
|
|
|
|
inreplace 'src/Makefile' do |f|
|
|
|
|
f.change_make_var! 'CCOPT', '-fomit-frame-pointer'
|
|
|
|
f.change_make_var! 'CC', ENV.cc
|
|
|
|
f.change_make_var! 'CCOPT_X86', ''
|
2011-06-09 19:23:07 +00:00
|
|
|
end
|
2011-08-24 04:31:05 +00:00
|
|
|
|
2012-03-31 23:31:51 +00:00
|
|
|
ENV.O2 # Respect the developer's choice.
|
|
|
|
args = [ "PREFIX=#{prefix}" ]
|
2012-08-28 05:07:27 +00:00
|
|
|
if build.include? 'enable-debug' then
|
2012-03-31 23:31:51 +00:00
|
|
|
ENV.Og if ENV.compiler == :clang
|
|
|
|
args << 'CCDEBUG=-g'
|
|
|
|
end
|
|
|
|
|
|
|
|
bldargs = args
|
|
|
|
bldargs << 'amalg'
|
|
|
|
system 'make', *bldargs
|
|
|
|
args << 'install'
|
|
|
|
system 'make', *args # Build requires args during install
|
|
|
|
|
2011-04-01 12:57:51 +00:00
|
|
|
# Non-versioned symlink
|
2012-08-28 05:07:27 +00:00
|
|
|
if build.head?
|
2012-06-20 07:10:49 +00:00
|
|
|
version = "2.0.0-beta10"
|
2011-08-24 04:31:05 +00:00
|
|
|
else
|
|
|
|
version = @version
|
|
|
|
end
|
2011-04-01 12:57:51 +00:00
|
|
|
ln_s bin+"luajit-#{version}", bin+"luajit"
|
2010-03-08 12:22:58 +00:00
|
|
|
end
|
|
|
|
end
|