From 93135e7bab9828758050ec9dc2423260380b5da9 Mon Sep 17 00:00:00 2001 From: Zsolt Prontvai Date: Thu, 24 Oct 2019 18:37:01 +0200 Subject: [PATCH 1/4] gcc-arm-none-eabi 8-2019-q3-update (new formula) --- Formula/gcc-arm-none-eabi.rb | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Formula/gcc-arm-none-eabi.rb diff --git a/Formula/gcc-arm-none-eabi.rb b/Formula/gcc-arm-none-eabi.rb new file mode 100644 index 000000000000..53aac6db4d95 --- /dev/null +++ b/Formula/gcc-arm-none-eabi.rb @@ -0,0 +1,48 @@ +class GccArmNoneEabi < Formula + desc "GNU Arm Embedded Toolchain" + homepage "https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm" + url "https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2019q3/RC1.1/gcc-arm-none-eabi-8-2019-q3-update-src.tar.bz2" + version "8-2019-q3-update" + sha256 "e8a8ddfec47601f2d83f1d80c0600f198476f227102121c8d6a5a781d0c2eeef" + + env :std + + depends_on "wget" => :build + + def install + inreplace "build-common.sh" do |s| + s.gsub! "INSTALLDIR_NATIVE=$ROOT/install-native", "INSTALLDIR_NATIVE=#{prefix}" + s.gsub! "INSTALLDIR_NATIVE_DOC=$ROOT/install-native/share/doc/gcc-arm-none-eabi", "INSTALLDIR_NATIVE_DOC=#{doc}" + + # Do not update version during build + # see: https://bugs.launchpad.net/gcc-arm-embedded/+bug/1741994 + s.gsub! "$GCC_VER_NAME-$RELEASEVER", version + end + + inreplace "build-toolchain.sh" do |s| + s.gsub! "rm -rf $INSTALLDIR_NATIVE && mkdir -p $INSTALLDIR_NATIVE", "" + + s.gsub! "--prefix=$INSTALLDIR_NATIVE", "--prefix=#{prefix}" + s.gsub! "--libexecdir=$INSTALLDIR_NATIVE/lib", "--libexecdir=#{libexec}" + s.gsub! "--infodir=$INSTALLDIR_NATIVE_DOC/info", "--infodir=#{info}" + s.gsub! "--mandir=$INSTALLDIR_NATIVE_DOC/man", "--mandir=#{man}" + s.gsub! "--htmldir=$INSTALLDIR_NATIVE_DOC/html", "--htmldir=#{doc}/html" + s.gsub! "--pdfdir=$INSTALLDIR_NATIVE_DOC/pdf", "--pdfdir=#{doc}/pdf" + s.gsub! "--with-sysroot=$INSTALLDIR_NATIVE/arm-none-eabi", "--with-sysroot=#{prefix}/arm-none-eabi" + + # Task III-11, IV-8, V-0 and V-1 generates package which we don't need + s.gsub! /^echo Task \[III-11\].*?popd/m, "" + s.gsub! /^echo Task \[IV-8\].*?popd/m, "" + s.gsub! /^echo Task \[V-0\].*?popd/m, "" + s.gsub! /^echo Task \[V-1\].*?popd/m, "" + end + + system "./install-sources.sh" + system "./build-prerequisites.sh" + system "./build-toolchain.sh", "--skip_steps=manual" + end + + test do + assert_match version.to_s, shell_output("#{bin}/arm-none-eabi-gcc --version") + end +end From f1a02e8c2d31f2330f0bcae8d15c8d5af05e5b86 Mon Sep 17 00:00:00 2001 From: Zsolt Prontvai Date: Fri, 25 Oct 2019 23:01:13 +0200 Subject: [PATCH 2/4] Improvement --- Formula/gcc-arm-none-eabi.rb | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Formula/gcc-arm-none-eabi.rb b/Formula/gcc-arm-none-eabi.rb index 53aac6db4d95..c5bb6a6b2972 100644 --- a/Formula/gcc-arm-none-eabi.rb +++ b/Formula/gcc-arm-none-eabi.rb @@ -5,12 +5,23 @@ class GccArmNoneEabi < Formula version "8-2019-q3-update" sha256 "e8a8ddfec47601f2d83f1d80c0600f198476f227102121c8d6a5a781d0c2eeef" - env :std + depends_on "gmp" + depends_on "isl" + depends_on "libelf" + depends_on "libmpc" + depends_on "mpfr" - depends_on "wget" => :build + uses_from_macos "expat" + uses_from_macos "libiconv" + uses_from_macos "zlib" def install + cd "src" do + Dir.glob("*.tar.bz2") { |file| system "tar", "xf", file } + end + inreplace "build-common.sh" do |s| + s.gsub! /^clean_env$/, "" s.gsub! "INSTALLDIR_NATIVE=$ROOT/install-native", "INSTALLDIR_NATIVE=#{prefix}" s.gsub! "INSTALLDIR_NATIVE_DOC=$ROOT/install-native/share/doc/gcc-arm-none-eabi", "INSTALLDIR_NATIVE_DOC=#{doc}" @@ -29,17 +40,9 @@ def install s.gsub! "--htmldir=$INSTALLDIR_NATIVE_DOC/html", "--htmldir=#{doc}/html" s.gsub! "--pdfdir=$INSTALLDIR_NATIVE_DOC/pdf", "--pdfdir=#{doc}/pdf" s.gsub! "--with-sysroot=$INSTALLDIR_NATIVE/arm-none-eabi", "--with-sysroot=#{prefix}/arm-none-eabi" - - # Task III-11, IV-8, V-0 and V-1 generates package which we don't need - s.gsub! /^echo Task \[III-11\].*?popd/m, "" - s.gsub! /^echo Task \[IV-8\].*?popd/m, "" - s.gsub! /^echo Task \[V-0\].*?popd/m, "" - s.gsub! /^echo Task \[V-1\].*?popd/m, "" end - system "./install-sources.sh" - system "./build-prerequisites.sh" - system "./build-toolchain.sh", "--skip_steps=manual" + system "./build-toolchain.sh", "--build_type=ppa", "--skip_steps=manual" end test do From 0a97ccfb4839d32b2eb90db2ae563ab817f7ad37 Mon Sep 17 00:00:00 2001 From: Zsolt Prontvai Date: Sun, 27 Oct 2019 19:32:29 +0100 Subject: [PATCH 3/4] One step back --- Formula/gcc-arm-none-eabi.rb | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Formula/gcc-arm-none-eabi.rb b/Formula/gcc-arm-none-eabi.rb index c5bb6a6b2972..33fbc5afede1 100644 --- a/Formula/gcc-arm-none-eabi.rb +++ b/Formula/gcc-arm-none-eabi.rb @@ -5,15 +5,17 @@ class GccArmNoneEabi < Formula version "8-2019-q3-update" sha256 "e8a8ddfec47601f2d83f1d80c0600f198476f227102121c8d6a5a781d0c2eeef" - depends_on "gmp" - depends_on "isl" - depends_on "libelf" - depends_on "libmpc" - depends_on "mpfr" + env :std - uses_from_macos "expat" - uses_from_macos "libiconv" - uses_from_macos "zlib" + depends_on "gmp" # 6.1.0 6.1.2 + depends_on "isl" # 0.18 0.21 + depends_on "libelf" # 0.8.13 0.8.13 + depends_on "libmpc" # 1.0.3 1.1.0 + depends_on "mpfr" # 3.1.4 4.0.2 + + uses_from_macos "expat" # 2.1.1 2.2.9 + uses_from_macos "libiconv" # 1.14 1.16 + uses_from_macos "zlib" # 1.2.8 1.2.11 def install cd "src" do @@ -21,7 +23,7 @@ def install end inreplace "build-common.sh" do |s| - s.gsub! /^clean_env$/, "" + #s.gsub! /^clean_env$/, "" s.gsub! "INSTALLDIR_NATIVE=$ROOT/install-native", "INSTALLDIR_NATIVE=#{prefix}" s.gsub! "INSTALLDIR_NATIVE_DOC=$ROOT/install-native/share/doc/gcc-arm-none-eabi", "INSTALLDIR_NATIVE_DOC=#{doc}" @@ -40,9 +42,15 @@ def install s.gsub! "--htmldir=$INSTALLDIR_NATIVE_DOC/html", "--htmldir=#{doc}/html" s.gsub! "--pdfdir=$INSTALLDIR_NATIVE_DOC/pdf", "--pdfdir=#{doc}/pdf" s.gsub! "--with-sysroot=$INSTALLDIR_NATIVE/arm-none-eabi", "--with-sysroot=#{prefix}/arm-none-eabi" + + # Task III-11, IV-8, V-0 and V-1 generates package which we don't need + s.gsub! /^echo Task \[III-11\].*?popd/m, "" + s.gsub! /^echo Task \[IV-8\].*?popd/m, "" + s.gsub! /^echo Task \[V-0\].*?popd/m, "" + s.gsub! /^echo Task \[V-1\].*?popd/m, "" end - system "./build-toolchain.sh", "--build_type=ppa", "--skip_steps=manual" + system "./build-toolchain.sh", "--skip_steps=manual" end test do From 464b9864e74baa0d0dc2dbd62763a43af098b2f3 Mon Sep 17 00:00:00 2001 From: Zsolt Prontvai Date: Sun, 27 Oct 2019 22:28:26 +0100 Subject: [PATCH 4/4] test --- Formula/gcc-arm-none-eabi.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Formula/gcc-arm-none-eabi.rb b/Formula/gcc-arm-none-eabi.rb index 33fbc5afede1..b1e83af93fed 100644 --- a/Formula/gcc-arm-none-eabi.rb +++ b/Formula/gcc-arm-none-eabi.rb @@ -5,7 +5,7 @@ class GccArmNoneEabi < Formula version "8-2019-q3-update" sha256 "e8a8ddfec47601f2d83f1d80c0600f198476f227102121c8d6a5a781d0c2eeef" - env :std + #env :std depends_on "gmp" # 6.1.0 6.1.2 depends_on "isl" # 0.18 0.21 @@ -23,7 +23,7 @@ def install end inreplace "build-common.sh" do |s| - #s.gsub! /^clean_env$/, "" + s.gsub! /^clean_env$/, "" s.gsub! "INSTALLDIR_NATIVE=$ROOT/install-native", "INSTALLDIR_NATIVE=#{prefix}" s.gsub! "INSTALLDIR_NATIVE_DOC=$ROOT/install-native/share/doc/gcc-arm-none-eabi", "INSTALLDIR_NATIVE_DOC=#{doc}"