aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2016-11-08 15:09:56 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2016-11-08 15:09:56 -0800
commitdbab03a1a82913ae96bfa3c1613ade20b5ac438d (patch)
tree8086e4554c7902d6b0a3a0079425785e4eec5141 /toolsrc/src
parent2e7b260b32454d32fb10cc9d838409f82c7744b8 (diff)
parent218cae4503749134f4827b3e71fbf22a956d4dc3 (diff)
downloadvcpkg-dbab03a1a82913ae96bfa3c1613ade20b5ac438d.tar.gz
vcpkg-dbab03a1a82913ae96bfa3c1613ade20b5ac438d.zip
Merge branch 'postbuild'
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/BuildInfo.cpp46
-rw-r--r--toolsrc/src/post_build_lint.cpp18
-rw-r--r--toolsrc/src/triplet.cpp10
-rw-r--r--toolsrc/src/vcpkg.cpp2
-rw-r--r--toolsrc/src/vcpkg_paths.cpp5
5 files changed, 65 insertions, 16 deletions
diff --git a/toolsrc/src/BuildInfo.cpp b/toolsrc/src/BuildInfo.cpp
new file mode 100644
index 000000000..dc8d90e2e
--- /dev/null
+++ b/toolsrc/src/BuildInfo.cpp
@@ -0,0 +1,46 @@
+#include "BuildInfo.h"
+#include "vcpkg_Checks.h"
+#include "vcpkglib_helpers.h"
+
+namespace vcpkg
+{
+ //
+ namespace BuildInfoRequiredField
+ {
+ static const std::string CRT_LINKAGE = "CRTLinkage";
+ static const std::string LIBRARY_LINKAGE = "LibraryLinkage";
+ }
+
+ BuildInfo BuildInfo::create(const std::unordered_map<std::string, std::string>& pgh)
+ {
+ BuildInfo build_info;
+ build_info.crt_linkage = details::required_field(pgh, BuildInfoRequiredField::CRT_LINKAGE);
+ build_info.library_linkage = details::required_field(pgh, BuildInfoRequiredField::LIBRARY_LINKAGE);
+
+ return build_info;
+ }
+
+ LinkageType linkage_type_value_of(const std::string& as_string)
+
+ {
+ if (as_string == "dynamic")
+ {
+ return LinkageType::DYNAMIC;
+ }
+
+ if (as_string == "static")
+ {
+ return LinkageType::STATIC;
+ }
+
+ return LinkageType::UNKNOWN;
+ }
+
+ BuildInfo read_build_info(const fs::path& filepath)
+ {
+ const std::vector<std::unordered_map<std::string, std::string>> pghs = Paragraphs::get_paragraphs(filepath);
+ Checks::check_throw(pghs.size() == 1, "Invalid BUILD_INFO file for package");
+
+ return BuildInfo::create(pghs[0]);
+ }
+}
diff --git a/toolsrc/src/post_build_lint.cpp b/toolsrc/src/post_build_lint.cpp
index 8301e74cc..4b784952a 100644
--- a/toolsrc/src/post_build_lint.cpp
+++ b/toolsrc/src/post_build_lint.cpp
@@ -5,6 +5,7 @@
#include <functional>
#include "vcpkg_System.h"
#include "coff_file_reader.h"
+#include "BuildInfo.h"
namespace fs = std::tr2::sys;
@@ -495,6 +496,9 @@ namespace vcpkg
void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths)
{
System::println("-- Performing post-build validation");
+
+ BuildInfo build_info = read_build_info(paths.build_info_file_path(spec));
+
size_t error_count = 0;
error_count += check_for_files_in_include_directory(spec, paths);
error_count += check_for_files_in_debug_include_directory(spec, paths);
@@ -506,10 +510,9 @@ namespace vcpkg
error_count += check_for_copyright_file(spec, paths);
error_count += check_for_exes(spec, paths);
- triplet::BuildType build_type = spec.target_triplet().build_type();
- switch (build_type)
+ switch (linkage_type_value_of(build_info.library_linkage))
{
- case triplet::BuildType::DYNAMIC:
+ case LinkageType::DYNAMIC:
{
const std::vector<fs::path> debug_dlls = recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "debug" / "bin", ".dll");
const std::vector<fs::path> release_dlls = recursive_find_files_with_extension_in_dir(paths.packages / spec.dir() / "bin", ".dll");
@@ -525,7 +528,7 @@ namespace vcpkg
error_count += check_dll_architecture(spec.target_triplet().architecture(), dlls);
break;
}
- case triplet::BuildType::STATIC:
+ case LinkageType::STATIC:
{
std::vector<fs::path> dlls;
recursive_find_files_with_extension_in_dir(paths.packages / spec.dir(), ".dll", &dlls);
@@ -534,7 +537,12 @@ namespace vcpkg
error_count += check_bin_folders_are_not_present_in_static_build(spec, paths);
break;
}
-
+ case LinkageType::UNKNOWN:
+ {
+ error_count += 1;
+ System::println(System::color::warning, "Unknown library_linkage architecture: [ %s ]", build_info.library_linkage);
+ break;
+ }
default:
Checks::unreachable();
}
diff --git a/toolsrc/src/triplet.cpp b/toolsrc/src/triplet.cpp
index af2ca2a72..a6816b445 100644
--- a/toolsrc/src/triplet.cpp
+++ b/toolsrc/src/triplet.cpp
@@ -64,14 +64,4 @@ namespace vcpkg
auto it = std::find(this->m_canonical_name.cbegin(), this->m_canonical_name.cend(), '-');
return std::string(it + 1, this->m_canonical_name.cend());
}
-
- triplet::BuildType triplet::build_type() const
- {
- if (this->m_canonical_name.find("static") != std::string::npos)
- {
- return BuildType::STATIC;
- }
-
- return BuildType::DYNAMIC;
- }
}
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp
index 00aea1e2e..6e47df2c8 100644
--- a/toolsrc/src/vcpkg.cpp
+++ b/toolsrc/src/vcpkg.cpp
@@ -158,7 +158,7 @@ static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryPar
for (auto it = fs::recursive_directory_iterator(package_prefix_path); it != fs::recursive_directory_iterator(); ++it)
{
const auto& filename = it->path().filename();
- if (fs::is_regular_file(it->status()) && (filename == "CONTROL" || filename == "control"))
+ if (fs::is_regular_file(it->status()) && (_stricmp(filename.generic_string().c_str(), "CONTROL") == 0 || _stricmp(filename.generic_string().c_str(), "BUILD_INFO") == 0))
{
// Do not copy the control file
continue;
diff --git a/toolsrc/src/vcpkg_paths.cpp b/toolsrc/src/vcpkg_paths.cpp
index 28ab22ec3..5347b79d8 100644
--- a/toolsrc/src/vcpkg_paths.cpp
+++ b/toolsrc/src/vcpkg_paths.cpp
@@ -55,6 +55,11 @@ namespace vcpkg
return this->ports / spec.name();
}
+ fs::path vcpkg_paths::build_info_file_path(const package_spec& spec) const
+ {
+ return this->package_dir(spec) / "BUILD_INFO";
+ }
+
fs::path vcpkg_paths::listfile_path(const BinaryParagraph& pgh) const
{
return this->vcpkg_dir_info / (pgh.fullstem() + ".list");