class Qemu < Formula desc "x86 and PowerPC Emulator" homepage "https://www.qemu.org/" url "https://download.qemu.org/qemu-4.1.1.tar.xz" sha256 "ed6fdbbdd272611446ff8036991e9b9f04a2ab2e3ffa9e79f3bab0eb9a95a1d2" head "https://git.qemu.org/git/qemu.git" bottle do sha256 "890eddb62299cf2e7ed2c405c7f43ac49dcfdc31c8b9b207d33759d5d7a3f8da" => :catalina sha256 "975c6eb024395d1b1dd599bf9e449f21000948097a361f1a2823e9adadc4d05a" => :mojave sha256 "baac31721aba99ae068b3d9a76d7212a395124f791eee3bcb3cdf882ae41e829" => :high_sierra end depends_on "libtool" => :build depends_on "pkg-config" => :build depends_on "glib" depends_on "gnutls" depends_on "jpeg" depends_on "libpng" depends_on "libssh" depends_on "libusb" depends_on "lzo" depends_on "ncurses" depends_on "pixman" depends_on "vde" # 820KB floppy disk image file of FreeDOS 1.2, used to test QEMU resource "test-image" do url "https://dl.bintray.com/homebrew/mirror/FD12FLOPPY.zip" sha256 "81237c7b42dc0ffc8b32a2f5734e3480a3f9a470c50c14a9c4576a2561a35807" end def install ENV["LIBTOOL"] = "glibtool" args = %W[ --prefix=#{prefix} --cc=#{ENV.cc} --host-cc=#{ENV.cc} --disable-bsd-user --disable-guest-agent --enable-curses --enable-libssh --enable-vde --extra-cflags=-DNCURSES_WIDECHAR=1 --enable-cocoa --disable-sdl --disable-gtk ] # Sharing Samba directories in QEMU requires the samba.org smbd which is # incompatible with the macOS-provided version. This will lead to # silent runtime failures, so we set it to a Homebrew path in order to # obtain sensible runtime errors. This will also be compatible with # Samba installations from external taps. args << "--smbd=#{HOMEBREW_PREFIX}/sbin/samba-dot-org-smbd" system "./configure", *args system "make", "V=1", "install" end test do expected = build.stable? ? version.to_s : "QEMU Project" assert_match expected, shell_output("#{bin}/qemu-system-i386 --version") resource("test-image").stage testpath assert_match "file format: raw", shell_output("#{bin}/qemu-img info FLOPPY.img") end end