homebrew-core/Formula/x86_64-elf-gcc.rb

59 lines
2.0 KiB
Ruby

class X8664ElfGcc < Formula
desc "GNU compiler collection for x86_64-elf"
homepage "https://gcc.gnu.org"
url "https://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.xz"
mirror "https://ftpmirror.gnu.org/gcc/gcc-10.2.0/gcc-10.2.0.tar.xz"
sha256 "b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c"
livecheck do
url :stable
end
bottle do
sha256 "fabfa58ff9baa00f65192dac31f63133e8c98b1b2bf4ef49ba451f6331ed2cc2" => :catalina
sha256 "6775f752210fe04754eca0de749d7243e436da6a24118660faca5bbf62eedb16" => :mojave
sha256 "ef83d1c3909cc2d7b42d5dca74909c548f653d34a55d141f8d5402992214d622" => :high_sierra
end
depends_on "gmp"
depends_on "libmpc"
depends_on "mpfr"
depends_on "x86_64-elf-binutils"
def install
mkdir "x86_64-elf-gcc-build" do
system "../configure", "--target=x86_64-elf",
"--prefix=#{prefix}",
"--infodir=#{info}/x86_64-elf-gcc",
"--disable-nls",
"--without-isl",
"--without-headers",
"--with-as=#{Formula["x86_64-elf-binutils"].bin}/x86_64-elf-as",
"--with-ld=#{Formula["x86_64-elf-binutils"].bin}/x86_64-elf-ld",
"--enable-languages=c,c++",
"SED=/usr/bin/sed"
system "make", "all-gcc"
system "make", "install-gcc"
system "make", "all-target-libgcc"
system "make", "install-target-libgcc"
# FSF-related man pages may conflict with native gcc
(share/"man/man7").rmtree
end
end
test do
(testpath/"test-c.c").write <<~EOS
int main(void)
{
int i=0;
while(i<10) i++;
return i;
}
EOS
system "#{bin}/x86_64-elf-gcc", "-c", "-o", "test-c.o", "test-c.c"
assert_match "file format elf64-x86-64",
shell_output("#{Formula["x86_64-elf-binutils"].bin}/x86_64-elf-objdump -a test-c.o")
end
end