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

class Tcc < Formula
  homepage 'http://bellard.org/tcc/'
  url 'http://download.savannah.gnu.org/releases/tinycc/tcc-0.9.26.tar.bz2'
  sha1 '7110354d3637d0e05f43a006364c897248aed5d0'

  def install
    ENV.j1
    system "./configure", "--prefix=#{prefix}",
                          "--source-path=#{buildpath}",
                          "--sysincludepaths=/usr/local/include:#{MacOS.sdk_path}/usr/include:{B}/include"
    system "make"
    system "make", "install"
    system "make", "test"
  end

  test do
    (testpath/"hello-c.c").write <<-EOS.undent
      #include <stdio.h>
      int main()
      {
        puts("Hello, world!");
        return 0;
      }
    EOS
    assert_equal "Hello, world!\n", shell_output("#{bin}/tcc -run hello-c.c")
  end
end