homebrew-core/Formula/mesa.rb
2019-12-12 20:10:16 -05:00

61 lines
2.1 KiB
Ruby

class Mesa < Formula
include Language::Python::Virtualenv
desc "Graphics Library"
homepage "https://www.mesa3d.org/"
url "https://mesa.freedesktop.org/archive/mesa-19.3.0.tar.xz"
mirror "https://www.mesa3d.org/archive/mesa-19.3.0.tar.xz"
sha256 "5fa0e4e9dca79560f6882e362f9db36d81cf96da16cf6a84e0ada7466a99a5d7"
head "https://gitlab.freedesktop.org/mesa/mesa.git"
bottle do
cellar :any
sha256 "70fd3161f9f6ca8eb5253cd01cba3e6f4f6ed8fa1caaa8e0483c7c75c99fcf7b" => :catalina
sha256 "5ac4ef3cc0407e66a6ae10706255aa7004cca77b060591e3ff0a052dbf3a2b3d" => :mojave
sha256 "332514241142ea923900011a41f85bbd31ec775c24dbf295724204a3b0b4c6b3" => :high_sierra
end
depends_on "meson-internal" => :build
depends_on "ninja" => :build
depends_on "pkg-config" => :build
depends_on "python" => :build
depends_on "freeglut" => :test
depends_on "expat"
depends_on "gettext"
resource "Mako" do
url "https://files.pythonhosted.org/packages/b0/3c/8dcd6883d009f7cae0f3157fb53e9afb05a0d3d33b3db1268ec2e6f4a56b/Mako-1.1.0.tar.gz"
sha256 "a36919599a9b7dc5d86a7a8988f23a9a3a3d083070023bab23d64f7f1d1e0a4b"
end
resource "gears.c" do
url "https://www.opengl.org/archives/resources/code/samples/glut_examples/mesademos/gears.c"
sha256 "7df9d8cda1af9d0a1f64cc028df7556705d98471fdf3d0830282d4dcfb7a78cc"
end
def install
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", "--prefix=#{prefix}", "-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