Skip to content

Commit

Permalink
[#453] Add formulae for rollup binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
krendelhoff2 committed Aug 15, 2022
1 parent cf76079 commit ba30a79
Show file tree
Hide file tree
Showing 4 changed files with 344 additions and 0 deletions.
56 changes: 56 additions & 0 deletions Formula/tezos-tx-rollup-client-013-PtJakart.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-FileCopyrightText: 2021 Oxhead Alpha
# SPDX-License-Identifier: LicenseRef-MIT-OA

class TezosTxRollupClient014Ptkathma < Formula
@all_bins = []

class << self
attr_accessor :all_bins
end
homepage "https://gitlab.com/tezos/tezos"

url "https://gitlab.com/tezos/tezos.git", :tag => "v14.0", :shallow => false

version "v14.0-1"

build_dependencies = %w[pkg-config coreutils autoconf rsync wget rustup-init]
build_dependencies.each do |dependency|
depends_on dependency => :build
end

dependencies = %w[gmp hidapi libev libffi tezos-sapling-params]
dependencies.each do |dependency|
depends_on dependency
end
desc "Transaction rollup CLI client for interacting with tezos blockchain"

def make_deps
ENV.deparallelize
ENV["CARGO_HOME"]="./.cargo"
# Disable usage of instructions from the ADX extension to avoid incompatibility
# with old CPUs, see https://gitlab.com/dannywillems/ocaml-bls12-381/-/merge_requests/135/
ENV["BLST_PORTABLE"]="yes"
# Here is the workaround to use opam 2.0.9 because Tezos is currently not compatible with opam 2.1.0 and newer
arch = RUBY_PLATFORM.include?("arm64") ? "arm64" : "x86_64"
system "curl", "-L", "https://github.com/ocaml/opam/releases/download/2.0.9/opam-2.0.9-#{arch}-macos", "--create-dirs", "-o", "#{ENV["HOME"]}/.opam-bin/opam"
system "chmod", "+x", "#{ENV["HOME"]}/.opam-bin/opam"
ENV["PATH"]="#{ENV["HOME"]}/.opam-bin:#{ENV["PATH"]}"
system "rustup-init", "--default-toolchain", "1.52.1", "-y"
system "opam", "init", "--bare", "--debug", "--auto-setup", "--disable-sandboxing"
system ["source .cargo/env", "make build-deps"].join(" && ")
end

def install_template(dune_path, exec_path, name)
bin.mkpath
self.class.all_bins << name
system ["eval $(opam env)", "dune build #{dune_path}", "cp #{exec_path} #{name}"].join(" && ")
bin.install name
end

def install
make_deps
install_template "src/proto_014_PtKathma/bin_tx_rollup_client/main_tx_rollup_client_014_PtKathma.exe",
"_build/default/src/proto_014_PtKathma/bin_tx_rollup_client/main_tx_rollup_client_014_PtKathma.exe",
"tezos-tx-rollup-client-014-PtKathma"
end
end
56 changes: 56 additions & 0 deletions Formula/tezos-tx-rollup-client-014-PtKathma.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# SPDX-FileCopyrightText: 2021 Oxhead Alpha
# SPDX-License-Identifier: LicenseRef-MIT-OA

class TezosTxRollupClient013Ptjakart < Formula
@all_bins = []

class << self
attr_accessor :all_bins
end
homepage "https://gitlab.com/tezos/tezos"

url "https://gitlab.com/tezos/tezos.git", :tag => "v14.0", :shallow => false

version "v14.0-1"

build_dependencies = %w[pkg-config coreutils autoconf rsync wget rustup-init]
build_dependencies.each do |dependency|
depends_on dependency => :build
end

dependencies = %w[gmp hidapi libev libffi tezos-sapling-params]
dependencies.each do |dependency|
depends_on dependency
end
desc "Transaction rollup CLI client for interacting with tezos blockchain"

def make_deps
ENV.deparallelize
ENV["CARGO_HOME"]="./.cargo"
# Disable usage of instructions from the ADX extension to avoid incompatibility
# with old CPUs, see https://gitlab.com/dannywillems/ocaml-bls12-381/-/merge_requests/135/
ENV["BLST_PORTABLE"]="yes"
# Here is the workaround to use opam 2.0.9 because Tezos is currently not compatible with opam 2.1.0 and newer
arch = RUBY_PLATFORM.include?("arm64") ? "arm64" : "x86_64"
system "curl", "-L", "https://github.com/ocaml/opam/releases/download/2.0.9/opam-2.0.9-#{arch}-macos", "--create-dirs", "-o", "#{ENV["HOME"]}/.opam-bin/opam"
system "chmod", "+x", "#{ENV["HOME"]}/.opam-bin/opam"
ENV["PATH"]="#{ENV["HOME"]}/.opam-bin:#{ENV["PATH"]}"
system "rustup-init", "--default-toolchain", "1.52.1", "-y"
system "opam", "init", "--bare", "--debug", "--auto-setup", "--disable-sandboxing"
system ["source .cargo/env", "make build-deps"].join(" && ")
end

def install_template(dune_path, exec_path, name)
bin.mkpath
self.class.all_bins << name
system ["eval $(opam env)", "dune build #{dune_path}", "cp #{exec_path} #{name}"].join(" && ")
bin.install name
end

def install
make_deps
install_template "src/proto_013_PtJakart/bin_tx_rollup_client/main_tx_rollup_client_013_PtJakart.exe",
"_build/default/src/proto_013_PtJakart/bin_tx_rollup_client/main_tx_rollup_client_013_PtJakart.exe",
"tezos-tx-rollup-client-013-PtJakart"
end
end
116 changes: 116 additions & 0 deletions Formula/tezos-tx-rollup-node-013-PtJakart.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/usr/bin/env ruby

# SPDX-FileCopyrightText: 2022 Oxhead Alpha
# SPDX-License-Identifier: LicenseRef-MIT-OA

class TezosTxRollupNode013Ptjakart < Formula
@all_bins = []

class << self
attr_accessor :all_bins
end
homepage "https://gitlab.com/tezos/tezos"

url "https://gitlab.com/tezos/tezos.git", :tag => "v14.0", :shallow => false

version "v14.0-1"

build_dependencies = %w[pkg-config coreutils autoconf rsync wget rustup-init]
build_dependencies.each do |dependency|
depends_on dependency => :build
end

dependencies = %w[gmp hidapi libev libffi tezos-sapling-params tezos-client tezos-node]
dependencies.each do |dependency|
depends_on dependency
end
desc "Tezos transaction rollup node for 013-PtJakart"

def make_deps
ENV.deparallelize
ENV["CARGO_HOME"]="./.cargo"
# Disable usage of instructions from the ADX extension to avoid incompatibility
# with old CPUs, see https://gitlab.com/dannywillems/ocaml-bls12-381/-/merge_requests/135/
ENV["BLST_PORTABLE"]="yes"
# Here is the workaround to use opam 2.0.9 because Tezos is currently not compatible with opam 2.1.0 and newer
arch = RUBY_PLATFORM.include?("arm64") ? "arm64" : "x86_64"
system "curl", "-L", "https://github.com/ocaml/opam/releases/download/2.0.9/opam-2.0.9-#{arch}-macos", "--create-dirs", "-o", "#{ENV["HOME"]}/.opam-bin/opam"
system "chmod", "+x", "#{ENV["HOME"]}/.opam-bin/opam"
ENV["PATH"]="#{ENV["HOME"]}/.opam-bin:#{ENV["PATH"]}"
system "rustup-init", "--default-toolchain", "1.52.1", "-y"
system "opam", "init", "--bare", "--debug", "--auto-setup", "--disable-sandboxing"
system ["source .cargo/env", "make build-deps"].join(" && ")
end

def install_template(dune_path, exec_path, name)
bin.mkpath
self.class.all_bins << name
system ["eval $(opam env)", "dune build #{dune_path}", "cp #{exec_path} #{name}"].join(" && ")
bin.install name
end

def install
startup_contents =
<<~EOS
#!/usr/bin/env bash
set -euo pipefail
node="#{bin}/tezos-tx-rollup-node-013-PtJakart"
"$node" init "$MODE" config \
for "$ROLLUP_ALIAS" \
--data-dir "$DATA_DIR" \
--rpc-addr "$ROLLUP_NODE_RPC_ENDPOINT" \
--force
"$node" --endpoint "$NODE_RPC_ENDPOINT" \
run "$MODE" for "$ROLLUP_ALIAS" \
--data-dir "$DATA_DIR"
EOS
File.write("tezos-tx-rollup-node-013-PtJakart-start", startup_contents)
bin.install "tezos-tx-rollup-node-013-PtJakart-start"
make_deps
install_template "src/proto_013_PtJakart/bin_tx_rollup_node/main_tx_rollup_node_013_PtJakart.exe",
"_build/default/src/proto_013_PtJakart/bin_tx_rollup_node/main_tx_rollup_node_013_PtJakart.exe",
"tezos-tx-rollup-node-013-PtJakart"
end
plist_options manual: "tezos-tx-rollup-node-013-PtJakart run for"
def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>Program</key>
<string>#{opt_bin}/tezos-tx-rollup-node-013-PtJakart-start</string>
<key>EnvironmentVariables</key>
<dict>
<key>DATA_DIR</key>
<string>#{var}/lib/tezos/client</string>
<key>NODE_RPC_ENDPOINT</key>
<string>http://localhost:8732</string>
<key>ROLLUP_NODE_RPC_ENDPOINT</key>
<string>127.0.0.1:8472</string>
<key>MODE</key>
<string>observer</string>
<key>ROLLUP_ALIAS</key>
<string>rollup</string>
</dict>
<key>RunAtLoad</key><true/>
<key>StandardOutPath</key>
<string>#{var}/log/#{name}.log</string>
<key>StandardErrorPath</key>
<string>#{var}/log/#{name}.log</string>
</dict>
</plist>
EOS
end
def post_install
mkdir "#{var}/lib/tezos/client"
end
end
116 changes: 116 additions & 0 deletions Formula/tezos-tx-rollup-node-014-PtKathma.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/usr/bin/env ruby

# SPDX-FileCopyrightText: 2022 Oxhead Alpha
# SPDX-License-Identifier: LicenseRef-MIT-OA

class TezosTxRollupNode014Ptkathma < Formula
@all_bins = []

class << self
attr_accessor :all_bins
end
homepage "https://gitlab.com/tezos/tezos"

url "https://gitlab.com/tezos/tezos.git", :tag => "v14.0", :shallow => false

version "v14.0-1"

build_dependencies = %w[pkg-config coreutils autoconf rsync wget rustup-init]
build_dependencies.each do |dependency|
depends_on dependency => :build
end

dependencies = %w[gmp hidapi libev libffi tezos-sapling-params tezos-client tezos-node]
dependencies.each do |dependency|
depends_on dependency
end
desc "Tezos transaction rollup node for 014-PtKathma"

def make_deps
ENV.deparallelize
ENV["CARGO_HOME"]="./.cargo"
# Disable usage of instructions from the ADX extension to avoid incompatibility
# with old CPUs, see https://gitlab.com/dannywillems/ocaml-bls12-381/-/merge_requests/135/
ENV["BLST_PORTABLE"]="yes"
# Here is the workaround to use opam 2.0.9 because Tezos is currently not compatible with opam 2.1.0 and newer
arch = RUBY_PLATFORM.include?("arm64") ? "arm64" : "x86_64"
system "curl", "-L", "https://github.com/ocaml/opam/releases/download/2.0.9/opam-2.0.9-#{arch}-macos", "--create-dirs", "-o", "#{ENV["HOME"]}/.opam-bin/opam"
system "chmod", "+x", "#{ENV["HOME"]}/.opam-bin/opam"
ENV["PATH"]="#{ENV["HOME"]}/.opam-bin:#{ENV["PATH"]}"
system "rustup-init", "--default-toolchain", "1.52.1", "-y"
system "opam", "init", "--bare", "--debug", "--auto-setup", "--disable-sandboxing"
system ["source .cargo/env", "make build-deps"].join(" && ")
end

def install_template(dune_path, exec_path, name)
bin.mkpath
self.class.all_bins << name
system ["eval $(opam env)", "dune build #{dune_path}", "cp #{exec_path} #{name}"].join(" && ")
bin.install name
end

def install
startup_contents =
<<~EOS
#!/usr/bin/env bash
set -euo pipefail
node="#{bin}/tezos-tx-rollup-node-014-PtKathma"
"$node" init "$MODE" config \
for "$ROLLUP_ALIAS" \
--data-dir "$DATA_DIR" \
--rpc-addr "$ROLLUP_NODE_RPC_ENDPOINT" \
--force
"$node" --endpoint "$NODE_RPC_ENDPOINT" \
run "$MODE" for "$ROLLUP_ALIAS" \
--data-dir "$DATA_DIR"
EOS
File.write("tezos-tx-rollup-node-014-PtKathma-start", startup_contents)
bin.install "tezos-tx-rollup-node-014-PtKathma-start"
make_deps
install_template "src/proto_014_PtKathma/bin_tx_rollup_node/main_tx_rollup_node_014_PtKathma.exe",
"_build/default/src/proto_014_PtKathma/bin_tx_rollup_node/main_tx_rollup_node_014_PtKathma.exe",
"tezos-tx-rollup-node-014-PtKathma"
end
plist_options manual: "tezos-tx-rollup-node-014-PtKathma run for"
def plist
<<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>Program</key>
<string>#{opt_bin}/tezos-tx-rollup-node-014-PtKathma-start</string>
<key>EnvironmentVariables</key>
<dict>
<key>DATA_DIR</key>
<string>#{var}/lib/tezos/client</string>
<key>NODE_RPC_ENDPOINT</key>
<string>http://localhost:8732</string>
<key>ROLLUP_NODE_RPC_ENDPOINT</key>
<string>127.0.0.1:8472</string>
<key>MODE</key>
<string>observer</string>
<key>ROLLUP_ALIAS</key>
<string>rollup</string>
</dict>
<key>RunAtLoad</key><true/>
<key>StandardOutPath</key>
<string>#{var}/log/#{name}.log</string>
<key>StandardErrorPath</key>
<string>#{var}/log/#{name}.log</string>
</dict>
</plist>
EOS
end
def post_install
mkdir "#{var}/lib/tezos/client"
end
end

0 comments on commit ba30a79

Please sign in to comment.