From f4843faeec045bbda303f78da6fa7e4fe29b85c2 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Fri, 20 Mar 2020 21:35:32 -0500 Subject: [PATCH] Fix Debian package build on CPack 3.10. CPack now incorrectly adds two copies of directory symlinks when building Debian packages. This causes dpkg to see a file conflict and fail installing. The correct long term solution is to remove the symlink and use a flat directory structure. This patch adds the symlink in the post install script as a workaround until we can switch to flat layout. Change-Id: I879b6cbc2661c19df3db639cb42fba0972fddb93 [ROCm/ROCR-Runtime commit: f3b532b42dcde369eb876c6bfa25ae460680fe0e] --- .../runtime/hsa-runtime/CMakeLists.txt | 15 ++++++++++----- .../runtime/hsa-runtime/DEBIAN/postinst | 2 ++ .../rocr-runtime/runtime/hsa-runtime/DEBIAN/prerm | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/CMakeLists.txt b/projects/rocr-runtime/runtime/hsa-runtime/CMakeLists.txt index 642bd09a6c..2aa3f1788d 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/CMakeLists.txt +++ b/projects/rocr-runtime/runtime/hsa-runtime/CMakeLists.txt @@ -185,15 +185,20 @@ add_custom_target ( hsa_lib_link ALL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DI add_custom_target ( hsa_lib_link2 ALL WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E create_symlink ../hsa/lib/${CORE_RUNTIME_LIBRARY}.so.${SO_MAJOR} ${CORE_RUNTIME_LIBRARY}-link.so.${SO_MAJOR} ) ## Set install information -install ( TARGETS ${CORE_RUNTIME_TARGET} LIBRARY DESTINATION hsa/lib ) -install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/inc/ DESTINATION hsa/include/hsa ) -install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/hsa_include_link DESTINATION include PERMISSIONS OWNER_WRITE OWNER_READ RENAME hsa ) -install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_RUNTIME_LIBRARY}-link.so DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ RENAME ${CORE_RUNTIME_LIBRARY}.so ) -install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_RUNTIME_LIBRARY}-link.so.${SO_MAJOR} DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ RENAME ${CORE_RUNTIME_LIBRARY}.so.${SO_MAJOR} ) +install ( TARGETS ${CORE_RUNTIME_TARGET} LIBRARY DESTINATION hsa/lib COMPONENT binary) +install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/inc/ DESTINATION hsa/include/hsa COMPONENT binary) +install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/hsa_include_link DESTINATION include PERMISSIONS OWNER_WRITE OWNER_READ RENAME hsa COMPONENT dirlink) +install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_RUNTIME_LIBRARY}-link.so DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ RENAME ${CORE_RUNTIME_LIBRARY}.so COMPONENT binary) +install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/${CORE_RUNTIME_LIBRARY}-link.so.${SO_MAJOR} DESTINATION lib PERMISSIONS OWNER_WRITE OWNER_READ RENAME ${CORE_RUNTIME_LIBRARY}.so.${SO_MAJOR} COMPONENT binary) ## Packaging directives set ( CPACK_GENERATOR "DEB;RPM" CACHE STRING "Package types to build") +## Only pack the "binary" components, post install script will add the directory link. +set (CPACK_DEB_COMPONENT_INSTALL ON) +set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) +set (CPACK_COMPONENTS_ALL binary) + set ( CPACK_PACKAGE_NAME "hsa-rocr-dev" ) set ( CPACK_PACKAGE_VENDOR "AMD" ) set ( CPACK_PACKAGE_VERSION ${PACKAGE_VERSION_STRING} ) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/DEBIAN/postinst b/projects/rocr-runtime/runtime/hsa-runtime/DEBIAN/postinst index 769a72e462..4a28ba94f3 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/DEBIAN/postinst +++ b/projects/rocr-runtime/runtime/hsa-runtime/DEBIAN/postinst @@ -9,6 +9,8 @@ do_ldconfig() { case "$1" in configure) do_ldconfig + mkdir -p /opt/rocm/include + ln -s ../hsa/include/hsa /opt/rocm/include/hsa ;; abort-upgrade|abort-remove|abort-deconfigure) echo "$1" diff --git a/projects/rocr-runtime/runtime/hsa-runtime/DEBIAN/prerm b/projects/rocr-runtime/runtime/hsa-runtime/DEBIAN/prerm index 2b7d50a825..23c416a055 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/DEBIAN/prerm +++ b/projects/rocr-runtime/runtime/hsa-runtime/DEBIAN/prerm @@ -9,6 +9,7 @@ rm_ldconfig() { case "$1" in remove) rm_ldconfig + rm /opt/rocm/include/hsa ;; purge) ;;