From 6badb08b73a2ec828da2b483a48319e5050e3f2f Mon Sep 17 00:00:00 2001 From: Michka Popoff Date: Sat, 10 Apr 2021 23:36:34 +0200 Subject: [PATCH] gcc@7: split args for macOS and Linux --- Formula/gcc@7.rb | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/Formula/gcc@7.rb b/Formula/gcc@7.rb index 6bf7fb5650bbb..8f31b5be235e8 100644 --- a/Formula/gcc@7.rb +++ b/Formula/gcc@7.rb @@ -4,7 +4,7 @@ class GccAT7 < Formula url "https://ftp.gnu.org/gnu/gcc/gcc-7.5.0/gcc-7.5.0.tar.xz" mirror "https://ftpmirror.gnu.org/gcc/gcc-7.5.0/gcc-7.5.0.tar.xz" sha256 "b81946e7f01f90528a1f7352ab08cc602b9ccc05d4e44da4bd501c5a189ee661" - revision 3 + revision 4 livecheck do url :stable @@ -59,7 +59,6 @@ def install languages = %w[c c++ objc obj-c++ fortran] args = [ - "--build=x86_64-apple-darwin#{OS.kernel_version}", "--prefix=#{prefix}", "--libdir=#{lib}/gcc/#{version_suffix}", "--enable-languages=#{languages.join(",")}", @@ -69,29 +68,35 @@ def install "--with-mpfr=#{Formula["mpfr"].opt_prefix}", "--with-mpc=#{Formula["libmpc"].opt_prefix}", "--with-isl=#{Formula["isl"].opt_prefix}", - "--with-system-zlib", "--enable-checking=release", "--with-pkgversion=Homebrew GCC #{pkg_version} #{build.used_options*" "}".strip, "--with-bugurl=#{tap.issues_url}", "--disable-nls", ] - # Xcode 10 dropped 32-bit support - args << "--disable-multilib" if DevelopmentTools.clang_build_version >= 1000 + on_macos do + args << "--build=x86_64-apple-darwin#{OS.kernel_version}" + args << "--with-system-zlib" - # System headers may not be in /usr/include - sdk = MacOS.sdk_path_if_needed - if sdk - args << "--with-native-system-header-dir=/usr/include" - args << "--with-sysroot=#{sdk}" - end + # Xcode 10 dropped 32-bit support + args << "--disable-multilib" if DevelopmentTools.clang_build_version >= 1000 + + # System headers may not be in /usr/include + sdk = MacOS.sdk_path_if_needed + if sdk + args << "--with-native-system-header-dir=/usr/include" + args << "--with-sysroot=#{sdk}" + end - # Avoid reference to sed shim - args << "SED=/usr/bin/sed" + # Ensure correct install names when linking against libgcc_s; + # see discussion in https://github.com/Homebrew/homebrew/pull/34303 + inreplace "libgcc/config/t-slibgcc-darwin", "@shlib_slibdir@", "#{HOMEBREW_PREFIX}/lib/gcc/#{version_suffix}" + end - # Ensure correct install names when linking against libgcc_s; - # see discussion in https://github.com/Homebrew/homebrew/pull/34303 - inreplace "libgcc/config/t-slibgcc-darwin", "@shlib_slibdir@", "#{HOMEBREW_PREFIX}/lib/gcc/#{version_suffix}" + on_linux do + # Fix Linux error: gnu/stubs-32.h: No such file or directory. + args << "--disable-multilib" + end mkdir "build" do system "../configure", *args