From d4c99ba28fe112242d42bafc459a2a6bea6c9453 Mon Sep 17 00:00:00 2001 From: Adam Hartley Date: Thu, 2 Jul 2020 15:48:03 +0100 Subject: [PATCH 1/4] Build Telnet for Apple Silicon --- Formula/telnet.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Formula/telnet.rb b/Formula/telnet.rb index 8a3a2d8182624..b48cc4b9e7d63 100644 --- a/Formula/telnet.rb +++ b/Formula/telnet.rb @@ -25,21 +25,24 @@ def install ENV["SDKROOT"] = MacOS.sdk_path ENV["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version - # Force 64 bit-only build, otherwise it fails on Mojave - xcodebuild "SYMROOT=build", "-arch", "x86_64" + arch = Hardware::CPU.arm? ? "arm64" : "x86_64" + + xcodebuild "SYMROOT=build", "-arch", arch libtelnet_dst = buildpath/"telnet.tproj/build/Products" libtelnet_dst.install "build/Release/libtelnet.a" libtelnet_dst.install "build/Release/usr/local/include/libtelnet/" end + arch_arg = Hardware::CPU.arm? ? "RC_ARCHS=arm64" : "RC_ARCHS=x86_64" + system "make", "-C", "telnet.tproj", "OBJROOT=build/Intermediates", "SYMROOT=build/Products", "DSTROOT=build/Archive", "CFLAGS=$(CC_Flags) -isystembuild/Products/", "LDFLAGS=$(LD_Flags) -Lbuild/Products/", - "RC_ARCHS=x86_64", # Force 64-bit build for Mojave + *arch_arg, "install" bin.install "telnet.tproj/build/Archive/usr/local/bin/telnet" From 21608aeb9d68f3414f14e4787ecfbcbc97cd41d9 Mon Sep 17 00:00:00 2001 From: Adam Hartley Date: Thu, 2 Jul 2020 16:41:24 +0100 Subject: [PATCH 2/4] Update Formula/telnet.rb Co-authored-by: Bo Anderson --- Formula/telnet.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Formula/telnet.rb b/Formula/telnet.rb index b48cc4b9e7d63..2f920e94e7036 100644 --- a/Formula/telnet.rb +++ b/Formula/telnet.rb @@ -25,9 +25,7 @@ def install ENV["SDKROOT"] = MacOS.sdk_path ENV["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version - arch = Hardware::CPU.arm? ? "arm64" : "x86_64" - - xcodebuild "SYMROOT=build", "-arch", arch + xcodebuild "SYMROOT=build", "-arch", Hardware::CPU.arch libtelnet_dst = buildpath/"telnet.tproj/build/Products" libtelnet_dst.install "build/Release/libtelnet.a" From e6af83144a5dc14379729ec3308f36596d5dfe60 Mon Sep 17 00:00:00 2001 From: Adam Hartley Date: Thu, 2 Jul 2020 16:42:17 +0100 Subject: [PATCH 3/4] Update telnet.rb --- Formula/telnet.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Formula/telnet.rb b/Formula/telnet.rb index 2f920e94e7036..7597a7a1da104 100644 --- a/Formula/telnet.rb +++ b/Formula/telnet.rb @@ -32,15 +32,13 @@ def install libtelnet_dst.install "build/Release/usr/local/include/libtelnet/" end - arch_arg = Hardware::CPU.arm? ? "RC_ARCHS=arm64" : "RC_ARCHS=x86_64" - system "make", "-C", "telnet.tproj", "OBJROOT=build/Intermediates", "SYMROOT=build/Products", "DSTROOT=build/Archive", "CFLAGS=$(CC_Flags) -isystembuild/Products/", "LDFLAGS=$(LD_Flags) -Lbuild/Products/", - *arch_arg, + "RC_ARCHS=%s" % Hardware::CPU.arch, "install" bin.install "telnet.tproj/build/Archive/usr/local/bin/telnet" From 088ffe43261b486f1f4821882b53ed4237fa78ac Mon Sep 17 00:00:00 2001 From: Adam Hartley Date: Thu, 2 Jul 2020 16:50:14 +0100 Subject: [PATCH 4/4] Update Formula/telnet.rb Co-authored-by: Bo Anderson --- Formula/telnet.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Formula/telnet.rb b/Formula/telnet.rb index 7597a7a1da104..2e5151a9d234d 100644 --- a/Formula/telnet.rb +++ b/Formula/telnet.rb @@ -38,7 +38,7 @@ def install "DSTROOT=build/Archive", "CFLAGS=$(CC_Flags) -isystembuild/Products/", "LDFLAGS=$(LD_Flags) -Lbuild/Products/", - "RC_ARCHS=%s" % Hardware::CPU.arch, + "RC_ARCHS=#{Hardware::CPU.arch}", "install" bin.install "telnet.tproj/build/Archive/usr/local/bin/telnet"