From 9051b752c4cbf2df80173d3aa84db17d523a44e2 Mon Sep 17 00:00:00 2001 From: Chris Freehill Date: Fri, 11 Sep 2020 08:47:33 -0500 Subject: [PATCH] Add grpc to build Also: * fix typo in rpm post install script * for RPM, tell CPack to exclude intermediate directories in rpm file Change-Id: I9dbb4901298d3699e092b53b339f5cb1d77b4edb (cherry picked from commit e894cfa757aae8343afb373ce4ae60a1aa950a91) --- CMakeLists.txt | 17 ++++++++++++++++- README.md | 2 +- src/DEBIAN_postinst.in | 4 +++- src/RPM_rpm_post.in | 10 ++++++++-- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83f1962127..99c7de89ae 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ set(RSMI_INC_DIR ${ROCM_DIR}/rocm_smi/include) set(RSMI_LIB_DIR ${ROCM_DIR}/rocm_smi/lib) if (NOT DEFINED GRPC_ROOT) - set(GRPC_ROOT "/usr/local") + set(GRPC_ROOT "/usr") endif() if (NOT DEFINED CPACK_PACKAGING_INSTALL_PREFIX) set(CPACK_PACKAGING_INSTALL_PREFIX "/" @@ -157,6 +157,11 @@ set(CPACK_PACKAGING_INSTALL_PREFIX ${RDC_SERVER_ROOT_PATH} set(SERVER_COMPONENT "server") set(CLIENT_COMPONENT "client") +install(DIRECTORY ${GRPC_ROOT} + USE_SOURCE_PERMISSIONS + DESTINATION usr + COMPONENT ${SERVER_COMPONENT}) + add_subdirectory("server") add_subdirectory("client") add_subdirectory("rdc_libs") @@ -181,8 +186,18 @@ set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/postinst; ${CMAKE_CURRENT_SOURCE_DIR}/DEBIAN/prerm") set(CPACK_DEBIAN_PACKAGE_VERSION ${PKG_VERSION_STR}) +set(CPACK_DEBIAN_PACKAGE_DEPENDS "rocm-smi-lib64") # RPM package specific variables +set(CPACK_RPM_PACKAGE_AUTOREQ 0) +set(CPACK_RPM_PACKAGE_REQUIRES "rocm-smi-lib64") +list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/lib") +list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/sbin") +list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/lib/systemd") +list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/lib/systemd/system") +list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr") +list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/opt") + set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/RPM/rpm_post") set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE diff --git a/README.md b/README.md index 5da0717377..b0995007ee 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ For complete list of features and how to start using RDC from pre-built packages (ii) AMD ROCk Kernel driver (https://github.com/RadeonOpenCompute/ROCK-Kernel-Driver) ## Building gRPC and protoc -**NOTE:** gRPC and protoc compiler must be built from source as pre-built packages are not available. These must be installed to both build RDC and must also be available on machines where RDC will run. +**NOTE:** gRPC and protoc compiler must be built when building RDC from source as pre-built packages are not available. When installing RDC from a package, gRPC and protoc will be installed from the package. **IMPORTANT:** Building gRPC and protocol buffers requires CMake 3.15 or greater. With an older version build will quietly succeed with a *message*. However, all components of gRPC will not be installed and RDC will ***fail*** to run diff --git a/src/DEBIAN_postinst.in b/src/DEBIAN_postinst.in index b7a38b7c02..11a229a9aa 100755 --- a/src/DEBIAN_postinst.in +++ b/src/DEBIAN_postinst.in @@ -1,6 +1,7 @@ #/bin/bash RDC_LIB_DIR=@RDC_CLIENT_ROOT_PATH@/rdc/lib +GRPC_LIB_DIR=/usr/grpc/lib # This will return 0 if an id is created and non-zero if # it already exists @@ -10,7 +11,8 @@ do_create_rdc_user() { # librdc_client.so do_ldconfig() { - echo $RDC_LIB_DIR > /etc/ld.so.conf.d/x86_64-librdc_client.conf && ldconfig + echo "$RDC_LIB_DIR" > /etc/ld.so.conf.d/x86_64-librdc_client.conf + echo "$GRPC_LIB_DIR" >> /etc/ld.so.conf.d/x86_64-librdc_client.conf && ldconfig do_create_rdc_user diff --git a/src/RPM_rpm_post.in b/src/RPM_rpm_post.in index 75afa1bf35..644116354f 100755 --- a/src/RPM_rpm_post.in +++ b/src/RPM_rpm_post.in @@ -1,10 +1,16 @@ #!/bin/bash RDC_LIB_DIR=@RDC_CLIENT_ROOT_PATH@/rdc/lib +GRPC_LIB_DIR=/usr/grpc/lib + do_create_rdc_user() { useradd -r -s /bin/nologin rdc } -do_create_rpc_user -echo -e "${RDC_LIB_DIR}\n${RDC_LIB_DIR}64" > /etc/ld.so.conf.d/x86_64-librdc_client.conf && ldconfig +do_create_rdc_user +echo "$GRPC_LIB_DIR" > /etc/ld.so.conf.d/x86_64-librdc_client.conf +echo "$GRPC_LIB_DIR"64 >> /etc/ld.so.conf.d/x86_64-librdc_client.conf +echo "$RDC_LIB_DIR" >> /etc/ld.so.conf.d/x86_64-librdc_client.conf +echo "$RDC_LIB_DIR"64 >> /etc/ld.so.conf.d/x86_64-librdc_client.conf +ldconfig