aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/luajit.rb
blob: fa1cb26a14a89938016592a17d89b47e9f0ddc5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require 'formula'

class Luajit < Formula
  url 'http://luajit.org/download/LuaJIT-2.0.0-beta8.tar.gz'
  head 'http://luajit.org/git/luajit-2.0.git', :using => :git
  homepage 'http://luajit.org/luajit.html'
  md5 'f0748a73ae268d49b1d01f56c4fe3e61'

  # Skip cleaning both empty folders and bin/libs so external symbols still work.
  skip_clean :all

  def options
    [["--debug", "Build with debugging symbols."]]
  end

  # Apply beta8 hotfix #1
  def patches
    if not ARGV.build_head?
      { :p1 => "http://luajit.org/download/beta8_hotfix1.patch" }
    end
  end

  def install
    if ARGV.include? '--debug'
      system "make", "CCDEBUG=-g", "PREFIX=#{prefix}", "amalg"
      system "make", "CCDEBUG=-g", "PREFIX=#{prefix}", "install"
    else
      system "make", "PREFIX=#{prefix}", "amalg"
      system "make", "PREFIX=#{prefix}", "install"
    end

    # Non-versioned symlink
    if ARGV.build_head?
      version = "2.0.0-beta8"
    else
      version = @version
    end
    ln_s bin+"luajit-#{version}", bin+"luajit"
  end
end