Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc@7: split args for macOS and Linux #74930

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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