blob: 567ac1ea366de94c7a10509c84fea199396433ca [file] [log] [blame]
# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-libs/mesa/mesa-7.9.ebuild,v 1.3 2010/12/05 17:19:14 arfrever Exp $
EAPI=6
CROS_WORKON_COMMIT="ae283c6c143ae77e7dedbf3f9ea7f2f3ad945f87"
CROS_WORKON_TREE="cbc74a968f7dbca5312df2f7cb8af5ecadf471c5"
CROS_WORKON_PROJECT="chromiumos/third_party/mesa"
CROS_WORKON_LOCALNAME="mesa-amd"
CROS_WORKON_EGIT_BRANCH="chromeos-amd"
inherit base flag-o-matic meson toolchain-funcs cros-workon
DESCRIPTION="The Mesa 3D Graphics Library"
HOMEPAGE="http://mesa3d.org/"
LICENSE="MIT"
SLOT="0"
KEYWORDS="*"
VIDEO_CARDS="intel amdgpu radeon freedreno llvmpipe"
for card in ${VIDEO_CARDS}; do
IUSE_VIDEO_CARDS+=" video_cards_${card}"
done
IUSE="${IUSE_VIDEO_CARDS} debug vulkan"
# keep correct libdrm and dri2proto dep
# keep blocks in rdepend for binpkg
RDEPEND="
virtual/libelf
dev-libs/expat
x11-libs/libdrm
!media-libs/mesa
"
DEPEND="${RDEPEND}
sys-devel/bison
sys-devel/flex
virtual/pkgconfig
x11-base/xorg-proto
x11-libs/libva
sys-devel/llvm
"
driver_list() {
local drivers="$(sort -u <<< "${1// /$'\n'}")"
echo "${drivers//$'\n'/,}"
}
src_configure() {
tc-getPROG PKG_CONFIG pkg-config
cros_optimize_package_for_speed
# Intel code
dri_driver_enable video_cards_intel i965
gallium_enable video_cards_llvmpipe swrast
# ATI code
gallium_enable video_cards_radeon r300 r600
gallium_enable video_cards_amdgpu radeonsi
# Freedreno code
gallium_enable video_cards_freedreno freedreno
if use vulkan; then
vulkan_enable video_cards_intel intel
vulkan_enable video_cards_amdgpu amd
fi
export LLVM_CONFIG=${SYSROOT}/usr/lib/llvm/bin/llvm-config-host
append-flags "-UENABLE_SHADER_CACHE"
emesonargs+=(
-Dglx=disabled
-Dllvm=true
-Dshared-llvm=false
-Dplatforms=
-Degl=true
-Dgbm=false
-Dgl=false
-Dgles1=false
-Dgles2=true
-Ddri-drivers=$(driver_list "${DRI_DRIVERS[*]}")
-Dgallium-drivers=$(driver_list "${GALLIUM_DRIVERS[*]}")
-Dvulkan-drivers=$(driver_list "${VULKAN_DRIVERS[*]}")
--buildtype $(usex debug debug release)
-Dgallium-va=true
-Dva-libs-path="/usr/$(get_libdir)/va/drivers"
)
meson_src_configure
}
src_install() {
meson_src_install
# Remove redundant GLES headers
rm -f "${D}"/usr/include/{EGL,GLES2,GLES3,KHR}/*.h || die "Removing GLES headers failed."
# Set driconf option to enable S3TC hardware decompression
insinto "/etc/"
doins "${FILESDIR}"/drirc
}
# $1 - VIDEO_CARDS flag (check skipped for "--")
# other args - names of DRI drivers to enable
dri_driver_enable() {
if [[ $1 == -- ]] || use $1; then
shift
DRI_DRIVERS+=("$@")
fi
}
gallium_enable() {
if [[ $1 == -- ]] || use $1; then
shift
GALLIUM_DRIVERS+=("$@")
fi
}
vulkan_enable() {
if [[ $1 == -- ]] || use $1; then
shift
VULKAN_DRIVERS+=("$@")
fi
}