Created
October 23, 2016 20:01
-
-
Save andlabs/c93f7c5bb542316e584e8d4b420092ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Qemu < Formula | |
desc "x86 and PowerPC Emulator" | |
homepage "http://wiki.qemu.org" | |
head "https://github.com/abligh/qemu.git", :branch => "qemu-hypervisor-framework" | |
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 "sdl" => :optional | |
depends_on "gtk+" => :optional | |
depends_on "libssh2" => :optional | |
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" | |
args = %W[ | |
--prefix=#{prefix} | |
--cc=#{ENV.cc} | |
--host-cc=#{ENV.cc} | |
--disable-bsd-user | |
--disable-guest-agent | |
] | |
# Cocoa and SDL/GTK+ UIs cannot both be enabled at once. | |
if build.with?("sdl") || build.with?("gtk+") | |
args << "--disable-cocoa" | |
else | |
args << "--enable-cocoa" | |
end | |
args << (build.with?("vde") ? "--enable-vde" : "--disable-vde") | |
args << (build.with?("sdl") ? "--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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment