[med-svn] [Git][med-team/sight][master] Add patch to fix module folder detection

Flavien Bridault (@fbridault-guest) gitlab at salsa.debian.org
Mon May 9 20:47:11 BST 2022



Flavien Bridault pushed to branch master at Debian Med / sight


Commits:
04f5dce0 by Flavien Bridault at 2022-05-09T21:46:42+02:00
Add patch to fix module folder detection


- - - - -


3 changed files:

- debian/patches/disable-default-password.patch
- + debian/patches/fix-multi-arch-folder-detection.patch
- debian/patches/series


Changes:

=====================================
debian/patches/disable-default-password.patch
=====================================
@@ -1,3 +1,6 @@
+Author: Flavien Bridault <fbridault at ircad.fr>
+Description: Disable default password feature properly.
+Bug: https://git.ircad.fr/sight/sight/-/issues/890
 --- sight.orig/CMakeLists.txt
 +++ sight/CMakeLists.txt
 @@ -133,7 +133,9 @@


=====================================
debian/patches/fix-multi-arch-folder-detection.patch
=====================================
@@ -0,0 +1,56 @@
+Author: Flavien Bridault <fbridault at ircad.fr>
+Origin: upstream
+Description: Fix detection of modules with multi-arch folders.
+Applied-Upstream: https://git.ircad.fr/sight/sight/-/commit/6c0ce6b
+--- sight.orig/libs/core/core/CMakeLists.txt
++++ sight/libs/core/core/CMakeLists.txt
+@@ -14,6 +14,7 @@
+ endif()
+ 
+ # This is the only place where we should pass these variables to the C++ code
++target_compile_definitions(${TARGET_OBJECT_LIB} PRIVATE MODULE_BIN_PREFIX="${CMAKE_INSTALL_BINDIR}")
+ target_compile_definitions(${TARGET_OBJECT_LIB} PRIVATE MODULE_LIB_PREFIX="${SIGHT_MODULE_LIB_PREFIX}")
+ target_compile_definitions(${TARGET_OBJECT_LIB} PRIVATE MODULE_RC_PREFIX="${SIGHT_MODULE_RC_PREFIX}")
+ 
+--- sight.orig/libs/core/core/runtime/detail/Runtime.cpp
++++ sight/libs/core/core/runtime/detail/Runtime.cpp
+@@ -59,8 +59,27 @@
+ 
+ Runtime::Runtime()
+ {
+-    // The lib location is 'SIGHT_DIR/lib/sight_core.dll'
+-    m_workingPath = boost::dll::this_line_location().parent_path().parent_path().string();
++    // Here we try to find the location of the root of a Sight install
++
++    // In most cases, we can rely on finding sight_core library and then go upward in the filesystem tree
++    // The lib location looks like 'SIGHT_DIR/lib/<arch>/libsight_core.*', where arch is optional
++    const std::string corePath = boost::dll::this_line_location().string();
++    const std::string libPrefix(MODULE_LIB_PREFIX);
++    auto it = std::search(corePath.begin(), corePath.end(), libPrefix.begin(), libPrefix.end());
++
++    if(it == corePath.end())
++    {
++        // But if we link statically, for instance linking with sight_core as an object library, then
++        // boost::dll::this_line_location() will return the location of the current executable
++        // In this case, we know that have to locate the bin directory instead of the library directory
++        const std::string binPrefix(MODULE_BIN_PREFIX);
++        it = std::search(corePath.begin(), corePath.end(), binPrefix.begin(), binPrefix.end());
++        SIGHT_FATAL_IF("Failed to locate Sight runtime. We tried to guess it from: " + corePath, it == corePath.end());
++    }
++
++    const std::filesystem::path libPath(corePath.begin(), it);
++    m_workingPath = libPath.parent_path();
++    SIGHT_INFO("Located Sight runtime in folder: " + m_workingPath.string());
+ }
+ 
+ //------------------------------------------------------------------------------
+--- sight.orig/libs/core/core/test/detail/CMakeLists.txt
++++ sight/libs/core/core/test/detail/CMakeLists.txt
+@@ -2,6 +2,7 @@
+ sight_add_target(coreDetailTest TYPE TEST PCH core_obj)
+ 
+ # We need this one to test the location
++target_compile_definitions(coreDetailTest PRIVATE MODULE_BIN_PREFIX="${CMAKE_INSTALL_BINDIR}")
+ target_compile_definitions(coreDetailTest PRIVATE MODULE_RC_PREFIX="${SIGHT_MODULE_RC_PREFIX}")
+ target_compile_definitions(coreDetailTest PRIVATE MODULE_LIB_PREFIX="${SIGHT_MODULE_LIB_PREFIX}")
+ target_compile_definitions(coreDetailTest PRIVATE VERSION="${PROJECT_VERSION}")


=====================================
debian/patches/series
=====================================
@@ -1,3 +1,4 @@
 disable-default-password.patch
 fix-itk5-build.patch
 fix-itk-build.patch
+fix-multi-arch-folder-detection.patch



View it on GitLab: https://salsa.debian.org/med-team/sight/-/commit/04f5dce04874bc790d3d1b194e924eb7c8d34664

-- 
View it on GitLab: https://salsa.debian.org/med-team/sight/-/commit/04f5dce04874bc790d3d1b194e924eb7c8d34664
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220509/3581898f/attachment-0001.htm>


More information about the debian-med-commit mailing list