diff options
author | 2018-03-11 12:55:35 +0100 | |
---|---|---|
committer | 2018-03-11 12:55:35 +0100 | |
commit | f225e40a2dd8517a9e6027d9ec338d2fc6360836 (patch) | |
tree | 97c4d620602b6c73739b2db8df2063878cfa2eed | |
parent | weston: update git ebuild (diff) | |
download | ennui-f225e40a2dd8517a9e6027d9ec338d2fc6360836.tar.gz ennui-f225e40a2dd8517a9e6027d9ec338d2fc6360836.tar.bz2 ennui-f225e40a2dd8517a9e6027d9ec338d2fc6360836.zip |
mesa: add git version
-rw-r--r-- | media-libs/mesa/Manifest | 6 | ||||
-rw-r--r-- | media-libs/mesa/files/eselect-mesa.conf.9.2 | 38 | ||||
-rw-r--r-- | media-libs/mesa/files/mesa-17-musl-invocation_name.patch | 47 | ||||
-rw-r--r-- | media-libs/mesa/files/mesa-17-musl_endian.patch | 12 | ||||
-rw-r--r-- | media-libs/mesa/files/mesa-18-execinfo.patch | 65 | ||||
-rw-r--r-- | media-libs/mesa/files/mesa-18-musl-pthread.patch | 40 | ||||
-rw-r--r-- | media-libs/mesa/mesa-9999.ebuild | 592 |
7 files changed, 800 insertions, 0 deletions
diff --git a/media-libs/mesa/Manifest b/media-libs/mesa/Manifest new file mode 100644 index 0000000..5568827 --- /dev/null +++ b/media-libs/mesa/Manifest @@ -0,0 +1,6 @@ +AUX eselect-mesa.conf.9.2 1630 BLAKE2B 6c67ef9b5dc94f2f26378c004a459680b05084900a9199107a23f9c55514b59438265bce9ca207b05e2d20c3aa43e475d3f228c283dc965402c962a4cd0b6ebf SHA512 0fa9a23b4fba10599268266a82c7fa8dc5bfa1a0d565732875064c381dc4ff40c23faddb02b5849b1522eb9b7fd2ec2a0fac14406442a4aa0afa44bf760b42b5 +AUX mesa-17-musl-invocation_name.patch 2200 BLAKE2B a3caf41314e2526d2b7f299ed93f19e8b6c57e68a59b8af0c2ea48086dc642ddde8c1eba9f33476f4b9b790f19ea0ca341599c27ff94818a4edc596bf4c151a9 SHA512 3a22dca8e6bf29a2db81ffa17ce95ad86f5d7425006d25606e465a829691cee3d723bc9dcd20c958a035fe0c9460498b975f66aa2ddbedfa196a4ae67e764c09 +AUX mesa-17-musl_endian.patch 463 BLAKE2B cc768590fc4e63680c05ab3b08ad88c31d58459ae51b301f347138222e4a66f3488189441870daf2bc9874cfbe31063905ce8da7b693051cb7a3cc73c3c3da34 SHA512 7305c4c49e8268727f2505d1879edb8e214c68eebbfd5889e7c743b60eb9ba82e9b24b267c380ddcd993dcc2339d5d4551b0768801bdcc416f74730970a1d9ba +AUX mesa-18-execinfo.patch 2583 BLAKE2B 1c4d091cca06c8d282458c154d25d1f69f831b6d6bee06df8b220520a68188fcdd72603ea121e833e509f24aa175f00c5e229bd65ee769ab9d7418baa3d4cb8d SHA512 7c4e5488d0596968384aff1e44ac651d1fd87605cbdaceddcf7caaf287fee102deccec32c50846689d9dbdd3a807cb9f38bc2b5a6dfae6991abb1c082659d95b +AUX mesa-18-musl-pthread.patch 1920 BLAKE2B 6900ecf2ada8ff339c01cddb97a235f8c6d251fe213325b1b05bf5a2a746b06581d6d5491fb23982e12a3459434e5ab6a13a4a587157b9270b4b050b9690b0c9 SHA512 8696af0b7591b0a2cb05cfed5aeb216b97e599e618036a8451755632fdf0e3548c2bcbe944f97f7891f954b5fe834572af348f79dd1e51453aa140c733e5e121 +EBUILD mesa-9999.ebuild 15215 BLAKE2B 771d604c81ceceb101e25869ba2bdcef5b68f1b93ec0982902a4e4ef93ef3f0e90036785cbd633e023da48e8dd08f7e19d4691ca1d29a00c2512776ade095c2d SHA512 09b3d28ca1894db581e6ee852fe2611b7ec8ee7c53702a6c5116f95b65cc49eb4792d9c8e1e28d265a10499be48e2d33f703264b14f6a1f02bf00ca72585ce3a 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..18bfaff --- /dev/null +++ b/media-libs/mesa/files/eselect-mesa.conf.9.2 @@ -0,0 +1,38 @@ +# 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,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/mesa-17-musl-invocation_name.patch b/media-libs/mesa/files/mesa-17-musl-invocation_name.patch new file mode 100644 index 0000000..80b02f5 --- /dev/null +++ b/media-libs/mesa/files/mesa-17-musl-invocation_name.patch @@ -0,0 +1,47 @@ +diff -Naur mesa-17.3.0.orig/src/gallium/auxiliary/os/os_process.c mesa-17.3.0/src/gallium/auxiliary/os/os_process.c +--- mesa-17.3.0.orig/src/gallium/auxiliary/os/os_process.c 2017-12-08 05:49:11.000000000 -0800 ++++ mesa-17.3.0/src/gallium/auxiliary/os/os_process.c 2017-12-11 14:24:35.200797607 -0800 +@@ -32,7 +32,7 @@ + + #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) + # include <windows.h> +-#elif defined(__GLIBC__) || defined(__CYGWIN__) ++#elif defined(__linux__) || defined(__CYGWIN__) + # include <errno.h> + #elif defined(PIPE_OS_BSD) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_ANDROID) + # include <stdlib.h> +@@ -84,7 +84,7 @@ + + name = lpProcessName; + +-#elif defined(__GLIBC__) || defined(__CYGWIN__) ++#elif defined(__linux__) || defined(__CYGWIN__) + name = program_invocation_short_name; + #elif defined(PIPE_OS_BSD) || defined(PIPE_OS_APPLE) || defined(PIPE_OS_ANDROID) + /* *BSD and OS X */ +diff -Naur mesa-17.3.0.orig/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c mesa-17.3.0/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c +--- mesa-17.3.0.orig/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c 2017-12-08 05:49:11.000000000 -0800 ++++ mesa-17.3.0/src/gallium/winsys/virgl/vtest/virgl_vtest_socket.c 2017-12-11 14:23:35.312798680 -0800 +@@ -84,7 +84,7 @@ + ret = os_get_process_name(cmdline, 63); + if (ret == FALSE) + strcpy(cmdline, nstr); +-#if defined(__GLIBC__) || defined(__CYGWIN__) ++#if defined(__linux__) || defined(__CYGWIN__) + if (!strcmp(cmdline, "shader_runner")) { + const char *name; + /* hack to get better testname */ +diff -Naur mesa-17.3.0.orig/src/util/xmlconfig.c mesa-17.3.0/src/util/xmlconfig.c +--- mesa-17.3.0.orig/src/util/xmlconfig.c 2017-12-08 05:49:11.000000000 -0800 ++++ mesa-17.3.0/src/util/xmlconfig.c 2017-12-11 14:22:54.052799419 -0800 +@@ -40,8 +40,8 @@ + + #undef GET_PROGRAM_NAME + +-#if (defined(__GNU_LIBRARY__) || defined(__GLIBC__)) && !defined(__UCLIBC__) +-# if !defined(__GLIBC__) || (__GLIBC__ < 2) ++#if defined(__linux__) ++# if defined(__GLIBC__) && (__GLIBC__ < 2) + /* These aren't declared in any libc5 header */ + extern char *program_invocation_name, *program_invocation_short_name; + # endif diff --git a/media-libs/mesa/files/mesa-17-musl_endian.patch b/media-libs/mesa/files/mesa-17-musl_endian.patch new file mode 100644 index 0000000..74e3d1d --- /dev/null +++ b/media-libs/mesa/files/mesa-17-musl_endian.patch @@ -0,0 +1,12 @@ +diff -Naur mesa-17.3.1.orig/src/util/u_endian.h mesa-17.3.1/src/util/u_endian.h +--- mesa-17.3.1.orig/src/util/u_endian.h 2017-12-29 14:19:33.532915798 -0800 ++++ mesa-17.3.1/src/util/u_endian.h 2017-12-29 14:21:55.547913255 -0800 +@@ -27,7 +27,7 @@ + #ifndef U_ENDIAN_H + #define U_ENDIAN_H + +-#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__) ++#if defined(__linux__) || defined(__CYGWIN__) + #include <endian.h> + + #if __BYTE_ORDER == __LITTLE_ENDIAN diff --git a/media-libs/mesa/files/mesa-18-execinfo.patch b/media-libs/mesa/files/mesa-18-execinfo.patch new file mode 100644 index 0000000..02652ee --- /dev/null +++ b/media-libs/mesa/files/mesa-18-execinfo.patch @@ -0,0 +1,65 @@ +diff -Naur mesa-17.3.0.orig/configure.ac mesa-17.3.0/configure.ac +--- mesa-17.3.0.orig/configure.ac 2017-12-08 05:49:11.000000000 -0800 ++++ mesa-17.3.0/configure.ac 2017-12-11 14:11:53.587811247 -0800 +@@ -794,6 +794,7 @@ + AC_CHECK_FUNC([strtof], [DEFINES="$DEFINES -DHAVE_STRTOF"]) + AC_CHECK_FUNC([mkostemp], [DEFINES="$DEFINES -DHAVE_MKOSTEMP"]) + AC_CHECK_FUNC([memfd_create], [DEFINES="$DEFINES -DHAVE_MEMFD_CREATE"]) ++AC_CHECK_HEADER([execinfo.h], [DEFINES="$DEFINES -DHAVE_EXECINFO_H"]) + + AC_MSG_CHECKING([whether strtod has locale support]) + AC_LINK_IFELSE([AC_LANG_SOURCE([[ +diff -Naur mesa-17.3.0.orig/src/gallium/auxiliary/util/u_debug_symbol.c mesa-17.3.0/src/gallium/auxiliary/util/u_debug_symbol.c +--- mesa-17.3.0.orig/src/gallium/auxiliary/util/u_debug_symbol.c 2017-12-08 05:49:11.000000000 -0800 ++++ mesa-17.3.0/src/gallium/auxiliary/util/u_debug_symbol.c 2017-12-11 14:13:52.780809112 -0800 +@@ -219,7 +219,7 @@ + #endif /* PIPE_OS_WINDOWS */ + + +-#if defined(__GLIBC__) && !defined(__UCLIBC__) ++#if defined(HAVE_EXECINFO_H) + + #include <execinfo.h> + +@@ -240,7 +240,7 @@ + return TRUE; + } + +-#endif /* defined(__GLIBC__) && !defined(__UCLIBC__) */ ++#endif /* defined(HAVE_EXECINFO_H) */ + + + void +@@ -252,7 +252,7 @@ + } + #endif + +-#if defined(__GLIBC__) && !defined(__UCLIBC__) ++#if defined(HAVE_EXECINFO_H) + if (debug_symbol_name_glibc(addr, buf, size)) { + return; + } +diff -Naur mesa-17.3.0.orig/src/mapi/glapi/gen/gl_gentable.py mesa-17.3.0/src/mapi/glapi/gen/gl_gentable.py +--- mesa-17.3.0.orig/src/mapi/glapi/gen/gl_gentable.py 2017-12-08 05:49:11.000000000 -0800 ++++ mesa-17.3.0/src/mapi/glapi/gen/gl_gentable.py 2017-12-11 14:11:53.587811247 -0800 +@@ -43,7 +43,7 @@ + #endif + + #if (defined(GLXEXT) && defined(HAVE_BACKTRACE)) \\ +- || (!defined(GLXEXT) && defined(DEBUG) && !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__DragonFly__)) ++ || (!defined(GLXEXT) && defined(DEBUG) && defined(HAVE_EXECINFO_H)) + #define USE_BACKTRACE + #endif + +diff -Naur mesa-17.3.0.orig/src/mesa/drivers/dri/i915/intel_regions.c mesa-17.3.0/src/mesa/drivers/dri/i915/intel_regions.c +--- mesa-17.3.0.orig/src/mesa/drivers/dri/i915/intel_regions.c 2017-12-08 05:49:11.000000000 -0800 ++++ mesa-17.3.0/src/mesa/drivers/dri/i915/intel_regions.c 2017-12-11 14:11:53.588811247 -0800 +@@ -57,7 +57,7 @@ + */ + #define DEBUG_BACKTRACE_SIZE 0 + +-#if DEBUG_BACKTRACE_SIZE == 0 ++#if DEBUG_BACKTRACE_SIZE == 0 || !defined(HAVE_EXECINFO_H) + /* Use the standard debug output */ + #define _DBG(...) DBG(__VA_ARGS__) + #else diff --git a/media-libs/mesa/files/mesa-18-musl-pthread.patch b/media-libs/mesa/files/mesa-18-musl-pthread.patch new file mode 100644 index 0000000..2db1667 --- /dev/null +++ b/media-libs/mesa/files/mesa-18-musl-pthread.patch @@ -0,0 +1,40 @@ +diff -Naur mesa-18.0.0-rc2.orig/src/gallium/state_trackers/nine/nine_debug.c mesa-18.0.0-rc2/src/gallium/state_trackers/nine/nine_debug.c +--- mesa-18.0.0-rc2.orig/src/gallium/state_trackers/nine/nine_debug.c 2018-01-24 13:20:13.287944874 -0800 ++++ mesa-18.0.0-rc2/src/gallium/state_trackers/nine/nine_debug.c 2018-01-24 13:23:34.722941267 -0800 +@@ -73,8 +73,8 @@ + } + + #if defined(HAVE_PTHREAD) +-# if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \ +- (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) ++# if defined(__linux__) && !(defined(__GLIBC__) || \ ++ (__GLIBC__ < 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12))) + if (dbg_flags & DBG_TID) + tid = pthread_self(); + # endif +diff -Naur mesa-18.0.0-rc2.orig/src/util/u_thread.h mesa-18.0.0-rc2/src/util/u_thread.h +--- mesa-18.0.0-rc2.orig/src/util/u_thread.h 2018-01-24 13:20:13.166944876 -0800 ++++ mesa-18.0.0-rc2/src/util/u_thread.h 2018-01-24 13:24:11.028940616 -0800 +@@ -61,9 +61,8 @@ + static inline void u_thread_setname( const char *name ) + { + #if defined(HAVE_PTHREAD) +-# if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \ +- (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) && \ +- defined(__linux__) ++# if defined(__linux__) && !(defined(__GLIBC__) || \ ++ (__GLIBC__ < 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12))) + pthread_setname_np(pthread_self(), name); + # endif + #endif +@@ -93,8 +92,8 @@ + static inline bool u_thread_is_self(thrd_t thread) + { + #if defined(HAVE_PTHREAD) +-# if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \ +- (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12)) ++# if defined(__linux__) && !(defined(__GLIBC__) || \ ++ (__GLIBC__ < 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 12))) + return pthread_equal(pthread_self(), thread); + # endif + #endif diff --git a/media-libs/mesa/mesa-9999.ebuild b/media-libs/mesa/mesa-9999.ebuild new file mode 100644 index 0000000..5b7cdbd --- /dev/null +++ b/media-libs/mesa/mesa-9999.ebuild @@ -0,0 +1,592 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +EGIT_REPO_URI="https://anongit.freedesktop.org/git/mesa/mesa.git" + +if [[ ${PV} = 9999 ]]; then + GIT_ECLASS="git-r3" + EXPERIMENTAL="true" +fi + +PYTHON_COMPAT=( python2_7 ) + +inherit autotools llvm multilib-minimal python-any-r1 pax-utils ${GIT_ECLASS} + +OPENGL_DIR="xorg-x11" + +MY_P="${P/_/-}" + +DESCRIPTION="OpenGL-like graphic library for Linux" +HOMEPAGE="https://www.mesa3d.org/ https://mesa.freedesktop.org/" + +if [[ $PV == 9999 ]]; then + SRC_URI="" +else + SRC_URI="https://mesa.freedesktop.org/archive/${MY_P}.tar.xz" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~sparc-solaris ~x64-solaris ~x86-solaris" +fi + +LICENSE="MIT" +SLOT="0" +RESTRICT="!bindist? ( bindist )" + +RADEON_CARDS="r100 r200 r300 r600 radeon radeonsi" +VIDEO_CARDS="${RADEON_CARDS} freedreno i915 i965 imx intel nouveau vc4 virgl vivante 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 unwind + +llvm +nptl opencl osmesa pax_kernel openmax pic selinux vaapi valgrind + vdpau vulkan wayland xvmc xa" + +REQUIRED_USE=" + d3d9? ( dri3 gallium ) + llvm? ( gallium ) + opencl? ( gallium llvm ) + openmax? ( gallium ) + gles1? ( egl ) + gles2? ( egl ) + vaapi? ( gallium ) + vdpau? ( gallium ) + vulkan? ( || ( video_cards_i965 video_cards_radeonsi ) + video_cards_radeonsi? ( llvm ) ) + wayland? ( egl gbm ) + xa? ( gallium ) + video_cards_freedreno? ( gallium ) + video_cards_intel? ( classic ) + video_cards_i915? ( || ( classic gallium ) ) + video_cards_i965? ( classic ) + video_cards_imx? ( gallium video_cards_vivante ) + video_cards_nouveau? ( || ( classic gallium ) ) + video_cards_radeon? ( || ( classic gallium ) + gallium? ( x86? ( llvm ) amd64? ( llvm ) ) ) + video_cards_r100? ( classic ) + video_cards_r200? ( classic ) + video_cards_r300? ( gallium x86? ( llvm ) amd64? ( llvm ) ) + video_cards_r600? ( gallium ) + video_cards_radeonsi? ( gallium llvm ) + video_cards_vc4? ( gallium ) + video_cards_virgl? ( gallium ) + video_cards_vivante? ( gallium gbm ) + video_cards_vmware? ( gallium ) +" + +LIBDRM_DEPSTRING=">=x11-libs/libdrm-2.4.91" +# 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 + >=dev-libs/expat-2.1.0-r3:=[${MULTILIB_USEDEP}] + >=sys-libs/zlib-1.2.8[${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.13:=[${MULTILIB_USEDEP}] + x11-libs/libXfixes:=[${MULTILIB_USEDEP}] + unwind? ( sys-libs/libunwind[${MULTILIB_USEDEP}] ) + llvm? ( + video_cards_radeonsi? ( + virtual/libelf:0=[${MULTILIB_USEDEP}] + ) + video_cards_r600? ( + virtual/libelf:0=[${MULTILIB_USEDEP}] + ) + video_cards_radeon? ( + virtual/libelf:0=[${MULTILIB_USEDEP}] + ) + ) + opencl? ( + app-eselect/eselect-opencl + dev-libs/libclc + virtual/libelf:0=[${MULTILIB_USEDEP}] + ) + openmax? ( + >=media-libs/libomxil-bellagio-0.9.3:=[${MULTILIB_USEDEP}] + x11-misc/xdg-utils + ) + vaapi? ( + >=x11-libs/libva-1.7.3:=[${MULTILIB_USEDEP}] + video_cards_nouveau? ( !<=x11-libs/libva-vdpau-driver-0.7.4-r3 ) + ) + vdpau? ( >=x11-libs/libvdpau-1.1:=[${MULTILIB_USEDEP}] ) + wayland? ( + >=dev-libs/wayland-1.11.0:=[${MULTILIB_USEDEP}] + >=dev-libs/wayland-protocols-1.8 + ) + xvmc? ( >=x11-libs/libXvMC-1.0.8:=[${MULTILIB_USEDEP}] ) + ${LIBDRM_DEPSTRING}[video_cards_freedreno?,video_cards_nouveau?,video_cards_vc4?,video_cards_vivante?,video_cards_vmware?,${MULTILIB_USEDEP}] + + video_cards_intel? ( + !video_cards_i965? ( ${LIBDRM_DEPSTRING}[video_cards_intel] ) + ) + video_cards_i915? ( ${LIBDRM_DEPSTRING}[video_cards_intel] ) +" +for card in ${RADEON_CARDS}; do + RDEPEND="${RDEPEND} + video_cards_${card}? ( ${LIBDRM_DEPSTRING}[video_cards_radeon] ) + " +done +RDEPEND="${RDEPEND} + video_cards_radeonsi? ( ${LIBDRM_DEPSTRING}[video_cards_amdgpu] ) +" + +# Please keep the LLVM dependency block separate. Since LLVM is slotted, +# we need to *really* make sure we're not pulling one than more slot +# simultaneously. +# +# How to use it: +# 1. List all the working slots (with min versions) in ||, newest first. +# 2. Update the := to specify *max* version, e.g. < 7. +# 3. Specify LLVM_MAX_SLOT, e.g. 6. +LLVM_DEPSTR=" + || ( + sys-devel/llvm:7[${MULTILIB_USEDEP}] + sys-devel/llvm:6[${MULTILIB_USEDEP}] + sys-devel/llvm:5[${MULTILIB_USEDEP}] + sys-devel/llvm:4[${MULTILIB_USEDEP}] + >=sys-devel/llvm-3.9.0:0[${MULTILIB_USEDEP}] + ) + sys-devel/llvm:=[${MULTILIB_USEDEP}] +" +LLVM_DEPSTR_AMDGPU=${LLVM_DEPSTR//]/,llvm_targets_AMDGPU(-)]} +CLANG_DEPSTR=${LLVM_DEPSTR//llvm/clang} +CLANG_DEPSTR_AMDGPU=${CLANG_DEPSTR//]/,llvm_targets_AMDGPU(-)]} +RDEPEND="${RDEPEND} + llvm? ( + opencl? ( + video_cards_r600? ( + ${CLANG_DEPSTR_AMDGPU} + ) + !video_cards_r600? ( + video_cards_radeonsi? ( + ${CLANG_DEPSTR_AMDGPU} + ) + ) + !video_cards_r600? ( + !video_cards_radeonsi? ( + video_cards_radeon? ( + ${CLANG_DEPSTR_AMDGPU} + ) + ) + ) + !video_cards_r600? ( + !video_cards_radeon? ( + !video_cards_radeonsi? ( + ${CLANG_DEPSTR} + ) + ) + ) + ) + !opencl? ( + video_cards_r600? ( + ${LLVM_DEPSTR_AMDGPU} + ) + !video_cards_r600? ( + video_cards_radeonsi? ( + ${LLVM_DEPSTR_AMDGPU} + ) + ) + !video_cards_r600? ( + !video_cards_radeonsi? ( + video_cards_radeon? ( + ${LLVM_DEPSTR_AMDGPU} + ) + ) + ) + !video_cards_r600? ( + !video_cards_radeon? ( + !video_cards_radeonsi? ( + ${LLVM_DEPSTR} + ) + ) + ) + ) + ) +" +unset {LLVM,CLANG}_DEPSTR{,_AMDGPU} + +DEPEND="${RDEPEND} + ${PYTHON_DEPS} + opencl? ( + >=sys-devel/gcc-4.6 + ) + sys-devel/gettext + virtual/pkgconfig + valgrind? ( dev-util/valgrind ) + >=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}] + vulkan? ( + $(python_gen_any_dep ">=dev-python/mako-0.7.3[\${PYTHON_USEDEP}]") + ) +" +[[ ${PV} == 9999 ]] && DEPEND+=" + sys-devel/bison + sys-devel/flex + $(python_gen_any_dep ">=dev-python/mako-0.7.3[\${PYTHON_USEDEP}]") +" + +S="${WORKDIR}/${MY_P}" +EGIT_CHECKOUT_DIR=${S} + +QA_WX_LOAD=" +x86? ( + !pic? ( + usr/lib*/libglapi.so.0.0.0 + usr/lib*/libGLESv1_CM.so.1.1.0 + usr/lib*/libGLESv2.so.2.0.0 + usr/lib*/libGL.so.1.2.0 + usr/lib*/libOSMesa.so.8.0.0 + ) +)" + +llvm_check_deps() { + local flags=${MULTILIB_USEDEP} + if use video_cards_r600 || use video_cards_radeon || use video_cards_radeonsi + then + flags+=",llvm_targets_AMDGPU(-)" + fi + + if use opencl; then + has_version "sys-devel/clang[${flags}]" || return 1 + fi + has_version "sys-devel/llvm[${flags}]" +} + +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 + + if use llvm; then + llvm_pkg_setup + fi + python-any-r1_pkg_setup +} + +src_prepare() { + [[ ${PV} == 9999 ]] && eautoreconf + eapply "${FILESDIR}"/${PN}-17-musl_endian.patch + eapply "${FILESDIR}"/${PN}-18-execinfo.patch + eapply "${FILESDIR}"/${PN}-17-musl-invocation_name.patch + eapply "${FILESDIR}"/${PN}-18-musl-pthread.patch + + eautoreconf + + eapply_user +} + +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-platforms=x11,surfaceless$(use wayland && echo ",wayland")$(use gbm && echo ",drm")" + fi + + if use gallium; then + myconf+=" + $(use_enable d3d9 nine) + $(use_enable llvm) + $(use_enable openmax omx-bellagio) + $(use_enable vaapi va) + $(use_enable vdpau) + $(use_enable xa) + $(use_enable xvmc) + " + use vaapi && myconf+=" --with-va-libdir=/usr/$(get_libdir)/va/drivers" + + gallium_enable swrast + gallium_enable video_cards_vc4 vc4 + gallium_enable video_cards_vivante etnaviv + gallium_enable video_cards_vmware svga + gallium_enable video_cards_nouveau nouveau + gallium_enable video_cards_i915 i915 + gallium_enable video_cards_imx imx + 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 + 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 + + gallium_enable video_cards_virgl virgl + fi + + if use vulkan; then + vulkan_enable video_cards_i965 intel + vulkan_enable video_cards_radeonsi radeon + fi + + # x86 hardened pax_kernel needs glx-rts, bug 240956 + if [[ ${ABI} == x86 ]]; then + myconf+=" $(use_enable pax_kernel glx-read-only-text)" + fi + + # on abi_x86_32 hardened we need to have asm disable + if [[ ${ABI} == x86* ]] && use pic; then + myconf+=" --disable-asm" + fi + + if use gallium; then + myconf+=" $(use_enable osmesa gallium-osmesa)" + else + myconf+=" $(use_enable osmesa)" + 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 \ + $(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 unwind libunwind) \ + --enable-valgrind=$(usex valgrind auto no) \ + --enable-llvm-shared-libs \ + --disable-opencl-icd \ + --with-dri-drivers=${DRI_DRIVERS} \ + --with-gallium-drivers=${GALLIUM_DRIVERS} \ + --with-vulkan-drivers=${VULKAN_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() { + find "${ED}" -name '*.la' -delete + 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 /usr/share/doc/${P}/patents.txt.bz2 for an" + elog "explanation." + 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 +} + +vulkan_enable() { + case $# in + # for enabling unconditionally + 1) + VULKAN_DRIVERS+=",$1" + ;; + *) + if use $1; then + shift + for i in $@; do + VULKAN_DRIVERS+=",${i}" + done + fi + ;; + esac +} |