aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/ragel.rb
blob: c9341da95a84f149b645544ef7da7ba2962e8b6f (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
require 'formula'

class RagelUserGuide < Formula
  url 'http://www.complang.org/ragel/ragel-guide-6.7.pdf'
  sha1 '6f3483fea075941c989ac37e6c49afabc7e181c0'
end

class Ragel < Formula
  homepage 'http://www.complang.org/ragel/'
  url 'http://www.complang.org/ragel/ragel-6.7.tar.gz'
  sha1 'bf12b634f5a25e5ba305edfee59a455069ed3b0a'

  def install
    if ENV.compiler == :clang
      # fix build with clang
      inreplace ["aapl/avlcommon.h", "aapl/bstcommon.h", "aapl/bubblesort.h", "aapl/mergesort.h"], /([^:.])(compare)/, '\1this->\2'
      # fix build with libc++
      inreplace 'ragel/javacodegen.cpp', /setiosflags/, 'std::\&'
    end

    system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
    system "make install"

    # Install the prebuilt PDF documentation
    RagelUserGuide.new.brew { doc.install Dir['*.pdf'] }
  end
end