Skip to content

Commit 2a9c1d1

Browse files
authored
Merge pull request #204696 from Homebrew/bold
bold 0.1.0 (new formula)
2 parents 71c9b52 + 26411cf commit 2a9c1d1

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

.github/autobump.txt

+1
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ bluez
284284
bmake
285285
bnd
286286
bob
287+
bold
287288
bomber
288289
bore-cli
289290
borgbackup

Formula/b/bold.rb

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
class Bold < Formula
2+
desc "Drop-in replacement for Apple system linker ld"
3+
homepage "https://github.com/kubkon/bold"
4+
url "https://github.com/kubkon/bold/archive/refs/tags/v0.1.0.tar.gz"
5+
sha256 "2496f04e47c9d5e17ef273b26519abf429b5c3e3df6d264f2941735088253ec0"
6+
license "MIT"
7+
8+
bottle do
9+
sha256 cellar: :any_skip_relocation, arm64_sequoia: "a1deba05b1a4ab3d20a443e7b5a11f63b6cfc44f2996c41dce352fbdc48e78db"
10+
sha256 cellar: :any_skip_relocation, arm64_sonoma: "75029020d0fa32ee7573f9c730b9bbb09a6c98fb310dee951b284df022dfd3b6"
11+
sha256 cellar: :any_skip_relocation, arm64_ventura: "5e4087ae6dc9a698588838f127ed739eaa55d899b143efd5079b40a613db6d1b"
12+
sha256 cellar: :any_skip_relocation, sonoma: "2539d42202287085cf3e89c7e06fce587166465fbb8df8ba4fa23cf8bde298d1"
13+
sha256 cellar: :any_skip_relocation, ventura: "84a0a90973ee9a14a971d3c700f64bd164167518bcb978830080d5361c13ba5c"
14+
end
15+
16+
depends_on "zig" => :build
17+
depends_on :macos # does not build on linux
18+
19+
def install
20+
# Fix illegal instruction errors when using bottles on older CPUs.
21+
# https://github.com/Homebrew/homebrew-core/issues/92282
22+
cpu = case Hardware.oldest_cpu
23+
when :arm_vortex_tempest then "apple_m1" # See `zig targets`.
24+
else Hardware.oldest_cpu
25+
end
26+
27+
args = %W[
28+
--prefix #{prefix}
29+
-Doptimize=ReleaseSafe
30+
-Dstrip=true
31+
]
32+
33+
args << "-Dcpu=#{cpu}" if build.bottle?
34+
35+
system "zig", "build", *args
36+
end
37+
38+
test do
39+
(testpath/"hello.c").write <<~EOS
40+
#include <stdio.h>
41+
int main() {
42+
printf("Hello from Bold\\n");
43+
return 0;
44+
}
45+
EOS
46+
47+
system ENV.cc, "-c", "hello.c", "-o", "hello.o"
48+
arch = Hardware::CPU.arm? ? "arm64" : "x86_64"
49+
macos_min = MacOS.version.to_s
50+
51+
system bin/"bold", "hello.o", "-arch", arch, "-macos_version_min", macos_min,
52+
"-syslibroot", MacOS.sdk_path, "-lSystem", "-o", "test"
53+
54+
assert_equal "Hello from Bold\n", shell_output("./test")
55+
end
56+
end

0 commit comments

Comments
 (0)