PengZheng commented on code in PR #608:
URL: https://github.com/apache/celix/pull/608#discussion_r1288315376


##########
cmake/cmake_celix/BundlePackaging.cmake:
##########
@@ -992,24 +1002,64 @@ function(install_celix_bundle)
     list(GET ARGN 0 BUNDLE)
     list(REMOVE_AT ARGN 0)
 
-    set(OPTIONS )
+    set(OPTIONS)
     set(ONE_VAL_ARGS PROJECT_NAME BUNDLE_NAME EXPORT)
     set(MULTI_VAL_ARGS HEADERS RESOURCES)
     cmake_parse_arguments(INSTALL "${OPTIONS}" "${ONE_VAL_ARGS}" 
"${MULTI_VAL_ARGS}" ${ARGN})
-    
+
     if (NOT DEFINED INSTALL_PROJECT_NAME)
         string(TOLOWER ${PROJECT_NAME} INSTALL_PROJECT_NAME)
-    endif()
+    endif ()
     if (NOT DEFINED INSTALL_BUNDLE_NAME)
         set(INSTALL_BUNDLE_NAME ${BUNDLE})
-    endif()
+    endif ()
 
-    install(FILES "$<TARGET_PROPERTY:${BUNDLE},BUNDLE_FILE>" DESTINATION 
share/${INSTALL_PROJECT_NAME}/bundles COMPONENT ${BUNDLE})
+    get_target_property(BUNDLE_CONTENT_DIR ${BUNDLE} "BUNDLE_CONTENT_DIR")
+    set(BUNDLE_INSTALL_DIR "${BUNDLE_CONTENT_DIR}_install")
+    # copy bundle content to prepare the bundle to be installed
+    install(CODE "file(COPY ${BUNDLE_CONTENT_DIR}/ DESTINATION 
${BUNDLE_INSTALL_DIR})")
+
+    # fix RPATH of shared objects in the bundle to be installed using CMake's 
internal RPATH rewrite
+    get_target_property(LIB_TARGETS ${BUNDLE} "BUNDLE_LIB_TARGETS")
+    get_target_property(BUNDLE_GEN_DIR ${BUNDLE} "BUNDLE_GEN_DIR")
+    foreach (LIB_TARGET ${LIB_TARGETS})
+        install(TARGETS ${LIB_TARGET} LIBRARY DESTINATION ${BUNDLE_GEN_DIR} 
NAMELINK_SKIP COMPONENT ${BUNDLE})
+        # JAR does not support symbolic links, so we only install soname file

Review Comment:
   Otherwise, the bundle will contain two/three copies of the same shared 
library.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to