From 895b3e005dfe2a08f828ad7e6132b6ae563b64a7 Mon Sep 17 00:00:00 2001 From: Danilo Tuler Date: Thu, 5 Sep 2024 13:33:54 -0400 Subject: [PATCH] feat: cartesi-machine formula --- Formula/cartesi-machine.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Formula/cartesi-machine.rb diff --git a/Formula/cartesi-machine.rb b/Formula/cartesi-machine.rb new file mode 100644 index 0000000..3d7dba5 --- /dev/null +++ b/Formula/cartesi-machine.rb @@ -0,0 +1,31 @@ +class CartesiMachine < Formula + desc "Off-chain implementation of the Cartesi Machine" + homepage "https://cartesi.io/" + url "https://github.com/cartesi/machine-emulator/archive/refs/tags/v0.18.1.tar.gz" + sha256 "2d6ca78881b0a218aa9460d5cc7af7be51f9971b163305d6191039719568b5c3" + license "LGPL-3.0-only" + version "0.18.1" + + depends_on "pkg-config" => :build + depends_on "wget" => :build + depends_on "boost" => :build + depends_on "libslirp" => :build + depends_on "lua" => :build + depends_on "openssl" => :build + + resource "uarch" do + url "https://github.com/cartesi/machine-emulator/releases/download/v0.18.1/uarch-ram.bin" + sha256 "60888eed34d995be2480a456d48399c708fcd72d2d4f7e3b5a5423064e45444c" + end + + patch :DATA + + def install + system "make", "UARCH_RAM_IMAGE=#{resource("uarch").cached_download}", "BREW_PREFIX=#{prefix}" + system "make", "install", "PREFIX=#{prefix}" + end + + test do + assert_match(/cartesi-machine #{version}/, shell_output("#{bin}/cartesi-machine --version | head -1")) + end +end