class Mesa < Formula include Language::Python::Virtualenv desc "Graphics Library" homepage "https://www.mesa3d.org/" url "https://mesa.freedesktop.org/archive/mesa-19.1.7.tar.xz" sha256 "e287920fdb38712a9fed448dc90b3ca95048c7face5db52e58361f8b6e0f3cd5" head "https://gitlab.freedesktop.org/mesa/mesa.git" bottle do sha256 "08e519e5540e340136e6773925f71ccb974eaf6576c6ea3619f90043cf3634b6" => :mojave sha256 "dc5a2b8caf4823e7163acf81845222f536ed61a65406837664ff0eb28e729baf" => :high_sierra sha256 "fe1cc29ff4476548ae2a3b2b1cbd6aea27686ceee80c6e74ff4b5dbcc04bc2e5" => :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" depends_on :x11 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}", "-D buildtype=plain", "-D b_ndebug=true", ".." system "ninja" system "ninja", "install" end end test do system ENV.cc, "#{pkgshare}/gears.c", "-o", "gears", "-L#{lib}", "-I#{Formula["freeglut"].opt_include}", "-L#{Formula["freeglut"].opt_lib}", "-lgl", "-lglut" end end