-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Expand file tree
/
Copy pathgarble.rb
More file actions
47 lines (40 loc) · 1.8 KB
/
Copy pathgarble.rb
File metadata and controls
47 lines (40 loc) · 1.8 KB
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
41
42
43
44
45
46
47
class Garble < Formula
desc "Obfuscate Go builds"
homepage "https://github.com/burrowers/garble"
url "https://github.com/burrowers/garble/archive/refs/tags/v0.14.1.tar.gz"
sha256 "0eb231e6ad91793f0fcf086fb57a1654f0c2056284a79fb12ac955ade6791737"
license "BSD-3-Clause"
head "https://github.com/burrowers/garble.git", branch: "master"
bottle do
sha256 cellar: :any_skip_relocation, arm64_sequoia: "9abc206d2d2b7eb241c831f4c747c3751cbf0889a55a5f8c43035597dcdfaa6b"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "9abc206d2d2b7eb241c831f4c747c3751cbf0889a55a5f8c43035597dcdfaa6b"
sha256 cellar: :any_skip_relocation, arm64_ventura: "9abc206d2d2b7eb241c831f4c747c3751cbf0889a55a5f8c43035597dcdfaa6b"
sha256 cellar: :any_skip_relocation, sonoma: "ccb7bd3ccd7f7b6f72ed7d83be99078b881a4afb7640120e05046e7eb04a4215"
sha256 cellar: :any_skip_relocation, ventura: "ccb7bd3ccd7f7b6f72ed7d83be99078b881a4afb7640120e05046e7eb04a4215"
sha256 cellar: :any_skip_relocation, x86_64_linux: "7bf42f55a4caabbf26e018ee60d7eb8333fb7a51b490cc1b65d6d50169b062e7"
end
depends_on "go" => [:build, :test]
depends_on "git"
def install
inreplace "internal/linker/linker.go", "\"git\"", "\"#{Formula["git"].opt_bin}/git\""
system "go", "build", *std_go_args(ldflags: "-s -w")
end
test do
(testpath/"hello.go").write <<~GO
package main
import "fmt"
func main() {
fmt.Println("Hello World")
}
GO
system bin/"garble", "-literals", "-tiny", "build", testpath/"hello.go"
assert_equal "Hello World\n", shell_output("#{testpath}/hello")
expected = <<~EOS
Build settings:
-buildmode exe
-compiler gc
-trimpath true
EOS
assert_match expected, shell_output("#{bin}/garble version")
end
end