<commit_before>class Gcc49 < Formula
  def arch
    if Hardware::CPU.type == :intel
      if MacOS.prefer_64_bit?
        "x86_64"
      else
        "i686"
      end
    elsif Hardware::CPU.type == :ppc
      if MacOS.prefer_64_bit?
        "powerpc64"
      else
        "powerpc"
      end
    end
  end

  def osmajor
    `uname -r`.chomp
  end

  desc "GNU Compiler Collection"
  homepage "http://gcc.gnu.org"
  url "https://ftpmirror.gnu.org/gcc/gcc-4.9.3/gcc-4.9.3.tar.bz2"
  mirror "ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.9.3/gcc-4.9.3.tar.bz2"
  sha256 "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e"

  if MacOS.version >= :yosemite
    # Fixes build with Xcode 7.
    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66523
    patch do
      url "https://gcc.gnu.org/bugzilla/attachment.cgi?id=35773"
      sha256 "db4966ade190fff4ed39976be8d13e84839098711713eff1d08920d37a58f5ec"
    end
    # Fixes assembler generation with XCode 7
    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66509
    patch do
      url "https://gist.githubusercontent.com/tdsmith/d248e025029add31e7aa/raw/444e292786df41346a3a1cc6267bba587408a007/gcc.diff"
      sha256 "636b65a160ccb7417cc4ffc263fc815382f8bb895e32262205cd10d65ea7804a"
    end
  end

  # Fix config-ml.in: eval: line 160: unexpected EOF while looking for matching `''
  # Fixed upstream.
  patch do
    url "https://gist.githubusercontent.com/sjackman/34fa1081982bda781862/raw/738349d49f4f094cced7cfe287cdcdfcd7207265/52fd2e1.diff"
    sha256 "360dc5061909bae0096d86546e53eae971755661da386b403f836eb70fa335f1"
  end

  # Use curl instead of wget for downloads: wget on linux brews libuuid
  # which may conflict with system as the API/ABI of libuuid is unstable
  patch do
    url "https://files.warwick.ac.uk/supernemo/files/Cadfael/distfiles/gcc49-use-curl-prerequisites.patch"
    sha256 "97899007c4d92dfd4039ecd5f33b33f1edf6295937b4cf7131d4cc4fd8598fed"
  end

  # Use https mirror rather than ftp in prerequisites as ftp is unusable
  # inside French labs
  patch do
    url "https://files.warwick.ac.uk/supernemo/files/Cadfael/distfiles/gcc49-use-nonftp-mirror-prerequisites.patch"
    sha256 "faf652fd1c8bd1179533d95a6fa9a27f6ff69f8bdd62186092c439d1e9574339"
  end

  option "with-nls", "Build with native language support (localization)"
  option "with-all-languages", "Enable all compilers and languages, except Ada"
  option "without-fortran", "Build without the gfortran compiler"
  option "with-objc", "Build the Objective C/C++ compiler"
  option "with-java", "Build the gcj compiler"

  # enabling multilib on a host that can't run 64-bit results in build failures
  if OS.mac?
    option "without-multilib", "Build without multilib support" if MacOS.prefer_64_bit?
  else
    option "with-multilib", "Build with multilib support"
  end

  if OS.linux?
    depends_on "binutils" if build.with? "glibc"
    depends_on "glibc" => :optional
  end

  depends_on "ecj" if build.with?("java") || build.with?("all-languages")

  if MacOS.version < :leopard && OS.mac?
    # The as that comes with Tiger isn't capable of dealing with the
    # PPC asm that comes in libitm
    depends_on "cctools" => :build
  end

  fails_with :gcc_4_0

  # GCC bootstraps itself, so it is OK to have an incompatible C++ stdlib
  cxxstdlib_check :skip

  # The bottles are built on systems with the CLT installed, and do not work
  # out of the box on Xcode-only systems due to an incorrect sysroot.
  def pour_bottle?
    MacOS::CLT.installed?
  end

  def version_suffix
    version.to_s.slice(/\d\.\d/)
  end

  def install
    # GCC will suffer build errors if forced to use a particular linker.
    ENV.delete "LD"

    if OS.mac? && MacOS.version < :leopard
      ENV["AS"] = ENV["AS_FOR_TARGET"] = "#{Formula["cctools"].bin}/as"
    end

    # C, C++, compilers are always built<commit_msg>Remove no more valid directive<commit_after>class Gcc49 < Formula
  def arch
    if Hardware::CPU.type == :intel
      if MacOS.prefer_64_bit?
        "x86_64"
      else
        "i686"
      end
    elsif Hardware::CPU.type == :ppc
      if MacOS.prefer_64_bit?
        "powerpc64"
      else
        "powerpc"
      end
    end
  end

  def osmajor
    `uname -r`.chomp
  end

  desc "GNU Compiler Collection"
  homepage "http://gcc.gnu.org"
  url "https://ftpmirror.gnu.org/gcc/gcc-4.9.3/gcc-4.9.3.tar.bz2"
  mirror "ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.9.3/gcc-4.9.3.tar.bz2"
  sha256 "2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e"

  if MacOS.version >= :yosemite
    # Fixes build with Xcode 7.
    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66523
    patch do
      url "https://gcc.gnu.org/bugzilla/attachment.cgi?id=35773"
      sha256 "db4966ade190fff4ed39976be8d13e84839098711713eff1d08920d37a58f5ec"
    end
    # Fixes assembler generation with XCode 7
    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66509
    patch do
      url "https://gist.githubusercontent.com/tdsmith/d248e025029add31e7aa/raw/444e292786df41346a3a1cc6267bba587408a007/gcc.diff"
      sha256 "636b65a160ccb7417cc4ffc263fc815382f8bb895e32262205cd10d65ea7804a"
    end
  end

  # Fix config-ml.in: eval: line 160: unexpected EOF while looking for matching `''
  # Fixed upstream.
  patch do
    url "https://gist.githubusercontent.com/sjackman/34fa1081982bda781862/raw/738349d49f4f094cced7cfe287cdcdfcd7207265/52fd2e1.diff"
    sha256 "360dc5061909bae0096d86546e53eae971755661da386b403f836eb70fa335f1"
  end

  # Use curl instead of wget for downloads: wget on linux brews libuuid
  # which may conflict with system as the API/ABI of libuuid is unstable
  patch do
    url "https://files.warwick.ac.uk/supernemo/files/Cadfael/distfiles/gcc49-use-curl-prerequisites.patch"
    sha256 "97899007c4d92dfd4039ecd5f33b33f1edf6295937b4cf7131d4cc4fd8598fed"
  end

  # Use https mirror rather than ftp in prerequisites as ftp is unusable
  # inside French labs
  patch do
    url "https://files.warwick.ac.uk/supernemo/files/Cadfael/distfiles/gcc49-use-nonftp-mirror-prerequisites.patch"
    sha256 "faf652fd1c8bd1179533d95a6fa9a27f6ff69f8bdd62186092c439d1e9574339"
  end

  option "with-nls", "Build with native language support (localization)"
  option "with-all-languages", "Enable all compilers and languages, except Ada"
  option "without-fortran", "Build without the gfortran compiler"
  option "with-objc", "Build the Objective C/C++ compiler"
  option "with-java", "Build the gcj compiler"

  # enabling multilib on a host that can't run 64-bit results in build failures
  if OS.mac?
    option "without-multilib", "Build without multilib support" if MacOS.prefer_64_bit?
  else
    option "with-multilib", "Build with multilib support"
  end

  if OS.linux?
    depends_on "binutils" if build.with? "glibc"
    depends_on "glibc" => :optional
  end

  depends_on "ecj" if build.with?("java") || build.with?("all-languages")

  if MacOS.version < :leopard && OS.mac?
    # The as that comes with Tiger isn't capable of dealing with the
    # PPC asm that comes in libitm
    depends_on "cctools" => :build
  end

  # fails_with :gcc_4_0

  # GCC bootstraps itself, so it is OK to have an incompatible C++ stdlib
  cxxstdlib_check :skip

  # The bottles are built on systems with the CLT installed, and do not work
  # out of the box on Xcode-only systems due to an incorrect sysroot.
  def pour_bottle?
    MacOS::CLT.installed?
  end

  def version_suffix
    version.to_s.slice(/\d\.\d/)
  end

  def install
    # GCC will suffer build errors if forced to use a particular linker.
    ENV.delete "LD"

    if OS.mac? && MacOS.version < :leopard
      ENV["AS"] = ENV["AS_FOR_TARGET"] = "#{Formula["cctools"].bin}/as"
    end

    # C, C++, compilers are always built
{'fraction_non_alphanumeric': 0.09696578437701743, 'fraction_numerical': 0.10664945125887669, 'mean_word_length': 3.4878331402085747, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1597883', 'n_tokens_mistral': 3479, 'n_tokens_neox': 2926, 'n_words': 677}