From 3e93c12455405a8cec8c9eb1e714d9184074fa5d Mon Sep 17 00:00:00 2001 From: Francis Roch Date: Thu, 9 May 2024 12:58:44 -0400 Subject: [PATCH] Fix persisting wasm dylib on macOS after `brew cleanup` --- lib/base.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/base.rb b/lib/base.rb index ac9ce3d..22479ee 100644 --- a/lib/base.rb +++ b/lib/base.rb @@ -59,7 +59,10 @@ def verify_checksum(file) end def install_libwasmvm - lib.install "#{buildpath}/libwasmvm.#{determine_libwasmvm_suffix}" + libwasmvm_suffix = determine_libwasmvm_suffix + libwasmvm_file = "#{buildpath}/libwasmvm.#{libwasmvm_suffix}" + + lib.install libwasmvm_file end def compile_and_install_xiond @@ -67,8 +70,13 @@ def compile_and_install_xiond ENV["LINK_STATICALLY"] = "true" ENV["LDFLAGS"] = "-linkmode external -extldflags '-static'" end + system "make", "install" bin.install "#{ENV.fetch("GOPATH", nil)}/bin/xiond" + + if OS.mac? + system "install_name_tool", "-add_rpath", HOMEBREW_PREFIX/"lib", "#{bin}/xiond" + end end def determine_libwasmvm_suffix