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

55 lines
1.9 KiB
Ruby

class I686ElfGcc < Formula
desc "GNU compiler collection for i686-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: "6d402e313e5bb521f8359dba3805c2e9791f2d660395dda69e13da8e0f118a84"
sha256 catalina: "c1f1073df4c6c3b134178abb19e8e35d9b3a5ce50815d8407aca4682fe283018"
sha256 mojave: "6799e72168bcb5f4e14081b64a98eb746e7a699be00bccf9adeead726796ff0e"
end
depends_on "gmp"
depends_on "i686-elf-binutils"
depends_on "libmpc"
depends_on "mpfr"
def install
mkdir "i686-elf-gcc-build" do
system "../configure", "--target=i686-elf",
"--prefix=#{prefix}",
"--infodir=#{info}/i686-elf-gcc",
"--disable-nls",
"--without-isl",
"--without-headers",
"--with-as=#{Formula["i686-elf-binutils"].bin}/i686-elf-as",
"--with-ld=#{Formula["i686-elf-binutils"].bin}/i686-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}/i686-elf-gcc", "-c", "-o", "test-c.o", "test-c.c"
assert_match "file format elf32-i386",
shell_output("#{Formula["i686-elf-binutils"].bin}/i686-elf-objdump -a test-c.o")
end
end