From c01d7fc3c3765ccd0057445dea07cbc06f74ddbc Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Fri, 24 May 2024 13:41:38 +0000 Subject: [PATCH 01/10] spirv-tools: enable host build spirv-tools is used by spirv-llvm-translator and thus by llvm in addition to its prior use by vulkan/glslang. this is necessary for iris graphics in mesa-24.1.0 Co-authored-by: CvH <1355173+CvH@users.noreply.github.com> --- packages/graphics/vulkan/spirv-tools/package.mk | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/graphics/vulkan/spirv-tools/package.mk b/packages/graphics/vulkan/spirv-tools/package.mk index 4c6a8e5b31..905d72ce6c 100644 --- a/packages/graphics/vulkan/spirv-tools/package.mk +++ b/packages/graphics/vulkan/spirv-tools/package.mk @@ -11,6 +11,13 @@ PKG_SHA256="03ee1a2c06f3b61008478f4abe9423454e53e580b9488b47c8071547c6a9db47" PKG_LICENSE="Apache-2.0" PKG_SITE="https://github.com/KhronosGroup/SPIRV-Tools" PKG_URL="https://github.com/KhronosGroup/SPIRV-Tools/archive/${PKG_VERSION}.tar.gz" -PKG_DEPENDS_HOST="" +PKG_DEPENDS_HOST="toolchain:host" +PKG_DEPENDS_UNPACK="spirv-headers" PKG_LONGDESC="The SPIR-V Tools project provides an API and commands for processing SPIR-V modules." -PKG_TOOLCHAIN="manual" + +post_unpack() { + mkdir -p ${PKG_BUILD}/external/spirv-headers + tar --strip-components=1 \ + -xf "${SOURCES}/spirv-headers/spirv-headers-$(get_pkg_version spirv-headers).tar.gz" \ + -C "${PKG_BUILD}/external/spirv-headers" +} From 0d5f719de082736e54e9336e8ebb99c0dec7d7eb Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Fri, 24 May 2024 13:45:34 +0000 Subject: [PATCH 02/10] spirv-tools: move package.mk from vulkan to graphics this is now used for gbm Generic builds too --- packages/graphics/{vulkan => }/spirv-tools/package.mk | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/graphics/{vulkan => }/spirv-tools/package.mk (100%) diff --git a/packages/graphics/vulkan/spirv-tools/package.mk b/packages/graphics/spirv-tools/package.mk similarity index 100% rename from packages/graphics/vulkan/spirv-tools/package.mk rename to packages/graphics/spirv-tools/package.mk From d1838dd72355f8b2024b6a14a41071ff3c9633d0 Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Fri, 24 May 2024 13:46:49 +0000 Subject: [PATCH 03/10] spirv-headers: move package.mk from vulkan to graphics this is now used for gbm Generic builds too --- packages/graphics/{vulkan => }/spirv-headers/package.mk | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename packages/graphics/{vulkan => }/spirv-headers/package.mk (100%) diff --git a/packages/graphics/vulkan/spirv-headers/package.mk b/packages/graphics/spirv-headers/package.mk similarity index 100% rename from packages/graphics/vulkan/spirv-headers/package.mk rename to packages/graphics/spirv-headers/package.mk From 7ae4432099fbe3b4964628c4d23fd455e2b670ce Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Fri, 24 May 2024 12:53:05 +0000 Subject: [PATCH 04/10] spirv-llvm-translator: initial package required by mesa-24.1.0 when building libclc needed for Iris Co-authored-by: CvH <1355173+CvH@users.noreply.github.com> --- licenses/LLVM.txt | 70 +++++++++++++++++++ .../graphics/spirv-llvm-translator/package.mk | 11 +++ 2 files changed, 81 insertions(+) create mode 100644 licenses/LLVM.txt create mode 100644 packages/graphics/spirv-llvm-translator/package.mk diff --git a/licenses/LLVM.txt b/licenses/LLVM.txt new file mode 100644 index 0000000000..922092b052 --- /dev/null +++ b/licenses/LLVM.txt @@ -0,0 +1,70 @@ +============================================================================== +LLVM Release License +============================================================================== +University of Illinois/NCSA +Open Source License + +Copyright (c) 2003-2014 University of Illinois at Urbana-Champaign. +All rights reserved. + +Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal with +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE +SOFTWARE. + +============================================================================== +Copyrights and Licenses for Third Party Software Distributed with LLVM: +============================================================================== +The LLVM software contains code written by third parties. Such software will +have its own individual LICENSE.TXT file in the directory in which it appears. +This file will describe the copyrights, license, and restrictions which apply +to that code. + +The disclaimer of warranty in the University of Illinois Open Source License +applies to all code in the LLVM Distribution, and nothing in any of the +other licenses gives permission to use the names of the LLVM Team or the +University of Illinois to endorse or promote products derived from this +Software. + +The following pieces of software have additional or alternate copyrights, +licenses, and/or restrictions: + +Program Directory +------- --------- +Autoconf llvm/autoconf + llvm/projects/ModuleMaker/autoconf +Google Test llvm/utils/unittest/googletest +OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex} +pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT} +ARM contributions llvm/lib/Target/ARM/LICENSE.TXT +md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h diff --git a/packages/graphics/spirv-llvm-translator/package.mk b/packages/graphics/spirv-llvm-translator/package.mk new file mode 100644 index 0000000000..aadb18a290 --- /dev/null +++ b/packages/graphics/spirv-llvm-translator/package.mk @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (C) 2024-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="spirv-llvm-translator" +PKG_VERSION="18.1.0" +PKG_SHA256="78a770eff24d5ffe2798479845adec4b909cbf058ddc55830ea00fa7d2c1698a" +PKG_LICENSE="LLVM" +PKG_SITE="https://github.com/KhronosGroup/SPIRV-LLVM-Translator" +PKG_URL="https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/v${PKG_VERSION}.tar.gz" +PKG_LONGDESC="SPIRV-LLVM-Translator" +PKG_TOOLCHAIN="manual" From 940d79b12eaac22d4c83d833f8025339f3102390 Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Fri, 24 May 2024 13:50:12 +0000 Subject: [PATCH 05/10] llvm: include build of llvm-spirv required by mesa-24.1.0 when building for iris Co-authored-by: CvH <1355173+CvH@users.noreply.github.com> --- packages/lang/llvm/package.mk | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/lang/llvm/package.mk b/packages/lang/llvm/package.mk index f2f806e2cf..efe06a6db3 100644 --- a/packages/lang/llvm/package.mk +++ b/packages/lang/llvm/package.mk @@ -13,6 +13,10 @@ PKG_DEPENDS_TARGET="toolchain llvm:host zlib" PKG_LONGDESC="Low-Level Virtual Machine (LLVM) is a compiler infrastructure." PKG_TOOLCHAIN="cmake" +if listcontains "${GRAPHIC_DRIVERS}" "iris"; then + PKG_DEPENDS_UNPACK="spirv-headers spirv-llvm-translator" +fi + PKG_CMAKE_OPTS_COMMON="-DLLVM_INCLUDE_TOOLS=ON \ -DLLVM_BUILD_TOOLS=OFF \ -DLLVM_BUILD_UTILS=OFF \ @@ -41,8 +45,21 @@ PKG_CMAKE_OPTS_COMMON="-DLLVM_INCLUDE_TOOLS=ON \ -DLLVM_ENABLE_RTTI=ON \ -DLLVM_ENABLE_UNWIND_TABLES=OFF \ -DLLVM_ENABLE_Z3_SOLVER=OFF \ + -DLLVM_SPIRV_INCLUDE_TESTS=OFF \ -DCMAKE_SKIP_RPATH=ON" +post_unpack() { + if listcontains "${GRAPHIC_DRIVERS}" "iris"; then + mkdir -p "${PKG_BUILD}"/llvm/projects/{SPIRV-Headers,SPIRV-LLVM-Translator} + tar --strip-components=1 \ + -xf "${SOURCES}/spirv-headers/spirv-headers-$(get_pkg_version spirv-headers).tar.gz" \ + -C "${PKG_BUILD}/llvm/projects/SPIRV-Headers" + tar --strip-components=1 \ + -xf "${SOURCES}/spirv-llvm-translator/spirv-llvm-translator-$(get_pkg_version spirv-llvm-translator).tar.gz" \ + -C "${PKG_BUILD}/llvm/projects/SPIRV-LLVM-Translator" + fi +} + pre_configure() { PKG_CMAKE_SCRIPT=${PKG_BUILD}/llvm/CMakeLists.txt } @@ -84,12 +101,20 @@ pre_configure_host() { post_make_host() { ninja ${NINJA_OPTS} llvm-config llvm-tblgen + + if listcontains "${GRAPHIC_DRIVERS}" "iris"; then + ninja ${NINJA_OPTS} llvm-as llvm-link llvm-spirv opt + fi } post_makeinstall_host() { mkdir -p ${TOOLCHAIN}/bin cp -a bin/llvm-config ${TOOLCHAIN}/bin cp -a bin/llvm-tblgen ${TOOLCHAIN}/bin + + if listcontains "${GRAPHIC_DRIVERS}" "iris"; then + cp -a bin/{llvm-as,llvm-link,llvm-spirv,opt} "${TOOLCHAIN}/bin" + fi } pre_configure_target() { From 8be81eee9bb96aaa5903186e195df1c39358699f Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Fri, 24 May 2024 13:52:33 +0000 Subject: [PATCH 06/10] libclc: initial package required by mesa-24.1.0 when building for Iris Co-authored-by: CvH <1355173+CvH@users.noreply.github.com> --- packages/devel/libclc/package.mk | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 packages/devel/libclc/package.mk diff --git a/packages/devel/libclc/package.mk b/packages/devel/libclc/package.mk new file mode 100644 index 0000000000..6d775676b7 --- /dev/null +++ b/packages/devel/libclc/package.mk @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (C) 2024-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="libclc" +PKG_VERSION="$(get_pkg_version llvm)" +PKG_LICENSE="Apache-2.0" +PKG_URL="" +PKG_DEPENDS_HOST="toolchain:host llvm:host" +PKG_LONGDESC="Low-Level Virtual Machine (LLVM) is a compiler infrastructure." +PKG_DEPENDS_UNPACK+=" llvm" +PKG_PATCH_DIRS+=" $(get_pkg_directory llvm)/patches" +PKG_TOOLCHAIN="cmake" + +unpack() { + mkdir -p ${PKG_BUILD} + tar --strip-components=1 -xf ${SOURCES}/llvm/llvm-${PKG_VERSION}.tar.xz -C ${PKG_BUILD} +} + +pre_configure() { + PKG_CMAKE_SCRIPT="${PKG_BUILD}/libclc/CMakeLists.txt" +} + +pre_configure_host() { + LIBCLC_TARGETS_TO_BUILD="spirv64-mesa3d-" + + mkdir -p "${PKG_BUILD}/.${HOST_NAME}" + cd ${PKG_BUILD}/.${HOST_NAME} + PKG_CMAKE_OPTS_HOST="-DLIBCLC_TARGETS_TO_BUILD=${LIBCLC_TARGETS_TO_BUILD}" +} From ec14e8f203d21c39536541bb63a3d3e3c01432ce Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Sat, 25 May 2024 04:21:06 +0000 Subject: [PATCH 07/10] libdrm: enable host build required by mesa-24.1.0 when building intel_clc needed for Iris --- packages/graphics/libdrm/package.mk | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/graphics/libdrm/package.mk b/packages/graphics/libdrm/package.mk index fed46f545a..6833036e10 100644 --- a/packages/graphics/libdrm/package.mk +++ b/packages/graphics/libdrm/package.mk @@ -8,12 +8,13 @@ PKG_SHA256="3bf55363f76c7250946441ab51d3a6cc0ae518055c0ff017324ab76cdefb327a" PKG_LICENSE="GPL" PKG_SITE="https://dri.freedesktop.org" PKG_URL="https://dri.freedesktop.org/libdrm/libdrm-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_HOST="toolchain:host" PKG_DEPENDS_TARGET="toolchain libpciaccess" PKG_LONGDESC="The userspace interface library to kernel DRM services." get_graphicdrivers -PKG_MESON_OPTS_TARGET="-Dnouveau=disabled \ +PKG_MESON_OPTS_COMMON="-Dnouveau=disabled \ -Domap=disabled \ -Dexynos=disabled \ -Dtegra=disabled \ @@ -21,9 +22,23 @@ PKG_MESON_OPTS_TARGET="-Dnouveau=disabled \ -Dman-pages=disabled \ -Dvalgrind=disabled \ -Dfreedreno-kgsl=false \ - -Dinstall-test-programs=true \ -Dudev=false" +PKG_MESON_OPTS_HOST="${PKG_MESON_OPTS_COMMON} \ + -Damdgpu=disabled \ + -Detnaviv=disabled \ + -Dfreedreno=disabled \ + -Dintel=disabled \ + -Dradeon=disabled \ + -Dvc4=disabled \ + -Dvmwgfx=disabled \ + -Dtests=false \ + -Dinstall-test-programs=false" + +PKG_MESON_OPTS_TARGET="${PKG_MESON_OPTS_COMMON} \ + -Dtests=true \ + -Dinstall-test-programs=true" + listcontains "${GRAPHIC_DRIVERS}" "(crocus|i915|iris)" && PKG_MESON_OPTS_TARGET+=" -Dintel=enabled" || PKG_MESON_OPTS_TARGET+=" -Dintel=disabled" From 13cbee4617f1943b51b9a2561e49ad32668b345f Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Sat, 25 May 2024 07:32:37 +0000 Subject: [PATCH 08/10] pycparser: initial package required by mesa-24.1.0 when building for NXP with etnaviv Co-authored-by: CvH <1355173+CvH@users.noreply.github.com> --- packages/python/devel/pycparser/package.mk | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 packages/python/devel/pycparser/package.mk diff --git a/packages/python/devel/pycparser/package.mk b/packages/python/devel/pycparser/package.mk new file mode 100644 index 0000000000..45e757101c --- /dev/null +++ b/packages/python/devel/pycparser/package.mk @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (C) 2024-present Team LibreELEC (https://libreelec.tv) + +PKG_NAME="pycparser" +PKG_VERSION="2.22" +PKG_SHA256="491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6" +PKG_LICENSE="BSD-3-Clause" +PKG_SITE="https://pypi.org/project/pycparser/" +PKG_URL="https://files.pythonhosted.org/packages/source/${PKG_NAME:0:1}/${PKG_NAME}/${PKG_NAME}-${PKG_VERSION}.tar.gz" +PKG_DEPENDS_HOST="Python3:host setuptools:host" +PKG_LONGDESC="Complete C99 parser in pure Python" +PKG_TOOLCHAIN="manual" + +makeinstall_host() { + export DONT_BUILD_LEGACY_PYC=1 + exec_thread_safe python3 setup.py install --prefix="${TOOLCHAIN}" +} From 68d0dbff84761e420103f5d1a8abadbbbe5090a8 Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Wed, 22 May 2024 23:28:24 +0000 Subject: [PATCH 09/10] mesa: update to 24.1.0 Co-authored-by: CvH <1355173+CvH@users.noreply.github.com> --- packages/graphics/mesa/package.mk | 34 +++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/packages/graphics/mesa/package.mk b/packages/graphics/mesa/package.mk index 1b29d22856..6ca56ba1a6 100644 --- a/packages/graphics/mesa/package.mk +++ b/packages/graphics/mesa/package.mk @@ -3,11 +3,12 @@ # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) PKG_NAME="mesa" -PKG_VERSION="24.0.8" -PKG_SHA256="d1ed86a266d5b7b8c136ae587ef5618ed1a9837a43440f3713622bf0123bf5c1" +PKG_VERSION="24.1.0" +PKG_SHA256="b7eac8c79244806b1c276eeeacc329e4a5b31a370804c4b0c7cd16837783f78b" PKG_LICENSE="OSS" PKG_SITE="http://www.mesa3d.org/" PKG_URL="https://mesa.freedesktop.org/archive/mesa-${PKG_VERSION}.tar.xz" +PKG_DEPENDS_HOST="toolchain:host expat:host libclc:host libdrm:host Mako:host spirv-tools:host" PKG_DEPENDS_TARGET="toolchain expat libdrm Mako:host" PKG_LONGDESC="Mesa is a 3-D graphics library with an API." @@ -17,13 +18,23 @@ if [ "${DEVICE}" = "Dragonboard" ]; then PKG_DEPENDS_TARGET+=" libarchive libxml2 lua54" fi +PKG_MESON_OPTS_HOST="-Dglvnd=disabled \ + -Dgallium-drivers=iris \ + -Dgallium-vdpau=disabled \ + -Dplatforms= \ + -Ddri3=disabled \ + -Dglx=disabled \ + -Dvulkan-drivers=" + PKG_MESON_OPTS_TARGET="-Dgallium-drivers=${GALLIUM_DRIVERS// /,} \ -Dgallium-extra-hud=false \ + -Dgallium-rusticl=false \ -Dgallium-omx=disabled \ -Dgallium-nine=false \ -Dgallium-opencl=disabled \ -Dshader-cache=enabled \ -Dshared-glapi=enabled \ + -Dopencl-spirv=false \ -Dopengl=true \ -Dgbm=enabled \ -Degl=enabled \ @@ -32,6 +43,7 @@ PKG_MESON_OPTS_TARGET="-Dgallium-drivers=${GALLIUM_DRIVERS// /,} \ -Dlmsensors=disabled \ -Dbuild-tests=false \ -Ddraw-use-llvm=false \ + -Dmicrosoft-clc=disabled \ -Dselinux=false \ -Dosmesa=false" @@ -52,11 +64,20 @@ else -Dglx=disabled" fi +if listcontains "${GRAPHIC_DRIVERS}" "etnaviv"; then + PKG_DEPENDS_TARGET+=" pycparser:host" +fi + +if listcontains "${GRAPHIC_DRIVERS}" "iris"; then + PKG_DEPENDS_TARGET+=" mesa:host" + PKG_MESON_OPTS_TARGET+=" -Dintel-clc=system" +fi + if listcontains "${GRAPHIC_DRIVERS}" "(nvidia|nvidia-ng)"; then PKG_DEPENDS_TARGET+=" libglvnd" - PKG_MESON_OPTS_TARGET+=" -Dglvnd=true" + PKG_MESON_OPTS_TARGET+=" -Dglvnd=enabled" else - PKG_MESON_OPTS_TARGET+=" -Dglvnd=false" + PKG_MESON_OPTS_TARGET+=" -Dglvnd=disabled" fi if [ "${LLVM_SUPPORT}" = "yes" ]; then @@ -99,3 +120,8 @@ if [ "${VULKAN_SUPPORT}" = "yes" ]; then else PKG_MESON_OPTS_TARGET+=" -Dvulkan-drivers=" fi + +makeinstall_host() { + mkdir -p "${TOOLCHAIN}/bin" + cp -a src/intel/compiler/intel_clc "${TOOLCHAIN}/bin" +} From 2682b903fdcc87100f7bb090a1f43f3b765d535e Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Sat, 25 May 2024 07:04:58 +0000 Subject: [PATCH 10/10] glslang: update unpack the spirv-tools is not a pristine directory, it is used for :host builds. extract the required subprojects from original tar files. Co-authored-by: CvH <1355173+CvH@users.noreply.github.com> --- packages/graphics/vulkan/glslang/package.mk | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/graphics/vulkan/glslang/package.mk b/packages/graphics/vulkan/glslang/package.mk index 3e89298c4a..9d2a354bd9 100644 --- a/packages/graphics/vulkan/glslang/package.mk +++ b/packages/graphics/vulkan/glslang/package.mk @@ -28,9 +28,14 @@ PKG_CMAKE_OPTS_COMMON="-DBUILD_EXTERNAL=ON \ post_unpack() { # Enables SPIR-V optimzer capability needed for ENABLE_OPT CMake build option + mkdir -p ${PKG_BUILD}/External/spirv-tools + tar --strip-components=1 \ + -xf "${SOURCES}/spirv-tools/spirv-tools-$(get_pkg_version spirv-tools).tar.gz" \ + -C "${PKG_BUILD}/External/spirv-tools" mkdir -p ${PKG_BUILD}/External/spirv-tools/external/spirv-headers - cp -R $(get_build_dir spirv-tools)/* ${PKG_BUILD}/External/spirv-tools - cp -R $(get_build_dir spirv-headers)/* ${PKG_BUILD}/External/spirv-tools/external/spirv-headers + tar --strip-components=1 \ + -xf "${SOURCES}/spirv-headers/spirv-headers-$(get_pkg_version spirv-headers).tar.gz" \ + -C "${PKG_BUILD}/External/spirv-tools/external/spirv-headers" } pre_configure_host() {