diff --git a/projects/rocprofiler/CMakeLists.txt b/projects/rocprofiler/CMakeLists.txt index 2f757df145..6f0b7bf47c 100644 --- a/projects/rocprofiler/CMakeLists.txt +++ b/projects/rocprofiler/CMakeLists.txt @@ -179,6 +179,7 @@ install ( FILES ${PROJECT_BINARY_DIR}/rocprof-link DESTINATION bin ## Packaging directives set ( CPACK_GENERATOR "DEB" "RPM" "TGZ" ) +set ( ENABLE_LDCONFIG ON CACHE BOOL "Set library links and caches using ldconfig.") set ( CPACK_PACKAGE_NAME "${ROCPROFILER_NAME}-dev" ) set ( CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc." ) set ( CPACK_PACKAGE_VERSION_MAJOR ${BUILD_VERSION_MAJOR} ) @@ -203,7 +204,10 @@ endif() message ( "Using CPACK_DEBIAN_PACKAGE_RELEASE ${CPACK_DEBIAN_PACKAGE_RELEASE}" ) set ( CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT" ) set ( CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr-dev" ) -set ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/postinst;${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/prerm" ) +## Process the Debian install/remove scripts to update the CPACK variables +configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/postinst.in DEBIAN/postinst @ONLY ) +configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/prerm.in DEBIAN/prerm @ONLY ) +set ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "DEBIAN/postinst;DEBIAN/prerm" ) ## RPM package specific variables if ( DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE} ) @@ -225,7 +229,11 @@ if ( PROC_RESULT EQUAL "0" AND NOT EVAL_RESULT STREQUAL "" ) endif() set ( CPACK_RPM_FILE_NAME "RPM-DEFAULT" ) set ( CPACK_RPM_PACKAGE_DEPENDS "hsa-rocr-dev" ) -set ( CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/RPM/rpm_post" ) -set ( CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/RPM/rpm_postun" ) +## Process the Rpm install/remove scripts to update the CPACK variables +configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/RPM/post.in" RPM/post @ONLY ) +configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/RPM/postun.in" RPM/postun @ONLY ) + +set ( CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/RPM/post" ) +set ( CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/RPM/postun" ) include ( CPack ) diff --git a/projects/rocprofiler/DEBIAN/postinst b/projects/rocprofiler/DEBIAN/postinst deleted file mode 100644 index abec93b9c7..0000000000 --- a/projects/rocprofiler/DEBIAN/postinst +++ /dev/null @@ -1,19 +0,0 @@ -#/bin/bash - -set -e - -do_ldconfig() { - echo /opt/rocm/rocprofiler/lib > /etc/ld.so.conf.d/librocprofiler64.conf && ldconfig -} - -case "$1" in - configure) - do_ldconfig - ;; - abort-upgrade|abort-remove|abort-deconfigure) - echo "$1" - ;; - *) - exit 0 - ;; -esac diff --git a/projects/rocprofiler/DEBIAN/postinst.in b/projects/rocprofiler/DEBIAN/postinst.in new file mode 100644 index 0000000000..60124ec876 --- /dev/null +++ b/projects/rocprofiler/DEBIAN/postinst.in @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e + +do_ldconfig() { + # left-hand term originates from ENABLE_LDCONFIG = ON/OFF at package build + if [ "@ENABLE_LDCONFIG@" == "ON" ]; then + echo @CPACK_PACKAGING_INSTALL_PREFIX@/rocprofiler/lib > /etc/ld.so.conf.d/librocprofiler64.conf + ldconfig + fi +} + +case "$1" in + ( configure ) + do_ldconfig + ;; + ( abort-upgrade | abort-remove | abort-deconfigure ) + echo "$1" + ;; + ( * ) + exit 0 + ;; +esac diff --git a/projects/rocprofiler/DEBIAN/prerm b/projects/rocprofiler/DEBIAN/prerm deleted file mode 100644 index 4094638306..0000000000 --- a/projects/rocprofiler/DEBIAN/prerm +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -e - -rm_ldconfig() { - rm -f /etc/ld.so.conf.d/librocprofiler64.conf && ldconfig -} - -case "$1" in - remove) - rm_ldconfig - ;; - purge) - ;; - *) - exit 0 - ;; -esac diff --git a/projects/rocprofiler/DEBIAN/prerm.in b/projects/rocprofiler/DEBIAN/prerm.in new file mode 100644 index 0000000000..1258de5635 --- /dev/null +++ b/projects/rocprofiler/DEBIAN/prerm.in @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e + +rm_ldconfig() { + # left-hand term originates from ENABLE_LDCONFIG = ON/OFF at package build + if [ "@ENABLE_LDCONFIG@" == "ON" ]; then + rm -f /etc/ld.so.conf.d/librocprofiler64.conf + ldconfig + fi +} + +case "$1" in + ( remove ) + rm_ldconfig + ;; + ( purge ) + ;; + ( * ) + exit 0 + ;; +esac diff --git a/projects/rocprofiler/RPM/post.in b/projects/rocprofiler/RPM/post.in new file mode 100644 index 0000000000..35ce1eb23b --- /dev/null +++ b/projects/rocprofiler/RPM/post.in @@ -0,0 +1,5 @@ +# left-hand term originates from ENABLE_LDCONFIG = ON/OFF at package build +if [ "@ENABLE_LDCONFIG@" == "ON" ]; then + echo @CPACK_PACKAGING_INSTALL_PREFIX@/rocprofiler/lib > /etc/ld.so.conf.d/librocprofiler64.conf + ldconfig +fi diff --git a/projects/rocprofiler/RPM/postun.in b/projects/rocprofiler/RPM/postun.in new file mode 100644 index 0000000000..678b35d9f4 --- /dev/null +++ b/projects/rocprofiler/RPM/postun.in @@ -0,0 +1,4 @@ +# left-hand term originates from ENABLE_LDCONFIG = ON/OFF at package build +if [ "@ENABLE_LDCONFIG@" == "ON" ]; then + rm -f /etc/ld.so.conf.d/librocprofiler64.conf && ldconfig +fi diff --git a/projects/rocprofiler/RPM/rpm_post b/projects/rocprofiler/RPM/rpm_post deleted file mode 100644 index d0684561dd..0000000000 --- a/projects/rocprofiler/RPM/rpm_post +++ /dev/null @@ -1 +0,0 @@ -echo /opt/rocm/rocprofiler/lib > /etc/ld.so.conf.d/librocprofiler64.conf && ldconfig diff --git a/projects/rocprofiler/RPM/rpm_postun b/projects/rocprofiler/RPM/rpm_postun deleted file mode 100644 index b9c1fadbf2..0000000000 --- a/projects/rocprofiler/RPM/rpm_postun +++ /dev/null @@ -1 +0,0 @@ -rm -f /etc/ld.so.conf.d/librocprofiler64.conf && ldconfig