Merge pull request #207012 from Homebrew/bump-tailwindcss-4.0.5
[Homebrew/homebrew-core.git] / Formula / g / garble.rb
blob08be9dcb30fdf1a5d42cc54360c73666ad3a55b6
1 class Garble < Formula
2   desc "Obfuscate Go builds"
3   homepage "https://github.com/burrowers/garble"
4   url "https://github.com/burrowers/garble/archive/refs/tags/v0.14.0.tar.gz"
5   sha256 "9fb75bad82fc89afe08bbdb26c9bbbba8766a1663f8bb585318cf363fd3eedbf"
6   license "BSD-3-Clause"
7   revision 1
8   head "https://github.com/burrowers/garble.git", branch: "master"
10   bottle do
11     sha256 cellar: :any_skip_relocation, arm64_sequoia: "9abc206d2d2b7eb241c831f4c747c3751cbf0889a55a5f8c43035597dcdfaa6b"
12     sha256 cellar: :any_skip_relocation, arm64_sonoma:  "9abc206d2d2b7eb241c831f4c747c3751cbf0889a55a5f8c43035597dcdfaa6b"
13     sha256 cellar: :any_skip_relocation, arm64_ventura: "9abc206d2d2b7eb241c831f4c747c3751cbf0889a55a5f8c43035597dcdfaa6b"
14     sha256 cellar: :any_skip_relocation, sonoma:        "ccb7bd3ccd7f7b6f72ed7d83be99078b881a4afb7640120e05046e7eb04a4215"
15     sha256 cellar: :any_skip_relocation, ventura:       "ccb7bd3ccd7f7b6f72ed7d83be99078b881a4afb7640120e05046e7eb04a4215"
16     sha256 cellar: :any_skip_relocation, x86_64_linux:  "7bf42f55a4caabbf26e018ee60d7eb8333fb7a51b490cc1b65d6d50169b062e7"
17   end
19   depends_on "go" => [:build, :test]
20   depends_on "git"
22   def install
23     inreplace "internal/linker/linker.go", "\"git\"", "\"#{Formula["git"].opt_bin}/git\""
24     system "go", "build", *std_go_args(ldflags: "-s -w")
25   end
27   test do
28     (testpath/"hello.go").write <<~GO
29       package main
31       import "fmt"
33       func main() {
34           fmt.Println("Hello World")
35       }
36     GO
37     system bin/"garble", "-literals", "-tiny", "build", testpath/"hello.go"
38     assert_equal "Hello World\n", shell_output("#{testpath}/hello")
40     expected = <<~EOS
41       Build settings:
42             -buildmode exe
43              -compiler gc
44              -trimpath true
45     EOS
46     assert_match expected, shell_output("#{bin}/garble version")
47   end
48 end