commit: e93b411163f3311e30771c26dc4e790bb98e25ea Author: Sv. Lockal <lockalsash <AT> gmail <DOT> com> AuthorDate: Thu Nov 27 17:38:36 2025 +0000 Commit: Sv. Lockal <lockalsash <AT> gmail <DOT> com> CommitDate: Thu Nov 27 17:38:40 2025 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=e93b4111
dev-util/xrt: new package, add 202610.2.21.21, 999999 See also: https://wiki.gentoo.org/wiki/User:Lockal/AMDXDNA Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com> dev-util/xrt/Manifest | 5 + dev-util/xrt/files/aiebu-no-downloads.patch | 21 +++ .../xrt-202520.2.20.172-modern-protobuf.patch | 57 ++++++++ dev-util/xrt/metadata.xml | 12 ++ dev-util/xrt/xrt-202610.2.21.21.ebuild | 152 +++++++++++++++++++++ dev-util/xrt/xrt-999999.ebuild | 152 +++++++++++++++++++++ 6 files changed, 399 insertions(+) diff --git a/dev-util/xrt/Manifest b/dev-util/xrt/Manifest new file mode 100644 index 0000000000..6db01ad7d5 --- /dev/null +++ b/dev-util/xrt/Manifest @@ -0,0 +1,5 @@ +DIST ELFIO-f849001f.tar.gz 6587989 BLAKE2B 8b8caf331f190bcd89e5647fc34f10abcfba21325eb58269174b9ceda47563dbacf965b4b13f9475044cfc4b58967762f05c2894c6e27e086eddb0dd0bc448ae SHA512 f5e4334db8765ab1b491ea8d06fcc0de6b52f8cf92fd178f7ab2840d3b0ef623ac12f40f702d2887c2fd7568d188b16ea8653849e4eb2e20061f44a98c30fe7e +DIST aie-rt-a8b06671.tar.gz 858418 BLAKE2B 4ec9c12ef3377baf6b17d9081c043b4cc9180a8a94ad1b5be5f15ce1a191cc534b5a128c7fcac55212e20f1d991e128d87282b6b794954cec1f1ca253f355ab3 SHA512 93e5d998a8f93b10aa588812ed9c38c3029d6f97702777372915aefe74113cfa430d3b60b8facf85877f07d1c234716a7f8080454a87fc3440fa6e364439201b +DIST aiebu-9065273e.tar.gz 18201124 BLAKE2B 59eca62198a79732c1a93d0532c63e965c944a978ae4349313d7f6dacd967842aa2451a1ed9e29f42be88612df77b986488fc14047354167c635fcbb6af5c0b1 SHA512 bd7eb639e1ce3b486b0146192e97a7d7156e9ac2ad56383a78aeba26e8eff29159bba590fb1d404f6ee38705a0fc68ff624e792d7bb9ba9f93c2cef062a99adf +DIST markdown_graphviz_svg-554d75e9.py 2959 BLAKE2B de085801483995665788290dd386ed1d47a0f45e8d1567ae129732edd408bd29709fc6d9112cbb229d56af66d41f616663f2cb0dbf7f64263db8288e663eb8a0 SHA512 38db8297f889a26c52b4bd8c738b7dd44b8b4f04f3572431f037c88c50d2d0134f6acbf8ce80824af037698809505983a554932bdbbe41dd03865ed4ba0968ce +DIST xrt-202610.2.21.21.tar.gz 14659455 BLAKE2B 5ec11abd3315ca144434d4aa3c88153bf1cda2fc1b9ef8fdc16231220d2c4b541090409c6f74116246d6a794f292c8a0dbb33afdd59aa021be45a09a92b65e04 SHA512 d3835e41de66e76a1817de407cb521fc9d7179ebf8b0ada19d3509b79256e09d56209030ecc052afc110dc68a1e0090b8d54d14ce8eee5def04ff2978aa6c6cb diff --git a/dev-util/xrt/files/aiebu-no-downloads.patch b/dev-util/xrt/files/aiebu-no-downloads.patch new file mode 100644 index 0000000000..9c658e5d55 --- /dev/null +++ b/dev-util/xrt/files/aiebu-no-downloads.patch @@ -0,0 +1,21 @@ +Fix for network-isolated builds +--- a/specification/CMakeLists.txt ++++ b/specification/CMakeLists.txt +@@ -1,5 +1,6 @@ + # SPDX-License-Identifier: MIT + # Copyright (C) 2023 Advanced Micro Devices, Inc. ++if(NOT SPEC_TOOL_DEPS_DOWNLOADED) + if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + add_custom_target(spec-tool-deps + COMMAND wget -q -O markdown_graphviz_svg.py +@@ -15,6 +16,10 @@ else() + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + endif() ++else() ++ add_custom_target(spec-tool-deps) ++endif() ++ + + set(SPEC_PYTHON_PATH ${CMAKE_CURRENT_BINARY_DIR}) + diff --git a/dev-util/xrt/files/xrt-202520.2.20.172-modern-protobuf.patch b/dev-util/xrt/files/xrt-202520.2.20.172-modern-protobuf.patch new file mode 100644 index 0000000000..16ca499420 --- /dev/null +++ b/dev-util/xrt/files/xrt-202520.2.20.172-modern-protobuf.patch @@ -0,0 +1,57 @@ +Use modern way of linking to protobuf, otherwise it fails on abseil. +Old way requires to propagate abseil micro-libraries via INTERFACE dependencies. +--- a/src/runtime_src/core/tools/xbtracer/CMakeLists.txt ++++ b/src/runtime_src/core/tools/xbtracer/CMakeLists.txt +@@ -10,7 +10,7 @@ else (POLICY CMP0144) + return() + endif () + +-find_package(Protobuf) ++find_package(Protobuf CONFIG) + if (NOT Protobuf_FOUND) + message("Protobuf is not found, skipping xbtracer") + return() +@@ -31,12 +31,10 @@ file(GLOB PROTO_SRC_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/src/*.proto" + ) + +-PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${PROTO_SRC_FILES}) +- +-add_custom_target(xbtracer_generated_code DEPENDS ${ProtoSources} ${ProtoHeaders}) +- +-add_library(xbtracer_protobuf STATIC ${ProtoSources} ${ProtoHeaders}) +-add_dependencies(xbtracer_protobuf xbtracer_generated_code) ++add_library(xbtracer_protobuf STATIC ${PROTO_SRC_FILES}) ++protobuf_generate(TARGET xbtracer_protobuf) ++target_link_libraries(xbtracer_protobuf PRIVATE protobuf::libprotobuf) ++target_include_directories(xbtracer_protobuf PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/src) + if (MSVC) + target_compile_options(xbtracer_protobuf PRIVATE /wd4244 /wd4267) + endif(MSVC) +@@ -63,7 +61,7 @@ add_library(xrt_trace SHARED ${XBTRACER_WRAPPER_SRC_FILES} ${ProtoHeaders}) + set_target_properties(xrt_trace PROPERTIES VERSION ${XRT_VERSION_STRING} SOVERSION ${XRT_SOVERSION}) + target_compile_definitions(xrt_trace PRIVATE XRT_ABI_VERSION=${XRT_VERSION_MAJOR}) + +-target_link_libraries(xrt_trace PRIVATE xbtracer_common xbtracer_protobuf ${Protobuf_LIBRARIES} xrt_coreutil) ++target_link_libraries(xrt_trace PRIVATE xbtracer_common xbtracer_protobuf xrt_coreutil) + add_dependencies(xrt_trace xbtracer_common xbtracer_protobuf xrt_coreutil) + + file(GLOB XBTRACER_CAPTURE_SRC_FILES +@@ -78,7 +76,7 @@ file(GLOB XBREPLAY_SRC_FILES + "${CMAKE_CURRENT_SOURCE_DIR}/src/replay/*.cpp" + ) + add_executable(xrt-replay ${XBREPLAY_SRC_FILES}) +-target_link_libraries(xrt-replay PRIVATE xbtracer_common xbtracer_protobuf ${Protobuf_LIBRARIES} xrt_coreutil) ++target_link_libraries(xrt-replay PRIVATE xbtracer_common xbtracer_protobuf xrt_coreutil) + if (NOT WIN32) + target_link_libraries(xrt-replay PRIVATE pthread) + endif (NOT WIN32) +@@ -94,7 +92,7 @@ if (XRT_XBTRACER_ENABLE_JSON) + add_executable(xbtracer_dump + src/misc/xbtracer_dump.cpp + ) +- target_link_libraries(xbtracer_dump PRIVATE xbtracer_common xbtracer_protobuf ${Protobuf_LIBRARIES}) ++ target_link_libraries(xbtracer_dump PRIVATE xbtracer_common xbtracer_protobuf) + add_dependencies(xbtracer_dump xbtracer_common xbtracer_protobuf xrt_coreutil) + endif (XRT_XBTRACER_ENABLE_JSON) + diff --git a/dev-util/xrt/metadata.xml b/dev-util/xrt/metadata.xml new file mode 100644 index 0000000000..99960fb1b1 --- /dev/null +++ b/dev-util/xrt/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>[email protected]</email> + <name>Sv. Lockal</name> + </maintainer> + <upstream> + <bugs-to>https://github.com/Xilinx/XRT/issues</bugs-to> + <remote-id type="github">Xilinx/XRT</remote-id> + </upstream> +</pkgmetadata> \ No newline at end of file diff --git a/dev-util/xrt/xrt-202610.2.21.21.ebuild b/dev-util/xrt/xrt-202610.2.21.21.ebuild new file mode 100644 index 0000000000..cedef456cf --- /dev/null +++ b/dev-util/xrt/xrt-202610.2.21.21.ebuild @@ -0,0 +1,152 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..14} ) +inherit bash-completion-r1 cmake python-any-r1 + +declare -A submodules +submodules["src/runtime_src/aie-rt"]=https://github.com/Xilinx/aie-rt.git@a8b0667133ea2851ce27793a1796c5968226d9af +submodules["src/runtime_src/core/common/aiebu"]=https://github.com/Xilinx/aiebu.git@9065273e0c0a4ac5930fff904ac245cf38dd3087 +submodules["src/runtime_src/core/common/elf"]=https://github.com/serge1/ELFIO.git@f849001fc229c2598f8557e0df22866af194ef98 + +DESCRIPTION="Runtime for AIE and FPGA based platforms" +HOMEPAGE="https://github.com/Xilinx/XRT" + +MGS_HASH=554d75e924ed621f23d077b0495c247c329bc770 +MGS=markdown_graphviz_svg +MGS_PY=${MGS}-${MGS_HASH:0:8}.py + +if [[ ${PV} == 999999 ]] ; then + EGIT_REPO_URI="https://github.com/Xilinx/XRT.git" + EGIT_SUBMODULES=( + src/runtime_src/aie-rt + src/runtime_src/core/common/aiebu + src/runtime_src/core/common/elf + ) + inherit git-r3 +else + SRC_URI=" + https://github.com/Xilinx/XRT/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz + https://raw.githubusercontent.com/Tanami/markdown-graphviz-svg/${MGS_HASH}/src/${MGS}/${MGS}.py -> ${MGS_PY} + " + for k in "${!submodules[@]}"; do + git_url="${submodules[$k]%@*}" + commit_hash="${submodules[$k]#*@}" + url_prefix="${git_url%.git}" + SRC_URI+=" ${url_prefix}/archive/${commit_hash}.tar.gz -> ${url_prefix##*/}-${commit_hash:0:8}.tar.gz"; + done + + KEYWORDS="~amd64" + S="${WORKDIR}/XRT-${PV}" +fi + +LICENSE="Apache-2.0" +SLOT="0" + +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND=" + dev-cpp/abseil-cpp:= + dev-debug/systemtap + dev-libs/boost:= + dev-libs/openssl:= + dev-libs/protobuf:= + sys-apps/util-linux +" + +DEPEND=" + ${RDEPEND} + dev-libs/cxxopts + dev-libs/opencl-icd-loader + dev-libs/rapidjson + dev-util/opencl-headers + x11-libs/libdrm +" + +BDEPEND=" + ${PYTHON_DEPS} + $(python_gen_any_dep " + dev-python/jinja2[\${PYTHON_USEDEP}] + dev-python/markdown[\${PYTHON_USEDEP}] + dev-python/pybind11[\${PYTHON_USEDEP}] + dev-python/pyyaml[\${PYTHON_USEDEP}] + ") +" + +PATCHES=( + "${FILESDIR}"/${PN}-202520.2.20.172-modern-protobuf.patch +) + +python_check_deps() { + python_has_version -b "dev-python/jinja2[${PYTHON_USEDEP}]" && \ + python_has_version -b "dev-python/markdown[${PYTHON_USEDEP}]" && \ + python_has_version -b "dev-python/pybind11[${PYTHON_USEDEP}]" && \ + python_has_version -b "dev-python/pyyaml[${PYTHON_USEDEP}]" +} + +src_prepare() { + if [[ ${PV} != 999999 ]] ; then + for k in $(printf '%s\n' "${!submodules[@]}" | sort); do + git_url="${submodules[$k]%@*}" + commit_hash="${submodules[$k]#*@}" + url_prefix="${git_url%.git}" + rm -r "$k" || die + ln -s "${WORKDIR}/${url_prefix##*/}-${commit_hash}" "$k" || die + done + fi + + pushd "src/runtime_src/core/common/aiebu" || die + eapply "${FILESDIR}"/aiebu-no-downloads.patch + popd || die + + sed -e 's/-Werror//' -i src/runtime_src/core/common/aiebu/cmake/linux.cmake || die + + # Enable <CL/cl_icd.h> instead of <ocl_icd.h> + sed -e "/OPENCL_ICD_LOADER/c #if 1" \ + -i src/runtime_src/xocl/api/icd/ocl_icd_bindings.h \ + -i src/runtime_src/xocl/api/icd/ocl_icd_bindings.cpp || die + + # template for isa.h is damaged in git, skip regeneration + # Bug: https://github.com/Xilinx/aiebu/issues/144 + sed -e '/BYPRODUCTS .*isa\.h/d' \ + -i src/runtime_src/core/common/aiebu/specification/aie2ps/CMakeLists.txt || die + + sed -e "s/set (XRT_UPSTREAM 0)/set (XRT_UPSTREAM 1)/" -i src/CMake/settings.cmake || die + + sed -e "s|\${XRT_INSTALL_DIR}/share/doc|\${CMAKE_INSTALL_DOCDIR}|" -i src/CMake/changelog.cmake || die + + cmake_src_prepare +} + +src_configure() { + local mycmakeargs=( + -DCMAKE_INSTALL_PREFIX="${EPREFIX}"/usr + -DPython3_EXECUTABLE="${PYTHON}" + -DSPEC_TOOL_DEPS_DOWNLOADED=ON + -DXRT_ENABLE_WERROR=OFF + -DXRT_NPU=ON + ) + [[ ${PV} != 999999 ]] && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON ) + + cmake_src_configure + + ln -s "${DISTDIR}/${MGS_PY}" \ + "${BUILD_DIR}"/src/runtime_src/core/common/aiebu/specification/${MGS}.py || die +} + +src_test() { + DESTDIR=. cmake_build install + cmake_src_test +} + +src_install() { + cmake_src_install + + rm -r "${ED}"/usr/{license,version.json} || die + rm -r "${ED}"/usr/share/completions || die + + newbashcomp "${S}/src/runtime_src/core/tools/xbutil2/xbutil-bash-completion" xrt-smi +} diff --git a/dev-util/xrt/xrt-999999.ebuild b/dev-util/xrt/xrt-999999.ebuild new file mode 100644 index 0000000000..cedef456cf --- /dev/null +++ b/dev-util/xrt/xrt-999999.ebuild @@ -0,0 +1,152 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..14} ) +inherit bash-completion-r1 cmake python-any-r1 + +declare -A submodules +submodules["src/runtime_src/aie-rt"]=https://github.com/Xilinx/aie-rt.git@a8b0667133ea2851ce27793a1796c5968226d9af +submodules["src/runtime_src/core/common/aiebu"]=https://github.com/Xilinx/aiebu.git@9065273e0c0a4ac5930fff904ac245cf38dd3087 +submodules["src/runtime_src/core/common/elf"]=https://github.com/serge1/ELFIO.git@f849001fc229c2598f8557e0df22866af194ef98 + +DESCRIPTION="Runtime for AIE and FPGA based platforms" +HOMEPAGE="https://github.com/Xilinx/XRT" + +MGS_HASH=554d75e924ed621f23d077b0495c247c329bc770 +MGS=markdown_graphviz_svg +MGS_PY=${MGS}-${MGS_HASH:0:8}.py + +if [[ ${PV} == 999999 ]] ; then + EGIT_REPO_URI="https://github.com/Xilinx/XRT.git" + EGIT_SUBMODULES=( + src/runtime_src/aie-rt + src/runtime_src/core/common/aiebu + src/runtime_src/core/common/elf + ) + inherit git-r3 +else + SRC_URI=" + https://github.com/Xilinx/XRT/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz + https://raw.githubusercontent.com/Tanami/markdown-graphviz-svg/${MGS_HASH}/src/${MGS}/${MGS}.py -> ${MGS_PY} + " + for k in "${!submodules[@]}"; do + git_url="${submodules[$k]%@*}" + commit_hash="${submodules[$k]#*@}" + url_prefix="${git_url%.git}" + SRC_URI+=" ${url_prefix}/archive/${commit_hash}.tar.gz -> ${url_prefix##*/}-${commit_hash:0:8}.tar.gz"; + done + + KEYWORDS="~amd64" + S="${WORKDIR}/XRT-${PV}" +fi + +LICENSE="Apache-2.0" +SLOT="0" + +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND=" + dev-cpp/abseil-cpp:= + dev-debug/systemtap + dev-libs/boost:= + dev-libs/openssl:= + dev-libs/protobuf:= + sys-apps/util-linux +" + +DEPEND=" + ${RDEPEND} + dev-libs/cxxopts + dev-libs/opencl-icd-loader + dev-libs/rapidjson + dev-util/opencl-headers + x11-libs/libdrm +" + +BDEPEND=" + ${PYTHON_DEPS} + $(python_gen_any_dep " + dev-python/jinja2[\${PYTHON_USEDEP}] + dev-python/markdown[\${PYTHON_USEDEP}] + dev-python/pybind11[\${PYTHON_USEDEP}] + dev-python/pyyaml[\${PYTHON_USEDEP}] + ") +" + +PATCHES=( + "${FILESDIR}"/${PN}-202520.2.20.172-modern-protobuf.patch +) + +python_check_deps() { + python_has_version -b "dev-python/jinja2[${PYTHON_USEDEP}]" && \ + python_has_version -b "dev-python/markdown[${PYTHON_USEDEP}]" && \ + python_has_version -b "dev-python/pybind11[${PYTHON_USEDEP}]" && \ + python_has_version -b "dev-python/pyyaml[${PYTHON_USEDEP}]" +} + +src_prepare() { + if [[ ${PV} != 999999 ]] ; then + for k in $(printf '%s\n' "${!submodules[@]}" | sort); do + git_url="${submodules[$k]%@*}" + commit_hash="${submodules[$k]#*@}" + url_prefix="${git_url%.git}" + rm -r "$k" || die + ln -s "${WORKDIR}/${url_prefix##*/}-${commit_hash}" "$k" || die + done + fi + + pushd "src/runtime_src/core/common/aiebu" || die + eapply "${FILESDIR}"/aiebu-no-downloads.patch + popd || die + + sed -e 's/-Werror//' -i src/runtime_src/core/common/aiebu/cmake/linux.cmake || die + + # Enable <CL/cl_icd.h> instead of <ocl_icd.h> + sed -e "/OPENCL_ICD_LOADER/c #if 1" \ + -i src/runtime_src/xocl/api/icd/ocl_icd_bindings.h \ + -i src/runtime_src/xocl/api/icd/ocl_icd_bindings.cpp || die + + # template for isa.h is damaged in git, skip regeneration + # Bug: https://github.com/Xilinx/aiebu/issues/144 + sed -e '/BYPRODUCTS .*isa\.h/d' \ + -i src/runtime_src/core/common/aiebu/specification/aie2ps/CMakeLists.txt || die + + sed -e "s/set (XRT_UPSTREAM 0)/set (XRT_UPSTREAM 1)/" -i src/CMake/settings.cmake || die + + sed -e "s|\${XRT_INSTALL_DIR}/share/doc|\${CMAKE_INSTALL_DOCDIR}|" -i src/CMake/changelog.cmake || die + + cmake_src_prepare +} + +src_configure() { + local mycmakeargs=( + -DCMAKE_INSTALL_PREFIX="${EPREFIX}"/usr + -DPython3_EXECUTABLE="${PYTHON}" + -DSPEC_TOOL_DEPS_DOWNLOADED=ON + -DXRT_ENABLE_WERROR=OFF + -DXRT_NPU=ON + ) + [[ ${PV} != 999999 ]] && mycmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Git=ON ) + + cmake_src_configure + + ln -s "${DISTDIR}/${MGS_PY}" \ + "${BUILD_DIR}"/src/runtime_src/core/common/aiebu/specification/${MGS}.py || die +} + +src_test() { + DESTDIR=. cmake_build install + cmake_src_test +} + +src_install() { + cmake_src_install + + rm -r "${ED}"/usr/{license,version.json} || die + rm -r "${ED}"/usr/share/completions || die + + newbashcomp "${S}/src/runtime_src/core/tools/xbutil2/xbutil-bash-completion" xrt-smi +}
