homebrew-core/Formula/mesa.rb

62 lines
2.0 KiB
Ruby

class Mesa < Formula
desc "Graphics Library"
homepage "https://www.mesa3d.org/"
url "https://archive.mesa3d.org/mesa-20.1.2.tar.xz"
sha256 "283dff72814c8a80ce1ff8271e3f055895d26f4da3f4362acc49193e635780cb"
head "https://gitlab.freedesktop.org/mesa/mesa.git"
bottle do
cellar :any
sha256 "3554b5932a65665c08e70397db4cb74c35abf8d0f4b9a6cf275f06e423bfc0aa" => :catalina
sha256 "cf1ff78957fe913c00b57fdda192d828682d33cbae7d11fd6cd7f41e46968141" => :mojave
sha256 "20bb00c5495936cb49ef2c5c17a70465fadd7d7a2ca5237a6c9085e8a5d9542f" => :high_sierra
end
depends_on "meson-internal" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "python@3.8" => :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
python3 = Formula["python@3.8"].opt_bin/"python3"
xy = Language::Python.major_minor_version python3
ENV.prepend_create_path "PYTHONPATH", buildpath/"vendor/lib/python#{xy}/site-packages"
resource("Mako").stage do
system python3, *Language::Python.setup_install_args(buildpath/"vendor")
end
resource("gears.c").stage(pkgshare.to_s)
mkdir "build" do
system "meson", *std_meson_args, "..", "-Dbuildtype=plain", "-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