homebrew-core/Formula/mesa.rb

85 lines
2.6 KiB
Ruby

class Mesa < Formula
include Language::Python::Virtualenv
desc "Graphics Library"
homepage "https://www.mesa3d.org/"
url "https://mesa.freedesktop.org/archive/mesa-20.3.3.tar.xz"
sha256 "f74e212d4838e982a10c203ffa998817d1855c5cf448ae87b58f96edea61d156"
license "MIT"
revision 1
head "https://gitlab.freedesktop.org/mesa/mesa.git"
livecheck do
url :stable
end
bottle do
sha256 "de19172509d1d200b275abc87f3e4239bcd786ca9629c47d9dde8f37e825d2aa" => :big_sur
sha256 "b00018a0517349b91003f295ec96874621a0a4056c8138c49e0cf2c8d267e54c" => :arm64_big_sur
sha256 "fa1446210f1f08b95d113ab2fea439c448d7746f11095a396e0b87d36f45c2c3" => :catalina
sha256 "6831faac87491e5321db31744457dc19a47985017605c9c01471a217d6b0b189" => :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/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