Skip to content

Commit

Permalink
🚨 (rubocop): Fix all warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed May 24, 2024
1 parent dc51329 commit 24248af
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 52 deletions.
2 changes: 2 additions & 0 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ArmGccBinAT10 < Formula
desc "Pre-built GNU toolchain for Arm Cortex-M and Cortex-R processors"
homepage "https://developer.arm.com/open-source/gnu-toolchain/gnu-rm"
Expand Down
2 changes: 2 additions & 0 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ArmGccBinAT11 < Formula
desc "Pre-built GNU toolchain for Arm Cortex-M and Cortex-R processors"
homepage "https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads"
Expand Down
2 changes: 2 additions & 0 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ArmGccBinAT12 < Formula
@tar_file = if Hardware::CPU.arm?
"arm-gnu-toolchain-12.2.rel1-darwin-arm64-arm-none-eabi.tar.xz"
Expand Down
6 changes: 4 additions & 2 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ArmGccBinAT13 < Formula
@tar_file = if Hardware::CPU.arm?
"arm-gnu-toolchain-13.2.rel1-darwin-arm64-arm-none-eabi.tar.xz"
Expand All @@ -13,8 +15,8 @@ class ArmGccBinAT13 < Formula
bottle do
root_url "https://github.com/osx-cross/homebrew-arm/releases/download/[email protected]"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "91ec58e4f00cf911ed4d12534591b776e9b1217ceb3b5b5f582da76646f70de7"
sha256 cellar: :any, ventura: "6e8834c9c8bd67023b438451588ac679b2c520139ff9daec0692f184923078ec"
sha256 cellar: :any, monterey: "b2ea7549fb70b7a69438a814c84bd9ef637b33ee93ec135842e82b787aa1db34"
sha256 cellar: :any_skip_relocation, ventura: "6e8834c9c8bd67023b438451588ac679b2c520139ff9daec0692f184923078ec"
sha256 cellar: :any_skip_relocation, monterey: "b2ea7549fb70b7a69438a814c84bd9ef637b33ee93ec135842e82b787aa1db34"
end

@tar_file_sha = if Hardware::CPU.arm?
Expand Down
2 changes: 2 additions & 0 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ArmGccBinAT8 < Formula
desc "Pre-built GNU toolchain for Arm Cortex-M and Cortex-R processors"
homepage "https://developer.arm.com/open-source/gnu-toolchain/gnu-rm"
Expand Down
2 changes: 2 additions & 0 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ArmGccBinAT9 < Formula
desc "Pre-built GNU toolchain for Arm Cortex-M and Cortex-R processors"
homepage "https://developer.arm.com/open-source/gnu-toolchain/gnu-rm"
Expand Down
2 changes: 2 additions & 0 deletions Formula/arm-none-eabi-binutils.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ArmNoneEabiBinutils < Formula
desc "GNU Tools for ARM Embedded Processors - Binutils"
homepage "https://www.gnu.org/software/binutils/binutils.html"
Expand Down
52 changes: 27 additions & 25 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ArmNoneEabiGccAT8 < Formula
desc "GNU Tools for ARM Embedded Processors - GCC"
homepage "https://www.gnu.org/software/gcc/gcc.html"
Expand Down Expand Up @@ -47,7 +49,7 @@ class ArmNoneEabiGccAT8 < Formula
end

def install
arm_prefix = prefix/"arm-none-eabi"
arm_prefix = prefix / "arm-none-eabi"

# GCC will suffer build errors if forced to use a particular linker.
ENV.delete "LD"
Expand All @@ -63,8 +65,8 @@ def install
--prefix=/
--target=arm-none-eabi
--enable-languages=c
--with-ld=#{Formula["arm-none-eabi-binutils"].opt_bin/"arm-none-eabi-ld"}
--with-as=#{Formula["arm-none-eabi-binutils"].opt_bin/"arm-none-eabi-as"}
--with-ld=#{Formula["arm-none-eabi-binutils"].opt_bin / "arm-none-eabi-ld"}
--with-as=#{Formula["arm-none-eabi-binutils"].opt_bin / "arm-none-eabi-as"}
--disable-nls
--disable-libssp
--disable-shared
Expand All @@ -87,7 +89,7 @@ def install
--with-multilib-list=rmprofile
--with-system-zlib
--with-sysroot=#{prefix}
--with-build-sysroot=#{buildpath.parent/"gcc-install"}
--with-build-sysroot=#{buildpath.parent / "gcc-install"}
]

# Avoid reference to sed shim
Expand All @@ -99,21 +101,21 @@ def install
# otherwise updated load commands won't fit in the Mach-O header.
# This is needed because `gcc` avoids the superenv shim.
system "make", "all-gcc", "BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"
system "make", "DESTDIR=#{buildpath.parent/"gcc-install"}", "install-gcc"
system "make", "DESTDIR=#{buildpath.parent / "gcc-install"}", "install-gcc"
end

ENV["PATH"] = "#{buildpath.parent/"gcc-install/bin"}:#{ENV["PATH"]}"
ENV["PATH"] = "#{buildpath.parent / "gcc-install/bin"}:#{ENV["PATH"]}"

# `make install` complains if these dirs do not already exist, for some reason
(arm_prefix/"lib/arm/v5te/hard").mkpath
(arm_prefix/"lib/arm/v5te/softfp").mkpath
(arm_prefix/"lib/thumb/nofp").mkpath
(arm_prefix / "lib/arm/v5te/hard").mkpath
(arm_prefix / "lib/arm/v5te/softfp").mkpath
(arm_prefix / "lib/thumb/nofp").mkpath
["v6-m", "v7", "v7-m", "v7e-m", "v8-m.base", "v8-m.main"].each do |v|
(arm_prefix/"lib/thumb/#{v}/nofp").mkpath
(arm_prefix / "lib/thumb/#{v}/nofp").mkpath
end
["v7+fp", "v7e-m+fp", "v7e-m+dp", "v8-m.main+fp", "v8-m.main+dp"].each do |v|
(arm_prefix/"lib/thumb/#{v}/hard").mkpath
(arm_prefix/"lib/thumb/#{v}/softfp").mkpath
(arm_prefix / "lib/thumb/#{v}/hard").mkpath
(arm_prefix / "lib/thumb/#{v}/softfp").mkpath
end

mkdir "build-nano" do
Expand All @@ -138,11 +140,11 @@ def install
system "make"
system "make", "install"

(arm_prefix/"lib").glob("**/lib{c,g,rdimon}.a").each do |f|
(arm_prefix / "lib").glob("**/lib{c,g,rdimon}.a").each do |f|
mv f, f.sub(".a", "_nano.a")
end
(arm_prefix/"include/newlib-nano").mkpath
mv arm_prefix/"include/newlib.h", arm_prefix/"include/newlib-nano/newlib.h"
(arm_prefix / "include/newlib-nano").mkpath
mv arm_prefix / "include/newlib.h", arm_prefix / "include/newlib-nano/newlib.h"
end

mkdir "build" do
Expand Down Expand Up @@ -175,8 +177,8 @@ def install

--enable-languages=#{languages.join(",")}

--with-ld=#{Formula["arm-none-eabi-binutils"].opt_bin/"arm-none-eabi-ld"}
--with-as=#{Formula["arm-none-eabi-binutils"].opt_bin/"arm-none-eabi-as"}
--with-ld=#{Formula["arm-none-eabi-binutils"].opt_bin / "arm-none-eabi-ld"}
--with-as=#{Formula["arm-none-eabi-binutils"].opt_bin / "arm-none-eabi-as"}

--enable-plugins
--disable-decimal-float
Expand Down Expand Up @@ -219,7 +221,7 @@ def install
# otherwise updated load commands won't fit in the Mach-O header.
# This is needed because `gcc` avoids the superenv shim.
system "make", "INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'",
"BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"
"BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"
system "make", "install"
end

Expand All @@ -230,27 +232,27 @@ def install
ENV["CXXFLAGS_FOR_TARGET"] = "-g -Os -ffunction-sections -fdata-sections -fno-exceptions"

system "make", "INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'",
"BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"
"BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"
system "make", "DESTDIR=#{buildpath.parent}/nano-install", "install"
end

# we need only libstdc nano files
multilibs = `#{bin}/arm-none-eabi-gcc -print-multi-lib`.split("\n")
multilibs.each do |multilib|
m_dir = multilib.split(";").first.chomp
from_dir = buildpath.parent/"nano-install"/arm_prefix/"lib"/m_dir
to_dir = arm_prefix/"lib"/m_dir
cp from_dir/"libstdc++.a", to_dir/"libstdc++_nano.a"
cp from_dir/"libsupc++.a", to_dir/"libsupc++_nano.a"
from_dir = buildpath.parent / "nano-install" / arm_prefix / "lib" / m_dir
to_dir = arm_prefix / "lib" / m_dir
cp from_dir / "libstdc++.a", to_dir / "libstdc++_nano.a"
cp from_dir / "libsupc++.a", to_dir / "libsupc++_nano.a"
end

# strip target binaries
(arm_prefix/"lib").glob("**/*.{a,o}").each do |f|
(arm_prefix / "lib").glob("**/*.{a,o}").each do |f|
system "arm-none-eabi-objcopy", "-R", ".comment", "-R", ".note", "-R", ".debug_info", "-R", ".debug_aranges",
"-R", ".debug_pubnames", "-R", ".debug_pubtypes", "-R", ".debug_abbrev", "-R", ".debug_line",
"-R", ".debug_str", "-R", ".debug_ranges", "-R", ".debug_loc", f.to_s
end
(prefix/"lib").glob("**/*.{a,o}").each do |f|
(prefix / "lib").glob("**/*.{a,o}").each do |f|
system "arm-none-eabi-objcopy", "-R", ".comment", "-R", ".note", "-R", ".debug_info", "-R", ".debug_aranges",
"-R", ".debug_pubnames", "-R", ".debug_pubtypes", "-R", ".debug_abbrev", "-R", ".debug_line",
"-R", ".debug_str", "-R", ".debug_ranges", "-R", ".debug_loc", f.to_s
Expand Down
52 changes: 27 additions & 25 deletions Formula/[email protected]
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ArmNoneEabiGccAT9 < Formula
desc "GNU Tools for ARM Embedded Processors - GCC"
homepage "https://www.gnu.org/software/gcc/gcc.html"
Expand Down Expand Up @@ -47,7 +49,7 @@ class ArmNoneEabiGccAT9 < Formula
end

def install
arm_prefix = prefix/"arm-none-eabi"
arm_prefix = prefix / "arm-none-eabi"

# GCC will suffer build errors if forced to use a particular linker.
ENV.delete "LD"
Expand All @@ -63,8 +65,8 @@ def install
--prefix=/
--target=arm-none-eabi
--enable-languages=c
--with-ld=#{Formula["arm-none-eabi-binutils"].opt_bin/"arm-none-eabi-ld"}
--with-as=#{Formula["arm-none-eabi-binutils"].opt_bin/"arm-none-eabi-as"}
--with-ld=#{Formula["arm-none-eabi-binutils"].opt_bin / "arm-none-eabi-ld"}
--with-as=#{Formula["arm-none-eabi-binutils"].opt_bin / "arm-none-eabi-as"}
--disable-nls
--disable-libssp
--disable-shared
Expand All @@ -87,7 +89,7 @@ def install
--with-multilib-list=rmprofile
--with-system-zlib
--with-sysroot=#{prefix}
--with-build-sysroot=#{buildpath.parent/"gcc-install"}
--with-build-sysroot=#{buildpath.parent / "gcc-install"}
]

# Avoid reference to sed shim
Expand All @@ -99,21 +101,21 @@ def install
# otherwise updated load commands won't fit in the Mach-O header.
# This is needed because `gcc` avoids the superenv shim.
system "make", "all-gcc", "BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"
system "make", "DESTDIR=#{buildpath.parent/"gcc-install"}", "install-gcc"
system "make", "DESTDIR=#{buildpath.parent / "gcc-install"}", "install-gcc"
end

ENV["PATH"] = "#{buildpath.parent/"gcc-install/bin"}:#{ENV["PATH"]}"
ENV["PATH"] = "#{buildpath.parent / "gcc-install/bin"}:#{ENV["PATH"]}"

# `make install` complains if these dirs do not already exist, for some reason
(arm_prefix/"lib/arm/v5te/hard").mkpath
(arm_prefix/"lib/arm/v5te/softfp").mkpath
(arm_prefix/"lib/thumb/nofp").mkpath
(arm_prefix / "lib/arm/v5te/hard").mkpath
(arm_prefix / "lib/arm/v5te/softfp").mkpath
(arm_prefix / "lib/thumb/nofp").mkpath
["v6-m", "v7", "v7-m", "v7e-m", "v8-m.base", "v8-m.main"].each do |v|
(arm_prefix/"lib/thumb/#{v}/nofp").mkpath
(arm_prefix / "lib/thumb/#{v}/nofp").mkpath
end
["v7+fp", "v7e-m+fp", "v7e-m+dp", "v7-r+fp.sp", "v8-m.main+fp", "v8-m.main+dp"].each do |v|
(arm_prefix/"lib/thumb/#{v}/hard").mkpath
(arm_prefix/"lib/thumb/#{v}/softfp").mkpath
(arm_prefix / "lib/thumb/#{v}/hard").mkpath
(arm_prefix / "lib/thumb/#{v}/softfp").mkpath
end

mkdir "build-nano" do
Expand All @@ -138,11 +140,11 @@ def install
system "make"
system "make", "install"

(arm_prefix/"lib").glob("**/lib{c,g,rdimon}.a").each do |f|
(arm_prefix / "lib").glob("**/lib{c,g,rdimon}.a").each do |f|
mv f, f.sub(".a", "_nano.a")
end
(arm_prefix/"include/newlib-nano").mkpath
mv arm_prefix/"include/newlib.h", arm_prefix/"include/newlib-nano/newlib.h"
(arm_prefix / "include/newlib-nano").mkpath
mv arm_prefix / "include/newlib.h", arm_prefix / "include/newlib-nano/newlib.h"
end

mkdir "build" do
Expand Down Expand Up @@ -175,8 +177,8 @@ def install

--enable-languages=#{languages.join(",")}

--with-ld=#{Formula["arm-none-eabi-binutils"].opt_bin/"arm-none-eabi-ld"}
--with-as=#{Formula["arm-none-eabi-binutils"].opt_bin/"arm-none-eabi-as"}
--with-ld=#{Formula["arm-none-eabi-binutils"].opt_bin / "arm-none-eabi-ld"}
--with-as=#{Formula["arm-none-eabi-binutils"].opt_bin / "arm-none-eabi-as"}

--enable-plugins
--disable-decimal-float
Expand Down Expand Up @@ -219,7 +221,7 @@ def install
# otherwise updated load commands won't fit in the Mach-O header.
# This is needed because `gcc` avoids the superenv shim.
system "make", "INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'",
"BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"
"BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"
system "make", "install"
end

Expand All @@ -230,27 +232,27 @@ def install
ENV["CXXFLAGS_FOR_TARGET"] = "-g -Os -ffunction-sections -fdata-sections -fno-exceptions"

system "make", "INHIBIT_LIBC_CFLAGS='-DUSE_TM_CLONE_REGISTRY=0'",
"BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"
"BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"
system "make", "DESTDIR=#{buildpath.parent}/nano-install", "install"
end

# we need only libstdc nano files
multilibs = `#{bin}/arm-none-eabi-gcc -print-multi-lib`.split("\n")
multilibs.each do |multilib|
m_dir = multilib.split(";").first.chomp
from_dir = buildpath.parent/"nano-install"/arm_prefix/"lib"/m_dir
to_dir = arm_prefix/"lib"/m_dir
cp from_dir/"libstdc++.a", to_dir/"libstdc++_nano.a"
cp from_dir/"libsupc++.a", to_dir/"libsupc++_nano.a"
from_dir = buildpath.parent / "nano-install" / arm_prefix / "lib" / m_dir
to_dir = arm_prefix / "lib" / m_dir
cp from_dir / "libstdc++.a", to_dir / "libstdc++_nano.a"
cp from_dir / "libsupc++.a", to_dir / "libsupc++_nano.a"
end

# strip target binaries
(arm_prefix/"lib").glob("**/*.{a,o}").each do |f|
(arm_prefix / "lib").glob("**/*.{a,o}").each do |f|
system "arm-none-eabi-objcopy", "-R", ".comment", "-R", ".note", "-R", ".debug_info", "-R", ".debug_aranges",
"-R", ".debug_pubnames", "-R", ".debug_pubtypes", "-R", ".debug_abbrev", "-R", ".debug_line",
"-R", ".debug_str", "-R", ".debug_ranges", "-R", ".debug_loc", f.to_s
end
(prefix/"lib").glob("**/*.{a,o}").each do |f|
(prefix / "lib").glob("**/*.{a,o}").each do |f|
system "arm-none-eabi-objcopy", "-R", ".comment", "-R", ".note", "-R", ".debug_info", "-R", ".debug_aranges",
"-R", ".debug_pubnames", "-R", ".debug_pubtypes", "-R", ".debug_abbrev", "-R", ".debug_line",
"-R", ".debug_str", "-R", ".debug_ranges", "-R", ".debug_loc", f.to_s
Expand Down

0 comments on commit 24248af

Please sign in to comment.