homebrew-core/Formula/mesa.rb

70 lines
2.0 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.2.1.tar.xz"
sha256 "d1a46d9a3f291bc0e0374600bdcb59844fa3eafaa50398e472a36fc65fd0244a"
license "MIT"
revision 1
head "https://gitlab.freedesktop.org/mesa/mesa.git"
livecheck do
url :stable
end
bottle do
cellar :any
sha256 "748342d8a327d3020bf6f8c1f4802cc9854aabed9ae09be569945ec805a4e217" => :catalina
sha256 "52d122a994018dc02d1a351c59a32a9428efc81ce4342d5eee6fed7f21636a60" => :mojave
sha256 "22240d614adfa767e18dadd3c3f407762d4e82134ea7b7e1c9980b8f2a112c05" => :high_sierra
end
depends_on "meson" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "python@3.9" => :build
depends_on "freeglut" => :test
depends_on "expat"
depends_on "gettext"
resource "Mako" do
url "https://files.pythonhosted.org/packages/72/89/402d2b4589e120ca76a6aed8fee906a0f5ae204b50e455edd36eda6e778d/Mako-1.1.3.tar.gz"
sha256 "8195c8c1400ceb53496064314c6736719c6f25e7479cd24c77be3d9361cddc27"
end
resource "gears.c" do
url "https://www.opengl.org/archives/resources/code/samples/glut_examples/mesademos/gears.c"
sha256 "7df9d8cda1af9d0a1f64cc028df7556705d98471fdf3d0830282d4dcfb7a78cc"
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"
resource("gears.c").stage(pkgshare.to_s)
mkdir "build" do
system "meson", *std_meson_args, "..", "-Db_ndebug=true",
"-Dplatforms=surfaceless", "-Dglx=disabled"
system "ninja"
system "ninja", "install"
end
end
test do
flags = %W[
-framework OpenGL
-I#{Formula["freeglut"].opt_include}
-L#{Formula["freeglut"].opt_lib}
-lglut
]
system ENV.cc, "#{pkgshare}/gears.c", "-o", "gears", *flags
end
end