143 lines
4.5 KiB
Ruby
143 lines
4.5 KiB
Ruby
class Mesa < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Graphics Library"
|
|
homepage "https://www.mesa3d.org/"
|
|
url "https://mesa.freedesktop.org/archive/mesa-22.0.5.tar.xz"
|
|
sha256 "5ee2dc06eff19e19b2867f12eb0db0905c9691c07974f6253f2f1443df4c7a35"
|
|
license "MIT"
|
|
revision 1
|
|
head "https://gitlab.freedesktop.org/mesa/mesa.git", branch: "main"
|
|
|
|
bottle do
|
|
sha256 arm64_monterey: "b25ea498bb2762d8ddd64e647c47039c5a83ce2d3d6347cc5c91d370d86fbf83"
|
|
sha256 arm64_big_sur: "1576db8e33b89a7e647c9f5edbdc14207a647f985242924b4853d69d83ff27a8"
|
|
sha256 monterey: "f45bca55e3394c71ad1a7bd5fa538f6c1552b1a0475d6ac334d40be00ba1abcd"
|
|
sha256 big_sur: "9a312c0b271faae42c2c9781fdf88ebd0fed6f2d8b5261ad406df6e367ba2f0e"
|
|
sha256 catalina: "33f50bb6bceaaaa211e3dd8704223b4ca077ed7c8591cc2eea929e799f011c6a"
|
|
sha256 x86_64_linux: "29bc459a87ec012f4bb04407a0c8510baee075c718d6b35825c3164d8e1087fb"
|
|
end
|
|
|
|
depends_on "bison" => :build # can't use form macOS, needs '> 2.3'
|
|
depends_on "meson" => :build
|
|
depends_on "ninja" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "python@3.10" => :build
|
|
depends_on "expat"
|
|
depends_on "gettext"
|
|
depends_on "libx11"
|
|
depends_on "libxcb"
|
|
depends_on "libxdamage"
|
|
depends_on "libxext"
|
|
|
|
uses_from_macos "flex" => :build
|
|
uses_from_macos "llvm"
|
|
uses_from_macos "ncurses"
|
|
uses_from_macos "zlib"
|
|
|
|
on_linux do
|
|
depends_on "elfutils"
|
|
depends_on "gcc"
|
|
depends_on "gzip"
|
|
depends_on "libdrm"
|
|
depends_on "libva"
|
|
depends_on "libvdpau"
|
|
depends_on "libxfixes"
|
|
depends_on "libxrandr"
|
|
depends_on "libxshmfence"
|
|
depends_on "libxv"
|
|
depends_on "libxvmc"
|
|
depends_on "libxxf86vm"
|
|
depends_on "lm-sensors"
|
|
depends_on "wayland"
|
|
depends_on "wayland-protocols"
|
|
end
|
|
|
|
fails_with gcc: "5"
|
|
|
|
resource "Mako" do
|
|
url "https://files.pythonhosted.org/packages/50/ec/1d687348f0954bda388bfd1330c158ba8d7dea4044fc160e74e080babdb9/Mako-1.2.0.tar.gz"
|
|
sha256 "9a7c7e922b87db3686210cf49d5d767033a41d4010b284e747682c92bddd8b39"
|
|
end
|
|
|
|
resource "Pygments" do
|
|
url "https://files.pythonhosted.org/packages/59/0f/eb10576eb73b5857bc22610cdfc59e424ced4004fe7132c8f2af2cc168d3/Pygments-2.12.0.tar.gz"
|
|
sha256 "5eb116118f9612ff1ee89ac96437bb6b49e8f04d8a13b514ba26f620208e26eb"
|
|
end
|
|
|
|
resource "MarkupSafe" do
|
|
url "https://files.pythonhosted.org/packages/1d/97/2288fe498044284f39ab8950703e88abbac2abbdf65524d576157af70556/MarkupSafe-2.1.1.tar.gz"
|
|
sha256 "7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b"
|
|
end
|
|
|
|
resource "glxgears.c" do
|
|
url "https://gitlab.freedesktop.org/mesa/demos/-/raw/db5ad06a346774a249b22797e660d55bde0d9571/src/xdemos/glxgears.c"
|
|
sha256 "3873db84d708b5d8b3cac39270926ba46d812c2f6362da8e6cd0a1bff6628ae6"
|
|
end
|
|
|
|
resource "gl_wrap.h" do
|
|
url "https://gitlab.freedesktop.org/mesa/demos/-/raw/ea99b861a256e63d029f0d476bf452681d821dd6/src/util/gl_wrap.h"
|
|
sha256 "41f5a84f8f5abe8ea2a21caebf5ff31094a46953a83a738a19e21c010c433c88"
|
|
end
|
|
|
|
def install
|
|
ENV.prepend_path "PATH", Formula["python@3.10"].opt_libexec/"bin"
|
|
|
|
venv_root = buildpath/"venv"
|
|
venv = virtualenv_create(venv_root, "python3")
|
|
|
|
%w[Mako Pygments MarkupSafe].each do |res|
|
|
venv.pip_install resource(res)
|
|
end
|
|
|
|
ENV.prepend_path "PATH", "#{venv_root}/bin"
|
|
|
|
args = ["-Db_ndebug=true"]
|
|
|
|
if OS.linux?
|
|
args += %w[
|
|
-Dplatforms=x11,wayland
|
|
-Dglx=auto
|
|
-Ddri3=true
|
|
-Dgallium-drivers=auto
|
|
-Dgallium-omx=disabled
|
|
-Degl=true
|
|
-Dgbm=true
|
|
-Dopengl=true
|
|
-Dgles1=enabled
|
|
-Dgles2=enabled
|
|
-Dgallium-xvmc=disabled
|
|
-Dvalgrind=false
|
|
-Dtools=drm-shim,etnaviv,freedreno,glsl,nir,nouveau,xvmc,lima
|
|
]
|
|
end
|
|
|
|
system "meson", "build", *args, *std_meson_args
|
|
system "meson", "compile", "-C", "build"
|
|
system "meson", "install", "-C", "build"
|
|
|
|
if OS.linux?
|
|
# Strip executables/libraries/object files to reduce their size
|
|
system("strip", "--strip-unneeded", "--preserve-dates", *(Dir[bin/"**/*", lib/"**/*"]).select do |f|
|
|
f = Pathname.new(f)
|
|
f.file? && (f.elf? || f.extname == ".a")
|
|
end)
|
|
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
|