From 89622ac5f706473debf5cd61c9f9a5ef206ac697 Mon Sep 17 00:00:00 2001 From: Francis Roch Date: Tue, 2 Jul 2024 19:24:44 -0400 Subject: [PATCH] Fix dependencies --- .github/workflows/tests.yml | 4 +++- lib/base.rb | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f3700c0..f4a744b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,7 +39,9 @@ jobs: - run: brew test-bot --only-tap-syntax - - run: brew test-bot --only-formulae + - run: | + brew install golang + brew test-bot --only-formulae if: github.event_name == 'pull_request' - name: Upload bottles as artifact diff --git a/lib/base.rb b/lib/base.rb index 4a0c60b..5ed6a46 100644 --- a/lib/base.rb +++ b/lib/base.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "macho" # Ensure ruby-macho is required - class XiondBase < Formula desc "Generalized Blockchain Abstraction Layer" homepage "https://xion.burnt.com" @@ -19,7 +17,7 @@ def self.init(version, sha256) def install # Homebrew forces us to download a tarball; this kills the git information # So for `xiond version` to work after build, we need to fetch tags ie. nuke buildpath and clone the repo - Dir.chdir("/tmp") do + Dir.mktmpdir do remove_dir(buildpath, true) Dir.mkdir(buildpath) system "git", "clone", "--depth", "1", "--branch", "v#{version}", "https://github.com/burnt-labs/xion.git", buildpath @@ -76,10 +74,21 @@ def compile_and_install_xiond system "make", "install" bin.install "#{ENV.fetch("GOPATH", nil)}/bin/xiond" + end + # Homebrew linting fails on this system call + # it stubbornly requires a dependency on ruby-macho instead + # GTFO + def post_install return unless OS.mac? - MachO::Tools.add_rpath("#{bin}/xiond", "#{HOMEBREW_PREFIX}/lib") + rpath = "#{HOMEBREW_PREFIX}/lib" + executable = "#{bin}/xiond" + + # Check if the executable exists and modify the rpath + return unless File.exist?(executable) + + system "install_name_tool", "-add_rpath", rpath, executable end def determine_libwasmvm_suffix