aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWimok Nupphiboon <wimok.mok@gmail.com>2018-04-13 09:48:50 +0700
committerWimok Nupphiboon <wimok.mok@gmail.com>2018-04-13 09:48:50 +0700
commit00cdc0b10a089c6c3763f8e3c7847efac909e3fd (patch)
treedbe3d517060d68a06e7b0ac58104b0d7ea8547b6
parent30b56c86148babd61eb6c7c2807421bdcd8d3c13 (diff)
parentdc207a2c891fe6deb2710ccde0abf48078f64fcd (diff)
downloadvcpkg-00cdc0b10a089c6c3763f8e3c7847efac909e3fd.tar.gz
vcpkg-00cdc0b10a089c6c3763f8e3c7847efac909e3fd.zip
Merge remote-tracking branch 'origin/master'
-rw-r--r--CHANGELOG.md65
-rw-r--r--ports/abseil/CONTROL2
-rw-r--r--ports/abseil/portfile.cmake4
-rw-r--r--ports/asio/CONTROL3
-rw-r--r--ports/asio/portfile.cmake5
-rw-r--r--ports/aws-sdk-cpp/CONTROL6
-rw-r--r--ports/aws-sdk-cpp/CONTROL.in3
-rw-r--r--ports/aws-sdk-cpp/compute_build_only.cmake3
-rw-r--r--ports/aws-sdk-cpp/portfile.cmake11
-rw-r--r--ports/azure-c-shared-utility/CONTROL2
-rw-r--r--ports/azure-c-shared-utility/portfile.cmake4
-rw-r--r--ports/azure-iot-sdk-c/CONTROL2
-rw-r--r--ports/azure-iot-sdk-c/portfile.cmake4
-rw-r--r--ports/azure-uamqp-c/CONTROL2
-rw-r--r--ports/azure-uamqp-c/portfile.cmake4
-rw-r--r--ports/azure-umqtt-c/CONTROL2
-rw-r--r--ports/azure-umqtt-c/portfile.cmake4
-rw-r--r--ports/breakpad/CONTROL2
-rw-r--r--ports/breakpad/portfile.cmake4
-rw-r--r--ports/catch2/CONTROL2
-rw-r--r--ports/catch2/portfile.cmake4
-rw-r--r--ports/directxmesh/CONTROL4
-rw-r--r--ports/directxmesh/portfile.cmake4
-rw-r--r--ports/exiv2/CONTROL2
-rw-r--r--ports/exiv2/portfile.cmake4
-rw-r--r--ports/folly/CONTROL2
-rw-r--r--ports/folly/portfile.cmake6
-rw-r--r--ports/forest/CONTROL4
-rw-r--r--ports/forest/portfile.cmake15
-rw-r--r--ports/gdcm2/CONTROL2
-rw-r--r--ports/gdcm2/portfile.cmake4
-rw-r--r--ports/graphicsmagick/CMakeLists.txt2
-rw-r--r--ports/graphicsmagick/CONTROL2
-rw-r--r--ports/graphicsmagick/portfile.cmake4
-rw-r--r--ports/grpc/CONTROL2
-rw-r--r--ports/grpc/portfile.cmake4
-rw-r--r--ports/icu/CONTROL2
-rw-r--r--ports/icu/portfile.cmake35
-rw-r--r--ports/jsonnet/CONTROL2
-rw-r--r--ports/jsonnet/portfile.cmake4
-rw-r--r--ports/libiconv/CONTROL2
-rw-r--r--ports/libiconv/portfile.cmake2
-rw-r--r--ports/libiconv/unofficial-iconv-config.cmake2
-rw-r--r--ports/libiconv/vcpkg-iconv-config.cmake2
-rw-r--r--ports/liblinear/CMakeLists.txt47
-rw-r--r--ports/liblinear/CONTROL3
-rw-r--r--ports/liblinear/portfile.cmake26
-rw-r--r--ports/libxml2/CMakeLists.txt84
-rw-r--r--ports/libxml2/CONTROL2
-rw-r--r--ports/libxml2/config.linux.h56
-rw-r--r--ports/libxml2/config.osx.h54
-rw-r--r--ports/libxml2/portfile.cmake1
-rw-r--r--ports/libxml2/vcpkg-cmake-wrapper.cmake18
-rw-r--r--ports/nuklear/CONTROL2
-rw-r--r--ports/nuklear/portfile.cmake4
-rw-r--r--ports/openal-soft/cmake-3-11.patch14
-rw-r--r--ports/openal-soft/portfile.cmake8
-rw-r--r--ports/openvr/CONTROL2
-rw-r--r--ports/openvr/portfile.cmake4
-rw-r--r--ports/plplot/portfile.cmake8
-rw-r--r--ports/protobuf/CONTROL2
-rw-r--r--ports/protobuf/portfile.cmake30
-rw-r--r--ports/pugixml/CONTROL2
-rw-r--r--ports/pugixml/portfile.cmake45
-rw-r--r--ports/pugixml/pugixmlapi.patch13
-rw-r--r--ports/rocksdb/CONTROL2
-rw-r--r--ports/rocksdb/pass-major-version.patch20
-rw-r--r--ports/rocksdb/portfile.cmake10
-rw-r--r--ports/rs-core-lib/CONTROL2
-rw-r--r--ports/rs-core-lib/portfile.cmake4
-rw-r--r--ports/shogun/CONTROL2
-rw-r--r--ports/shogun/portfile.cmake11
-rw-r--r--ports/sol/CONTROL2
-rw-r--r--ports/sol/portfile.cmake4
-rw-r--r--ports/sqlite3/CONTROL2
-rw-r--r--ports/sqlite3/portfile.cmake6
-rw-r--r--ports/tbb/portfile.cmake4
-rw-r--r--ports/theia/CONTROL4
-rw-r--r--ports/theia/portfile.cmake4
-rw-r--r--ports/thrift/CONTROL2
-rw-r--r--ports/thrift/portfile.cmake4
-rw-r--r--ports/tinyxml2/CONTROL2
-rw-r--r--ports/tinyxml2/portfile.cmake4
-rw-r--r--ports/unicorn-lib/CONTROL2
-rw-r--r--ports/unicorn-lib/portfile.cmake4
-rw-r--r--ports/yoga/CONTROL2
-rw-r--r--ports/yoga/portfile.cmake4
-rw-r--r--ports/zeromq/CONTROL2
-rw-r--r--ports/zeromq/portfile.cmake6
-rw-r--r--scripts/SHA256Hash.ps19
-rw-r--r--scripts/VcpkgPowershellUtils.ps199
-rw-r--r--scripts/buildsystems/vcpkg.cmake37
-rw-r--r--scripts/cmake/vcpkg_build_cmake.cmake28
-rw-r--r--scripts/cmake/vcpkg_configure_cmake.cmake1
-rw-r--r--scripts/cmake/vcpkg_find_acquire_program.cmake13
-rw-r--r--scripts/fetchTool.ps155
-rw-r--r--scripts/toolchains/windows.cmake13
-rw-r--r--scripts/vcpkgTools.xml98
-rw-r--r--toolsrc/CMakeLists.txt3
-rw-r--r--toolsrc/VERSION.txt2
-rw-r--r--toolsrc/include/vcpkg/base/checks.h4
-rw-r--r--toolsrc/include/vcpkg/base/chrono.h11
-rw-r--r--toolsrc/include/vcpkg/base/cstringview.h15
-rw-r--r--toolsrc/include/vcpkg/base/files.h2
-rw-r--r--toolsrc/include/vcpkg/base/lineinfo.h2
-rw-r--r--toolsrc/include/vcpkg/base/optional.h12
-rw-r--r--toolsrc/include/vcpkg/base/span.h7
-rw-r--r--toolsrc/include/vcpkg/base/strings.h2
-rw-r--r--toolsrc/include/vcpkg/binaryparagraph.h2
-rw-r--r--toolsrc/include/vcpkg/build.h6
-rw-r--r--toolsrc/include/vcpkg/commands.h11
-rw-r--r--toolsrc/include/vcpkg/dependencies.h9
-rw-r--r--toolsrc/include/vcpkg/export.ifw.h2
-rw-r--r--toolsrc/include/vcpkg/packagespecparseresult.h2
-rw-r--r--toolsrc/include/vcpkg/paragraphs.h3
-rw-r--r--toolsrc/include/vcpkg/statusparagraph.h5
-rw-r--r--toolsrc/include/vcpkg/triplet.h4
-rw-r--r--toolsrc/include/vcpkg/vcpkgcmdarguments.h1
-rw-r--r--toolsrc/include/vcpkg/vcpkglib.h2
-rw-r--r--toolsrc/include/vcpkg/vcpkgpaths.h31
-rw-r--r--toolsrc/include/vcpkg/versiont.h4
-rw-r--r--toolsrc/src/tests.plan.cpp146
-rw-r--r--toolsrc/src/vcpkg.cpp2
-rw-r--r--toolsrc/src/vcpkg/base/chrono.cpp10
-rw-r--r--toolsrc/src/vcpkg/base/cofffilereader.cpp102
-rw-r--r--toolsrc/src/vcpkg/base/files.cpp17
-rw-r--r--toolsrc/src/vcpkg/base/strings.cpp20
-rw-r--r--toolsrc/src/vcpkg/base/system.cpp46
-rw-r--r--toolsrc/src/vcpkg/binaryparagraph.cpp4
-rw-r--r--toolsrc/src/vcpkg/build.cpp98
-rw-r--r--toolsrc/src/vcpkg/commands.cache.cpp2
-rw-r--r--toolsrc/src/vcpkg/commands.ci.cpp7
-rw-r--r--toolsrc/src/vcpkg/commands.contact.cpp14
-rw-r--r--toolsrc/src/vcpkg/commands.cpp5
-rw-r--r--toolsrc/src/vcpkg/commands.create.cpp4
-rw-r--r--toolsrc/src/vcpkg/commands.dependinfo.cpp3
-rw-r--r--toolsrc/src/vcpkg/commands.edit.cpp7
-rw-r--r--toolsrc/src/vcpkg/commands.exportifw.cpp6
-rw-r--r--toolsrc/src/vcpkg/commands.fetch.cpp717
-rw-r--r--toolsrc/src/vcpkg/commands.hash.cpp222
-rw-r--r--toolsrc/src/vcpkg/commands.import.cpp2
-rw-r--r--toolsrc/src/vcpkg/commands.integrate.cpp27
-rw-r--r--toolsrc/src/vcpkg/commands.list.cpp11
-rw-r--r--toolsrc/src/vcpkg/commands.owns.cpp2
-rw-r--r--toolsrc/src/vcpkg/commands.portsdiff.cpp7
-rw-r--r--toolsrc/src/vcpkg/commands.upgrade.cpp3
-rw-r--r--toolsrc/src/vcpkg/commands.version.cpp2
-rw-r--r--toolsrc/src/vcpkg/dependencies.cpp452
-rw-r--r--toolsrc/src/vcpkg/export.cpp27
-rw-r--r--toolsrc/src/vcpkg/metrics.cpp17
-rw-r--r--toolsrc/src/vcpkg/parse.cpp1
-rw-r--r--toolsrc/src/vcpkg/postbuildlint.cpp8
-rw-r--r--toolsrc/src/vcpkg/remove.cpp4
-rw-r--r--toolsrc/src/vcpkg/statusparagraph.cpp11
-rw-r--r--toolsrc/src/vcpkg/triplet.cpp3
-rw-r--r--toolsrc/src/vcpkg/update.cpp11
-rw-r--r--toolsrc/src/vcpkg/vcpkglib.cpp24
-rw-r--r--toolsrc/src/vcpkg/vcpkgpaths.cpp659
-rw-r--r--toolsrc/src/vcpkg/versiont.cpp4
-rw-r--r--toolsrc/vcpkglib/vcpkglib.vcxproj1
-rw-r--r--toolsrc/vcpkglib/vcpkglib.vcxproj.filters3
161 files changed, 2318 insertions, 1672 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 36c40f6e8..0cc88e2c2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,68 @@
+vcpkg (0.0.108)
+--------------
+ * Add ports:
+ - google-cloud-cpp 0.1.0
+ - mhook 2.5.1-1
+ - mosquitto 1.4.15
+ - pmdk 1.4-1 (renamed from nvml)
+ * Remove Ports:
+ - nvml 1.3-0 (renamed to pmdk)
+ * Update ports:
+ - abseil 2018-03-23 -> 2018-04-05
+ - asio 1.12.0-1 -> 1.12.0-2
+ - aws-sdk-cpp 1.4.21 -> 1.4.30-1
+ - azure-c-shared-utility 1.0.0-pre-release-1.0.9 -> 1.1.2
+ - azure-iot-sdk-c 1.0.0-pre-release-1.0.9 -> 1.2.2
+ - azure-uamqp-c 1.0.0-pre-release-1.0.9 -> 1.2.2
+ - azure-umqtt-c 1.0.0-pre-release-1.0.9 -> 1.1.2
+ - breakpad 2018-03-13 -> 2018-04-05
+ - clara 2018-03-23 -> 2018-04-02
+ - cryptopp 5.6.5-1 -> 6.1.0-2
+ - discord-rpc 3.1.0 -> 3.2.0
+ - dlib 19.10 -> 19.10-1
+ - eastl 3.08.00 -> 3.09.00
+ - exiv2 2018-03-23 -> 2018-04-05
+ - folly 2017.11.27.00-3 -> 2018.03.19.00-2
+ - forest 4.5.0 -> 7.0.1
+ - gdcm2 2.8.5 -> 2.8.6
+ - grpc 1.10.0 -> 1.10.1
+ - gtest 1.8.0-7 -> 1.8.0-8
+ - libiconv 1.15-2 -> 1.15-3
+ - libuv 1.19.2 -> 1.20.0
+ - libvpx 1.6.1-2 -> 1.7.0
+ - libxml2 2.9.4-4 -> 2.9.4-5
+ - nuklear 2018-03-23 -> 2018-04-05
+ - openimageio 1.8.9 -> 1.8.10
+ - openssl 1.0.2n-3 -> 1.0.2o-1
+ - qt5-base 5.9.2-5 -> 5.9.2-6
+ - qt5-modularscripts 2 -> 3
+ - qwt 6.1.3-4 -> 6.1.3-5
+ - recast 1.5.1 -> 1.5.1-1
+ - rocksdb 5.11.3 -> 5.12.2
+ - rs-core-lib 2018-03-17 -> 2018-04-05
+ - sciter 4.1.4 -> 4.1.5
+ - tbb 2018_U2 -> 2018_U3
+ - tesseract 3.05.01-2 -> 3.05.01-3
+ - theia 0.7-d15154a-1 -> 0.7-d15154a-3
+ - thrift 2018-03-23 -> 2018-04-05
+ - unrar 5.5.8 -> 5.5.8-1
+ - yoga 1.7.0 -> 1.7.0-1
+ - zeromq 2018-03-23 -> 2018-04-05
+ * `vcpkg.cmake`: Remove detection for Windows SDK. Let `cmake` detect it instead.
+ * Rework `vcpkgTools.xml`.
+ - `<requiredVersion>` renamed to `<version>`
+ - `<archiveRelativePath>` renamed `<archiveName>`
+ - `<sha256>` changed to `<sha512>`
+ - `<tool>` tags now specify an `os="x"` property
+ - The version of the tools list (i.e. `<tools version="1">`) is now verified by `vcpkg.exe`.
+ * Use [7zip](https://www.7-zip.org/) to extract vcpkg tools defined in `vcpkgTools.xml`.
+ * Use [aria2](https://aria2.github.io/) to download vcpkg tools defined in `vcpkgTools.xml`.
+ - The experimental flag `vcpkg install <port> --x-use-aria2` allows you to use `aria2` for other downloads as well.
+ * `vckg hash` improvements
+
+-- vcpkg team <vcpkg@microsoft.com> FRI, 06 Apr 2018 19:30:00 -0800
+
+
vcpkg (0.0.107)
--------------
* Add ports:
diff --git a/ports/abseil/CONTROL b/ports/abseil/CONTROL
index b7ef25750..42edc7e12 100644
--- a/ports/abseil/CONTROL
+++ b/ports/abseil/CONTROL
@@ -1,5 +1,5 @@
Source: abseil
-Version: 2018-04-02
+Version: 2018-04-09
Description: an open-source collection designed to augment the C++ standard library.
Abseil is an open-source collection of C++ library code designed to augment the C++ standard library. The Abseil library code is collected from Google's own C++ code base, has been extensively tested and used in production, and is the same code we depend on in our daily coding lives.
In some cases, Abseil provides pieces missing from the C++ standard; in others, Abseil provides alternatives to the standard for special needs we've found through usage in the Google code base. We denote those cases clearly within the library code we provide you.
diff --git a/ports/abseil/portfile.cmake b/ports/abseil/portfile.cmake
index 4ccdb27a6..f2a08328b 100644
--- a/ports/abseil/portfile.cmake
+++ b/ports/abseil/portfile.cmake
@@ -7,8 +7,8 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO abseil/abseil-cpp
- REF 7b3c38a0628b9201ce92a6893b96890b64e5daa8
- SHA512 6e23d98adabbefcf8054a0ff03fdbc5438efbd957cd4864ab870496468f9891eeb8f73796a37faba7412a4b88b96771fc23f3f0bb89ab6023800beb99e6660d3
+ REF 3f622d6c5990a7ae80eb8e52450c309a28bbec77
+ SHA512 27c11bbe4e321fcd42f1947fab2a7deb108443bf46260e7f7920cc28442a4dbfbf315d579e866b2d82e92cfe1fd43e82cbd51e907cbf74a25d724cfd8acda055
HEAD_REF master
)
diff --git a/ports/asio/CONTROL b/ports/asio/CONTROL
index cd9914052..ec8ab41a8 100644
--- a/ports/asio/CONTROL
+++ b/ports/asio/CONTROL
@@ -1,4 +1,3 @@
Source: asio
-Version: 1.12.0-1
-Build-Depends: boost-config, boost-throw-exception, boost-utility, boost-date-time
+Version: 1.12.0-2
Description: Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach.
diff --git a/ports/asio/portfile.cmake b/ports/asio/portfile.cmake
index f6980f14e..284e25300 100644
--- a/ports/asio/portfile.cmake
+++ b/ports/asio/portfile.cmake
@@ -15,3 +15,8 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/COPYING ${CURRENT_PACKAGES_DIR
# Copy the asio header files
file(INSTALL ${SOURCE_PATH}/asio/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.hpp" PATTERN "*.ipp")
+
+# Always use "ASIO_STANDALONE" to avoid boost dependency
+file(READ "${CURRENT_PACKAGES_DIR}/include/asio/detail/config.hpp" _contents)
+string(REPLACE "defined(ASIO_STANDALONE)" "!defined(VCPKG_DISABLE_ASIO_STANDALONE)" _contents "${_contents}")
+file(WRITE "${CURRENT_PACKAGES_DIR}/include/asio/detail/config.hpp" "${_contents}")
diff --git a/ports/aws-sdk-cpp/CONTROL b/ports/aws-sdk-cpp/CONTROL
index b4004cdc0..c9338b0cc 100644
--- a/ports/aws-sdk-cpp/CONTROL
+++ b/ports/aws-sdk-cpp/CONTROL
@@ -1,6 +1,7 @@
Source: aws-sdk-cpp
-Version: 1.4.27
+Version: 1.4.32
Description: AWS SDK for C++
+Build-Depends: openssl (!uwp&!windows), curl (!uwp&!windows)
Default-Features: dynamodb, ec2, kms, rds, s3, sns, sqs
# Automatically generated by generateFeatures.ps1
@@ -103,6 +104,9 @@ Description: C++ SDK for the AWS comprehend service
Feature: config
Description: C++ SDK for the AWS config service
+Feature: connect
+Description: C++ SDK for the AWS connect service
+
Feature: cur
Description: C++ SDK for the AWS cur service
diff --git a/ports/aws-sdk-cpp/CONTROL.in b/ports/aws-sdk-cpp/CONTROL.in
index 5cf05fdff..184374de6 100644
--- a/ports/aws-sdk-cpp/CONTROL.in
+++ b/ports/aws-sdk-cpp/CONTROL.in
@@ -1,4 +1,5 @@
Source: aws-sdk-cpp
-Version: 1.4.21
+Version: 1.4.30-1
Description: AWS SDK for C++
+Build-Depends: openssl (!uwp&!windows), curl (!uwp&!windows)
Default-Features: dynamodb, ec2, kms, rds, s3, sns, sqs
diff --git a/ports/aws-sdk-cpp/compute_build_only.cmake b/ports/aws-sdk-cpp/compute_build_only.cmake
index a50ed2128..f4a139153 100644
--- a/ports/aws-sdk-cpp/compute_build_only.cmake
+++ b/ports/aws-sdk-cpp/compute_build_only.cmake
@@ -98,6 +98,9 @@ endif()
if("config" IN_LIST FEATURES)
list(APPEND BUILD_ONLY config)
endif()
+if("connect" IN_LIST FEATURES)
+ list(APPEND BUILD_ONLY connect)
+endif()
if("cur" IN_LIST FEATURES)
list(APPEND BUILD_ONLY cur)
endif()
diff --git a/ports/aws-sdk-cpp/portfile.cmake b/ports/aws-sdk-cpp/portfile.cmake
index 26129db5c..6b3b1f241 100644
--- a/ports/aws-sdk-cpp/portfile.cmake
+++ b/ports/aws-sdk-cpp/portfile.cmake
@@ -3,8 +3,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO aws/aws-sdk-cpp
- REF 1.4.27
- SHA512 d714fe12d3701461b897256d824b169ff3242bb412d386a2c1455c0dc1dcedf3add444eab556551fbb69e0339b49c3133c1f820710b5681d25a23237e919ddd0
+ REF 1.4.32
+ SHA512 f37aaf1d439acd1563fe50624e2e7856ba5d267a540a8cd1fde80d0d7bd9e2cdd261f9f6e3e843548cc17b8ea7158419a9e0ed27092acf5c22b5c9e38d327c64
HEAD_REF master
)
@@ -14,8 +14,11 @@ set(BUILD_ONLY core)
include(${CMAKE_CURRENT_LIST_DIR}/compute_build_only.cmake)
-# This handles escaping the list
-string(REPLACE ";" "\\\\\\;" BUILD_ONLY "${BUILD_ONLY}")
+if(CMAKE_HOST_WIN32)
+ string(REPLACE ";" "\\\\\\;" BUILD_ONLY "${BUILD_ONLY}")
+else()
+ string(REPLACE ";" "\\\\\\\\\\\;" BUILD_ONLY "${BUILD_ONLY}")
+endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
diff --git a/ports/azure-c-shared-utility/CONTROL b/ports/azure-c-shared-utility/CONTROL
index 99cbcd38d..97d0a9a64 100644
--- a/ports/azure-c-shared-utility/CONTROL
+++ b/ports/azure-c-shared-utility/CONTROL
@@ -1,3 +1,3 @@
Source: azure-c-shared-utility
-Version: 1.0.0-pre-release-1.0.9
+Version: 1.1.2
Description: Azure C SDKs common code
diff --git a/ports/azure-c-shared-utility/portfile.cmake b/ports/azure-c-shared-utility/portfile.cmake
index 4635f0d97..6aea93dad 100644
--- a/ports/azure-c-shared-utility/portfile.cmake
+++ b/ports/azure-c-shared-utility/portfile.cmake
@@ -8,8 +8,8 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Azure/azure-c-shared-utility
- REF 1.0.0-pre-release-1.0.9
- SHA512 df28d0bb01961943d86febd7b54bafd7037b8461b4025e1db26ba0b76c4cadfa722c4cb5695ac0d4f57e16576eb23f3da02703bcc363af54a0476bccec95ce45
+ REF 1.1.2
+ SHA512 23c576efe0cc6c4a47d356f1e0be9e23d2b4e22692d35efa7d0d627a05fad245c55a81d26e60e1f7f7676d547a0e28c357846d2854b31f3f6ae7c39a934cf3d4
HEAD_REF master
)
diff --git a/ports/azure-iot-sdk-c/CONTROL b/ports/azure-iot-sdk-c/CONTROL
index 8c9bdb956..72ecadfca 100644
--- a/ports/azure-iot-sdk-c/CONTROL
+++ b/ports/azure-iot-sdk-c/CONTROL
@@ -1,4 +1,4 @@
Source: azure-iot-sdk-c
-Version: 1.0.0-pre-release-1.0.9
+Version: 1.2.2
Build-Depends: azure-uamqp-c, azure-umqtt-c, azure-c-shared-utility, parson
Description: A C99 SDK for connecting devices to Microsoft Azure IoT services
diff --git a/ports/azure-iot-sdk-c/portfile.cmake b/ports/azure-iot-sdk-c/portfile.cmake
index e4f0d8758..a1e864ab2 100644
--- a/ports/azure-iot-sdk-c/portfile.cmake
+++ b/ports/azure-iot-sdk-c/portfile.cmake
@@ -8,8 +8,8 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Azure/azure-iot-sdk-c
- REF 1.0.0-pre-release-1.0.9
- SHA512 972b5da73399805963031dfacc436665c1a7aaecf4a0035af369d9cf184cb4e7be608b4ca5768902dcfb04f18324c399d095f6543ff3d1da835c40da6e18934e
+ REF 1.2.2
+ SHA512 1542f8347e5efc3104eacf1696b84739299bedb4f50dce3869b3a53072b5c016aadf34223658c18fe28e87eab775a0687b5bf18b5629a7a87b8709b123b3599a
HEAD_REF master
)
diff --git a/ports/azure-uamqp-c/CONTROL b/ports/azure-uamqp-c/CONTROL
index 03b4a2402..832675f10 100644
--- a/ports/azure-uamqp-c/CONTROL
+++ b/ports/azure-uamqp-c/CONTROL
@@ -1,4 +1,4 @@
Source: azure-uamqp-c
-Version: 1.0.0-pre-release-1.0.9
+Version: 1.2.2
Build-Depends: azure-c-shared-utility
Description: AMQP library for C
diff --git a/ports/azure-uamqp-c/portfile.cmake b/ports/azure-uamqp-c/portfile.cmake
index a4407963c..e912c30fd 100644
--- a/ports/azure-uamqp-c/portfile.cmake
+++ b/ports/azure-uamqp-c/portfile.cmake
@@ -8,8 +8,8 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Azure/azure-uamqp-c
- REF 1.0.0-pre-release-1.0.9
- SHA512 8c7142e0f28779847501941effc8baa0d3411e76bec00a3af0a32f5e25c0ded200d1345fcea58d922d7b0e2b736bc2a57ecaaac23d4de7f97c75a22793cd3750
+ REF 1.2.2
+ SHA512 66d4169ecfa1f0bc37c1b61de34908703d1f2d49d5b6edf5aa0c208795117b614a3c0afbba95df3ffc5364f4fd45debe2c95ac7a5be86fbd42d997b4db2aaf9c
HEAD_REF master
)
diff --git a/ports/azure-umqtt-c/CONTROL b/ports/azure-umqtt-c/CONTROL
index 79bd87b79..d8aff61a8 100644
--- a/ports/azure-umqtt-c/CONTROL
+++ b/ports/azure-umqtt-c/CONTROL
@@ -1,4 +1,4 @@
Source: azure-umqtt-c
-Version: 1.0.0-pre-release-1.0.9
+Version: 1.1.2
Build-Depends: azure-c-shared-utility
Description: General purpose library for communication over the mqtt protocol
diff --git a/ports/azure-umqtt-c/portfile.cmake b/ports/azure-umqtt-c/portfile.cmake
index 9a9002166..b66ab4f2e 100644
--- a/ports/azure-umqtt-c/portfile.cmake
+++ b/ports/azure-umqtt-c/portfile.cmake
@@ -8,8 +8,8 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Azure/azure-umqtt-c
- REF 1.0.0-pre-release-1.0.9
- SHA512 8cabeb431e1b8db64551c0374e80157d9db39011f38db8d3a3dfb77ddf3d6ffed4d6ee0ab697a0af3ce93571fc8a83bb2f3efa52387afe301583151e75f55658
+ REF 1.1.2
+ SHA512 e99b1292d6acdefef43b13cb2ad5b5972ed9e65fb3b2b3eacf06486e88f65fdb1e119fd0cf7dadddb1b1dffaef1aa30edda68fa5dc8aa2b22bcdad2d56e1de63
HEAD_REF master
)
diff --git a/ports/breakpad/CONTROL b/ports/breakpad/CONTROL
index 76e76668b..80789a41d 100644
--- a/ports/breakpad/CONTROL
+++ b/ports/breakpad/CONTROL
@@ -1,4 +1,4 @@
Source: breakpad
-Version: 2018-03-27
+Version: 2018-04-05
Build-Depends: libdisasm
Description: a set of client and server components which implement a crash-reporting system.
diff --git a/ports/breakpad/portfile.cmake b/ports/breakpad/portfile.cmake
index 29cf87498..5030bb936 100644
--- a/ports/breakpad/portfile.cmake
+++ b/ports/breakpad/portfile.cmake
@@ -3,8 +3,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/breakpad
- REF e93f852a3c316ad767381d5e5bc839eba5c6225b
- SHA512 8139472f4f9ce01770cf2922a52cc63fa009cfff93db893d297f61a1b44198b10bba73c92977e84c18a90ef7e71f0911e4fe9d27e8978fc38f231e499e23fc4d
+ REF adcc90ddb8c9ebc13a4312116ad92d8628b691c3
+ SHA512 f6dbdad54dcd778a2ece7de28b60b95c2c276d386f672ab5990c6de41f17fa526f6d1092e38163647ed2feed07c91826ec3f4c21a219ca5f5fac203a7a21eeec
HEAD_REF master
)
diff --git a/ports/catch2/CONTROL b/ports/catch2/CONTROL
index faa5f0574..a466f7be5 100644
--- a/ports/catch2/CONTROL
+++ b/ports/catch2/CONTROL
@@ -1,4 +1,4 @@
Source: catch2
-Version: 2.2.1-1
+Version: 2.2.2
Description: A modern, header-only test framework for unit testing.
Issues, PRs and changelogs can be found at https://github.com/catchorg/Catch2
diff --git a/ports/catch2/portfile.cmake b/ports/catch2/portfile.cmake
index 65a38d8f0..5329d9cab 100644
--- a/ports/catch2/portfile.cmake
+++ b/ports/catch2/portfile.cmake
@@ -3,8 +3,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO catchorg/Catch2
- REF v2.2.1
- SHA512 48d3a0384dcd19fe622c4fda51639be36c904aaff77f5857615010c57e69d8e9f1deb2156e3e4882a592fe260d2bae0efa3cd02c2a2cabe07d9f9db09051a6b0
+ REF v2.2.2
+ SHA512 ab91036c6c3ace087d0382ce99f26b2c30a4b75d52f285619ca282a618470fe388afe47495f3b2764268d600c6834c60ba464483d06f3a1c4316c099477c8e38
HEAD_REF master
)
diff --git a/ports/directxmesh/CONTROL b/ports/directxmesh/CONTROL
index 9ccd7156e..41b26ef1a 100644
--- a/ports/directxmesh/CONTROL
+++ b/ports/directxmesh/CONTROL
@@ -1,3 +1,3 @@
-Source: directxmesh
-Version: feb2018
+Source: directxmesh
+Version: feb2018-eb751e0b631b05aa25c36c08e7d6bbf09f5e94a9
Description: DirectXMesh geometry processing library \ No newline at end of file
diff --git a/ports/directxmesh/portfile.cmake b/ports/directxmesh/portfile.cmake
index 69f335c61..6d64d3658 100644
--- a/ports/directxmesh/portfile.cmake
+++ b/ports/directxmesh/portfile.cmake
@@ -12,8 +12,8 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Microsoft/DirectXMesh
- REF feb2018
- SHA512 b5d21c8960ef9c8f2e608807ce29fd4873d0f4ad5bb0b6432f6efbb6110bfd61a16fbaab8a5c626cc1977f48923a562a618f29b9b2f112db625c0a8eb43f0422
+ REF eb751e0b631b05aa25c36c08e7d6bbf09f5e94a9
+ SHA512 35a6be07fbdf5d9a39e7f5a3716057d09643d0c4bb43d39beae4233ca6941d2e2318b826dcc4a385dfa512675c7e28f320067b88bb325943b6532c8e65ebcd1b
HEAD_REF master
)
diff --git a/ports/exiv2/CONTROL b/ports/exiv2/CONTROL
index 3e7d58c9a..af05d4ddf 100644
--- a/ports/exiv2/CONTROL
+++ b/ports/exiv2/CONTROL
@@ -1,4 +1,4 @@
Source: exiv2
-Version: 2018-04-02
+Version: 2018-04-09
Build-Depends: zlib, expat, libiconv
Description: Image metadata library and tools http://www.exiv2.org
diff --git a/ports/exiv2/portfile.cmake b/ports/exiv2/portfile.cmake
index 99a72304f..109105085 100644
--- a/ports/exiv2/portfile.cmake
+++ b/ports/exiv2/portfile.cmake
@@ -3,8 +3,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Exiv2/exiv2
- REF 07d75cd0e833286ce9e301ea83229f3e283c6191
- SHA512 8cf5cb919c12e719d70f2ea71c84835f09f2962095eeb56bb27ef3cd22ad4ea032dfbf9704f9c7393de0a969d3ae0609dafeb619b6c28dca598c8f34a3810b4d
+ REF fbd8e2669e223d43c34777c61029bb19b4c6e833
+ SHA512 9c87e3123458e9dbf24df80118a09a6cc2c10855b19e59b3164634166b10f2daef54ac35a207bf8865eeb08cbc1d2d5b2ab33e4f2539bf8ffa82a7012c0eecc4
HEAD_REF master
)
diff --git a/ports/folly/CONTROL b/ports/folly/CONTROL
index cb3a464af..865c93ce6 100644
--- a/ports/folly/CONTROL
+++ b/ports/folly/CONTROL
@@ -1,5 +1,5 @@
Source: folly
-Version: 2018.03.19.00-2
+Version: 2018.04.09.00
Description: An open-source C++ library developed and used at Facebook. The library is UNSTABLE on Windows
Build-Depends: openssl, libevent, double-conversion, glog, gflags, boost-chrono, boost-context, boost-conversion, boost-crc, boost-date-time, boost-filesystem, boost-multi-index, boost-program-options, boost-regex, boost-system, boost-thread
Default-Features: zlib
diff --git a/ports/folly/portfile.cmake b/ports/folly/portfile.cmake
index ce101d918..520ab0539 100644
--- a/ports/folly/portfile.cmake
+++ b/ports/folly/portfile.cmake
@@ -17,8 +17,8 @@ set(ENV{PATH} "$ENV{PATH};${PYTHON3_DIR}")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO facebook/folly
- REF v2018.03.19.00
- SHA512 72df8768753bf9f1109ad3f16645d811906b633833c91c7d9fe856a06c16b5e398876cf6cae415401eff96b568c99ffa1dc0c44d81cd40219bafb0f4c72fc2ca
+ REF v2018.04.09.00
+ SHA512 625034437ee6c261949652dbd6cafb50b0954b691750e4591cd0eb03cf369348cfae3b4b98c012bd906a157b7642ebcb1d8843311c74416ed51bffc5b1da3018
HEAD_REF master
)
@@ -75,7 +75,7 @@ vcpkg_install_cmake(ADD_BIN_TO_PATH)
vcpkg_copy_pdbs()
-vcpkg_fixup_cmake_targets()
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/folly)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
diff --git a/ports/forest/CONTROL b/ports/forest/CONTROL
index 522668d9d..76dbbf47e 100644
--- a/ports/forest/CONTROL
+++ b/ports/forest/CONTROL
@@ -1,3 +1,3 @@
Source: forest
-Version: 4.5.0
-Description: Forest is an open-source, template library of tree data structures written in C++11.
+Version: 7.0.6
+Description: Template library of tree data structures
diff --git a/ports/forest/portfile.cmake b/ports/forest/portfile.cmake
index 6f076a0db..48ab6c9dd 100644
--- a/ports/forest/portfile.cmake
+++ b/ports/forest/portfile.cmake
@@ -1,13 +1,12 @@
-# Ηeader-only library
-
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/forest-4.5.0)
-vcpkg_download_distfile(ARCHIVE
- URLS "https://github.com/xorz57/forest/archive/4.5.0.zip"
- FILENAME "forest-4.5.0.zip"
- SHA512 ae256ad38802d0827cfcd45ffae35ddb95cf74e38cf3e5d806f6e2215f701abfb8159f82e2bb6362788fe96a9f9008429d366e7abbc7980b29b3528052cfe43e
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO xorz57/forest
+ REF 7.0.6
+ SHA512 a1e5d27f2b8b9e6758a67a9124fc25517074c633644651b26f6683bab09189569e75ccf4ae7d9cfeddae234435b073fc00e0f5385c4e9370062c3e8b222c1c59
+ HEAD_REF master
)
-vcpkg_extract_source_archive(${ARCHIVE})
# Handle headers
file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.h")
diff --git a/ports/gdcm2/CONTROL b/ports/gdcm2/CONTROL
index 6268c788f..45900dbab 100644
--- a/ports/gdcm2/CONTROL
+++ b/ports/gdcm2/CONTROL
@@ -1,4 +1,4 @@
Source: gdcm2
-Version: 2.8.5
+Version: 2.8.6
Description: Grassroots DICOM library
Build-Depends: zlib, expat
diff --git a/ports/gdcm2/portfile.cmake b/ports/gdcm2/portfile.cmake
index 7e8c89611..65fa7a6e1 100644
--- a/ports/gdcm2/portfile.cmake
+++ b/ports/gdcm2/portfile.cmake
@@ -14,8 +14,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO malaterre/GDCM
- REF v2.8.5
- SHA512 644a7ad04746ffb36b7923796b967cc11fd3b71baede7722093d5785eaf869280c67a968f6b32aeb43cc7c88927fba78459e4846e058996a1634311311745510
+ REF v2.8.6
+ SHA512 c04c131afae6a326978d82ea7c6f42eaa5d8e0f9d9dc3b6ad531a2d6ef7261e603cef32f364609ae99ff33f144373fe7bdd62056e535b6d487b0a4b13919062e
)
vcpkg_apply_patches(
diff --git a/ports/graphicsmagick/CMakeLists.txt b/ports/graphicsmagick/CMakeLists.txt
index 035a193cc..27f9fb109 100644
--- a/ports/graphicsmagick/CMakeLists.txt
+++ b/ports/graphicsmagick/CMakeLists.txt
@@ -77,7 +77,7 @@ add_library(graphicsmagick coders/art.c coders/avs.c
coders/tiff.c coders/tile.c coders/tim.c coders/topol.c
coders/ttf.c coders/txt.c coders/uil.c coders/url.c
coders/uyvy.c coders/vicar.c coders/vid.c coders/viff.c
- coders/wbmp.c coders/webp.c coders/wmf.c coders/wpg.c
+ coders/wbmp.c coders/wmf.c coders/wpg.c
coders/x.c coders/xbm.c coders/xc.c coders/xcf.c
coders/xpm.c coders/xtrn.c coders/xwd.c coders/yuv.c
filters/analyze.c
diff --git a/ports/graphicsmagick/CONTROL b/ports/graphicsmagick/CONTROL
index 17f2a635d..275bae92f 100644
--- a/ports/graphicsmagick/CONTROL
+++ b/ports/graphicsmagick/CONTROL
@@ -1,4 +1,4 @@
Source: graphicsmagick
-Version: 1.3.26-2
+Version: 1.3.28
Build-Depends: zlib, bzip2, freetype, libjpeg-turbo, libpng, tiff
Description: Image processing library
diff --git a/ports/graphicsmagick/portfile.cmake b/ports/graphicsmagick/portfile.cmake
index 6636802cf..12630d346 100644
--- a/ports/graphicsmagick/portfile.cmake
+++ b/ports/graphicsmagick/portfile.cmake
@@ -1,12 +1,12 @@
include(vcpkg_common_functions)
-set(GM_VERSION 1.3.26)
+set(GM_VERSION 1.3.28)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/graphicsmagick-${GM_VERSION}-windows-source)
vcpkg_download_distfile(ARCHIVE
URLS "https://sourceforge.net/projects/graphicsmagick/files/graphicsmagick/${GM_VERSION}/GraphicsMagick-${GM_VERSION}-windows-source.7z"
FILENAME "GraphicsMagick-${GM_VERSION}-windows-source.7z"
- SHA512 c45a054d082d9a7a2889a2235dd5b96bd564acf55bd581426ecd32c426f9797d7d56d6e5f25a5a7da8ebd26bf0d962372b5d48d86532dc6c57522d27c0d18ec8
+ SHA512 0271c187634580204dcc3173553bae9e3cd799203d621ad9e2ba64be778760ac307f25af54859b10e60f8e2589287ad98062548f1c3c94f229e68e7c83878419
)
vcpkg_extract_source_archive(${ARCHIVE})
diff --git a/ports/grpc/CONTROL b/ports/grpc/CONTROL
index 707c8cb8b..088d9336e 100644
--- a/ports/grpc/CONTROL
+++ b/ports/grpc/CONTROL
@@ -1,4 +1,4 @@
Source: grpc
-Version: 1.10.0
+Version: 1.10.1
Build-Depends: zlib, openssl, protobuf, c-ares
Description: An RPC library and framework
diff --git a/ports/grpc/portfile.cmake b/ports/grpc/portfile.cmake
index abab22925..f68f67e64 100644
--- a/ports/grpc/portfile.cmake
+++ b/ports/grpc/portfile.cmake
@@ -12,8 +12,8 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO grpc/grpc
- REF v1.10.0
- SHA512 52a3e2710fd51b92fb6345cddb9fd64a9b826bcb85dba86075b5e8465abf6dbc26a9245c9f79dd68b0c11a4fa3b983513091000991b61d77761b7debcdac3703
+ REF v1.10.1
+ SHA512 2221d902c60eada6dd1547a63d26bd3b30cb6710247b5e48523bacde498a3691cc177f1dbe9db8a007b8ae341a5b0c8ec999539e26a9bcff480a8d0b02140997
HEAD_REF master
)
diff --git a/ports/icu/CONTROL b/ports/icu/CONTROL
index 3553238f9..9d8320762 100644
--- a/ports/icu/CONTROL
+++ b/ports/icu/CONTROL
@@ -1,3 +1,3 @@
Source: icu
-Version: 59.1-1
+Version: 61.1-1
Description: Mature and widely used Unicode and localization library.
diff --git a/ports/icu/portfile.cmake b/ports/icu/portfile.cmake
index dcf9efda5..afacc076c 100644
--- a/ports/icu/portfile.cmake
+++ b/ports/icu/portfile.cmake
@@ -1,15 +1,31 @@
+# Common Ambient Variables:
+# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
+# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
+# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
+# PORT = current port name (zlib, etc)
+# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
+# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
+# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
+# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
+# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
+#
if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
message(FATAL_ERROR "Error: UWP builds are currently not supported.")
endif()
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/icu-59.1/icu)
-set(ICU_VERSION 59)
-vcpkg_download_distfile(ARCHIVE
- URLS "http://download.icu-project.org/files/icu4c/59.1/icu4c-59_1-src.zip"
- FILENAME "icu4c-59_1-src.zip"
- SHA512 1d3b39678e7cc4e9794e724982886a4918642231048eb76b9f683aad5a19e0b7c52b3b9c7107cb1a3879464682c4a3a97b58ab012d082bd9e5a80c67adf8ce8b)
-vcpkg_extract_source_archive(${ARCHIVE} ${CURRENT_BUILDTREES_DIR}/src/icu-59.1)
+set(VERSION 61.1)
+set(VERSION2 61_1)
+set(ICU_VERSION_MAJOR 61)
+
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/icu-${VERSION}/icu)
+vcpkg_download_distfile(
+ ARCHIVE
+ URLS "http://download.icu-project.org/files/icu4c/${VERSION}/icu4c-${VERSION2}-src.zip"
+ FILENAME "icu4c-${VERSION2}-src.zip"
+ SHA512 60fed25976b8c2fe2df0b0ab745ded24da237711ec8c1e1dbdfe6eaf2014fb6b3a4bcaa488174cf770737a1c159a2d3f48a86a139cbb277163f064e607b8928f
+ )
+vcpkg_extract_source_archive(${ARCHIVE} ${CURRENT_BUILDTREES_DIR}/src/icu-${VERSION})
vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/disable-escapestr-tool.patch)
@@ -109,8 +125,8 @@ file(REMOVE ${TEST_LIBS})
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
# copy icu dlls from lib to bin
- file(GLOB RELEASE_DLLS ${CURRENT_PACKAGES_DIR}/lib/icu*${ICU_VERSION}.dll)
- file(GLOB DEBUG_DLLS ${CURRENT_PACKAGES_DIR}/debug/lib/icu*d${ICU_VERSION}.dll)
+ file(GLOB RELEASE_DLLS ${CURRENT_PACKAGES_DIR}/lib/icu*${ICU_VERSION_MAJOR}.dll)
+ file(GLOB DEBUG_DLLS ${CURRENT_PACKAGES_DIR}/debug/lib/icu*d${ICU_VERSION_MAJOR}.dll)
file(COPY ${RELEASE_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
file(COPY ${DEBUG_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
else()
@@ -139,5 +155,6 @@ endif()
# This is expected because ICU database contains no executable code
vcpkg_copy_pdbs()
+# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/icu)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/icu/LICENSE ${CURRENT_PACKAGES_DIR}/share/icu/copyright)
diff --git a/ports/jsonnet/CONTROL b/ports/jsonnet/CONTROL
index f32796ca3..55bc73fa4 100644
--- a/ports/jsonnet/CONTROL
+++ b/ports/jsonnet/CONTROL
@@ -1,3 +1,3 @@
Source: jsonnet
-Version: 2018-03-17
+Version: 2018-04-09
Description: Jsonnet - The data templating language
diff --git a/ports/jsonnet/portfile.cmake b/ports/jsonnet/portfile.cmake
index 0041d7f2c..02afe21b8 100644
--- a/ports/jsonnet/portfile.cmake
+++ b/ports/jsonnet/portfile.cmake
@@ -3,8 +3,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/jsonnet
- REF 9829acf280a64b58ad0b14c9f5c28fe8564ed13e
- SHA512 5ddcc3d6bc91467da766ba0ed81251066e348db14d1fdf681bdd6c08189249d1c221dab73cc6bdf85465217aeda186f2f5c0eee11bb179435a52ff57be12d20e
+ REF bdbb3b32dda55b42b1f8843acc88f7bb4e38103f
+ SHA512 a275b63169a24c3319029dee85ec1efec54310cbc8a347a3f791dae6c2565358b74ce48f373453abd7b57361b67388fb85b9401f014df0b132f1cf0dd9babb49
HEAD_REF master
)
diff --git a/ports/libiconv/CONTROL b/ports/libiconv/CONTROL
index 8bb9625b9..37c1a0f0d 100644
--- a/ports/libiconv/CONTROL
+++ b/ports/libiconv/CONTROL
@@ -1,3 +1,3 @@
Source: libiconv
-Version: 1.15-2
+Version: 1.15-3
Description: GNU Unicode text conversion
diff --git a/ports/libiconv/portfile.cmake b/ports/libiconv/portfile.cmake
index bded180db..5cc48da91 100644
--- a/ports/libiconv/portfile.cmake
+++ b/ports/libiconv/portfile.cmake
@@ -1,7 +1,7 @@
if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/libiconv)
- file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-iconv-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/libiconv)
+ file(COPY ${CMAKE_CURRENT_LIST_DIR}/unofficial-iconv-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/unofficial-iconv)
return()
endif()
diff --git a/ports/libiconv/unofficial-iconv-config.cmake b/ports/libiconv/unofficial-iconv-config.cmake
new file mode 100644
index 000000000..e272ce09e
--- /dev/null
+++ b/ports/libiconv/unofficial-iconv-config.cmake
@@ -0,0 +1,2 @@
+add_library(unofficial::iconv::libcharset UNKNOWN IMPORTED)
+add_library(unofficial::iconv::libiconv UNKNOWN IMPORTED)
diff --git a/ports/libiconv/vcpkg-iconv-config.cmake b/ports/libiconv/vcpkg-iconv-config.cmake
deleted file mode 100644
index 4befd4d15..000000000
--- a/ports/libiconv/vcpkg-iconv-config.cmake
+++ /dev/null
@@ -1,2 +0,0 @@
-add_library(unofficial::vcpkg::libcharset UNKNOWN IMPORTED)
-add_library(unofficial::vcpkg::libiconv UNKNOWN IMPORTED)
diff --git a/ports/liblinear/CMakeLists.txt b/ports/liblinear/CMakeLists.txt
new file mode 100644
index 000000000..6e6928a91
--- /dev/null
+++ b/ports/liblinear/CMakeLists.txt
@@ -0,0 +1,47 @@
+cmake_minimum_required(VERSION 3.9)
+project(liblinear)
+
+add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
+
+add_library(blas OBJECT
+ blas/daxpy.c
+ blas/ddot.c
+ blas/dnrm2.c
+ blas/dscal.c
+)
+
+add_library(liblinear
+ linear.cpp
+ tron.cpp
+ $<TARGET_OBJECTS:blas>
+)
+target_include_directories(liblinear PRIVATE .)
+if(BUILD_SHARED_LIBS)
+ target_link_libraries(liblinear PRIVATE "-DEF:${CMAKE_CURRENT_SOURCE_DIR}/linear.def")
+endif()
+
+add_executable(train train.c $<TARGET_OBJECTS:blas>)
+target_link_libraries(train liblinear)
+
+add_executable(predict predict.c $<TARGET_OBJECTS:blas>)
+target_link_libraries(predict liblinear)
+
+install(
+ TARGETS liblinear
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+
+if(NOT DISABLE_INSTALL_TOOLS)
+ install(
+ TARGETS train predict
+ RUNTIME DESTINATION tools/liblinear
+ )
+endif()
+
+if(NOT DISABLE_INSTALL_HEADERS)
+ install(
+ FILES linear.h tron.h
+ DESTINATION include/liblinear)
+endif() \ No newline at end of file
diff --git a/ports/liblinear/CONTROL b/ports/liblinear/CONTROL
new file mode 100644
index 000000000..3e83e601d
--- /dev/null
+++ b/ports/liblinear/CONTROL
@@ -0,0 +1,3 @@
+Source: liblinear
+Version: 2.20
+Description: A Library for Large Linear Classification
diff --git a/ports/liblinear/portfile.cmake b/ports/liblinear/portfile.cmake
new file mode 100644
index 000000000..4d662d0a5
--- /dev/null
+++ b/ports/liblinear/portfile.cmake
@@ -0,0 +1,26 @@
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO cjlin1/liblinear
+ REF v220
+ SHA512 cde798b7cb221513cf2b8bbe134d6c3dce1ed26c43504d8c09dbed93b82ca47bfd271d4dd3d03384187273906ce140d4ce4418a4a8c21410015ec1631c1042c6
+ HEAD_REF master
+)
+
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS_DEBUG
+ -DDISABLE_INSTALL_HEADERS=ON
+ -DDISABLE_INSTALL_TOOLS=ON
+)
+
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/liblinear)
+
+file(INSTALL ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/liblinear RENAME copyright)
+file(INSTALL ${SOURCE_PATH}/README DESTINATION ${CURRENT_PACKAGES_DIR}/share/liblinear)
diff --git a/ports/libxml2/CMakeLists.txt b/ports/libxml2/CMakeLists.txt
index 96ecb901d..3d49985ee 100644
--- a/ports/libxml2/CMakeLists.txt
+++ b/ports/libxml2/CMakeLists.txt
@@ -3,60 +3,16 @@ project(libxml2 C)
option(INSTALL_HEADERS "Install public header files" ON)
+set(CMAKE_SHARED_LIBRARY_PREFIX)
+set(CMAKE_STATIC_LIBRARY_PREFIX)
+
find_package(ZLIB REQUIRED)
find_package(LibLZMA REQUIRED)
-if(WIN32)
- find_library(ICONV NAMES libiconv)
- find_library(ICONV_CHARSET NAMES libcharset)
-endif()
+find_package(unofficial-iconv REQUIRED)
-set(SOURCES
- buf.c
- c14n.c
- catalog.c
- chvalid.c
- debugXML.c
- dict.c
- DOCBparser.c
- encoding.c
- entities.c
- error.c
- globals.c
- hash.c
- HTMLparser.c
- HTMLtree.c
- legacy.c
- list.c
- nanoftp.c
- nanohttp.c
- parser.c
- parserInternals.c
- pattern.c
- relaxng.c
- SAX.c
- SAX2.c
- schematron.c
- threads.c
- tree.c
- uri.c
- valid.c
- xinclude.c
- xlink.c
- xmlIO.c
- xmlmemory.c
- xmlreader.c
- xmlregexp.c
- xmlmodule.c
- xmlsave.c
- xmlschemas.c
- xmlschemastypes.c
- xmlstring.c
- xmlunicode.c
- xmlwriter.c
- xpath.c
- xpointer.c
- xzlib.c
-)
+file(GLOB SOURCES *.c)
+list(FILTER SOURCES EXCLUDE REGEX "/(run|test|trio)[^/]*$")
+list(FILTER SOURCES EXCLUDE REGEX "xml(lint|catalog).c$")
# Generate xmlexports with fixed definition of LIBXML_STATIC
file(READ include/libxml/xmlexports.h XMLEXPORTS_H)
@@ -67,25 +23,33 @@ else()
endif()
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/xmlexports.h "${XMLEXPORTS_H}")
-file(GLOB PUBLIC_HEADERS include/libxml/*.h)
-list(FILTER PUBLIC_HEADERS EXCLUDE REGEX "xmlexports\\.h$")
-list(APPEND PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/xmlexports.h)
-
-configure_file(include/win32config.h config.h COPYONLY)
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ configure_file(include/win32config.h config.h COPYONLY)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ configure_file("${PORT_DIR}/config.osx.h" config.h COPYONLY)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ configure_file("${PORT_DIR}/config.linux.h" config.h COPYONLY)
+else()
+ message(FATAL_ERROR "No config.h checked in for the target platform. Please run ./configure for libxml2 and add the resulting config.h into this port.")
+endif()
add_library(libxml2 ${SOURCES})
if(INSTALL_HEADERS)
+ file(GLOB PUBLIC_HEADERS include/libxml/*.h)
+ list(FILTER PUBLIC_HEADERS EXCLUDE REGEX "xmlexports\\.h$")
+ list(APPEND PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/xmlexports.h)
+
set_target_properties(libxml2 PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}")
endif()
-target_include_directories(libxml2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR} win32/vc10 include ${LIBLZMA_INCLUDE_DIRS})
+target_include_directories(libxml2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR} include ${LIBLZMA_INCLUDE_DIRS})
target_link_libraries(libxml2 PRIVATE
+ unofficial::iconv::libcharset unofficial::iconv::libiconv
ZLIB::ZLIB
${LIBLZMA_LIBRARIES}
)
-if(WIN32)
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ target_include_directories(libxml2 PRIVATE win32/vc10)
target_link_libraries(libxml2 PRIVATE
- ${ICONV}
- ${ICONV_CHARSET}
wsock32.lib
ws2_32.lib
)
diff --git a/ports/libxml2/CONTROL b/ports/libxml2/CONTROL
index b8552e48e..f005d2367 100644
--- a/ports/libxml2/CONTROL
+++ b/ports/libxml2/CONTROL
@@ -1,4 +1,4 @@
Source: libxml2
-Version: 2.9.4-4
+Version: 2.9.4-5
Description: Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform)
Build-Depends: zlib, libiconv, liblzma
diff --git a/ports/libxml2/config.linux.h b/ports/libxml2/config.linux.h
new file mode 100644
index 000000000..d029e95cf
--- /dev/null
+++ b/ports/libxml2/config.linux.h
@@ -0,0 +1,56 @@
+#define GETHOSTBYNAME_ARG_CAST /**/
+#define HAVE_ANSIDECL_H 1
+#define HAVE_ARPA_INET_H 1
+#define HAVE_ARPA_NAMESER_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_DIRENT_H 1
+#define HAVE_DLFCN_H 1
+#define HAVE_DLOPEN /**/
+#define HAVE_ERRNO_H 1
+#define HAVE_FCNTL_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_FTIME 1
+#define HAVE_GETADDRINFO /**/
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_ISASCII 1
+#define HAVE_LIMITS_H 1
+#define HAVE_LOCALTIME 1
+#define HAVE_LZMA_H 1
+#define HAVE_MALLOC_H 1
+#define HAVE_MATH_H 1
+#define HAVE_MMAP 1
+#define HAVE_NETDB_H 1
+#define HAVE_NETINET_IN_H 1
+#define HAVE_POLL_H 1
+#define HAVE_PTHREAD_H /**/
+#define HAVE_PUTENV 1
+#define HAVE_RAND 1
+#define HAVE_RAND_R 1
+#define HAVE_RESOLV_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_SRAND 1
+#define HAVE_STAT 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRFTIME 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_MMAN_H 1
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_SYS_SOCKET_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TIMEB_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_TIME 1
+#define HAVE_TIME_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_VA_COPY 1
+#define HAVE_ZLIB_H 1
+#define ICONV_CONST
+#define SEND_ARG2_CAST /**/
+#define SUPPORT_IP6 /**/
+#define VA_LIST_IS_ARRAY 1
+#define XML_SOCKLEN_T socklen_t
diff --git a/ports/libxml2/config.osx.h b/ports/libxml2/config.osx.h
new file mode 100644
index 000000000..95d83edc1
--- /dev/null
+++ b/ports/libxml2/config.osx.h
@@ -0,0 +1,54 @@
+#define GETHOSTBYNAME_ARG_CAST /**/
+#define HAVE_ARPA_INET_H 1
+#define HAVE_ARPA_NAMESER_H 1
+#define HAVE_CTYPE_H 1
+#define HAVE_DIRENT_H 1
+#define HAVE_DLFCN_H 1
+#define HAVE_DLOPEN /**/
+#define HAVE_ERRNO_H 1
+#define HAVE_FCNTL_H 1
+#define HAVE_FLOAT_H 1
+#define HAVE_FTIME 1
+#define HAVE_GETADDRINFO /**/
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_ISASCII 1
+#define HAVE_LIMITS_H 1
+#define HAVE_LOCALTIME 1
+#define HAVE_LZMA_H 1
+#define HAVE_MATH_H 1
+#define HAVE_MMAP 1
+#define HAVE_NETDB_H 1
+#define HAVE_NETINET_IN_H 1
+#define HAVE_POLL_H 1
+#define HAVE_PTHREAD_H /**/
+#define HAVE_PUTENV 1
+#define HAVE_RAND 1
+#define HAVE_RAND_R 1
+#define HAVE_RESOLV_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_SRAND 1
+#define HAVE_STAT 1
+#define HAVE_STDARG_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRFTIME 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_MMAN_H 1
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_SYS_SOCKET_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TIMEB_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_TIME 1
+#define HAVE_TIME_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_VA_COPY 1
+#define HAVE_ZLIB_H 1
+#define ICONV_CONST
+#define SEND_ARG2_CAST /**/
+#define SUPPORT_IP6 /**/
+#define VA_LIST_IS_ARRAY 1
+#define XML_SOCKLEN_T socklen_t
diff --git a/ports/libxml2/portfile.cmake b/ports/libxml2/portfile.cmake
index a300fcaf5..cdf10496e 100644
--- a/ports/libxml2/portfile.cmake
+++ b/ports/libxml2/portfile.cmake
@@ -12,6 +12,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
+ OPTIONS -DPORT_DIR=${CMAKE_CURRENT_LIST_DIR}
OPTIONS_DEBUG -DINSTALL_HEADERS=OFF
)
diff --git a/ports/libxml2/vcpkg-cmake-wrapper.cmake b/ports/libxml2/vcpkg-cmake-wrapper.cmake
index 6452af426..68bed6547 100644
--- a/ports/libxml2/vcpkg-cmake-wrapper.cmake
+++ b/ports/libxml2/vcpkg-cmake-wrapper.cmake
@@ -1,11 +1,13 @@
_find_package(${ARGS})
-if(LibXml2_FOUND AND (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore"))
+if(LibXml2_FOUND)
find_package(LibLZMA)
- list(APPEND LIBXML2_LIBRARIES
- ${LIBLZMA_LIBRARIES}
- debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libiconv.lib
- optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libiconv.lib
- debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libcharset.lib
- optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libcharset.lib
- ws2_32)
+ list(APPEND LIBXML2_LIBRARIES ${LIBLZMA_LIBRARIES})
+ if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ list(APPEND LIBXML2_LIBRARIES
+ debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libiconv.lib
+ optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libiconv.lib
+ debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libcharset.lib
+ optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libcharset.lib
+ ws2_32)
+ endif()
endif()
diff --git a/ports/nuklear/CONTROL b/ports/nuklear/CONTROL
index 51aaf9ac2..bfa1e2ab5 100644
--- a/ports/nuklear/CONTROL
+++ b/ports/nuklear/CONTROL
@@ -1,3 +1,3 @@
Source: nuklear
-Version: 2018-04-02
+Version: 2018-04-06
Description: This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain
diff --git a/ports/nuklear/portfile.cmake b/ports/nuklear/portfile.cmake
index 1e820cc07..0722fe775 100644
--- a/ports/nuklear/portfile.cmake
+++ b/ports/nuklear/portfile.cmake
@@ -2,8 +2,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO vurtun/nuklear
- REF 60bd95c926f73b143ec91e66b2fe315ad2a316e1
- SHA512 45cf7c5cab105241aec6c2a56a34abf9701eded52bf06d3092e0079949757a6cbb0d684b45952a054451384cd07a77b1763526470ec84835da3d514c614c65ba
+ REF bca152011e3f5839c7eb08864f76f1f900d4ffe7
+ SHA512 aa3bf7f9f32fe63140505e4845a9ee22fb9feb1abc3dd36b333697548778272b817795844a8b6f5cc95a4e460afd69fd96359955ab4e8d12737ac4b46be7e4d1
HEAD_REF master
)
file(INSTALL ${SOURCE_PATH}/nuklear.h DESTINATION ${CURRENT_PACKAGES_DIR}/include)
diff --git a/ports/openal-soft/cmake-3-11.patch b/ports/openal-soft/cmake-3-11.patch
new file mode 100644
index 000000000..07f7e6936
--- /dev/null
+++ b/ports/openal-soft/cmake-3-11.patch
@@ -0,0 +1,14 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a871f4c..f9f6b34 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -965,7 +965,8 @@ OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF)
+ OPTION(ALSOFT_REQUIRE_MMDEVAPI "Require MMDevApi backend" OFF)
+ IF(HAVE_WINDOWS_H)
+ # Check MMSystem backend
+- CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0502)
++ set(CMAKE_REQUIRED_DEFINITIONS -D_WIN32_WINNT=0x0502)
++ CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H)
+ IF(HAVE_MMSYSTEM_H)
+ CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
+ IF(HAVE_LIBWINMM)
diff --git a/ports/openal-soft/portfile.cmake b/ports/openal-soft/portfile.cmake
index b1421f1f5..527b4ba60 100644
--- a/ports/openal-soft/portfile.cmake
+++ b/ports/openal-soft/portfile.cmake
@@ -11,8 +11,12 @@ vcpkg_from_github(
HEAD_REF master
)
-vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH}
- PATCHES ${CMAKE_CURRENT_LIST_DIR}/dont-export-symbols-in-static-build.patch)
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/dont-export-symbols-in-static-build.patch
+ ${CMAKE_CURRENT_LIST_DIR}/cmake-3-11.patch
+)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(OPENAL_LIBTYPE "SHARED")
diff --git a/ports/openvr/CONTROL b/ports/openvr/CONTROL
index 3e42aaa23..816a8751f 100644
--- a/ports/openvr/CONTROL
+++ b/ports/openvr/CONTROL
@@ -1,3 +1,3 @@
Source: openvr
-Version: 1.0.13
+Version: 1.0.14
Description: an API and runtime that allows access to VR hardware from multiple vendors without requiring that applications have specific knowledge of the hardware they are targeting.
diff --git a/ports/openvr/portfile.cmake b/ports/openvr/portfile.cmake
index b86f44335..31e1658b1 100644
--- a/ports/openvr/portfile.cmake
+++ b/ports/openvr/portfile.cmake
@@ -3,8 +3,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ValveSoftware/openvr
- REF v1.0.13
- SHA512 3ec901f9363f9517fd3246cf58c0792c2446c39d61997a46375756b0965e6fad6902a5d1b87eb65c579e1b615cbb6e6688e7dc8ced957e5dc50b4c4dcbbb36b9
+ REF v1.0.14
+ SHA512 2f38622121911ad4d59971fe88313f839fcb3bddae07af266b3b9f804a8c3855b4eb67d9153f0979db3465279dfcce9cb0bfe83451bf8639be5cdc9acafa2eda
HEAD_REF master
)
diff --git a/ports/plplot/portfile.cmake b/ports/plplot/portfile.cmake
index 372a59bba..7b35f0a15 100644
--- a/ports/plplot/portfile.cmake
+++ b/ports/plplot/portfile.cmake
@@ -53,6 +53,14 @@ file(REMOVE
${CURRENT_PACKAGES_DIR}/bin/pltek.exe
)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ message(STATUS "Static build: Removing the full bin directory.")
+ file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/bin
+ ${CURRENT_PACKAGES_DIR}/bin
+ )
+endif()
+
# Remove unwanted and duplicate directories
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/include
diff --git a/ports/protobuf/CONTROL b/ports/protobuf/CONTROL
index 86fecafc5..12e508f6d 100644
--- a/ports/protobuf/CONTROL
+++ b/ports/protobuf/CONTROL
@@ -1,5 +1,5 @@
Source: protobuf
-Version: 3.5.1-1
+Version: 3.5.1-2
Description: Protocol Buffers - Google's data interchange format
Feature: zlib
diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake
index 593eebe7d..765b52a1d 100644
--- a/ports/protobuf/portfile.cmake
+++ b/ports/protobuf/portfile.cmake
@@ -21,7 +21,7 @@ vcpkg_apply_patches(
"${CMAKE_CURRENT_LIST_DIR}/js-embed.patch"
)
-if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+if(CMAKE_HOST_WIN32)
set(TOOL_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-${PROTOBUF_VERSION}-win32)
vcpkg_download_distfile(TOOL_ARCHIVE_FILE
URLS "https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-win32.zip"
@@ -85,27 +85,39 @@ endfunction()
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/include)
+if(CMAKE_HOST_WIN32)
+ set(EXECUTABLE_SUFFIX ".exe")
+else()
+ set(EXECUTABLE_SUFFIX "")
+endif()
+
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(READ ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-release.cmake RELEASE_MODULE)
- string(REPLACE "\${_IMPORT_PREFIX}/bin/protoc.exe" "\${_IMPORT_PREFIX}/tools/protoc.exe" RELEASE_MODULE "${RELEASE_MODULE}")
+ string(REPLACE "\${_IMPORT_PREFIX}/bin/protoc${EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/protoc${EXECUTABLE_SUFFIX}" RELEASE_MODULE "${RELEASE_MODULE}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-release.cmake "${RELEASE_MODULE}")
endif()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/protobuf/protobuf-targets-debug.cmake DEBUG_MODULE)
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" DEBUG_MODULE "${DEBUG_MODULE}")
- string(REPLACE "\${_IMPORT_PREFIX}/debug/bin/protoc.exe" "\${_IMPORT_PREFIX}/tools/protoc.exe" DEBUG_MODULE "${DEBUG_MODULE}")
+ string(REPLACE "\${_IMPORT_PREFIX}/debug/bin/protoc${EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/protoc${EXECUTABLE_SUFFIX}" DEBUG_MODULE "${DEBUG_MODULE}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/protobuf/protobuf-targets-debug.cmake "${DEBUG_MODULE}")
endif()
protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/share)
-if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
- protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin)
- protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin)
+if(CMAKE_HOST_WIN32)
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin)
+ protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin)
+ else()
+ protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin/protoc.exe)
+ protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin/protoc.exe)
+ endif()
else()
- protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin/protoc.exe)
- protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin/protoc.exe)
+ protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(INSTALL ${CURRENT_PACKAGES_DIR}/bin/protoc DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
+ protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
@@ -115,7 +127,7 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
endif()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/protobuf RENAME copyright)
-if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+if(CMAKE_HOST_WIN32)
file(INSTALL ${TOOL_PATH}/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
endif()
vcpkg_copy_pdbs()
diff --git a/ports/pugixml/CONTROL b/ports/pugixml/CONTROL
index eb1f4e634..5e2dad599 100644
--- a/ports/pugixml/CONTROL
+++ b/ports/pugixml/CONTROL
@@ -1,3 +1,3 @@
Source: pugixml
-Version: 1.8.1-3
+Version: 1.9-1
Description: C++ XML processing library
diff --git a/ports/pugixml/portfile.cmake b/ports/pugixml/portfile.cmake
index 889063223..b0ec2cc58 100644
--- a/ports/pugixml/portfile.cmake
+++ b/ports/pugixml/portfile.cmake
@@ -1,32 +1,33 @@
+# Common Ambient Variables:
+# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
+# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
+# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
+# PORT = current port name (zlib, etc)
+# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
+# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
+# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
+# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
+# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
+#
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pugixml-1.8)
-vcpkg_download_distfile(ARCHIVE
- URLS "https://github.com/zeux/pugixml/releases/download/v1.8.1/pugixml-1.8.1.zip"
- FILENAME "pugixml-1.8.1.zip"
- SHA512 683fe224a9bcac032d78cb44d03915a3766d2faa588f3a8486b5719f26eeba3e17d447edf70e1907f51f8649ffb4607b6badd1365e4c15cf24279bf577dc853e
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO zeux/pugixml
+ REF v1.9
+ SHA512 f97941941d98a1a056087edc0dde6376bf2cc12ce4523b67a2f2ec5ae0895c2a2e55da32fcca6a997f1a0d918c5f39564167da0a07ce0d7da92880ad8631c31e
+ HEAD_REF master
)
-vcpkg_extract_source_archive(${ARCHIVE})
-if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
- vcpkg_configure_cmake(
- SOURCE_PATH ${SOURCE_PATH}
- )
-else()
- vcpkg_apply_patches(
- SOURCE_PATH ${SOURCE_PATH}
- PATCHES
- ${CMAKE_CURRENT_LIST_DIR}/pugixmlapi.patch
- )
- vcpkg_configure_cmake(
- SOURCE_PATH ${SOURCE_PATH}
- OPTIONS
- -DBUILD_DEFINES="PUGIXML_API=__declspec\(dllexport\)"
- )
-endif()
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/pugixml")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# Handle copyright
file(INSTALL ${SOURCE_PATH}/readme.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/pugixml RENAME copyright)
diff --git a/ports/pugixml/pugixmlapi.patch b/ports/pugixml/pugixmlapi.patch
deleted file mode 100644
index 177664dbe..000000000
--- a/ports/pugixml/pugixmlapi.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/src/pugixml.hpp b/src/pugixml.hpp
-index 4d76bfa..75a4f8a 100644
---- a/src/pugixml.hpp
-+++ b/src/pugixml.hpp
-@@ -50,7 +50,7 @@
-
- // If no API is defined, assume default
- #ifndef PUGIXML_API
--# define PUGIXML_API
-+# define PUGIXML_API __declspec(dllimport)
- #endif
-
- // If no API for classes is defined, assume default
diff --git a/ports/rocksdb/CONTROL b/ports/rocksdb/CONTROL
index 6e3f6a4c5..852281924 100644
--- a/ports/rocksdb/CONTROL
+++ b/ports/rocksdb/CONTROL
@@ -1,5 +1,5 @@
Source: rocksdb
-Version: 5.11.3-3
+Version: 5.12.2
Description: A library that provides an embeddable, persistent key-value store for fast storage
Default-Features: zlib
diff --git a/ports/rocksdb/pass-major-version.patch b/ports/rocksdb/pass-major-version.patch
new file mode 100644
index 000000000..1cc3f2d13
--- /dev/null
+++ b/ports/rocksdb/pass-major-version.patch
@@ -0,0 +1,20 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d6bfbf2..ea6a884 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -132,6 +132,7 @@ endif()
+
+ string(REGEX REPLACE "[^0-9a-f]+" "" GIT_SHA "${GIT_SHA}")
+
++if(NOT DEFINED ROCKSDB_VERSION OR NOT DEFINED ROCKSDB_VERSION_MAJOR)
+ set(SH_CMD "sh")
+ execute_process(COMMAND
+ ${SH_CMD} -c "build_tools/version.sh full"
+@@ -145,6 +146,7 @@ execute_process(COMMAND
+ OUTPUT_VARIABLE ROCKSDB_VERSION_MAJOR
+ )
+ string(STRIP "${ROCKSDB_VERSION_MAJOR}" ROCKSDB_VERSION_MAJOR)
++endif()
+
+ option(WITH_MD_LIBRARY "build with MD" ON)
+ if(WIN32 AND MSVC)
diff --git a/ports/rocksdb/portfile.cmake b/ports/rocksdb/portfile.cmake
index 169573cf3..92ca0c2fa 100644
--- a/ports/rocksdb/portfile.cmake
+++ b/ports/rocksdb/portfile.cmake
@@ -3,8 +3,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO facebook/rocksdb
- REF rocksdb-5.11.3
- SHA512 a4c771e36056ee0da497202b25092d89799db43573a442568b4392b8478ac20320dabf4c904e93bd0641a32f249e9c8dcad0d67577acaee6902cd4d30f29ce57
+ REF v5.12.2
+ SHA512 53e81e87e84f0500cd09d754c39e86265a16a52d4b84f9044f8d9759c224881eb7ef4bf89f9b01fdff25f123ed4dfa7b5cb272d2311f27b322c15fe2e893bbe3
HEAD_REF master
)
@@ -14,6 +14,7 @@ vcpkg_apply_patches(
"${CMAKE_CURRENT_LIST_DIR}/0002-disable-gtest.patch"
"${CMAKE_CURRENT_LIST_DIR}/0003-only-build-one-flavor.patch"
"${CMAKE_CURRENT_LIST_DIR}/use-find-package.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/pass-major-version.patch"
)
file(REMOVE "${SOURCE_PATH}/cmake/modules/Findzlib.cmake")
@@ -48,7 +49,8 @@ if("zlib" IN_LIST FEATURES)
endif()
get_filename_component(ROCKSDB_VERSION "${SOURCE_PATH}" NAME)
-string(REPLACE "rocksdb-rocksdb-" "" ROCKSDB_VERSION "${ROCKSDB_VERSION}")
+string(REPLACE "rocksdb-" "" ROCKSDB_VERSION "${ROCKSDB_VERSION}")
+string(REGEX REPLACE "^([0-9]+)." "\\1" ROCKSDB_MAJOR_VERSION "${ROCKSDB_VERSION}")
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
@@ -67,7 +69,7 @@ vcpkg_configure_cmake(
-DROCKSDB_DISABLE_INSTALL_SHARED_LIB=${ROCKSDB_DISABLE_INSTALL_SHARED_LIB}
-DROCKSDB_DISABLE_INSTALL_STATIC_LIB=${ROCKSDB_DISABLE_INSTALL_STATIC_LIB}
-DROCKSDB_VERSION=${ROCKSDB_VERSION}
- -DCURRENT_INSTALLED_DIR=${CURRENT_INSTALLED_DIR}
+ -DROCKSDB_VERSION_MAJOR=${ROCKSDB_MAJOR_VERSION}
-DCMAKE_DISABLE_FIND_PACKAGE_TBB=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_NUMA=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_gtest=TRUE
diff --git a/ports/rs-core-lib/CONTROL b/ports/rs-core-lib/CONTROL
index a6f837d0a..de6b3c5a2 100644
--- a/ports/rs-core-lib/CONTROL
+++ b/ports/rs-core-lib/CONTROL
@@ -1,4 +1,4 @@
Source: rs-core-lib
-Version: 2018-03-29
+Version: 2018-04-09
Description: Minimal common utilities by Ross Smith
diff --git a/ports/rs-core-lib/portfile.cmake b/ports/rs-core-lib/portfile.cmake
index cca3be0a3..18d127849 100644
--- a/ports/rs-core-lib/portfile.cmake
+++ b/ports/rs-core-lib/portfile.cmake
@@ -3,8 +3,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO CaptainCrowbar/rs-core-lib
- REF 3300d39fef567adf90f59d07223e55ca44ed4f98
- SHA512 0e696a94ab71ca29c61075d917a26b01057f657537c5516cb3bf2fd046d5c61f7e74d83a7c2eba2d4d923f3bd8b125f61c6732d09ade59b0995f42eb3df22a17
+ REF ca8065dea45355836d9ca834823775c23a1f3571
+ SHA512 4bead4c2317f8b1f33844eacd052724680da6e00d52acb9238a458598a0745a86e91ac8f41a9b2ec4be1365a18e727e1e2659910f293d3bfe3f3b49d34d20b30
HEAD_REF master
)
diff --git a/ports/shogun/CONTROL b/ports/shogun/CONTROL
index 6a05a331e..56b6250d6 100644
--- a/ports/shogun/CONTROL
+++ b/ports/shogun/CONTROL
@@ -1,4 +1,4 @@
Source: shogun
Version: 6.1.3
-Build-Depends: bzip2, eigen3, liblzma, libxml2, openblas, nlopt, rxcpp, snappy, zlib, protobuf, curl, lzo, dirent
+Build-Depends: bzip2, eigen3, liblzma, libxml2, openblas (x64), nlopt, rxcpp, snappy, zlib, protobuf, curl, lzo, dirent
Description: Unified and efficient Machine Learning
diff --git a/ports/shogun/portfile.cmake b/ports/shogun/portfile.cmake
index 24e258539..e002ead4a 100644
--- a/ports/shogun/portfile.cmake
+++ b/ports/shogun/portfile.cmake
@@ -22,6 +22,16 @@ file(REMOVE_RECURSE ${SOURCE_PATH}/cmake/external)
file(MAKE_DIRECTORY ${SOURCE_PATH}/cmake/external)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/MSDirent.cmake DESTINATION ${SOURCE_PATH}/cmake/external)
+if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ set(CMAKE_DISABLE_FIND_PACKAGE_BLAS 0)
+else()
+ set(CMAKE_DISABLE_FIND_PACKAGE_BLAS 1)
+endif()
+
+vcpkg_find_acquire_program(PYTHON3)
+get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
+set(ENV{PATH} "$ENV{PATH};${PYTHON3_DIR}")
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
@@ -47,6 +57,7 @@ vcpkg_configure_cmake(
-DCMAKE_DISABLE_FIND_PACKAGE_Ctags=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_CCache=TRUE
-DCMAKE_DISABLE_FIND_PACKAGE_Doxygen=TRUE
+ -DCMAKE_DISABLE_FIND_PACKAGE_BLAS=${CMAKE_DISABLE_FIND_PACKAGE_BLAS}
-DINSTALL_TARGETS=shogun-static
)
diff --git a/ports/sol/CONTROL b/ports/sol/CONTROL
index f1bd57fa3..42b1be455 100644
--- a/ports/sol/CONTROL
+++ b/ports/sol/CONTROL
@@ -1,3 +1,3 @@
Source: sol
-Version: 2.18.7
+Version: 2.19.5
Description: Sol v2.0 - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great
diff --git a/ports/sol/portfile.cmake b/ports/sol/portfile.cmake
index 83d59becc..c65202380 100644
--- a/ports/sol/portfile.cmake
+++ b/ports/sol/portfile.cmake
@@ -14,8 +14,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ThePhD/sol2
- REF v2.18.7
- SHA512 747dbcba2da4e44bfb365c0fd0c8df916d0e5d0ddbaa9df514838d84a8fd4261c87db7d14d9683b708b874cd6a73586e7854d9a784743a737858b73acdd78f1c
+ REF v2.19.5
+ SHA512 c004c2331e2eb0aae4467c10609f73879246c3ab5b7421e5b6fcb91b0c6595d999e5fd4c70b1859af1febb374631640d6727bf236a0cd176e40f631813e243a9
HEAD_REF develop
)
diff --git a/ports/sqlite3/CONTROL b/ports/sqlite3/CONTROL
index 7e39794dd..a5d76d43b 100644
--- a/ports/sqlite3/CONTROL
+++ b/ports/sqlite3/CONTROL
@@ -1,5 +1,5 @@
Source: sqlite3
-Version: 3.21.0-1
+Version: 3.23.0
Description: SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.
Feature: tool
diff --git a/ports/sqlite3/portfile.cmake b/ports/sqlite3/portfile.cmake
index d6596e7b2..d016660ab 100644
--- a/ports/sqlite3/portfile.cmake
+++ b/ports/sqlite3/portfile.cmake
@@ -1,11 +1,11 @@
include(vcpkg_common_functions)
-set(SQLITE_VERSION 3210000)
-set(SQLITE_HASH 0a272b00825d07528c3842ccd483d81e5e719ab56737eec0972f7f8191dfbe92e35777ab8d1b37c95fde9320bbfa3c365a4b30253af876340f55517ea96bf665)
+set(SQLITE_VERSION 3230000)
+set(SQLITE_HASH bfca2ec16d926c11c9ec052eae41549f1de392582227ca08eb8a01cc36e58ac528c7677fdab253250ba3e0cf6e5cd9d3d0012e5b558be7db91740ac901dae0fe)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/sqlite-amalgamation-${SQLITE_VERSION})
vcpkg_download_distfile(ARCHIVE
- URLS "https://sqlite.org/2017/sqlite-amalgamation-${SQLITE_VERSION}.zip"
+ URLS "https://sqlite.org/2018/sqlite-amalgamation-${SQLITE_VERSION}.zip"
FILENAME "sqlite-amalgamation-${SQLITE_VERSION}.zip"
SHA512 ${SQLITE_HASH})
vcpkg_extract_source_archive(${ARCHIVE})
diff --git a/ports/tbb/portfile.cmake b/ports/tbb/portfile.cmake
index f74d096de..4a0b80ec4 100644
--- a/ports/tbb/portfile.cmake
+++ b/ports/tbb/portfile.cmake
@@ -10,8 +10,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO 01org/tbb
- REF 2018_U3
- SHA512 e92a2aabcdd456c1676eb9ce20653908a867ea18ff118f5f039823f5a10a0da3de61d0044774ad38b137e636fa8602af009dfeb59c84005fe90c6206aa3306ab
+ REF 633b01ad27e012e1dc4e392c3230250d1f4967a4
+ SHA512 5576b5e1efa0c7938dc08a1a9503ea19234b20f6a742f3d13a8de19b47f5bdafa1bb855e4de022a4b096a429e66739599a198fdf687c167c659f7556235fa01f
HEAD_REF tbb_2018)
if(TRIPLET_SYSTEM_ARCH STREQUAL x86)
diff --git a/ports/theia/CONTROL b/ports/theia/CONTROL
index 06dcc80c8..83d6c2c53 100644
--- a/ports/theia/CONTROL
+++ b/ports/theia/CONTROL
@@ -1,4 +1,4 @@
Source: theia
-Version: 0.7-d15154a-2
-Build-Depends: flann, cereal, ceres[suitesparse], openimageio, glew, freeglut
+Version: 0.7-d15154a-3
+Build-Depends: flann, cereal, ceres[suitesparse] (!x86&!uwp&!arm&!linux&!osx), openimageio, glew, freeglut
Description: An open source library for multiview geometry and structure from motion
diff --git a/ports/theia/portfile.cmake b/ports/theia/portfile.cmake
index d2e4c6699..b2e61fae1 100644
--- a/ports/theia/portfile.cmake
+++ b/ports/theia/portfile.cmake
@@ -3,6 +3,10 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
endif()
+if(VCPKG_TARGET_ARCHIECTURE STREQUAL "x86")
+ message(FATAL_ERROR "theia requires ceres[suitesparse] which depends on suitesparse which depends on openblas which is unavailable on x86.")
+endif()
+
include(vcpkg_common_functions)
vcpkg_from_github(
diff --git a/ports/thrift/CONTROL b/ports/thrift/CONTROL
index da43bce3d..e544fbbe0 100644
--- a/ports/thrift/CONTROL
+++ b/ports/thrift/CONTROL
@@ -1,4 +1,4 @@
Source: thrift
-Version: 2018-04-02
+Version: 2018-04-09
Build-Depends: zlib, libevent, openssl, boost-range, boost-smart-ptr, boost-date-time, boost-locale, boost-scope-exit
Description: Apache Thrift is a software project spanning a variety of programming languages and use cases. Our goal is to make reliable, performant communication and data serialization across languages as efficient and seamless as possible. Originally developed at Facebook, Thrift was open sourced in April 2007 and entered the Apache Incubator in May, 2008. Thrift became an Apache TLP in October, 2010.
diff --git a/ports/thrift/portfile.cmake b/ports/thrift/portfile.cmake
index 80a6f036d..5461f3307 100644
--- a/ports/thrift/portfile.cmake
+++ b/ports/thrift/portfile.cmake
@@ -15,8 +15,8 @@ vcpkg_find_acquire_program(BISON)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO apache/thrift
- REF 3c0edfa875218bd83f6b79a7823380e2adc08ae6
- SHA512 8499ae6adf0db725f847f25f1c0b0ccf0abd8b142dd410a8a3c544dfd2fae8bdf1dec86e74eee3b4f78288f53ed5a162214d963513456d9b3be794e157c00a38
+ REF 606f1ef31447526b908244933d5b716397a6bad8
+ SHA512 101de834e8f19ed5f4855a3b138425ffdc8103565f04656f1544098821ad54d5e89f8275cf50b380f01d3a83f4ba7670ec1cc79ec7bd4594172f6fb06d3e034b
HEAD_REF master
)
diff --git a/ports/tinyxml2/CONTROL b/ports/tinyxml2/CONTROL
index 1df7e49f2..185fa749c 100644
--- a/ports/tinyxml2/CONTROL
+++ b/ports/tinyxml2/CONTROL
@@ -1,3 +1,3 @@
Source: tinyxml2
-Version: 6.0.0-2
+Version: 6.2.0
Description: A simple, small, efficient, C++ XML parser
diff --git a/ports/tinyxml2/portfile.cmake b/ports/tinyxml2/portfile.cmake
index 0a7c887c5..8a28b424b 100644
--- a/ports/tinyxml2/portfile.cmake
+++ b/ports/tinyxml2/portfile.cmake
@@ -3,8 +3,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO leethomason/tinyxml2
- REF 6.0.0
- SHA512 30c68f491830187738b01ca5db1a96e7b4907cf8fa09a533c90ea084ab5e73f798dff6305cfc4edccc8989926e91c0482677bb5796799113c839dbd0528c8ad5
+ REF 6.2.0
+ SHA512 ef784240aeb090ab04aad659352ad4b224c431feecf485f33aca7936bcaa0ef4ab9d0a2e0692d3cf6036ac3e8012019d65665e780a920bbad3d4820f736445b1
HEAD_REF master
)
diff --git a/ports/unicorn-lib/CONTROL b/ports/unicorn-lib/CONTROL
index 2c742eedc..4a46f6343 100644
--- a/ports/unicorn-lib/CONTROL
+++ b/ports/unicorn-lib/CONTROL
@@ -1,4 +1,4 @@
Source: unicorn-lib
-Version: 2018-03-13
+Version: 2018-04-09
Description: Unicode library for C++ by Ross Smith
Build-Depends: rs-core-lib, pcre, zlib, libiconv
diff --git a/ports/unicorn-lib/portfile.cmake b/ports/unicorn-lib/portfile.cmake
index c76da4fa3..c215e7ccd 100644
--- a/ports/unicorn-lib/portfile.cmake
+++ b/ports/unicorn-lib/portfile.cmake
@@ -3,8 +3,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO CaptainCrowbar/unicorn-lib
- REF 8fc132c879e748a61c9e4b6a93a6de209b55dbe5
- SHA512 f70d9fd9c06b4bf7a771abfacd1f989f03ea51395b6819b1162a13954e680d49622e48b61b71195c598ac21861435c6c5fe8ff368880098a07eb4b86547eede0
+ REF 38b8bfe7b22978d42923a55ed3303a0aadd86abd
+ SHA512 423dc648476cc957273a7a81770ce5b25452bd685aaa36688cecb1e7cc83495ede6a441fb33e010e80782986c32a8cc87fe42844b0ccd597ce9a4e5286dc6791
HEAD_REF master
)
diff --git a/ports/yoga/CONTROL b/ports/yoga/CONTROL
index c4bbe1a69..7a96eb9c2 100644
--- a/ports/yoga/CONTROL
+++ b/ports/yoga/CONTROL
@@ -1,3 +1,3 @@
Source: yoga
-Version: 1.7.0-1
+Version: 1.8.0-1
Description: Yoga is a cross-platform layout engine which implements Flexbox
diff --git a/ports/yoga/portfile.cmake b/ports/yoga/portfile.cmake
index a261d5106..5dbb4e527 100644
--- a/ports/yoga/portfile.cmake
+++ b/ports/yoga/portfile.cmake
@@ -21,8 +21,8 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO facebook/yoga
- REF 1.7.0
- SHA512 3472a6db429e1fd0365321b2e663935741c4c97331f3936ea7b590b8218ada567ef7517fb20b1c843c1aad393e2b564e9626170a3d6c25e85450f9e8eb7ffdcc
+ REF v1.8.0
+ SHA512 9af0e9e66ce223c99a9cab12721099ca40f85d2fa2a0e0a7d2bcff6d5acc5b6ca0edaaa53e49ec921bf78bb986070702cfe3271c4819147486dad6f6ee93e690
HEAD_REF master
)
diff --git a/ports/zeromq/CONTROL b/ports/zeromq/CONTROL
index a7f21a9b8..b333f7440 100644
--- a/ports/zeromq/CONTROL
+++ b/ports/zeromq/CONTROL
@@ -1,3 +1,3 @@
Source: zeromq
-Version: 2018-03-29
+Version: 2018-04-05
Description: The ZeroMQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products
diff --git a/ports/zeromq/portfile.cmake b/ports/zeromq/portfile.cmake
index 3220d8f3a..8019053f9 100644
--- a/ports/zeromq/portfile.cmake
+++ b/ports/zeromq/portfile.cmake
@@ -3,8 +3,8 @@ include(vcpkg_common_functions)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO zeromq/libzmq
- REF 2aa54d662048f420ac0dbd5d9b46559963a675f2
- SHA512 48abea6fdac733ff7c2da7b3f45f129dc904d5d5a59f41f4f47419f5c2483a5227aec1a605d76422071045ea82c76ceb55a521bb80fe5d7f77d5d01c43acb3e6
+ REF bb4fb32925c6465fd0f8e8cc89e5347bc79bc4bf
+ SHA512 73101b68d93fdf1eca1f83373fe4c946865978d32ca11692e9015a63af8d42ff2d2ff93c88c812f75c2d80596c986df59e62f8de3dc1a016ab24f91f518c24eb
HEAD_REF master
)
@@ -45,6 +45,8 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
else()
string(REPLACE "get_target_property(ZeroMQ_LIBRARY libzmq LOCATION)" "add_library(libzmq INTERFACE IMPORTED)\nset_target_properties(libzmq PROPERTIES INTERFACE_LINK_LIBRARIES libzmq-static)" _contents "${_contents}")
set(_contents "${_contents}\nset(ZeroMQ_LIBRARY \${ZeroMQ_STATIC_LIBRARY})\n")
+
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()
file(WRITE ${CURRENT_PACKAGES_DIR}/share/zeromq/ZeroMQConfig.cmake "${_contents}")
diff --git a/scripts/SHA256Hash.ps1 b/scripts/SHA256Hash.ps1
deleted file mode 100644
index 348d461b7..000000000
--- a/scripts/SHA256Hash.ps1
+++ /dev/null
@@ -1,9 +0,0 @@
-[CmdletBinding()]
-Param(
- [Parameter(Mandatory=$True)]
- [String]$Value
-)
-
-$sha256 = New-Object -TypeName System.Security.Cryptography.SHA256CryptoServiceProvider
-$utf8 = New-Object -TypeName System.Text.UTF8Encoding
-[System.BitConverter]::ToString($sha256.ComputeHash($utf8.GetBytes($Value)))
diff --git a/scripts/VcpkgPowershellUtils.ps1 b/scripts/VcpkgPowershellUtils.ps1
index 92e0f21d0..fdd89e7b9 100644
--- a/scripts/VcpkgPowershellUtils.ps1
+++ b/scripts/VcpkgPowershellUtils.ps1
@@ -84,22 +84,22 @@ function vcpkgGetCredentials()
}
}
-function vcpkgGetSHA256([Parameter(Mandatory=$true)][string]$filePath)
+function vcpkgGetSHA512([Parameter(Mandatory=$true)][string]$filePath)
{
if (vcpkgHasCommand -commandName 'Microsoft.PowerShell.Utility\Get-FileHash')
{
Write-Verbose("Hashing with Microsoft.PowerShell.Utility\Get-FileHash")
- $hash = (Microsoft.PowerShell.Utility\Get-FileHash -Path $filePath -Algorithm SHA256).Hash
+ $hash = (Microsoft.PowerShell.Utility\Get-FileHash -Path $filePath -Algorithm SHA512).Hash
}
elseif(vcpkgHasCommand -commandName 'Pscx\Get-Hash')
{
Write-Verbose("Hashing with Pscx\Get-Hash")
- $hash = (Pscx\Get-Hash -Path $filePath -Algorithm SHA256).HashString
+ $hash = (Pscx\Get-Hash -Path $filePath -Algorithm SHA512).HashString
}
else
{
Write-Verbose("Hashing with .NET")
- $hashAlgorithm = [Security.Cryptography.HashAlgorithm]::Create("SHA256")
+ $hashAlgorithm = [Security.Cryptography.HashAlgorithm]::Create("SHA512")
$fileAsByteArray = [io.File]::ReadAllBytes($filePath)
$hashByteArray = $hashAlgorithm.ComputeHash($fileAsByteArray)
$hash = -Join ($hashByteArray | ForEach-Object {"{0:x2}" -f $_})
@@ -108,28 +108,26 @@ function vcpkgGetSHA256([Parameter(Mandatory=$true)][string]$filePath)
return $hash.ToLower()
}
-function vcpkgCheckEqualFileHash( [Parameter(Mandatory=$true)][string]$filePath,
- [Parameter(Mandatory=$true)][string]$expectedHash,
- [Parameter(Mandatory=$true)][string]$actualHash)
+function vcpkgCheckEqualFileHash( [Parameter(Mandatory=$true)][string]$url,
+ [Parameter(Mandatory=$true)][string]$filePath,
+ [Parameter(Mandatory=$true)][string]$expectedHash)
{
+ $actualHash = vcpkgGetSHA512 $filePath
if ($expectedHash -ne $actualHash)
{
Write-Host ("`nFile does not have expected hash:`n" +
+ " url: [ $url ]`n" +
" File path: [ $filePath ]`n" +
" Expected hash: [ $expectedHash ]`n" +
" Actual hash: [ $actualHash ]`n")
- throw "Invalid Hash for file $filePath"
+ throw
}
}
function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url,
- [Parameter(Mandatory=$true)][string]$downloadPath)
+ [Parameter(Mandatory=$true)][string]$downloadPath,
+ [Parameter(Mandatory=$true)][string]$sha512)
{
- if (Test-Path $downloadPath)
- {
- return
- }
-
if ($url -match "github")
{
if ([System.Enum]::IsDefined([Net.SecurityProtocolType], "Tls12"))
@@ -157,21 +155,65 @@ function vcpkgDownloadFile( [Parameter(Mandatory=$true)][string]$url,
}
$wc.DownloadFile($url, $downloadPartPath)
+ vcpkgCheckEqualFileHash -url $url -filePath $downloadPartPath -expectedHash $sha512
Move-Item -Path $downloadPartPath -Destination $downloadPath
}
-function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$archivePath,
- [Parameter(Mandatory=$true)][string]$destinationDir,
- [Parameter(Mandatory=$true)][string]$outFilename)
+function vcpkgDownloadFileWithAria2( [Parameter(Mandatory=$true)][string]$aria2exe,
+ [Parameter(Mandatory=$true)][string]$url,
+ [Parameter(Mandatory=$true)][string]$downloadPath,
+ [Parameter(Mandatory=$true)][string]$sha512)
{
- vcpkgCreateDirectoryIfNotExists $destinationDir
- $output = "$destinationDir\$outFilename"
- vcpkgRemoveItem $output
- $destinationPartial = "$destinationDir\partially-extracted"
+ vcpkgCreateParentDirectoryIfNotExists $downloadPath
+ $downloadPartPath = "$downloadPath.part"
+ vcpkgRemoveItem $downloadPartPath
+ $parentDir = split-path -parent $downloadPath
+ $filename = split-path -leaf $downloadPath
+
+ if ((Test-Path $url) -or ($url.StartsWith("file://"))) # if is local file
+ {
+ vcpkgDownloadFile $url $downloadPath $sha512
+ return
+ }
+
+ $ec = vcpkgInvokeCommand "$aria2exe" "--dir `"$parentDir`" --out `"$filename.part`" $url"
+ if ($ec -ne 0)
+ {
+ Write-Host "Could not download $url"
+ throw
+ }
+
+ vcpkgCheckEqualFileHash -url $url -filePath $downloadPartPath -expectedHash $sha512
+ Move-Item -Path $downloadPartPath -Destination $downloadPath
+}
+
+function vcpkgExtractFileWith7z([Parameter(Mandatory=$true)][string]$sevenZipExe,
+ [Parameter(Mandatory=$true)][string]$archivePath,
+ [Parameter(Mandatory=$true)][string]$destinationDir)
+{
+ vcpkgRemoveItem $destinationDir
+ $destinationPartial = "$destinationDir.partial"
+ vcpkgRemoveItem $destinationPartial
+ vcpkgCreateDirectoryIfNotExists $destinationPartial
+ $ec = vcpkgInvokeCommand "$sevenZipExe" "x `"$archivePath`" -o`"$destinationPartial`" -y"
+ if ($ec -ne 0)
+ {
+ Write-Host "Could not extract $archivePath"
+ throw
+ }
+ Rename-Item -Path "$destinationPartial" -NewName $destinationDir
+}
+
+function vcpkgExtractZipFile( [Parameter(Mandatory=$true)][string]$archivePath,
+ [Parameter(Mandatory=$true)][string]$destinationDir)
+{
+ vcpkgRemoveItem $destinationDir
+ $destinationPartial = "$destinationDir.partial"
vcpkgRemoveItem $destinationPartial
vcpkgCreateDirectoryIfNotExists $destinationPartial
+
if (vcpkgHasCommand -commandName 'Microsoft.PowerShell.Archive\Expand-Archive')
{
Write-Verbose("Extracting with Microsoft.PowerShell.Archive\Expand-Archive")
@@ -194,20 +236,7 @@ function vcpkgExtractFile( [Parameter(Mandatory=$true)][string]$archivePath,
}
}
- $items = @(Get-ChildItem "$destinationPartial")
- $itemCount = $items.Count
-
- if ($itemCount -eq 1)
- {
- $item = $items | Select-Object -first 1
- Write-Host "$item"
- Move-Item -Path "$destinationPartial\$item" -Destination $output
- vcpkgRemoveItem $destinationPartial
- }
- else
- {
- Move-Item -Path "$destinationPartial" -Destination $output
- }
+ Rename-Item -Path "$destinationPartial" -NewName $destinationDir
}
function vcpkgInvokeCommand()
diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake
index 0c32b22fb..a9f8190f7 100644
--- a/scripts/buildsystems/vcpkg.cmake
+++ b/scripts/buildsystems/vcpkg.cmake
@@ -187,7 +187,7 @@ macro(find_package name)
unset(Boost_USE_STATIC_RUNTIME)
set(Boost_COMPILER "-vc140")
_find_package(${ARGV})
- elseif("${name}" STREQUAL "ICU")
+ elseif("${name}" STREQUAL "ICU" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/unicode/utf.h")
function(_vcpkg_find_in_list)
list(FIND ARGV "COMPONENTS" COMPONENTS_IDX)
set(COMPONENTS_IDX ${COMPONENTS_IDX} PARENT_SCOPE)
@@ -198,7 +198,7 @@ macro(find_package name)
else()
_find_package(${ARGV})
endif()
- elseif("${name}" STREQUAL "TIFF")
+ elseif("${name}" STREQUAL "TIFF" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/tiff.h")
_find_package(${ARGV})
find_package(LibLZMA)
if(TARGET TIFF::TIFF)
@@ -207,24 +207,7 @@ macro(find_package name)
if(TIFF_LIBRARIES)
list(APPEND TIFF_LIBRARIES ${LIBLZMA_LIBRARIES})
endif()
- elseif("${name}" STREQUAL "Freetype")
- _find_package(${ARGV})
- find_package(ZLIB)
- find_package(PNG)
- find_package(BZip2)
- if(TARGET Freetype::Freetype)
- set_property(TARGET Freetype::Freetype APPEND PROPERTY INTERFACE_LINK_LIBRARIES BZip2::BZip2 PNG::PNG ZLIB::ZLIB)
- endif()
- if(FREETYPE_LIBRARIES)
- list(APPEND FREETYPE_LIBRARIES ${BZIP2_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
- endif()
- elseif("${name}" STREQUAL "tinyxml2")
- _find_package(${ARGV})
- if(TARGET tinyxml2_static AND NOT TARGET tinyxml2)
- _add_library(tinyxml2 INTERFACE IMPORTED)
- set_target_properties(tinyxml2 PROPERTIES INTERFACE_LINK_LIBRARIES "tinyxml2_static")
- endif()
- elseif(("${name}" STREQUAL "HDF5" OR "${name}" STREQUAL "hdf5") AND NOT PROJECT_NAME STREQUAL "VTK")
+ elseif(("${name}" STREQUAL "HDF5" OR "${name}" STREQUAL "hdf5") AND NOT PROJECT_NAME STREQUAL "VTK" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/hdf5.h")
# This is a hack to make VTK work. TODO: find another way to suppress the built-in find module.
_find_package(${ARGV} CONFIG)
# Fill in missing static/shared targets
@@ -237,7 +220,7 @@ macro(find_package name)
set_target_properties(hdf5::${HDF5TARGET}-static PROPERTIES INTERFACE_LINK_LIBRARIES "hdf5::${HDF5TARGET}-shared")
endif()
endforeach()
- elseif("${name}" STREQUAL "GSL")
+ elseif("${name}" STREQUAL "GSL" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/gsl")
_find_package(${ARGV})
if(GSL_FOUND AND TARGET GSL::gsl)
set_property( TARGET GSL::gslcblas APPEND PROPERTY IMPORTED_CONFIGURATIONS Release )
@@ -249,7 +232,7 @@ macro(find_package name)
set_target_properties( GSL::gslcblas PROPERTIES IMPORTED_LOCATION_DEBUG "${GSL_CBLAS_LIBRARY_DEBUG}" )
endif()
endif()
- elseif("${name}" STREQUAL "CURL")
+ elseif("${name}" STREQUAL "CURL" AND EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/curl")
_find_package(${ARGV})
if(CURL_FOUND)
if(EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/nghttp2.lib")
@@ -258,16 +241,6 @@ macro(find_package name)
"optimized" "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/nghttp2.lib")
endif()
endif()
- elseif("${name}" STREQUAL "LibXml2")
- _find_package(${ARGV})
- if(LibXml2_FOUND AND (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore"))
- list(APPEND LIBXML2_LIBRARIES
- debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libiconv.lib
- optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libiconv.lib
- debug ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/libcharset.lib
- optimized ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libcharset.lib
- ws2_32)
- endif()
else()
_find_package(${ARGV})
endif()
diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake
index 630662588..41415d9a8 100644
--- a/scripts/cmake/vcpkg_build_cmake.cmake
+++ b/scripts/cmake/vcpkg_build_cmake.cmake
@@ -105,6 +105,7 @@ function(vcpkg_build_cmake)
if(out_contents MATCHES "LINK : fatal error LNK1102:" OR out_contents MATCHES " fatal error C1060: ")
# The linker ran out of memory during execution. We will try continuing once more, with parallelism disabled.
+ message(STATUS "Restarting Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} without parallelism because memory exceeded")
execute_process(
COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${NO_PARALLEL_ARG}
OUTPUT_FILE "${LOGPREFIX}-out-1.log"
@@ -123,6 +124,33 @@ function(vcpkg_build_cmake)
list(APPEND LOGS "${LOGPREFIX}-err-1.log")
endif()
endif()
+ elseif(out_contents MATCHES ": No such file or directory")
+ # WSL workaround - WSL occassionally fails with no such file or directory. Detect if we are running in WSL and restart.
+ execute_process(COMMAND "uname" "-r"
+ OUTPUT_VARIABLE UNAME_R ERROR_VARIABLE UNAME_R
+ OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE)
+
+ if (UNAME_R MATCHES "Microsoft")
+ message(STATUS "Restarting Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} because of (potential) wsl subsystem issue.")
+ execute_process(
+ COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS}
+ OUTPUT_FILE "${LOGPREFIX}-out-1.log"
+ ERROR_FILE "${LOGPREFIX}-err-1.log"
+ RESULT_VARIABLE error_code
+ WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE})
+
+ if(error_code)
+ file(READ "${LOGPREFIX}-out-1.log" out_contents)
+ file(READ "${LOGPREFIX}-err-1.log" err_contents)
+
+ if(out_contents)
+ list(APPEND LOGS "${LOGPREFIX}-out-1.log")
+ endif()
+ if(err_contents)
+ list(APPEND LOGS "${LOGPREFIX}-err-1.log")
+ endif()
+ endif()
+ endif()
endif()
if(error_code)
diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake
index 3a3a88515..3e0922428 100644
--- a/scripts/cmake/vcpkg_configure_cmake.cmake
+++ b/scripts/cmake/vcpkg_configure_cmake.cmake
@@ -165,6 +165,7 @@ function(vcpkg_configure_cmake)
list(APPEND _csc_OPTIONS
"-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET}"
+ "-DVCPKG_PLATFORM_TOOLSET=${VCPKG_PLATFORM_TOOLSET}"
"-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON"
"-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON"
"-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON"
diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake
index ef0e1584f..30ecb0573 100644
--- a/scripts/cmake/vcpkg_find_acquire_program.cmake
+++ b/scripts/cmake/vcpkg_find_acquire_program.cmake
@@ -116,7 +116,7 @@ function(vcpkg_find_acquire_program VAR)
if(CMAKE_HOST_WIN32)
set(PATHS "${DOWNLOADS}/tools/ninja/${SUBDIR}")
else()
- set(PATHS "${DOWNLOADS}/tools/${SUBDIR}")
+ set(PATHS "${DOWNLOADS}/tools/${SUBDIR}-linux")
endif()
set(BREW_PACKAGE_NAME "ninja")
set(APT_PACKAGE_NAME "ninja-build")
@@ -218,19 +218,20 @@ function(vcpkg_find_acquire_program VAR)
FILENAME ${ARCHIVE}
)
- file(MAKE_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR})
+ set(PROG_PATH_SUBDIR "${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}")
+ file(MAKE_DIRECTORY ${PROG_PATH_SUBDIR})
if(DEFINED NOEXTRACT)
if(DEFINED _vfa_RENAME)
- file(INSTALL ${ARCHIVE_PATH} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR} RENAME ${_vfa_RENAME})
+ file(INSTALL ${ARCHIVE_PATH} DESTINATION ${PROG_PATH_SUBDIR} RENAME ${_vfa_RENAME})
else()
- file(COPY ${ARCHIVE_PATH} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR})
+ file(COPY ${ARCHIVE_PATH} DESTINATION ${PROG_PATH_SUBDIR})
endif()
else()
get_filename_component(ARCHIVE_EXTENSION ${ARCHIVE} EXT)
string(TOLOWER "${ARCHIVE_EXTENSION}" ARCHIVE_EXTENSION)
if(ARCHIVE_EXTENSION STREQUAL ".msi")
file(TO_NATIVE_PATH "${ARCHIVE_PATH}" ARCHIVE_NATIVE_PATH)
- file(TO_NATIVE_PATH "${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}" DESTINATION_NATIVE_PATH)
+ file(TO_NATIVE_PATH "${PROG_PATH_SUBDIR}" DESTINATION_NATIVE_PATH)
execute_process(
COMMAND msiexec /a ${ARCHIVE_NATIVE_PATH} /qn TARGETDIR=${DESTINATION_NATIVE_PATH}
WORKING_DIRECTORY ${DOWNLOADS}
@@ -238,7 +239,7 @@ function(vcpkg_find_acquire_program VAR)
else()
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xzf ${ARCHIVE_PATH}
- WORKING_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}
+ WORKING_DIRECTORY ${PROG_PATH_SUBDIR}
)
endif()
endif()
diff --git a/scripts/fetchTool.ps1 b/scripts/fetchTool.ps1
index 26eedac3b..dd3f0f9f4 100644
--- a/scripts/fetchTool.ps1
+++ b/scripts/fetchTool.ps1
@@ -22,43 +22,74 @@ function fetchToolInternal([Parameter(Mandatory=$true)][string]$tool)
if ($toolData -eq $null)
{
- throw "Unkown tool $tool"
+ throw "Unknown tool $tool"
}
- $exePath = "$downloadsDir\$($toolData.exeRelativePath)"
+ $toolPath="$downloadsDir\tools\$tool-$($toolData.version)-windows"
+ $exePath = "$toolPath\$($toolData.exeRelativePath)"
if (Test-Path $exePath)
{
return $exePath
}
- $isArchive = vcpkgHasProperty -object $toolData -propertyName "archiveRelativePath"
+ $isArchive = vcpkgHasProperty -object $toolData -propertyName "archiveName"
if ($isArchive)
{
- $downloadPath = "$downloadsDir\$($toolData.archiveRelativePath)"
+ $downloadPath = "$downloadsDir\$($toolData.archiveName)"
}
else
{
- $downloadPath = "$downloadsDir\$($toolData.exeRelativePath)"
+ $downloadPath = "$toolPath\$($toolData.exeRelativePath)"
}
[String]$url = $toolData.url
if (!(Test-Path $downloadPath))
{
Write-Host "Downloading $tool..."
- vcpkgDownloadFile $url $downloadPath
+
+ # Download aria2 with .NET. aria2 will be used to download everything else.
+ if ($tool -eq "aria2")
+ {
+ vcpkgDownloadFile $url $downloadPath $toolData.sha512
+ }
+ else
+ {
+ $aria2exe = fetchToolInternal "aria2"
+ vcpkgDownloadFileWithAria2 $aria2exe $url $downloadPath $toolData.sha512
+ }
+
Write-Host "Downloading $tool... done."
}
-
- $expectedDownloadedFileHash = $toolData.sha256
- $downloadedFileHash = vcpkgGetSHA256 $downloadPath
- vcpkgCheckEqualFileHash -filePath $downloadPath -expectedHash $expectedDownloadedFileHash -actualHash $downloadedFileHash
+ else
+ {
+ vcpkgCheckEqualFileHash -url $url -filePath $downloadPath -expectedHash $toolData.sha512
+ }
if ($isArchive)
{
- $outFilename = (Get-ChildItem $downloadPath).BaseName
Write-Host "Extracting $tool..."
- vcpkgExtractFile -ArchivePath $downloadPath -DestinationDir $downloadsDir -outFilename $outFilename
+ # Extract 7zip920 with shell because we need it to extract 7zip
+ # Extract aria2 with shell because we need it to download 7zip
+ if ($tool -eq "7zip920" -or $tool -eq "aria2")
+ {
+ vcpkgExtractZipFile -ArchivePath $downloadPath -DestinationDir $toolPath
+ }
+ elseif ($tool -eq "7zip")
+ {
+ $sevenZip920 = fetchToolInternal "7zip920"
+ $ec = vcpkgInvokeCommand "$sevenZip920" "x `"$downloadPath`" -o`"$toolPath`" -y"
+ if ($ec -ne 0)
+ {
+ Write-Host "Could not extract $downloadPath"
+ throw
+ }
+ }
+ else
+ {
+ $sevenZipExe = fetchToolInternal "7zip"
+ vcpkgExtractFileWith7z -sevenZipExe "$sevenZipExe" -ArchivePath $downloadPath -DestinationDir $toolPath
+ }
Write-Host "Extracting $tool... done."
}
diff --git a/scripts/toolchains/windows.cmake b/scripts/toolchains/windows.cmake
index 7bfc2282b..266e023b1 100644
--- a/scripts/toolchains/windows.cmake
+++ b/scripts/toolchains/windows.cmake
@@ -9,8 +9,17 @@ if(NOT _CMAKE_IN_TRY_COMPILE)
message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"")
endif()
- set(CMAKE_CXX_FLAGS " /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP ${VCPKG_CXX_FLAGS}" CACHE STRING "")
- set(CMAKE_C_FLAGS " /DWIN32 /D_WINDOWS /W3 /utf-8 /MP ${VCPKG_C_FLAGS}" CACHE STRING "")
+ set(CHARSET_FLAG "/utf-8")
+ if(VCPKG_PLATFORM_TOOLSET MATCHES "v120")
+ # VS 2013 does not support /utf-8
+ set(CHARSET_FLAG)
+ endif()
+
+ set(CMAKE_CXX_FLAGS " /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /GR /EHsc /MP ${VCPKG_CXX_FLAGS}" CACHE STRING "")
+ set(CMAKE_C_FLAGS " /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /MP ${VCPKG_C_FLAGS}" CACHE STRING "")
+ set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "")
+
+ unset(CHARSET_FLAG)
set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "")
set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "")
diff --git a/scripts/vcpkgTools.xml b/scripts/vcpkgTools.xml
index 477584c5a..daaf29214 100644
--- a/scripts/vcpkgTools.xml
+++ b/scripts/vcpkgTools.xml
@@ -1,71 +1,85 @@
<?xml version="1.0"?>
-<tools version="1">
- <tool name="cmake">
- <requiredVersion>3.10.2</requiredVersion>
+<tools version="2">
+ <tool name="cmake" os="windows">
+ <version>3.10.2</version>
<exeRelativePath>cmake-3.10.2-win32-x86\bin\cmake.exe</exeRelativePath>
<url>https://cmake.org/files/v3.10/cmake-3.10.2-win32-x86.zip</url>
- <sha256>f5f7e41a21d0e9b655aca58498b08e17ecd27796bf82837e2c84435359169dd6</sha256>
- <archiveRelativePath>cmake-3.10.2-win32-x86.zip</archiveRelativePath>
+ <sha512>9c16861a2ac09c7011b84f38459ecfec2829a9f825b254acbbde46d98f12f8ca0d4db3a6764758cb671507ee7c0327576d87658b81d7ddf1e8280b37569eb16d</sha512>
+ <archiveName>cmake-3.10.2-win32-x86.zip</archiveName>
</tool>
<tool name="cmake" os="osx">
- <requiredVersion>3.10.2</requiredVersion>
+ <version>3.10.2</version>
<exeRelativePath>cmake-3.10.2-Darwin-x86_64/CMake.app/Contents/bin/cmake</exeRelativePath>
<url>https://cmake.org/files/v3.10/cmake-3.10.2-Darwin-x86_64.tar.gz</url>
- <sha256>e748eb7698f8e2783c2eea9ab81eebf66da0238bbf8e8fa722a67a38f2110718</sha256>
- <archiveRelativePath>cmake-3.10.2-Darwin-x86_64.tar.gz</archiveRelativePath>
+ <sha512>cb7d76e11c892eb786da5804282c4141564390c3552e08c506c7abb93015eb5f619c55255459872b219399ce8114ac321fe92df7f82a7e42bbc874eec240571e</sha512>
+ <archiveName>cmake-3.10.2-Darwin-x86_64.tar.gz</archiveName>
</tool>
<tool name="cmake" os="linux">
- <requiredVersion>3.10.2</requiredVersion>
+ <version>3.10.2</version>
<exeRelativePath>cmake-3.10.2-Linux-x86_64/bin/cmake</exeRelativePath>
<url>https://cmake.org/files/v3.10/cmake-3.10.2-Linux-x86_64.tar.gz</url>
- <sha256>7a82b46c35f4e68a0807e8dc04e779dee3f36cd42c6387fd13b5c29fe62a69ea</sha256>
- <archiveRelativePath>cmake-3.10.2-Linux-x86_64.tar.gz</archiveRelativePath>
+ <sha512>54389b5cb3f3cb9d182d35e0b1eaf7b301695899930da0d26e9df1dc25056213a077646d23ea609a93daa81d30687757d9cf0dc263339fa3d73dbeb1284bc1a9</sha512>
+ <archiveName>cmake-3.10.2-Linux-x86_64.tar.gz</archiveName>
</tool>
- <tool name="git">
- <requiredVersion>2.16.2</requiredVersion>
- <exeRelativePath>MinGit-2.16.2-32-bit\cmd\git.exe</exeRelativePath>
+ <tool name="git" os="windows">
+ <version>2.16.2</version>
+ <exeRelativePath>cmd\git.exe</exeRelativePath>
<url>https://github.com/git-for-windows/git/releases/download/v2.16.2.windows.1/MinGit-2.16.2-32-bit.zip</url>
- <sha256>322c727e482aa97522c64a5ac68bdda3780111e8670bcfb532beac8e11ece5da</sha256>
- <archiveRelativePath>MinGit-2.16.2-32-bit.zip</archiveRelativePath>
+ <sha512>004e1dc1904f2e2d5c3534d0a56f58bf030b1146f5b263d6d191e60f72cd35455977c588604708125a1e93268ee8f7a5ab32ed6115adc028257b12d5926f350a</sha512>
+ <archiveName>MinGit-2.16.2-32-bit.zip</archiveName>
</tool>
- <tool name="vswhere">
- <requiredVersion>2.3.2</requiredVersion>
- <exeRelativePath>vswhere-2.3.2\vswhere.exe</exeRelativePath>
- <url>https://github.com/Microsoft/vswhere/releases/download/2.3.2/vswhere.exe</url>
- <sha256>103f2784c4b2c8e70c7c1c03687abbf22bce052aae30639406e4e13ffa29ee04</sha256>
+ <tool name="vswhere" os="windows">
+ <version>2.4.1</version>
+ <exeRelativePath>vswhere.exe</exeRelativePath>
+ <url>https://github.com/Microsoft/vswhere/releases/download/2.4.1/vswhere.exe</url>
+ <sha512>f477842d0cebefcd6bf9c6d536ab8ea20ec5b0aa967ee963ab6a101aeff9df8742ca600d35f39e2e7158d76d8231f1ed2bef6104dce84d2bf8d6b07d17d706a1</sha512>
</tool>
- <tool name="nuget">
- <requiredVersion>4.4.0</requiredVersion>
- <exeRelativePath>nuget-4.4.0\nuget.exe</exeRelativePath>
- <url>https://dist.nuget.org/win-x86-commandline/v4.4.0/nuget.exe</url>
- <sha256>2cf9b118937eef825464e548f0c44f7f64090047746de295d75ac3dcffa3e1f6</sha256>
+ <tool name="nuget" os="windows">
+ <version>4.6.2</version>
+ <exeRelativePath>nuget.exe</exeRelativePath>
+ <url>https://dist.nuget.org/win-x86-commandline/v4.6.2/nuget.exe</url>
+ <sha512>60daea7bec2de23089f7ad73985dd788ac154171d6326c2c456726849b8f97dfc38cbdd9b9bf8d96aced009ccaaed317905b65c108e149cfbbbcdfb95f8f0519</sha512>
</tool>
- <tool name="installerbase">
- <requiredVersion>3.1.81</requiredVersion>
+ <tool name="installerbase" os="windows">
+ <version>3.1.81</version>
<exeRelativePath>QtInstallerFramework-win-x86\bin\installerbase.exe</exeRelativePath>
<url>https://github.com/podsvirov/installer-framework/releases/download/cr203958-9/QtInstallerFramework-win-x86.zip</url>
- <sha256>f2ce23cf5cf9fc7ce409bdca49328e09a070c0026d3c8a04e4dfde7b05b83fe8</sha256>
- <archiveRelativePath>QtInstallerFramework-win-x86.zip</archiveRelativePath>
+ <sha512>1f3e593270d7c2a4e271fdb49c637a2de462351310ef66bba298d30f6ca23365ec6aecf2e57799a00c873267cd3f92060ecac03eb291d42903d0e0869cd17c73</sha512>
+ <archiveName>QtInstallerFramework-win-x86.zip</archiveName>
</tool>
- <tool name="7zip">
- <requiredVersion>18.01.0</requiredVersion>
- <exeRelativePath>7za920\7za.exe</exeRelativePath>
- <url>http://www.7-zip.org/a/7za920.zip</url>
- <sha256>2a3afe19c180f8373fa02ff00254d5394fec0349f5804e0ad2f6067854ff28ac</sha256>
- <archiveRelativePath>7za920.zip</archiveRelativePath>
+ <tool name="7zip" os="windows">
+ <version>18.01.0</version>
+ <exeRelativePath>7za.exe</exeRelativePath>
+ <url>https://www.7-zip.org/a/7z1801-extra.7z</url>
+ <sha512>9133fc551d76515e37fdd4dd8c1e28d464aea493548246b44565a42bba46715764f41f9cfa14d470d298c3a6e9829d200f8be5168cb67cf8f23d8042fca833bc</sha512>
+ <archiveName>7z1801-extra.7z</archiveName>
+ </tool>
+ <tool name="7zip920" os="windows">
+ <version>9.20.0</version>
+ <exeRelativePath>7za.exe</exeRelativePath>
+ <url>https://www.7-zip.org/a/7za920.zip</url>
+ <sha512>84e830c91a0e8ae499cc4814080da6569d8a6acbddc585c8b62abc86c809793aeb669b0a741063a379fd281ade85f120bc27efeb67d63bf961be893eec8bc3b3</sha512>
+ <archiveName>7za920.zip</archiveName>
+ </tool>
+ <tool name="aria2" os="windows">
+ <version>18.01.0</version>
+ <exeRelativePath>aria2-1.33.1-win-32bit-build1\aria2c.exe</exeRelativePath>
+ <url>https://github.com/aria2/aria2/releases/download/release-1.33.1/aria2-1.33.1-win-32bit-build1.zip</url>
+ <sha512>2456176ba3d506a07cf0cc4f61f080e1ff8cb4106426d66f354c5bb67a9a8720b5ddb26904275e61b1f623c932355f7dcde4cd17556cc895f11293c23c3a9bf3</sha512>
+ <archiveName>aria2-1.33.1-win-32bit-build1.zip</archiveName>
</tool>
<tool name="ninja" os="linux">
- <requiredVersion>1.8.2</requiredVersion>
+ <version>1.8.2</version>
<exeRelativePath>ninja</exeRelativePath>
<url>https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip</url>
- <sha256>d2fea9ff33b3ef353161ed906f260d565ca55b8ca0568fa07b1d2cab90a84a07</sha256>
- <archiveRelativePath>ninja-linux.zip</archiveRelativePath>
+ <sha512>38fcb68e745c1f15b4b50f20069ffe686b1ef5baf93b74958e132ea5d30d155cf6970d6dc1b095aafd421ebd8bcc63acf4f64e305c496266b5182f99b815cca5</sha512>
+ <archiveName>ninja-linux.zip</archiveName>
</tool>
<tool name="ninja" os="osx">
- <requiredVersion>1.8.2</requiredVersion>
+ <version>1.8.2</version>
<exeRelativePath>ninja</exeRelativePath>
<url>https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip</url>
- <sha256>0347d55c66061652b26f48769d566761630ffde3143793b29064a57f356542cc</sha256>
- <archiveRelativePath>ninja-mac.zip</archiveRelativePath>
+ <sha512>acadfb286eb7d93676629701917fa0c3c39f36daa068c169e4a098c29f97380d1ea95abfd42b04798ff118fd9dc93fdb250fcda36086bac20bc5506354214fc3</sha512>
+ <archiveName>ninja-mac.zip</archiveName>
</tool>
</tools>
diff --git a/toolsrc/CMakeLists.txt b/toolsrc/CMakeLists.txt
index acc12f2b3..db756deee 100644
--- a/toolsrc/CMakeLists.txt
+++ b/toolsrc/CMakeLists.txt
@@ -23,6 +23,9 @@ endif()
if(GCC OR CLANG)
add_compile_options(-std=c++1z)
+ if(WERROR)
+ add_compile_options(-Wall -Wno-unknown-pragmas -Werror)
+ endif()
endif()
file(GLOB_RECURSE VCPKGLIB_SOURCES src/vcpkg/*.cpp)
diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt
index daa1cd86e..2cd1bf9ac 100644
--- a/toolsrc/VERSION.txt
+++ b/toolsrc/VERSION.txt
@@ -1 +1 @@
-"0.0.107" \ No newline at end of file
+"0.0.108" \ No newline at end of file
diff --git a/toolsrc/include/vcpkg/base/checks.h b/toolsrc/include/vcpkg/base/checks.h
index fb162c897..bceee3428 100644
--- a/toolsrc/include/vcpkg/base/checks.h
+++ b/toolsrc/include/vcpkg/base/checks.h
@@ -27,7 +27,7 @@ namespace vcpkg::Checks
// Display an error message to the user and exit the tool.
[[noreturn]] void exit_with_message(const LineInfo& line_info,
const char* error_message_template,
- const Arg1 error_message_arg1,
+ const Arg1& error_message_arg1,
const Args&... error_message_args)
{
exit_with_message(line_info,
@@ -42,7 +42,7 @@ namespace vcpkg::Checks
void check_exit(const LineInfo& line_info,
Conditional&& expression,
const char* error_message_template,
- const Arg1 error_message_arg1,
+ const Arg1& error_message_arg1,
const Args&... error_message_args)
{
if (!expression)
diff --git a/toolsrc/include/vcpkg/base/chrono.h b/toolsrc/include/vcpkg/base/chrono.h
index 4291115f7..aa764a597 100644
--- a/toolsrc/include/vcpkg/base/chrono.h
+++ b/toolsrc/include/vcpkg/base/chrono.h
@@ -2,7 +2,6 @@
#include <chrono>
#include <string>
-#include <time.h>
#include <vcpkg/base/optional.h>
namespace vcpkg::Chrono
@@ -12,8 +11,8 @@ namespace vcpkg::Chrono
using duration = std::chrono::high_resolution_clock::time_point::duration;
public:
- constexpr ElapsedTime() : m_duration() {}
- constexpr ElapsedTime(duration d) : m_duration(d) {}
+ constexpr ElapsedTime() noexcept : m_duration() {}
+ constexpr ElapsedTime(duration d) noexcept : m_duration(d) {}
template<class TimeUnit>
TimeUnit as() const
@@ -32,7 +31,7 @@ namespace vcpkg::Chrono
public:
static ElapsedTimer create_started();
- constexpr ElapsedTimer() : m_start_tick() {}
+ constexpr ElapsedTimer() noexcept : m_start_tick() {}
ElapsedTime elapsed() const
{
@@ -53,8 +52,8 @@ namespace vcpkg::Chrono
static Optional<CTime> get_current_date_time();
static Optional<CTime> parse(CStringView str);
- constexpr CTime() : m_tm{0} {}
- explicit constexpr CTime(tm t) : m_tm{t} {}
+ constexpr CTime() noexcept : m_tm{0} {}
+ explicit constexpr CTime(tm t) noexcept : m_tm{t} {}
std::string to_string() const;
diff --git a/toolsrc/include/vcpkg/base/cstringview.h b/toolsrc/include/vcpkg/base/cstringview.h
index 0441bc573..f285aa36c 100644
--- a/toolsrc/include/vcpkg/base/cstringview.h
+++ b/toolsrc/include/vcpkg/base/cstringview.h
@@ -7,7 +7,7 @@ namespace vcpkg
{
struct CStringView
{
- constexpr CStringView() : cstr(nullptr) {}
+ constexpr CStringView() noexcept : cstr(nullptr) {}
constexpr CStringView(const char* cstr) : cstr(cstr) {}
constexpr CStringView(const CStringView&) = default;
CStringView(const std::string& str) : cstr(str.c_str()) {}
@@ -18,19 +18,6 @@ namespace vcpkg
const char* cstr;
};
- struct CWStringView
- {
- constexpr CWStringView() : cstr(nullptr) {}
- constexpr CWStringView(const wchar_t* cstr) : cstr(cstr) {}
- constexpr CWStringView(const CWStringView&) = default;
- CWStringView(const std::wstring& str) : cstr(str.c_str()) {}
-
- constexpr const wchar_t* c_str() const { return cstr; }
-
- private:
- const wchar_t* cstr;
- };
-
namespace details
{
inline bool vcpkg_strcmp(const char* l, const char* r) { return strcmp(l, r) == 0; }
diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h
index ac1f192ae..f16805d0a 100644
--- a/toolsrc/include/vcpkg/base/files.h
+++ b/toolsrc/include/vcpkg/base/files.h
@@ -64,7 +64,7 @@ namespace vcpkg::Files
Filesystem& get_real_filesystem();
- static const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)";
+ static constexpr const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)";
bool has_invalid_chars_for_filesystem(const std::string& s);
diff --git a/toolsrc/include/vcpkg/base/lineinfo.h b/toolsrc/include/vcpkg/base/lineinfo.h
index e7e8c3031..e0eb8bec9 100644
--- a/toolsrc/include/vcpkg/base/lineinfo.h
+++ b/toolsrc/include/vcpkg/base/lineinfo.h
@@ -9,7 +9,7 @@ namespace vcpkg
int line_number;
const char* file_name;
- constexpr LineInfo() : line_number(0), file_name("") {}
+ constexpr LineInfo() noexcept : line_number(0), file_name("") {}
constexpr LineInfo(const int lineno, const char* filename) : line_number(lineno), file_name(filename) {}
std::string to_string() const;
diff --git a/toolsrc/include/vcpkg/base/optional.h b/toolsrc/include/vcpkg/base/optional.h
index af2d297a6..6b84b10aa 100644
--- a/toolsrc/include/vcpkg/base/optional.h
+++ b/toolsrc/include/vcpkg/base/optional.h
@@ -16,7 +16,7 @@ namespace vcpkg
template<class T>
struct OptionalStorage
{
- constexpr OptionalStorage() : m_is_present(false), m_t() {}
+ constexpr OptionalStorage() noexcept : m_is_present(false), m_t() {}
constexpr OptionalStorage(const T& t) : m_is_present(true), m_t(t) {}
constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) {}
@@ -33,7 +33,7 @@ namespace vcpkg
template<class T>
struct OptionalStorage<T&>
{
- constexpr OptionalStorage() : m_t(nullptr) {}
+ constexpr OptionalStorage() noexcept : m_t(nullptr) {}
constexpr OptionalStorage(T& t) : m_t(&t) {}
constexpr bool has_value() const { return m_t != nullptr; }
@@ -48,7 +48,7 @@ namespace vcpkg
template<class T>
struct Optional
{
- constexpr Optional() {}
+ constexpr Optional() noexcept {}
// Constructors are intentionally implicit
constexpr Optional(NullOpt) {}
@@ -64,6 +64,12 @@ namespace vcpkg
return std::move(this->m_base.value());
}
+ T& value_or_exit(const LineInfo& line_info) &
+ {
+ this->exit_if_null(line_info);
+ return this->m_base.value();
+ }
+
const T& value_or_exit(const LineInfo& line_info) const&
{
this->exit_if_null(line_info);
diff --git a/toolsrc/include/vcpkg/base/span.h b/toolsrc/include/vcpkg/base/span.h
index c9ac18afe..2b067d0ac 100644
--- a/toolsrc/include/vcpkg/base/span.h
+++ b/toolsrc/include/vcpkg/base/span.h
@@ -19,18 +19,19 @@ namespace vcpkg
using iterator = pointer;
constexpr Span() noexcept : m_ptr(nullptr), m_count(0) {}
- constexpr Span(std::nullptr_t) noexcept : Span() {}
+ constexpr Span(std::nullptr_t) noexcept : m_ptr(nullptr), m_count(0) {}
constexpr Span(pointer ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {}
constexpr Span(pointer ptr_begin, pointer ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {}
constexpr Span(std::initializer_list<T> l) noexcept : m_ptr(l.begin()), m_count(l.size()) {}
template<size_t N>
- constexpr Span(T (&arr)[N]) noexcept : Span(arr, N)
+ constexpr Span(T (&arr)[N]) noexcept : m_ptr(arr), m_count(N)
{
}
template<size_t N>
- constexpr Span(const std::array<std::remove_const_t<T>, N>& arr) noexcept : Span(arr.data(), arr.size())
+ constexpr Span(const std::array<std::remove_const_t<T>, N>& arr) noexcept
+ : m_ptr(arr.data()), m_count(arr.size())
{
}
diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h
index c32e81ac2..4cc17bcf4 100644
--- a/toolsrc/include/vcpkg/base/strings.h
+++ b/toolsrc/include/vcpkg/base/strings.h
@@ -36,7 +36,7 @@ namespace vcpkg::Strings
std::wstring to_utf16(const CStringView& s);
- std::string to_utf8(const CWStringView& w);
+ std::string to_utf8(const wchar_t* w);
std::string escape_string(const CStringView& s, char char_to_escape, char escape_char);
diff --git a/toolsrc/include/vcpkg/binaryparagraph.h b/toolsrc/include/vcpkg/binaryparagraph.h
index 3315151c6..5ba2fbde3 100644
--- a/toolsrc/include/vcpkg/binaryparagraph.h
+++ b/toolsrc/include/vcpkg/binaryparagraph.h
@@ -12,7 +12,7 @@ namespace vcpkg
/// </summary>
struct BinaryParagraph
{
- BinaryParagraph();
+ BinaryParagraph() noexcept;
explicit BinaryParagraph(std::unordered_map<std::string, std::string> fields);
BinaryParagraph(const SourceParagraph& spgh, const Triplet& triplet, const std::string& abi_tag);
BinaryParagraph(const SourceParagraph& spgh, const FeatureParagraph& fpgh, const Triplet& triplet);
diff --git a/toolsrc/include/vcpkg/build.h b/toolsrc/include/vcpkg/build.h
index a86245ccf..c5e7e8d88 100644
--- a/toolsrc/include/vcpkg/build.h
+++ b/toolsrc/include/vcpkg/build.h
@@ -62,7 +62,7 @@ namespace vcpkg::Build
BUILT_IN,
ARIA2,
};
- const std::string& to_string(DownloadTool tool);
+ const std::string& to_string(DownloadTool tool);
struct BuildPackageOptions
{
@@ -203,8 +203,8 @@ namespace vcpkg::Build
struct BuildInfo
{
- LinkageType crt_linkage;
- LinkageType library_linkage;
+ LinkageType crt_linkage = LinkageType::DYNAMIC;
+ LinkageType library_linkage = LinkageType::DYNAMIC;
Optional<std::string> version;
diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h
index 7369b8206..6d29b7960 100644
--- a/toolsrc/include/vcpkg/commands.h
+++ b/toolsrc/include/vcpkg/commands.h
@@ -131,8 +131,17 @@ namespace vcpkg::Commands
namespace Hash
{
+ std::string get_string_hash(const std::string& s, const std::string& hash_type);
+ std::string get_file_hash(const VcpkgPaths& paths, const fs::path& path, const std::string& hash_type);
+
+ void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
+ }
+
+ namespace Fetch
+ {
+ std::vector<Toolset> find_toolset_instances(const VcpkgPaths& paths);
+ fs::path get_tool_path(const VcpkgPaths& paths, const std::string& tool);
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
- std::string get_file_hash(const VcpkgPaths& paths, fs::path const& path, std::string const& hash_type);
}
template<class T>
diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h
index fea0d88a9..3c3b8f267 100644
--- a/toolsrc/include/vcpkg/dependencies.h
+++ b/toolsrc/include/vcpkg/dependencies.h
@@ -35,10 +35,9 @@ namespace vcpkg::Dependencies
{
static bool compare_by_name(const InstallPlanAction* left, const InstallPlanAction* right);
- InstallPlanAction();
+ InstallPlanAction() noexcept;
- InstallPlanAction(const PackageSpec& spec,
- InstalledPackageView&& spghs,
+ InstallPlanAction(InstalledPackageView&& spghs,
const std::set<std::string>& features,
const RequestType& request_type);
@@ -74,7 +73,7 @@ namespace vcpkg::Dependencies
{
static bool compare_by_name(const RemovePlanAction* left, const RemovePlanAction* right);
- RemovePlanAction();
+ RemovePlanAction() noexcept;
RemovePlanAction(const PackageSpec& spec, const RemovePlanType& plan_type, const RequestType& request_type);
PackageSpec spec;
@@ -104,7 +103,7 @@ namespace vcpkg::Dependencies
{
static bool compare_by_name(const ExportPlanAction* left, const ExportPlanAction* right);
- ExportPlanAction();
+ ExportPlanAction() noexcept;
ExportPlanAction(const PackageSpec& spec,
InstalledPackageView&& installed_package,
const RequestType& request_type);
diff --git a/toolsrc/include/vcpkg/export.ifw.h b/toolsrc/include/vcpkg/export.ifw.h
index d28a4436d..b1573924e 100644
--- a/toolsrc/include/vcpkg/export.ifw.h
+++ b/toolsrc/include/vcpkg/export.ifw.h
@@ -3,8 +3,6 @@
#include <vcpkg/dependencies.h>
#include <vcpkg/vcpkgpaths.h>
-#include <vcpkg/base/files.h>
-
#include <string>
#include <vector>
diff --git a/toolsrc/include/vcpkg/packagespecparseresult.h b/toolsrc/include/vcpkg/packagespecparseresult.h
index dd91c9a67..be3497152 100644
--- a/toolsrc/include/vcpkg/packagespecparseresult.h
+++ b/toolsrc/include/vcpkg/packagespecparseresult.h
@@ -17,7 +17,7 @@ namespace vcpkg
template<>
struct ErrorHolder<PackageSpecParseResult>
{
- ErrorHolder() : m_err(PackageSpecParseResult::SUCCESS) {}
+ ErrorHolder() noexcept : m_err(PackageSpecParseResult::SUCCESS) {}
ErrorHolder(PackageSpecParseResult err) : m_err(err) {}
bool has_error() const { return m_err != PackageSpecParseResult::SUCCESS; }
diff --git a/toolsrc/include/vcpkg/paragraphs.h b/toolsrc/include/vcpkg/paragraphs.h
index fa0265b75..56f09387a 100644
--- a/toolsrc/include/vcpkg/paragraphs.h
+++ b/toolsrc/include/vcpkg/paragraphs.h
@@ -3,12 +3,9 @@
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/parse.h>
#include <vcpkg/vcpkgpaths.h>
-#include <vcpkg/versiont.h>
#include <vcpkg/base/expected.h>
-#include <map>
-
namespace vcpkg::Paragraphs
{
using RawParagraph = Parse::RawParagraph;
diff --git a/toolsrc/include/vcpkg/statusparagraph.h b/toolsrc/include/vcpkg/statusparagraph.h
index 0802de530..e79c946cc 100644
--- a/toolsrc/include/vcpkg/statusparagraph.h
+++ b/toolsrc/include/vcpkg/statusparagraph.h
@@ -29,7 +29,7 @@ namespace vcpkg
/// </summary>
struct StatusParagraph
{
- StatusParagraph();
+ StatusParagraph() noexcept;
explicit StatusParagraph(std::unordered_map<std::string, std::string>&& fields);
bool is_installed() const { return want == Want::INSTALL && state == InstallState::INSTALLED; }
@@ -47,13 +47,14 @@ namespace vcpkg
struct InstalledPackageView
{
- InstalledPackageView() : core(nullptr) {}
+ InstalledPackageView() noexcept : core(nullptr) {}
InstalledPackageView(const StatusParagraph* c, std::vector<const StatusParagraph*>&& fs)
: core(c), features(std::move(fs))
{
}
+ const PackageSpec& spec() const { return core->package.spec; }
std::vector<PackageSpec> dependencies() const;
const StatusParagraph* core;
diff --git a/toolsrc/include/vcpkg/triplet.h b/toolsrc/include/vcpkg/triplet.h
index 10464dc2c..334960e49 100644
--- a/toolsrc/include/vcpkg/triplet.h
+++ b/toolsrc/include/vcpkg/triplet.h
@@ -9,7 +9,7 @@ namespace vcpkg
struct Triplet
{
public:
- constexpr Triplet() : m_instance(&DEFAULT_INSTANCE) {}
+ constexpr Triplet() noexcept : m_instance(&DEFAULT_INSTANCE) {}
static Triplet from_canonical_name(const std::string& triplet_as_string);
@@ -47,4 +47,4 @@ namespace std
{
size_t operator()(const vcpkg::Triplet& t) const { return t.hash_code(); }
};
-} \ No newline at end of file
+}
diff --git a/toolsrc/include/vcpkg/vcpkgcmdarguments.h b/toolsrc/include/vcpkg/vcpkgcmdarguments.h
index f449887f1..de65eec28 100644
--- a/toolsrc/include/vcpkg/vcpkgcmdarguments.h
+++ b/toolsrc/include/vcpkg/vcpkgcmdarguments.h
@@ -1,6 +1,5 @@
#pragma once
-#include <vcpkg/base/cstringview.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/span.h>
#include <vcpkg/base/stringliteral.h>
diff --git a/toolsrc/include/vcpkg/vcpkglib.h b/toolsrc/include/vcpkg/vcpkglib.h
index 3c8e676bf..5674d30db 100644
--- a/toolsrc/include/vcpkg/vcpkglib.h
+++ b/toolsrc/include/vcpkg/vcpkglib.h
@@ -16,7 +16,7 @@ namespace vcpkg
SortedVector<std::string> files;
};
- std::vector<StatusParagraph*> get_installed_ports(const StatusParagraphs& status_db);
+ std::vector<InstalledPackageView> get_installed_ports(const StatusParagraphs& status_db);
std::vector<StatusParagraphAndAssociatedFiles> get_installed_files(const VcpkgPaths& paths,
const StatusParagraphs& status_db);
diff --git a/toolsrc/include/vcpkg/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h
index b3f24fb89..9c8f2911a 100644
--- a/toolsrc/include/vcpkg/vcpkgpaths.h
+++ b/toolsrc/include/vcpkg/vcpkgpaths.h
@@ -3,12 +3,25 @@
#include <vcpkg/binaryparagraph.h>
#include <vcpkg/packagespec.h>
+#include <vcpkg/base/cache.h>
#include <vcpkg/base/expected.h>
#include <vcpkg/base/files.h>
#include <vcpkg/base/lazy.h>
namespace vcpkg
{
+ namespace Tools
+ {
+ static const std::string SEVEN_ZIP = "7zip";
+ static const std::string CMAKE = "cmake";
+ static const std::string GIT = "git";
+ static const std::string NINJA = "ninja";
+ static const std::string NUGET = "nuget";
+ static const std::string IFW_INSTALLER_BASE = "ifw_installerbase";
+ static const std::string IFW_BINARYCREATOR = "ifw_binarycreator";
+ static const std::string IFW_REPOGEN = "ifw_repogen";
+ }
+
struct ToolsetArchOption
{
CStringView name;
@@ -63,14 +76,7 @@ namespace vcpkg
fs::path ports_cmake;
- const fs::path& get_7za_exe() const;
- const fs::path& get_cmake_exe() const;
- const fs::path& get_git_exe() const;
- const fs::path& get_ninja_exe() const;
- const fs::path& get_nuget_exe() const;
- const fs::path& get_ifw_installerbase_exe() const;
- const fs::path& get_ifw_binarycreator_exe() const;
- const fs::path& get_ifw_repogen_exe() const;
+ const fs::path& get_tool_exe(const std::string& tool) const;
/// <summary>Retrieve a toolset matching a VS version</summary>
/// <remarks>
@@ -82,14 +88,7 @@ namespace vcpkg
private:
Lazy<std::vector<std::string>> available_triplets;
- Lazy<fs::path> _7za_exe;
- Lazy<fs::path> cmake_exe;
- Lazy<fs::path> git_exe;
- Lazy<fs::path> ninja_exe;
- Lazy<fs::path> nuget_exe;
- Lazy<fs::path> ifw_installerbase_exe;
- Lazy<fs::path> ifw_binarycreator_exe;
- Lazy<fs::path> ifw_repogen_exe;
+ Cache<std::string, fs::path> tool_paths;
Lazy<std::vector<Toolset>> toolsets;
Lazy<std::vector<Toolset>> toolsets_vs2013;
diff --git a/toolsrc/include/vcpkg/versiont.h b/toolsrc/include/vcpkg/versiont.h
index 8427dfe3b..e893f1abc 100644
--- a/toolsrc/include/vcpkg/versiont.h
+++ b/toolsrc/include/vcpkg/versiont.h
@@ -5,7 +5,7 @@ namespace vcpkg
{
struct VersionT
{
- VersionT();
+ VersionT() noexcept;
VersionT(std::string&& value);
VersionT(const std::string& value);
@@ -23,7 +23,7 @@ namespace vcpkg
VersionT left;
VersionT right;
- VersionDiff();
+ VersionDiff() noexcept;
VersionDiff(const VersionT& left, const VersionT& right);
std::string to_string() const;
diff --git a/toolsrc/src/tests.plan.cpp b/toolsrc/src/tests.plan.cpp
index a99f1abb9..238aa7032 100644
--- a/toolsrc/src/tests.plan.cpp
+++ b/toolsrc/src/tests.plan.cpp
@@ -81,7 +81,7 @@ namespace UnitTest1
{
std::unordered_map<std::string, SourceControlFile> map;
Triplet triplet;
- PackageSpecMap(const Triplet& t) { triplet = t; }
+ PackageSpecMap(const Triplet& t = Triplet::X86_WINDOWS) noexcept { triplet = t; }
PackageSpec emplace(const char* name,
const char* depends = "",
@@ -105,7 +105,7 @@ namespace UnitTest1
{
std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs;
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a", "b");
auto spec_b = spec_map.emplace("b", "c");
auto spec_c = spec_map.emplace("c");
@@ -124,7 +124,7 @@ namespace UnitTest1
{
std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs;
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a", "d");
auto spec_b = spec_map.emplace("b", "d, e");
auto spec_c = spec_map.emplace("c", "e, h");
@@ -167,7 +167,7 @@ namespace UnitTest1
std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs;
status_paragraphs.push_back(make_status_pgh("a"));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = FullPackageSpec{spec_map.emplace("a")};
auto install_plan =
@@ -187,7 +187,7 @@ namespace UnitTest1
{
std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs;
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = FullPackageSpec{spec_map.emplace("a", "b")};
auto spec_b = FullPackageSpec{spec_map.emplace("b")};
@@ -216,7 +216,7 @@ namespace UnitTest1
status_paragraphs.push_back(make_status_pgh("j", "k"));
status_paragraphs.push_back(make_status_pgh("k"));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a", "b, c, d, e, f, g, h, j, k");
auto spec_b = spec_map.emplace("b", "c, d, e, f, g, h, j, k");
@@ -251,7 +251,7 @@ namespace UnitTest1
status_paragraphs.push_back(make_status_pgh("b"));
status_paragraphs.push_back(make_status_feature_pgh("b", "b1"));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = FullPackageSpec{spec_map.emplace("a", "b, b[b1]", {{"a1", "b[b2]"}}), {"a1"}};
auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}, {"b2", ""}, {"b3", ""}})};
@@ -271,7 +271,7 @@ namespace UnitTest1
{
std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs;
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = FullPackageSpec{spec_map.emplace("a", "b[b1]", {{"a1", "b[b2]"}}), {"a1"}};
auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}, {"b2", ""}, {"b3", ""}})};
@@ -291,7 +291,7 @@ namespace UnitTest1
std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs;
status_paragraphs.push_back(make_status_pgh("a"));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}}), {"core"}};
auto spec_b = FullPackageSpec{spec_map.emplace("b")};
@@ -315,7 +315,7 @@ namespace UnitTest1
status_paragraphs.push_back(make_status_pgh("a"));
status_paragraphs.push_back(make_status_feature_pgh("a", "a1", ""));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}})};
auto spec_b = FullPackageSpec{spec_map.emplace("b")};
@@ -334,7 +334,7 @@ namespace UnitTest1
{
std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs;
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a =
FullPackageSpec{spec_map.emplace("a", "", {{"a1", "b[b1]"}, {"a2", "b[b2]"}, {"a3", "a[a2]"}}), {"a3"}};
@@ -355,7 +355,7 @@ namespace UnitTest1
std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs;
status_paragraphs.push_back(make_status_pgh("b"));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = FullPackageSpec{spec_map.emplace("a", "b[core]"), {"core"}};
auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}}), {"b1"}};
@@ -376,7 +376,7 @@ namespace UnitTest1
status_paragraphs.push_back(make_status_pgh("x", "b"));
status_paragraphs.push_back(make_status_pgh("b"));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = FullPackageSpec{spec_map.emplace("a")};
auto spec_x = FullPackageSpec{spec_map.emplace("x", "a"), {"core"}};
@@ -674,17 +674,35 @@ namespace UnitTest1
Assert::IsTrue(install_plan[0].install_action.get()->computed_dependencies == std::vector<PackageSpec>{});
}
+ TEST_METHOD(install_with_default_features)
+ {
+ std::vector<std::unique_ptr<StatusParagraph>> pghs;
+ pghs.push_back(make_status_pgh("a", ""));
+ StatusParagraphs status_db(std::move(pghs));
+
+ PackageSpecMap spec_map;
+ auto b_spec = spec_map.emplace("b", "", {{"0", ""}}, {"0"});
+ auto a_spec = spec_map.emplace("a", "b[core]", {{"0", ""}});
+
+ // Install "a" and indicate that "b" should not install default features
+ auto install_plan = Dependencies::create_feature_install_plan(
+ spec_map.map, {FeatureSpec{a_spec, "0"}, FeatureSpec{b_spec, "core"}}, status_db);
+
+ Assert::IsTrue(install_plan.size() == 3);
+ remove_plan_check(&install_plan[0], "a");
+ features_check(&install_plan[1], "b", {"core"});
+ features_check(&install_plan[2], "a", {"0", "core"});
+ }
+
TEST_METHOD(upgrade_with_default_features_1)
{
std::vector<std::unique_ptr<StatusParagraph>> pghs;
pghs.push_back(make_status_pgh("a", "", "1"));
pghs.push_back(make_status_feature_pgh("a", "0"));
- pghs.back()->package.spec =
- PackageSpec::from_name_and_triplet("a", Triplet::X86_WINDOWS).value_or_exit(VCPKG_LINE_INFO);
StatusParagraphs status_db(std::move(pghs));
// Add a port "a" of which "core" and "0" are already installed.
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a", "", {{"0", ""}, {"1", ""}}, {"1"});
Dependencies::MapPortFileProvider provider(spec_map.map);
@@ -697,23 +715,47 @@ namespace UnitTest1
Assert::AreEqual(size_t(2), plan.size());
Assert::AreEqual("a", plan[0].spec().name().c_str());
- Assert::IsTrue(plan[0].remove_action.has_value());
-
- Assert::AreEqual("a", plan[1].spec().name().c_str());
- features_check(&plan[1], "a", {"core", "0"}, Triplet::X86_WINDOWS);
+ remove_plan_check(&plan[0], "a");
+ features_check(&plan[1], "a", {"core", "0"});
}
TEST_METHOD(upgrade_with_default_features_2)
{
std::vector<std::unique_ptr<StatusParagraph>> pghs;
- pghs.push_back(make_status_pgh("b"));
- pghs.push_back(make_status_pgh("a", "b[core]"));
- pghs.back()->package.spec =
- PackageSpec::from_name_and_triplet("a", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO);
+ // B is currently installed _without_ default feature b0
+ pghs.push_back(make_status_pgh("b", "", "b0", "x64-windows"));
+ pghs.push_back(make_status_pgh("a", "b[core]", "", "x64-windows"));
+
+ StatusParagraphs status_db(std::move(pghs));
+
+ PackageSpecMap spec_map(Triplet::X64_WINDOWS);
+ auto spec_a = spec_map.emplace("a", "b[core]");
+ auto spec_b = spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b0", "b1"});
+
+ Dependencies::MapPortFileProvider provider(spec_map.map);
+ Dependencies::PackageGraph graph(provider, status_db);
+
+ graph.upgrade(spec_a);
+ graph.upgrade(spec_b);
+ auto plan = graph.serialize();
+
+ // The upgrade should install the new default feature b1 but not b0
+ Assert::AreEqual(size_t(4), plan.size());
+ remove_plan_check(&plan[0], "a", Triplet::X64_WINDOWS);
+ remove_plan_check(&plan[1], "b", Triplet::X64_WINDOWS);
+ features_check(&plan[2], "b", {"core", "b1"}, Triplet::X64_WINDOWS);
+ features_check(&plan[3], "a", {"core"}, Triplet::X64_WINDOWS);
+ }
+
+ TEST_METHOD(upgrade_with_default_features_3)
+ {
+ std::vector<std::unique_ptr<StatusParagraph>> pghs;
+ // note: unrelated package due to x86 triplet
+ pghs.push_back(make_status_pgh("b", "", "", "x86-windows"));
+ pghs.push_back(make_status_pgh("a", "", "", "x64-windows"));
StatusParagraphs status_db(std::move(pghs));
- // Add a port "a" of which "core" and "0" are already installed.
PackageSpecMap spec_map(Triplet::X64_WINDOWS);
auto spec_a = spec_map.emplace("a", "b[core]");
spec_map.emplace("b", "", {{"b0", ""}, {"b1", ""}}, {"b0"});
@@ -724,17 +766,33 @@ namespace UnitTest1
graph.upgrade(spec_a);
auto plan = graph.serialize();
- // The upgrade should not install the default feature
+ // The upgrade should install the default feature
Assert::AreEqual(size_t(3), plan.size());
+ remove_plan_check(&plan[0], "a", Triplet::X64_WINDOWS);
+ features_check(&plan[1], "b", {"b0", "core"}, Triplet::X64_WINDOWS);
+ features_check(&plan[2], "a", {"core"}, Triplet::X64_WINDOWS);
+ }
- Assert::AreEqual("a", plan[0].spec().name().c_str());
- Assert::IsTrue(plan[0].remove_action.has_value());
+ TEST_METHOD(upgrade_with_new_default_feature)
+ {
+ std::vector<std::unique_ptr<StatusParagraph>> pghs;
+ pghs.push_back(make_status_pgh("a", "", "0", "x86-windows"));
- Assert::AreEqual("b", plan[1].spec().name().c_str());
- features_check(&plan[1], "b", {"b0", "core"}, Triplet::X64_WINDOWS);
+ StatusParagraphs status_db(std::move(pghs));
- Assert::AreEqual("a", plan[2].spec().name().c_str());
- features_check(&plan[2], "a", {"core"}, Triplet::X64_WINDOWS);
+ PackageSpecMap spec_map;
+ auto spec_a = spec_map.emplace("a", "", {{"0", ""}, {"1", ""}, {"2", ""}}, {"0", "1"});
+
+ Dependencies::MapPortFileProvider provider(spec_map.map);
+ Dependencies::PackageGraph graph(provider, status_db);
+
+ graph.upgrade(spec_a);
+ auto plan = graph.serialize();
+
+ // The upgrade should install the new default feature but not the old default feature 0
+ Assert::AreEqual(size_t(2), plan.size());
+ remove_plan_check(&plan[0], "a", Triplet::X86_WINDOWS);
+ features_check(&plan[1], "a", {"core", "1"}, Triplet::X86_WINDOWS);
}
TEST_METHOD(transitive_features_test)
@@ -924,7 +982,7 @@ namespace UnitTest1
pghs.push_back(make_status_pgh("a"));
StatusParagraphs status_db(std::move(pghs));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a");
Dependencies::MapPortFileProvider provider(spec_map.map);
@@ -948,7 +1006,7 @@ namespace UnitTest1
pghs.push_back(make_status_pgh("b", "a"));
StatusParagraphs status_db(std::move(pghs));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a");
spec_map.emplace("b", "a");
@@ -980,7 +1038,7 @@ namespace UnitTest1
pghs.push_back(make_status_pgh("b"));
StatusParagraphs status_db(std::move(pghs));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a");
spec_map.emplace("b", "a");
@@ -1004,7 +1062,7 @@ namespace UnitTest1
pghs.push_back(make_status_pgh("a"));
StatusParagraphs status_db(std::move(pghs));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a", "b");
spec_map.emplace("b");
@@ -1031,7 +1089,7 @@ namespace UnitTest1
pghs.push_back(make_status_feature_pgh("a", "a1"));
StatusParagraphs status_db(std::move(pghs));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a", "", {{"a1", ""}});
Dependencies::MapPortFileProvider provider(spec_map.map);
@@ -1057,7 +1115,7 @@ namespace UnitTest1
StatusParagraphs status_db(std::move(pghs));
// a1 was added as a default feature and should be installed in upgrade
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a", "", {{"a1", ""}}, {"a1"});
Dependencies::MapPortFileProvider provider(spec_map.map);
@@ -1083,7 +1141,7 @@ namespace UnitTest1
pghs.push_back(make_status_feature_pgh("a", "a2", "a[a1]"));
StatusParagraphs status_db(std::move(pghs));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a", "", {{"a1", ""}, {"a2", "a[a1]"}});
Dependencies::MapPortFileProvider provider(spec_map.map);
@@ -1112,7 +1170,7 @@ namespace UnitTest1
pghs.push_back(make_status_pgh("a"));
StatusParagraphs status_db(std::move(pghs));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a");
auto plan = Dependencies::create_export_plan({spec_a}, status_db);
@@ -1129,7 +1187,7 @@ namespace UnitTest1
pghs.push_back(make_status_pgh("b", "a"));
StatusParagraphs status_db(std::move(pghs));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a");
auto spec_b = spec_map.emplace("b", "a");
@@ -1150,7 +1208,7 @@ namespace UnitTest1
pghs.push_back(make_status_pgh("b"));
StatusParagraphs status_db(std::move(pghs));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a");
auto spec_b = spec_map.emplace("b", "a");
@@ -1165,7 +1223,7 @@ namespace UnitTest1
{
StatusParagraphs status_db;
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a");
auto plan = Dependencies::create_export_plan({spec_a}, status_db);
@@ -1183,7 +1241,7 @@ namespace UnitTest1
pghs.push_back(make_status_feature_pgh("a", "a1", "b[core]"));
StatusParagraphs status_db(std::move(pghs));
- PackageSpecMap spec_map(Triplet::X86_WINDOWS);
+ PackageSpecMap spec_map;
auto spec_a = spec_map.emplace("a", "", {{"a1", ""}});
auto plan = Dependencies::create_export_plan({spec_a}, status_db);
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp
index a65045aa8..06c99e9a8 100644
--- a/toolsrc/src/vcpkg.cpp
+++ b/toolsrc/src/vcpkg.cpp
@@ -223,6 +223,7 @@ static void load_config()
}
}
+#if defined(_WIN32)
static std::string trim_path_from_command_line(const std::string& full_command_line)
{
Checks::check_exit(
@@ -243,6 +244,7 @@ static std::string trim_path_from_command_line(const std::string& full_command_l
++it;
return std::string(it, full_command_line.cend());
}
+#endif
#if defined(_WIN32)
int wmain(const int argc, const wchar_t* const* const argv)
diff --git a/toolsrc/src/vcpkg/base/chrono.cpp b/toolsrc/src/vcpkg/base/chrono.cpp
index 00f8ba3f1..2a76f5df0 100644
--- a/toolsrc/src/vcpkg/base/chrono.cpp
+++ b/toolsrc/src/vcpkg/base/chrono.cpp
@@ -15,7 +15,7 @@ namespace vcpkg::Chrono
using std::chrono::nanoseconds;
using std::chrono::seconds;
- const double nanos_as_double = static_cast<double>(nanos.count());
+ const auto nanos_as_double = static_cast<double>(nanos.count());
if (duration_cast<hours>(nanos) > hours())
{
@@ -92,7 +92,7 @@ namespace vcpkg::Chrono
Optional<CTime> CTime::parse(CStringView str)
{
CTime ret;
- auto assigned =
+ const auto assigned =
#if defined(_WIN32)
sscanf_s
#else
@@ -117,15 +117,13 @@ namespace vcpkg::Chrono
std::string CTime::to_string() const
{
- std::array<char, 80> date;
- date.fill(0);
-
+ std::array<char, 80> date{};
strftime(&date[0], date.size(), "%Y-%m-%dT%H:%M:%S.0Z", &m_tm);
return &date[0];
}
std::chrono::system_clock::time_point CTime::to_time_point() const
{
- auto t = mktime(&m_tm);
+ const time_t t = mktime(&m_tm);
return std::chrono::system_clock::from_time_t(t);
}
}
diff --git a/toolsrc/src/vcpkg/base/cofffilereader.cpp b/toolsrc/src/vcpkg/base/cofffilereader.cpp
index 96d280108..2c09e2c19 100644
--- a/toolsrc/src/vcpkg/base/cofffilereader.cpp
+++ b/toolsrc/src/vcpkg/base/cofffilereader.cpp
@@ -2,6 +2,7 @@
#include <vcpkg/base/checks.h>
#include <vcpkg/base/cofffilereader.h>
+#include <vcpkg/base/stringliteral.h>
using namespace std;
@@ -43,21 +44,21 @@ namespace vcpkg::CoffFileReader
actual);
}
- static void read_and_verify_PE_signature(fstream& fs)
+ static void read_and_verify_pe_signature(fstream& fs)
{
- static const size_t OFFSET_TO_PE_SIGNATURE_OFFSET = 0x3c;
+ static constexpr size_t OFFSET_TO_PE_SIGNATURE_OFFSET = 0x3c;
- static const char* PE_SIGNATURE = "PE\0\0";
- static const size_t PE_SIGNATURE_SIZE = 4;
+ static constexpr StringLiteral PE_SIGNATURE = "PE\0\0";
+ static constexpr size_t PE_SIGNATURE_SIZE = 4;
fs.seekg(OFFSET_TO_PE_SIGNATURE_OFFSET, ios_base::beg);
- const int32_t offset_to_PE_signature = read_value_from_stream<int32_t>(fs);
+ const auto offset_to_pe_signature = read_value_from_stream<int32_t>(fs);
- fs.seekg(offset_to_PE_signature);
+ fs.seekg(offset_to_pe_signature);
char signature[PE_SIGNATURE_SIZE];
fs.read(signature, PE_SIGNATURE_SIZE);
- verify_equal_strings(VCPKG_LINE_INFO, PE_SIGNATURE, signature, PE_SIGNATURE_SIZE, "PE_SIGNATURE");
- fs.seekg(offset_to_PE_signature + PE_SIGNATURE_SIZE, ios_base::beg);
+ verify_equal_strings(VCPKG_LINE_INFO, PE_SIGNATURE.c_str(), signature, PE_SIGNATURE_SIZE, "PE_SIGNATURE");
+ fs.seekg(offset_to_pe_signature + PE_SIGNATURE_SIZE, ios_base::beg);
}
static fpos_t align_to_size(const uint64_t unaligned, const uint64_t alignment_size)
@@ -71,7 +72,7 @@ namespace vcpkg::CoffFileReader
struct CoffFileHeader
{
- static const size_t HEADER_SIZE = 20;
+ static constexpr size_t HEADER_SIZE = 20;
static CoffFileHeader read(fstream& fs)
{
@@ -83,11 +84,11 @@ namespace vcpkg::CoffFileReader
MachineType machine_type() const
{
- static const size_t MACHINE_TYPE_OFFSET = 0;
- static const size_t MACHINE_TYPE_SIZE = 2;
+ static constexpr size_t MACHINE_TYPE_OFFSET = 0;
+ static constexpr size_t MACHINE_TYPE_SIZE = 2;
std::string machine_field_as_string = data.substr(MACHINE_TYPE_OFFSET, MACHINE_TYPE_SIZE);
- const uint16_t machine = reinterpret_bytes<uint16_t>(machine_field_as_string.c_str());
+ const auto machine = reinterpret_bytes<uint16_t>(machine_field_as_string.c_str());
return to_machine_type(machine);
}
@@ -97,13 +98,13 @@ namespace vcpkg::CoffFileReader
struct ArchiveMemberHeader
{
- static const size_t HEADER_SIZE = 60;
+ static constexpr size_t HEADER_SIZE = 60;
static ArchiveMemberHeader read(fstream& fs)
{
- static const size_t HEADER_END_OFFSET = 58;
- static const char* HEADER_END = "`\n";
- static const size_t HEADER_END_SIZE = 2;
+ static constexpr size_t HEADER_END_OFFSET = 58;
+ static constexpr StringLiteral HEADER_END = "`\n";
+ static constexpr size_t HEADER_END_SIZE = 2;
ArchiveMemberHeader ret;
ret.data.resize(HEADER_SIZE);
@@ -113,7 +114,7 @@ namespace vcpkg::CoffFileReader
{
const std::string header_end = ret.data.substr(HEADER_END_OFFSET, HEADER_END_SIZE);
verify_equal_strings(
- VCPKG_LINE_INFO, HEADER_END, header_end.c_str(), HEADER_END_SIZE, "LIB HEADER_END");
+ VCPKG_LINE_INFO, HEADER_END.c_str(), header_end.c_str(), HEADER_END_SIZE, "LIB HEADER_END");
}
return ret;
@@ -121,17 +122,17 @@ namespace vcpkg::CoffFileReader
std::string name() const
{
- static const size_t HEADER_NAME_OFFSET = 0;
- static const size_t HEADER_NAME_SIZE = 16;
+ static constexpr size_t HEADER_NAME_OFFSET = 0;
+ static constexpr size_t HEADER_NAME_SIZE = 16;
return data.substr(HEADER_NAME_OFFSET, HEADER_NAME_SIZE);
}
uint64_t member_size() const
{
- static const size_t ALIGNMENT_SIZE = 2;
+ static constexpr size_t ALIGNMENT_SIZE = 2;
- static const size_t HEADER_SIZE_OFFSET = 48;
- static const size_t HEADER_SIZE_FIELD_SIZE = 10;
+ static constexpr size_t HEADER_SIZE_OFFSET = 48;
+ static constexpr size_t HEADER_SIZE_FIELD_SIZE = 10;
const std::string as_string = data.substr(HEADER_SIZE_OFFSET, HEADER_SIZE_FIELD_SIZE);
// This is in ASCII decimal representation
const uint64_t value = std::strtoull(as_string.c_str(), nullptr, 10);
@@ -147,18 +148,19 @@ namespace vcpkg::CoffFileReader
{
static OffsetsArray read(fstream& fs, const uint32_t offset_count)
{
- static const size_t OFFSET_WIDTH = 4;
+ static constexpr uint32_t OFFSET_WIDTH = 4;
std::string raw_offsets;
- const size_t raw_offset_size = offset_count * OFFSET_WIDTH;
+ const uint32_t raw_offset_size = offset_count * OFFSET_WIDTH;
raw_offsets.resize(raw_offset_size);
fs.read(&raw_offsets[0], raw_offset_size);
OffsetsArray ret;
for (uint32_t i = 0; i < offset_count; ++i)
{
- const std::string value_as_string = raw_offsets.substr(OFFSET_WIDTH * i, OFFSET_WIDTH * (i + 1));
- const uint32_t value = reinterpret_bytes<uint32_t>(value_as_string.c_str());
+ const std::string value_as_string = raw_offsets.substr(OFFSET_WIDTH * static_cast<size_t>(i),
+ OFFSET_WIDTH * (static_cast<size_t>(i) + 1));
+ const auto value = reinterpret_bytes<uint32_t>(value_as_string.c_str());
// Ignore offsets that point to offset 0. See vcpkg github #223 #288 #292
if (value != 0)
@@ -177,28 +179,28 @@ namespace vcpkg::CoffFileReader
struct ImportHeader
{
- static const size_t HEADER_SIZE = 20;
+ static constexpr size_t HEADER_SIZE = 20;
static ImportHeader read(fstream& fs)
{
- static const size_t SIG1_OFFSET = 0;
- static const uint16_t SIG1 = static_cast<uint16_t>(MachineType::UNKNOWN);
- static const size_t SIG1_SIZE = 2;
+ static constexpr size_t SIG1_OFFSET = 0;
+ static constexpr auto SIG1 = static_cast<uint16_t>(MachineType::UNKNOWN);
+ static constexpr size_t SIG1_SIZE = 2;
- static const size_t SIG2_OFFSET = 2;
- static const uint16_t SIG2 = 0xFFFF;
- static const size_t SIG2_SIZE = 2;
+ static constexpr size_t SIG2_OFFSET = 2;
+ static constexpr uint16_t SIG2 = 0xFFFF;
+ static constexpr size_t SIG2_SIZE = 2;
ImportHeader ret;
ret.data.resize(HEADER_SIZE);
fs.read(&ret.data[0], HEADER_SIZE);
const std::string sig1_as_string = ret.data.substr(SIG1_OFFSET, SIG1_SIZE);
- const uint16_t sig1 = reinterpret_bytes<uint16_t>(sig1_as_string.c_str());
+ const auto sig1 = reinterpret_bytes<uint16_t>(sig1_as_string.c_str());
Checks::check_exit(VCPKG_LINE_INFO, sig1 == SIG1, "Sig1 was incorrect. Expected %s but got %s", SIG1, sig1);
const std::string sig2_as_string = ret.data.substr(SIG2_OFFSET, SIG2_SIZE);
- const uint16_t sig2 = reinterpret_bytes<uint16_t>(sig2_as_string.c_str());
+ const auto sig2 = reinterpret_bytes<uint16_t>(sig2_as_string.c_str());
Checks::check_exit(VCPKG_LINE_INFO, sig2 == SIG2, "Sig2 was incorrect. Expected %s but got %s", SIG2, sig2);
return ret;
@@ -206,11 +208,11 @@ namespace vcpkg::CoffFileReader
MachineType machine_type() const
{
- static const size_t MACHINE_TYPE_OFFSET = 6;
- static const size_t MACHINE_TYPE_SIZE = 2;
+ static constexpr size_t MACHINE_TYPE_OFFSET = 6;
+ static constexpr size_t MACHINE_TYPE_SIZE = 2;
std::string machine_field_as_string = data.substr(MACHINE_TYPE_OFFSET, MACHINE_TYPE_SIZE);
- const uint16_t machine = reinterpret_bytes<uint16_t>(machine_field_as_string.c_str());
+ const auto machine = reinterpret_bytes<uint16_t>(machine_field_as_string.c_str());
return to_machine_type(machine);
}
@@ -220,14 +222,14 @@ namespace vcpkg::CoffFileReader
static void read_and_verify_archive_file_signature(fstream& fs)
{
- static const char* FILE_START = "!<arch>\n";
- static const size_t FILE_START_SIZE = 8;
+ static constexpr StringLiteral FILE_START = "!<arch>\n";
+ static constexpr size_t FILE_START_SIZE = 8;
- fs.seekg(fs.beg);
+ fs.seekg(std::fstream::beg);
char file_start[FILE_START_SIZE];
fs.read(file_start, FILE_START_SIZE);
- verify_equal_strings(VCPKG_LINE_INFO, FILE_START, file_start, FILE_START_SIZE, "LIB FILE_START");
+ verify_equal_strings(VCPKG_LINE_INFO, FILE_START.c_str(), file_start, FILE_START_SIZE, "LIB FILE_START");
}
DllInfo read_dll(const fs::path& path)
@@ -235,7 +237,7 @@ namespace vcpkg::CoffFileReader
std::fstream fs(path, std::ios::in | std::ios::binary | std::ios::ate);
Checks::check_exit(VCPKG_LINE_INFO, fs.is_open(), "Could not open file %s for reading", path.generic_string());
- read_and_verify_PE_signature(fs);
+ read_and_verify_pe_signature(fs);
CoffFileHeader header = CoffFileHeader::read(fs);
const MachineType machine = header.machine_type();
return {machine};
@@ -245,7 +247,7 @@ namespace vcpkg::CoffFileReader
{
void set_to_offset(const fpos_t position) { this->m_absolute_position = position; }
- void set_to_current_pos(fstream& fs) { this->m_absolute_position = fs.tellg().seekpos(); }
+ void set_to_current_pos(fstream& fs) { this->m_absolute_position = fs.tellg(); }
void seek_to_marker(fstream& fs) const { fs.seekg(this->m_absolute_position, ios_base::beg); }
@@ -278,13 +280,13 @@ namespace vcpkg::CoffFileReader
second_linker_member_header.name().substr(0, 2) == "/ ",
"Could not find proper second linker member");
// The first 4 bytes contains the number of archive members
- const uint32_t archive_member_count = read_value_from_stream<uint32_t>(fs);
+ const auto archive_member_count = read_value_from_stream<uint32_t>(fs);
const OffsetsArray offsets = OffsetsArray::read(fs, archive_member_count);
marker.advance_by(ArchiveMemberHeader::HEADER_SIZE + second_linker_member_header.member_size());
marker.seek_to_marker(fs);
- const bool hasLongnameMemberHeader = peek_value_from_stream<uint16_t>(fs) == 0x2F2F;
- if (hasLongnameMemberHeader)
+ const bool has_longname_member_header = peek_value_from_stream<uint16_t>(fs) == 0x2F2F;
+ if (has_longname_member_header)
{
const ArchiveMemberHeader longnames_member_header = ArchiveMemberHeader::read(fs);
marker.advance_by(ArchiveMemberHeader::HEADER_SIZE + longnames_member_header.member_size());
@@ -297,10 +299,10 @@ namespace vcpkg::CoffFileReader
{
marker.set_to_offset(offset + ArchiveMemberHeader::HEADER_SIZE); // Skip the header, no need to read it.
marker.seek_to_marker(fs);
- const uint16_t first_two_bytes = peek_value_from_stream<uint16_t>(fs);
- const bool isImportHeader = to_machine_type(first_two_bytes) == MachineType::UNKNOWN;
+ const auto first_two_bytes = peek_value_from_stream<uint16_t>(fs);
+ const bool is_import_header = to_machine_type(first_two_bytes) == MachineType::UNKNOWN;
const MachineType machine =
- isImportHeader ? ImportHeader::read(fs).machine_type() : CoffFileHeader::read(fs).machine_type();
+ is_import_header ? ImportHeader::read(fs).machine_type() : CoffFileHeader::read(fs).machine_type();
machine_types.insert(machine);
}
diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp
index 4e61666b7..1723b467e 100644
--- a/toolsrc/src/vcpkg/base/files.cpp
+++ b/toolsrc/src/vcpkg/base/files.cpp
@@ -22,9 +22,9 @@ namespace vcpkg::Files
auto length = file_stream.tellg();
file_stream.seekg(0, file_stream.beg);
- if (length > SIZE_MAX)
+ if (length == std::streampos(-1))
{
- return std::make_error_code(std::errc::file_too_large);
+ return std::make_error_code(std::errc::io_error);
}
std::string output;
@@ -185,12 +185,15 @@ namespace vcpkg::Files
return;
}
- auto count = fwrite(data.data(), sizeof(data[0]), data.size(), f);
- fclose(f);
-
- if (count != data.size())
+ if (f != nullptr)
{
- ec = std::make_error_code(std::errc::no_space_on_device);
+ auto count = fwrite(data.data(), sizeof(data[0]), data.size(), f);
+ fclose(f);
+
+ if (count != data.size())
+ {
+ ec = std::make_error_code(std::errc::no_space_on_device);
+ }
}
}
};
diff --git a/toolsrc/src/vcpkg/base/strings.cpp b/toolsrc/src/vcpkg/base/strings.cpp
index 5fedf3e1f..fbc33ca42 100644
--- a/toolsrc/src/vcpkg/base/strings.cpp
+++ b/toolsrc/src/vcpkg/base/strings.cpp
@@ -7,7 +7,7 @@
namespace vcpkg::Strings::details
{
// To disambiguate between two overloads
- static bool IS_SPACE(const char c) { return std::isspace(c) != 0; };
+ static bool is_space(const char c) { return std::isspace(c) != 0; }
// Avoids C4244 warnings because of char<->int conversion that occur when using std::tolower()
static char tolower_char(const char c) { return static_cast<char>(std::tolower(c)); }
@@ -39,7 +39,7 @@ namespace vcpkg::Strings::details
_vsnprintf_s_l(&output.at(0), output.size() + 1, output.size(), fmtstr, c_locale(), args);
#else
va_start(args, fmtstr);
- auto res = vsnprintf(&output.at(0), output.size() + 1, fmtstr, args);
+ vsnprintf(&output.at(0), output.size() + 1, fmtstr, args);
#endif
va_end(args);
@@ -52,23 +52,25 @@ namespace vcpkg::Strings
std::wstring to_utf16(const CStringView& s)
{
#if defined(_WIN32)
- const int size = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, nullptr, 0);
std::wstring output;
+ const size_t size = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, nullptr, 0);
+ if (size == 0) return output;
output.resize(size - 1);
- MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, output.data(), size - 1);
+ MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, output.data(), static_cast<int>(size) - 1);
return output;
#else
Checks::unreachable(VCPKG_LINE_INFO);
#endif
}
- std::string to_utf8(const CWStringView& w)
+ std::string to_utf8(const wchar_t* w)
{
#if defined(_WIN32)
- const int size = WideCharToMultiByte(CP_UTF8, 0, w.c_str(), -1, nullptr, 0, nullptr, nullptr);
std::string output;
+ const size_t size = WideCharToMultiByte(CP_UTF8, 0, w, -1, nullptr, 0, nullptr, nullptr);
+ if (size == 0) return output;
output.resize(size - 1);
- WideCharToMultiByte(CP_UTF8, 0, w.c_str(), -1, output.data(), size - 1, nullptr, nullptr);
+ WideCharToMultiByte(CP_UTF8, 0, w, -1, output.data(), static_cast<int>(size) - 1, nullptr, nullptr);
return output;
#else
Checks::unreachable(VCPKG_LINE_INFO);
@@ -143,8 +145,8 @@ namespace vcpkg::Strings
std::string trim(std::string&& s)
{
- s.erase(std::find_if_not(s.rbegin(), s.rend(), details::IS_SPACE).base(), s.end());
- s.erase(s.begin(), std::find_if_not(s.begin(), s.end(), details::IS_SPACE));
+ s.erase(std::find_if_not(s.rbegin(), s.rend(), details::is_space).base(), s.end());
+ s.erase(s.begin(), std::find_if_not(s.begin(), s.end(), details::is_space));
return std::move(s);
}
diff --git a/toolsrc/src/vcpkg/base/system.cpp b/toolsrc/src/vcpkg/base/system.cpp
index 171dd2bbf..d4210fe6d 100644
--- a/toolsrc/src/vcpkg/base/system.cpp
+++ b/toolsrc/src/vcpkg/base/system.cpp
@@ -5,7 +5,7 @@
#include <vcpkg/globalstate.h>
#include <vcpkg/metrics.h>
-#include <time.h>
+#include <ctime>
#if defined(__APPLE__)
#include <mach-o/dyld.h>
@@ -23,7 +23,7 @@ namespace vcpkg::System
{
using std::chrono::system_clock;
std::time_t now_time = system_clock::to_time_t(system_clock::now());
- tm parts;
+ tm parts{};
#if defined(_WIN32)
localtime_s(&parts, &now_time);
#else
@@ -158,7 +158,7 @@ namespace vcpkg::System
#if defined(_WIN32)
static const std::string SYSTEM_ROOT = get_environment_variable("SystemRoot").value_or_exit(VCPKG_LINE_INFO);
static const std::string SYSTEM_32 = SYSTEM_ROOT + R"(\system32)";
- std::string NEW_PATH = Strings::format(
+ std::string new_path = Strings::format(
R"(Path=%s;%s;%s\Wbem;%s\WindowsPowerShell\v1.0\)", SYSTEM_32, SYSTEM_ROOT, SYSTEM_32, SYSTEM_32);
std::vector<std::wstring> env_wstrings = {
@@ -214,7 +214,7 @@ namespace vcpkg::System
for (auto&& env_wstring : env_wstrings)
{
- const Optional<std::string> value = System::get_environment_variable(Strings::to_utf8(env_wstring));
+ const Optional<std::string> value = System::get_environment_variable(Strings::to_utf8(env_wstring.c_str()));
const auto v = value.get();
if (!v || v->empty()) continue;
@@ -225,13 +225,13 @@ namespace vcpkg::System
}
if (extra_env.find("PATH") != extra_env.end())
- NEW_PATH += Strings::format(";%s", extra_env.find("PATH")->second);
- env_cstr.append(Strings::to_utf16(NEW_PATH));
+ new_path += Strings::format(";%s", extra_env.find("PATH")->second);
+ env_cstr.append(Strings::to_utf16(new_path));
env_cstr.push_back(L'\0');
env_cstr.append(L"VSLANG=1033");
env_cstr.push_back(L'\0');
- for (auto item : extra_env)
+ for (const auto& item : extra_env)
{
if (item.first == "PATH") continue;
env_cstr.append(Strings::to_utf16(item.first));
@@ -298,17 +298,6 @@ namespace vcpkg::System
return exit_code;
}
- // On Win7, output from powershell calls contain a byte order mark, so we strip it out if it is present
- static void remove_byte_order_marks(std::wstring* s)
- {
- const wchar_t* a = s->c_str();
- // This is the UTF-8 byte-order mark
- while (s->size() >= 3 && a[0] == 0xEF && a[1] == 0xBB && a[2] == 0xBF)
- {
- s->erase(0, 3);
- }
- }
-
ExitCodeAndOutput cmd_execute_and_capture_output(const CStringView cmd_line)
{
// Flush stdout before launching external process
@@ -325,7 +314,7 @@ namespace vcpkg::System
const auto pipe = _wpopen(Strings::to_utf16(actual_cmd_line).c_str(), L"r");
if (pipe == nullptr)
{
- return {1, Strings::to_utf8(output)};
+ return {1, Strings::to_utf8(output.c_str())};
}
while (fgetws(buf, 1024, pipe))
{
@@ -333,15 +322,22 @@ namespace vcpkg::System
}
if (!feof(pipe))
{
- return {1, Strings::to_utf8(output)};
+ return {1, Strings::to_utf8(output.c_str())};
}
const auto ec = _pclose(pipe);
- remove_byte_order_marks(&output);
- Debug::println("_pclose() returned %d after %8d us", ec, (int)timer.microseconds());
+ // On Win7, output from powershell calls contain a utf-8 byte order mark in the utf-16 stream, so we strip it
+ // out if it is present. 0xEF,0xBB,0xBF is the UTF-8 byte-order mark
+ const wchar_t* a = output.c_str();
+ while (output.size() >= 3 && a[0] == 0xEF && a[1] == 0xBB && a[2] == 0xBF)
+ {
+ output.erase(0, 3);
+ }
+
+ Debug::println("_pclose() returned %d after %8d us", ec, static_cast<int>(timer.microseconds()));
- return {ec, Strings::to_utf8(output)};
+ return {ec, Strings::to_utf8(output.c_str())};
#else
const auto actual_cmd_line = Strings::format(R"###(%s 2>&1)###", cmd_line);
@@ -481,7 +477,7 @@ namespace vcpkg::System
const auto sz2 = GetEnvironmentVariableW(w_varname.c_str(), ret.data(), static_cast<DWORD>(ret.size()));
Checks::check_exit(VCPKG_LINE_INFO, sz2 + 1 == sz);
ret.pop_back();
- return Strings::to_utf8(ret);
+ return Strings::to_utf8(ret.c_str());
#else
auto v = getenv(varname.c_str());
if (!v) return nullopt;
@@ -522,7 +518,7 @@ namespace vcpkg::System
return nullopt;
ret.pop_back(); // remove extra trailing null byte
- return Strings::to_utf8(ret);
+ return Strings::to_utf8(ret.c_str());
}
#else
Optional<std::string> get_registry_string(void* base_hkey, const CStringView sub_key, const CStringView valuename)
diff --git a/toolsrc/src/vcpkg/binaryparagraph.cpp b/toolsrc/src/vcpkg/binaryparagraph.cpp
index 7a8b0d577..126c7df97 100644
--- a/toolsrc/src/vcpkg/binaryparagraph.cpp
+++ b/toolsrc/src/vcpkg/binaryparagraph.cpp
@@ -24,7 +24,7 @@ namespace vcpkg
static const std::string DEFAULTFEATURES = "Default-Features";
}
- BinaryParagraph::BinaryParagraph() = default;
+ BinaryParagraph::BinaryParagraph() noexcept = default;
BinaryParagraph::BinaryParagraph(std::unordered_map<std::string, std::string> fields)
{
@@ -79,7 +79,7 @@ namespace vcpkg
}
BinaryParagraph::BinaryParagraph(const SourceParagraph& spgh, const FeatureParagraph& fpgh, const Triplet& triplet)
- : version(), feature(fpgh.name), description(fpgh.description), maintainer()
+ : version(), description(fpgh.description), maintainer(), feature(fpgh.name)
{
this->spec = PackageSpec::from_name_and_triplet(spgh.name, triplet).value_or_exit(VCPKG_LINE_INFO);
this->depends = filter_dependencies(fpgh.depends, triplet);
diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp
index 79a55bd36..7a9d35667 100644
--- a/toolsrc/src/vcpkg/build.cpp
+++ b/toolsrc/src/vcpkg/build.cpp
@@ -64,7 +64,8 @@ namespace vcpkg::Build::Command
const Build::BuildPackageOptions build_package_options{Build::UseHeadVersion::NO,
Build::AllowDownloads::YES,
Build::CleanBuildtrees::NO,
- Build::CleanPackages::NO};
+ Build::CleanPackages::NO,
+ Build::DownloadTool::BUILT_IN};
std::set<std::string> features_as_set(full_spec.features.begin(), full_spec.features.end());
features_as_set.emplace("core");
@@ -210,7 +211,7 @@ namespace vcpkg::Build
for (auto&& host : host_architectures)
{
- auto it = Util::find_if(toolset.supported_architectures, [&](const ToolsetArchOption& opt) {
+ const auto it = Util::find_if(toolset.supported_architectures, [&](const ToolsetArchOption& opt) {
return host == opt.host_arch && target_arch == opt.target_arch;
});
if (it != toolset.supported_architectures.end()) return it->name;
@@ -279,7 +280,7 @@ namespace vcpkg::Build
{
const Triplet& triplet = config.triplet;
- auto dep_strings =
+ const std::vector<std::string> dep_strings =
Util::fmap_flatten(config.feature_list, [&](std::string const& feature) -> std::vector<std::string> {
if (feature == "core")
{
@@ -302,7 +303,7 @@ namespace vcpkg::Build
if (fspec.feature().empty())
{
// reference to default features
- auto it = status_db.find_installed(fspec.spec());
+ const auto it = status_db.find_installed(fspec.spec());
if (it == status_db.end())
{
// not currently installed, so just leave the default reference so it will fail later
@@ -310,9 +311,9 @@ namespace vcpkg::Build
}
else
{
- ret.push_back(FeatureSpec{fspec.spec(), "core"});
+ ret.emplace_back(fspec.spec(), "core");
for (auto&& default_feature : it->get()->package.default_features)
- ret.push_back(FeatureSpec{fspec.spec(), default_feature});
+ ret.emplace_back(fspec.spec(), default_feature);
}
}
else
@@ -329,8 +330,7 @@ namespace vcpkg::Build
const PreBuildInfo& pre_build_info,
const PackageSpec& spec,
const std::string& abi_tag,
- const BuildPackageConfig& config,
- const StatusParagraphs& status_db)
+ const BuildPackageConfig& config)
{
auto& fs = paths.get_filesystem();
const Triplet& triplet = spec.triplet();
@@ -338,11 +338,11 @@ namespace vcpkg::Build
#if !defined(_WIN32)
// TODO: remove when vcpkg.exe is in charge for acquiring tools. Change introduced in vcpkg v0.0.107.
// bootstrap should have already downloaded ninja, but making sure it is present in case it was deleted.
- vcpkg::Util::unused(paths.get_ninja_exe());
+ vcpkg::Util::unused(paths.get_tool_exe(Tools::NINJA));
#endif
- const fs::path& cmake_exe_path = paths.get_cmake_exe();
- const fs::path& git_exe_path = paths.get_git_exe();
+ const fs::path& cmake_exe_path = paths.get_tool_exe(Tools::CMAKE);
+ const fs::path& git_exe_path = paths.get_tool_exe(Tools::GIT);
std::string all_features;
for (auto& feature : config.scf.feature_paragraphs)
@@ -361,9 +361,8 @@ namespace vcpkg::Build
{"TARGET_TRIPLET", spec.triplet().canonical_name()},
{"VCPKG_PLATFORM_TOOLSET", toolset.version.c_str()},
{"VCPKG_USE_HEAD_VERSION",
- Util::Enum::to_bool(config.build_package_options.use_head_version) ? "1" : "0"},
- {"_VCPKG_NO_DOWNLOADS",
- !Util::Enum::to_bool(config.build_package_options.allow_downloads) ? "1" : "0"},
+ Util::Enum::to_bool(config.build_package_options.use_head_version) ? "1" : "0"},
+ {"_VCPKG_NO_DOWNLOADS", !Util::Enum::to_bool(config.build_package_options.allow_downloads) ? "1" : "0"},
{"_VCPKG_DOWNLOAD_TOOL", to_string(config.build_package_options.download_tool)},
{"GIT", git_exe_path},
{"FEATURES", Strings::join(";", config.feature_list)},
@@ -419,10 +418,9 @@ namespace vcpkg::Build
const PreBuildInfo& pre_build_info,
const PackageSpec& spec,
const std::string& abi_tag,
- const BuildPackageConfig& config,
- const StatusParagraphs& status_db)
+ const BuildPackageConfig& config)
{
- auto result = do_build_package(paths, pre_build_info, spec, abi_tag, config, status_db);
+ auto result = do_build_package(paths, pre_build_info, spec, abi_tag, config);
if (config.build_package_options.clean_buildtrees == CleanBuildtrees::YES)
{
@@ -464,7 +462,7 @@ namespace vcpkg::Build
abi_tag_entries.emplace_back(AbiEntry{"triplet", pre_build_info.triplet_abi_tag});
- std::string features = Strings::join(";", config.feature_list);
+ const std::string features = Strings::join(";", config.feature_list);
abi_tag_entries.emplace_back(AbiEntry{"features", features});
if (config.build_package_options.use_head_version == UseHeadVersion::YES)
@@ -472,7 +470,7 @@ namespace vcpkg::Build
Util::sort(abi_tag_entries);
- std::string full_abi_info =
+ const std::string full_abi_info =
Strings::join("", abi_tag_entries, [](const AbiEntry& p) { return p.key + " " + p.value + "\n"; });
if (GlobalState::debugging)
@@ -492,19 +490,17 @@ namespace vcpkg::Build
{
std::error_code ec;
fs.create_directories(paths.buildtrees / name, ec);
- auto abi_file_path = paths.buildtrees / name / (triplet.canonical_name() + ".vcpkg_abi_info.txt");
+ const auto abi_file_path = paths.buildtrees / name / (triplet.canonical_name() + ".vcpkg_abi_info.txt");
fs.write_contents(abi_file_path, full_abi_info);
return AbiTagAndFile{Commands::Hash::get_file_hash(paths, abi_file_path, "SHA1"), abi_file_path};
}
- else
- {
- System::println(
- "Warning: binary caching disabled because abi keys are missing values:\n%s",
- Strings::join("", abi_tag_entries_missing, [](const AbiEntry& e) { return " " + e.key + "\n"; }));
- return nullopt;
- }
+ System::println(
+ "Warning: binary caching disabled because abi keys are missing values:\n%s",
+ Strings::join("", abi_tag_entries_missing, [](const AbiEntry& e) { return " " + e.key + "\n"; }));
+
+ return nullopt;
}
static void decompress_archive(const VcpkgPaths& paths, const PackageSpec& spec, const fs::path& archive_path)
@@ -519,10 +515,10 @@ namespace vcpkg::Build
Checks::check_exit(VCPKG_LINE_INFO, files.empty(), "unable to clear path: %s", pkg_path.u8string());
#if defined(_WIN32)
- auto&& _7za = paths.get_7za_exe();
+ auto&& seven_zip_exe = paths.get_tool_exe(Tools::SEVEN_ZIP);
System::cmd_execute_clean(Strings::format(
- R"("%s" x "%s" -o"%s" -y >nul)", _7za.u8string(), archive_path.u8string(), pkg_path.u8string()));
+ R"("%s" x "%s" -o"%s" -y >nul)", seven_zip_exe.u8string(), archive_path.u8string(), pkg_path.u8string()));
#else
System::cmd_execute_clean(Strings::format(
R"(unzip -qq "%s" "-d%s")", archive_path.u8string(), pkg_path.u8string()));
@@ -539,11 +535,11 @@ namespace vcpkg::Build
Checks::check_exit(
VCPKG_LINE_INFO, !fs.exists(tmp_archive_path), "Could not remove file: %s", tmp_archive_path.u8string());
#if defined(_WIN32)
- auto&& _7za = paths.get_7za_exe();
+ auto&& seven_zip_exe = paths.get_tool_exe(Tools::SEVEN_ZIP);
System::cmd_execute_clean(Strings::format(
R"("%s" a "%s" "%s\*" >nul)",
- _7za.u8string(),
+ seven_zip_exe.u8string(),
tmp_archive_path.u8string(),
paths.package_dir(spec).u8string()));
#else
@@ -566,7 +562,7 @@ namespace vcpkg::Build
auto dep_pspecs = Util::fmap(required_fspecs, [](FeatureSpec const& fspec) { return fspec.spec(); });
Util::sort_unique_erase(dep_pspecs);
- // Find all features that aren't installed. This destroys required_fspecs.
+ // Find all features that aren't installed. This mutates required_fspecs.
Util::unstable_keep_if(required_fspecs, [&](FeatureSpec const& fspec) {
return !status_db.is_installed(fspec) && fspec.name() != name;
});
@@ -585,7 +581,7 @@ namespace vcpkg::Build
for (auto&& pspec : dep_pspecs)
{
if (pspec == spec) continue;
- auto status_it = status_db.find_installed(pspec);
+ const auto status_it = status_db.find_installed(pspec);
Checks::check_exit(VCPKG_LINE_INFO, status_it != status_db.end());
dependency_abis.emplace_back(
AbiEntry{status_it->get()->package.spec.name(), status_it->get()->package.abi});
@@ -595,17 +591,15 @@ namespace vcpkg::Build
auto maybe_abi_tag_and_file = compute_abi_tag(paths, config, pre_build_info, dependency_abis);
- std::unique_ptr<BinaryControlFile> bcf;
-
- auto abi_tag_and_file = maybe_abi_tag_and_file.get();
+ const auto abi_tag_and_file = maybe_abi_tag_and_file.get();
if (GlobalState::g_binary_caching && abi_tag_and_file)
{
- auto archives_root_dir = paths.root / "archives";
- auto archive_name = abi_tag_and_file->tag + ".zip";
- auto archive_subpath = fs::u8path(abi_tag_and_file->tag.substr(0, 2)) / archive_name;
- auto archive_path = archives_root_dir / archive_subpath;
- auto archive_tombstone_path = archives_root_dir / "fail" / archive_subpath;
+ const fs::path archives_root_dir = paths.root / "archives";
+ const std::string archive_name = abi_tag_and_file->tag + ".zip";
+ const fs::path archive_subpath = fs::u8path(abi_tag_and_file->tag.substr(0, 2)) / archive_name;
+ const fs::path archive_path = archives_root_dir / archive_subpath;
+ const fs::path archive_tombstone_path = archives_root_dir / "fail" / archive_subpath;
if (fs.exists(archive_path))
{
@@ -614,10 +608,12 @@ namespace vcpkg::Build
decompress_archive(paths, spec, archive_path);
auto maybe_bcf = Paragraphs::try_load_cached_package(paths, spec);
- bcf = std::make_unique<BinaryControlFile>(std::move(maybe_bcf).value_or_exit(VCPKG_LINE_INFO));
+ std::unique_ptr<BinaryControlFile> bcf =
+ std::make_unique<BinaryControlFile>(std::move(maybe_bcf).value_or_exit(VCPKG_LINE_INFO));
return {BuildResult::SUCCEEDED, std::move(bcf)};
}
- else if (fs.exists(archive_tombstone_path))
+
+ if (fs.exists(archive_tombstone_path))
{
System::println("Found failure tombstone: %s", archive_tombstone_path.u8string());
return BuildResult::BUILD_FAILED;
@@ -626,7 +622,7 @@ namespace vcpkg::Build
System::println("Could not locate cached archive: %s", archive_path.u8string());
ExtendedBuildResult result = do_build_package_and_clean_buildtrees(
- paths, pre_build_info, spec, maybe_abi_tag_and_file.value_or(AbiTagAndFile{}).tag, config, status_db);
+ paths, pre_build_info, spec, maybe_abi_tag_and_file.value_or(AbiTagAndFile{}).tag, config);
std::error_code ec;
fs.create_directories(paths.package_dir(spec) / "share" / spec.name(), ec);
@@ -636,7 +632,7 @@ namespace vcpkg::Build
if (result.code == BuildResult::SUCCEEDED)
{
- auto tmp_archive_path = paths.buildtrees / spec.name() / (spec.triplet().to_string() + ".zip");
+ const auto tmp_archive_path = paths.buildtrees / spec.name() / (spec.triplet().to_string() + ".zip");
compress_archive(paths, spec, tmp_archive_path);
@@ -657,11 +653,9 @@ namespace vcpkg::Build
return result;
}
- else
- {
- return do_build_package_and_clean_buildtrees(
- paths, pre_build_info, spec, maybe_abi_tag_and_file.value_or(AbiTagAndFile{}).tag, config, status_db);
- }
+
+ return do_build_package_and_clean_buildtrees(
+ paths, pre_build_info, spec, maybe_abi_tag_and_file.value_or(AbiTagAndFile{}).tag, config);
}
const std::string& to_string(const BuildResult build_result)
@@ -771,11 +765,11 @@ namespace vcpkg::Build
{
static constexpr CStringView FLAG_GUID = "c35112b6-d1ba-415b-aa5d-81de856ef8eb";
- const fs::path& cmake_exe_path = paths.get_cmake_exe();
+ const fs::path& cmake_exe_path = paths.get_tool_exe(Tools::CMAKE);
const fs::path ports_cmake_script_path = paths.scripts / "get_triplet_environment.cmake";
const fs::path triplet_file_path = paths.triplets / (triplet.canonical_name() + ".cmake");
- auto triplet_abi_tag = [&]() {
+ const std::string triplet_abi_tag = [&]() {
static std::map<fs::path, std::string> s_hash_cache;
if (GlobalState::g_binary_caching)
diff --git a/toolsrc/src/vcpkg/commands.cache.cpp b/toolsrc/src/vcpkg/commands.cache.cpp
index 85bf5fb4d..a9d8ba03c 100644
--- a/toolsrc/src/vcpkg/commands.cache.cpp
+++ b/toolsrc/src/vcpkg/commands.cache.cpp
@@ -38,7 +38,7 @@ namespace vcpkg::Commands::Cache
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
- args.parse_arguments(COMMAND_STRUCTURE);
+ Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
const std::vector<BinaryParagraph> binary_paragraphs = read_all_binary_paragraphs(paths);
if (binary_paragraphs.empty())
diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp
index 45eb1c83e..04b42ea00 100644
--- a/toolsrc/src/vcpkg/commands.ci.cpp
+++ b/toolsrc/src/vcpkg/commands.ci.cpp
@@ -77,11 +77,8 @@ namespace vcpkg::Commands::CI
{
auto triplet = p->spec.triplet();
- const Build::BuildPackageConfig build_config{p->source_control_file.value_or_exit(VCPKG_LINE_INFO),
- triplet,
- paths.port_dir(p->spec),
- install_plan_options,
- p->feature_list};
+ const Build::BuildPackageConfig build_config{
+ *scf, triplet, paths.port_dir(p->spec), install_plan_options, p->feature_list};
auto dependency_abis =
Util::fmap(p->computed_dependencies, [&](const PackageSpec& spec) -> Build::AbiEntry {
diff --git a/toolsrc/src/vcpkg/commands.contact.cpp b/toolsrc/src/vcpkg/commands.contact.cpp
index ffed07557..9f86a67dc 100644
--- a/toolsrc/src/vcpkg/commands.contact.cpp
+++ b/toolsrc/src/vcpkg/commands.contact.cpp
@@ -14,24 +14,28 @@ namespace vcpkg::Commands::Contact
return S_EMAIL;
}
- static const CommandSwitch switches[] = {{"--survey", "Launch default browser to the current vcpkg survey"}};
+ static constexpr StringLiteral OPTION_SURVEY = "--survey";
+
+ static constexpr std::array<CommandSwitch, 1> SWITCHES = {{
+ {OPTION_SURVEY, "Launch default browser to the current vcpkg survey"},
+ }};
const CommandStructure COMMAND_STRUCTURE = {
Help::create_example_string("contact"),
0,
0,
- {switches, {}},
+ {SWITCHES, {}},
nullptr,
};
void perform_and_exit(const VcpkgCmdArguments& args)
{
- auto parsed_args = args.parse_arguments(COMMAND_STRUCTURE);
+ const ParsedArguments parsed_args = args.parse_arguments(COMMAND_STRUCTURE);
- if (Util::Sets::contains(parsed_args.switches, switches[0].name))
+ if (Util::Sets::contains(parsed_args.switches, SWITCHES[0].name))
{
auto maybe_now = Chrono::CTime::get_current_date_time();
- if (auto p_now = maybe_now.get())
+ if (const auto p_now = maybe_now.get())
{
auto& fs = Files::get_real_filesystem();
auto config = UserConfig::try_read_data(fs);
diff --git a/toolsrc/src/vcpkg/commands.cpp b/toolsrc/src/vcpkg/commands.cpp
index d9c0e54cd..8b6ffb3d7 100644
--- a/toolsrc/src/vcpkg/commands.cpp
+++ b/toolsrc/src/vcpkg/commands.cpp
@@ -43,7 +43,8 @@ namespace vcpkg::Commands
{"portsdiff", &PortsDiff::perform_and_exit},
{"autocomplete", &Autocomplete::perform_and_exit},
{"hash", &Hash::perform_and_exit},
- };
+ // {"fetch", &Fetch::perform_and_exit},
+ };
return t;
}
@@ -51,7 +52,7 @@ namespace vcpkg::Commands
{
static std::vector<PackageNameAndFunction<CommandTypeC>> t = {
{"version", &Version::perform_and_exit},
- {"contact", &Contact::perform_and_exit}
+ {"contact", &Contact::perform_and_exit},
};
return t;
}
diff --git a/toolsrc/src/vcpkg/commands.create.cpp b/toolsrc/src/vcpkg/commands.create.cpp
index 25c34cf09..dfb3ab784 100644
--- a/toolsrc/src/vcpkg/commands.create.cpp
+++ b/toolsrc/src/vcpkg/commands.create.cpp
@@ -18,11 +18,11 @@ namespace vcpkg::Commands::Create
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
- args.parse_arguments(COMMAND_STRUCTURE);
+ Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
const std::string port_name = args.command_arguments.at(0);
const std::string url = args.command_arguments.at(1);
- const fs::path& cmake_exe = paths.get_cmake_exe();
+ const fs::path& cmake_exe = paths.get_tool_exe(Tools::CMAKE);
std::vector<System::CMakeVariable> cmake_args{{"CMD", "CREATE"}, {"PORT", port_name}, {"URL", url}};
diff --git a/toolsrc/src/vcpkg/commands.dependinfo.cpp b/toolsrc/src/vcpkg/commands.dependinfo.cpp
index bb300d96e..1ca658216 100644
--- a/toolsrc/src/vcpkg/commands.dependinfo.cpp
+++ b/toolsrc/src/vcpkg/commands.dependinfo.cpp
@@ -19,7 +19,7 @@ namespace vcpkg::Commands::DependInfo
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
- args.parse_arguments(COMMAND_STRUCTURE);
+ Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
std::vector<std::unique_ptr<SourceControlFile>> source_control_files =
Paragraphs::load_all_ports(paths.get_filesystem(), paths.ports);
@@ -30,7 +30,6 @@ namespace vcpkg::Commands::DependInfo
Util::erase_remove_if(source_control_files,
[&](const std::unique_ptr<SourceControlFile>& source_control_file) {
-
const SourceParagraph& source_paragraph = *source_control_file->core_paragraph;
if (Strings::case_insensitive_ascii_contains(source_paragraph.name, filter))
diff --git a/toolsrc/src/vcpkg/commands.edit.cpp b/toolsrc/src/vcpkg/commands.edit.cpp
index 6c696018e..82569dd07 100644
--- a/toolsrc/src/vcpkg/commands.edit.cpp
+++ b/toolsrc/src/vcpkg/commands.edit.cpp
@@ -9,14 +9,15 @@ namespace vcpkg::Commands::Edit
{
static std::vector<fs::path> find_from_registry()
{
+ std::vector<fs::path> output;
+
+#if defined(_WIN32)
static const std::array<const char*, 3> REGKEYS = {
R"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C26E74D1-022E-4238-8B9D-1E7564A36CC9}_is1)",
R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1287CAD5-7C8D-410D-88B9-0D1EE4A83FF2}_is1)",
R"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1)",
};
- std::vector<fs::path> output;
-#if defined(_WIN32)
for (auto&& keypath : REGKEYS)
{
const Optional<std::string> code_installpath =
@@ -93,7 +94,7 @@ namespace vcpkg::Commands::Edit
const std::vector<fs::path> from_registry = find_from_registry();
candidate_paths.insert(candidate_paths.end(), from_registry.cbegin(), from_registry.cend());
- auto it = Util::find_if(candidate_paths, [&](const fs::path& p) { return fs.exists(p); });
+ const auto it = Util::find_if(candidate_paths, [&](const fs::path& p) { return fs.exists(p); });
if (it == candidate_paths.cend())
{
System::println(
diff --git a/toolsrc/src/vcpkg/commands.exportifw.cpp b/toolsrc/src/vcpkg/commands.exportifw.cpp
index 58d9aa0be..ae106196a 100644
--- a/toolsrc/src/vcpkg/commands.exportifw.cpp
+++ b/toolsrc/src/vcpkg/commands.exportifw.cpp
@@ -291,7 +291,7 @@ namespace vcpkg::Export::IFW
std::error_code ec;
Files::Filesystem& fs = paths.get_filesystem();
- const fs::path& installerbase_exe = paths.get_ifw_installerbase_exe();
+ const fs::path& installerbase_exe = paths.get_tool_exe(Tools::IFW_INSTALLER_BASE);
fs::path tempmaintenancetool = ifw_packages_dir_path / "maintenance" / "data" / "tempmaintenancetool.exe";
fs.create_directories(tempmaintenancetool.parent_path(), ec);
Checks::check_exit(VCPKG_LINE_INFO,
@@ -335,7 +335,7 @@ namespace vcpkg::Export::IFW
void do_repository(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
{
- const fs::path& repogen_exe = paths.get_ifw_repogen_exe();
+ const fs::path& repogen_exe = paths.get_tool_exe(Tools::IFW_REPOGEN);
const fs::path packages_dir = get_packages_dir_path(export_id, ifw_options, paths);
const fs::path repository_dir = get_repository_dir_path(export_id, ifw_options, paths);
@@ -361,7 +361,7 @@ namespace vcpkg::Export::IFW
void do_installer(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
{
- const fs::path& binarycreator_exe = paths.get_ifw_binarycreator_exe();
+ const fs::path& binarycreator_exe = paths.get_tool_exe(Tools::IFW_BINARYCREATOR);
const fs::path config_file = get_config_file_path(export_id, ifw_options, paths);
const fs::path packages_dir = get_packages_dir_path(export_id, ifw_options, paths);
const fs::path repository_dir = get_repository_dir_path(export_id, ifw_options, paths);
diff --git a/toolsrc/src/vcpkg/commands.fetch.cpp b/toolsrc/src/vcpkg/commands.fetch.cpp
new file mode 100644
index 000000000..7a1e6a810
--- /dev/null
+++ b/toolsrc/src/vcpkg/commands.fetch.cpp
@@ -0,0 +1,717 @@
+#include "pch.h"
+
+#include <vcpkg/base/checks.h>
+#include <vcpkg/base/strings.h>
+#include <vcpkg/base/system.h>
+#include <vcpkg/base/util.h>
+#include <vcpkg/commands.h>
+#include <vcpkg/help.h>
+
+namespace vcpkg::Commands::Fetch
+{
+ static constexpr CStringView V_120 = "v120";
+ static constexpr CStringView V_140 = "v140";
+ static constexpr CStringView V_141 = "v141";
+
+ struct ToolData
+ {
+ std::array<int, 3> version;
+ fs::path exe_path;
+ std::string url;
+ fs::path download_path;
+ fs::path tool_dir_path;
+ std::string sha512;
+ };
+
+ static Optional<std::array<int, 3>> parse_version_string(const std::string& version_as_string)
+ {
+ static const std::regex RE(R"###((\d+)\.(\d+)\.(\d+))###");
+
+ std::match_results<std::string::const_iterator> match;
+ const auto found = std::regex_search(version_as_string, match, RE);
+ if (!found)
+ {
+ return {};
+ }
+
+ const int d1 = atoi(match[1].str().c_str());
+ const int d2 = atoi(match[2].str().c_str());
+ const int d3 = atoi(match[3].str().c_str());
+ const std::array<int, 3> result = {d1, d2, d3};
+ return result;
+ }
+
+ static ToolData parse_tool_data_from_xml(const VcpkgPaths& paths, const std::string& tool)
+ {
+#if defined(_WIN32)
+ static constexpr StringLiteral OS_STRING = "windows";
+#elif defined(__APPLE__)
+ static constexpr StringLiteral OS_STRING = "osx";
+#elif defined(__linux__)
+ static constexpr StringLiteral OS_STRING = "linux";
+#else
+ return ToolData{};
+#endif
+
+#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__)
+ static const std::string XML_VERSION = "2";
+ static const fs::path XML_PATH = paths.scripts / "vcpkgTools.xml";
+
+ const auto maybe_get_string_inside_tags = [](const std::string& input,
+ const std::regex& regex) -> Optional<std::string> {
+ std::smatch match;
+ const bool has_match = std::regex_search(input.cbegin(), input.cend(), match, regex);
+ if (!has_match) return nullopt;
+ return match[1];
+ };
+
+ const auto get_string_inside_tags =
+ [](const std::string& input, const std::regex& regex, const std::string& tag_name) -> std::string {
+ std::smatch match;
+ const bool has_match = std::regex_search(input.cbegin(), input.cend(), match, regex);
+ Checks::check_exit(
+ VCPKG_LINE_INFO, has_match, "Could not find tag <%s> in %s", tag_name, XML_PATH.generic_string());
+
+ return match[1];
+ };
+
+ static const std::regex XML_VERSION_REGEX{R"###(<tools[\s]+version="([^"]+)">)###"};
+ static const std::string XML = paths.get_filesystem().read_contents(XML_PATH).value_or_exit(VCPKG_LINE_INFO);
+ static const std::regex VERSION_REGEX{R"###(<version>([\s\S]*?)</version>)###"};
+ static const std::regex EXE_RELATIVE_PATH_REGEX{
+ Strings::format(R"###(<exeRelativePath>([\s\S]*?)</exeRelativePath>)###")};
+ static const std::regex ARCHIVE_NAME_REGEX{Strings::format(R"###(<archiveName>([\s\S]*?)</archiveName>)###")};
+ static const std::regex URL_REGEX{Strings::format(R"###(<url>([\s\S]*?)</url>)###")};
+ static const std::regex SHA512_REGEX{Strings::format(R"###(<sha512>([\s\S]*?)</sha512>)###")};
+
+ std::smatch match_xml_version;
+ const bool has_xml_version = std::regex_search(XML.cbegin(), XML.cend(), match_xml_version, XML_VERSION_REGEX);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ has_xml_version,
+ R"(Could not find <tools version="%s"> in %s)",
+ XML_VERSION,
+ XML_PATH.generic_string());
+ Checks::check_exit(VCPKG_LINE_INFO,
+ XML_VERSION == match_xml_version[1],
+ "Expected %s version: [%s], but was [%s]. Please re-run bootstrap-vcpkg.",
+ XML_PATH.generic_string(),
+ XML_VERSION,
+ match_xml_version[1]);
+
+ const std::regex tool_regex{
+ Strings::format(R"###(<tool[\s]+name="%s"[\s]+os="%s">([\s\S]*?)<\/tool>)###", tool, OS_STRING)};
+
+ std::smatch match_tool;
+ const bool has_match_tool = std::regex_search(XML.cbegin(), XML.cend(), match_tool, tool_regex);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ has_match_tool,
+ "Could not find entry for tool [%s] in %s",
+ tool,
+ XML_PATH.generic_string());
+
+ const std::string tool_data_as_string = get_string_inside_tags(XML, tool_regex, tool);
+
+ const std::string required_version_as_string =
+ get_string_inside_tags(tool_data_as_string, VERSION_REGEX, "version");
+
+ const std::string url = get_string_inside_tags(tool_data_as_string, URL_REGEX, "url");
+
+ const std::string exe_relative_path =
+ get_string_inside_tags(tool_data_as_string, EXE_RELATIVE_PATH_REGEX, "exeRelativePath");
+
+ auto archive_name = maybe_get_string_inside_tags(tool_data_as_string, ARCHIVE_NAME_REGEX);
+
+ const Optional<std::array<int, 3>> required_version = parse_version_string(required_version_as_string);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ required_version.has_value(),
+ "Could not parse version for tool %s. Version string was: %s",
+ tool,
+ required_version_as_string);
+
+ const std::string tool_dir_name = Strings::format("%s-%s-%s", tool, required_version_as_string, OS_STRING);
+ const fs::path tool_dir_path = paths.downloads / "tools" / tool_dir_name;
+ const fs::path exe_path = tool_dir_path / exe_relative_path;
+
+ const std::string sha512 = get_string_inside_tags(tool_data_as_string, SHA512_REGEX, "sha512");
+
+ return ToolData{*required_version.get(),
+ exe_path,
+ url,
+ paths.downloads / archive_name.value_or(exe_relative_path),
+ tool_dir_path,
+ sha512};
+#endif
+ }
+
+ static bool exists_and_has_equal_or_greater_version(const std::string& version_cmd,
+ const std::array<int, 3>& expected_version)
+ {
+ const auto rc = System::cmd_execute_and_capture_output(Strings::format(R"(%s)", version_cmd));
+ if (rc.exit_code != 0)
+ {
+ return false;
+ }
+
+ const Optional<std::array<int, 3>> v = parse_version_string(rc.output);
+ if (!v.has_value())
+ {
+ return false;
+ }
+
+ const std::array<int, 3> actual_version = *v.get();
+ return (actual_version[0] > expected_version[0] ||
+ (actual_version[0] == expected_version[0] && actual_version[1] > expected_version[1]) ||
+ (actual_version[0] == expected_version[0] && actual_version[1] == expected_version[1] &&
+ actual_version[2] >= expected_version[2]));
+ }
+
+ static Optional<fs::path> find_if_has_equal_or_greater_version(const std::vector<fs::path>& candidate_paths,
+ const std::string& version_check_arguments,
+ const std::array<int, 3>& expected_version)
+ {
+ auto it = Util::find_if(candidate_paths, [&](const fs::path& p) {
+ const std::string cmd = Strings::format(R"("%s" %s)", p.u8string(), version_check_arguments);
+ return exists_and_has_equal_or_greater_version(cmd, expected_version);
+ });
+
+ if (it != candidate_paths.cend())
+ {
+ return std::move(*it);
+ }
+
+ return nullopt;
+ }
+
+ static std::vector<std::string> keep_data_lines(const std::string& data_blob)
+ {
+ static const std::regex DATA_LINE_REGEX(R"(<sol>::(.+?)(?=::<eol>))");
+
+ std::vector<std::string> data_lines;
+
+ const std::sregex_iterator it(data_blob.cbegin(), data_blob.cend(), DATA_LINE_REGEX);
+ const std::sregex_iterator end;
+ for (std::sregex_iterator i = it; i != end; ++i)
+ {
+ const std::smatch match = *i;
+ data_lines.push_back(match[1].str());
+ }
+
+ return data_lines;
+ }
+
+#if !defined(_WIN32)
+ static void extract_archive(const VcpkgPaths& paths, const fs::path& archive, const fs::path& to_path)
+ {
+ Files::Filesystem& fs = paths.get_filesystem();
+ const fs::path to_path_partial = to_path.u8string() + ".partial";
+
+ std::error_code ec;
+ fs.remove_all(to_path_partial, ec);
+ fs.create_directories(to_path_partial, ec);
+
+ const auto ext = archive.extension();
+ if (ext == ".gz" && ext.extension() != ".tar")
+ {
+ const auto code = System::cmd_execute(
+ Strings::format(R"(cd '%s' && tar xzf '%s')", to_path_partial.u8string(), archive.u8string()));
+ Checks::check_exit(VCPKG_LINE_INFO, code == 0, "tar failed while extracting %s", archive.u8string());
+ }
+ else if (ext == ".zip")
+ {
+ const auto code = System::cmd_execute(
+ Strings::format(R"(cd '%s' && unzip -qqo '%s')", to_path_partial.u8string(), archive.u8string()));
+ Checks::check_exit(VCPKG_LINE_INFO, code == 0, "unzip failed while extracting %s", archive.u8string());
+ }
+ else
+ {
+ Checks::exit_with_message(VCPKG_LINE_INFO, "Unexpected archive extension: %s", ext.u8string());
+ }
+
+ fs.rename(to_path_partial, to_path);
+ }
+
+ static void verify_hash(const VcpkgPaths& paths,
+ const std::string& url,
+ const fs::path& path,
+ const std::string& sha512)
+ {
+ const std::string actual_hash = Hash::get_file_hash(paths, path, "SHA512");
+ Checks::check_exit(VCPKG_LINE_INFO,
+ sha512 == actual_hash,
+ "File does not have the expected hash:\n"
+ " url : [ %s ]\n"
+ " File path : [ %s ]\n"
+ " Expected hash : [ %s ]\n"
+ " Actual hash : [ %s ]\n",
+ url,
+ path.u8string(),
+ sha512,
+ actual_hash);
+ }
+
+ static void download_file(const VcpkgPaths& paths,
+ const std::string& url,
+ const fs::path& download_path,
+ const std::string& sha512)
+ {
+ Files::Filesystem& fs = paths.get_filesystem();
+ const std::string download_path_part = download_path.u8string() + ".part";
+ std::error_code ec;
+ fs.remove(download_path_part, ec);
+ const auto code = System::cmd_execute(Strings::format(
+ R"(curl -L '%s' --create-dirs --output '%s')", url, download_path_part));
+ Checks::check_exit(VCPKG_LINE_INFO, code == 0, "Could not download %s", url);
+
+ verify_hash(paths, url, download_path_part, sha512);
+ fs.rename(download_path_part, download_path);
+ }
+
+#endif
+ static fs::path fetch_tool(const VcpkgPaths& paths, const std::string& tool_name, const ToolData& tool_data)
+ {
+ const std::array<int, 3>& version = tool_data.version;
+
+ const std::string version_as_string = Strings::format("%d.%d.%d", version[0], version[1], version[2]);
+ System::println("A suitable version of %s was not found (required v%s). Downloading portable %s v%s...",
+ tool_name,
+ version_as_string,
+ tool_name,
+ version_as_string);
+#if defined(_WIN32)
+ const fs::path script = paths.scripts / "fetchtool.ps1";
+ const std::string title = Strings::format(
+ "Fetching %s version %s (No sufficient installed version was found)", tool_name, version_as_string);
+ const System::PowershellParameter tool_param("tool", tool_name);
+ const std::string output = System::powershell_execute_and_capture_output(title, script, {tool_param});
+
+ const std::vector<std::string> tool_path = keep_data_lines(output);
+ Checks::check_exit(VCPKG_LINE_INFO, tool_path.size() == 1, "Expected tool path, but got %s", output);
+
+ const fs::path actual_downloaded_path = Strings::trim(std::string{tool_path.at(0)});
+ const fs::path& expected_downloaded_path = tool_data.exe_path;
+ std::error_code ec;
+ const auto eq = fs::stdfs::equivalent(expected_downloaded_path, actual_downloaded_path, ec);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ eq && !ec,
+ "Expected tool downloaded path to be %s, but was %s",
+ expected_downloaded_path.u8string(),
+ actual_downloaded_path.u8string());
+ return actual_downloaded_path;
+#else
+ const auto& fs = paths.get_filesystem();
+ if (!fs.exists(tool_data.download_path))
+ {
+ System::println("Downloading %s...", tool_name);
+ download_file(paths, tool_data.url, tool_data.download_path, tool_data.sha512);
+ System::println("Downloading %s... done.", tool_name);
+ }
+ else
+ {
+ verify_hash(paths, tool_data.url, tool_data.download_path, tool_data.sha512);
+ }
+
+ System::println("Extracting %s...", tool_name);
+ extract_archive(paths, tool_data.download_path, tool_data.tool_dir_path);
+ System::println("Extracting %s... done.", tool_name);
+
+ Checks::check_exit(VCPKG_LINE_INFO,
+ fs.exists(tool_data.exe_path),
+ "Expected %s to exist after extracting",
+ tool_data.exe_path);
+
+ return tool_data.exe_path;
+#endif
+ }
+
+ static fs::path get_cmake_path(const VcpkgPaths& paths)
+ {
+ std::vector<fs::path> candidate_paths;
+#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__)
+ static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "cmake");
+ candidate_paths.push_back(TOOL_DATA.exe_path);
+#else
+ static const ToolData TOOL_DATA = ToolData{{3, 5, 1}, ""};
+#endif
+ static const std::string VERSION_CHECK_ARGUMENTS = "--version";
+
+ const std::vector<fs::path> from_path = Files::find_from_PATH("cmake");
+ candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
+
+ const auto& program_files = System::get_program_files_platform_bitness();
+ if (const auto pf = program_files.get()) candidate_paths.push_back(*pf / "CMake" / "bin" / "cmake.exe");
+ const auto& program_files_32_bit = System::get_program_files_32_bit();
+ if (const auto pf = program_files_32_bit.get()) candidate_paths.push_back(*pf / "CMake" / "bin" / "cmake.exe");
+
+ const Optional<fs::path> path =
+ find_if_has_equal_or_greater_version(candidate_paths, VERSION_CHECK_ARGUMENTS, TOOL_DATA.version);
+ if (const auto p = path.get())
+ {
+ return *p;
+ }
+
+ return fetch_tool(paths, "cmake", TOOL_DATA);
+ }
+
+ static fs::path get_7za_path(const VcpkgPaths& paths)
+ {
+#if defined(_WIN32)
+ static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "7zip");
+ if (!paths.get_filesystem().exists(TOOL_DATA.exe_path))
+ {
+ return fetch_tool(paths, "7zip", TOOL_DATA);
+ }
+ return TOOL_DATA.exe_path;
+#else
+ Checks::exit_with_message(VCPKG_LINE_INFO, "Cannot download 7zip for non-Windows platforms.");
+#endif
+ }
+
+ static fs::path get_ninja_path(const VcpkgPaths& paths)
+ {
+ static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "ninja");
+
+ std::vector<fs::path> candidate_paths;
+ candidate_paths.push_back(TOOL_DATA.exe_path);
+ const std::vector<fs::path> from_path = Files::find_from_PATH("ninja");
+ candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
+
+ auto path = find_if_has_equal_or_greater_version(candidate_paths, "--version", TOOL_DATA.version);
+ if (const auto p = path.get())
+ {
+ return *p;
+ }
+
+ return fetch_tool(paths, "ninja", TOOL_DATA);
+ }
+
+ static fs::path get_nuget_path(const VcpkgPaths& paths)
+ {
+ static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "nuget");
+
+ std::vector<fs::path> candidate_paths;
+ candidate_paths.push_back(TOOL_DATA.exe_path);
+ const std::vector<fs::path> from_path = Files::find_from_PATH("nuget");
+ candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
+
+ auto path = find_if_has_equal_or_greater_version(candidate_paths, "", TOOL_DATA.version);
+ if (const auto p = path.get())
+ {
+ return *p;
+ }
+
+ return fetch_tool(paths, "nuget", TOOL_DATA);
+ }
+
+ static fs::path get_git_path(const VcpkgPaths& paths)
+ {
+#if defined(_WIN32)
+ static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "git");
+#else
+ static const ToolData TOOL_DATA = ToolData{{2, 7, 4}, ""};
+#endif
+ static const std::string VERSION_CHECK_ARGUMENTS = "--version";
+
+ std::vector<fs::path> candidate_paths;
+#if defined(_WIN32)
+ candidate_paths.push_back(TOOL_DATA.exe_path);
+#endif
+ const std::vector<fs::path> from_path = Files::find_from_PATH("git");
+ candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
+
+ const auto& program_files = System::get_program_files_platform_bitness();
+ if (const auto pf = program_files.get()) candidate_paths.push_back(*pf / "git" / "cmd" / "git.exe");
+ const auto& program_files_32_bit = System::get_program_files_32_bit();
+ if (const auto pf = program_files_32_bit.get()) candidate_paths.push_back(*pf / "git" / "cmd" / "git.exe");
+
+ const Optional<fs::path> path =
+ find_if_has_equal_or_greater_version(candidate_paths, VERSION_CHECK_ARGUMENTS, TOOL_DATA.version);
+ if (const auto p = path.get())
+ {
+ return *p;
+ }
+
+ return fetch_tool(paths, "git", TOOL_DATA);
+ }
+
+ static fs::path get_ifw_installerbase_path(const VcpkgPaths& paths)
+ {
+ static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "installerbase");
+
+ static const std::string VERSION_CHECK_ARGUMENTS = "--framework-version";
+
+ std::vector<fs::path> candidate_paths;
+ candidate_paths.push_back(TOOL_DATA.exe_path);
+ // TODO: Uncomment later
+ // const std::vector<fs::path> from_path = Files::find_from_PATH("installerbase");
+ // candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
+ // candidate_paths.push_back(fs::path(System::get_environment_variable("HOMEDRIVE").value_or("C:")) / "Qt" /
+ // "Tools" / "QtInstallerFramework" / "3.1" / "bin" / "installerbase.exe");
+ // candidate_paths.push_back(fs::path(System::get_environment_variable("HOMEDRIVE").value_or("C:")) / "Qt" /
+ // "QtIFW-3.1.0" / "bin" / "installerbase.exe");
+
+ const Optional<fs::path> path =
+ find_if_has_equal_or_greater_version(candidate_paths, VERSION_CHECK_ARGUMENTS, TOOL_DATA.version);
+ if (const auto p = path.get())
+ {
+ return *p;
+ }
+
+ return fetch_tool(paths, "installerbase", TOOL_DATA);
+ }
+
+ struct VisualStudioInstance
+ {
+ fs::path root_path;
+ std::string version;
+ std::string release_type;
+ std::string preference_weight; // Mostly unused, just for verification that order is as intended
+
+ std::string major_version() const { return version.substr(0, 2); }
+ };
+
+ static std::vector<VisualStudioInstance> get_visual_studio_instances(const VcpkgPaths& paths)
+ {
+ const fs::path script = paths.scripts / "findVisualStudioInstallationInstances.ps1";
+ const std::string output =
+ System::powershell_execute_and_capture_output("Detecting Visual Studio instances", script);
+
+ const std::vector<std::string> instances_as_strings = keep_data_lines(output);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ !instances_as_strings.empty(),
+ "Could not detect any Visual Studio instances.\n"
+ "Powershell script:\n"
+ " %s\n"
+ "returned:\n"
+ "%s",
+ script.generic_string(),
+ output);
+
+ std::vector<VisualStudioInstance> instances;
+ for (const std::string& instance_as_string : instances_as_strings)
+ {
+ const std::vector<std::string> split = Strings::split(instance_as_string, "::");
+ Checks::check_exit(VCPKG_LINE_INFO,
+ split.size() == 4,
+ "Invalid Visual Studio instance format.\n"
+ "Expected: PreferenceWeight::ReleaseType::Version::PathToVisualStudio\n"
+ "Actual : %s\n",
+ instance_as_string);
+ instances.push_back({split.at(3), split.at(2), split.at(1), split.at(0)});
+ }
+
+ return instances;
+ }
+
+ std::vector<Toolset> find_toolset_instances(const VcpkgPaths& paths)
+ {
+ using CPU = System::CPUArchitecture;
+
+ const auto& fs = paths.get_filesystem();
+
+ // Note: this will contain a mix of vcvarsall.bat locations and dumpbin.exe locations.
+ std::vector<fs::path> paths_examined;
+
+ std::vector<Toolset> found_toolsets;
+ std::vector<Toolset> excluded_toolsets;
+
+ const std::vector<VisualStudioInstance> vs_instances = get_visual_studio_instances(paths);
+ const bool v140_is_available = Util::find_if(vs_instances, [&](const VisualStudioInstance& vs_instance) {
+ return vs_instance.major_version() == "14";
+ }) != vs_instances.cend();
+
+ for (const VisualStudioInstance& vs_instance : vs_instances)
+ {
+ const std::string major_version = vs_instance.major_version();
+ if (major_version == "15")
+ {
+ const fs::path vc_dir = vs_instance.root_path / "VC";
+
+ // Skip any instances that do not have vcvarsall.
+ const fs::path vcvarsall_dir = vc_dir / "Auxiliary" / "Build";
+ const fs::path vcvarsall_bat = vcvarsall_dir / "vcvarsall.bat";
+ paths_examined.push_back(vcvarsall_bat);
+ if (!fs.exists(vcvarsall_bat)) continue;
+
+ // Get all supported architectures
+ std::vector<ToolsetArchOption> supported_architectures;
+ if (fs.exists(vcvarsall_dir / "vcvars32.bat"))
+ supported_architectures.push_back({"x86", CPU::X86, CPU::X86});
+ if (fs.exists(vcvarsall_dir / "vcvars64.bat"))
+ supported_architectures.push_back({"amd64", CPU::X64, CPU::X64});
+ if (fs.exists(vcvarsall_dir / "vcvarsx86_amd64.bat"))
+ supported_architectures.push_back({"x86_amd64", CPU::X86, CPU::X64});
+ if (fs.exists(vcvarsall_dir / "vcvarsx86_arm.bat"))
+ supported_architectures.push_back({"x86_arm", CPU::X86, CPU::ARM});
+ if (fs.exists(vcvarsall_dir / "vcvarsx86_arm64.bat"))
+ supported_architectures.push_back({"x86_arm64", CPU::X86, CPU::ARM64});
+ if (fs.exists(vcvarsall_dir / "vcvarsamd64_x86.bat"))
+ supported_architectures.push_back({"amd64_x86", CPU::X64, CPU::X86});
+ if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm.bat"))
+ supported_architectures.push_back({"amd64_arm", CPU::X64, CPU::ARM});
+ if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm64.bat"))
+ supported_architectures.push_back({"amd64_arm64", CPU::X64, CPU::ARM64});
+
+ // Locate the "best" MSVC toolchain version
+ const fs::path msvc_path = vc_dir / "Tools" / "MSVC";
+ std::vector<fs::path> msvc_subdirectories = fs.get_files_non_recursive(msvc_path);
+ Util::unstable_keep_if(msvc_subdirectories,
+ [&fs](const fs::path& path) { return fs.is_directory(path); });
+
+ // Sort them so that latest comes first
+ std::sort(
+ msvc_subdirectories.begin(),
+ msvc_subdirectories.end(),
+ [](const fs::path& left, const fs::path& right) { return left.filename() > right.filename(); });
+
+ for (const fs::path& subdir : msvc_subdirectories)
+ {
+ const fs::path dumpbin_path = subdir / "bin" / "HostX86" / "x86" / "dumpbin.exe";
+ paths_examined.push_back(dumpbin_path);
+ if (fs.exists(dumpbin_path))
+ {
+ const Toolset v141toolset = Toolset{
+ vs_instance.root_path, dumpbin_path, vcvarsall_bat, {}, V_141, supported_architectures};
+
+ auto english_language_pack = dumpbin_path.parent_path() / "1033";
+
+ if (!fs.exists(english_language_pack))
+ {
+ excluded_toolsets.push_back(v141toolset);
+ break;
+ }
+
+ found_toolsets.push_back(v141toolset);
+
+ if (v140_is_available)
+ {
+ const Toolset v140toolset = Toolset{vs_instance.root_path,
+ dumpbin_path,
+ vcvarsall_bat,
+ {"-vcvars_ver=14.0"},
+ V_140,
+ supported_architectures};
+ found_toolsets.push_back(v140toolset);
+ }
+
+ break;
+ }
+ }
+
+ continue;
+ }
+
+ if (major_version == "14" || major_version == "12")
+ {
+ const fs::path vcvarsall_bat = vs_instance.root_path / "VC" / "vcvarsall.bat";
+
+ paths_examined.push_back(vcvarsall_bat);
+ if (fs.exists(vcvarsall_bat))
+ {
+ const fs::path vs_dumpbin_exe = vs_instance.root_path / "VC" / "bin" / "dumpbin.exe";
+ paths_examined.push_back(vs_dumpbin_exe);
+
+ const fs::path vs_bin_dir = vcvarsall_bat.parent_path() / "bin";
+ std::vector<ToolsetArchOption> supported_architectures;
+ if (fs.exists(vs_bin_dir / "vcvars32.bat"))
+ supported_architectures.push_back({"x86", CPU::X86, CPU::X86});
+ if (fs.exists(vs_bin_dir / "amd64\\vcvars64.bat"))
+ supported_architectures.push_back({"x64", CPU::X64, CPU::X64});
+ if (fs.exists(vs_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat"))
+ supported_architectures.push_back({"x86_amd64", CPU::X86, CPU::X64});
+ if (fs.exists(vs_bin_dir / "x86_arm\\vcvarsx86_arm.bat"))
+ supported_architectures.push_back({"x86_arm", CPU::X86, CPU::ARM});
+ if (fs.exists(vs_bin_dir / "amd64_x86\\vcvarsamd64_x86.bat"))
+ supported_architectures.push_back({"amd64_x86", CPU::X64, CPU::X86});
+ if (fs.exists(vs_bin_dir / "amd64_arm\\vcvarsamd64_arm.bat"))
+ supported_architectures.push_back({"amd64_arm", CPU::X64, CPU::ARM});
+
+ if (fs.exists(vs_dumpbin_exe))
+ {
+ const Toolset toolset = {vs_instance.root_path,
+ vs_dumpbin_exe,
+ vcvarsall_bat,
+ {},
+ major_version == "14" ? V_140 : V_120,
+ supported_architectures};
+
+ auto english_language_pack = vs_dumpbin_exe.parent_path() / "1033";
+
+ if (!fs.exists(english_language_pack))
+ {
+ excluded_toolsets.push_back(toolset);
+ break;
+ }
+
+ found_toolsets.push_back(toolset);
+ }
+ }
+ }
+ }
+
+ if (!excluded_toolsets.empty())
+ {
+ System::println(
+ System::Color::warning,
+ "Warning: The following VS instances are excluded because the English language pack is unavailable.");
+ for (const Toolset& toolset : excluded_toolsets)
+ {
+ System::println(" %s", toolset.visual_studio_root_path.u8string());
+ }
+ System::println(System::Color::warning, "Please install the English language pack.");
+ }
+
+ if (found_toolsets.empty())
+ {
+ System::println(System::Color::error, "Could not locate a complete toolset.");
+ System::println("The following paths were examined:");
+ for (const fs::path& path : paths_examined)
+ {
+ System::println(" %s", path.u8string());
+ }
+ Checks::exit_fail(VCPKG_LINE_INFO);
+ }
+
+ return found_toolsets;
+ }
+
+ fs::path get_tool_path(const VcpkgPaths& paths, const std::string& tool)
+ {
+ // First deal with specially handled tools.
+ // For these we may look in locations like Program Files, the PATH etc as well as the auto-downloaded location.
+ if (tool == Tools::SEVEN_ZIP) return get_7za_path(paths);
+ if (tool == Tools::CMAKE) return get_cmake_path(paths);
+ if (tool == Tools::GIT) return get_git_path(paths);
+ if (tool == Tools::NINJA) return get_ninja_path(paths);
+ if (tool == Tools::NUGET) return get_nuget_path(paths);
+ if (tool == Tools::IFW_INSTALLER_BASE) return get_ifw_installerbase_path(paths);
+ if (tool == Tools::IFW_BINARYCREATOR)
+ return get_ifw_installerbase_path(paths).parent_path() / "binarycreator.exe";
+ if (tool == Tools::IFW_REPOGEN) return get_ifw_installerbase_path(paths).parent_path() / "repogen.exe";
+
+ // For other tools, we simply always auto-download them.
+ const ToolData tool_data = parse_tool_data_from_xml(paths, tool);
+ if (paths.get_filesystem().exists(tool_data.exe_path))
+ {
+ return tool_data.exe_path;
+ }
+ return fetch_tool(paths, tool, tool_data);
+ }
+
+ const CommandStructure COMMAND_STRUCTURE = {
+ Strings::format("The argument should be tool name\n%s", Help::create_example_string("fetch cmake")),
+ 1,
+ 1,
+ {},
+ nullptr,
+ };
+
+ void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
+ {
+ Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
+
+ const std::string tool = args.command_arguments[0];
+ const fs::path tool_path = get_tool_path(paths, tool);
+ System::println(tool_path.u8string());
+ Checks::exit_success(VCPKG_LINE_INFO);
+ }
+}
diff --git a/toolsrc/src/vcpkg/commands.hash.cpp b/toolsrc/src/vcpkg/commands.hash.cpp
index 9e1b54390..1f709f87b 100644
--- a/toolsrc/src/vcpkg/commands.hash.cpp
+++ b/toolsrc/src/vcpkg/commands.hash.cpp
@@ -7,6 +7,19 @@
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
+namespace vcpkg::Commands::Hash
+{
+ static void verify_has_only_allowed_chars(const std::string& s)
+ {
+ static const std::regex ALLOWED_CHARS{"^[a-zA-Z0-9-]*$"};
+ Checks::check_exit(VCPKG_LINE_INFO,
+ std::regex_match(s, ALLOWED_CHARS),
+ "Only alphanumeric chars and dashes are currently allowed. String was:\n"
+ " % s",
+ s);
+ }
+}
+
#if defined(_WIN32)
#include <bcrypt.h>
@@ -18,7 +31,7 @@ namespace vcpkg::Commands::Hash
{
namespace
{
- static std::string to_hex(const unsigned char* string, const size_t bytes)
+ std::string to_hex(const unsigned char* string, const size_t bytes)
{
static constexpr char HEX_MAP[] = "0123456789abcdef";
@@ -39,99 +52,172 @@ namespace vcpkg::Commands::Hash
return output;
}
- struct BCryptAlgorithmHandle : Util::ResourceBase
+ class BCryptHasher
{
- BCRYPT_ALG_HANDLE handle = nullptr;
+ struct BCryptAlgorithmHandle : Util::ResourceBase
+ {
+ BCRYPT_ALG_HANDLE handle = nullptr;
+
+ ~BCryptAlgorithmHandle()
+ {
+ if (handle) BCryptCloseAlgorithmProvider(handle, 0);
+ }
+ };
+
+ struct BCryptHashHandle : Util::ResourceBase
+ {
+ BCRYPT_HASH_HANDLE handle = nullptr;
+
+ ~BCryptHashHandle()
+ {
+ if (handle) BCryptDestroyHash(handle);
+ }
+ };
- ~BCryptAlgorithmHandle()
+ static void initialize_hash_handle(BCryptHashHandle& hash_handle,
+ const BCryptAlgorithmHandle& algorithm_handle)
{
- if (handle) BCryptCloseAlgorithmProvider(handle, 0);
+ const NTSTATUS error_code =
+ BCryptCreateHash(algorithm_handle.handle, &hash_handle.handle, nullptr, 0, nullptr, 0, 0);
+ Checks::check_exit(VCPKG_LINE_INFO, NT_SUCCESS(error_code), "Failed to initialize the hasher");
}
- };
- struct BCryptHashHandle : Util::ResourceBase
- {
- BCRYPT_HASH_HANDLE handle = nullptr;
+ static void hash_data(BCryptHashHandle& hash_handle, const unsigned char* buffer, const size_t& data_size)
+ {
+ const NTSTATUS error_code = BCryptHashData(
+ hash_handle.handle, const_cast<unsigned char*>(buffer), static_cast<ULONG>(data_size), 0);
+ Checks::check_exit(VCPKG_LINE_INFO, NT_SUCCESS(error_code), "Failed to hash data");
+ }
- ~BCryptHashHandle()
+ static std::string finalize_hash_handle(const BCryptHashHandle& hash_handle, const ULONG length_in_bytes)
{
- if (handle) BCryptDestroyHash(handle);
+ std::unique_ptr<unsigned char[]> hash_buffer = std::make_unique<UCHAR[]>(length_in_bytes);
+ const NTSTATUS error_code = BCryptFinishHash(hash_handle.handle, hash_buffer.get(), length_in_bytes, 0);
+ Checks::check_exit(VCPKG_LINE_INFO, NT_SUCCESS(error_code), "Failed to finalize the hash");
+ return to_hex(hash_buffer.get(), length_in_bytes);
}
- };
- }
- std::string get_file_hash(const VcpkgPaths&, const fs::path& path, const std::string& hash_type)
- {
- BCryptAlgorithmHandle algorithm_handle;
-
- NTSTATUS error_code = BCryptOpenAlgorithmProvider(
- &algorithm_handle.handle, Strings::to_utf16(Strings::ascii_to_uppercase(hash_type)).c_str(), nullptr, 0);
- Checks::check_exit(VCPKG_LINE_INFO, NT_SUCCESS(error_code), "Failed to open the algorithm provider");
-
- DWORD hash_buffer_bytes;
- DWORD cb_data;
- error_code = BCryptGetProperty(algorithm_handle.handle,
- BCRYPT_HASH_LENGTH,
- reinterpret_cast<PUCHAR>(&hash_buffer_bytes),
- sizeof(DWORD),
- &cb_data,
- 0);
- Checks::check_exit(VCPKG_LINE_INFO, NT_SUCCESS(error_code), "Failed to get hash length");
- const ULONG length_in_bytes = hash_buffer_bytes;
-
- BCryptHashHandle hash_handle;
-
- error_code = BCryptCreateHash(algorithm_handle.handle, &hash_handle.handle, nullptr, 0, nullptr, 0, 0);
- Checks::check_exit(VCPKG_LINE_INFO, NT_SUCCESS(error_code), "Failed to initialize the hasher");
-
- FILE* file = nullptr;
- const auto ec = _wfopen_s(&file, path.c_str(), L"rb");
- Checks::check_exit(VCPKG_LINE_INFO, ec == 0, "Failed to open file: %s", path.u8string());
- unsigned char buffer[4096];
- while (const auto actual_size = fread(buffer, 1, sizeof(buffer), file))
- {
- error_code = BCryptHashData(hash_handle.handle, buffer, static_cast<ULONG>(actual_size), 0);
- Checks::check_exit(VCPKG_LINE_INFO, NT_SUCCESS(error_code), "Failed to hash data");
- }
+ public:
+ explicit BCryptHasher(const std::string& hash_type)
+ {
+ NTSTATUS error_code =
+ BCryptOpenAlgorithmProvider(&this->algorithm_handle.handle,
+ Strings::to_utf16(Strings::ascii_to_uppercase(hash_type)).c_str(),
+ nullptr,
+ 0);
+ Checks::check_exit(VCPKG_LINE_INFO, NT_SUCCESS(error_code), "Failed to open the algorithm provider");
+
+ DWORD hash_buffer_bytes;
+ DWORD cb_data;
+ error_code = BCryptGetProperty(this->algorithm_handle.handle,
+ BCRYPT_HASH_LENGTH,
+ reinterpret_cast<PUCHAR>(&hash_buffer_bytes),
+ sizeof(DWORD),
+ &cb_data,
+ 0);
+ Checks::check_exit(VCPKG_LINE_INFO, NT_SUCCESS(error_code), "Failed to get hash length");
+ this->length_in_bytes = hash_buffer_bytes;
+ }
- fclose(file);
+ std::string hash_file(const fs::path& path) const
+ {
+ BCryptHashHandle hash_handle;
+ initialize_hash_handle(hash_handle, this->algorithm_handle);
+
+ FILE* file = nullptr;
+ const auto ec = _wfopen_s(&file, path.c_str(), L"rb");
+ Checks::check_exit(VCPKG_LINE_INFO, ec == 0, "Failed to open file: %s", path.u8string());
+ if (file != nullptr)
+ {
+ unsigned char buffer[4096];
+ while (const auto actual_size = fread(buffer, 1, sizeof(buffer), file))
+ {
+ hash_data(hash_handle, buffer, actual_size);
+ }
+ fclose(file);
+ }
+
+ return finalize_hash_handle(hash_handle, length_in_bytes);
+ }
- std::unique_ptr<unsigned char[]> hash_buffer = std::make_unique<UCHAR[]>(length_in_bytes);
+ std::string hash_string(const std::string& s) const
+ {
+ BCryptHashHandle hash_handle;
+ initialize_hash_handle(hash_handle, this->algorithm_handle);
+ hash_data(hash_handle, reinterpret_cast<const unsigned char*>(s.c_str()), s.size());
+ return finalize_hash_handle(hash_handle, length_in_bytes);
+ }
+
+ private:
+ BCryptAlgorithmHandle algorithm_handle;
+ ULONG length_in_bytes;
+ };
+ }
- error_code = BCryptFinishHash(hash_handle.handle, hash_buffer.get(), length_in_bytes, 0);
- Checks::check_exit(VCPKG_LINE_INFO, NT_SUCCESS(error_code), "Failed to finalize the hash");
+ std::string get_file_hash(const VcpkgPaths& paths, const fs::path& path, const std::string& hash_type)
+ {
+ Checks::check_exit(
+ VCPKG_LINE_INFO, paths.get_filesystem().exists(path), "File %s does not exist", path.u8string());
+ return BCryptHasher{hash_type}.hash_file(path);
+ }
- return to_hex(hash_buffer.get(), length_in_bytes);
+ std::string get_string_hash(const std::string& s, const std::string& hash_type)
+ {
+ verify_has_only_allowed_chars(s);
+ return BCryptHasher{hash_type}.hash_string(s);
}
}
#else
namespace vcpkg::Commands::Hash
{
- std::string get_file_hash(const VcpkgPaths& paths, const fs::path& path, const std::string& hash_type)
+ static std::string get_digest_size(const std::string& hash_type)
{
- const std::string cmd_line = Strings::format(
- R"("%s" -E %ssum "%s")",
- paths.get_cmake_exe().u8string(),
- Strings::ascii_to_lowercase(hash_type),
- path.u8string());
+ if (!Strings::case_insensitive_ascii_starts_with(hash_type, "SHA"))
+ {
+ Checks::exit_with_message(
+ VCPKG_LINE_INFO, "shasum only supports SHA hashes, but %s was provided", hash_type);
+ }
- const auto ec_data = System::cmd_execute_and_capture_output(cmd_line);
- Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", cmd_line);
+ return hash_type.substr(3, hash_type.length() - 3);
+ }
- std::string const& output = ec_data.output;
+ static std::string run_shasum_and_post_process(const std::string& cmd_line)
+ {
+ const auto ec_data = System::cmd_execute_and_capture_output(cmd_line);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ ec_data.exit_code == 0,
+ "Failed to run:\n"
+ " %s",
+ cmd_line);
+
+ std::vector<std::string> split = Strings::split(ec_data.output, " ");
+ Checks::check_exit(VCPKG_LINE_INFO,
+ split.size() == 3,
+ "Expected output of the form [hash filename\n] (3 tokens), but got\n"
+ "[%s] (%s tokens)",
+ ec_data.output,
+ std::to_string(split.size()));
+
+ return split[0];
+ }
- const auto start = output.find_first_of(' ');
+ std::string get_file_hash(const VcpkgPaths& paths, const fs::path& path, const std::string& hash_type)
+ {
+ const std::string digest_size = get_digest_size(hash_type);
Checks::check_exit(
- VCPKG_LINE_INFO, start != std::string::npos, "Unexpected output format from command: %s", cmd_line);
+ VCPKG_LINE_INFO, paths.get_filesystem().exists(path), "File %s does not exist", path.u8string());
+ const std::string cmd_line = Strings::format(R"(shasum -a %s "%s")", digest_size, path.u8string());
+ return run_shasum_and_post_process(cmd_line);
+ }
- const auto end = output.find_first_of("\r\n", start + 1);
- Checks::check_exit(
- VCPKG_LINE_INFO, end != std::string::npos, "Unexpected output format from command: %s", cmd_line);
+ std::string get_string_hash(const std::string& s, const std::string& hash_type)
+ {
+ const std::string digest_size = get_digest_size(hash_type);
+ verify_has_only_allowed_chars(s);
- auto hash = output.substr(0, start);
- Util::erase_remove_if(hash, isspace);
- return hash;
+ const std::string cmd_line = Strings::format(R"(echo -n "%s" | shasum -a %s)", s, digest_size);
+ return run_shasum_and_post_process(cmd_line);
}
}
#endif
diff --git a/toolsrc/src/vcpkg/commands.import.cpp b/toolsrc/src/vcpkg/commands.import.cpp
index 24394207b..4b595697a 100644
--- a/toolsrc/src/vcpkg/commands.import.cpp
+++ b/toolsrc/src/vcpkg/commands.import.cpp
@@ -103,7 +103,7 @@ namespace vcpkg::Commands::Import
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
- args.parse_arguments(COMMAND_STRUCTURE);
+ Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
const fs::path control_file_path(args.command_arguments[0]);
const fs::path include_directory(args.command_arguments[1]);
diff --git a/toolsrc/src/vcpkg/commands.integrate.cpp b/toolsrc/src/vcpkg/commands.integrate.cpp
index 36e4e56e7..7061a3984 100644
--- a/toolsrc/src/vcpkg/commands.integrate.cpp
+++ b/toolsrc/src/vcpkg/commands.integrate.cpp
@@ -8,6 +8,7 @@
namespace vcpkg::Commands::Integrate
{
+#if defined(_WIN32)
static std::string create_appdata_targets_shortcut(const std::string& target_path) noexcept
{
return Strings::format(R"###(
@@ -18,7 +19,9 @@ namespace vcpkg::Commands::Integrate
target_path,
target_path);
}
+#endif
+#if defined(_WIN32)
static std::string create_system_targets_shortcut() noexcept
{
return R"###(
@@ -31,7 +34,9 @@ namespace vcpkg::Commands::Integrate
</Project>
)###";
}
+#endif
+#if defined(_WIN32)
static std::string create_nuget_targets_file_contents(const fs::path& msbuild_vcpkg_targets_file) noexcept
{
const std::string as_string = msbuild_vcpkg_targets_file.string();
@@ -47,7 +52,9 @@ namespace vcpkg::Commands::Integrate
as_string,
as_string);
}
+#endif
+#if defined(_WIN32)
static std::string create_nuget_props_file_contents() noexcept
{
return R"###(
@@ -58,7 +65,9 @@ namespace vcpkg::Commands::Integrate
</Project>
)###";
}
+#endif
+#if defined(_WIN32)
static std::string get_nuget_id(const fs::path& vcpkg_root_dir)
{
std::string dir_id = vcpkg_root_dir.generic_string();
@@ -71,7 +80,9 @@ namespace vcpkg::Commands::Integrate
const std::string nuget_id = "vcpkg." + dir_id;
return nuget_id;
}
+#endif
+#if defined(_WIN32)
static std::string create_nuspec_file_contents(const fs::path& vcpkg_root_dir,
const std::string& nuget_id,
const std::string& nupkg_version)
@@ -98,17 +109,18 @@ namespace vcpkg::Commands::Integrate
content = Strings::replace_all(std::move(content), "@VERSION@", nupkg_version);
return content;
}
+#endif
+#if defined(_WIN32)
enum class ElevationPromptChoice
{
YES,
NO
};
-#if defined(_WIN32)
static ElevationPromptChoice elevated_cmd_execute(const std::string& param)
{
- SHELLEXECUTEINFOW sh_ex_info = {0};
+ SHELLEXECUTEINFOW sh_ex_info{};
sh_ex_info.cbSize = sizeof(sh_ex_info);
sh_ex_info.fMask = SEE_MASK_NOCLOSEPROCESS;
sh_ex_info.hwnd = nullptr;
@@ -272,11 +284,12 @@ CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s")",
}
#endif
+#if defined(WIN32)
static void integrate_project(const VcpkgPaths& paths)
{
auto& fs = paths.get_filesystem();
- const fs::path& nuget_exe = paths.get_nuget_exe();
+ const fs::path& nuget_exe = paths.get_tool_exe(Tools::NUGET);
const fs::path& buildsystems_dir = paths.buildsystems;
const fs::path tmp_dir = buildsystems_dir / "tmp";
@@ -319,13 +332,19 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
Checks::exit_success(VCPKG_LINE_INFO);
}
+#endif
+#if defined(_WIN32)
const char* const INTEGRATE_COMMAND_HELPSTRING =
" vcpkg integrate install Make installed packages available user-wide. Requires admin privileges on "
"first use\n"
" vcpkg integrate remove Remove user-wide integration\n"
" vcpkg integrate project Generate a referencing nuget package for individual VS project use\n"
" vcpkg integrate powershell Enable PowerShell Tab-Completion\n";
+#else
+ const char* const INTEGRATE_COMMAND_HELPSTRING =
+ "No user-wide integration methods are available on this platform\n";
+#endif
namespace Subcommand
{
@@ -352,7 +371,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
- args.parse_arguments(COMMAND_STRUCTURE);
+ Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
#if defined(_WIN32)
if (args.command_arguments[0] == Subcommand::INSTALL)
diff --git a/toolsrc/src/vcpkg/commands.list.cpp b/toolsrc/src/vcpkg/commands.list.cpp
index a5efd5442..1bfbc4247 100644
--- a/toolsrc/src/vcpkg/commands.list.cpp
+++ b/toolsrc/src/vcpkg/commands.list.cpp
@@ -10,7 +10,7 @@ namespace vcpkg::Commands::List
static constexpr StringLiteral OPTION_FULLDESC =
"--x-full-desc"; // TODO: This should find a better home, eventually
- static void do_print(const StatusParagraph& pgh, bool full_desc)
+ static void do_print(const StatusParagraph& pgh, const bool full_desc)
{
if (full_desc)
{
@@ -44,14 +44,19 @@ namespace vcpkg::Commands::List
const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE);
const StatusParagraphs status_paragraphs = database_load_check(paths);
- std::vector<StatusParagraph*> installed_packages = get_installed_ports(status_paragraphs);
+ auto installed_ipv = get_installed_ports(status_paragraphs);
- if (installed_packages.empty())
+ if (installed_ipv.empty())
{
System::println("No packages are installed. Did you mean `search`?");
Checks::exit_success(VCPKG_LINE_INFO);
}
+ auto installed_packages = Util::fmap(installed_ipv, [](const InstalledPackageView& ipv) { return ipv.core; });
+ auto installed_features =
+ Util::fmap_flatten(installed_ipv, [](const InstalledPackageView& ipv) { return ipv.features; });
+ installed_packages.insert(installed_packages.end(), installed_features.begin(), installed_features.end());
+
std::sort(installed_packages.begin(),
installed_packages.end(),
[](const StatusParagraph* lhs, const StatusParagraph* rhs) -> bool {
diff --git a/toolsrc/src/vcpkg/commands.owns.cpp b/toolsrc/src/vcpkg/commands.owns.cpp
index 52249187b..ee9584651 100644
--- a/toolsrc/src/vcpkg/commands.owns.cpp
+++ b/toolsrc/src/vcpkg/commands.owns.cpp
@@ -34,7 +34,7 @@ namespace vcpkg::Commands::Owns
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
- args.parse_arguments(COMMAND_STRUCTURE);
+ Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
const StatusParagraphs status_db = database_load_check(paths);
search_file(paths, args.command_arguments[0], status_db);
diff --git a/toolsrc/src/vcpkg/commands.portsdiff.cpp b/toolsrc/src/vcpkg/commands.portsdiff.cpp
index dba04ce5b..2d2b4bd5f 100644
--- a/toolsrc/src/vcpkg/commands.portsdiff.cpp
+++ b/toolsrc/src/vcpkg/commands.portsdiff.cpp
@@ -3,6 +3,7 @@
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/paragraphs.h>
+#include <vcpkg/versiont.h>
#include <vcpkg/base/sortedvector.h>
#include <vcpkg/base/system.h>
@@ -79,7 +80,7 @@ namespace vcpkg::Commands::PortsDiff
{
std::error_code ec;
auto& fs = paths.get_filesystem();
- const fs::path& git_exe = paths.get_git_exe();
+ const fs::path& git_exe = paths.get_tool_exe(Tools::GIT);
const fs::path dot_git_dir = paths.root / ".git";
const std::string ports_dir_name_as_string = paths.ports.filename().u8string();
const fs::path temp_checkout_path =
@@ -128,9 +129,9 @@ namespace vcpkg::Commands::PortsDiff
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
- args.parse_arguments(COMMAND_STRUCTURE);
+ Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
- const fs::path& git_exe = paths.get_git_exe();
+ const fs::path& git_exe = paths.get_tool_exe(Tools::GIT);
const std::string git_commit_id_for_previous_snapshot = args.command_arguments.at(0);
const std::string git_commit_id_for_current_snapshot =
diff --git a/toolsrc/src/vcpkg/commands.upgrade.cpp b/toolsrc/src/vcpkg/commands.upgrade.cpp
index c5b48f2a2..a902ddeaf 100644
--- a/toolsrc/src/vcpkg/commands.upgrade.cpp
+++ b/toolsrc/src/vcpkg/commands.upgrade.cpp
@@ -144,7 +144,8 @@ namespace vcpkg::Commands::Upgrade
const Build::BuildPackageOptions install_plan_options = {Build::UseHeadVersion::NO,
Build::AllowDownloads::YES,
Build::CleanBuildtrees::NO,
- Build::CleanPackages::NO};
+ Build::CleanPackages::NO,
+ Build::DownloadTool::BUILT_IN};
// Set build settings for all install actions
for (auto&& action : plan)
diff --git a/toolsrc/src/vcpkg/commands.version.cpp b/toolsrc/src/vcpkg/commands.version.cpp
index ffc5d2c8f..2ad91b57d 100644
--- a/toolsrc/src/vcpkg/commands.version.cpp
+++ b/toolsrc/src/vcpkg/commands.version.cpp
@@ -83,7 +83,7 @@ namespace vcpkg::Commands::Version
void perform_and_exit(const VcpkgCmdArguments& args)
{
- args.parse_arguments(COMMAND_STRUCTURE);
+ Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
System::println("Vcpkg package management program version %s\n"
"\n"
diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp
index f6d81c973..8fb35b0da 100644
--- a/toolsrc/src/vcpkg/dependencies.cpp
+++ b/toolsrc/src/vcpkg/dependencies.cpp
@@ -13,11 +13,17 @@
namespace vcpkg::Dependencies
{
- struct FeatureNodeEdges
+ struct ClusterInstalled
{
- std::vector<FeatureSpec> remove_edges;
- std::vector<FeatureSpec> build_edges;
- bool plus = false;
+ InstalledPackageView ipv;
+ std::set<PackageSpec> remove_edges;
+ std::set<std::string> original_features;
+ };
+
+ struct ClusterSource
+ {
+ const SourceControlFile* scf = nullptr;
+ std::unordered_map<std::string, std::vector<FeatureSpec>> build_edges;
};
/// <summary>
@@ -25,14 +31,15 @@ namespace vcpkg::Dependencies
/// </summary>
struct Cluster : Util::MoveOnlyBase
{
- InstalledPackageView installed_package;
-
- Optional<const SourceControlFile*> source_control_file;
PackageSpec spec;
- std::unordered_map<std::string, FeatureNodeEdges> edges_by_feature;
+
+ Optional<ClusterInstalled> installed;
+ Optional<ClusterSource> source;
+
+ // Note: this map can contain "special" strings such as "" and "*"
+ std::unordered_map<std::string, bool> plus;
std::set<std::string> to_install_features;
- std::set<std::string> original_features;
- bool will_remove = false;
+ bool minus = false;
bool transient_uninstalled = true;
RequestType request_type = RequestType::AUTO_SELECTED;
};
@@ -88,27 +95,26 @@ namespace vcpkg::Dependencies
auto maybe_scf = m_provider.get_control_file(spec.name());
auto& clust = m_graph[spec];
clust.spec = spec;
- if (auto p_scf = maybe_scf.get()) cluster_from_scf(*p_scf, clust);
+ if (auto p_scf = maybe_scf.get())
+ {
+ clust.source = cluster_from_scf(*p_scf, clust.spec.triplet());
+ }
return clust;
}
return it->second;
}
private:
- void cluster_from_scf(const SourceControlFile& scf, Cluster& out_cluster) const
+ static ClusterSource cluster_from_scf(const SourceControlFile& scf, Triplet t)
{
- FeatureNodeEdges core_dependencies;
- core_dependencies.build_edges =
- filter_dependencies_to_specs(scf.core_paragraph->depends, out_cluster.spec.triplet());
- out_cluster.edges_by_feature.emplace("core", std::move(core_dependencies));
+ ClusterSource ret;
+ ret.build_edges.emplace("core", filter_dependencies_to_specs(scf.core_paragraph->depends, t));
for (const auto& feature : scf.feature_paragraphs)
- {
- FeatureNodeEdges added_edges;
- added_edges.build_edges = filter_dependencies_to_specs(feature->depends, out_cluster.spec.triplet());
- out_cluster.edges_by_feature.emplace(feature->name, std::move(added_edges));
- }
- out_cluster.source_control_file = &scf;
+ ret.build_edges.emplace(feature->name, filter_dependencies_to_specs(feature->depends, t));
+
+ ret.scf = &scf;
+ return ret;
}
std::unordered_map<PackageSpec, Cluster> m_graph;
@@ -139,7 +145,10 @@ namespace vcpkg::Dependencies
}
}
- InstallPlanAction::InstallPlanAction() : plan_type(InstallPlanType::UNKNOWN), request_type(RequestType::UNKNOWN) {}
+ InstallPlanAction::InstallPlanAction() noexcept
+ : plan_type(InstallPlanType::UNKNOWN), request_type(RequestType::UNKNOWN), build_options{}
+ {
+ }
InstallPlanAction::InstallPlanAction(const PackageSpec& spec,
const SourceControlFile& scf,
@@ -150,19 +159,20 @@ namespace vcpkg::Dependencies
, source_control_file(scf)
, plan_type(InstallPlanType::BUILD_AND_INSTALL)
, request_type(request_type)
+ , build_options{}
, feature_list(features)
, computed_dependencies(std::move(dependencies))
{
}
- InstallPlanAction::InstallPlanAction(const PackageSpec& spec,
- InstalledPackageView&& ipv,
+ InstallPlanAction::InstallPlanAction(InstalledPackageView&& ipv,
const std::set<std::string>& features,
const RequestType& request_type)
- : spec(spec)
+ : spec(ipv.spec())
, installed_package(std::move(ipv))
, plan_type(InstallPlanType::ALREADY_INSTALLED)
, request_type(request_type)
+ , build_options{}
, feature_list(features)
, computed_dependencies(installed_package.get()->dependencies())
{
@@ -184,7 +194,10 @@ namespace vcpkg::Dependencies
return left->spec.name() < right->spec.name();
}
- RemovePlanAction::RemovePlanAction() : plan_type(RemovePlanType::UNKNOWN), request_type(RequestType::UNKNOWN) {}
+ RemovePlanAction::RemovePlanAction() noexcept
+ : plan_type(RemovePlanType::UNKNOWN), request_type(RequestType::UNKNOWN)
+ {
+ }
RemovePlanAction::RemovePlanAction(const PackageSpec& spec,
const RemovePlanType& plan_type,
@@ -213,7 +226,10 @@ namespace vcpkg::Dependencies
return left->spec.name() < right->spec.name();
}
- ExportPlanAction::ExportPlanAction() : plan_type(ExportPlanType::UNKNOWN), request_type(RequestType::UNKNOWN) {}
+ ExportPlanAction::ExportPlanAction() noexcept
+ : plan_type(ExportPlanType::UNKNOWN), request_type(RequestType::UNKNOWN)
+ {
+ }
ExportPlanAction::ExportPlanAction(const PackageSpec& spec,
InstalledPackageView&& installed_package,
@@ -289,11 +305,11 @@ namespace vcpkg::Dependencies
struct RemoveAdjacencyProvider final : Graphs::AdjacencyProvider<PackageSpec, RemovePlanAction>
{
const StatusParagraphs& status_db;
- const std::vector<StatusParagraph*>& installed_ports;
+ const std::vector<InstalledPackageView>& installed_ports;
const std::unordered_set<PackageSpec>& specs_as_set;
RemoveAdjacencyProvider(const StatusParagraphs& status_db,
- const std::vector<StatusParagraph*>& installed_ports,
+ const std::vector<InstalledPackageView>& installed_ports,
const std::unordered_set<PackageSpec>& specs_as_set)
: status_db(status_db), installed_ports(installed_ports), specs_as_set(specs_as_set)
{
@@ -308,24 +324,13 @@ namespace vcpkg::Dependencies
const PackageSpec& spec = plan.spec;
std::vector<PackageSpec> dependents;
- for (const StatusParagraph* an_installed_package : installed_ports)
+ for (auto&& ipv : installed_ports)
{
- if (an_installed_package->package.spec.triplet() != spec.triplet()) continue;
+ auto deps = ipv.dependencies();
- std::vector<std::string> deps = an_installed_package->package.depends;
- // <hack>
- // This is a hack to work around existing installations that put featurespecs into binary packages
- // (example: curl[core]) Eventually, this can be returned to a simple string search.
- for (auto&& dep : deps)
- {
- dep.erase(std::find(dep.begin(), dep.end(), '['), dep.end());
- }
- Util::unstable_keep_if(deps,
- [&](auto&& e) { return e != an_installed_package->package.spec.name(); });
- // </hack>
- if (std::find(deps.begin(), deps.end(), spec.name()) == deps.end()) continue;
+ if (std::find(deps.begin(), deps.end(), spec) == deps.end()) continue;
- dependents.push_back(an_installed_package->package.spec);
+ dependents.push_back(ipv.spec());
}
return dependents;
@@ -347,7 +352,7 @@ namespace vcpkg::Dependencies
std::string to_string(const PackageSpec& spec) const override { return spec.to_string(); }
};
- const std::vector<StatusParagraph*>& installed_ports = get_installed_ports(status_db);
+ auto installed_ports = get_installed_ports(status_db);
const std::unordered_set<PackageSpec> specs_as_set(specs.cbegin(), specs.cend());
return Graphs::topological_sort(specs, RemoveAdjacencyProvider{status_db, installed_ports, specs_as_set});
}
@@ -405,161 +410,201 @@ namespace vcpkg::Dependencies
Cluster& cluster,
ClusterGraph& graph,
GraphPlan& graph_plan,
- const std::unordered_set<std::string>& prevent_default_features = {});
+ const std::unordered_set<std::string>& prevent_default_features);
- static void mark_minus(Cluster& cluster, ClusterGraph& graph, GraphPlan& graph_plan);
+ static void mark_minus(Cluster& cluster,
+ ClusterGraph& graph,
+ GraphPlan& graph_plan,
+ const std::unordered_set<std::string>& prevent_default_features);
- MarkPlusResult mark_plus(const std::string& feature,
- Cluster& cluster,
- ClusterGraph& graph,
- GraphPlan& graph_plan,
- const std::unordered_set<std::string>& prevent_default_features)
+ static MarkPlusResult follow_plus_dependencies(const std::string& feature,
+ Cluster& cluster,
+ ClusterGraph& graph,
+ GraphPlan& graph_plan,
+ const std::unordered_set<std::string>& prevent_default_features)
{
- if (feature.empty())
+ if (auto p_source = cluster.source.get())
{
- if (prevent_default_features.find(cluster.spec.name()) == prevent_default_features.end())
+ auto it_build_edges = p_source->build_edges.find(feature);
+ if (it_build_edges != p_source->build_edges.end())
{
- // Indicates that core was not specified in the reference
+ // mark this package for rebuilding if needed
+ mark_minus(cluster, graph, graph_plan, prevent_default_features);
- // Add default features for this package, if this is the "core" feature and we
- // are not supposed to prevent default features for this package
- if (auto scf = cluster.source_control_file.value_or(nullptr))
+ graph_plan.install_graph.add_vertex({&cluster});
+ cluster.to_install_features.insert(feature);
+
+ if (feature != "core")
{
- for (auto&& default_feature : scf->core_paragraph.get()->default_features)
- {
- auto res = mark_plus(default_feature, cluster, graph, graph_plan, prevent_default_features);
- if (res != MarkPlusResult::SUCCESS)
- {
- return res;
- }
- }
+ // All features implicitly depend on core
+ auto res = mark_plus("core", cluster, graph, graph_plan, prevent_default_features);
+
+ // Should be impossible for "core" to not exist
+ Checks::check_exit(VCPKG_LINE_INFO, res == MarkPlusResult::SUCCESS);
}
- // "core" is always an implicit default feature. In case we did not add it as
- // a dependency above (e.g. no default features), add it here.
- auto res = mark_plus("core", cluster, graph, graph_plan, prevent_default_features);
- if (res != MarkPlusResult::SUCCESS)
+ if (!cluster.installed.get() && !Util::Sets::contains(prevent_default_features, cluster.spec.name()))
{
- return res;
+ // Add the default features of this package if it was not previously installed and it isn't being
+ // suppressed.
+ auto res = mark_plus("", cluster, graph, graph_plan, prevent_default_features);
+
+ Checks::check_exit(VCPKG_LINE_INFO,
+ res == MarkPlusResult::SUCCESS,
+ "Error: Unable to satisfy default dependencies of %s",
+ cluster.spec);
+ }
+
+ for (auto&& depend : it_build_edges->second)
+ {
+ auto& depend_cluster = graph.get(depend.spec());
+ auto res = mark_plus(depend.feature(), depend_cluster, graph, graph_plan, prevent_default_features);
+
+ Checks::check_exit(VCPKG_LINE_INFO,
+ res == MarkPlusResult::SUCCESS,
+ "Error: Unable to satisfy dependency %s of %s",
+ depend,
+ FeatureSpec(cluster.spec, feature));
+
+ if (&depend_cluster == &cluster) continue;
+ graph_plan.install_graph.add_edge({&cluster}, {&depend_cluster});
}
- return MarkPlusResult::SUCCESS;
- }
- else
- {
- // Skip adding the default features, as explicitly told not to.
return MarkPlusResult::SUCCESS;
}
}
- auto it = cluster.edges_by_feature.find(feature);
- if (it == cluster.edges_by_feature.end()) return MarkPlusResult::FEATURE_NOT_FOUND;
+ // The feature was not available in the installed package nor the source paragraph.
+ return MarkPlusResult::FEATURE_NOT_FOUND;
+ }
- if (cluster.edges_by_feature[feature].plus) return MarkPlusResult::SUCCESS;
+ MarkPlusResult mark_plus(const std::string& feature,
+ Cluster& cluster,
+ ClusterGraph& graph,
+ GraphPlan& graph_plan,
+ const std::unordered_set<std::string>& prevent_default_features)
+ {
+ auto& plus = cluster.plus[feature];
+ if (plus) return MarkPlusResult::SUCCESS;
+ plus = true;
- if (cluster.original_features.find(feature) == cluster.original_features.end())
+ if (feature.empty())
{
- cluster.transient_uninstalled = true;
- }
+ // Add default features for this package. This is an exact reference, so ignore prevent_default_features.
+ if (auto p_source = cluster.source.get())
+ {
+ for (auto&& default_feature : p_source->scf->core_paragraph.get()->default_features)
+ {
+ auto res = mark_plus(default_feature, cluster, graph, graph_plan, prevent_default_features);
+ if (res != MarkPlusResult::SUCCESS)
+ {
+ return res;
+ }
+ }
+ }
+ else
+ {
+ Checks::exit_with_message(VCPKG_LINE_INFO,
+ "Error: Unable to install default features because can't find CONTROL for %s",
+ cluster.spec);
+ }
- if (!cluster.transient_uninstalled)
- {
- return MarkPlusResult::SUCCESS;
+ // "core" is always required.
+ return mark_plus("core", cluster, graph, graph_plan, prevent_default_features);
}
- cluster.edges_by_feature[feature].plus = true;
- if (!cluster.original_features.empty())
+ if (feature == "*")
{
- mark_minus(cluster, graph, graph_plan);
- }
+ if (auto p_source = cluster.source.get())
+ {
+ for (auto&& fpgh : p_source->scf->feature_paragraphs)
+ {
+ auto res = mark_plus(fpgh->name, cluster, graph, graph_plan, prevent_default_features);
- graph_plan.install_graph.add_vertex({&cluster});
- auto& tracked = cluster.to_install_features;
- tracked.insert(feature);
+ Checks::check_exit(VCPKG_LINE_INFO,
+ res == MarkPlusResult::SUCCESS,
+ "Error: Unable to locate feature %s in %s",
+ fpgh->name,
+ cluster.spec);
+ }
- if (feature != "core")
- {
- // All features implicitly depend on core
- auto res = mark_plus("core", cluster, graph, graph_plan, prevent_default_features);
+ auto res = mark_plus("core", cluster, graph, graph_plan, prevent_default_features);
- // Should be impossible for "core" to not exist
- Checks::check_exit(VCPKG_LINE_INFO, res == MarkPlusResult::SUCCESS);
- }
- else
- {
- // Add the default features of this package.
- auto res = mark_plus("", cluster, graph, graph_plan, prevent_default_features);
+ Checks::check_exit(VCPKG_LINE_INFO, res == MarkPlusResult::SUCCESS);
+ }
+ else
+ {
+ Checks::exit_with_message(
+ VCPKG_LINE_INFO, "Error: Unable to handle '*' because can't find CONTROL for %s", cluster.spec);
+ }
+ return MarkPlusResult::SUCCESS;
}
- for (auto&& depend : cluster.edges_by_feature[feature].build_edges)
+ if (auto p_installed = cluster.installed.get())
{
- auto& depend_cluster = graph.get(depend.spec());
- auto res = mark_plus(depend.feature(), depend_cluster, graph, graph_plan, prevent_default_features);
-
- Checks::check_exit(VCPKG_LINE_INFO,
- res == MarkPlusResult::SUCCESS,
- "Error: Unable to satisfy dependency %s of %s",
- depend,
- FeatureSpec(cluster.spec, feature));
-
- if (&depend_cluster == &cluster) continue;
- graph_plan.install_graph.add_edge({&cluster}, {&depend_cluster});
+ if (p_installed->original_features.find(feature) != p_installed->original_features.end())
+ {
+ return MarkPlusResult::SUCCESS;
+ }
}
- return MarkPlusResult::SUCCESS;
+ // This feature was or will be uninstalled, therefore we need to rebuild
+ mark_minus(cluster, graph, graph_plan, prevent_default_features);
+
+ return follow_plus_dependencies(feature, cluster, graph, graph_plan, prevent_default_features);
}
- void mark_minus(Cluster& cluster, ClusterGraph& graph, GraphPlan& graph_plan)
+ void mark_minus(Cluster& cluster,
+ ClusterGraph& graph,
+ GraphPlan& graph_plan,
+ const std::unordered_set<std::string>& prevent_default_features)
{
- if (cluster.will_remove) return;
- cluster.will_remove = true;
-
- std::unordered_set<std::string> prevent_default_features;
+ if (cluster.minus) return;
+ cluster.minus = true;
+ cluster.transient_uninstalled = true;
- if (cluster.request_type == RequestType::USER_REQUESTED)
- {
- // Do not install default features for packages which the user
- // installed explicitly. New default features for dependent
- // clusters should still be upgraded.
- prevent_default_features.insert(cluster.spec.name());
+ auto p_installed = cluster.installed.get();
+ auto p_source = cluster.source.get();
- // For dependent packages this is handles through the recursion
- }
+ Checks::check_exit(
+ VCPKG_LINE_INFO,
+ p_source,
+ "Error: cannot locate new portfile for %s. Please explicitly remove this package with `vcpkg remove %s`.",
+ cluster.spec,
+ cluster.spec);
- graph_plan.remove_graph.add_vertex({&cluster});
- for (auto&& pair : cluster.edges_by_feature)
+ if (p_installed)
{
- auto& remove_edges_edges = pair.second.remove_edges;
- for (auto&& depend : remove_edges_edges)
+ graph_plan.remove_graph.add_vertex({&cluster});
+ for (auto&& edge : p_installed->remove_edges)
{
- auto& depend_cluster = graph.get(depend.spec());
- if (&depend_cluster != &cluster) graph_plan.remove_graph.add_edge({&cluster}, {&depend_cluster});
- mark_minus(depend_cluster, graph, graph_plan);
+ auto& depend_cluster = graph.get(edge);
+ Checks::check_exit(VCPKG_LINE_INFO, &cluster != &depend_cluster);
+ graph_plan.remove_graph.add_edge({&cluster}, {&depend_cluster});
+ mark_minus(depend_cluster, graph, graph_plan, prevent_default_features);
}
- }
- cluster.transient_uninstalled = true;
- for (auto&& original_feature : cluster.original_features)
- {
- auto res = mark_plus(original_feature, cluster, graph, graph_plan, prevent_default_features);
- if (res != MarkPlusResult::SUCCESS)
+ // Reinstall all original features. Don't use mark_plus because it will ignore them since they are
+ // "already installed".
+ for (auto&& f : p_installed->original_features)
{
- System::println(System::Color::warning,
- "Warning: could not reinstall feature %s",
- FeatureSpec{cluster.spec, original_feature});
+ auto res = follow_plus_dependencies(f, cluster, graph, graph_plan, prevent_default_features);
+ if (res != MarkPlusResult::SUCCESS)
+ {
+ System::println(System::Color::warning,
+ "Warning: could not reinstall feature %s",
+ FeatureSpec{cluster.spec, f});
+ }
}
- }
- // Check if any default features have been added
- if (auto scf = cluster.source_control_file.value_or(nullptr))
- {
- auto& previous_df = cluster.installed_package.core->package.default_features;
- for (auto&& default_feature : scf->core_paragraph->default_features)
+ // Check if any default features have been added
+ auto& previous_df = p_installed->ipv.core->package.default_features;
+ for (auto&& default_feature : p_source->scf->core_paragraph->default_features)
{
if (std::find(previous_df.begin(), previous_df.end(), default_feature) == previous_df.end())
{
- // this is a new default feature, mark it for installation
- auto res = mark_plus(default_feature, cluster, graph, graph_plan);
+ // This is a new default feature, mark it for installation
+ auto res = mark_plus(default_feature, cluster, graph, graph_plan, prevent_default_features);
if (res != MarkPlusResult::SUCCESS)
{
System::println(System::Color::warning,
@@ -588,7 +633,11 @@ namespace vcpkg::Dependencies
PackageGraph pgraph(provider, status_db);
for (auto&& spec : specs)
+ {
+ // If preventing default features, ignore the automatically generated "" references
+ if (spec.feature().empty() && Util::Sets::contains(prevent_default_features, spec.name())) continue;
pgraph.install(spec, prevent_default_features);
+ }
return pgraph.serialize();
}
@@ -614,37 +663,10 @@ namespace vcpkg::Dependencies
{
Cluster& spec_cluster = m_graph->get(spec.spec());
spec_cluster.request_type = RequestType::USER_REQUESTED;
- if (spec.feature() == "*")
- {
- if (auto p_scf = spec_cluster.source_control_file.value_or(nullptr))
- {
- for (auto&& feature : p_scf->feature_paragraphs)
- {
- auto res =
- mark_plus(feature->name, spec_cluster, *m_graph, *m_graph_plan, prevent_default_features);
- Checks::check_exit(
- VCPKG_LINE_INFO, res == MarkPlusResult::SUCCESS, "Error: Unable to locate feature %s", spec);
- }
+ auto res = mark_plus(spec.feature(), spec_cluster, *m_graph, *m_graph_plan, prevent_default_features);
- auto res = mark_plus("core", spec_cluster, *m_graph, *m_graph_plan, prevent_default_features);
-
- Checks::check_exit(
- VCPKG_LINE_INFO, res == MarkPlusResult::SUCCESS, "Error: Unable to locate feature %s", spec);
- }
- else
- {
- Checks::exit_with_message(
- VCPKG_LINE_INFO, "Error: Unable to handle '*' because can't find CONTROL for %s", spec.spec());
- }
- }
- else
- {
- auto res = mark_plus(spec.feature(), spec_cluster, *m_graph, *m_graph_plan, prevent_default_features);
-
- Checks::check_exit(
- VCPKG_LINE_INFO, res == MarkPlusResult::SUCCESS, "Error: Unable to locate feature %s", spec);
- }
+ Checks::check_exit(VCPKG_LINE_INFO, res == MarkPlusResult::SUCCESS, "Error: Unable to locate feature %s", spec);
m_graph_plan->install_graph.add_vertex(ClusterPtr{&spec_cluster});
}
@@ -654,7 +676,7 @@ namespace vcpkg::Dependencies
Cluster& spec_cluster = m_graph->get(spec);
spec_cluster.request_type = RequestType::USER_REQUESTED;
- mark_minus(spec_cluster, *m_graph, *m_graph_plan);
+ mark_minus(spec_cluster, *m_graph, *m_graph_plan, {});
}
std::vector<AnyAction> PackageGraph::serialize() const
@@ -669,11 +691,8 @@ namespace vcpkg::Dependencies
for (auto&& p_cluster : remove_toposort)
{
- auto scf = *p_cluster->source_control_file.get();
- auto spec = PackageSpec::from_name_and_triplet(scf->core_paragraph->name, p_cluster->spec.triplet())
- .value_or_exit(VCPKG_LINE_INFO);
plan.emplace_back(RemovePlanAction{
- std::move(spec),
+ std::move(p_cluster->spec),
RemovePlanType::REMOVE,
p_cluster->request_type,
});
@@ -684,8 +703,7 @@ namespace vcpkg::Dependencies
if (p_cluster->transient_uninstalled)
{
// If it will be transiently uninstalled, we need to issue a full installation command
- auto pscf = p_cluster->source_control_file.value_or_exit(VCPKG_LINE_INFO);
- Checks::check_exit(VCPKG_LINE_INFO, pscf != nullptr);
+ auto pscf = p_cluster->source.value_or_exit(VCPKG_LINE_INFO).scf;
auto dep_specs = Util::fmap(m_graph_plan->install_graph.adjacency_list(p_cluster),
[](ClusterPtr const& p) { return p->spec; });
@@ -703,10 +721,10 @@ namespace vcpkg::Dependencies
{
// If the package isn't transitively installed, still include it if the user explicitly requested it
if (p_cluster->request_type != RequestType::USER_REQUESTED) continue;
+ auto&& installed = p_cluster->installed.value_or_exit(VCPKG_LINE_INFO);
plan.emplace_back(InstallPlanAction{
- p_cluster->spec,
- InstalledPackageView{p_cluster->installed_package},
- p_cluster->original_features,
+ InstalledPackageView{installed.ipv},
+ installed.original_features,
p_cluster->request_type,
});
}
@@ -722,44 +740,36 @@ namespace vcpkg::Dependencies
auto installed_ports = get_installed_ports(status_db);
- for (auto&& status_paragraph : installed_ports)
+ for (auto&& ipv : installed_ports)
{
- Cluster& cluster = graph->get(status_paragraph->package.spec);
+ Cluster& cluster = graph->get(ipv.spec());
cluster.transient_uninstalled = false;
- auto& status_paragraph_feature = status_paragraph->package.feature;
-
- // In this case, empty string indicates the "core" paragraph for a package.
- if (status_paragraph_feature.empty())
- {
- cluster.original_features.insert("core");
- cluster.installed_package.core = status_paragraph;
- }
- else
- {
- cluster.original_features.insert(status_paragraph_feature);
- cluster.installed_package.features.emplace_back(status_paragraph);
- }
+ cluster.installed = [](const InstalledPackageView& ipv) -> ClusterInstalled {
+ ClusterInstalled ret;
+ ret.ipv = ipv;
+ ret.original_features.emplace("core");
+ for (auto&& feature : ipv.features)
+ ret.original_features.emplace(feature->package.feature);
+ return ret;
+ }(ipv);
}
// Populate the graph with "remove edges", which are the reverse of the Build-Depends edges.
- for (auto&& status_paragraph : installed_ports)
+ for (auto&& ipv : installed_ports)
{
- auto& spec = status_paragraph->package.spec;
- auto& status_paragraph_feature = status_paragraph->package.feature;
- auto reverse_edges = FeatureSpec::from_strings_and_triplet(status_paragraph->package.depends,
- status_paragraph->package.spec.triplet());
+ auto deps = ipv.dependencies();
- for (auto&& dependency : reverse_edges)
+ for (auto&& dep : deps)
{
- auto& dep_cluster = graph->get(dependency.spec());
-
- auto depends_name = dependency.feature();
- if (depends_name.empty()) depends_name = "core";
-
- auto& target_node = dep_cluster.edges_by_feature[depends_name];
- target_node.remove_edges.emplace_back(FeatureSpec{spec, status_paragraph_feature});
+ auto p_installed = graph->get(dep).installed.get();
+ Checks::check_exit(VCPKG_LINE_INFO,
+ p_installed,
+ "Error: database corrupted. Package %s is installed but dependency %s is not.",
+ ipv.spec(),
+ dep);
+ p_installed->remove_edges.emplace(ipv.spec());
}
}
return graph;
diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp
index 16c84f99d..152252018 100644
--- a/toolsrc/src/vcpkg/export.cpp
+++ b/toolsrc/src/vcpkg/export.cpp
@@ -13,8 +13,6 @@
#include <vcpkg/paragraphs.h>
#include <vcpkg/vcpkglib.h>
-#include <regex>
-
namespace vcpkg::Export
{
using Dependencies::ExportPlanAction;
@@ -70,8 +68,11 @@ namespace vcpkg::Export
{
static constexpr std::array<ExportPlanType, 2> ORDER = {ExportPlanType::ALREADY_BUILT,
ExportPlanType::NOT_BUILT};
- static constexpr Build::BuildPackageOptions build_options = {Build::UseHeadVersion::NO,
- Build::AllowDownloads::YES};
+ static constexpr Build::BuildPackageOptions BUILD_OPTIONS = {Build::UseHeadVersion::NO,
+ Build::AllowDownloads::YES,
+ Build::CleanBuildtrees::NO,
+ Build::CleanPackages::NO,
+ Build::DownloadTool::BUILT_IN};
for (const ExportPlanType plan_type : ORDER)
{
@@ -84,7 +85,7 @@ namespace vcpkg::Export
std::vector<const ExportPlanAction*> cont = it->second;
std::sort(cont.begin(), cont.end(), &ExportPlanAction::compare_by_name);
const std::string as_string = Strings::join("\n", cont, [](const ExportPlanAction* p) {
- return Dependencies::to_output_string(p->request_type, p->spec.to_string(), build_options);
+ return Dependencies::to_output_string(p->request_type, p->spec.to_string(), BUILD_OPTIONS);
});
switch (plan_type)
@@ -123,7 +124,7 @@ namespace vcpkg::Export
const fs::path& output_dir)
{
Files::Filesystem& fs = paths.get_filesystem();
- const fs::path& nuget_exe = paths.get_nuget_exe();
+ const fs::path& nuget_exe = paths.get_tool_exe(Tools::NUGET);
// This file will be placed in "build\native" in the nuget package. Therefore, go up two dirs.
const std::string targets_redirect_content =
@@ -189,7 +190,7 @@ namespace vcpkg::Export
const fs::path& output_dir,
const ArchiveFormat& format)
{
- const fs::path& cmake_exe = paths.get_cmake_exe();
+ const fs::path& cmake_exe = paths.get_tool_exe(Tools::CMAKE);
const std::string exported_dir_filename = raw_exported_dir.filename().u8string();
const std::string exported_archive_filename =
@@ -246,12 +247,12 @@ namespace vcpkg::Export
struct ExportArguments
{
- bool dry_run;
- bool raw;
- bool nuget;
- bool ifw;
- bool zip;
- bool seven_zip;
+ bool dry_run = false;
+ bool raw = false;
+ bool nuget = false;
+ bool ifw = false;
+ bool zip = false;
+ bool seven_zip = false;
Optional<std::string> maybe_output;
diff --git a/toolsrc/src/vcpkg/metrics.cpp b/toolsrc/src/vcpkg/metrics.cpp
index 9e17b237d..8890c067f 100644
--- a/toolsrc/src/vcpkg/metrics.cpp
+++ b/toolsrc/src/vcpkg/metrics.cpp
@@ -245,12 +245,6 @@ namespace vcpkg::Metrics
bool get_compiled_metrics_enabled() { return DISABLE_METRICS == 0; }
- static fs::path get_vcpkg_root()
- {
- return Files::get_real_filesystem().find_file_recursively_up(
- fs::stdfs::absolute(System::get_exe_path_of_current_process()), ".vcpkg-root");
- }
-
std::string get_MAC_user()
{
#if defined(_WIN32)
@@ -264,17 +258,10 @@ namespace vcpkg::Metrics
while (next != last)
{
- auto match = *next;
+ const auto match = *next;
if (match[0] != "00-00-00-00-00-00")
{
- const std::string matchstr = match[0];
- const System::PowershellParameter value("Value", matchstr);
- auto hash_result = System::powershell_execute_and_capture_output(
- "SHA256Hash", get_vcpkg_root() / "scripts" / "SHA256Hash.ps1", {value});
- Util::erase_remove_if(hash_result,
- [](char ch) { return !(ch >= 'A' && ch <= 'F') && !(ch >= '0' && ch <= '9'); });
- hash_result = Strings::ascii_to_lowercase(hash_result);
- return hash_result;
+ return vcpkg::Commands::Hash::get_string_hash(match[0], "SHA256");
}
++next;
}
diff --git a/toolsrc/src/vcpkg/parse.cpp b/toolsrc/src/vcpkg/parse.cpp
index c2670f561..d50296cf8 100644
--- a/toolsrc/src/vcpkg/parse.cpp
+++ b/toolsrc/src/vcpkg/parse.cpp
@@ -2,7 +2,6 @@
#include <vcpkg/parse.h>
-#include <vcpkg/base/checks.h>
#include <vcpkg/base/util.h>
namespace vcpkg::Parse
diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp
index a31518ad7..6fe11951f 100644
--- a/toolsrc/src/vcpkg/postbuildlint.cpp
+++ b/toolsrc/src/vcpkg/postbuildlint.cpp
@@ -361,6 +361,7 @@ namespace vcpkg::PostBuildLint
std::string actual_arch;
};
+#if defined(_WIN32)
static std::string get_actual_architecture(const MachineType& machine_type)
{
switch (machine_type)
@@ -374,7 +375,9 @@ namespace vcpkg::PostBuildLint
default: return "Machine Type Code = " + std::to_string(static_cast<uint16_t>(machine_type));
}
}
+#endif
+#if defined(_WIN32)
static void print_invalid_architecture_files(const std::string& expected_architecture,
std::vector<FileAndArch> binaries_with_invalid_architecture)
{
@@ -391,7 +394,6 @@ namespace vcpkg::PostBuildLint
static LintStatus check_dll_architecture(const std::string& expected_architecture,
const std::vector<fs::path>& files)
{
-#if defined(_WIN32)
std::vector<FileAndArch> binaries_with_invalid_architecture;
for (const fs::path& file : files)
@@ -414,10 +416,10 @@ namespace vcpkg::PostBuildLint
print_invalid_architecture_files(expected_architecture, binaries_with_invalid_architecture);
return LintStatus::ERROR_DETECTED;
}
-#endif
return LintStatus::SUCCESS;
}
+#endif
static LintStatus check_lib_architecture(const std::string& expected_architecture,
const std::vector<fs::path>& files)
@@ -802,7 +804,9 @@ namespace vcpkg::PostBuildLint
check_outdated_crt_linkage_of_dlls(dlls, toolset.dumpbin, build_info, pre_build_info);
}
+#if defined(_WIN32)
error_count += check_dll_architecture(pre_build_info.target_architecture, dlls);
+#endif
break;
}
case Build::LinkageType::STATIC:
diff --git a/toolsrc/src/vcpkg/remove.cpp b/toolsrc/src/vcpkg/remove.cpp
index 32433b234..13cc9325e 100644
--- a/toolsrc/src/vcpkg/remove.cpp
+++ b/toolsrc/src/vcpkg/remove.cpp
@@ -201,9 +201,9 @@ namespace vcpkg::Remove
static std::vector<std::string> valid_arguments(const VcpkgPaths& paths)
{
const StatusParagraphs status_db = database_load_check(paths);
- const std::vector<StatusParagraph*> installed_packages = get_installed_ports(status_db);
+ auto installed_packages = get_installed_ports(status_db);
- return Util::fmap(installed_packages, [](auto&& pgh) -> std::string { return pgh->package.spec.to_string(); });
+ return Util::fmap(installed_packages, [](auto&& pgh) -> std::string { return pgh.spec().to_string(); });
}
const CommandStructure COMMAND_STRUCTURE = {
diff --git a/toolsrc/src/vcpkg/statusparagraph.cpp b/toolsrc/src/vcpkg/statusparagraph.cpp
index 62d1d4b42..462d8d8ed 100644
--- a/toolsrc/src/vcpkg/statusparagraph.cpp
+++ b/toolsrc/src/vcpkg/statusparagraph.cpp
@@ -12,7 +12,7 @@ namespace vcpkg
static const std::string STATUS = "Status";
}
- StatusParagraph::StatusParagraph() : want(Want::ERROR_STATE), state(InstallState::ERROR_STATE) {}
+ StatusParagraph::StatusParagraph() noexcept : want(Want::ERROR_STATE), state(InstallState::ERROR_STATE) {}
void serialize(const StatusParagraph& pgh, std::string& out_str)
{
@@ -25,6 +25,7 @@ namespace vcpkg
}
StatusParagraph::StatusParagraph(std::unordered_map<std::string, std::string>&& fields)
+ : want(Want::ERROR_STATE), state(InstallState::ERROR_STATE)
{
auto status_it = fields.find(BinaryParagraphRequiredField::STATUS);
Checks::check_exit(VCPKG_LINE_INFO, status_it != fields.end(), "Expected 'Status' field in status paragraph");
@@ -95,7 +96,7 @@ namespace vcpkg
// Add the core paragraph dependencies to the list
deps.insert(deps.end(), core->package.depends.begin(), core->package.depends.end());
- auto&& spec = core->package.spec;
+ auto&& l_spec = spec();
// <hack>
// This is a hack to work around existing installations that put featurespecs into binary packages
@@ -104,12 +105,12 @@ namespace vcpkg
{
dep.erase(std::find(dep.begin(), dep.end(), '['), dep.end());
}
- Util::unstable_keep_if(deps, [&](auto&& e) { return e != spec.name(); });
+ Util::unstable_keep_if(deps, [&](auto&& e) { return e != l_spec.name(); });
// </hack>
Util::sort_unique_erase(deps);
return Util::fmap(deps, [&](const std::string& dep) -> PackageSpec {
- auto maybe_dependency_spec = PackageSpec::from_name_and_triplet(dep, spec.triplet());
+ auto maybe_dependency_spec = PackageSpec::from_name_and_triplet(dep, l_spec.triplet());
if (auto dependency_spec = maybe_dependency_spec.get())
{
return std::move(*dependency_spec);
@@ -120,7 +121,7 @@ namespace vcpkg
"Invalid dependency [%s] in package [%s]\n"
"%s",
dep,
- spec.name(),
+ l_spec.name(),
vcpkg::to_string(error_type));
});
}
diff --git a/toolsrc/src/vcpkg/triplet.cpp b/toolsrc/src/vcpkg/triplet.cpp
index ef0fab183..c4ad3f690 100644
--- a/toolsrc/src/vcpkg/triplet.cpp
+++ b/toolsrc/src/vcpkg/triplet.cpp
@@ -1,6 +1,5 @@
#include "pch.h"
-#include <vcpkg/base/checks.h>
#include <vcpkg/base/strings.h>
#include <vcpkg/triplet.h>
@@ -38,7 +37,7 @@ namespace vcpkg
const Triplet Triplet::ARM_UWP = from_canonical_name("arm-uwp");
const Triplet Triplet::ARM64_UWP = from_canonical_name("arm64-uwp");
const Triplet Triplet::ARM_WINDOWS = from_canonical_name("arm-windows");
- const Triplet Triplet::ARM64_WINDOWS = from_canonical_name("arm64-windows");
+ const Triplet Triplet::ARM64_WINDOWS = from_canonical_name("arm64-windows");
bool Triplet::operator==(const Triplet& other) const { return this->m_instance == other.m_instance; }
diff --git a/toolsrc/src/vcpkg/update.cpp b/toolsrc/src/vcpkg/update.cpp
index d6c5614ed..57259f952 100644
--- a/toolsrc/src/vcpkg/update.cpp
+++ b/toolsrc/src/vcpkg/update.cpp
@@ -17,17 +17,12 @@ namespace vcpkg::Update
std::vector<OutdatedPackage> find_outdated_packages(const Dependencies::PortFileProvider& provider,
const StatusParagraphs& status_db)
{
- const std::vector<StatusParagraph*> installed_packages = get_installed_ports(status_db);
+ auto installed_packages = get_installed_ports(status_db);
std::vector<OutdatedPackage> output;
- for (const StatusParagraph* pgh : installed_packages)
+ for (auto&& ipv : installed_packages)
{
- if (!pgh->package.feature.empty())
- {
- // Skip feature paragraphs; only consider master paragraphs for needing updates.
- continue;
- }
-
+ const auto& pgh = ipv.core;
auto maybe_scf = provider.get_control_file(pgh->package.spec.name());
if (auto p_scf = maybe_scf.get())
{
diff --git a/toolsrc/src/vcpkg/vcpkglib.cpp b/toolsrc/src/vcpkg/vcpkglib.cpp
index 7979fd9a5..c8e95dab1 100644
--- a/toolsrc/src/vcpkg/vcpkglib.cpp
+++ b/toolsrc/src/vcpkg/vcpkglib.cpp
@@ -169,16 +169,32 @@ namespace vcpkg
fs.rename(updated_listfile_path, listfile_path);
}
- std::vector<StatusParagraph*> get_installed_ports(const StatusParagraphs& status_db)
+ std::vector<InstalledPackageView> get_installed_ports(const StatusParagraphs& status_db)
{
- std::vector<StatusParagraph*> installed_packages;
+ std::map<PackageSpec, InstalledPackageView> ipv_map;
+
+ std::vector<InstalledPackageView> installed_packages;
for (auto&& pgh : status_db)
{
if (!pgh->is_installed()) continue;
- installed_packages.push_back(pgh.get());
+ auto& ipv = ipv_map[pgh->package.spec];
+ if (pgh->package.feature.empty())
+ {
+ ipv.core = pgh.get();
+ }
+ else
+ {
+ ipv.features.emplace_back(pgh.get());
+ }
}
- return installed_packages;
+ for (auto&& ipv : ipv_map)
+ Checks::check_exit(VCPKG_LINE_INFO,
+ ipv.second.core != nullptr,
+ "Database is corrupted: package %s has features but no core paragraph.",
+ ipv.first);
+
+ return Util::fmap(ipv_map, [](auto&& p) -> InstalledPackageView { return std::move(p.second); });
}
std::vector<StatusParagraphAndAssociatedFiles> get_installed_files(const VcpkgPaths& paths,
diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp
index bda2c4174..0903c2d76 100644
--- a/toolsrc/src/vcpkg/vcpkgpaths.cpp
+++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp
@@ -5,407 +5,13 @@
#include <vcpkg/base/system.h>
#include <vcpkg/base/util.h>
#include <vcpkg/build.h>
+#include <vcpkg/commands.h>
#include <vcpkg/metrics.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/vcpkgpaths.h>
namespace vcpkg
{
- static constexpr CStringView V_120 = "v120";
- static constexpr CStringView V_140 = "v140";
- static constexpr CStringView V_141 = "v141";
-
- struct ToolData
- {
- std::array<int, 3> required_version;
- fs::path exe_path;
- std::string url;
- fs::path downloaded_path;
- fs::path tool_dir_path;
- };
-
- static Optional<std::array<int, 3>> parse_version_string(const std::string& version_as_string)
- {
- static const std::regex RE(R"###((\d+)\.(\d+)\.(\d+))###");
-
- std::match_results<std::string::const_iterator> match;
- const auto found = std::regex_search(version_as_string, match, RE);
- if (!found)
- {
- return {};
- }
-
- const int d1 = atoi(match[1].str().c_str());
- const int d2 = atoi(match[2].str().c_str());
- const int d3 = atoi(match[3].str().c_str());
- const std::array<int, 3> result = {d1, d2, d3};
- return result;
- }
-
- static ToolData parse_tool_data_from_xml(const VcpkgPaths& paths, const std::string& tool)
- {
-#if defined(_WIN32)
- static constexpr StringLiteral OS_STRING = "windows";
-#elif defined(__APPLE__)
- static constexpr StringLiteral OS_STRING = "osx";
-#else // assume linux
- static constexpr StringLiteral OS_STRING = "linux";
-#endif
-
- static const fs::path XML_PATH = paths.scripts / "vcpkgTools.xml";
-
- const auto maybe_get_string_inside_tags = [](const std::string& input,
- const std::regex& regex) -> Optional<std::string> {
- std::smatch match;
- const bool has_match = std::regex_search(input.cbegin(), input.cend(), match, regex);
- if (!has_match) return nullopt;
- return match[1];
- };
-
- const auto get_string_inside_tags =
- [](const std::string& input, const std::regex& regex, const std::string& tag_name) -> std::string {
- std::smatch match;
- const bool has_match = std::regex_search(input.cbegin(), input.cend(), match, regex);
- Checks::check_exit(
- VCPKG_LINE_INFO, has_match, "Could not find tag <%s> in %s", tag_name, XML_PATH.generic_string());
-
- return match[1];
- };
-
- static const std::string XML = paths.get_filesystem().read_contents(XML_PATH).value_or_exit(VCPKG_LINE_INFO);
- static const std::regex VERSION_REGEX{R"###(<requiredVersion>([\s\S]*?)</requiredVersion>)###"};
- static const std::regex EXE_RELATIVE_PATH_REGEX{
- Strings::format(R"###(<exeRelativePath>([\s\S]*?)</exeRelativePath>)###")};
- static const std::regex ARCHIVE_RELATIVE_PATH_REGEX{
- Strings::format(R"###(<archiveRelativePath>([\s\S]*?)</archiveRelativePath>)###")};
- static const std::regex URL_REGEX{Strings::format(R"###(<url>([\s\S]*?)</url>)###")};
-
- std::regex tool_regex{
- Strings::format(R"###(<tool[\s]+name="%s"[\s]+os="%s">([\s\S]*?)<\/tool>)###", tool, OS_STRING)};
-
- std::smatch match_tool;
- bool has_match_tool = std::regex_search(XML.cbegin(), XML.cend(), match_tool, tool_regex);
- if (!has_match_tool && OS_STRING == "windows") // Legacy support. Change introduced in vcpkg v0.0.107.
- {
- tool_regex = Strings::format(R"###(<tool[\s]+name="%s">([\s\S]*?)<\/tool>)###", tool);
- has_match_tool = std::regex_search(XML.cbegin(), XML.cend(), match_tool, tool_regex);
- }
- Checks::check_exit(VCPKG_LINE_INFO,
- has_match_tool,
- "Could not find entry for tool [%s] in %s",
- tool,
- XML_PATH.generic_string());
-
- const std::string tool_data_as_string = get_string_inside_tags(XML, tool_regex, tool);
-
- const std::string required_version_as_string =
- get_string_inside_tags(tool_data_as_string, VERSION_REGEX, "requiredVersion");
-
- const std::string url = get_string_inside_tags(tool_data_as_string, URL_REGEX, "url");
-
- const std::string exe_relative_path =
- get_string_inside_tags(tool_data_as_string, EXE_RELATIVE_PATH_REGEX, "exeRelativePath");
-
- auto archive_relative_path = maybe_get_string_inside_tags(tool_data_as_string, ARCHIVE_RELATIVE_PATH_REGEX);
-
- const Optional<std::array<int, 3>> required_version = parse_version_string(required_version_as_string);
- Checks::check_exit(VCPKG_LINE_INFO,
- required_version.has_value(),
- "Could not parse version for tool %s. Version string was: %s",
- tool,
- required_version_as_string);
-
-// Legacy support. Change introduced in vcpkg v0.0.107.
-#if !defined(_WIN32)
- const std::string tool_dir_name = Strings::format("%s-%s", tool, required_version_as_string);
- const fs::path tool_dir_path = paths.downloads / "tools" / tool_dir_name;
- const fs::path exe_path = tool_dir_path / exe_relative_path;
-#else
- const fs::path tool_dir_path;
- const fs::path exe_path = paths.downloads / exe_relative_path;
-#endif
- return ToolData{*required_version.get(),
- exe_path,
- url,
- paths.downloads / archive_relative_path.value_or(exe_relative_path),
- tool_dir_path};
- }
-
- static bool exists_and_has_equal_or_greater_version(const std::string& version_cmd,
- const std::array<int, 3>& expected_version)
- {
- const auto rc = System::cmd_execute_and_capture_output(Strings::format(R"(%s)", version_cmd));
- if (rc.exit_code != 0)
- {
- return false;
- }
-
- const Optional<std::array<int, 3>> v = parse_version_string(rc.output);
- if (!v.has_value())
- {
- return false;
- }
-
- const std::array<int, 3> actual_version = *v.get();
- return (actual_version[0] > expected_version[0] ||
- (actual_version[0] == expected_version[0] && actual_version[1] > expected_version[1]) ||
- (actual_version[0] == expected_version[0] && actual_version[1] == expected_version[1] &&
- actual_version[2] >= expected_version[2]));
- }
-
- static Optional<fs::path> find_if_has_equal_or_greater_version(const std::vector<fs::path>& candidate_paths,
- const std::string& version_check_arguments,
- const std::array<int, 3>& expected_version)
- {
- auto it = Util::find_if(candidate_paths, [&](const fs::path& p) {
- const std::string cmd = Strings::format(R"("%s" %s)", p.u8string(), version_check_arguments);
- return exists_and_has_equal_or_greater_version(cmd, expected_version);
- });
-
- if (it != candidate_paths.cend())
- {
- return std::move(*it);
- }
-
- return nullopt;
- }
-
- static std::vector<std::string> keep_data_lines(const std::string& data_blob)
- {
- static const std::regex DATA_LINE_REGEX(R"(<sol>::(.+?)(?=::<eol>))");
-
- std::vector<std::string> data_lines;
-
- const std::sregex_iterator it(data_blob.cbegin(), data_blob.cend(), DATA_LINE_REGEX);
- const std::sregex_iterator end;
- for (std::sregex_iterator i = it; i != end; ++i)
- {
- const std::smatch match = *i;
- data_lines.push_back(match[1].str());
- }
-
- return data_lines;
- }
-
- static void extract_archive(const VcpkgPaths& paths, const fs::path& archive, const fs::path& to_path)
- {
- Files::Filesystem& fs = paths.get_filesystem();
- const fs::path to_path_partial = to_path.u8string() + ".partial";
-
- std::error_code ec;
- fs.remove_all(to_path_partial, ec);
- fs.create_directories(to_path_partial, ec);
-
- const auto ext = archive.extension();
- if (ext == ".gz" && ext.extension() != ".tar")
- {
- const auto code = System::cmd_execute(
- Strings::format(R"(cd '%s' && tar xzf '%s')", to_path_partial.u8string(), archive.u8string()));
- Checks::check_exit(VCPKG_LINE_INFO, code == 0, "tar failed while extracting %s", archive.u8string());
- }
- else if (ext == ".zip")
- {
- const auto code = System::cmd_execute(
- Strings::format(R"(cd '%s' && unzip -qqo '%s')", to_path_partial.u8string(), archive.u8string()));
- Checks::check_exit(VCPKG_LINE_INFO, code == 0, "unzip failed while extracting %s", archive.u8string());
- }
- else
- {
- Checks::exit_with_message(VCPKG_LINE_INFO, "Unexpected archive extension: %s", ext.u8string());
- }
-
- fs.rename(to_path_partial, to_path);
- }
-
- static fs::path fetch_tool(const VcpkgPaths& paths, const std::string& tool_name, const ToolData& tool_data)
- {
- const auto& fs = paths.get_filesystem();
- const fs::path& scripts_folder = paths.scripts;
- const std::array<int, 3>& version = tool_data.required_version;
-
- const std::string version_as_string = Strings::format("%d.%d.%d", version[0], version[1], version[2]);
- System::println("A suitable version of %s was not found (required v%s). Downloading portable %s v%s...",
- tool_name,
- version_as_string,
- tool_name,
- version_as_string);
-#if defined(_WIN32)
- const fs::path script = scripts_folder / "fetchtool.ps1";
- const std::string title = Strings::format(
- "Fetching %s version %s (No sufficient installed version was found)", tool_name, version_as_string);
- const System::PowershellParameter tool_param("tool", tool_name);
- const std::string output = System::powershell_execute_and_capture_output(title, script, {tool_param});
-
- const std::vector<std::string> tool_path = keep_data_lines(output);
- Checks::check_exit(VCPKG_LINE_INFO, tool_path.size() == 1, "Expected tool path, but got %s", output);
-
- const fs::path actual_downloaded_path = Strings::trim(std::string{tool_path.at(0)});
- const fs::path& expected_downloaded_path = tool_data.exe_path;
- std::error_code ec;
- const auto eq = fs::stdfs::equivalent(expected_downloaded_path, actual_downloaded_path, ec);
- Checks::check_exit(VCPKG_LINE_INFO,
- eq && !ec,
- "Expected tool downloaded path to be %s, but was %s",
- expected_downloaded_path.u8string(),
- actual_downloaded_path.u8string());
- return actual_downloaded_path;
-#else
- if (!fs.exists(tool_data.downloaded_path))
- {
- auto code = System::cmd_execute(Strings::format(
- R"(curl -L '%s' --create-dirs --output '%s')", tool_data.url, tool_data.downloaded_path));
- Checks::check_exit(VCPKG_LINE_INFO, code == 0, "curl failed while downloading %s", tool_data.url);
- }
-
- System::println("Extracting %s...", tool_name);
- extract_archive(paths, tool_data.downloaded_path, tool_data.tool_dir_path);
- System::println("Extracting %s... done.", tool_name);
-
- Checks::check_exit(VCPKG_LINE_INFO,
- fs.exists(tool_data.exe_path),
- "Expected %s to exist after extracting",
- tool_data.exe_path);
-
- return tool_data.exe_path;
-#endif
- }
-
- static fs::path get_cmake_path(const VcpkgPaths& paths)
- {
- std::vector<fs::path> candidate_paths;
-#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__)
- static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "cmake");
- candidate_paths.push_back(TOOL_DATA.exe_path);
-#else
- static const ToolData TOOL_DATA = ToolData{{3, 5, 1}, ""};
-#endif
- static const std::string VERSION_CHECK_ARGUMENTS = "--version";
-
- const std::vector<fs::path> from_path = Files::find_from_PATH("cmake");
- candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
-
- const auto& program_files = System::get_program_files_platform_bitness();
- if (const auto pf = program_files.get()) candidate_paths.push_back(*pf / "CMake" / "bin" / "cmake.exe");
- const auto& program_files_32_bit = System::get_program_files_32_bit();
- if (const auto pf = program_files_32_bit.get()) candidate_paths.push_back(*pf / "CMake" / "bin" / "cmake.exe");
-
- const Optional<fs::path> path =
- find_if_has_equal_or_greater_version(candidate_paths, VERSION_CHECK_ARGUMENTS, TOOL_DATA.required_version);
- if (const auto p = path.get())
- {
- return *p;
- }
-
- return fetch_tool(paths, "cmake", TOOL_DATA);
- }
-
- static fs::path get_7za_path(const VcpkgPaths& paths)
- {
-#if defined(_WIN32)
- static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "7zip");
- if (!paths.get_filesystem().exists(TOOL_DATA.exe_path))
- {
- return fetch_tool(paths, "7zip", TOOL_DATA);
- }
- return TOOL_DATA.exe_path;
-#else
- Checks::exit_with_message(VCPKG_LINE_INFO, "Cannot download 7zip for non-Windows platforms.");
-#endif
- }
-
- static fs::path get_ninja_path(const VcpkgPaths& paths)
- {
- static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "ninja");
-
- std::vector<fs::path> candidate_paths;
- candidate_paths.push_back(TOOL_DATA.exe_path);
- const std::vector<fs::path> from_path = Files::find_from_PATH("ninja");
- candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
-
- auto path = find_if_has_equal_or_greater_version(candidate_paths, "--version", TOOL_DATA.required_version);
- if (const auto p = path.get())
- {
- return *p;
- }
-
- return fetch_tool(paths, "ninja", TOOL_DATA);
- }
-
- static fs::path get_nuget_path(const VcpkgPaths& paths)
- {
- static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "nuget");
-
- std::vector<fs::path> candidate_paths;
- candidate_paths.push_back(TOOL_DATA.exe_path);
- const std::vector<fs::path> from_path = Files::find_from_PATH("nuget");
- candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
-
- auto path = find_if_has_equal_or_greater_version(candidate_paths, "", TOOL_DATA.required_version);
- if (const auto p = path.get())
- {
- return *p;
- }
-
- return fetch_tool(paths, "nuget", TOOL_DATA);
- }
-
- static fs::path get_git_path(const VcpkgPaths& paths)
- {
-#if defined(_WIN32)
- static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "git");
-#else
- static const ToolData TOOL_DATA = ToolData{{2, 7, 4}, ""};
-#endif
- static const std::string VERSION_CHECK_ARGUMENTS = "--version";
-
- std::vector<fs::path> candidate_paths;
-#if defined(_WIN32)
- candidate_paths.push_back(TOOL_DATA.exe_path);
-#endif
- const std::vector<fs::path> from_path = Files::find_from_PATH("git");
- candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
-
- const auto& program_files = System::get_program_files_platform_bitness();
- if (const auto pf = program_files.get()) candidate_paths.push_back(*pf / "git" / "cmd" / "git.exe");
- const auto& program_files_32_bit = System::get_program_files_32_bit();
- if (const auto pf = program_files_32_bit.get()) candidate_paths.push_back(*pf / "git" / "cmd" / "git.exe");
-
- const Optional<fs::path> path =
- find_if_has_equal_or_greater_version(candidate_paths, VERSION_CHECK_ARGUMENTS, TOOL_DATA.required_version);
- if (const auto p = path.get())
- {
- return *p;
- }
-
- return fetch_tool(paths, "git", TOOL_DATA);
- }
-
- static fs::path get_ifw_installerbase_path(const VcpkgPaths& paths)
- {
- static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "installerbase");
-
- static const std::string VERSION_CHECK_ARGUMENTS = "--framework-version";
-
- std::vector<fs::path> candidate_paths;
- candidate_paths.push_back(TOOL_DATA.exe_path);
- // TODO: Uncomment later
- // const std::vector<fs::path> from_path = Files::find_from_PATH("installerbase");
- // candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
- // candidate_paths.push_back(fs::path(System::get_environment_variable("HOMEDRIVE").value_or("C:")) / "Qt" /
- // "Tools" / "QtInstallerFramework" / "3.1" / "bin" / "installerbase.exe");
- // candidate_paths.push_back(fs::path(System::get_environment_variable("HOMEDRIVE").value_or("C:")) / "Qt" /
- // "QtIFW-3.1.0" / "bin" / "installerbase.exe");
-
- const Optional<fs::path> path =
- find_if_has_equal_or_greater_version(candidate_paths, VERSION_CHECK_ARGUMENTS, TOOL_DATA.required_version);
- if (const auto p = path.get())
- {
- return *p;
- }
-
- return fetch_tool(paths, "installerbase", TOOL_DATA);
- }
-
Expected<VcpkgPaths> VcpkgPaths::create(const fs::path& vcpkg_root_dir, const std::string& default_vs_path)
{
std::error_code ec;
@@ -477,266 +83,15 @@ namespace vcpkg
bool VcpkgPaths::is_valid_triplet(const Triplet& t) const
{
- auto it = Util::find_if(this->get_available_triplets(),
- [&](auto&& available_triplet) { return t.canonical_name() == available_triplet; });
+ const auto it = Util::find_if(this->get_available_triplets(), [&](auto&& available_triplet) {
+ return t.canonical_name() == available_triplet;
+ });
return it != this->get_available_triplets().cend();
}
- const fs::path& VcpkgPaths::get_7za_exe() const
- {
- return this->_7za_exe.get_lazy([this]() { return get_7za_path(*this); });
- }
-
- const fs::path& VcpkgPaths::get_cmake_exe() const
- {
- return this->cmake_exe.get_lazy([this]() { return get_cmake_path(*this); });
- }
-
- const fs::path& VcpkgPaths::get_git_exe() const
- {
- return this->git_exe.get_lazy([this]() { return get_git_path(*this); });
- }
-
- const fs::path& VcpkgPaths::get_ninja_exe() const
- {
- return this->ninja_exe.get_lazy([this]() { return get_ninja_path(*this); });
- }
-
- const fs::path& VcpkgPaths::get_nuget_exe() const
- {
- return this->nuget_exe.get_lazy([this]() { return get_nuget_path(*this); });
- }
-
- const fs::path& VcpkgPaths::get_ifw_installerbase_exe() const
- {
- return this->ifw_installerbase_exe.get_lazy([this]() { return get_ifw_installerbase_path(*this); });
- }
-
- const fs::path& VcpkgPaths::get_ifw_binarycreator_exe() const
- {
- return this->ifw_binarycreator_exe.get_lazy(
- [this]() { return get_ifw_installerbase_exe().parent_path() / "binarycreator.exe"; });
- }
-
- const fs::path& VcpkgPaths::get_ifw_repogen_exe() const
- {
- return this->ifw_repogen_exe.get_lazy(
- [this]() { return get_ifw_installerbase_exe().parent_path() / "repogen.exe"; });
- }
-
- struct VisualStudioInstance
- {
- fs::path root_path;
- std::string version;
- std::string release_type;
- std::string preference_weight; // Mostly unused, just for verification that order is as intended
-
- std::string major_version() const { return version.substr(0, 2); }
- };
-
- static std::vector<VisualStudioInstance> get_visual_studio_instances(const VcpkgPaths& paths)
- {
- const fs::path script = paths.scripts / "findVisualStudioInstallationInstances.ps1";
- const std::string output =
- System::powershell_execute_and_capture_output("Detecting Visual Studio instances", script);
-
- const std::vector<std::string> instances_as_strings = keep_data_lines(output);
- Checks::check_exit(VCPKG_LINE_INFO,
- !instances_as_strings.empty(),
- "Could not detect any Visual Studio instances.\n"
- "Powershell script:\n"
- " %s\n"
- "returned:\n"
- "%s",
- script.generic_string(),
- output);
-
- std::vector<VisualStudioInstance> instances;
- for (const std::string& instance_as_string : instances_as_strings)
- {
- const std::vector<std::string> split = Strings::split(instance_as_string, "::");
- Checks::check_exit(VCPKG_LINE_INFO,
- split.size() == 4,
- "Invalid Visual Studio instance format.\n"
- "Expected: PreferenceWeight::ReleaseType::Version::PathToVisualStudio\n"
- "Actual : %s\n",
- instance_as_string);
- instances.push_back({split.at(3), split.at(2), split.at(1), split.at(0)});
- }
-
- return instances;
- }
-
- static std::vector<Toolset> find_toolset_instances(const VcpkgPaths& paths)
+ const fs::path& VcpkgPaths::get_tool_exe(const std::string& tool) const
{
- using CPU = System::CPUArchitecture;
-
- const auto& fs = paths.get_filesystem();
-
- // Note: this will contain a mix of vcvarsall.bat locations and dumpbin.exe locations.
- std::vector<fs::path> paths_examined;
-
- std::vector<Toolset> found_toolsets;
- std::vector<Toolset> excluded_toolsets;
-
- const std::vector<VisualStudioInstance> vs_instances = get_visual_studio_instances(paths);
- const bool v140_is_available = Util::find_if(vs_instances, [&](const VisualStudioInstance& vs_instance) {
- return vs_instance.major_version() == "14";
- }) != vs_instances.cend();
-
- for (const VisualStudioInstance& vs_instance : vs_instances)
- {
- const std::string major_version = vs_instance.major_version();
- if (major_version == "15")
- {
- const fs::path vc_dir = vs_instance.root_path / "VC";
-
- // Skip any instances that do not have vcvarsall.
- const fs::path vcvarsall_dir = vc_dir / "Auxiliary" / "Build";
- const fs::path vcvarsall_bat = vcvarsall_dir / "vcvarsall.bat";
- paths_examined.push_back(vcvarsall_bat);
- if (!fs.exists(vcvarsall_bat)) continue;
-
- // Get all supported architectures
- std::vector<ToolsetArchOption> supported_architectures;
- if (fs.exists(vcvarsall_dir / "vcvars32.bat"))
- supported_architectures.push_back({"x86", CPU::X86, CPU::X86});
- if (fs.exists(vcvarsall_dir / "vcvars64.bat"))
- supported_architectures.push_back({"amd64", CPU::X64, CPU::X64});
- if (fs.exists(vcvarsall_dir / "vcvarsx86_amd64.bat"))
- supported_architectures.push_back({"x86_amd64", CPU::X86, CPU::X64});
- if (fs.exists(vcvarsall_dir / "vcvarsx86_arm.bat"))
- supported_architectures.push_back({"x86_arm", CPU::X86, CPU::ARM});
- if (fs.exists(vcvarsall_dir / "vcvarsx86_arm64.bat"))
- supported_architectures.push_back({"x86_arm64", CPU::X86, CPU::ARM64});
- if (fs.exists(vcvarsall_dir / "vcvarsamd64_x86.bat"))
- supported_architectures.push_back({"amd64_x86", CPU::X64, CPU::X86});
- if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm.bat"))
- supported_architectures.push_back({"amd64_arm", CPU::X64, CPU::ARM});
- if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm64.bat"))
- supported_architectures.push_back({"amd64_arm64", CPU::X64, CPU::ARM64});
-
- // Locate the "best" MSVC toolchain version
- const fs::path msvc_path = vc_dir / "Tools" / "MSVC";
- std::vector<fs::path> msvc_subdirectories = fs.get_files_non_recursive(msvc_path);
- Util::unstable_keep_if(msvc_subdirectories,
- [&fs](const fs::path& path) { return fs.is_directory(path); });
-
- // Sort them so that latest comes first
- std::sort(
- msvc_subdirectories.begin(),
- msvc_subdirectories.end(),
- [](const fs::path& left, const fs::path& right) { return left.filename() > right.filename(); });
-
- for (const fs::path& subdir : msvc_subdirectories)
- {
- const fs::path dumpbin_path = subdir / "bin" / "HostX86" / "x86" / "dumpbin.exe";
- paths_examined.push_back(dumpbin_path);
- if (fs.exists(dumpbin_path))
- {
- const Toolset v141toolset = Toolset{
- vs_instance.root_path, dumpbin_path, vcvarsall_bat, {}, V_141, supported_architectures};
-
- auto english_language_pack = dumpbin_path.parent_path() / "1033";
-
- if (!fs.exists(english_language_pack))
- {
- excluded_toolsets.push_back(v141toolset);
- break;
- }
-
- found_toolsets.push_back(v141toolset);
-
- if (v140_is_available)
- {
- const Toolset v140toolset = Toolset{vs_instance.root_path,
- dumpbin_path,
- vcvarsall_bat,
- {"-vcvars_ver=14.0"},
- V_140,
- supported_architectures};
- found_toolsets.push_back(v140toolset);
- }
-
- break;
- }
- }
-
- continue;
- }
-
- if (major_version == "14" || major_version == "12")
- {
- const fs::path vcvarsall_bat = vs_instance.root_path / "VC" / "vcvarsall.bat";
-
- paths_examined.push_back(vcvarsall_bat);
- if (fs.exists(vcvarsall_bat))
- {
- const fs::path vs_dumpbin_exe = vs_instance.root_path / "VC" / "bin" / "dumpbin.exe";
- paths_examined.push_back(vs_dumpbin_exe);
-
- const fs::path vs_bin_dir = vcvarsall_bat.parent_path() / "bin";
- std::vector<ToolsetArchOption> supported_architectures;
- if (fs.exists(vs_bin_dir / "vcvars32.bat"))
- supported_architectures.push_back({"x86", CPU::X86, CPU::X86});
- if (fs.exists(vs_bin_dir / "amd64\\vcvars64.bat"))
- supported_architectures.push_back({"x64", CPU::X64, CPU::X64});
- if (fs.exists(vs_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat"))
- supported_architectures.push_back({"x86_amd64", CPU::X86, CPU::X64});
- if (fs.exists(vs_bin_dir / "x86_arm\\vcvarsx86_arm.bat"))
- supported_architectures.push_back({"x86_arm", CPU::X86, CPU::ARM});
- if (fs.exists(vs_bin_dir / "amd64_x86\\vcvarsamd64_x86.bat"))
- supported_architectures.push_back({"amd64_x86", CPU::X64, CPU::X86});
- if (fs.exists(vs_bin_dir / "amd64_arm\\vcvarsamd64_arm.bat"))
- supported_architectures.push_back({"amd64_arm", CPU::X64, CPU::ARM});
-
- if (fs.exists(vs_dumpbin_exe))
- {
- const Toolset toolset = {vs_instance.root_path,
- vs_dumpbin_exe,
- vcvarsall_bat,
- {},
- major_version == "14" ? V_140 : V_120,
- supported_architectures};
-
- auto english_language_pack = vs_dumpbin_exe.parent_path() / "1033";
-
- if (!fs.exists(english_language_pack))
- {
- excluded_toolsets.push_back(toolset);
- break;
- }
-
- found_toolsets.push_back(toolset);
- }
- }
- }
- }
-
- if (!excluded_toolsets.empty())
- {
- System::println(
- System::Color::warning,
- "Warning: The following VS instances are excluded because the English language pack is unavailable.");
- for (const Toolset& toolset : excluded_toolsets)
- {
- System::println(" %s", toolset.visual_studio_root_path.u8string());
- }
- System::println(System::Color::warning, "Please install the English language pack.");
- }
-
- if (found_toolsets.empty())
- {
- System::println(System::Color::error, "Could not locate a complete toolset.");
- System::println("The following paths were examined:");
- for (const fs::path& path : paths_examined)
- {
- System::println(" %s", path.u8string());
- }
- Checks::exit_fail(VCPKG_LINE_INFO);
- }
-
- return found_toolsets;
+ return this->tool_paths.get_lazy(tool, [&]() { return Commands::Fetch::get_tool_path(*this, tool); });
}
const Toolset& VcpkgPaths::get_toolset(const Build::PreBuildInfo& prebuildinfo) const
@@ -760,7 +115,7 @@ namespace vcpkg
// Invariant: toolsets are non-empty and sorted with newest at back()
const std::vector<Toolset>& vs_toolsets =
- this->toolsets.get_lazy([this]() { return find_toolset_instances(*this); });
+ this->toolsets.get_lazy([this]() { return Commands::Fetch::find_toolset_instances(*this); });
std::vector<const Toolset*> candidates = Util::element_pointers(vs_toolsets);
const auto tsv = prebuildinfo.platform_toolset.get();
diff --git a/toolsrc/src/vcpkg/versiont.cpp b/toolsrc/src/vcpkg/versiont.cpp
index 0d4a39255..d20e6b577 100644
--- a/toolsrc/src/vcpkg/versiont.cpp
+++ b/toolsrc/src/vcpkg/versiont.cpp
@@ -5,7 +5,7 @@
namespace vcpkg
{
- VersionT::VersionT() : value("0.0.0") {}
+ VersionT::VersionT() noexcept : value("0.0.0") {}
VersionT::VersionT(std::string&& value) : value(std::move(value)) {}
VersionT::VersionT(const std::string& value) : value(value) {}
const std::string& VersionT::to_string() const { return value; }
@@ -13,7 +13,7 @@ namespace vcpkg
bool operator!=(const VersionT& left, const VersionT& right) { return left.to_string() != right.to_string(); }
std::string to_printf_arg(const VersionT& version) { return version.to_string(); }
- VersionDiff::VersionDiff() : left(), right() {}
+ VersionDiff::VersionDiff() noexcept : left(), right() {}
VersionDiff::VersionDiff(const VersionT& left, const VersionT& right) : left(left), right(right) {}
std::string VersionDiff::to_string() const
diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj
index ae699a840..871d0c58d 100644
--- a/toolsrc/vcpkglib/vcpkglib.vcxproj
+++ b/toolsrc/vcpkglib/vcpkglib.vcxproj
@@ -214,6 +214,7 @@
<ClCompile Include="..\src\vcpkg\commands.edit.cpp" />
<ClCompile Include="..\src\vcpkg\commands.env.cpp" />
<ClCompile Include="..\src\vcpkg\commands.exportifw.cpp" />
+ <ClCompile Include="..\src\vcpkg\commands.fetch.cpp" />
<ClCompile Include="..\src\vcpkg\commands.hash.cpp" />
<ClCompile Include="..\src\vcpkg\commands.import.cpp" />
<ClCompile Include="..\src\vcpkg\commands.integrate.cpp" />
diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters
index 74bfebf3b..6a23a09b5 100644
--- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters
+++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters
@@ -198,6 +198,9 @@
<ClCompile Include="..\src\vcpkg\commands.upgrade.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vcpkg\commands.fetch.cpp">
+ <Filter>Source Files\vcpkg</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\pch.h">