homebrew-core/Formula/mesa.rb

85 lines
2.7 KiB
Ruby

class Mesa < Formula
include Language::Python::Virtualenv
desc "Graphics Library"
homepage "https://www.mesa3d.org/"
url "https://archive.mesa3d.org/mesa-20.3.4.tar.xz"
sha256 "dc21a987ec1ff45b278fe4b1419b1719f1968debbb80221480e44180849b4084"
license "MIT"
head "https://gitlab.freedesktop.org/mesa/mesa.git"
livecheck do
url "https://archive.mesa3d.org/"
regex(/href=.*?mesa[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_big_sur: "a3e65d929df4b5bcb70c71abb33140e6fbcc8192876042a443ae71ba134d9b03"
sha256 big_sur: "32e6edaa53e047150bf4c64ecb9f755d0121a18dbb1c07b44ac47ca878d913f1"
sha256 catalina: "4e4cdf122c32ff4dda73d4dc70d985827b5bc64361bf5f58c30f77a8a25171c9"
sha256 mojave: "91334cb28cd9396b09c54f705ff3fda339e43eb9b9ea283ce7cd55029a84e044"
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/5c/db/2d2d88b924aa4674a080aae83b59ea19d593250bfe5ed789947c21736785/Mako-1.1.4.tar.gz"
sha256 "17831f0b7087c313c0ffae2bcbbd3c1d5ba9eeac9c38f2eb7b50e8c99fe9d5ab"
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
patch do
url "https://gitlab.freedesktop.org/mesa/mesa/-/commit/50064ad367449afad03c927f7e572c138b05c5d4.patch"
sha256 "aa3fa361a8626d442aefdac922a7193612b77cab2410452acee40b6dbc10a800"
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