diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2016-11-04 17:05:00 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2016-11-04 17:05:00 -0700 |
| commit | 8c73539499f2211baa7cdf3248856bb1f45a7947 (patch) | |
| tree | a86e0f81b295a9e5fcebe85dec1aad2ea3aca58b | |
| parent | d7ff71610b5eed96c86374ad0fb41857a49839cb (diff) | |
| parent | f413b423960ab6080681d460a042a2e09dc1c0e6 (diff) | |
| download | vcpkg-8c73539499f2211baa7cdf3248856bb1f45a7947.tar.gz vcpkg-8c73539499f2211baa7cdf3248856bb1f45a7947.zip | |
Merge branch 'master' of https://github.com/microsoft/vcpkg
| -rw-r--r-- | ports/apr/CONTROL | 3 | ||||
| -rw-r--r-- | ports/apr/portfile.cmake | 50 | ||||
| -rw-r--r-- | ports/fmt/portfile.cmake | 1 | ||||
| -rw-r--r-- | ports/libmysql/portfile.cmake | 1 | ||||
| -rw-r--r-- | ports/openjpeg/portfile.cmake | 5 | ||||
| -rw-r--r-- | ports/openssl/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | ports/openssl/CONTROL | 2 | ||||
| -rw-r--r-- | ports/openssl/portfile.cmake | 10 | ||||
| -rw-r--r-- | ports/tiff/portfile.cmake | 4 | ||||
| -rw-r--r-- | ports/zlib/portfile.cmake | 1 | ||||
| -rw-r--r-- | toolsrc/include/BinaryParagraph.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/SourceParagraph.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Maps.h | 11 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Strings.h | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkglib_helpers.h | 2 | ||||
| -rw-r--r-- | toolsrc/src/BinaryParagraph.cpp | 61 | ||||
| -rw-r--r-- | toolsrc/src/SourceParagraph.cpp | 69 | ||||
| -rw-r--r-- | toolsrc/src/StatusParagraph.cpp | 8 | ||||
| -rw-r--r-- | toolsrc/src/commands_installation.cpp | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg_Strings.cpp | 21 | ||||
| -rw-r--r-- | toolsrc/src/vcpkglib_helpers.cpp | 34 |
21 files changed, 257 insertions, 48 deletions
diff --git a/ports/apr/CONTROL b/ports/apr/CONTROL new file mode 100644 index 000000000..eed3c518d --- /dev/null +++ b/ports/apr/CONTROL @@ -0,0 +1,3 @@ +Source: apr +Version: 1.5.2 +Description: The Apache Portable Runtime (APR) is a C library that forms a system portability layer that covers many operating systems. diff --git a/ports/apr/portfile.cmake b/ports/apr/portfile.cmake new file mode 100644 index 000000000..df96d4474 --- /dev/null +++ b/ports/apr/portfile.cmake @@ -0,0 +1,50 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> +# TARGET_TRIPLET is the current triplet (x86-windows, etc) +# PORT is the current port name (zlib, etc) +# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} +# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} +# + +include(${CMAKE_TRIPLET_FILE}) +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/apr-1.5.2) +vcpkg_download_distfile(ARCHIVE + URLS "https://www.apache.org/dist/apr/apr-1.5.2.tar.bz2" + FILENAME "apr-1.5.2.tar.bz2" + SHA512 d1156ad16abf07887797777b56c2147c890f16d8445829b3e3b4917950d24c5fd2f8febd439992467a5ea0511da562c0fb4a7cfd8a235ab55882388bfa2b919d +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS -DINSTALL_PDB=OFF -DMIN_WINDOWS_VER=Windows7 -DAPR_HAVE_IPV6=ON + # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +# There is no way to suppress installation of the headers in debug builds. +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Both dynamic and static are built, so keep only the one needed +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/apr-1.lib + ${CURRENT_PACKAGES_DIR}/lib/aprapp-1.lib + ${CURRENT_PACKAGES_DIR}/debug/lib/apr-1.lib + ${CURRENT_PACKAGES_DIR}/debug/lib/aprapp-1.lib) +else() + file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libapr-1.lib + ${CURRENT_PACKAGES_DIR}/lib/libaprapp-1.lib + ${CURRENT_PACKAGES_DIR}/debug/lib/libapr-1.lib + ${CURRENT_PACKAGES_DIR}/debug/lib/libaprapp-1.lib) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/apr) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/apr/LICENSE ${CURRENT_PACKAGES_DIR}/share/apr/copyright) + +vcpkg_copy_pdbs() diff --git a/ports/fmt/portfile.cmake b/ports/fmt/portfile.cmake index a265da175..26465b6b2 100644 --- a/ports/fmt/portfile.cmake +++ b/ports/fmt/portfile.cmake @@ -31,5 +31,6 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/fmt/fmt-targets.cmake ${CURRENT_PA file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake ${CURRENT_PACKAGES_DIR}/cmake) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/fmt/fmt-targets.cmake ${CURRENT_PACKAGES_DIR}/share/fmt/fmt-targets-debug.cmake) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake) vcpkg_copy_pdbs() diff --git a/ports/libmysql/portfile.cmake b/ports/libmysql/portfile.cmake index dd85e104d..9c2aafdc1 100644 --- a/ports/libmysql/portfile.cmake +++ b/ports/libmysql/portfile.cmake @@ -42,7 +42,6 @@ file(REMOVE_RECURSE file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share - ${CURRENT_PACKAGES_DIR}/debug/share ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) diff --git a/ports/openjpeg/portfile.cmake b/ports/openjpeg/portfile.cmake index 718ca6ca1..9ce215bbc 100644 --- a/ports/openjpeg/portfile.cmake +++ b/ports/openjpeg/portfile.cmake @@ -24,6 +24,11 @@ string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" OPENJPEG_DEBUG_MO file(WRITE ${CURRENT_PACKAGES_DIR}/share/openjpeg/OpenJPEGTargets-debug.cmake "${OPENJPEG_DEBUG_MODULE}") file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +# Cleanup bin directories in static builds +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + # Cleanup Visual C++ Redistributable runtime file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/msvcp140.dll) file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/vcruntime140.dll) diff --git a/ports/openssl/CMakeLists.txt b/ports/openssl/CMakeLists.txt index acb9bc7a5..1fa0f30d0 100644 --- a/ports/openssl/CMakeLists.txt +++ b/ports/openssl/CMakeLists.txt @@ -3,7 +3,7 @@ project(openssl NONE) include(vcpkg_execute_required_process) include(vcpkg_apply_patches) -set(SOURCE_PATH ${CMAKE_CURRENT_BINARY_DIR}/openssl-1.0.2h) +set(SOURCE_PATH ${CMAKE_CURRENT_BINARY_DIR}/openssl-1.0.2j) find_program(PERL perl) find_program(NMAKE nmake) diff --git a/ports/openssl/CONTROL b/ports/openssl/CONTROL index 9ee9ef163..d0cd893f5 100644 --- a/ports/openssl/CONTROL +++ b/ports/openssl/CONTROL @@ -1,3 +1,3 @@ Source: openssl -Version: 1.0.2h-1 +Version: 1.0.2j Description: OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.
\ No newline at end of file diff --git a/ports/openssl/portfile.cmake b/ports/openssl/portfile.cmake index 49d322095..1d3d40b78 100644 --- a/ports/openssl/portfile.cmake +++ b/ports/openssl/portfile.cmake @@ -1,6 +1,6 @@ include(${CMAKE_TRIPLET_FILE}) include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-1.0.2h) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-1.0.2j) vcpkg_find_acquire_program(PERL) find_program(NMAKE nmake) @@ -8,9 +8,9 @@ get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}") vcpkg_download_distfile(OPENSSL_SOURCE_ARCHIVE - URLS "https://www.openssl.org/source/openssl-1.0.2h.tar.gz" - FILENAME "openssl-1.0.2h.tar.gz" - SHA512 780601f6f3f32f42b6d7bbc4c593db39a3575f9db80294a10a68b2b0bb79448d9bd529ca700b9977354cbdfc65887c76af0aa7b90d3ee421f74ab53e6f15c303 + URLS "https://www.openssl.org/source/openssl-1.0.2j.tar.gz" + FILENAME "openssl-1.0.2j.tar.gz" + SHA512 7d6ccae4aa3ccec3a5d128da29c68401cdb1210cba6d212d55235fc3bc63d7085e2f119e2bbee7ddff6b7b5eef07c6196156791724cd2caf313a4c2fef724edd ) file(COPY @@ -30,7 +30,7 @@ vcpkg_configure_cmake( -DOPENSSL_SOURCE_ARCHIVE=${OPENSSL_SOURCE_ARCHIVE} -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} -DTRIPLET_SYSTEM_ARCH=${TRIPLET_SYSTEM_ARCH} - -DVERSION=1.0.2h + -DVERSION=1.0.2j -DTARGET_TRIPLET=${TARGET_TRIPLET} ) diff --git a/ports/tiff/portfile.cmake b/ports/tiff/portfile.cmake index 5a546967a..2266cfe35 100644 --- a/ports/tiff/portfile.cmake +++ b/ports/tiff/portfile.cmake @@ -34,4 +34,8 @@ file(RENAME ) file(GLOB EXES ${CURRENT_PACKAGES_DIR}/bin/*.exe ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe) file(REMOVE ${EXES}) +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + vcpkg_copy_pdbs() diff --git a/ports/zlib/portfile.cmake b/ports/zlib/portfile.cmake index 35ca5ff6d..1d6d807d4 100644 --- a/ports/zlib/portfile.cmake +++ b/ports/zlib/portfile.cmake @@ -18,6 +18,7 @@ vcpkg_configure_cmake( vcpkg_install_cmake() +# Both dynamic and static are built, so keep only the one needed if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/zlibstatic.lib ${CURRENT_PACKAGES_DIR}/debug/lib/zlibstaticd.lib) else() diff --git a/toolsrc/include/BinaryParagraph.h b/toolsrc/include/BinaryParagraph.h index 01979c924..dcb986423 100644 --- a/toolsrc/include/BinaryParagraph.h +++ b/toolsrc/include/BinaryParagraph.h @@ -10,7 +10,7 @@ namespace vcpkg struct BinaryParagraph { BinaryParagraph(); - explicit BinaryParagraph(const std::unordered_map<std::string, std::string>& fields); + explicit BinaryParagraph(std::unordered_map<std::string, std::string> fields); BinaryParagraph(const SourceParagraph& spgh, const triplet& target_triplet); std::string displayname() const; diff --git a/toolsrc/include/SourceParagraph.h b/toolsrc/include/SourceParagraph.h index 72dca8324..bac005144 100644 --- a/toolsrc/include/SourceParagraph.h +++ b/toolsrc/include/SourceParagraph.h @@ -9,7 +9,7 @@ namespace vcpkg { SourceParagraph(); - explicit SourceParagraph(const std::unordered_map<std::string, std::string>& fields); + explicit SourceParagraph(std::unordered_map<std::string, std::string> fields); std::string name; std::string version; diff --git a/toolsrc/include/vcpkg_Maps.h b/toolsrc/include/vcpkg_Maps.h index 5b7b8ed46..886889294 100644 --- a/toolsrc/include/vcpkg_Maps.h +++ b/toolsrc/include/vcpkg_Maps.h @@ -15,4 +15,15 @@ namespace vcpkg { namespace Maps } return key_set; } + + template <typename K, typename V> + std::vector<K> extract_keys(const std::unordered_map<K, V>& input_map) + { + std::vector<K> key_set; + for (auto const& element : input_map) + { + key_set.push_back(element.first); + } + return key_set; + } }} diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index 70526198c..d55a01224 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -1,6 +1,7 @@ #pragma once #include <string> +#include <vector> namespace vcpkg {namespace Strings {namespace details { @@ -67,4 +68,6 @@ namespace vcpkg {namespace Strings std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern); std::string ascii_to_lowercase(const std::string& input); + + std::string join(const std::vector<std::string>& v, const std::string& delimiter); }} diff --git a/toolsrc/include/vcpkglib_helpers.h b/toolsrc/include/vcpkglib_helpers.h index 72711d63b..05c9e17df 100644 --- a/toolsrc/include/vcpkglib_helpers.h +++ b/toolsrc/include/vcpkglib_helpers.h @@ -5,8 +5,10 @@ namespace vcpkg {namespace details { std::string optional_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname); + std::string remove_optional_field(std::unordered_map<std::string, std::string>* fields, const std::string& fieldname); std::string required_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname); + std::string remove_required_field(std::unordered_map<std::string, std::string>* fields, const std::string& fieldname); std::vector<std::string> parse_depends(const std::string& depends_string); }} diff --git a/toolsrc/src/BinaryParagraph.cpp b/toolsrc/src/BinaryParagraph.cpp index 48d04f686..6dceb66d9 100644 --- a/toolsrc/src/BinaryParagraph.cpp +++ b/toolsrc/src/BinaryParagraph.cpp @@ -6,28 +6,57 @@ using namespace vcpkg::details; namespace vcpkg { + // + namespace BinaryParagraphRequiredField + { + static const std::string PACKAGE = "Package"; + static const std::string VERSION = "Version"; + static const std::string ARCHITECTURE = "Architecture"; + static const std::string MULTI_ARCH = "Multi-Arch"; + } + + namespace BinaryParagraphOptionalField + { + static const std::string DESCRIPTION = "Description"; + static const std::string MAINTAINER = "Maintainer"; + static const std::string DEPENDS = "Depends"; + } + + static const std::vector<std::string>& get_list_of_valid_fields() + { + static const std::vector<std::string> valid_fields = + { + BinaryParagraphRequiredField::PACKAGE, + BinaryParagraphRequiredField::VERSION, + BinaryParagraphRequiredField::ARCHITECTURE, + + BinaryParagraphOptionalField::DESCRIPTION, + BinaryParagraphOptionalField::MAINTAINER, + BinaryParagraphOptionalField::DEPENDS + }; + + return valid_fields; + } + BinaryParagraph::BinaryParagraph() = default; - BinaryParagraph::BinaryParagraph(const std::unordered_map<std::string, std::string>& fields) : - version(required_field(fields, "Version")), - description(optional_field(fields, "Description")), - maintainer(optional_field(fields, "Maintainer")) + BinaryParagraph::BinaryParagraph(std::unordered_map<std::string, std::string> fields) { - const std::string name = required_field(fields, "Package"); - const triplet target_triplet = triplet::from_canonical_name(required_field(fields, "Architecture")); + const std::string name = details::remove_required_field(&fields, BinaryParagraphRequiredField::PACKAGE); + const std::string architecture = details::remove_required_field(&fields, BinaryParagraphRequiredField::ARCHITECTURE); + const triplet target_triplet = triplet::from_canonical_name(architecture); + this->spec = package_spec::from_name_and_triplet(name, target_triplet).get_or_throw(); + this->version = details::remove_required_field(&fields, BinaryParagraphRequiredField::VERSION); - { - std::string multi_arch = required_field(fields, "Multi-Arch"); - Checks::check_throw(multi_arch == "same", "Multi-Arch must be 'same' but was %s", multi_arch); - } + this->description = details::remove_optional_field(&fields, BinaryParagraphOptionalField::DESCRIPTION); + this->maintainer = details::remove_optional_field(&fields, BinaryParagraphOptionalField::MAINTAINER); - std::string deps = optional_field(fields, "Depends"); - if (!deps.empty()) - { - this->depends.clear(); - this->depends = parse_depends(deps); - } + std::string multi_arch = details::remove_required_field(&fields, BinaryParagraphRequiredField::MULTI_ARCH); + Checks::check_exit(multi_arch == "same", "Multi-Arch must be 'same' but was %s", multi_arch); + + std::string deps = details::remove_optional_field(&fields, BinaryParagraphOptionalField::DEPENDS); + this->depends = details::parse_depends(deps); } BinaryParagraph::BinaryParagraph(const SourceParagraph& spgh, const triplet& target_triplet) diff --git a/toolsrc/src/SourceParagraph.cpp b/toolsrc/src/SourceParagraph.cpp index 374121ae9..6f25dbded 100644 --- a/toolsrc/src/SourceParagraph.cpp +++ b/toolsrc/src/SourceParagraph.cpp @@ -1,20 +1,63 @@ #include "SourceParagraph.h" #include "vcpkglib_helpers.h" +#include "vcpkg_System.h" +#include "vcpkg_Maps.h" -using namespace vcpkg::details; +namespace vcpkg +{ + // + namespace SourceParagraphRequiredField + { + static const std::string SOURCE = "Source"; + static const std::string VERSION = "Version"; + } -vcpkg::SourceParagraph::SourceParagraph() = default; + namespace SourceParagraphOptionalField + { + static const std::string DESCRIPTION = "Description"; + static const std::string MAINTAINER = "Maintainer"; + static const std::string BUILD_DEPENDS = "Build-Depends"; + } -vcpkg::SourceParagraph::SourceParagraph(const std::unordered_map<std::string, std::string>& fields): - name(required_field(fields, "Source")), - version(required_field(fields, "Version")), - description(optional_field(fields, "Description")), - maintainer(optional_field(fields, "Maintainer")) -{ - std::string deps = optional_field(fields, "Build-Depends"); - if (!deps.empty()) + static const std::vector<std::string>& get_list_of_valid_fields() { - this->depends.clear(); - this->depends = parse_depends(deps); - }; + static const std::vector<std::string> valid_fields = + { + SourceParagraphRequiredField::SOURCE, + SourceParagraphRequiredField::VERSION, + + SourceParagraphOptionalField::DESCRIPTION, + SourceParagraphOptionalField::MAINTAINER, + SourceParagraphOptionalField::BUILD_DEPENDS + }; + + return valid_fields; + } + + SourceParagraph::SourceParagraph() = default; + + SourceParagraph::SourceParagraph(std::unordered_map<std::string, std::string> fields) + { + this->name = details::remove_required_field(&fields, SourceParagraphRequiredField::SOURCE); + this->version = details::remove_required_field(&fields, SourceParagraphRequiredField::VERSION); + this->description = details::remove_optional_field(&fields, SourceParagraphOptionalField::DESCRIPTION); + this->maintainer = details::remove_optional_field(&fields, SourceParagraphOptionalField::MAINTAINER); + + std::string deps = details::remove_optional_field(&fields, SourceParagraphOptionalField::BUILD_DEPENDS); + this->depends = details::parse_depends(deps); + + if (!fields.empty()) + { + const std::vector<std::string> remaining_fields = Maps::extract_keys(fields); + const std::vector<std::string>& valid_fields = get_list_of_valid_fields(); + + const std::string remaining_fields_as_string = Strings::join(remaining_fields, "\n "); + const std::string valid_fields_as_string = Strings::join(valid_fields, "\n "); + + System::println(System::color::error, "Error: There are invalid fields in the Source Paragraph of %s", this->name); + System::println("The following fields were not expected:\n\n %s\n\n", remaining_fields_as_string); + System::println("This is the list of valid fields (case-sensitive): \n\n %s\n", valid_fields_as_string); + exit(EXIT_FAILURE); + } + } } diff --git a/toolsrc/src/StatusParagraph.cpp b/toolsrc/src/StatusParagraph.cpp index 5aa425969..bf12ae89a 100644 --- a/toolsrc/src/StatusParagraph.cpp +++ b/toolsrc/src/StatusParagraph.cpp @@ -5,6 +5,12 @@ using namespace vcpkg::details; namespace vcpkg { + // + namespace BinaryParagraphRequiredField + { + static const std::string STATUS = "Status"; + } + StatusParagraph::StatusParagraph() : want(want_t::error), state(install_state_t::error) { } @@ -19,7 +25,7 @@ namespace vcpkg StatusParagraph::StatusParagraph(const std::unordered_map<std::string, std::string>& fields) : package(fields) { - std::string status_field = required_field(fields, "Status"); + std::string status_field = required_field(fields, BinaryParagraphRequiredField::STATUS); auto b = status_field.begin(); auto mark = b; diff --git a/toolsrc/src/commands_installation.cpp b/toolsrc/src/commands_installation.cpp index 7e7da9e3f..022b87139 100644 --- a/toolsrc/src/commands_installation.cpp +++ b/toolsrc/src/commands_installation.cpp @@ -8,20 +8,23 @@ #include "vcpkg_System.h" #include "vcpkg_Dependencies.h" #include "vcpkg_Input.h" +#include "vcpkg_Maps.h" namespace vcpkg { - static void create_binary_control_file(const vcpkg_paths& paths, const fs::path& port_dir, const triplet& target_triplet) + static void create_binary_control_file(const vcpkg_paths& paths, const SourceParagraph& source_paragraph, const triplet& target_triplet) { - auto pghs = get_paragraphs(port_dir / "CONTROL"); - Checks::check_exit(pghs.size() == 1, "Error: invalid control file"); - auto bpgh = BinaryParagraph(SourceParagraph(pghs[0]), target_triplet); + auto bpgh = BinaryParagraph(source_paragraph, target_triplet); const fs::path binary_control_file = paths.packages / bpgh.dir() / "CONTROL"; std::ofstream(binary_control_file) << bpgh; } static void build_internal(const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir) { + auto pghs = get_paragraphs(port_dir / "CONTROL"); + Checks::check_exit(pghs.size() == 1, "Error: invalid control file"); + SourceParagraph source_paragraph(pghs[0]); + const fs::path ports_cmake_script_path = paths.ports_cmake; auto&& target_triplet = spec.target_triplet(); const std::wstring command = Strings::wformat(LR"("%%VS140COMNTOOLS%%..\..\VC\vcvarsall.bat" %s && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")", @@ -54,7 +57,7 @@ namespace vcpkg perform_all_checks(spec, paths); - create_binary_control_file(paths, port_dir, target_triplet); + create_binary_control_file(paths, source_paragraph, target_triplet); // const fs::path port_buildtrees_dir = paths.buildtrees / spec.name; // delete_directory(port_buildtrees_dir); diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index 56eeae7a0..c53cba1fc 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -64,4 +64,25 @@ namespace vcpkg {namespace Strings std::transform(output.begin(), output.end(), output.begin(), ::tolower); return output; } + + std::string join(const std::vector<std::string>& v, const std::string& delimiter) + { + if (v.empty()) + { + return std::string(); + } + + std::string output; + size_t size = v.size(); + + output.append(v.at(0)); + + for (int i = 1; i < size; ++i) + { + output.append(delimiter); + output.append(v.at(i)); + } + + return output; + } }} diff --git a/toolsrc/src/vcpkglib_helpers.cpp b/toolsrc/src/vcpkglib_helpers.cpp index 3aa3735b0..3d14d4b06 100644 --- a/toolsrc/src/vcpkglib_helpers.cpp +++ b/toolsrc/src/vcpkglib_helpers.cpp @@ -13,17 +13,45 @@ namespace vcpkg {namespace details } return it->second; - }; + } + + std::string remove_optional_field(std::unordered_map<std::string, std::string>* fields, const std::string& fieldname) + { + auto it = fields->find(fieldname); + if (it == fields->end()) + { + return std::string(); + } + + const std::string value = std::move(it->second); + fields->erase(it); + return value; + } std::string required_field(const std::unordered_map<std::string, std::string>& fields, const std::string& fieldname) { auto it = fields.find(fieldname); - vcpkg::Checks::check_throw(it != fields.end(), "Required field not present: %s", fieldname); + Checks::check_exit(it != fields.end(), "Required field not present: %s", fieldname); return it->second; - }; + } + + std::string remove_required_field(std::unordered_map<std::string, std::string>* fields, const std::string& fieldname) + { + auto it = fields->find(fieldname); + Checks::check_exit(it != fields->end(), "Required field not present: %s", fieldname); + + const std::string value = std::move(it->second); + fields->erase(it); + return value; + } std::vector<std::string> parse_depends(const std::string& depends_string) { + if (depends_string.empty()) + { + return {}; + } + std::vector<std::string> out; size_t cur = 0; |
