class Libvirt < Formula desc "C virtualization API" homepage "https://www.libvirt.org" url "https://libvirt.org/sources/libvirt-7.1.0.tar.xz" sha256 "870f180d80256411c5afc39bc5aac4f8acca04a4e0725c576ad24053dc64a06c" license all_of: ["LGPL-2.1-or-later", "GPL-2.0-or-later"] livecheck do url "https://libvirt.org/sources/" regex(/href=.*?libvirt[._-]v?(\d+(?:\.\d+)+)\.t/i) end bottle do sha256 arm64_big_sur: "9528f4136350704a84bab9d44cef72175e5bfca5f71cb937e10e45633400b5b3" sha256 big_sur: "be8c1b4db224029267adc74e8b16e5155a556767a5825558af2fc5116fea6e79" sha256 catalina: "d46f9827e96c9224fa9a98a0b1d9b82fc4c4865f553e44281823289b8ab6d616" sha256 mojave: "8490636bc061351ae411c1b767065dda777c9ea75049f86a894689304a815ac3" end head do url "https://github.com/libvirt/libvirt.git" end depends_on "docutils" => :build depends_on "meson" => :build depends_on "ninja" => :build depends_on "perl" => :build depends_on "pkg-config" => :build depends_on "python@3.9" => :build depends_on "rpcgen" => :build depends_on "gettext" depends_on "glib" depends_on "gnutls" depends_on "libgcrypt" depends_on "libiscsi" depends_on "libssh2" depends_on "yajl" def install mkdir "build" do args = %W[ --localstatedir=#{var} --mandir=#{man} --sysconfdir=#{etc} -Ddriver_esx=enabled -Ddriver_qemu=enabled -Dinit_script=none ] system "meson", *std_meson_args, *args, ".." system "meson", "compile" system "meson", "install" end end plist_options manual: "libvirtd" def plist <<~EOS EnvironmentVariables PATH #{HOMEBREW_PREFIX}/bin Label #{plist_name} ProgramArguments #{sbin}/libvirtd -f #{etc}/libvirt/libvirtd.conf KeepAlive RunAtLoad EOS end test do if build.head? output = shell_output("#{bin}/virsh -V") assert_match "Compiled with support for:", output else output = shell_output("#{bin}/virsh -v") assert_match version.to_s, output end end end