129 lines
4.0 KiB
Ruby
129 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.3.6.tar.xz"
|
|
sha256 "96bb761fd546e9aa41d025fcc025225c5668443839dae21e3731959beb096736"
|
|
license "MIT"
|
|
head "https://gitlab.freedesktop.org/mesa/mesa.git", branch: "main"
|
|
|
|
bottle do
|
|
sha256 arm64_monterey: "b9896161e14b443b182c7567af486efcbf7c8fe29ccb4814328f188cc4ad707f"
|
|
sha256 arm64_big_sur: "632481e11f5986db8f61f626b0d31c841edaae883df4c331d82a303ff2dff08c"
|
|
sha256 monterey: "22b341ac896fa08be156ccdd58a744e4c86deb5931648c5d855d876f17298402"
|
|
sha256 big_sur: "cf87cfe21f2bce354ef149458e3a5a861798a24296413aa49ca6fc7139882c49"
|
|
sha256 catalina: "64e828a3749dd133d9afc791421ea97c1b1361e9d6a985cd2a790cf880c4159d"
|
|
sha256 x86_64_linux: "a7528d2c25c73653b7a055ee217e163e276d2dc72896f5f83f46820ec3542028"
|
|
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/af/b6/42cd322ae555aa770d49e31b8c5c28a243ba1bbb57ad927e1a5f5b064811/Mako-1.1.6.tar.gz"
|
|
sha256 "4e9e345a41924a954251b95b4b28e14a301145b544901332e658907a7464b6b2"
|
|
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 << "-Dgallium-xvmc=disabled"
|
|
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
|