class X8664ElfGcc < Formula desc "The GNU compiler collection for x86_64-elf" homepage "https://gcc.gnu.org" url "https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz" mirror "https://ftpmirror.gnu.org/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz" sha256 "ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206" bottle do sha256 "08e58deea0e230490676590c0094dd4c27586d6ef1a5dfdfa808be46508ac81e" => :catalina sha256 "eee7d6ac62924a8322ba09687aee4f10f48f32a2caf5497cad3bf67dadfe6e9b" => :mojave sha256 "f00c75602affbe7012f22524633b0df235667ab65f91c9bad51ca874305620de" => :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", "--enable-targets=all", "--enable-multilib", "--prefix=#{prefix}", "--without-isl", "--disable-werror", "--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" 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