pkg:setup ENV.delete "LD" languages = %w[c c++ objc obj-c++ fortran] osmajor = `uname -r`.split(".").first pkgversion = "Homebrew GCC #{pkg_version} #{build.used_options*" "}".strip args = %W[--build=x86_64-apple-darwin#{osmajor} --prefix=#{prefix} --libdir=#{lib}/gcc/#{version_suffix} --disable-nls --enable-checking=release --enable-languages=#{languages.join(",")} --program-suffix=-#{version_suffix} --with-gmp=#{Formula["gmp"].opt_prefix} --with-mpfr=#{Formula["mpfr"].opt_prefix} --with-mpc=#{Formula["libmpc"].opt_prefix} --with-isl=#{Formula["isl"].opt_prefix} --with-system-zlib --with-pkgversion=#{pkgversion} --with-bugurl=https://github.com/Homebrew/homebrew-core/issues ] args << "--disable-multilib" if DevelopmentTools.clang_build_version >= 1000 inreplace "libgcc/config/t-slibgcc-darwin", "@shlib_slibdir@", "#{HOMEBREW_PREFIX}/lib/gcc/#{version_suffix}" mkdir "build" && cd build if !MacOS::CLT.installed? args << "--with-native-system-header-dir=/usr/include" args << "--with-sysroot=#{MacOS.sdk_path}" elsif MacOS.version >= :mojave args << "--with-native-system-header-dir=/usr/include" args << "--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" end PKG_CONF=../configure pkg:configure *args make BOOT_LDFLAGS=-Wl,-headerpad_max_DESTDIR=${PKG_DEST} install_names make DESTDIR=${PKG_DEST} install bin.install_symlink bin/"gfortran-#{version_suffix}" => "gfortran"