Add versioned qemu formulas which use virgl library

main
Nikita Tokarchuk 3 years ago
parent 2e048f4fb2
commit 1da2f305c5
Signed by: mainnika
GPG Key ID: A595FB7E3E56911C
  1. 116
      Formula/qemu@20211103.1.rb
  2. 116
      Formula/qemu@20220315.1.rb

@ -0,0 +1,116 @@
class QemuAT202111031 < Formula
desc "Emulator for x86 and PowerPC augmented with a power of VirGL"
homepage "https://www.qemu.org/"
url "https://code.tokarch.uk/third_party/qemu.git",
# v6.1.0
using: :git,
revision: "8d1c7afa5bc34e11fba6fd79632b3fb368534fca"
version "20211103.1"
license "GPL-2.0-only"
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 "libangle"
depends_on "libepoxy@20211103.1"
depends_on "virglrenderer@20211103.1"
depends_on "libpng"
depends_on "libssh"
depends_on "libusb"
depends_on "lzo"
depends_on "ncurses"
depends_on "nettle"
depends_on "pixman"
depends_on "snappy"
depends_on "spice-protocol"
depends_on "vde"
conflicts_with "qemu",
because: "it's a same package"
# 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-vde
--extra-cflags=-DNCURSES_WIDECHAR=1
--extra-cflags=-I#{Formula["libangle"].opt_prefix}/include
--extra-ldflags=-L#{Formula["libangle"].opt_prefix}/lib
--extra-cflags=-I#{Formula["libepoxy@20211103.1"].opt_prefix}/include
--extra-ldflags=-L#{Formula["libepoxy@20211103.1"].opt_prefix}/lib
--extra-cflags=-I#{Formula["virglrenderer@20211103.1"].opt_prefix}/include
--extra-ldflags=-L#{Formula["virglrenderer@20211103.1"].opt_prefix}/lib
--extra-cflags=-I#{Formula["spice-protocol"].opt_prefix}/include/spice-1
--extra-ldflags=-L#{Formula["spice-protocol"].opt_prefix}/lib
--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 = "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-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

@ -0,0 +1,116 @@
class QemuAT202203151 < Formula
desc "Emulator for x86 and PowerPC augmented with a power of VirGL"
homepage "https://www.qemu.org/"
url "https://code.tokarch.uk/third_party/qemu.git",
# v7.0.0-rc
using: :git,
revision: "79a55203871ffc5dd0775e49798b90fa936bdefc"
version "20220315.1"
license "GPL-2.0-only"
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 "libangle"
depends_on "libepoxy@20220315.1"
depends_on "virglrenderer@20220315.1"
depends_on "libpng"
depends_on "libssh"
depends_on "libusb"
depends_on "lzo"
depends_on "ncurses"
depends_on "nettle"
depends_on "pixman"
depends_on "snappy"
depends_on "spice-protocol"
depends_on "vde"
conflicts_with "qemu",
because: "it's a same package"
# 820KB floppy disk image file of FreeDOS 1.2, used to test QEMU
resource "test-image" do
url "http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/qemu/qemu-fd12-base.zip"
sha256 "2900ee67ded38c58680c6b1ae667b2d01ea611c63c83f19bbef53e3da3735820"
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
--extra-cflags=-I#{Formula["libangle"].opt_prefix}/include
--extra-ldflags=-L#{Formula["libangle"].opt_prefix}/lib
--extra-cflags=-I#{Formula["libepoxy@20220315.1"].opt_prefix}/include
--extra-ldflags=-L#{Formula["libepoxy@20220315.1"].opt_prefix}/lib
--extra-cflags=-I#{Formula["virglrenderer@20220315.1"].opt_prefix}/include
--extra-ldflags=-L#{Formula["virglrenderer@20220315.1"].opt_prefix}/lib
--extra-cflags=-I#{Formula["spice-protocol"].opt_prefix}/include/spice-1
--extra-ldflags=-L#{Formula["spice-protocol"].opt_prefix}/lib
--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 = "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-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
Loading…
Cancel
Save