homebrew-core/Formula/qemu.rb

125 lines
5.2 KiB
Ruby

class Qemu < Formula
desc "Emulator for x86 and PowerPC"
homepage "https://www.qemu.org/"
license "GPL-2.0-only"
revision 1
head "https://git.qemu.org/git/qemu.git"
stable do
url "https://download.qemu.org/qemu-5.2.0.tar.xz"
sha256 "cb18d889b628fbe637672b0326789d9b0e3b8027e0445b936537c78549df17bc"
# remove in next release
patch do
url "https://git.qemu.org/?p=qemu.git;a=patch;h=0dbce6efb5ff2e7113734d3a0cabbf87fc56feec"
sha256 "8ced33c7f829216544b762d8db0f143dbea04fa5a1ce41b491bbd7808f64a944"
end
# remove in next release
patch do
url "https://git.qemu.org/?p=qemu.git;a=patch;h=cb7abd8319d19000b57ae6c5c474c2635db054c6"
sha256 "818ad42f0cb25ab5df37058e27d7f879e4389489f692da4404c1f15dde5b2c4d"
end
end
bottle do
sha256 arm64_big_sur: "ed35771ec8725d39c1d8113496d3d5eb826c005707166d4d4245414b72917d6c"
sha256 big_sur: "b3e345a9bdf7b44c9250c3a806d30509903a025c6a10e021804e4b0389906a76"
sha256 catalina: "9c2c7f34bdaa6e2398b1a54385b3e25a2b67c19e3f8ceae8ea9b649b5626448c"
sha256 mojave: "06e7e68f8201f7b3345b74ba5fe5582c42a35da5285cf7914b946403b2c7c797"
end
depends_on "libtool" => :build
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "glib"
depends_on "gnutls"
depends_on "jpeg"
depends_on "libpng"
depends_on "libslirp"
depends_on "libssh"
depends_on "libusb"
depends_on "lzo"
depends_on "ncurses"
depends_on "nettle"
depends_on "pixman"
depends_on "snappy"
depends_on "vde"
# 820KB floppy disk image file of FreeDOS 1.2, used to test QEMU
resource "test-image" do
url "https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/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-slirp=system
--enable-vde
--extra-cflags=-DNCURSES_WIDECHAR=1
--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"
on_macos do
args << "--enable-cocoa"
end
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-aarch64 --version")
assert_match expected, shell_output("#{bin}/qemu-system-alpha --version")
assert_match expected, shell_output("#{bin}/qemu-system-arm --version")
assert_match expected, shell_output("#{bin}/qemu-system-cris --version")
assert_match expected, shell_output("#{bin}/qemu-system-hppa --version")
assert_match expected, shell_output("#{bin}/qemu-system-i386 --version")
assert_match expected, shell_output("#{bin}/qemu-system-m68k --version")
assert_match expected, shell_output("#{bin}/qemu-system-microblaze --version")
assert_match expected, shell_output("#{bin}/qemu-system-microblazeel --version")
assert_match expected, shell_output("#{bin}/qemu-system-mips --version")
assert_match expected, shell_output("#{bin}/qemu-system-mips64 --version")
assert_match expected, shell_output("#{bin}/qemu-system-mips64el --version")
assert_match expected, shell_output("#{bin}/qemu-system-mipsel --version")
assert_match expected, shell_output("#{bin}/qemu-system-moxie --version")
assert_match expected, shell_output("#{bin}/qemu-system-nios2 --version")
assert_match expected, shell_output("#{bin}/qemu-system-or1k --version")
assert_match expected, shell_output("#{bin}/qemu-system-ppc --version")
assert_match expected, shell_output("#{bin}/qemu-system-ppc64 --version")
assert_match expected, shell_output("#{bin}/qemu-system-riscv32 --version")
assert_match expected, shell_output("#{bin}/qemu-system-riscv64 --version")
assert_match expected, shell_output("#{bin}/qemu-system-rx --version")
assert_match expected, shell_output("#{bin}/qemu-system-s390x --version")
assert_match expected, shell_output("#{bin}/qemu-system-sh4 --version")
assert_match expected, shell_output("#{bin}/qemu-system-sh4eb --version")
assert_match expected, shell_output("#{bin}/qemu-system-sparc --version")
assert_match expected, shell_output("#{bin}/qemu-system-sparc64 --version")
assert_match expected, shell_output("#{bin}/qemu-system-tricore --version")
assert_match expected, shell_output("#{bin}/qemu-system-x86_64 --version")
assert_match expected, shell_output("#{bin}/qemu-system-xtensa --version")
assert_match expected, shell_output("#{bin}/qemu-system-xtensaeb --version")
resource("test-image").stage testpath
assert_match "file format: raw", shell_output("#{bin}/qemu-img info FLOPPY.img")
end
end