Skip to content

Commit

Permalink
gnirehtet: update to use upstream build patch
Browse files Browse the repository at this point in the history
  • Loading branch information
chenrui333 committed Dec 26, 2022
1 parent 26d002d commit cf1a9f8
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions Formula/gnirehtet.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
class Gnirehtet < Formula
desc "Reverse tethering tool for Android"
homepage "https://github.com/Genymobile/gnirehtet"
# Try to switch `rustup-init` to `rust` on the next release
url "https://github.com/Genymobile/gnirehtet/archive/v2.5.tar.gz"
sha256 "2b55b56e1b21d1b609a0899fe85d1f311120bb12b04761ec586187338daf6ec5"
license "Apache-2.0"
revision 1
head "https://github.com/Genymobile/gnirehtet.git", branch: "master"

stable do
url "https://github.com/Genymobile/gnirehtet/archive/v2.5.tar.gz"
sha256 "2b55b56e1b21d1b609a0899fe85d1f311120bb12b04761ec586187338daf6ec5"

# Fix compilation issue with rust 1.64.0+
# upstream PR reference, https://github.com/Genymobile/gnirehtet/pull/478
patch do
url "https://github.com/raw/Homebrew/formula-patches/d62149f/gnirehtet/2.5-rust-1.64.0.patch"
sha256 "bdda0abc50344b14227d880d8257189f49eb586722b6e5fa07f3cb70b442b7a0"
end
end

bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "8e895ff323e648db638a97542eeed9d71936f882c36b95e410bd50a7ff272ffd"
sha256 cellar: :any_skip_relocation, arm64_big_sur: "7fd56faf93c88c65df43599e0dda5c7d3044e6b1dee05ef535d6eff42b558684"
Expand All @@ -19,7 +28,7 @@ class Gnirehtet < Formula
sha256 cellar: :any_skip_relocation, x86_64_linux: "94166648cf3a8a072b85eed7436af2bddbcf5c2dfab939cd79590d4ff2b9a9c3"
end

depends_on "rustup-init" => :build
depends_on "rust" => :build
depends_on "socat" => :test

resource "java_bundle" do
Expand All @@ -30,12 +39,6 @@ class Gnirehtet < Formula
def install
resource("java_bundle").stage { libexec.install "gnirehtet.apk" }

# Building the binary with rust 1.64.0 or later results in an error when running `gnirehtet relay`.
# ERROR Main: Execution error: IO error: Address family not supported by protocol family (os error 47)
# Issue ref: https://github.com/Genymobile/gnirehtet/issues/475
system "rustup-init", "-qy", "--no-modify-path", "--default-toolchain", "1.63.0"
ENV.prepend_path "PATH", HOMEBREW_CACHE/"cargo_cache/bin"

system "cargo", "install", *std_cargo_args(root: libexec, path: "relay-rust")
mv "#{libexec}/bin/gnirehtet", "#{libexec}/gnirehtet"

Expand Down

0 comments on commit cf1a9f8

Please sign in to comment.