Skip to content

Commit

Permalink
mesa and libva: use libva v1.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-belkin committed Jun 17, 2018
1 parent fb18a8b commit 5c48389
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 58 deletions.
22 changes: 9 additions & 13 deletions Formula/libva.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
class Libva < Formula
desc "Hardware accelerated video processing library"
homepage "https://freedesktop.org/wiki/Software/vaapi/"
url "https://www.freedesktop.org/software/vaapi/releases/libva/libva-1.7.3.tar.bz2"
sha256 "22bc139498065a7950d966dbdb000cad04905cbd3dc8f3541f80d36c4670b9d9"

bottle do
sha256 "202cad95248823257d1d9cedefb76fc95593ef3dd61d93721a14f000f75bd0db" => :x86_64_linux
end
url "https://www.freedesktop.org/software/vaapi/releases/libva/libva-1.8.2.tar.bz2"
sha256 "9ed3e3ddc8f47a715d4c6ec366beb21c83fc4e8a3d4d39a811baff76f0a0cede"

option "with-static", "Build static libraries (not recommended)"

Expand All @@ -19,20 +15,20 @@ class Libva < Formula

option "with-eglx", "Build libva with egl and glx support (use after building mesa)"

# Build-time
depends_on "pkg-config" => :build
depends_on "autoconf" => :build

depends_on "pkg-config" => :build
depends_on "libtool" => :build if build.without?("wayland")
depends_on "linuxbrew/xorg/libdrm"
depends_on "linuxbrew/xorg/libx11"
depends_on "linuxbrew/xorg/libxext"
depends_on "linuxbrew/xorg/libxfixes"
depends_on "linuxbrew/xorg/wayland" => :recommended

depends_on "libtool" => :build if build.without?("wayland")

def install
args = %W[
--prefix=#{prefix}
--sysconfdir=#{etc}
--localstatedir=#{var}
--sysconfdir=#{prefix}/etc
--localstatedir=#{prefix}/var
--disable-dependency-tracking
--disable-silent-rules
--enable-static=#{build.with?("static") ? "yes" : "no"}
Expand Down
108 changes: 63 additions & 45 deletions Formula/mesa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,53 +13,62 @@ class Mesa < Formula

option "without-test", "Skip compile-time tests"
option "with-static", "Build static libraries (not recommended)"
option "with-llvm", "Build drivers that require llvm and libelf"

depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "pkg-config" => :build
depends_on "python" => :build
depends_on "python@2" => :build
depends_on "flex" => :build
depends_on "bison" => :build
depends_on "libtool" => :build
depends_on "linuxbrew/xorg/libpthread-stubs" => :build

depends_on "llvm" => :optional
depends_on "linuxbrew/xorg/wayland" => :optional
depends_on "linuxbrew/xorg/libglvnd" => :optional
depends_on "linuxbrew/xorg/libvdpau" => :optional

depends_on "linuxbrew/xorg/libva" => [:recommended, :build]
depends_on "valgrind" => :recommended

depends_on "linuxbrew/xorg/damageproto"
depends_on "linuxbrew/xorg/dri2proto"
depends_on "linuxbrew/xorg/glproto"
depends_on "linuxbrew/xorg/kbproto"
depends_on "linuxbrew/xorg/xextproto"
depends_on "linuxbrew/xorg/xf86vidmodeproto"
depends_on "linuxbrew/xorg/fixesproto"
depends_on "linuxbrew/xorg/videoproto"
depends_on "linuxbrew/xorg/damageproto" => :build
depends_on "linuxbrew/xorg/dri2proto" => :build
depends_on "linuxbrew/xorg/glproto" => :build
depends_on "linuxbrew/xorg/kbproto" => :build
depends_on "linuxbrew/xorg/xextproto" => :build
depends_on "linuxbrew/xorg/xf86vidmodeproto" => :build
depends_on "linuxbrew/xorg/fixesproto" => :build
depends_on "linuxbrew/xorg/videoproto" => :build

depends_on "linuxbrew/xorg/libdrm"
depends_on "systemd" # provides libudev <= needed by "gbm"
depends_on "linuxbrew/xorg/libsha1"
depends_on "llvm@4" # failed with llvm@6
depends_on "libelf" # radeonsi requires libelf when using llvm
depends_on "linuxbrew/xorg/libomxil-bellagio"
depends_on "linuxbrew/xorg/wayland-protocols" => :recommended
depends_on "valgrind" => :recommended
depends_on "linuxbrew/xorg/libglvnd" => :optional
depends_on "linuxbrew/xorg/libva" => :recommended
depends_on "linuxbrew/xorg/libvdpau"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "linuxbrew/xorg/libpthread-stubs" => :build
depends_on "linuxbrew/xorg/xorg"
depends_on "linuxbrew/xorg/libdrm"
depends_on "linuxbrew/xorg/libxdamage"
depends_on "linuxbrew/xorg/libxshmfence"
depends_on "linuxbrew/xorg/libxv"
depends_on "linuxbrew/xorg/libxvmc"

depends_on "libelf" if build.with? "llvm" # radeonsi requires libelf when using llvm
# Revisit later [@maxim-belkin, March 6, 2018]: depends_on "linuxbrew/xorg/wayland-protocols" => :recommended

#
# There is a circular dependency between Mesa and libva:
# libva should be installed:
# 1. before Mesa with "disable-egl" and "disable-egl" options [libva formula]
# 2. after Mesa without the above two options [this formula]
#

resource "mako" do
url "https://files.pythonhosted.org/packages/56/4b/cb75836863a6382199aefb3d3809937e21fa4cb0db15a4f4ba0ecc2e7e8e/Mako-1.0.6.tar.gz"
sha256 "48559ebd872a8e77f92005884b3d88ffae552812cdf17db6768e5c3be5ebbe0d"
end

resource "libva" do
url "https://www.freedesktop.org/software/vaapi/releases/libva/libva-1.7.3.tar.bz2"
sha256 "22bc139498065a7950d966dbdb000cad04905cbd3dc8f3541f80d36c4670b9d9"
url "https://www.freedesktop.org/software/vaapi/releases/libva/libva-1.8.2.tar.bz2"
sha256 "9ed3e3ddc8f47a715d4c6ec366beb21c83fc4e8a3d4d39a811baff76f0a0cede"
end

patch :p1 do
Expand All @@ -74,7 +83,7 @@ def install
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"

resource("mako").stage do
system "python", *Language::Python.setup_install_args(libexec/"vendor")
system "python2", *Language::Python.setup_install_args(libexec/"vendor")
end

args = %W[
Expand All @@ -83,34 +92,45 @@ def install
--disable-silent-rules
--disable-dependency-tracking
--prefix=#{prefix}
--sysconfdir=#{etc}
--localstatedir=#{var}
--sysconfdir=#{prefix}/etc
--localstatedir=#{prefix}/var
--disable-pwr8
--enable-texture-float
--enable-gles1
--enable-gles2
--disable-llvm-shared-libs
--enable-dri3
--enable-glx
--enable-osmesa
--enable-xa
--enable-gbm
--with-egl-platforms=drm,x11,surfaceless#{build.with?("wayland") ? ",wayland" : ""}
--with-gallium-drivers=i915,nouveau,r300,r600,radeonsi,svga,swrast,swr
--enable-glx-tls
--enable-dri
--enable-dri3
--enable-gallium-tests
--enable-glx
--enable-opengl
--enable-shared-glapi
--enable-va
--enable-vdpau
--enable-nine
--enable-xvmc
--disable-llvm-shared-libs
--with-dri-drivers=i965,nouveau,radeon,r200,swrast
--with-sha1=libsha1
--enable-llvm
--enable-sysfs
--with-llvm-prefix=#{Formula["llvm@4"].opt_prefix}
--enable-va
--enable-gallium-tests
--enable-glx-tls
--with-platforms=drm,x11,surfaceless#{build.with?("wayland") ? ",wayland" : ""}
--with-dri-drivers=i915,i965,nouveau,radeon,r200,swrast
--with-vulkan-drivers=intel
--with-swr-archs=avx,avx2,knl,skx
]

if build.with? "llvm"
args << %w[
--enable-llvm
--with-gallium-drivers=i915,nouveau,r300,r600,radeonsi,svga,swrast,swr
]
# Gallium Drivers: i915,nouveau,r300,r600,radeonsi,freedreno,pl111,svga,swrast,swr,vc4,virgl,etnaviv,imx
else
args << "--with-gallium-drivers=i915,nouveau,r600,svga,swrast"
end

args << "--enable-vdpau" if build.with? "vdpau"

# enable-opencl => needs libclc
# enable-gallium-osmesa => mutually exclusive with enable-osmesa

Expand All @@ -126,19 +146,17 @@ def install
system "make", "install"
system "make", "-C", "xdemos", "DEMOS_PREFIX=#{prefix}", "install"

if build.with?("libva")
if build.with? "libva"
resource("libva").stage do
args = %W[
--prefix=#{Formula["libva"].opt_prefix}
--sysconfdir=#{etc}
--localstatedir=#{var}
--sysconfdir=#{Formula["libva"].opt_prefix}/etc
--localstatedir=#{Formula["libva"].opt_prefix}/var
--disable-dependency-tracking
--disable-silent-rules
--enable-static=#{build.with?("static") ? "yes" : "no"}
]

# Be explicit about the configure flags
args << "--enable-static=#{build.with?("static") ? "yes" : "no"}"

### Set environment flags:
# $ pkg-config --cflags egl | tr ' ' '\n'
# $ pkg-config --cflags gl | tr ' ' '\n'
Expand All @@ -165,7 +183,7 @@ def install
ENV["EGL_LIBS"] = "-L#{lib} -lEGL"
ENV["GLX_LIBS"] = "-L#{lib} -lGL"

system "autoreconf", "-fi" if build.without?("wayland") # needed only if Wayland is not installed
system "autoreconf", "-fi" if build.without? "wayland" # needed only if Wayland is not installed
system "./configure", *args
system "make"
system "make", "install"
Expand Down

0 comments on commit 5c48389

Please sign in to comment.