[Cmake-commits] CMake branch, next, updated. v3.8.0-rc2-457-g227852f

Kitware Robot kwrobot at kitware.com
Fri Mar 10 11:45:02 EST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  227852fc9b275aefa80689a92f77ea2e89a65274 (commit)
       via  10fcef02752ad46b53dd22025420048a0278322d (commit)
       via  ac0786cb9ae40f73323b448e405b053a83770de0 (commit)
       via  a52faa1fcb7b54026ecfbef573d05568846e1aba (commit)
      from  9af050a850fa9e5d8c0ea2bc91b2120511905f7f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=227852fc9b275aefa80689a92f77ea2e89a65274
commit 227852fc9b275aefa80689a92f77ea2e89a65274
Merge: 9af050a 10fcef0
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Mar 10 16:39:42 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Fri Mar 10 11:39:46 2017 -0500

    Stage topic 'bundle_verify_unix'
    
    Topic-id: 22875
    Topic-url: https://gitlab.kitware.com/cmake/cmake/merge_requests/551


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=10fcef02752ad46b53dd22025420048a0278322d
commit 10fcef02752ad46b53dd22025420048a0278322d
Author:     Florian Apolloner <florian at apolloner.eu>
AuthorDate: Sun Mar 5 00:05:06 2017 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Mar 10 10:59:16 2017 -0500

    BundleUtilities: Fix bundle verification on Unix by considering rpaths.

diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 1ec06f1..121a8f0 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -1008,7 +1008,8 @@ function(verify_bundle_prerequisites bundle result_var info_var)
       endif()
 
       if(NOT ignoreFile)
-        get_prerequisites("${f}" prereqs 1 1 "${exepath}" "")
+        get_item_rpaths(${f} _main_exe_rpaths)
+        get_prerequisites("${f}" prereqs 1 1 "${exepath}" "${_main_exe_rpaths}")
 
         # On the Mac,
         # "embedded" and "system" prerequisites are fine... anything else means

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ac0786cb9ae40f73323b448e405b053a83770de0
commit ac0786cb9ae40f73323b448e405b053a83770de0
Author:     Florian Apolloner <florian at apolloner.eu>
AuthorDate: Sun Mar 5 00:05:06 2017 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Mar 10 10:59:07 2017 -0500

    BundleUtilities: Teach `get_item_rpaths` to parse ELF binaries

diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 5d6f402..1ec06f1 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -432,6 +432,16 @@ function(get_item_rpaths item rpaths_var)
     endif()
   endif()
 
+  if(UNIX AND NOT APPLE)
+    file(READ_ELF ${item} RPATH rpath_var RUNPATH runpath_var CAPTURE_ERROR error_var)
+    get_filename_component(item_dir ${item} DIRECTORY)
+    foreach(rpath ${rpath_var} ${runpath_var})
+      # Substitute $ORIGIN with the exepath and add to the found rpaths
+      string(REPLACE "$ORIGIN" "${item_dir}" rpath "${rpath}")
+      gp_append_unique(${rpaths_var} "${rpath}")
+    endforeach()
+  endif()
+
   set(${rpaths_var} ${${rpaths_var}} PARENT_SCOPE)
 endfunction()
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a52faa1fcb7b54026ecfbef573d05568846e1aba
commit a52faa1fcb7b54026ecfbef573d05568846e1aba
Author:     Florian Apolloner <florian at apolloner.eu>
AuthorDate: Mon Mar 6 21:16:42 2017 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Mar 10 10:54:53 2017 -0500

    file: Add READ_ELF command to parse ELF binaries
    
    Leave it undocumented for now because we intend to use it internally and
    it cannot be made available everywhere.

diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 91cecb3..957b4cb 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -42,6 +42,10 @@
 #include "cmFileLockResult.h"
 #endif
 
+#if defined(CMAKE_USE_ELF_PARSER)
+#include "cmELF.h"
+#endif
+
 class cmSystemToolsFileTime;
 
 // Table of permissions flags.
@@ -166,6 +170,9 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args,
   if (subCommand == "RPATH_REMOVE") {
     return this->HandleRPathRemoveCommand(args);
   }
+  if (subCommand == "READ_ELF") {
+    return this->HandleReadElfCommand(args);
+  }
   if (subCommand == "RELATIVE_PATH") {
     return this->HandleRelativePathCommand(args);
   }
@@ -2177,6 +2184,68 @@ bool cmFileCommand::HandleRPathCheckCommand(
   return true;
 }
 
+bool cmFileCommand::HandleReadElfCommand(std::vector<std::string> const& args)
+{
+  if (args.size() < 4) {
+    this->SetError("READ_ELF must be called with at least three additional "
+                   "arguments.");
+    return false;
+  }
+
+  cmCommandArgumentsHelper argHelper;
+  cmCommandArgumentGroup group;
+
+  cmCAString readArg(&argHelper, "READ_ELF");
+  cmCAString fileNameArg(&argHelper, CM_NULLPTR);
+
+  cmCAString rpathArg(&argHelper, "RPATH", &group);
+  cmCAString runpathArg(&argHelper, "RUNPATH", &group);
+  cmCAString errorArg(&argHelper, "CAPTURE_ERROR", &group);
+
+  readArg.Follows(CM_NULLPTR);
+  fileNameArg.Follows(&readArg);
+  group.Follows(&fileNameArg);
+  argHelper.Parse(&args, CM_NULLPTR);
+
+  if (!cmSystemTools::FileExists(fileNameArg.GetString(), true)) {
+    std::ostringstream e;
+    e << "READ_ELF given FILE \"" << fileNameArg.GetString()
+      << "\" that does not exist.";
+    this->SetError(e.str());
+    return false;
+  }
+
+#if defined(CMAKE_USE_ELF_PARSER)
+  cmELF elf(fileNameArg.GetCString());
+
+  if (!rpathArg.GetString().empty()) {
+    if (cmELF::StringEntry const* se_rpath = elf.GetRPath()) {
+      std::string rpath(se_rpath->Value);
+      std::replace(rpath.begin(), rpath.end(), ':', ';');
+      this->Makefile->AddDefinition(rpathArg.GetString(), rpath.c_str());
+    }
+  }
+  if (!runpathArg.GetString().empty()) {
+    if (cmELF::StringEntry const* se_runpath = elf.GetRunPath()) {
+      std::string runpath(se_runpath->Value);
+      std::replace(runpath.begin(), runpath.end(), ':', ';');
+      this->Makefile->AddDefinition(runpathArg.GetString(), runpath.c_str());
+    }
+  }
+
+  return true;
+#else
+  std::string error = "ELF parser not available on this platform.";
+  if (errorArg.GetString().empty()) {
+    this->SetError(error);
+    return false;
+  } else {
+    this->Makefile->AddDefinition(errorArg.GetString(), error.c_str());
+    return true;
+  }
+#endif
+}
+
 bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args)
 {
   cmFileInstaller installer(this);
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index 319864c..2d82a23 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -53,6 +53,7 @@ protected:
   bool HandleRelativePathCommand(std::vector<std::string> const& args);
   bool HandleCMakePathCommand(std::vector<std::string> const& args,
                               bool nativePath);
+  bool HandleReadElfCommand(std::vector<std::string> const& args);
   bool HandleRPathChangeCommand(std::vector<std::string> const& args);
   bool HandleRPathCheckCommand(std::vector<std::string> const& args);
   bool HandleRPathRemoveCommand(std::vector<std::string> const& args);
diff --git a/Tests/RunCMake/file/READ_ELF-result.txt b/Tests/RunCMake/file/READ_ELF-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/READ_ELF-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/READ_ELF-stderr.txt b/Tests/RunCMake/file/READ_ELF-stderr.txt
new file mode 100644
index 0000000..7b32804
--- /dev/null
+++ b/Tests/RunCMake/file/READ_ELF-stderr.txt
@@ -0,0 +1,2 @@
+.*file READ_ELF must be called with at least three additional arguments\.
+.*file READ_ELF given FILE "XXX" that does not exist\.
diff --git a/Tests/RunCMake/file/READ_ELF.cmake b/Tests/RunCMake/file/READ_ELF.cmake
new file mode 100644
index 0000000..cd02c9b
--- /dev/null
+++ b/Tests/RunCMake/file/READ_ELF.cmake
@@ -0,0 +1,2 @@
+file(READ_ELF XXX)
+file(READ_ELF XXX RPATH YYY)
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index 7497544..3f3c0da 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -25,6 +25,7 @@ run_cmake(LOCK-error-no-timeout)
 run_cmake(LOCK-error-timeout)
 run_cmake(LOCK-error-unknown-option)
 run_cmake(LOCK-lowercase)
+run_cmake(READ_ELF)
 run_cmake(GLOB)
 run_cmake(GLOB_RECURSE)
 # test is valid both for GLOB and GLOB_RECURSE

-----------------------------------------------------------------------

Summary of changes:
 Modules/BundleUtilities.cmake                      |   13 +++-
 Source/cmFileCommand.cxx                           |   69 ++++++++++++++++++++
 Source/cmFileCommand.h                             |    1 +
 .../READ_ELF-result.txt}                           |    0
 Tests/RunCMake/file/READ_ELF-stderr.txt            |    2 +
 Tests/RunCMake/file/READ_ELF.cmake                 |    2 +
 Tests/RunCMake/file/RunCMakeTest.cmake             |    1 +
 7 files changed, 87 insertions(+), 1 deletion(-)
 copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => file/READ_ELF-result.txt} (100%)
 create mode 100644 Tests/RunCMake/file/READ_ELF-stderr.txt
 create mode 100644 Tests/RunCMake/file/READ_ELF.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list