Skip to content

bold 0.1.0 (new formula) #204696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/autobump.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ bluez
bmake
bnd
bob
bold
bomber
bore-cli
borgbackup
Expand Down
56 changes: 56 additions & 0 deletions Formula/b/bold.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
class Bold < Formula
desc "Drop-in replacement for Apple system linker ld"
homepage "https://github.com/kubkon/bold"
url "https://github.com/kubkon/bold/archive/refs/tags/v0.1.0.tar.gz"
sha256 "2496f04e47c9d5e17ef273b26519abf429b5c3e3df6d264f2941735088253ec0"
license "MIT"

bottle do
sha256 cellar: :any_skip_relocation, arm64_sequoia: "a1deba05b1a4ab3d20a443e7b5a11f63b6cfc44f2996c41dce352fbdc48e78db"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "75029020d0fa32ee7573f9c730b9bbb09a6c98fb310dee951b284df022dfd3b6"
sha256 cellar: :any_skip_relocation, arm64_ventura: "5e4087ae6dc9a698588838f127ed739eaa55d899b143efd5079b40a613db6d1b"
sha256 cellar: :any_skip_relocation, sonoma: "2539d42202287085cf3e89c7e06fce587166465fbb8df8ba4fa23cf8bde298d1"
sha256 cellar: :any_skip_relocation, ventura: "84a0a90973ee9a14a971d3c700f64bd164167518bcb978830080d5361c13ba5c"
end

depends_on "zig" => :build
depends_on :macos # does not build on linux

def install
# Fix illegal instruction errors when using bottles on older CPUs.
# https://github.com/Homebrew/homebrew-core/issues/92282
cpu = case Hardware.oldest_cpu
when :arm_vortex_tempest then "apple_m1" # See `zig targets`.
else Hardware.oldest_cpu
end

args = %W[
--prefix #{prefix}
-Doptimize=ReleaseSafe
-Dstrip=true
]

args << "-Dcpu=#{cpu}" if build.bottle?

system "zig", "build", *args
end

test do
(testpath/"hello.c").write <<~EOS
#include <stdio.h>
int main() {
printf("Hello from Bold\\n");
return 0;
}
EOS

system ENV.cc, "-c", "hello.c", "-o", "hello.o"
arch = Hardware::CPU.arm? ? "arm64" : "x86_64"
macos_min = MacOS.version.to_s

system bin/"bold", "hello.o", "-arch", arch, "-macos_version_min", macos_min,
"-syslibroot", MacOS.sdk_path, "-lSystem", "-o", "test"

assert_equal "Hello from Bold\n", shell_output("./test")
end
end
Loading