homebrew-core/Formula/mesa.rb
2019-12-04 22:21:26 -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.2.7.tar.xz"
mirror "https://www.mesa3d.org/archive/mesa-19.2.7.tar.xz"
sha256 "e3799fb7896fd9ed2f90f651fb907b95cdebfbd494968ff116e6bf1be143579e"
head "https://gitlab.freedesktop.org/mesa/mesa.git"
bottle do
cellar :any
sha256 "c1ddf0b32bcbdf75bc9df0dac0f092ed5d96e03503ca3adc70de00faaa2634d0" => :catalina
sha256 "38af51bc0b4fa44e64c5ad8b34dd03a9160f17dbd321c8e5be05402140e22c1d" => :mojave
sha256 "d3ca91d3fac36365065c6b0d73ff2306b1bf4ab04151363d35cf41f5ac65c715" => :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