homebrew-core/Formula/qemu.rb
2017-04-11 23:01:48 -07:00

83 lines
2.8 KiB
Ruby

class Qemu < Formula
desc "x86 and PowerPC Emulator"
homepage "http://wiki.qemu.org"
url "http://wiki.qemu-project.org/download/qemu-2.8.1.tar.bz2"
sha256 "018e4c7ed22c220395cf41f835d01505e49d0e579a548bd3d72b03809442bbcd"
head "git://git.qemu-project.org/qemu.git"
bottle do
sha256 "3a709657c309d04d3c2a91de375fe80f81d8f441eb42d029cf1e8e364774d56e" => :sierra
sha256 "ff966d6bdc3b80a786d87e1ae01e6099de4c6da6bee5442dd343bed898cd24f1" => :el_capitan
sha256 "3a13d18575c6d8b3817f39a08cd6d7d2b96b8dca7237a799011e7ebb51cf1c63" => :yosemite
end
depends_on "pkg-config" => :build
depends_on "libtool" => :build
depends_on "jpeg"
depends_on "libpng" => :recommended
depends_on "gnutls"
depends_on "glib"
depends_on "pixman"
depends_on "vde" => :optional
depends_on "sdl2" => :optional
depends_on "gtk+" => :optional
depends_on "libssh2" => :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
# 3.2MB working disc-image file hosted on upstream's servers for people to use to test qemu functionality.
resource "armtest" do
url "http://wiki.qemu.org/download/arm-test-0.2.tar.gz"
sha256 "4b4c2dce4c055f0a2adb93d571987a3d40c96c6cbfd9244d19b9708ce5aea454"
end
def install
ENV["LIBTOOL"] = "glibtool"
# Fixes "dyld: lazy symbol binding failed: Symbol not found: _clock_gettime"
if MacOS.version == "10.11" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0"
inreplace %w[hw/i386/kvm/i8254.c include/qemu/timer.h linux-user/strace.c
roms/skiboot/external/pflash/progress.c
roms/u-boot/arch/sandbox/cpu/os.c ui/spice-display.c
util/qemu-timer-common.c], "CLOCK_MONOTONIC", "NOT_A_SYMBOL"
end
args = %W[
--prefix=#{prefix}
--cc=#{ENV.cc}
--host-cc=#{ENV.cc}
--disable-bsd-user
--disable-guest-agent
]
# 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
assert_match version.to_s, shell_output("#{bin}/qemu-system-i386 --version")
resource("armtest").stage testpath
assert_match "file format: raw", shell_output("#{bin}/qemu-img info arm_root.img")
end
end