From 7ca01776fce4e0d150490d3a3ba9a3ccd58ed767 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Tue, 2 Dec 2025 17:14:10 -0800 Subject: [PATCH] container: root: refactor using common utility --- container/plugins/root/example.cc | 2 +- container/src/root/macro/rootlogon.C | 30 +++++++++++++++++----------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/container/plugins/root/example.cc b/container/plugins/root/example.cc index 6d6be48..63c3fd4 100644 --- a/container/plugins/root/example.cc +++ b/container/plugins/root/example.cc @@ -59,7 +59,7 @@ void example1() //! \ingroup cpp_plugin_impl void example2() { - namespace common = ::dfi::macro::common; + namespace common = ::dfi::common; auto print_env = [](const std::string& env) { std::cout << env << "=" << common::get_env(env) << "\n"; diff --git a/container/src/root/macro/rootlogon.C b/container/src/root/macro/rootlogon.C index 321db19..2e186cb 100644 --- a/container/src/root/macro/rootlogon.C +++ b/container/src/root/macro/rootlogon.C @@ -26,6 +26,8 @@ #include #include +#include "./common/utility.hh" // The one-and-only `dfi` header required by rootlogon + //! \namespace dfi //! \since docker-finance 1.0.0 namespace dfi @@ -192,24 +194,28 @@ void help() //! \since docker-finance 1.0.0 void rootlogon() { + namespace common = dfi::common; + // Add nested directory headers - gInterpreter->AddIncludePath("/usr/include/botan-3"); + common::add_include_dir("/usr/include/botan-3"); // Link default packaged libraries - gSystem->AddLinkedLibs("-lgtest"); // gtest/gmock - gSystem->AddLinkedLibs("-lbenchmark"); // gbenchmark - gSystem->AddLinkedLibs("-pthread"); // gtest/gmock/gbenchmark + // TODO(afiore): linking here appears to no longer be needed? + // Is ROOT loading all libraries on-the-fly (in default paths)? + common::add_linked_lib("/usr/lib/libgtest.so"); // gtest/gmock + common::add_linked_lib("/usr/lib/libbenchmark.so"); // gbenchmark + common::add_linked_lib("/usr/lib/libpthread.so.0"); // gtest/gmock/gbenchmark - gSystem->AddLinkedLibs("-lbotan-3"); // Botan - gSystem->AddLinkedLibs("-lcryptopp"); // Crypto++ - gSystem->AddLinkedLibs("-lsodium"); // libsodium + common::add_linked_lib("/usr/lib/libbotan-3.so"); // Botan + common::add_linked_lib("/usr/lib/libcryptopp.so"); // Crypto++ + common::add_linked_lib("/usr/lib/libsodium.so"); // libsodium // Load default `dfi` public consumables - gInterpreter->ProcessLine(".L plugin/common/utility.hh"); - gInterpreter->ProcessLine(".L macro/common/utility.hh"); - gInterpreter->ProcessLine(".L src/hash.hh"); - gInterpreter->ProcessLine(".L src/random.hh"); - gInterpreter->ProcessLine(".L src/utility.hh"); + common::load("plugin/common/utility.hh"); + common::load("macro/common/utility.hh"); + common::load("src/hash.hh"); + common::load("src/random.hh"); + common::load("src/utility.hh"); } #endif // CONTAINER_SRC_ROOT_MACRO_ROOTLOGON_C_