134 lines
4.0 KiB
Ruby
134 lines
4.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-21.2.1.tar.xz"
|
|
sha256 "2c65e6710b419b67456a48beefd0be827b32db416772e0e363d5f7d54dc01787"
|
|
license "MIT"
|
|
revision 1
|
|
head "https://gitlab.freedesktop.org/mesa/mesa.git", branch: "main"
|
|
|
|
livecheck do
|
|
url "https://mesa.freedesktop.org/archive/"
|
|
regex(/href=.*?mesa[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_big_sur: "e04319312192941e0958a7622eb0ca68fb9cb51d5122affdba32359c7c3a8930"
|
|
sha256 big_sur: "322ba38e53336aab63838e86882b478be2fde40204f542215ccaad2a4c654cff"
|
|
sha256 catalina: "257bea3d2ee0d5db58f02a454b5fcc6d81ee843d92c3a7964a0aa33e3f8b5775"
|
|
sha256 mojave: "3c1bc6f6612fbdcbc80b54ed067a0c40dd54cc51ba24d65325b6ef457dd26060"
|
|
sha256 x86_64_linux: "41d0c71f5c264e4a9d952ec32192c1ba380267acb16eed512bc2bae974b436cf"
|
|
end
|
|
|
|
depends_on "meson" => :build
|
|
depends_on "ninja" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "python@3.9" => :build
|
|
depends_on "expat"
|
|
depends_on "gettext"
|
|
depends_on "libx11"
|
|
depends_on "libxcb"
|
|
depends_on "libxdamage"
|
|
depends_on "libxext"
|
|
|
|
uses_from_macos "bison" => :build
|
|
uses_from_macos "flex" => :build
|
|
uses_from_macos "llvm"
|
|
uses_from_macos "ncurses"
|
|
uses_from_macos "zlib"
|
|
|
|
on_linux do
|
|
depends_on "elfutils"
|
|
depends_on "gcc"
|
|
depends_on "libdrm"
|
|
depends_on "libva"
|
|
depends_on "libvdpau"
|
|
depends_on "libxfixes"
|
|
depends_on "libxrandr"
|
|
depends_on "libxshmfence"
|
|
depends_on "libxv"
|
|
depends_on "libxvmc"
|
|
depends_on "libxxf86vm"
|
|
depends_on "lm-sensors"
|
|
depends_on "wayland"
|
|
depends_on "wayland-protocols"
|
|
end
|
|
|
|
fails_with gcc: "5"
|
|
|
|
resource "Mako" do
|
|
url "https://files.pythonhosted.org/packages/5c/db/2d2d88b924aa4674a080aae83b59ea19d593250bfe5ed789947c21736785/Mako-1.1.4.tar.gz"
|
|
sha256 "17831f0b7087c313c0ffae2bcbbd3c1d5ba9eeac9c38f2eb7b50e8c99fe9d5ab"
|
|
end
|
|
|
|
resource "glxgears.c" do
|
|
url "https://gitlab.freedesktop.org/mesa/demos/-/raw/faaa319d704ac677c3a93caadedeb91a4a74b7a7/src/xdemos/glxgears.c"
|
|
sha256 "3873db84d708b5d8b3cac39270926ba46d812c2f6362da8e6cd0a1bff6628ae6"
|
|
end
|
|
|
|
resource "gl_wrap.h" do
|
|
url "https://gitlab.freedesktop.org/mesa/demos/-/raw/faaa319d704ac677c3a93caadedeb91a4a74b7a7/src/util/gl_wrap.h"
|
|
sha256 "c727b2341d81c2a1b8a0b31e46d24f9702a1ec55c8be3f455ddc8d72120ada72"
|
|
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"
|
|
|
|
mkdir "build" do
|
|
args = ["-Db_ndebug=true"]
|
|
|
|
if OS.linux?
|
|
args << "-Dplatforms=x11,wayland"
|
|
args << "-Dglx=auto"
|
|
args << "-Ddri3=true"
|
|
args << "-Ddri-drivers=auto"
|
|
args << "-Dgallium-drivers=auto"
|
|
args << "-Dgallium-omx=disabled"
|
|
args << "-Degl=true"
|
|
args << "-Dgbm=true"
|
|
args << "-Dopengl=true"
|
|
args << "-Dgles1=true"
|
|
args << "-Dgles2=true"
|
|
args << "-Dxvmc=true"
|
|
args << "-Dvalgrind=false"
|
|
args << "-Dtools=drm-shim,etnaviv,freedreno,glsl,nir,nouveau,xvmc,lima"
|
|
end
|
|
|
|
system "meson", *std_meson_args, "..", *args
|
|
system "ninja"
|
|
system "ninja", "install"
|
|
end
|
|
|
|
if OS.linux?
|
|
# Strip executables/libraries/object files to reduce their size
|
|
system("strip", "--strip-unneeded", "--preserve-dates", *(Dir[bin/"**/*", lib/"**/*"]).select do |f|
|
|
f = Pathname.new(f)
|
|
f.file? && (f.elf? || f.extname == ".a")
|
|
end)
|
|
end
|
|
end
|
|
|
|
test do
|
|
%w[glxgears.c gl_wrap.h].each { |r| resource(r).stage(testpath) }
|
|
flags = %W[
|
|
-I#{include}
|
|
-L#{lib}
|
|
-L#{Formula["libx11"].lib}
|
|
-L#{Formula["libxext"].lib}
|
|
-lGL
|
|
-lX11
|
|
-lXext
|
|
-lm
|
|
]
|
|
system ENV.cc, "glxgears.c", "-o", "gears", *flags
|
|
end
|
|
end
|