class M68kElfGcc < Formula desc "GNU compiler collection m68k-elf" homepage "https://gcc.gnu.org" url "https://ftpmirror.gnu.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.xz" mirror "https://ftp.gnu.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.xz" sha256 "438fd996826b0c82485a29da03a72d71d6e3541a83ec702df4271f6fe025d24e" license "GPL-3.0-or-later" => { with: "GCC-exception-3.1" } livecheck do formula "gcc" end bottle do rebuild 1 sha256 arm64_tahoe: "8b29b6480ea952ca41137d137d330722f096c7fd15bc93e51bbd150344d31e56" sha256 arm64_sequoia: "c1fb4742df72f99529d427e22cf35645ade0addec649e0b1d749230d3368c8ce" sha256 arm64_sonoma: "5f638dfc953974e75111ab8699a9394bb6fbe3bca4fc19f0c4025d4cd1416e60" sha256 sonoma: "5a5f49d2e038b914738c7c6ba145e6ca0a4123ba6a79b851014f0d3a47153424" sha256 arm64_linux: "92608229d9d171fdc6ab30fe4c8d137d427a460204c5938bfb33651d08b465da" sha256 x86_64_linux: "a9b1cf9ab4afae9f6c63b7730b0364c305d57f28599cd585523179a492565315" end depends_on "gmp" depends_on "isl" depends_on "libmpc" depends_on "m68k-elf-binutils" depends_on "mpfr" depends_on "zstd" on_linux do depends_on "zlib-ng-compat" end def install target = "m68k-elf" mkdir "m68k-elf-build" do system "../configure", "--target=#{target}", "--prefix=#{prefix}", "--infodir=#{info}/#{target}", "--disable-nls", "--without-headers", "--with-as=#{Formula["m68k-elf-binutils"].bin}/m68k-elf-as", "--with-ld=#{Formula["m68k-elf-binutils"].bin}/m68k-elf-ld", "--enable-languages=c,c++,objc,lto", "--enable-lto", "--with-system-zlib", "--with-zstd", *std_configure_args 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 rm_r(share/"man/man7") end end test do (testpath/"test-c.c").write <<~C int main(void) { int i=0; while(i<10) i++; return i; } C system bin/"m68k-elf-gcc", "-c", "-o", "test-c.o", "test-c.c" assert_match "file format elf32-m68k", shell_output("#{Formula["m68k-elf-binutils"].bin}/m68k-elf-objdump -a test-c.o") end end