diff --git a/projects/clr/opencl/CMakeLists.txt b/projects/clr/opencl/CMakeLists.txt index 8ccd55f6d0..658547f118 100644 --- a/projects/clr/opencl/CMakeLists.txt +++ b/projects/clr/opencl/CMakeLists.txt @@ -103,6 +103,12 @@ message (STATUS "ROCM Installation path(ROCM_PATH): ${ROCM_PATH}") #Package: rocm-opencl,rocm-opencl-dev/devel,rocm-ocl-icd +set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/opencl) +configure_file(packaging/rocm-opencl.postinst ${BUILD_DIR}/postinst @ONLY) +configure_file(packaging/rocm-opencl.prerm ${BUILD_DIR}/prerm @ONLY) +configure_file(packaging/rocm-opencl.rpm_post ${BUILD_DIR}/rpm_post @ONLY) +configure_file(packaging/rocm-opencl.rpm_postun ${BUILD_DIR}/rpm_postun @ONLY) + if(BUILD_ICD) set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/rocm-ocl-icd) configure_file(packaging/rocm-ocl-icd.postinst ${BUILD_DIR}/postinst @ONLY) diff --git a/projects/clr/opencl/packaging/CMakeLists.txt b/projects/clr/opencl/packaging/CMakeLists.txt index 386b82e01f..d9329c4150 100644 --- a/projects/clr/opencl/packaging/CMakeLists.txt +++ b/projects/clr/opencl/packaging/CMakeLists.txt @@ -50,6 +50,11 @@ endif() set(CPACK_DEBIAN_BINARY_PACKAGE_NAME "rocm-opencl") set(CPACK_RPM_BINARY_PACKAGE_NAME "rocm-opencl") +set(CPACK_DEBIAN_BINARY_PACKAGE_CONTROL_EXTRA "${CMAKE_BINARY_DIR}/opencl/packages/opencl/postinst;${CMAKE_BINARY_DIR}/opencl/packages/opencl/prerm") +# RPM CPACK variables +set(CPACK_RPM_BINARY_POST_INSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/opencl/packages/opencl/rpm_post") +set(CPACK_RPM_BINARY_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_BINARY_DIR}/opencl/packages/opencl/rpm_postun") + ## Set ASAN package name set(CPACK_DEBIAN_ASAN_PACKAGE_NAME "rocm-opencl-asan") set(CPACK_RPM_ASAN_PACKAGE_NAME "rocm-opencl-asan") diff --git a/projects/clr/opencl/packaging/rocm-opencl.postinst b/projects/clr/opencl/packaging/rocm-opencl.postinst new file mode 100644 index 0000000000..634a4968eb --- /dev/null +++ b/projects/clr/opencl/packaging/rocm-opencl.postinst @@ -0,0 +1,20 @@ +#!/bin/bash + +set -e + + +do_ldconfig() { + mkdir -p /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors && (echo libamdocl64.so > /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@) +} + +case "$1" in + abort-deconfigure|abort-remove|abort-upgrade) + echo "$1" + ;; + configure) + do_ldconfig + ;; + *) + exit 0 + ;; +esac diff --git a/projects/clr/opencl/packaging/rocm-opencl.prerm b/projects/clr/opencl/packaging/rocm-opencl.prerm new file mode 100644 index 0000000000..5e5313f2d8 --- /dev/null +++ b/projects/clr/opencl/packaging/rocm-opencl.prerm @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +rm_ldconfig() { + rm -f /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@ +} + +case "$1" in + purge) + ;; + remove | upgrade ) + rm_ldconfig + ;; + *) + exit 0 + ;; +esac diff --git a/projects/clr/opencl/packaging/rocm-opencl.rpm_post b/projects/clr/opencl/packaging/rocm-opencl.rpm_post new file mode 100644 index 0000000000..1aff10f165 --- /dev/null +++ b/projects/clr/opencl/packaging/rocm-opencl.rpm_post @@ -0,0 +1 @@ +mkdir -p /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors && (echo libamdocl64.so > /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@) diff --git a/projects/clr/opencl/packaging/rocm-opencl.rpm_postun b/projects/clr/opencl/packaging/rocm-opencl.rpm_postun new file mode 100644 index 0000000000..4560615305 --- /dev/null +++ b/projects/clr/opencl/packaging/rocm-opencl.rpm_postun @@ -0,0 +1,4 @@ +# Remove icd file for uninstall and upgrade operation +rm -f /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@ + +