commit:     7f9224da75c864396af5693c2e5b3dbbd0f529c1
Author:     YiyangWu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Thu Jul 15 15:19:15 2021 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Fri Aug 13 05:08:09 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f9224da

dev-util/hip: bump version to 4.2.0

Update hip-3.5.1-config-cmake-in.patch to 4.2.0
lpl_ca removed, so hip-3.9.0-lpl_ca-add-include.patch not used
fill version into hipvars.pm at src_prepare
fix sandbox violation issue
remove linker flag -rpath in hipcc
correct profiling api header location and profile use flag settings

Closes: https://bugs.gentoo.org/799257
Closes: https://github.com/gentoo/gentoo/pull/21655

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 dev-util/hip/Manifest                              |  1 +
 .../hip-4.2.0-cancel-hcc-header-removal.patch      | 18 ++++++++++++++++
 dev-util/hip/files/hip-4.2.0-config-cmake-in.patch | 15 +++++++++++++
 dev-util/hip/files/hipvars.pm                      |  7 +++---
 dev-util/hip/hip-4.1.0-r1.ebuild                   |  2 ++
 .../hip/{hip-4.1.0-r1.ebuild => hip-4.2.0.ebuild}  | 25 +++++++++++++---------
 6 files changed, 55 insertions(+), 13 deletions(-)

diff --git a/dev-util/hip/Manifest b/dev-util/hip/Manifest
index fb6e7126f26..272ac83deb9 100644
--- a/dev-util/hip/Manifest
+++ b/dev-util/hip/Manifest
@@ -1,2 +1,3 @@
 DIST rocm-hip-4.0.0.tar.gz 1012154 BLAKE2B 
02343239a5b27c42dafd241f2c9b6f5195c50f78bfd717ae72bcb16d384bd6cf97ff6f2b86bfcf323aaaf022d6897f46d0987826c80d6f6279be4cb4792e15be
 SHA512 
cf840dbe28a9a15e3be14351bfa22d3c81e1654813a7aee55f53e71b2ee183f8dd0de14a79791617fabb5b357cadbf2ce2f476f78884b2843d30f206d65088f6
 DIST rocm-hip-4.1.0.tar.gz 954215 BLAKE2B 
c4b75ab2158e6921be1c34820ab5d1a5e2eb36112834b0143c50023caa27de384e0497f4837947cc7fe05554c6c95201340b1979eb916b31ebb4ffec8c923735
 SHA512 
420ffd7b79e2b4506873cbfc56e96395f8ed9d9375ce28df51626601199d4d8dca6920528e255d39a48ad66ee11f4b653f3b9f659df489d32b21886fb86c64b5
+DIST rocm-hip-4.2.0.tar.gz 918281 BLAKE2B 
45c28289c8ff9e600bfd9daff8af162c897fcfdf41ce65d91d1761d58253d87a6385fd4a15e818619ca39d3413479bf043ab2758fead349a243105e979b64f7c
 SHA512 
e620507321c949ded2eab6159099eef0eab267eb686b6ee0ed86022fffaa51fb8714a7f344b79acf76c876c55919360905d1bb3a7c00a87f40174774d6682ce8

diff --git a/dev-util/hip/files/hip-4.2.0-cancel-hcc-header-removal.patch 
b/dev-util/hip/files/hip-4.2.0-cancel-hcc-header-removal.patch
new file mode 100644
index 00000000000..08e0f3a3d4e
--- /dev/null
+++ b/dev-util/hip/files/hip-4.2.0-cancel-hcc-header-removal.patch
@@ -0,0 +1,18 @@
+hcc now deprecated by ROCm upstream. They use cmake to delete hcc headers for 
upgrating hip on other distros, 
+but Gentoo don't need this and the following code causes sandbox violation 
(#799257).
+
+github.com/ROCm-Developer-Tools/HIP/commit/c2adc70d4df3d30ef0db84d47be14b99b01aa340
 introduce these lines.
+
+--- orig/CMakeLists.txt
++++ HIP-rocm-4.2.0/CMakeLists.txt
+@@ -333,10 +333,6 @@ if(NOT ${INSTALL_SOURCE} EQUAL 0)
+     endif()
+     install(DIRECTORY bin DESTINATION . USE_SOURCE_PERMISSIONS)
+ 
+-    # The following two lines will be removed after upstream updation
+-    install(CODE "MESSAGE(\"Removing ${CMAKE_INSTALL_PREFIX}/include\")")
+-    install(CODE "file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/include)")
+-
+     install(DIRECTORY include DESTINATION .)
+     install(DIRECTORY cmake DESTINATION .)
+ endif()

diff --git a/dev-util/hip/files/hip-4.2.0-config-cmake-in.patch 
b/dev-util/hip/files/hip-4.2.0-config-cmake-in.patch
new file mode 100644
index 00000000000..12644828af7
--- /dev/null
+++ b/dev-util/hip/files/hip-4.2.0-config-cmake-in.patch
@@ -0,0 +1,15 @@
+since _IMPORT_PREFIX=/opt/gentoo/usr/lib/hip, INTERFACE_INCLUDE_DIRECTORIES 
should change
+
+--- orig/hip-config.cmake.in
++++ HIP-rocm-4.2.0/hip-config.cmake.in
+@@ -185,8 +185,8 @@ if(HIP_RUNTIME MATCHES "rocclr")
+ 
+   if(NOT WIN32)
+     set_target_properties(hip::device PROPERTIES
+-      INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../include"
+-      INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../include"
++      INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
++      INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
+     )
+   endif()
+ endif()

diff --git a/dev-util/hip/files/hipvars.pm b/dev-util/hip/files/hipvars.pm
index 3f5c88409e0..4c614080a11 100644
--- a/dev-util/hip/files/hipvars.pm
+++ b/dev-util/hip/files/hipvars.pm
@@ -1,9 +1,10 @@
 #!/usr/bin/perl -w
 package hipvars;
 
-$HIP_BASE_VERSION_MAJOR = "4";
-$HIP_BASE_VERSION_MINOR = "1";
+$HIP_BASE_VERSION_MAJOR = "@HIP_BASE_VERSION_MAJOR@";
+$HIP_BASE_VERSION_MINOR = "@HIP_BASE_VERSION_MINOR@";
 
+$isWindows = 0;
 $HIP_PATH='/usr/lib/hip';
 $ROCM_PATH='/usr';
 $CUDA_PATH='/opt/cuda';
@@ -15,5 +16,5 @@ $HIP_COMPILER = "clang";
 $HIP_RUNTIME = "rocclr";
 $HIP_VERSION_MAJOR = $HIP_BASE_VERSION_MAJOR;
 $HIP_VERSION_MINOR = $HIP_BASE_VERSION_MINOR;
-$HIP_VERSION_PATCH = "0";
+$HIP_VERSION_PATCH = "@HIP_VERSION_PATCH@";
 $HIP_VERSION="$HIP_VERSION_MAJOR.$HIP_VERSION_MINOR.$HIP_VERSION_PATCH";

diff --git a/dev-util/hip/hip-4.1.0-r1.ebuild b/dev-util/hip/hip-4.1.0-r1.ebuild
index 827305877f9..15d5bfcd3e3 100644
--- a/dev-util/hip/hip-4.1.0-r1.ebuild
+++ b/dev-util/hip/hip-4.1.0-r1.ebuild
@@ -59,6 +59,8 @@ src_prepare() {
        hprefixify $(grep -rl --exclude-dir=build/ "/usr" "${S}")
 
        cp "$(prefixify_ro "${FILESDIR}"/hipvars.pm)" bin/ || die "failed to 
replace hipvars.pm"
+       sed -e "s,@HIP_BASE_VERSION_MAJOR@,$(ver_cut 1)," -e 
"s,@HIP_BASE_VERSION_MINOR@,$(ver_cut 2)," \
+               -e "s,@HIP_VERSION_PATCH@,$(ver_cut 3)," -i bin/hipvars.pm || 
die
 }
 
 src_configure() {

diff --git a/dev-util/hip/hip-4.1.0-r1.ebuild b/dev-util/hip/hip-4.2.0.ebuild
similarity index 80%
copy from dev-util/hip/hip-4.1.0-r1.ebuild
copy to dev-util/hip/hip-4.2.0.ebuild
index 827305877f9..20017c51534 100644
--- a/dev-util/hip/hip-4.1.0-r1.ebuild
+++ b/dev-util/hip/hip-4.2.0.ebuild
@@ -19,14 +19,16 @@ RESTRICT="strip"
 
 DEPEND="dev-libs/rocclr:${SLOT}
        dev-util/rocminfo:${SLOT}
-       =sys-devel/llvm-roc-${PV}*[runtime]"
+       =sys-devel/llvm-roc-${PV}*[runtime]
+       profile? ( dev-util/roctracer:${SLOT} )"
 RDEPEND="${DEPEND}"
 
 PATCHES=(
        "${FILESDIR}/${PN}-4.1.0-DisableTest.patch"
        "${FILESDIR}/${PN}-3.9.0-add-include-directories.patch"
-       "${FILESDIR}/${PN}-3.5.1-config-cmake-in.patch"
-       "${FILESDIR}/${PN}-3.9.0-lpl_ca-add-include.patch"
+       "${FILESDIR}/${PN}-4.2.0-config-cmake-in.patch"
+       "${FILESDIR}/${PN}-3.5.1-hip_vector_types.patch"
+       "${FILESDIR}/${PN}-4.2.0-cancel-hcc-header-removal.patch"
 )
 
 S="${WORKDIR}/HIP-rocm-${PV}"
@@ -41,11 +43,15 @@ src_prepare() {
        # disable PCH, because it results in a build error in ROCm 4.0.0
        sed -e "s:option(__HIP_ENABLE_PCH:#option(__HIP_ENABLE_PCH:" -i 
CMakeLists.txt || die
 
+       # remove forcing set USE_PROF_API to 1
+       sed -e '/set(USE_PROF_API "1")/d' -i rocclr/CMakeLists.txt || die
+
        # "hcc" is deprecated and not installed, new platform is "rocclr";
        # Setting HSA_PATH to "/usr" results in setting "-isystem /usr/include"
        # which makes "stdlib.h" not found when using "#include_next" in header 
files;
        sed -e "/FLAGS .= \" -isystem \$HSA_PATH/d" \
                -e "s:\$ENV{'DEVICE_LIB_PATH'}:'/usr/lib/amdgcn/bitcode':" \
+               -e "/rpath/s,--rpath=[^ ]*,," \
                -i bin/hipcc || die
 
        # correctly find HIP_CLANG_INCLUDE_PATH using cmake
@@ -59,17 +65,13 @@ src_prepare() {
        hprefixify $(grep -rl --exclude-dir=build/ "/usr" "${S}")
 
        cp "$(prefixify_ro "${FILESDIR}"/hipvars.pm)" bin/ || die "failed to 
replace hipvars.pm"
+       sed -e "s,@HIP_BASE_VERSION_MAJOR@,$(ver_cut 1)," -e 
"s,@HIP_BASE_VERSION_MINOR@,$(ver_cut 2)," \
+               -e "s,@HIP_VERSION_PATCH@,$(ver_cut 3)," -i bin/hipvars.pm || 
die
 }
 
 src_configure() {
        strip-flags
-       if ! use debug; then
-               append-cflags "-DNDEBUG"
-               append-cxxflags "-DNDEBUG"
-               buildtype="Release"
-       else
-               buildtype="Debug"
-       fi
+       use debug && CMAKE_BUILD_TYPE="Debug"
 
        # TODO: Currently a GENTOO configuration is build,
        # this is also used in the cmake configuration files
@@ -86,6 +88,7 @@ src_configure() {
                -DROCM_PATH="${EPREFIX}/usr"
                -DHSA_PATH="${EPREFIX}/usr"
                -DUSE_PROF_API=$(usex profile 1 0)
+               -DPROF_API_HEADER_PATH="${EPREFIX}"/usr/include/roctracer/ext
                -DROCclr_DIR="${EPREFIX}"/usr/include/rocclr
        )
 
@@ -100,4 +103,6 @@ src_install() {
        doenvd 99hip
 
        cmake_src_install
+
+       rm "${ED}/usr/lib/hip/include/hip/hcc_detail" || die
 }

Reply via email to