class Mesa < Formula include Language::Python::Virtualenv desc "Graphics Library" homepage "https://www.mesa3d.org/" url "https://mesa.freedesktop.org/archive/mesa-20.3.0.tar.xz" sha256 "2999738e888731531cd62b27519fa37566cc0ea2cd7d4d97f46abaa3e949c630" license "MIT" head "https://gitlab.freedesktop.org/mesa/mesa.git" livecheck do url :stable end bottle do sha256 "17102cdc4cb95cfbfdc154a5d0412863c22688caa4978cb1c75c02c1be66d0cc" => :big_sur sha256 "083ebe4e77c62675367764e71cb372eda5d03c09960acd3a56b7dbc1fd5ec5d6" => :catalina sha256 "e32052ed6993ee7fd970122ca2c97b9379e616fe4e74cd9987737f30811ebe3b" => :mojave end depends_on "meson" => :build depends_on "ninja" => :build depends_on "pkg-config" => :build depends_on "python@3.9" => :build depends_on "expat" depends_on "gettext" depends_on "libx11" depends_on "libxcb" depends_on "libxdamage" depends_on "libxext" resource "Mako" do url "https://files.pythonhosted.org/packages/72/89/402d2b4589e120ca76a6aed8fee906a0f5ae204b50e455edd36eda6e778d/Mako-1.1.3.tar.gz" sha256 "8195c8c1400ceb53496064314c6736719c6f25e7479cd24c77be3d9361cddc27" end resource "glxgears.c" do url "https://gitlab.freedesktop.org/mesa/demos/-/raw/faaa319d704ac677c3a93caadedeb91a4a74b7a7/src/xdemos/glxgears.c" sha256 "3873db84d708b5d8b3cac39270926ba46d812c2f6362da8e6cd0a1bff6628ae6" end resource "gl_wrap.h" do url "https://gitlab.freedesktop.org/mesa/demos/-/raw/faaa319d704ac677c3a93caadedeb91a4a74b7a7/src/util/gl_wrap.h" sha256 "c727b2341d81c2a1b8a0b31e46d24f9702a1ec55c8be3f455ddc8d72120ada72" end def install ENV.prepend_path "PATH", Formula["python@3.9"].opt_libexec/"bin" venv_root = libexec/"venv" venv = virtualenv_create(venv_root, "python3") venv.pip_install resource("Mako") ENV.prepend_path "PATH", "#{venv_root}/bin" mkdir "build" do system "meson", *std_meson_args, "..", "-Db_ndebug=true" system "ninja" system "ninja", "install" end end test do %w[glxgears.c gl_wrap.h].each { |r| resource(r).stage(testpath) } flags = %W[ -I#{include} -L#{lib} -L#{Formula["libx11"].lib} -L#{Formula["libxext"].lib} -lGL -lX11 -lXext -lm ] system ENV.cc, "glxgears.c", "-o", "gears", *flags end end