Skip to content

Commit

Permalink
gcc@7: split args for macOS and Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
iMichka committed Apr 11, 2021
1 parent a6d75c0 commit 6badb08
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions Formula/gcc@7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(",")}",
Expand All @@ -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
Expand Down

0 comments on commit 6badb08

Please sign in to comment.