Merge pull request #207012 from Homebrew/bump-tailwindcss-4.0.5
[Homebrew/homebrew-core.git] / Formula / t / tcc.rb
blob1a76bad502946b35969e015941386b6dd85ff906
1 class Tcc < Formula
2   desc "Tiny C compiler"
3   homepage "https://bellard.org/tcc/"
4   license "LGPL-2.0-or-later"
5   revision 1
6   head "https://repo.or.cz/tinycc.git", branch: "mob"
8   stable do
9     url "https://download.savannah.nongnu.org/releases/tinycc/tcc-0.9.27.tar.bz2"
10     sha256 "de23af78fca90ce32dff2dd45b3432b2334740bb9bb7b05bf60fdbfc396ceb9c"
12     # Big Sur and later are not supported
13     # http://savannah.nongnu.org/bugs/?59640
14     depends_on maximum_macos: :catalina
15   end
17   livecheck do
18     url "https://download.savannah.nongnu.org/releases/tinycc/"
19     regex(/href=.*?tcc[._-]v?(\d+(?:\.\d+)+)\.t/i)
20   end
22   bottle do
23     sha256 catalina:     "68930891a8746b34b372ecfe43a6a042d0097414713c831353a095135d7b9569"
24     sha256 mojave:       "ca8cd4827e72201cd5f368b5b74b9dead8554e0188b7ea63f81926d775d704e9"
25     sha256 high_sierra:  "1ad7de1b974ca3e16668dec9cbef2accb29ecedb8f3f5819c06a2f77c8f3f2d1"
26     sha256 sierra:       "c2949f3a99d1efb600137e4bb617ebd8a385697038f9cb8136c681033a7a636e"
27     sha256 x86_64_linux: "053f79a5752554e18ecba168184e48481bce8a2db418a3f9b0de094f9e6d0e4d"
28   end
30   def install
31     # Add appropriate include paths for macOS or Linux.
32     os_include_path = if OS.mac?
33       MacOS.sdk_path/"usr/include"
34     else
35       "/usr/include:/usr/include/x86_64-linux-gnu"
36     end
38     args = %W[
39       --prefix=#{prefix}
40       --source-path=#{buildpath}
41       --sysincludepaths=#{HOMEBREW_PREFIX}/include:#{os_include_path}:{B}/include
42       --enable-cross
43     ]
44     args << "--cc=#{ENV.cc}" if build.head?
46     ENV.deparallelize
47     system "./configure", *args
49     make_args = []
50     make_args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}" if OS.mac?
52     system "make", *make_args
53     system "make", "install"
54   end
56   test do
57     (testpath/"hello-c.c").write <<~C
58       #include <stdio.h>
59       int main()
60       {
61         puts("Hello, world!");
62         return 0;
63       }
64     C
65     assert_equal "Hello, world!\n", shell_output("#{bin}/tcc -run hello-c.c")
66   end
67 end