summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Ulyanov <disinbox@gmail.com>2015-07-04 18:26:34 +0300
committerIgor Ulyanov <disinbox@gmail.com>2015-07-04 18:26:34 +0300
commitbc672cd4b93baa26965687befc6f1b5151611051 (patch)
tree2323fb9d045aa4801524db7c7ef4b89faabc030f /media-libs
parentmanifest change (diff)
downloaddisplacer-bc672cd4b93baa26965687befc6f1b5151611051.tar.gz
displacer-bc672cd4b93baa26965687befc6f1b5151611051.tar.bz2
displacer-bc672cd4b93baa26965687befc6f1b5151611051.zip
amdgpu mesa
Diffstat (limited to 'media-libs')
-rw-r--r--media-libs/mesa/Manifest8
-rw-r--r--media-libs/mesa/files/0001-gallivm-Do-not-use-NoFramePointerElim-with-LLVM-3.7.patch49
-rw-r--r--media-libs/mesa/files/0002-gallivm-Workaround-LLVM-PR23628.patch48
-rw-r--r--media-libs/mesa/files/eselect-mesa.conf.9.239
-rw-r--r--media-libs/mesa/files/glx_ro_text_segm.patch28
-rw-r--r--media-libs/mesa/files/mesa-9.2-dont-require-llvm-for-r300.patch12
-rw-r--r--media-libs/mesa/files/mesa-9999-dont-require-llvm-for-r300.patch11
-rw-r--r--media-libs/mesa/mesa-9999.ebuild463
-rw-r--r--media-libs/mesa/metadata.xml27
9 files changed, 685 insertions, 0 deletions
diff --git a/media-libs/mesa/Manifest b/media-libs/mesa/Manifest
new file mode 100644
index 0000000..9703d13
--- /dev/null
+++ b/media-libs/mesa/Manifest
@@ -0,0 +1,8 @@
+AUX 0001-gallivm-Do-not-use-NoFramePointerElim-with-LLVM-3.7.patch 1859 SHA256 162aa15ab8a89ae81349196c5a35b41029d6a933e060da90ffd97532ce3737b1 SHA512 e734985c022b0e7e6511a05b7c37b56291c2699b3b122c3c7352f6c861f4adfffe2033aa5734c7ea481d2c57cdbc99989ab06d782bee690725d9543ec7da516c WHIRLPOOL 16943dabdd39093e0909d440250ad59905ca9dbd90f55b58a2d16bc5f815ff633b21ae330da7258dc6d10ff0981c23b65148eaedf107fb6423a6429af7df7fad
+AUX 0002-gallivm-Workaround-LLVM-PR23628.patch 1324 SHA256 03f77da54b11288afb75ee05b237f2af243acfbec5952ea92ff360471dcd1d06 SHA512 d894f073b5de5be9c69082138ecd9da8bd840335e40b3c51040918380d92d0dd2faa2e9e7ab0bac076fb68a979225c50f02d94a7f146561df5efc6a61cea4b07 WHIRLPOOL ae9c6b282d05e301044b54922373ab40afd53d2c78ad14bdab8578eda152d28e640e20e8145a49ee88d2ba5b06743a228988630f217ff5d0d2929be14d8d1241
+AUX eselect-mesa.conf.9.2 1676 SHA256 bcf5f77140b4695f147d4cd3c2db4b954fb57eccfd4475c7f7c4866edda8436e SHA512 d0061359638c0d9729ba1035fd7740c84d59f538adc11af2ee671b5ddbc83c420159efbefcc39ea680f06d20507f1e1d76b528712a07baeca901a413ba7b55df WHIRLPOOL 0fc650223a1910305bb2c4b7b946ac8b83b5b1ba0b79b586a96303a369b30c9c03dc658a6e8e9a29c5c4605f3865e245be0a0e6a27c40ac37402e8a2616b3ace
+AUX glx_ro_text_segm.patch 731 SHA256 e36af5b530fdbe2b0e62a035bf4bf4baef267c3dc56133d1a58e56899ebffc5c SHA512 90d04d1268cc90e1c5596b49b143895eba99d4e7f7d9bb5f699725c1308e3995edac44e3f61536c7ce70ebf5df84a5a22c18fa84fb54fbddb339f908975bb43c WHIRLPOOL 42171ef67930bebdcfdfcb0c9370234791c6125be760b6419abfff44bd65899982167d6da4d6eb4198383438e6376b4b695109af158083b903071c545160d883
+AUX mesa-9.2-dont-require-llvm-for-r300.patch 524 SHA256 7e57cb037a57c8c4ef49be93d6f53bd9f002d918bf91c77158da4a4980fbbd66 SHA512 c5b4b40636a4bab64338a0be730f10ec546ff1da31fdde83c628485a5569cc021042fdb17e2ddbc39b86ab6e72e805ed28af9a98ebed320d23084e2575d6437b WHIRLPOOL 7c896f1be7353c964247fd60f517bb100779a02f08166ca509d4b2924c3cd45aba4cc5d45f0eeb171c4ef5d105e5a93316bd24af1342510ba8bde385ea709854
+AUX mesa-9999-dont-require-llvm-for-r300.patch 547 SHA256 83cfeae33b1e8c84b37ed59c353000eb775978ae3d9035ba8ce4f63a167756fc SHA512 d1cb5a989aa001c99f353d27ab5b28ac05d60050614bbfd76ca5d312e00efcc2b1a2459d30d697b68119310c69512b4195afce6c0ed7f31fb9cf14689a740e27 WHIRLPOOL c06669942d275a9d9f132ec8f51d3ecf23d33cb89cb607ba3a7861f209f283b39a9568513b07e22f0dfcc99339a307d7b2a6b03f261ed583fd4518d3b4d0b464
+EBUILD mesa-9999.ebuild 12776 SHA256 3f29988d707ee3de06282e38edf87060d9a26afc9a44035b916da60d8825af67 SHA512 6a81f8bb9b09c74323ebf112b0fb250d86b3a049b4bb65e68218c907ef058eacb635ef2b4d182c4f5d57d7372cdd47f5d62b3db0387bb32c80ef429986d7662c WHIRLPOOL 0799b325ca087a5ea839bafd9ca8f1cb48100c3591d6c7f74b2171dcec73868a88dc8e72861ee3d333072237b5ac0e9fe6cc8f14ab748795bf55a1e4a12e82ce
+MISC metadata.xml 1807 SHA256 96dab3e1a08b703b74fc7c1e80ee530970bbdbbab882cc3033e7c1cc0a1ae6e4 SHA512 893e2598b756fa4c175db3eddafa251bcebbd524b83c1b949006f2f97f653438b18677a67200d25885a4cd07f03af9edf0eb4460479f1d1a013b7d3a7bff3d01 WHIRLPOOL eb3749398a084521630b623c9f3831faa601db9f49110ebe210ad57f431be8d42033c9ff74b9f2c154de79ef074cfe424c8ae19bbf4d5140137b3374a0c61785
diff --git a/media-libs/mesa/files/0001-gallivm-Do-not-use-NoFramePointerElim-with-LLVM-3.7.patch b/media-libs/mesa/files/0001-gallivm-Do-not-use-NoFramePointerElim-with-LLVM-3.7.patch
new file mode 100644
index 0000000..90717f4
--- /dev/null
+++ b/media-libs/mesa/files/0001-gallivm-Do-not-use-NoFramePointerElim-with-LLVM-3.7.patch
@@ -0,0 +1,49 @@
+From b897aca66ad669fda0f6c4e7617ec51ca42823d8 Mon Sep 17 00:00:00 2001
+From: Vinson Lee <vlee@freedesktop.org>
+Date: Tue, 26 May 2015 22:18:28 -0700
+Subject: [PATCH 1/2] gallivm: Do not use NoFramePointerElim with LLVM 3.7.
+
+TargetOptions::NoFramePointerElim was removed in llvm-3.7.0svn r238244
+"Remove NoFramePointerElim and NoFramePointerElimOverride from
+TargetOptions and remove ExecutionEngine's dependence on CodeGen. NFC."
+
+Signed-off-by: Vinson Lee <vlee@freedesktop.org>
+Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
+---
+ src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 2 ++
+ src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
+index be3e834..76c302f 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
++++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp
+@@ -277,8 +277,10 @@ disassemble(const void* func, llvm::raw_ostream & Out)
+ options.StackAlignmentOverride = 4;
+ #endif
+ #if defined(DEBUG) || defined(PROFILE)
++#if HAVE_LLVM < 0x0307
+ options.NoFramePointerElim = true;
+ #endif
++#endif
+ OwningPtr<TargetMachine> TM(T->createTargetMachine(Triple, sys::getHostCPUName(), "", options));
+
+ /*
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+index 5e8a634..ffed9e6 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
++++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+@@ -439,8 +439,10 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
+ #if HAVE_LLVM < 0x0304
+ options.NoFramePointerElimNonLeaf = true;
+ #endif
++#if HAVE_LLVM < 0x0307
+ options.NoFramePointerElim = true;
+ #endif
++#endif
+
+ builder.setEngineKind(EngineKind::JIT)
+ .setErrorStr(&Error)
+--
+2.4.0
+
diff --git a/media-libs/mesa/files/0002-gallivm-Workaround-LLVM-PR23628.patch b/media-libs/mesa/files/0002-gallivm-Workaround-LLVM-PR23628.patch
new file mode 100644
index 0000000..3dc2c81
--- /dev/null
+++ b/media-libs/mesa/files/0002-gallivm-Workaround-LLVM-PR23628.patch
@@ -0,0 +1,48 @@
+From 025db80a8deb2358638a18d6c777721e288fdca8 Mon Sep 17 00:00:00 2001
+From: Jose Fonseca <jfonseca@vmware.com>
+Date: Thu, 28 May 2015 10:11:36 +0100
+Subject: [PATCH 2/2] gallivm: Workaround LLVM PR23628.
+
+Temporarily undefine DEBUG macro while including LLVM C++ headers,
+leveraging the push/pop_macro pragmas, which are supported both by GCC
+and MSVC.
+
+https://bugs.freedesktop.org/show_bug.cgi?id=90621
+
+Trivial.
+---
+ src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+index ffed9e6..5e25819 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
++++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+@@ -50,6 +50,12 @@
+
+ #include <stddef.h>
+
++// Workaround http://llvm.org/PR23628
++#if HAVE_LLVM >= 0x0307
++# pragma push_macro("DEBUG")
++# undef DEBUG
++#endif
++
+ #include <llvm-c/Core.h>
+ #include <llvm-c/ExecutionEngine.h>
+ #include <llvm/Target/TargetOptions.h>
+@@ -70,6 +76,11 @@
+ #include <llvm/IR/Module.h>
+ #include <llvm/Support/CBindingWrapping.h>
+
++// Workaround http://llvm.org/PR23628
++#if HAVE_LLVM >= 0x0307
++# pragma pop_macro("DEBUG")
++#endif
++
+ #include "pipe/p_config.h"
+ #include "util/u_debug.h"
+ #include "util/u_cpu_detect.h"
+--
+2.4.0
+
diff --git a/media-libs/mesa/files/eselect-mesa.conf.9.2 b/media-libs/mesa/files/eselect-mesa.conf.9.2
new file mode 100644
index 0000000..ff590f5
--- /dev/null
+++ b/media-libs/mesa/files/eselect-mesa.conf.9.2
@@ -0,0 +1,39 @@
+# mesa classic/gallium implementations in this release
+
+# Syntax description:
+# * MESA_IMPLEMENTATIONS contains a space-delimited list of switchable
+# classic/gallium implementations.
+# * MESA_DRIVERS is an associative array, for each member "foo" of
+# MESA_IMPLEMENTATIONS it contains the following elements:
+# foo,description - Human-readable description of the driver
+# foo,classicdriver - Filename of the classic driver
+# foo,galliumdriver - Filename of the gallium driver
+# foo,default - which of classic or gallium is chosen by default
+
+MESA_IMPLEMENTATIONS="i915 i965 r300 r600 sw"
+declare -A MESA_DRIVERS || die "MESA_DRIVERS already in environment and not associative."
+
+MESA_DRIVERS[i915,description]="i915 (Intel 915, 945)"
+MESA_DRIVERS[i915,classicdriver]="i915_dri.so"
+MESA_DRIVERS[i915,galliumdriver]="i915g_dri.so"
+MESA_DRIVERS[i915,default]="gallium"
+
+MESA_DRIVERS[i965,description]="i965 (Intel GMA 965, G/Q3x, G/Q4x, HD)"
+MESA_DRIVERS[i965,classicdriver]="i965_dri.so"
+MESA_DRIVERS[i965,galliumdriver]="ilo_dri.so"
+MESA_DRIVERS[i965,default]="classic"
+
+MESA_DRIVERS[r300,description]="r300 (Radeon R300-R500)"
+MESA_DRIVERS[r300,classicdriver]="r300_dri.so"
+MESA_DRIVERS[r300,galliumdriver]="r300g_dri.so"
+MESA_DRIVERS[r300,default]="gallium"
+
+MESA_DRIVERS[r600,description]="r600 (Radeon R600-R700, Evergreen, Northern Islands)"
+MESA_DRIVERS[r600,classicdriver]="r600_dri.so"
+MESA_DRIVERS[r600,galliumdriver]="r600g_dri.so"
+MESA_DRIVERS[r600,default]="gallium"
+
+MESA_DRIVERS[sw,description]="sw (Software renderer)"
+MESA_DRIVERS[sw,classicdriver]="swrast_dri.so"
+MESA_DRIVERS[sw,galliumdriver]="swrastg_dri.so"
+MESA_DRIVERS[sw,default]="gallium"
diff --git a/media-libs/mesa/files/glx_ro_text_segm.patch b/media-libs/mesa/files/glx_ro_text_segm.patch
new file mode 100644
index 0000000..495b7dc
--- /dev/null
+++ b/media-libs/mesa/files/glx_ro_text_segm.patch
@@ -0,0 +1,28 @@
+2011-02-09 Jeremy Huddleston <jeremyhu@freedesktop.org
+
+ #240956
+ * configure.ac add support to enable readonly test segment on x86
+
+--- configure.ac.orig 2008-11-17 23:19:38.000000000 +0100
++++ configure.ac 2008-11-17 23:20:17.000000000 +0100
+@@ -499,6 +499,20 @@
+ enable_xcb=no
+ fi
+
++
++dnl readonly text segment on x86 hardened platforms
++AC_ARG_ENABLE([glx_rts],
++ [AS_HELP_STRING([--enable-glx-rts],
++ [on x86, use a readonly text segment for libGL @<:@default=disabled@:>@])],
++ [enable_glx_rts="$enableval"],
++ [enable_glx_rts=no])
++if test "x$enable_glx_rts" = xyes; then
++ DEFINES="$DEFINES -DGLX_X86_READONLY_TEXT"
++else
++ enable_glx_rts=no
++fi
++
++
+ dnl
+ dnl libGL configuration per driver
+ dnl
diff --git a/media-libs/mesa/files/mesa-9.2-dont-require-llvm-for-r300.patch b/media-libs/mesa/files/mesa-9.2-dont-require-llvm-for-r300.patch
new file mode 100644
index 0000000..bd24787
--- /dev/null
+++ b/media-libs/mesa/files/mesa-9.2-dont-require-llvm-for-r300.patch
@@ -0,0 +1,12 @@
+diff --git a/configure.ac b/configure.ac
+index 21a1986..94b2247 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1777,7 +1777,6 @@ if test "x$with_gallium_drivers" != x; then
+ xr300)
+ HAVE_GALLIUM_R300=yes
+ PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
+- gallium_require_llvm "Gallium R300"
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
+ gallium_check_st "radeon/drm" "dri-r300" "" "" "xvmc-r300" "vdpau-r300"
+ ;;
diff --git a/media-libs/mesa/files/mesa-9999-dont-require-llvm-for-r300.patch b/media-libs/mesa/files/mesa-9999-dont-require-llvm-for-r300.patch
new file mode 100644
index 0000000..a85a3c1
--- /dev/null
+++ b/media-libs/mesa/files/mesa-9999-dont-require-llvm-for-r300.patch
@@ -0,0 +1,11 @@
+diff -Naur a/configure.ac b/configure.ac
+--- a/configure.ac 2014-03-03 04:05:33.110522943 +0100
++++ b/configure.ac 2014-03-03 04:06:44.165518094 +0100
+@@ -1774,7 +1774,6 @@
+ HAVE_GALLIUM_R300=yes
+ PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
+ gallium_require_drm_loader
+- gallium_require_llvm "Gallium R300"
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
+ gallium_check_st "radeon/drm" "r300/dri" "" "" ""
+ DRICOMMON_NEED_LIBDRM=yes
diff --git a/media-libs/mesa/mesa-9999.ebuild b/media-libs/mesa/mesa-9999.ebuild
new file mode 100644
index 0000000..126e07b
--- /dev/null
+++ b/media-libs/mesa/mesa-9999.ebuild
@@ -0,0 +1,463 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+EGIT_REPO_URI="git://anongit.freedesktop.org/mesa/mesa"
+#EGIT_REPO_URI="git://people.freedesktop.org/~agd5f/mesa"
+EGIT_BRANCH="amdgpu"
+
+if [[ ${PV} = 9999* ]]; then
+ GIT_ECLASS="git-r3"
+ EXPERIMENTAL="true"
+fi
+
+PYTHON_COMPAT=( python{2_6,2_7} )
+
+inherit autotools multilib-minimal python-any-r1 pax-utils ${GIT_ECLASS}
+
+OPENGL_DIR="xorg-x11"
+
+MY_P="${P/_/-}"
+FOLDER="${PV/_rc*/}"
+
+DESCRIPTION="OpenGL-like graphic library for Linux"
+HOMEPAGE="http://mesa3d.sourceforge.net/"
+
+if [[ $PV == 9999* ]]; then
+ SRC_URI=""
+else
+ SRC_URI="ftp://ftp.freedesktop.org/pub/mesa/${FOLDER}/${MY_P}.tar.xz"
+fi
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~sparc-solaris ~x64-solaris ~x86-solaris"
+RESTRICT="!bindist? ( bindist )"
+
+INTEL_CARDS="i915 i965 ilo intel"
+RADEON_CARDS="r100 r200 r300 r600 radeon radeonsi"
+VIDEO_CARDS="${INTEL_CARDS} ${RADEON_CARDS} freedreno nouveau vmware"
+for card in ${VIDEO_CARDS}; do
+ IUSE_VIDEO_CARDS+=" video_cards_${card}"
+done
+
+IUSE="${IUSE_VIDEO_CARDS}
+ bindist +classic d3d9 debug +dri3 +egl +gallium +gbm gles1 gles2 +llvm
+ +nptl opencl osmesa pax_kernel openmax pic selinux +udev vaapi vdpau
+ wayland xvmc xa kernel_FreeBSD"
+
+REQUIRED_USE="
+ d3d9? ( dri3 gallium )
+ llvm? ( gallium )
+ opencl? ( gallium llvm )
+ openmax? ( gallium )
+ gles1? ( egl )
+ gles2? ( egl )
+ vaapi? ( gallium )
+ vdpau? ( gallium )
+ wayland? ( egl gbm )
+ xa? ( gallium )
+ video_cards_freedreno? ( gallium )
+ video_cards_intel? ( classic )
+ video_cards_i915? ( || ( classic gallium ) )
+ video_cards_i965? ( classic )
+ video_cards_ilo? ( gallium )
+ video_cards_nouveau? ( || ( classic gallium ) )
+ video_cards_radeon? ( || ( classic gallium ) )
+ video_cards_r100? ( classic )
+ video_cards_r200? ( classic )
+ video_cards_r300? ( gallium )
+ video_cards_r600? ( gallium )
+ video_cards_radeonsi? ( gallium llvm )
+ video_cards_vmware? ( gallium )
+ ${PYTHON_REQUIRED_USE}
+"
+
+# video_cards_amdgpu? ( gallium llvm )
+
+LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.60"
+# keep correct libdrm and dri2proto dep
+# keep blocks in rdepend for binpkg
+RDEPEND="
+ !<x11-base/xorg-server-1.7
+ !<=x11-proto/xf86driproto-2.0.3
+ abi_x86_32? ( !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)] )
+ classic? ( app-eselect/eselect-mesa )
+ gallium? ( app-eselect/eselect-mesa )
+ >=app-eselect/eselect-opengl-1.3.0
+ udev? ( kernel_linux? ( >=virtual/libudev-215:=[${MULTILIB_USEDEP}] ) )
+ >=dev-libs/expat-2.1.0-r3:=[${MULTILIB_USEDEP}]
+ gbm? ( >=virtual/libudev-215:=[${MULTILIB_USEDEP}] )
+ dri3? ( >=virtual/libudev-215:=[${MULTILIB_USEDEP}] )
+ >=x11-libs/libX11-1.6.2:=[${MULTILIB_USEDEP}]
+ >=x11-libs/libxshmfence-1.1:=[${MULTILIB_USEDEP}]
+ >=x11-libs/libXdamage-1.1.4-r1:=[${MULTILIB_USEDEP}]
+ >=x11-libs/libXext-1.3.2:=[${MULTILIB_USEDEP}]
+ >=x11-libs/libXxf86vm-1.1.3:=[${MULTILIB_USEDEP}]
+ >=x11-libs/libxcb-1.9.3:=[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes:=[${MULTILIB_USEDEP}]
+ llvm? (
+ video_cards_radeonsi? ( || (
+ >=dev-libs/elfutils-0.155-r1:=[${MULTILIB_USEDEP}]
+ >=dev-libs/libelf-0.8.13-r2:=[${MULTILIB_USEDEP}]
+ ) )
+ !video_cards_r600? (
+ video_cards_radeon? ( || (
+ >=dev-libs/elfutils-0.155-r1:=[${MULTILIB_USEDEP}]
+ >=dev-libs/libelf-0.8.13-r2:=[${MULTILIB_USEDEP}]
+ ) )
+ )
+ >=sys-devel/llvm-3.4.2:=[${MULTILIB_USEDEP}]
+ )
+ opencl? (
+ app-eselect/eselect-opencl
+ dev-libs/libclc
+ || (
+ >=dev-libs/elfutils-0.155-r1:=[${MULTILIB_USEDEP}]
+ >=dev-libs/libelf-0.8.13-r2:=[${MULTILIB_USEDEP}]
+ )
+ )
+ openmax? ( >=media-libs/libomxil-bellagio-0.9.3:=[${MULTILIB_USEDEP}] )
+ vaapi? ( >=x11-libs/libva-0.35.0:=[${MULTILIB_USEDEP}] )
+ vdpau? ( >=x11-libs/libvdpau-0.7:=[${MULTILIB_USEDEP}] )
+ wayland? ( >=dev-libs/wayland-1.2.0:=[${MULTILIB_USEDEP}] )
+ xvmc? ( >=x11-libs/libXvMC-1.0.8:=[${MULTILIB_USEDEP}] )
+ ${LIBDRM_DEPSTRING}[video_cards_freedreno?,video_cards_nouveau?,video_cards_vmware?,${MULTILIB_USEDEP}]
+"
+for card in ${INTEL_CARDS}; do
+ RDEPEND="${RDEPEND}
+ video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_intel] )
+ "
+done
+
+for card in ${RADEON_CARDS}; do
+ RDEPEND="${RDEPEND}
+ video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_radeon] )
+ "
+done
+
+DEPEND="${RDEPEND}
+ llvm? (
+ video_cards_radeonsi? ( sys-devel/llvm[video_cards_radeon] )
+ )
+ opencl? (
+ >=sys-devel/llvm-3.4.2:=[${MULTILIB_USEDEP}]
+ >=sys-devel/clang-3.4.2:=[${MULTILIB_USEDEP}]
+ >=sys-devel/gcc-4.6
+ )
+ sys-devel/gettext
+ virtual/pkgconfig
+ >=x11-proto/dri2proto-2.8-r1:=[${MULTILIB_USEDEP}]
+ dri3? (
+ >=x11-proto/dri3proto-1.0:=[${MULTILIB_USEDEP}]
+ >=x11-proto/presentproto-1.0:=[${MULTILIB_USEDEP}]
+ )
+ >=x11-proto/glproto-1.4.17-r1:=[${MULTILIB_USEDEP}]
+ >=x11-proto/xextproto-7.2.1-r1:=[${MULTILIB_USEDEP}]
+ >=x11-proto/xf86driproto-2.1.1-r1:=[${MULTILIB_USEDEP}]
+ >=x11-proto/xf86vidmodeproto-2.3.1-r1:=[${MULTILIB_USEDEP}]
+"
+[[ ${PV} == "9999" ]] && DEPEND+="
+ sys-devel/bison
+ sys-devel/flex
+ ${PYTHON_DEPS}
+ $(python_gen_any_dep ">=dev-python/mako-0.7.3[\${PYTHON_USEDEP}]")
+"
+
+S="${WORKDIR}/${MY_P}"
+EGIT_CHECKOUT_DIR=${S}
+
+# It is slow without texrels, if someone wants slow
+# mesa without texrels +pic use is worth the shot
+QA_EXECSTACK="usr/lib*/libGL.so*"
+QA_WX_LOAD="usr/lib*/libGL.so*"
+
+pkg_setup() {
+ # warning message for bug 459306
+ if use llvm && has_version sys-devel/llvm[!debug=]; then
+ ewarn "Mismatch between debug USE flags in media-libs/mesa and sys-devel/llvm"
+ ewarn "detected! This can cause problems. For details, see bug 459306."
+ fi
+
+ python-any-r1_pkg_setup
+}
+
+src_prepare() {
+ # fix for hardened pax_kernel, bug 240956
+ [[ ${PV} != 9999* ]] && epatch "${FILESDIR}"/glx_ro_text_segm.patch
+# epatch "${FILESDIR}"/0001-gallivm-Do-not-use-NoFramePointerElim-with-LLVM-3.7.patch
+# epatch "${FILESDIR}"/0002-gallivm-Workaround-LLVM-PR23628.patch
+
+ eautoreconf
+}
+
+multilib_src_configure() {
+ local myconf
+
+ if use classic; then
+ # Configurable DRI drivers
+ driver_enable swrast
+
+ # Intel code
+ driver_enable video_cards_i915 i915
+ driver_enable video_cards_i965 i965
+ if ! use video_cards_i915 && \
+ ! use video_cards_i965; then
+ driver_enable video_cards_intel i915 i965
+ fi
+
+ # Nouveau code
+ driver_enable video_cards_nouveau nouveau
+
+ # ATI code
+ driver_enable video_cards_r100 radeon
+ driver_enable video_cards_r200 r200
+ if ! use video_cards_r100 && \
+ ! use video_cards_r200; then
+ driver_enable video_cards_radeon radeon r200
+ fi
+ fi
+
+ if use egl; then
+ myconf+="--with-egl-platforms=x11$(use wayland && echo ",wayland")$(use gbm && echo ",drm") "
+ fi
+
+ if use gallium; then
+ myconf+="
+ $(use_enable d3d9 nine)
+ $(use_enable llvm gallium-llvm)
+ $(use_enable openmax omx)
+ $(use_enable vaapi va)
+ $(use_enable vdpau)
+ $(use_enable xa)
+ $(use_enable xvmc)
+ "
+ gallium_enable swrast
+ gallium_enable video_cards_vmware svga
+ gallium_enable video_cards_nouveau nouveau
+ gallium_enable video_cards_i915 i915
+ gallium_enable video_cards_ilo ilo
+ if ! use video_cards_i915 && \
+ ! use video_cards_i965; then
+ gallium_enable video_cards_intel i915
+ fi
+
+ gallium_enable video_cards_r300 r300
+ gallium_enable video_cards_r600 r600
+ gallium_enable video_cards_radeonsi radeonsi
+# gallium_enable video_cards_amdgpu amdgpu
+ if ! use video_cards_r300 && \
+ ! use video_cards_r600; then
+ gallium_enable video_cards_radeon r300 r600
+ fi
+
+ gallium_enable video_cards_freedreno freedreno
+ # opencl stuff
+ if use opencl; then
+ myconf+="
+ $(use_enable opencl)
+ --with-clang-libdir="${EPREFIX}/usr/lib"
+ "
+ fi
+ fi
+
+ # x86 hardened pax_kernel needs glx-rts, bug 240956
+ if use pax_kernel; then
+ myconf+="
+ $(use_enable x86 glx-rts)
+ "
+ fi
+
+ # on abi_x86_32 hardened we need to have asm disable
+ if [[ ${ABI} == x86* ]] && use pic; then
+ myconf+=" --disable-asm"
+ fi
+
+ # build fails with BSD indent, bug #428112
+ use userland_GNU || export INDENT=cat
+
+ ECONF_SOURCE="${S}" \
+ econf \
+ --enable-dri \
+ --enable-glx \
+ --enable-shared-glapi \
+ --disable-shader-cache \
+ $(use_enable !bindist texture-float) \
+ $(use_enable d3d9 nine) \
+ $(use_enable debug) \
+ $(use_enable dri3) \
+ $(use_enable egl) \
+ $(use_enable gbm) \
+ $(use_enable gles1) \
+ $(use_enable gles2) \
+ $(use_enable nptl glx-tls) \
+ $(use_enable osmesa) \
+ $(use_enable !udev sysfs) \
+ --enable-llvm-shared-libs \
+ --with-dri-drivers=${DRI_DRIVERS} \
+ --with-gallium-drivers=${GALLIUM_DRIVERS} \
+ PYTHON2="${PYTHON}" \
+ ${myconf}
+}
+
+multilib_src_install() {
+ emake install DESTDIR="${D}"
+
+ if use classic || use gallium; then
+ ebegin "Moving DRI/Gallium drivers for dynamic switching"
+ local gallium_drivers=( i915_dri.so i965_dri.so r300_dri.so r600_dri.so swrast_dri.so )
+ keepdir /usr/$(get_libdir)/dri
+ dodir /usr/$(get_libdir)/mesa
+ for x in ${gallium_drivers[@]}; do
+ if [ -f "$(get_libdir)/gallium/${x}" ]; then
+ mv -f "${ED}/usr/$(get_libdir)/dri/${x}" "${ED}/usr/$(get_libdir)/dri/${x/_dri.so/g_dri.so}" \
+ || die "Failed to move ${x}"
+ fi
+ done
+ if use classic; then
+ emake -C "${BUILD_DIR}/src/mesa/drivers/dri" DESTDIR="${D}" install
+ fi
+ for x in "${ED}"/usr/$(get_libdir)/dri/*.so; do
+ if [ -f ${x} -o -L ${x} ]; then
+ mv -f "${x}" "${x/dri/mesa}" \
+ || die "Failed to move ${x}"
+ fi
+ done
+ pushd "${ED}"/usr/$(get_libdir)/dri || die "pushd failed"
+ ln -s ../mesa/*.so . || die "Creating symlink failed"
+ # remove symlinks to drivers known to eselect
+ for x in ${gallium_drivers[@]}; do
+ if [ -f ${x} -o -L ${x} ]; then
+ rm "${x}" || die "Failed to remove ${x}"
+ fi
+ done
+ popd
+ eend $?
+ fi
+ if use opencl; then
+ ebegin "Moving Gallium/Clover OpenCL implementation for dynamic switching"
+ local cl_dir="/usr/$(get_libdir)/OpenCL/vendors/mesa"
+ dodir ${cl_dir}/{lib,include}
+ if [ -f "${ED}/usr/$(get_libdir)/libOpenCL.so" ]; then
+ mv -f "${ED}"/usr/$(get_libdir)/libOpenCL.so* \
+ "${ED}"${cl_dir}
+ fi
+ if [ -f "${ED}/usr/include/CL/opencl.h" ]; then
+ mv -f "${ED}"/usr/include/CL \
+ "${ED}"${cl_dir}/include
+ fi
+ eend $?
+ fi
+
+ if use openmax; then
+ echo "XDG_DATA_DIRS=\"${EPREFIX}/usr/share/mesa/xdg\"" > "${T}/99mesaxdgomx"
+ doenvd "${T}"/99mesaxdgomx
+ keepdir /usr/share/mesa/xdg
+ fi
+}
+
+multilib_src_install_all() {
+ prune_libtool_files --all
+ einstalldocs
+
+ if use !bindist; then
+ dodoc docs/patents.txt
+ fi
+
+ # Install config file for eselect mesa
+ insinto /usr/share/mesa
+ newins "${FILESDIR}/eselect-mesa.conf.9.2" eselect-mesa.conf
+}
+
+multilib_src_test() {
+ if use llvm; then
+ local llvm_tests='lp_test_arit lp_test_arit lp_test_blend lp_test_blend lp_test_conv lp_test_conv lp_test_format lp_test_format lp_test_printf lp_test_printf'
+ pushd src/gallium/drivers/llvmpipe >/dev/null || die
+ emake ${llvm_tests}
+ pax-mark m ${llvm_tests}
+ popd >/dev/null || die
+ fi
+ emake check
+}
+
+pkg_postinst() {
+ # Switch to the xorg implementation.
+ echo
+ eselect opengl set --use-old ${OPENGL_DIR}
+
+ # Select classic/gallium drivers
+ if use classic || use gallium; then
+ eselect mesa set --auto
+ fi
+
+ # Switch to mesa opencl
+ if use opencl; then
+ eselect opencl set --use-old ${PN}
+ fi
+
+ # run omxregister-bellagio to make the OpenMAX drivers known system-wide
+ if use openmax; then
+ ebegin "Registering OpenMAX drivers"
+ BELLAGIO_SEARCH_PATH="${EPREFIX}/usr/$(get_libdir)/libomxil-bellagio0" \
+ OMX_BELLAGIO_REGISTRY=${EPREFIX}/usr/share/mesa/xdg/.omxregister \
+ omxregister-bellagio
+ eend $?
+ fi
+
+ # warn about patent encumbered texture-float
+ if use !bindist; then
+ elog "USE=\"bindist\" was not set. Potentially patent encumbered code was"
+ elog "enabled. Please see patents.txt for an explanation."
+ fi
+
+ if ! has_version media-libs/libtxc_dxtn; then
+ elog "Note that in order to have full S3TC support, it is necessary to install"
+ elog "media-libs/libtxc_dxtn as well. This may be necessary to get nice"
+ elog "textures in some apps, and some others even require this to run."
+ fi
+}
+
+pkg_prerm() {
+ if use openmax; then
+ rm "${EPREFIX}"/usr/share/mesa/xdg/.omxregister
+ fi
+}
+
+# $1 - VIDEO_CARDS flag
+# other args - names of DRI drivers to enable
+# TODO: avoid code duplication for a more elegant implementation
+driver_enable() {
+ case $# in
+ # for enabling unconditionally
+ 1)
+ DRI_DRIVERS+=",$1"
+ ;;
+ *)
+ if use $1; then
+ shift
+ for i in $@; do
+ DRI_DRIVERS+=",${i}"
+ done
+ fi
+ ;;
+ esac
+}
+
+gallium_enable() {
+ case $# in
+ # for enabling unconditionally
+ 1)
+ GALLIUM_DRIVERS+=",$1"
+ ;;
+ *)
+ if use $1; then
+ shift
+ for i in $@; do
+ GALLIUM_DRIVERS+=",${i}"
+ done
+ fi
+ ;;
+ esac
+}
diff --git a/media-libs/mesa/metadata.xml b/media-libs/mesa/metadata.xml
new file mode 100644
index 0000000..ec5c3b6
--- /dev/null
+++ b/media-libs/mesa/metadata.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>x11</herd>
+<use>
+ <flag name='bindist'>Disable patent-encumbered ARB_texture_float, EXT_texture_shared_exponent, and EXT_packed_float extensions.</flag>
+ <flag name='classic'>Build drivers based on the classic architecture.</flag>
+ <flag name='d3d9'>Enable Direct 3D9 API through Nine state tracker. Can be used together with patched wine.</flag>
+ <flag name='dri3'>Enable DRI3 support.</flag>
+ <flag name='egl'>Enable EGL support.</flag>
+ <flag name='gallium'>Build drivers based on Gallium3D, the new architecture for 3D graphics drivers.</flag>
+ <flag name='gbm'>Enable the Graphics Buffer Manager for EGL on KMS.</flag>
+ <flag name='gles1'>Enable GLESv1 support.</flag>
+ <flag name='gles2'>Enable GLESv2 support.</flag>
+ <flag name='llvm'>Enable LLVM backend for Gallium3D.</flag>
+ <flag name='opencl'>Enable the Clover Gallium OpenCL state tracker.</flag>
+ <flag name='openmax'>Enable OpenMAX video decode/encode acceleration for Gallium3D.</flag>
+ <flag name='osmesa'>Build the Mesa library for off-screen rendering.</flag>
+ <flag name='pax_kernel'>Enable if the user plans to run the package under a pax enabled hardened kernel</flag>
+ <flag name='pic'>disable optimized assembly code that is not PIC friendly</flag>
+ <flag name='vaapi'>Enable the VAAPI acceleration interface for the Gallium3D Video Layer.</flag>
+ <flag name='vdpau'>Enable the VDPAU acceleration interface for the Gallium3D Video Layer.</flag>
+ <flag name='wayland'>Enable support for dev-libs/wayland</flag>
+ <flag name='xa'>Enable the XA (X Acceleration) API for Gallium3D.</flag>
+ <flag name='xvmc'>Enable the XvMC acceleration interface for the Gallium3D Video Layer.</flag>
+</use>
+</pkgmetadata>