[pkg-d-commits] [ldc] 164/211: Suffix the LTO plugin packaged with LDC with "-ldc", to prevent installation conflicts.

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:36:20 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.1.0
in repository ldc.

commit d4f5b8ab6c44594294034e108730f6074162b527
Author: Johan Engelen <jbc.engelen at gmail.com>
Date:   Sun Nov 27 17:42:42 2016 +0100

    Suffix the LTO plugin packaged with LDC with "-ldc", to prevent installation conflicts.
---
 CMakeLists.txt    |  6 ++++--
 driver/linker.cpp | 18 ++++++++++--------
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index eff8730..06fcc1d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -729,14 +729,16 @@ endif()
 # Also install LLVM's LTO binary if available
 if(APPLE)
     set(LLVM_LTO_BINARY ${LLVM_LIBRARY_DIRS}/libLTO.dylib)
+    set(LDC_LTO_BINARY_NAME libLTO-ldc.dylib)
 elseif(UNIX)
     set(LLVM_LTO_BINARY ${LLVM_LIBRARY_DIRS}/LLVMgold.so)
+    set(LDC_LTO_BINARY_NAME LLVMgold-ldc.so)
 endif()
 if(EXISTS ${LLVM_LTO_BINARY})
     message(STATUS "Also installing LTO binary: ${LLVM_LTO_BINARY}")
-    install(PROGRAMS ${LLVM_LTO_BINARY} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
     file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
-    configure_file(${LLVM_LTO_BINARY} ${PROJECT_BINARY_DIR}/lib COPYONLY)
+    configure_file(${LLVM_LTO_BINARY} ${PROJECT_BINARY_DIR}/lib/${LDC_LTO_BINARY_NAME} COPYONLY)
+    install(PROGRAMS ${PROJECT_BINARY_DIR}/lib/${LDC_LTO_BINARY_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
 endif()
 
 #
diff --git a/driver/linker.cpp b/driver/linker.cpp
index 7798bdc..0ebcc4d 100644
--- a/driver/linker.cpp
+++ b/driver/linker.cpp
@@ -51,11 +51,11 @@ static llvm::cl::opt<bool> createStaticLibInObjdir(
     llvm::cl::desc("Create static library in -od directory (DMD-compliant)"),
     llvm::cl::ZeroOrMore, llvm::cl::ReallyHidden);
 
-static llvm::cl::opt<std::string> ltoLibrary(
-    "flto-binary",
-    llvm::cl::desc(
-        "Set the path for LLVMgold.so (Unixes) or libLTO.dylib (Darwin)"),
-    llvm::cl::value_desc("file"));
+static llvm::cl::opt<std::string>
+    ltoLibrary("flto-binary",
+               llvm::cl::desc("Set the linker LTO plugin library file (e.g. "
+                              "LLVMgold.so (Unixes) or libLTO.dylib (Darwin))"),
+               llvm::cl::value_desc("file"));
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -129,8 +129,9 @@ std::string getLTOGoldPluginPath() {
     fatal();
   } else {
     std::string searchPaths[] = {
-        exe_path::prependLibDir("LLVMgold.so"), "/usr/local/lib/LLVMgold.so",
-        "/usr/lib/bfd-plugins/LLVMgold.so",
+        // The plugin packaged with LDC has a "-ldc" suffix.
+        exe_path::prependLibDir("LLVMgold-ldc.so"),
+        "/usr/local/lib/LLVMgold.so", "/usr/lib/bfd-plugins/LLVMgold.so",
     };
 
     // Try all searchPaths and early return upon the first path found.
@@ -179,7 +180,8 @@ std::string getLTOdylibPath() {
     error(Loc(), "-flto-binary: '%s' not found", ltoLibrary.c_str());
     fatal();
   } else {
-    std::string searchPath = exe_path::prependLibDir("libLTO.dylib");
+    // The plugin packaged with LDC has a "-ldc" suffix.
+    std::string searchPath = exe_path::prependLibDir("libLTO-ldc.dylib");
     if (llvm::sys::fs::exists(searchPath))
       return searchPath;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list