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

55 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-11.1.0/gcc-11.1.0.tar.xz"
mirror "https://ftpmirror.gnu.org/gcc/gcc-11.1.0/gcc-11.1.0.tar.xz"
sha256 "4c4a6fb8a8396059241c2e674b85b351c26a5d678274007f076957afa1cc9ddf"
license "GPL-3.0-or-later" => { with: "GCC-exception-3.1" }
bottle do
sha256 big_sur: "88534ab7b03901f67f4c35f998b5022a7ae3214db8e30fdcf7c83424b42af292"
sha256 catalina: "63c2f1f77439b4e2e452b7fb0d4ae7e69242f7be2df2a01864e0895f93e2dd86"
sha256 mojave: "132bb7c7505c86b8cd4a3e6cee01acff07288034517345b7781771a0b17e5bec"
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++"
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