homebrew-core/Formula/qemu.rb
2018-04-11 22:48:40 -07:00

84 lines
2.6 KiB
Ruby

class Qemu < Formula
desc "x86 and PowerPC Emulator"
homepage "https://www.qemu.org/"
url "https://download.qemu.org/qemu-2.11.1.tar.bz2"
sha256 "d9df2213ceed32e91dab7bc9dd19c1af83f91ba72c7aeef7605dfaaf81732ccb"
head "https://git.qemu.org/git/qemu.git"
bottle do
sha256 "8239d88e31f56993977b0d6ba1d63e15c61436c76a6b04ffa46c0dd40f376c4c" => :high_sierra
sha256 "84a89e0db4091794605084ed08c5991f1bc60c68474ab44f5e78ac220c664335" => :sierra
sha256 "55c6b1cf7d0fdaf5e5f131c84bf62566954edb56557df0dd088c90a436bb25a3" => :el_capitan
end
devel do
url "https://download.qemu.org/qemu-2.12.0-rc3.tar.xz"
sha256 "e64b6ba7939a0339aaf82e5720f54b93f46cba032dddaf40fbba028e75397ac7"
end
depends_on "pkg-config" => :build
depends_on "libtool" => :build
depends_on "jpeg"
depends_on "gnutls"
depends_on "glib"
depends_on "ncurses"
depends_on "pixman"
depends_on "libpng" => :recommended
depends_on "vde" => :optional
depends_on "sdl2" => :optional
depends_on "gtk+" => :optional
depends_on "libssh2" => :optional
depends_on "libusb" => :optional
deprecated_option "with-sdl" => "with-sdl2"
fails_with :gcc_4_0 do
cause "qemu requires a compiler with support for the __thread specifier"
end
fails_with :gcc do
cause "qemu requires a compiler with support for the __thread specifier"
end
# 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
--extra-cflags=-DNCURSES_WIDECHAR=1
]
# Cocoa and SDL2/GTK+ UIs cannot both be enabled at once.
if build.with?("sdl2") || build.with?("gtk+")
args << "--disable-cocoa"
else
args << "--enable-cocoa"
end
args << (build.with?("vde") ? "--enable-vde" : "--disable-vde")
args << (build.with?("sdl2") ? "--enable-sdl" : "--disable-sdl")
args << (build.with?("gtk+") ? "--enable-gtk" : "--disable-gtk")
args << (build.with?("libssh2") ? "--enable-libssh2" : "--disable-libssh2")
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