diff options
195 files changed, 4610 insertions, 1600 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 52357ed6f..f591f4bae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,69 @@ +vcpkg (0.0.85) +-------------- + * Add ports: + - ccfits 2.5 + - highfive 1.3 + - lzfse 1.0 + - pangolin 0.5 + - rhash 1.3.5 + - speexdsp 1.2rc3-1 + - unrar 5.5.8 + * Update ports: + - assimp 4.0.0 -> 4.0.0-1 + - catch 1.9.7 -> 1.10.0 + - ctemplate 2017-06-23-44b7c5b918a08ad561c63e9d28beecb40c10ebca -> 2017-06-23-44b7c5-2 + - curl 7.55.0 -> 7.55.1 + - ecm 5.32.0 -> 5.37.0 + - expat 2.1.1-1 -> 2.2.4-1 + - ffmpeg 3.2.4-3 -> 3.3.3 + - gl2ps OpenGL to PostScript Printing Library -> 1.4.0 + - jsoncpp 1.7.7 -> 1.8.1 + - libp7-baical 4.1 -> 4.4-1 + - libpng 1.6.31 -> 1.6.32 + - libraw 0.18.2-2 -> 0.18.2-3 + - libsigcpp 2.10 -> 2.99 + - snappy 1.1.6-be6dc3d -> 1.1.7 + * `vcpkg edit`: Add new option `--builtrees`; opens editor in buildtrees directory for examining build issues + * Improve Windows SDK support (contract version detection) + * Improve handling for non-ascii environments + * Fixes and improvements in the `vcpkg` tool itself + +-- vcpkg team <vcpkg@microsoft.com> SUN, 27 Aug 2017 22:00:00 -0800 + + +vcpkg (0.0.84) +-------------- + * Add ports: + - cfitsio 3.410 + - chmlib 0.40 + - gl2ps OpenGL to PostScript Printing Library + - libharu 2017-08-15-d84867ebf9f-1 + - mpfr 3.1.5 + - sophus 1.0.0 + * Update ports: + - allegro5 5.2.1.0 -> 5.2.2.0 + - blaze 3.1 -> 3.2 + - boost 1.64-5 -> 1.65 + - curl 7.51.0-3 -> 7.55.0 + - flann 1.9.1-4 -> 1.9.1-5 + - gdal 1.11.3-4 -> 1.11.3-5 + - glew 2.0.0-2 -> 2.1.0 + - lcms 2.8-1 -> 2.8-2 + - libogg 2017-07-27-cab46b19847 -> 1.3.2-cab46b1-2 + - libuv 1.13.1 -> 1.14.0 + - lz4 1.7.5 -> 1.8.0 + - pcre2 10.23 -> 10.30 + - spdlog 0.13.0 -> 0.14.0 + - zstd 1.3.0 -> 1.3.1 + * Bump required version & auto-downloaded version of `git` to 2.14.1 (due to a security vulnerability) + * Show more information when there are issues acquiring `vcpkg` tool dependencies (`git`, `cmake`, `nuget`) + * Remove download prompts for cmake/git. The prompts were causing a lot of issues for users and especially CI builds + * `vcpkg edit`: Fix detection of 64-bit VSCode + * Fixes and improvements in the `vcpkg` tool itself + +-- vcpkg team <vcpkg@microsoft.com> TUE, 22 Aug 2017 13:00:00 -0800 + + vcpkg (0.0.83) -------------- * Add ports: diff --git a/ports/ace/portfile.cmake b/ports/ace/portfile.cmake index a6293fa24..6763cc370 100644 --- a/ports/ace/portfile.cmake +++ b/ports/ace/portfile.cmake @@ -5,9 +5,9 @@ endif() include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ACE_wrappers/ace) vcpkg_download_distfile(ARCHIVE - URLS "http://download.dre.vanderbilt.edu/previous_versions/ACE-6.4.3.zip" - FILENAME "ACE-6.4.3.zip" - SHA512 1d700733ec617559f338e908b2343c66c0c856bfac7bd2230f18290970fe3bc25a394839a9d66fa74f6edd239a70f9d6cf5746585ed796fbe9f8aeca90eab84e + URLS "http://download.dre.vanderbilt.edu/previous_versions/ACE-6.4.4.zip" + FILENAME "ACE-6.4.4.zip" + SHA512 82628a73b736a14b3ee33fb859e26370ffd7df88bda4890fe490736160d3ce393f7e61183cd8cd7a91a83bc31c4bd263aa887168543f9f89fde080dc3650a4ed ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/allegro5/CONTROL b/ports/allegro5/CONTROL index 2d3003935..4bb51ae4e 100644 --- a/ports/allegro5/CONTROL +++ b/ports/allegro5/CONTROL @@ -1,4 +1,4 @@ Source: allegro5 -Version: 5.2.1.0 +Version: 5.2.2.0 Description: Allegro is a cross-platform library mainly aimed at video game and multimedia programming. It handles common, low-level tasks such as creating windows, accepting user input, loading data, drawing images, playing sounds, etc. and generally abstracting away the underlying platform. However, Allegro is not a game engine: you are free to design and structure your program as you like. -Build-Depends: opengl, zlib, freetype, libogg, libvorbis, libflac, openal-soft, libpng, bzip2, physfs, libtheora
\ No newline at end of file +Build-Depends: opengl, zlib, freetype, libogg, libvorbis, libflac, openal-soft, libpng, bzip2, physfs, libtheora, opus, opusfile
\ No newline at end of file diff --git a/ports/allegro5/fix-pdb-install.patch b/ports/allegro5/fix-pdb-install.patch index ef964b9f3..714c69cf5 100644 --- a/ports/allegro5/fix-pdb-install.patch +++ b/ports/allegro5/fix-pdb-install.patch @@ -1,3 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 72348fe..c6fbecb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1010,14 +1010,9 @@ else() + set(PKG_CONFIG_FILES allegro ${ADDON_PKG_CONFIG_FILES}) + endif(WANT_MONOLITH) + +-# Install pkg-config files on Unix, and when cross-compiling on Unix. ++# Install pkg-config files + +-if(UNIX AND NOT WANT_FRAMEWORKS AND NOT IPHONE) +- set(INSTALL_PKG_CONFIG_FILES true) +-endif() +-if(CMAKE_CROSSCOMPILING AND CMAKE_HOST_UNIX) +- set(INSTALL_PKG_CONFIG_FILES true) +-endif() ++set(INSTALL_PKG_CONFIG_FILES true) + + if(INSTALL_PKG_CONFIG_FILES) + append_lib_type_suffix(lib_type) diff --git a/cmake/Common.cmake b/cmake/Common.cmake index 782196f..de29535 100644 --- a/cmake/Common.cmake diff --git a/ports/allegro5/portfile.cmake b/ports/allegro5/portfile.cmake index d2801d5d4..d4f74a569 100644 --- a/ports/allegro5/portfile.cmake +++ b/ports/allegro5/portfile.cmake @@ -11,19 +11,19 @@ # include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/allegro5-7d8892a9278c57f2d8bb1e555f9ec59cf9ed4f73) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/allegro5-e8b209bc20a60224859eb8a0cae082bd20d32ed1) vcpkg_from_github( OUT_SOURCE_PATH ${SOURCE_PATH} REPO liballeg/allegro5 - REF 7d8892a9278c57f2d8bb1e555f9ec59cf9ed4f73 - SHA512 b1531fa2f22023ecd4e053d03d1c54bf0b94aa3af004a3a06245c4d8278fea64e9d354467873ebd665301903d954795fed88e2467c88441f39c273e7e0d87d6e + REF e8b209bc20a60224859eb8a0cae082bd20d32ed1 + SHA512 50b30d4b539bd4a2488d2b33e9fbfc6fdfd340039d9086993a5719bab3cb020ee6fe7f6d3578755a52c8aab9816d25cd74710ce93b0b374a2f97620b6138419d HEAD_REF master ) if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - set(ALLEGRO_USE_STATIC -DSHARED=ON) + set(ALLEGRO_USE_STATIC ON) else() - set(ALLEGRO_USE_STATIC -DSHARED=OFF) + set(ALLEGRO_USE_STATIC OFF) endif() vcpkg_apply_patches( @@ -39,7 +39,7 @@ vcpkg_configure_cmake( -DWANT_DOCS=OFF -DALLEGRO_SDL=OFF -DWANT_DEMO=OFF - ${ALLEGRO_USE_STATIC} + -DSHARED=${ALLEGRO_USE_STATIC} -DWANT_EXAMPLES=OFF -DWANT_CURL_EXAMPLE=OFF -DWANT_TESTS=OFF @@ -63,7 +63,7 @@ vcpkg_configure_cmake( -DWANT_OPENAL=ON -DWANT_OPENGL=ON -DWANT_OPENSL=OFF # Not yet available on vcpkg - -DWANT_OPUS=OFF # opus is available on vcpkg, but opusfile isn't + -DWANT_OPUS=ON -DWANT_PHYSFS=ON -DWANT_POPUP_EXAMPLES=OFF -DWANT_PRIMITIVES=ON diff --git a/ports/assimp/CONTROL b/ports/assimp/CONTROL index 2e2b88692..9e036df33 100644 --- a/ports/assimp/CONTROL +++ b/ports/assimp/CONTROL @@ -1,4 +1,4 @@ Source: assimp -Version: 4.0.0 +Version: 4.0.0-1 Description: The Open Asset import library Build-Depends: zlib diff --git a/ports/assimp/const-compare-worditerator.patch b/ports/assimp/const-compare-worditerator.patch new file mode 100644 index 000000000..9b892ed82 --- /dev/null +++ b/ports/assimp/const-compare-worditerator.patch @@ -0,0 +1,15 @@ +diff --git a/code/X3DImporter.cpp b/code/X3DImporter.cpp +index 1117735..669f46f 100644 +--- a/code/X3DImporter.cpp ++++ b/code/X3DImporter.cpp +@@ -95,8 +95,8 @@ struct WordIterator: public std::iterator<std::input_iterator_tag, const char*> + end_ = other.end_; + return *this; + } +- bool operator==(WordIterator &other) const { return start_ == other.start_; } +- bool operator!=(WordIterator &other) const { return start_ != other.start_; } ++ bool operator==(const WordIterator &other) const { return start_ == other.start_; } ++ bool operator!=(const WordIterator &other) const { return start_ != other.start_; } + WordIterator &operator++() { + start_ += strcspn(start_, whitespace); + start_ += strspn(start_, whitespace); diff --git a/ports/assimp/portfile.cmake b/ports/assimp/portfile.cmake index 0da9cc2a8..14564e65a 100644 --- a/ports/assimp/portfile.cmake +++ b/ports/assimp/portfile.cmake @@ -8,6 +8,11 @@ vcpkg_from_github( HEAD_REF master ) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/const-compare-worditerator.patch +) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS -DASSIMP_BUILD_TESTS=False diff --git a/ports/blaze/CONTROL b/ports/blaze/CONTROL index dd1b065ef..ca7923ffc 100644 --- a/ports/blaze/CONTROL +++ b/ports/blaze/CONTROL @@ -1,3 +1,3 @@ Source: blaze -Version: 3.1 +Version: 3.2 Description: Blaze is an open-source, high-performance C++ math library for dense and sparse arithmetic. diff --git a/ports/blaze/portfile.cmake b/ports/blaze/portfile.cmake index cf268451c..3225e99d4 100644 --- a/ports/blaze/portfile.cmake +++ b/ports/blaze/portfile.cmake @@ -1,11 +1,11 @@ #header-only library include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/blaze-3.1) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/blaze-3.2) vcpkg_download_distfile(ARCHIVE - URLS "https://bitbucket.org/blaze-lib/blaze/downloads/blaze-3.1.tar.gz" - FILENAME "blaze-3.1.tar.gz" - SHA512 fe03a7615d4105d6a869cfd69b3db3165b838eff53cdff7adbbd5ae9d753aa009bbab50925463c6704f9530a4c4ad5605e373b3cbaee96ca982a474a665ed756 + URLS "https://bitbucket.org/blaze-lib/blaze/downloads/blaze-3.2.tar.gz" + FILENAME "blaze-3.2.tar.gz" + SHA512 33d2bb0a49a33e71c88a45ab9e8418160c09b877b3ebe5ff7aa48ec0973e28e8a282374604d56f1b5cf2722946e4ca84aa2b401a341240a2ab9debd72505148e ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/boost/CONTROL b/ports/boost/CONTROL index 964665b96..8200d54d1 100644 --- a/ports/boost/CONTROL +++ b/ports/boost/CONTROL @@ -1,4 +1,4 @@ Source: boost -Version: 1.64-5 +Version: 1.65-1 Description: Peer-reviewed portable C++ source libraries Build-Depends: zlib, bzip2 diff --git a/ports/boost/portfile.cmake b/ports/boost/portfile.cmake index 8db544237..3ed0ed9c5 100644 --- a/ports/boost/portfile.cmake +++ b/ports/boost/portfile.cmake @@ -1,17 +1,26 @@ include(vcpkg_common_functions) -set(VERSION 1_64) +set(VERSION 1_65) +set(VERSION2 1.65.0) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/boost_${VERSION}_0) ###################### # Acquire and arrange sources ###################### vcpkg_download_distfile(ARCHIVE_FILE - URLS "https://sourceforge.net/projects/boost/files/boost/1.64.0/boost_${VERSION}_0.tar.bz2" - FILENAME "boost_${VERSION}_0.tar.bz2" - SHA512 68477f148f61be617552ef48559c5c2cb90d42264cabd6d5e87215d0d5024b48fca27c4afcfc1f77e490c6220d44fb1abdf0a53703867a2e4132c2857f69fedf + URLS "https://sourceforge.net/projects/boost/files/boost/${VERSION2}/boost_${VERSION}_0.7z" "http://dl.bintray.com/boostorg/release/${VERSION2}/source/boost_${VERSION}_0.7z" + FILENAME "boost_${VERSION}_0.7z" + SHA512 41909136371b3aac53fc06ae92404bd52adde4cbda9337886433d197059105208b67331abf6ca8dc45e4d28679733b5c01fc701cba17516c7134c97785cc5f7e ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) +# apply boost combined hotfix +vcpkg_download_distfile(HOTFIX_PATCH + URLS "https://raw.githubusercontent.com/boostorg/website/6c3b630f2c621b78d983e882cefae7ffdf8383b8/patches/1_65_0/boost_1_65_0.patch" + FILENAME "boost_1_65_0.patch" + SHA512 8f9e654d0ee4d30b38b62b99ebfbbdeccd156c168656e1256b846bd21a3cb36d675396bd48d3f7a18d6cffba80932d40590d12e7ca1a4b51db343b3a0a39a3fd +) +vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH} PATCHES ${HOTFIX_PATCH}) + # apply boost range hotfix vcpkg_download_distfile(DIFF URLS "https://github.com/boostorg/range/commit/e7ebe14707130cda7b72e0ae5e93b17157fdb6a2.diff" @@ -61,7 +70,7 @@ file(MAKE_DIRECTORY if(NOT EXISTS ${SOURCE_PATH}/b2.exe) message(STATUS "Bootstrapping") vcpkg_execute_required_process( - COMMAND "${SOURCE_PATH}/bootstrap.bat" + COMMAND "${SOURCE_PATH}/bootstrap.bat" msvc WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME bootstrap ) @@ -108,7 +117,6 @@ if(VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore") # --without-date_time # --without-exception # --without-serialization - # --without-fiber # --without-context # --without-graph_parallel # --without-signals @@ -129,6 +137,8 @@ if(VCPKG_CMAKE_SYSTEM_NAME MATCHES "WindowsStore") --without-program_options # libs\program_options\src\parsers.cpp(194): error C2065: 'environ': undeclared identifier --without-test + --without-fiber + --without-stacktrace --without-filesystem # libs\filesystem\src\operations.cpp(178): error C2039: 'GetEnvironmentVariableW': is not a member of '`global namespace'' --without-thread --without-iostreams diff --git a/ports/catch/CONTROL b/ports/catch/CONTROL index 3e1e1ebaf..af18c49de 100644 --- a/ports/catch/CONTROL +++ b/ports/catch/CONTROL @@ -1,3 +1,3 @@ Source: catch -Version: 1.9.7 +Version: 1.10.0 Description: C++ Automated Test Cases in Headers diff --git a/ports/catch/portfile.cmake b/ports/catch/portfile.cmake index 10360187b..d78260cb8 100644 --- a/ports/catch/portfile.cmake +++ b/ports/catch/portfile.cmake @@ -1,10 +1,11 @@ include(vcpkg_common_functions) -set(CATCH_VERSION v1.9.7) +set(CATCH_VERSION v1.10.0) + vcpkg_download_distfile(HEADER URLS "https://github.com/philsquared/Catch/releases/download/${CATCH_VERSION}/catch.hpp" FILENAME "catch-${CATCH_VERSION}.hpp" - SHA512 c61fc39d9388a45d9c601c05dafeeba0e7887476b3b28e30a6ab47cb00e062be626c12d9712caa49e0cbfa3fd7517874137a24e8c293d6dd23353ea87f9fbf5c + SHA512 275ab5b5d778cc8a91b5f3e8f241a37b680c81d1b8945ff64ad16a9708c98e6535b389746bf8cacbed07f874629f456b56bafbf1879c5a6f84fa87675c1361b6 ) vcpkg_download_distfile(LICENSE diff --git a/ports/ccd/0001_fix_symbols_export.patch b/ports/ccd/0001_fix_symbols_export.patch new file mode 100644 index 000000000..f9c47d79b --- /dev/null +++ b/ports/ccd/0001_fix_symbols_export.patch @@ -0,0 +1,39 @@ +From 05b5718a364ac525c8766387bd74faf852f98589 Mon Sep 17 00:00:00 2001 +From: Mikhail Paulyshka <me@mixaill.tk> +Date: Sun, 27 Aug 2017 03:39:53 +0300 +Subject: [PATCH] win32: export additional symbols, fixes FCL build on MSVC + +--- + src/ccd/vec3.h | 2 +- + src/support.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/ccd/vec3.h b/src/ccd/vec3.h +index b0c1b33..014531c 100644 +--- a/src/ccd/vec3.h ++++ b/src/ccd/vec3.h +@@ -93,7 +93,7 @@ typedef struct _ccd_vec3_t ccd_vec3_t; + /** + * Holds origin (0,0,0) - this variable is meant to be read-only! + */ +-extern ccd_vec3_t *ccd_vec3_origin; ++extern _ccd_export ccd_vec3_t *ccd_vec3_origin; + + /** + * Array of points uniformly distributed on unit sphere. +diff --git a/src/support.h b/src/support.h +index 3372f5e..2e75df7 100644 +--- a/src/support.h ++++ b/src/support.h +@@ -37,7 +37,7 @@ _ccd_inline void ccdSupportCopy(ccd_support_t *, const ccd_support_t *s); + * Computes support point of obj1 and obj2 in direction dir. + * Support point is returned via supp. + */ +-void __ccdSupport(const void *obj1, const void *obj2, ++_ccd_export void __ccdSupport(const void *obj1, const void *obj2, + const ccd_vec3_t *dir, const ccd_t *ccd, + ccd_support_t *supp); + +-- +2.12.2.windows.2 + diff --git a/ports/libccd/CONTROL b/ports/ccd/CONTROL index 3a3a0252d..16f16ea0b 100644 --- a/ports/libccd/CONTROL +++ b/ports/ccd/CONTROL @@ -1,3 +1,3 @@ -Source: libccd -Version: 2.0.0 +Source: ccd +Version: 2.0.0-1 Description: Library for collision detection between two convex shapes diff --git a/ports/ccd/portfile.cmake b/ports/ccd/portfile.cmake new file mode 100644 index 000000000..0ce278220 --- /dev/null +++ b/ports/ccd/portfile.cmake @@ -0,0 +1,30 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO danfis/libccd + REF 64f02f741ac94fccd0fb660a5bffcbe6d01d9939 + SHA512 901b09d57e119e4661b3556bbefe5a4d58cb843bff5c76ee3952fe379ff183c878a04e86e6192006c11012309c6e93d42319e9d606abdf7ad723f6d8afeea47f + HEAD_REF master +) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/0001_fix_symbols_export.patch) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/ccd") + +file(INSTALL ${SOURCE_PATH}/BSD-LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/ccd RENAME copyright) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc) diff --git a/ports/ccfits/CONTROL b/ports/ccfits/CONTROL new file mode 100644 index 000000000..17083f9b2 --- /dev/null +++ b/ports/ccfits/CONTROL @@ -0,0 +1,4 @@ +Source: ccfits +Version: 2.5 +Description: CCfits is an object oriented interface to the cfitsio library. It is designed to make the capabilities of cfitsio available to programmers working in C++. +Build-Depends: cfitsio
\ No newline at end of file diff --git a/ports/ccfits/dll_exports.patch b/ports/ccfits/dll_exports.patch new file mode 100644 index 000000000..4ec4a8284 --- /dev/null +++ b/ports/ccfits/dll_exports.patch @@ -0,0 +1,495 @@ +Index: FITS.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- FITS.h (date 1502267716000) ++++ FITS.h (revision ) +@@ -21,6 +21,8 @@ + #include "HDUCreator.h" + // FitsError + #include "FitsError.h" ++//DLL Exporting ++#include "ccfits_export.h" + + namespace CCfits { + class FITSBase; +@@ -665,9 +667,8 @@ + + + +- class FITS +- { +- ++ class CCFITS_EXPORT FITS ++ { + public: + + +Index: HDU.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- HDU.h (date 1502267716000) ++++ HDU.h (revision ) +@@ -568,7 +568,7 @@ + + + +- class HDU ++ class CCFITS_EXPORT HDU + { + + public: +Index: Table.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- Table.h (date 1502267716000) ++++ Table.h (revision ) +@@ -268,7 +268,7 @@ + + + +- class Table : public ExtHDU //## Inherits: <unnamed>%3804A126EB10 ++ class CCFITS_EXPORT Table : public ExtHDU //## Inherits: <unnamed>%3804A126EB10 + { + + public: +Index: Column.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- Column.h (date 1502267716000) ++++ Column.h (revision ) +@@ -838,14 +838,14 @@ + + + +- class Column ++ class CCFITS_EXPORT Column + { + + public: + + + +- class RangeError : public FitsException //## Inherits: <unnamed>%3946526D031A ++ class CCFITS_EXPORT RangeError : public FitsException //## Inherits: <unnamed>%3946526D031A + { + public: + RangeError (const String& msg, bool silent = true); +@@ -857,7 +857,7 @@ + + + +- class InvalidDataType : public FitsException //## Inherits: <unnamed>%3947CF30033E ++ class CCFITS_EXPORT InvalidDataType : public FitsException //## Inherits: <unnamed>%3947CF30033E + { + public: + InvalidDataType (const String& str = string(), bool silent = true); +@@ -869,7 +869,7 @@ + + + +- class InvalidRowParameter : public FitsException //## Inherits: <unnamed>%39B5310F01A0 ++ class CCFITS_EXPORT InvalidRowParameter : public FitsException //## Inherits: <unnamed>%39B5310F01A0 + { + public: + InvalidRowParameter (const String& diag, bool silent = true); +@@ -881,7 +881,7 @@ + + + +- class WrongColumnType : public FitsException //## Inherits: <unnamed>%39B545780082 ++ class CCFITS_EXPORT WrongColumnType : public FitsException //## Inherits: <unnamed>%39B545780082 + { + public: + WrongColumnType (const String& diag, bool silent = true); +@@ -893,7 +893,7 @@ + + + +- class UnspecifiedLengths : public FitsException //## Inherits: <unnamed>%3A018C9D007D ++ class CCFITS_EXPORT UnspecifiedLengths : public FitsException //## Inherits: <unnamed>%3A018C9D007D + { + public: + UnspecifiedLengths (const String& diag, bool silent = true); +@@ -905,7 +905,7 @@ + + + +- class InvalidRowNumber : public FitsException //## Inherits: <unnamed>%3B0A850F0307 ++ class CCFITS_EXPORT InvalidRowNumber : public FitsException //## Inherits: <unnamed>%3B0A850F0307 + { + public: + InvalidRowNumber (const String& diag, bool silent = true); +@@ -917,7 +917,7 @@ + + + +- class InsufficientElements : public FitsException //## Inherits: <unnamed>%3B0BE611010A ++ class CCFITS_EXPORT InsufficientElements : public FitsException //## Inherits: <unnamed>%3B0BE611010A + { + public: + InsufficientElements (const String& msg, bool silent = true); +@@ -929,7 +929,7 @@ + + + +- class NoNullValue : public FitsException //## Inherits: <unnamed>%3B0D589A0092 ++ class CCFITS_EXPORT NoNullValue : public FitsException //## Inherits: <unnamed>%3B0D589A0092 + { + public: + NoNullValue (const String& diag, bool silent = true); +@@ -941,7 +941,7 @@ + + + +- class InvalidNumberOfRows : public FitsException //## Inherits: <unnamed>%3B20EB8B0205 ++ class CCFITS_EXPORT InvalidNumberOfRows : public FitsException //## Inherits: <unnamed>%3B20EB8B0205 + { + public: + InvalidNumberOfRows (int number, bool silent = true); +Index: AsciiTable.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- AsciiTable.h (date 1502267716000) ++++ AsciiTable.h (revision ) +@@ -133,7 +133,7 @@ + + + +- class AsciiTable : public Table //## Inherits: <unnamed>%3804A75CE420 ++ class CCFITS_EXPORT AsciiTable : public Table //## Inherits: <unnamed>%3804A75CE420 + { + + public: +Index: CCfits.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- CCfits.h (date 1502267716000) ++++ CCfits.h (revision ) +@@ -23,7 +23,7 @@ + #include <sys/types.h> + #include "longnam.h" + #include "float.h" +- ++#include "ccfits_export.h" + + namespace CCfits { + /*! \namespace CCfits +@@ -32,8 +32,8 @@ + static const int BITPIX = -32; + static const int NAXIS = 2; + static const int MAXDIM = 99; +- extern const unsigned long USBASE; +- extern const unsigned long ULBASE; ++ extern const CCFITS_EXPORT unsigned long USBASE; ++ extern const CCFITS_EXPORT unsigned long ULBASE; + + extern char BSCALE[7]; + extern char BZERO[6]; +Index: FITSBase.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- FITSBase.h (date 1502267716000) ++++ FITSBase.h (revision ) +@@ -30,7 +30,7 @@ + + + +- class FITSBase ++ class CCFITS_EXPORT FITSBase + { + + public: +Index: Keyword.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- Keyword.h (date 1502267716000) ++++ Keyword.h (revision ) +@@ -195,7 +195,7 @@ + + + +- class Keyword ++ class CCFITS_EXPORT Keyword + { + + public: +Index: ExtHDU.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- ExtHDU.h (date 1502267716000) ++++ ExtHDU.h (revision ) +@@ -435,7 +435,7 @@ + + + +- class ExtHDU : public HDU //## Inherits: <unnamed>%38048213E7A8 ++ class CCFITS_EXPORT ExtHDU : public HDU //## Inherits: <unnamed>%38048213E7A8 + { + + public: +Index: PHDU.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- PHDU.h (date 1502267716000) ++++ PHDU.h (revision ) +@@ -264,7 +264,7 @@ + + + +- class PHDU : public HDU //## Inherits: <unnamed>%394E6F9800C3 ++ class CCFITS_EXPORT PHDU : public HDU //## Inherits: <unnamed>%394E6F9800C3 + { + + public: +Index: BinTable.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- BinTable.h (date 1502267716000) ++++ BinTable.h (revision ) +@@ -127,7 +127,7 @@ + + + +- class BinTable : public Table //## Inherits: <unnamed>%3804A7E75F10 ++ class CCFITS_EXPORT BinTable : public Table //## Inherits: <unnamed>%3804A7E75F10 + { + + public: +Index: Image.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- Image.h (date 1502267716000) ++++ Image.h (revision ) +@@ -32,7 +32,7 @@ + + + template <typename T> +- class Image ++ class Image + { + + public: +Index: ColumnCreator.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- ColumnCreator.h (date 1502267716000) ++++ ColumnCreator.h (revision ) +@@ -28,7 +28,7 @@ + + + +- class ColumnCreator ++ class CCFITS_EXPORT ColumnCreator + { + + public: +Index: FitsError.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- FitsError.h (date 1502267716000) ++++ FitsError.h (revision ) +@@ -14,6 +14,7 @@ + //#include <iostream> + //#include <stl.h> + #include <string> ++#include "ccfits_export.h" + using std::string; + + +@@ -90,7 +91,7 @@ + + + +- class FitsException ++ class CCFITS_EXPORT FitsException + { + public: + FitsException (const string& msg, bool& silent); +@@ -109,7 +110,7 @@ + + + +- class FitsError : public FitsException //## Inherits: <unnamed>%399170BD017D ++ class CCFITS_EXPORT FitsError : public FitsException //## Inherits: <unnamed>%399170BD017D + { + public: + FitsError (int errornum, bool silent = true); +@@ -123,7 +124,7 @@ + + + +- class FitsFatal ++ class CCFITS_EXPORT FitsFatal + { + public: + FitsFatal (const string& diag); +Index: HDUCreator.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- HDUCreator.h (date 1502267716000) ++++ HDUCreator.h (revision ) +@@ -35,7 +35,7 @@ + + + +- class HDUCreator ++ class CCFITS_EXPORT HDUCreator + { + + public: +Index: ccfits_export.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- ccfits_export.h (revision ) ++++ ccfits_export.h (revision ) +@@ -0,0 +1,42 @@ ++ ++#ifndef CCFITS_EXPORT_H ++#define CCFITS_EXPORT_H ++ ++#ifdef CCFITS_STATIC_DEFINE ++# define CCFITS_EXPORT ++# define CCFITS_NO_EXPORT ++#else ++# ifndef CCFITS_EXPORT ++# ifdef CCfits_EXPORTS ++ /* We are building this library */ ++# define CCFITS_EXPORT __declspec(dllexport) ++# else ++ /* We are using this library */ ++# define CCFITS_EXPORT __declspec(dllimport) ++# endif ++# endif ++ ++# ifndef CCFITS_NO_EXPORT ++# define CCFITS_NO_EXPORT ++# endif ++#endif ++ ++#ifndef CCFITS_DEPRECATED ++# define CCFITS_DEPRECATED __declspec(deprecated) ++#endif ++ ++#ifndef CCFITS_DEPRECATED_EXPORT ++# define CCFITS_DEPRECATED_EXPORT CCFITS_EXPORT CCFITS_DEPRECATED ++#endif ++ ++#ifndef CCFITS_DEPRECATED_NO_EXPORT ++# define CCFITS_DEPRECATED_NO_EXPORT CCFITS_NO_EXPORT CCFITS_DEPRECATED ++#endif ++ ++#if 0 /* DEFINE_NO_DEPRECATED */ ++# ifndef CCFITS_NO_DEPRECATED ++# define CCFITS_NO_DEPRECATED ++# endif ++#endif ++ ++#endif +Index: FITSUtil.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- FITSUtil.h (date 1502267716000) ++++ FITSUtil.h (revision ) +@@ -22,6 +22,7 @@ + #include <string> + // FitsError + #include "FitsError.h" ++#include "ccfits_export.h" + #include <typeinfo> + + +@@ -287,21 +288,21 @@ + template <typename T> + void swap(std::vector<T>& left, std::vector<T>& right); + +- string lowerCase(const string& inputString); ++ string CCFITS_EXPORT lowerCase(const string& inputString); + +- string upperCase(const string& inputString); ++ string CCFITS_EXPORT upperCase(const string& inputString); + + // Check if a file name includes an image compression specifier, + // and return its location if it exists. +- string::size_type checkForCompressString(const string& fileName); ++ string::size_type CCFITS_EXPORT checkForCompressString(const string& fileName); + +- struct InvalidConversion : public FitsException ++ struct CCFITS_EXPORT InvalidConversion : public FitsException + { + InvalidConversion(const string& diag, bool silent=false); + + }; + +- struct MatchStem : public std::binary_function<string,string,bool> ++ struct CCFITS_EXPORT MatchStem : public std::binary_function<string,string,bool> + { + bool operator()(const string& left, const string& right) const; + }; +@@ -323,7 +324,7 @@ + + char** CharArray(const std::vector<string>& inArray); + +- string FITSType2String( int typeInt ); ++ string CCFITS_EXPORT FITSType2String( int typeInt ); + + + template <typename S, typename T> +@@ -633,7 +634,7 @@ + + + +- class UnrecognizedType : public FitsException //## Inherits: <unnamed>%3CE143AB00C6 ++ class CCFITS_EXPORT UnrecognizedType : public FitsException //## Inherits: <unnamed>%3CE143AB00C6 + { + public: + UnrecognizedType (string diag, bool silent = true); +Index: KeywordCreator.h +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- KeywordCreator.h (date 1502267716000) ++++ KeywordCreator.h (revision ) +@@ -24,7 +24,7 @@ + + + +- class KeywordCreator ++ class CCFITS_EXPORT KeywordCreator + { + + public: diff --git a/ports/ccfits/portfile.cmake b/ports/ccfits/portfile.cmake new file mode 100644 index 000000000..6bd9bd170 --- /dev/null +++ b/ports/ccfits/portfile.cmake @@ -0,0 +1,56 @@ +# 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) +#removes current source to prevent static builds from using patched source code +file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src/CCfits) +file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src/CCfits-2.5.tar.gz.extracted) + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/CCfits) + +vcpkg_download_distfile(ARCHIVE + URLS "https://heasarc.gsfc.nasa.gov/fitsio/ccfits/CCfits-2.5.tar.gz" + FILENAME "CCfits-2.5.tar.gz" + SHA512 63ab4d153063960510cf60651d5c832824cf85f937f84adc5390c7c2fb46eb8e9f5d8cda2554d79d24c7a4f1b6cf0b7a6e20958fb69920b65d7c362c0a5f26b5 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + vcpkg_apply_patches( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/CCfits + PATCHES "${CMAKE_CURRENT_LIST_DIR}/dll_exports.patch" + ) +endif() + + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin) + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin) + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/CCfits.dll ${CURRENT_PACKAGES_DIR}/bin/CCfits.dll) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/CCfits.dll ${CURRENT_PACKAGES_DIR}/debug/bin/CCfits.dll) +endif() + +# Remove duplicate include files +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/ccfits RENAME copyright) diff --git a/ports/cfitsio/CONTROL b/ports/cfitsio/CONTROL new file mode 100644 index 000000000..e45b8a8c2 --- /dev/null +++ b/ports/cfitsio/CONTROL @@ -0,0 +1,3 @@ +Source: cfitsio +Version: 3.410 +Description: Library of C and Fortran subroutines for reading and writing data files in FITS (Flexible Image Transport System) data format diff --git a/ports/cfitsio/portfile.cmake b/ports/cfitsio/portfile.cmake new file mode 100644 index 000000000..2490beb80 --- /dev/null +++ b/ports/cfitsio/portfile.cmake @@ -0,0 +1,29 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/cfitsio) +vcpkg_download_distfile(ARCHIVE + URLS "http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio3410.tar.gz" + FILENAME "cfitsio3410.tar.gz" + SHA512 b2ac31ab17e19eeeb4f1601f42f348402c0a4ab03725dbf74fe75eaabbee2f44f64f0c0ee7f0b2688bd93a9cc0dccf29f07e73b9148fff97fc78bebdbb5f6f0f +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +# Remove duplicate include files +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + # move DLLs to bin directories for dynamic builds + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin) + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cfitsio.dll ${CURRENT_PACKAGES_DIR}/bin/cfitsio.dll) + file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cfitsio.dll ${CURRENT_PACKAGES_DIR}/debug/bin/cfitsio.dll) +endif() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/License.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cfitsio RENAME copyright) diff --git a/ports/chmlib/CONTROL b/ports/chmlib/CONTROL new file mode 100644 index 000000000..22680db33 --- /dev/null +++ b/ports/chmlib/CONTROL @@ -0,0 +1,3 @@ +Source: chmlib +Version: 0.40 +Description: CHMLIB is a library for dealing with Microsoft ITSS/CHM format files. Right now, it is a very simple library, but sufficient for dealing with all of the .chm files I've come across. Due to the fairly well-designed indexing built into this particular file format, even a small library is able to gain reasonably good performance indexing into ITSS archives.
\ No newline at end of file diff --git a/ports/chmlib/chm.vcxproj b/ports/chmlib/chm.vcxproj new file mode 100644 index 000000000..61955291e --- /dev/null +++ b/ports/chmlib/chm.vcxproj @@ -0,0 +1,205 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>15.0</VCProjectVersion> + <ProjectGuid>{3bafee52-fe1a-494e-ab46-89bf77ed63a7}</ProjectGuid> + <RootNamespace>chmLibExe1</RootNamespace> + <ProjectName>chm</ProjectName> + <WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <!--Overriden at build time.--> + <OutDir>..\..\..\x86-windows-static-dbg\</OutDir> + <IntDir>..\..\..\x86-windows-static-dbg\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <!--Overriden at build time.--> + <OutDir>..\..\..\x86-windows-static-rel\</OutDir> + <IntDir>..\..\..\x86-windows-static-rel\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <!--Overriden at build time.--> + <OutDir>..\..\..\x64-windows-static-dbg\</OutDir> + <IntDir>..\..\..\x64-windows-static-dbg\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <!--Overriden at build time.--> + <OutDir>..\..\..\x64-windows-static-rel\</OutDir> + <IntDir>..\..\..\x64-windows-static-rel\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <MultiProcessorCompilation>false</MultiProcessorCompilation> + <PreprocessorDefinitions>WIN32;CHM_MT;CHM_DEBUG;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> + <DisableSpecificWarnings>4018;4057;4127;4189;4244;4267;4295;4324;4458;4477;4701;4706;4800;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <CompileAs>CompileAsC</CompileAs> + <DebugInformationFormat>OldStyle</DebugInformationFormat> + <MinimalRebuild>false</MinimalRebuild> + </ClCompile> + <Link> + <AdditionalDependencies> + </AdditionalDependencies> + <SubSystem>Console</SubSystem> + <ShowProgress>LinkVerbose</ShowProgress> + <IgnoreSpecificDefaultLibraries>libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries> + </Link> + <Lib> + <TreatLibWarningAsErrors>true</TreatLibWarningAsErrors> + <TargetMachine>MachineX86</TargetMachine> + <SubSystem>Windows</SubSystem> + <Verbose>true</Verbose> + <IgnoreSpecificDefaultLibraries>libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <MultiProcessorCompilation>false</MultiProcessorCompilation> + <PreprocessorDefinitions>WIN32;CHM_MT;CHM_DEBUG;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> + <DisableSpecificWarnings>4018;4057;4127;4189;4244;4267;4295;4324;4458;4477;4701;4706;4800;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <CompileAs>CompileAsC</CompileAs> + <DebugInformationFormat>OldStyle</DebugInformationFormat> + <MinimalRebuild>false</MinimalRebuild> + </ClCompile> + <Link> + <AdditionalDependencies> + </AdditionalDependencies> + <SubSystem>Console</SubSystem> + <ShowProgress>LinkVerbose</ShowProgress> + <IgnoreSpecificDefaultLibraries>libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries> + </Link> + <Lib> + <SubSystem>Windows</SubSystem> + <Verbose>true</Verbose> + <IgnoreSpecificDefaultLibraries>libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <MultiProcessorCompilation>false</MultiProcessorCompilation> + <PreprocessorDefinitions>CHM_MT;WIN32;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> + <DisableSpecificWarnings>4018;4057;4127;4189;4244;4267;4295;4324;4458;4477;4701;4706;4800;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <AdditionalDependencies> + </AdditionalDependencies> + <SubSystem>Console</SubSystem> + <ShowProgress>LinkVerbose</ShowProgress> + </Link> + <Lib> + <TargetMachine>MachineX86</TargetMachine> + <SubSystem>Windows</SubSystem> + <Verbose>true</Verbose> + <IgnoreSpecificDefaultLibraries>libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <MultiProcessorCompilation>false</MultiProcessorCompilation> + <PreprocessorDefinitions>CHM_MT;WIN32;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions> + <DisableSpecificWarnings>4018;4057;4127;4189;4244;4267;4295;4324;4458;4477;4701;4706;4800;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <AdditionalDependencies> + </AdditionalDependencies> + <SubSystem>Console</SubSystem> + <ShowProgress>LinkVerbose</ShowProgress> + </Link> + <Lib> + <SubSystem>Windows</SubSystem> + <Verbose>true</Verbose> + <IgnoreSpecificDefaultLibraries>libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib</IgnoreSpecificDefaultLibraries> + </Lib> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="chm_lib.c" /> + <ClCompile Include="lzx.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="chm_lib.h" /> + <ClInclude Include="lzx.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/ports/chmlib/portfile.cmake b/ports/chmlib/portfile.cmake new file mode 100644 index 000000000..cb2f2cf96 --- /dev/null +++ b/ports/chmlib/portfile.cmake @@ -0,0 +1,57 @@ +# 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) +# + +#message("VCPKG_TARGET_ARCHITECTURE" ${VCPKG_TARGET_ARCHITECTURE}) +#if(NOT ${VCPKG_TARGET_ARCHITECTURE} STREQUAL "x86") +# message(FATAL_ERROR "chmlib only supports x86") +#endif() + +if(${VCPKG_CRT_LINKAGE} STREQUAL "dynamic") + message(FATAL_ERROR "chmlib supports static linking only.") +endif() + +if(${VCPKG_LIBRARY_LINKAGE} STREQUAL "dynamic") + message(FATAL_ERROR "chmlib supports static linking only.") +endif() + +set(CHMLIB_VERSION chmlib-0.40) +set(CHMLIB_FILENAME ${CHMLIB_VERSION}.zip) +set(CHMLIB_URL http://www.jedrea.com/chmlib/${CHMLIB_FILENAME}) +set(CHMLIB_SRC ${CURRENT_BUILDTREES_DIR}/src/${CHMLIB_VERSION}/src) +include(vcpkg_common_functions) + +vcpkg_download_distfile( + ARCHIVE + URLS ${CHMLIB_URL} + FILENAME ${CHMLIB_FILENAME} + SHA512 ad3b0d49fcf99e724c0c38b9c842bae9508d0e4ad47122b0f489c113160f5344223d311abb79f25cbb0b662bb00e2925d338d60dd20a0c309bda2822cda4cd24 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY "${VCPKG_ROOT_DIR}/ports/${PORT}/chm.vcxproj" + DESTINATION ${CHMLIB_SRC}) + +vcpkg_build_msbuild( + PROJECT_PATH ${CHMLIB_SRC}/chm.vcxproj + RELEASE_CONFIGURATION Release + DEBUG_CONFIGURATION Debug + OPTIONS_DEBUG /p:OutDirPath="${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" + OPTIONS_RELEASE /p:OutDirPath="${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" + OPTIONS /v:diagnostic /p:SkipInvalidConfigurations=true +) + +file(INSTALL ${CHMLIB_SRC}/chm_lib.h DESTINATION ${CURRENT_PACKAGES_DIR}/include) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/chm.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/chm.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) + +file(COPY ${CURRENT_BUILDTREES_DIR}/src/chmlib-0.40/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/chmlib) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/chmlib/COPYING ${CURRENT_PACKAGES_DIR}/share/chmlib/copyright)
\ No newline at end of file diff --git a/ports/cpprestsdk/CONTROL b/ports/cpprestsdk/CONTROL index f284f2b53..f34f1ad4a 100644 --- a/ports/cpprestsdk/CONTROL +++ b/ports/cpprestsdk/CONTROL @@ -1,5 +1,5 @@ Source: cpprestsdk Version: 2.9.0-2 -Build-Depends: zlib [windows], openssl [windows], boost [windows], websocketpp [windows] +Build-Depends: zlib (windows), openssl (windows), boost (windows), websocketpp (windows) Description: C++11 JSON, REST, and OAuth library The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
\ No newline at end of file diff --git a/ports/ctemplate/CMakeLists.txt b/ports/ctemplate/CMakeLists.txt index c7cc211f4..63e6fc6b3 100644 --- a/ports/ctemplate/CMakeLists.txt +++ b/ports/ctemplate/CMakeLists.txt @@ -92,5 +92,5 @@ install( ) if(NOT DISABLE_INSTALL_HEADERS) - install(DIRECTORY "${COMMON_INCLUDES}/" DESTINATION include FILES_MATCHING PATTERN "*.h") + install(DIRECTORY "${COMMON_INCLUDES}/ctemplate" DESTINATION include FILES_MATCHING PATTERN "*.h") endif() diff --git a/ports/ctemplate/CONTROL b/ports/ctemplate/CONTROL index eb78d4c0f..5e9e69753 100644 --- a/ports/ctemplate/CONTROL +++ b/ports/ctemplate/CONTROL @@ -1,3 +1,3 @@ Source: ctemplate -Version: 2017-06-23-44b7c5b918a08ad561c63e9d28beecb40c10ebca +Version: 2017-06-23-44b7c5-2 Description: C++ CTemplate system diff --git a/ports/curl/CONTROL b/ports/curl/CONTROL index 320d82afb..d7da6511c 100644 --- a/ports/curl/CONTROL +++ b/ports/curl/CONTROL @@ -1,4 +1,4 @@ Source: curl -Version: 7.55.0 +Version: 7.55.1 Build-Depends: zlib, openssl, libssh2 Description: A library for transferring data with URLs diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake index c00f813b2..c770d3f25 100644 --- a/ports/curl/portfile.cmake +++ b/ports/curl/portfile.cmake @@ -2,8 +2,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO curl/curl - REF curl-7_55_0 - SHA512 7b49e7761f5864589c6cd6eb14d8e6908797c986d8bc46a3d8dc32b7bcd12d5af464259cf3f9975a4792c8e2a504f04dd071d266d2340082a31f7ee508e17d08 + REF curl-7_55_1 + SHA512 b5c6dd6cca8d07c08d1760feff9822f1264359adde068afd1584fc3fdcfa50c68e0e1b5ecaa277298ad0923b61019943c181ee1f0870c312399038c4c4e0e327 HEAD_REF master ) diff --git a/ports/ecm/CONTROL b/ports/ecm/CONTROL index e696bd7b9..e124c960e 100644 --- a/ports/ecm/CONTROL +++ b/ports/ecm/CONTROL @@ -1,3 +1,3 @@ Source: ecm -Version: 5.32.0 +Version: 5.37.0 Description: Extra CMake Modules (ECM), extra modules and scripts for CMake diff --git a/ports/ecm/portfile.cmake b/ports/ecm/portfile.cmake index 9fa648a1c..0e016418c 100644 --- a/ports/ecm/portfile.cmake +++ b/ports/ecm/portfile.cmake @@ -1,10 +1,10 @@ #cmake-only scripts include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/extra-cmake-modules-5.32.0) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/extra-cmake-modules-5.37.0) vcpkg_download_distfile(ARCHIVE - URLS "https://download.kde.org/stable/frameworks/5.32/extra-cmake-modules-5.32.0.zip" - FILENAME "extra-cmake-modules-5.32.0.zip" - SHA512 f966820e88fdbcdea7f20ff6b76ab8a6d2f7eaf78950bc690243b7201b9f646d92c83a998c19feab3bfe2ed528ec96ad1fa36e6ae320419d226cddd28cd433e5 + URLS "https://download.kde.org/stable/frameworks/5.37/extra-cmake-modules-5.37.0.zip" + FILENAME "extra-cmake-modules-5.37.0.zip" + SHA512 a9cd585fb5c63452fc45c955df62b6e7aca3d19e47ca2db33216f83951645f393271f37a04630e5c7f01899063562548c2b0dfe79d7afa8661bb0a8bca5ccfbf ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/expat/CONTROL b/ports/expat/CONTROL index 5987991c8..f833c3cf0 100644 --- a/ports/expat/CONTROL +++ b/ports/expat/CONTROL @@ -1,3 +1,3 @@ Source: expat -Version: 2.1.1-1 +Version: 2.2.4-1 Description: XML parser library written in C diff --git a/ports/expat/portfile.cmake b/ports/expat/portfile.cmake index a347ac2cb..da6ddc429 100644 --- a/ports/expat/portfile.cmake +++ b/ports/expat/portfile.cmake @@ -1,11 +1,10 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/expat-2.1.1) -vcpkg_download_distfile(ARCHIVE_FILE - URLS "http://downloads.sourceforge.net/project/expat/expat/2.1.1/expat-2.1.1.tar.bz2" - FILENAME "expat-2.1.1.tar.bz2" - SHA512 088e2ef3434f2affd4fc79fe46f0e9826b9b4c3931ddc780cd18892f1cd1e11365169c6807f45916a56bb6abcc627dcd17a23f970be0bf464f048f5be2713628 -) -vcpkg_extract_source_archive(${ARCHIVE_FILE}) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO libexpat/libexpat + REF R_2_2_4 + SHA512 64f9deb2f75be70450a60a408ab867d1df800022e29000a31a801d85421178b400ebbf817864d1592ce998ada1012fa25fd896e5f25c6b314851ae62d94b45dc + HEAD_REF master) if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) set(EXPAT_LINKAGE ON) @@ -14,7 +13,8 @@ else() endif() vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} + SOURCE_PATH ${SOURCE_PATH}/expat + PREFER_NINJA OPTIONS -DBUILD_examples=OFF -DBUILD_tests=OFF @@ -25,10 +25,13 @@ vcpkg_configure_cmake( vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig ${CURRENT_PACKAGES_DIR}/lib/pkgconfig) -file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/expat RENAME copyright) +file(INSTALL ${SOURCE_PATH}/expat/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/expat RENAME copyright) vcpkg_copy_pdbs() +# CMake's FindExpat currently doesn't look for expatd.lib +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/expatd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/expat.lib) + file(READ ${CURRENT_PACKAGES_DIR}/include/expat_external.h EXPAT_EXTERNAL_H) if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") string(REPLACE "!defined(XML_STATIC)" "/* vcpkg static build !defined(XML_STATIC) */ 0" EXPAT_EXTERNAL_H "${EXPAT_EXTERNAL_H}") diff --git a/ports/fcl/0001_fix_package_detection.patch b/ports/fcl/0001_fix_package_detection.patch new file mode 100644 index 000000000..9ae1b60e5 --- /dev/null +++ b/ports/fcl/0001_fix_package_detection.patch @@ -0,0 +1,81 @@ +From c43e3771cc2ec314191e5d4a5b485aab258c1b18 Mon Sep 17 00:00:00 2001 +From: Mikhail Paulyshka <me@mixaill.tk> +Date: Sun, 27 Aug 2017 04:12:36 +0300 +Subject: [PATCH] use cmake-exports for package detection + +--- + CMakeLists.txt | 48 +++--------------------------------------------- + 1 file changed, 3 insertions(+), 45 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5a4a559..8978b61 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -65,32 +65,11 @@ if(FCL_COVERALLS) + endif() + + # Find Octomap (optional) +-find_package(PkgConfig QUIET) +- + option(FCL_WITH_OCTOMAP "octomap library support" ON) + set(FCL_HAVE_OCTOMAP 0) + if(FCL_WITH_OCTOMAP) +- if(PKG_CONFIG_FOUND) +- pkg_check_modules(OCTOMAP QUIET octomap) +- endif() +- if(NOT OCTOMAP_FOUND) +- # if pkgconfig is not installed, then fall back on more fragile detection +- # of octomap +- find_path(OCTOMAP_INCLUDE_DIRS octomap.h +- PATH_SUFFIXES octomap) +- find_library(OCTOMAP_LIBRARY_DIRS +- ${CMAKE_SHARED_LIBRARY_PREFIX}octomap${CMAKE_SHARED_LIBRARY_SUFFIX}) +- if(OCTOMAP_INCLUDE_DIRS AND OCTOMAP_LIBRARY_DIRS) +- set(OCTOMAP_LIBRARIES "octomap;octomath") +- endif() +- endif() +- if (OCTOMAP_FOUND OR (OCTOMAP_INCLUDE_DIRS AND OCTOMAP_LIBRARY_DIRS)) +- string(REPLACE "." ";" VERSION_LIST ${OCTOMAP_VERSION}) +- list(GET VERSION_LIST 0 OCTOMAP_MAJOR_VERSION) +- list(GET VERSION_LIST 1 OCTOMAP_MINOR_VERSION) +- list(GET VERSION_LIST 2 OCTOMAP_PATCH_VERSION) +- include_directories(${OCTOMAP_INCLUDE_DIRS}) +- link_directories(${OCTOMAP_LIBRARY_DIRS}) ++ find_package(OCTOMAP REQUIRED) ++ if (OCTOMAP_FOUND) + set(FCL_HAVE_OCTOMAP 1) + message(STATUS "FCL uses Octomap") + else() +@@ -116,28 +95,7 @@ endif() + include_directories(BEFORE "include") + include_directories("${CMAKE_CURRENT_BINARY_DIR}/include") + +-if(PKG_CONFIG_FOUND) +- pkg_check_modules(CCD ccd) +- # check to see if the pkg is installed under the libccd name +- if(NOT CCD_FOUND) +- pkg_check_modules(CCD libccd) +- endif() +-endif() +- +-if(NOT CCD_FOUND) +- # if pkgconfig is not installed, then fall back on more fragile detection +- # of ccd +- find_path(CCD_INCLUDE_DIRS ccd/ccd.h) +- find_library(CCD_LIBRARY +- ${CMAKE_SHARED_LIBRARY_PREFIX}ccd${CMAKE_SHARED_LIBRARY_SUFFIX}) +- if(CCD_INCLUDE_DIRS AND CCD_LIBRARY) +- set(CCD_LIBRARIES "${CCD_LIBRARY}") +- else() +- message(FATAL_ERROR "Libccd is required by FCL") +- endif() +-endif() +-include_directories(${CCD_INCLUDE_DIRS}) +-link_directories(${CCD_LIBRARY_DIRS}) ++find_package(CCD REQUIRED) + + add_subdirectory(include/fcl) + add_subdirectory(src) +-- +2.12.2.windows.2 + diff --git a/ports/fcl/CONTROL b/ports/fcl/CONTROL new file mode 100644 index 000000000..c83593cb3 --- /dev/null +++ b/ports/fcl/CONTROL @@ -0,0 +1,4 @@ +Source: fcl +Version: 0.5.0-1 +Description: a library for performing three types of proximity queries on a pair of geometric models composed of triangles +Build-Depends: boost, ccd, octomap
\ No newline at end of file diff --git a/ports/fcl/portfile.cmake b/ports/fcl/portfile.cmake new file mode 100644 index 000000000..e0cee7e02 --- /dev/null +++ b/ports/fcl/portfile.cmake @@ -0,0 +1,42 @@ +include(vcpkg_common_functions) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO flexible-collision-library/fcl + REF 54e9619bc2b084ee50e986ac3308160d663481c4 + SHA512 11bfa3fdeeda6766769a34d2248ca32b6b13ecb32b412c068aa1c7aa3495d55b3f7a82a93621965904f9813c3fd0f128a84f796ae5731d2ff15b85935a0e1261 + HEAD_REF fcl-0.5 +) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/0001_fix_package_detection.patch) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + set(FCL_STATIC_LIBRARY ON) +else() + set(FCL_STATIC_LIBRARY OFF) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DFCL_STATIC_LIBRARY=${FCL_STATIC_LIBRARY} + -DFCL_BUILD_TESTS=OFF +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +vcpkg_fixup_cmake_targets(CONFIG_PATH "cmake/") + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/fcl RENAME copyright) diff --git a/ports/ffmpeg/CONTROL b/ports/ffmpeg/CONTROL index 443003d92..658c4b1f2 100644 --- a/ports/ffmpeg/CONTROL +++ b/ports/ffmpeg/CONTROL @@ -1,4 +1,4 @@ Source: ffmpeg -Version: 3.2.4-3 +Version: 3.3.3 Description: a library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. - FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations.
\ No newline at end of file + FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations. diff --git a/ports/ffmpeg/portfile.cmake b/ports/ffmpeg/portfile.cmake index de17e2851..8bd7abab0 100644 --- a/ports/ffmpeg/portfile.cmake +++ b/ports/ffmpeg/portfile.cmake @@ -4,11 +4,11 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ffmpeg-3.2.4) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ffmpeg-3.3.3) vcpkg_download_distfile(ARCHIVE - URLS "http://ffmpeg.org/releases/ffmpeg-3.2.4.tar.bz2" - FILENAME "ffmpeg-3.2.4.tar.bz2" - SHA512 ba5004d0f2659faa139c7dbf2f0fc6bab1d4e017d919f4ac271a5d2e8e4a3478909176e3a4d1ad33ddf2f62ab28dd9e00ce9be1399efb7cb3276dde79134cdaa + URLS "http://ffmpeg.org/releases/ffmpeg-3.3.3.tar.bz2" + FILENAME "ffmpeg-3.3.3.tar.bz2" + SHA512 1cc63bf73356f4e618c0d3572a216bdf5689f10deff56b4262f6d740b0bee5a4b3eac234f45fca3d4d2da77903a507b4fba725b76d2d2070f31b6dae9e7a2dab ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/flann/CONTROL b/ports/flann/CONTROL index ad9a5e871..f4a062981 100644 --- a/ports/flann/CONTROL +++ b/ports/flann/CONTROL @@ -1,3 +1,3 @@ Source: flann -Version: 1.9.1-4 +Version: 1.9.1-5 Description: Fast Library for Approximate Nearest Neighbors diff --git a/ports/flann/portfile.cmake b/ports/flann/portfile.cmake index ba7eca546..f1ead2ad9 100644 --- a/ports/flann/portfile.cmake +++ b/ports/flann/portfile.cmake @@ -25,6 +25,7 @@ vcpkg_configure_cmake( -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_MATLAB_BINDINGS=OFF -DCMAKE_DEBUG_POSTFIX=-gd + -DHDF5_NO_FIND_PACKAGE_CONFIG_FILE=ON ) vcpkg_install_cmake() diff --git a/ports/gdal/CONTROL b/ports/gdal/CONTROL index 2182a3d35..868a5e929 100644 --- a/ports/gdal/CONTROL +++ b/ports/gdal/CONTROL @@ -1,4 +1,4 @@ Source: gdal -Version: 1.11.3-4 +Version: 1.11.3-5 Description: The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data. Build-Depends: proj, libpng, geos, sqlite3, curl, expat, libpq, libmysql, openjpeg, libwebp, libxml2, liblzma diff --git a/ports/gdal/portfile.cmake b/ports/gdal/portfile.cmake index 96fa8fa6a..214ec2024 100644 --- a/ports/gdal/portfile.cmake +++ b/ports/gdal/portfile.cmake @@ -55,8 +55,8 @@ file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/expat.lib" EXPAT_LIBRARY # Setup curl libraries + include path file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" CURL_INCLUDE_DIR) -file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/libcurl_imp.lib" CURL_LIBRARY_REL) -file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libcurl_imp.lib" CURL_LIBRARY_DBG) +file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/libcurl.lib" CURL_LIBRARY_REL) +file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libcurl.lib" CURL_LIBRARY_DBG) # Setup sqlite3 libraries + include path file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" SQLITE_INCLUDE_DIR) diff --git a/ports/gdk-pixbuf/CMakeLists.txt b/ports/gdk-pixbuf/CMakeLists.txt index 06a6b7032..0d56b7fad 100644 --- a/ports/gdk-pixbuf/CMakeLists.txt +++ b/ports/gdk-pixbuf/CMakeLists.txt @@ -34,6 +34,7 @@ add_library(gdk-pixbuf gdk-pixbuf/gdk-pixbuf-util.c gdk-pixbuf/gdk-pixdata.c gdk-pixbuf/gdk-pixbuf-enum-types.c + gdk-pixbuf/gdk-pixbuf-marshal.c gdk-pixbuf/io-ani.c gdk-pixbuf/io-ani-animation.c gdk-pixbuf/io-icns.c diff --git a/ports/gdk-pixbuf/CONTROL b/ports/gdk-pixbuf/CONTROL index 23edca2e0..c12f67583 100644 --- a/ports/gdk-pixbuf/CONTROL +++ b/ports/gdk-pixbuf/CONTROL @@ -1,4 +1,4 @@ Source: gdk-pixbuf -Version: 2.36.6 +Version: 2.36.9 Description: Image loading library. Build-Depends: gettext, zlib, libpng, glib diff --git a/ports/gdk-pixbuf/portfile.cmake b/ports/gdk-pixbuf/portfile.cmake index 36b64a553..72469abff 100644 --- a/ports/gdk-pixbuf/portfile.cmake +++ b/ports/gdk-pixbuf/portfile.cmake @@ -4,13 +4,13 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static) endif() set(GDK_PIXBUF_VERSION 2.36) -set(GDK_PIXBUF_PATCH 6) +set(GDK_PIXBUF_PATCH 9) include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gdk-pixbuf-${GDK_PIXBUF_VERSION}.${GDK_PIXBUF_PATCH}) vcpkg_download_distfile(ARCHIVE URLS "http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/${GDK_PIXBUF_VERSION}/gdk-pixbuf-${GDK_PIXBUF_VERSION}.${GDK_PIXBUF_PATCH}.tar.xz" FILENAME "gdk-pixbuf-${GDK_PIXBUF_VERSION}.${GDK_PIXBUF_PATCH}.tar.xz" - SHA512 b963f01161b58463c83499079545aa946fd824ec5e7167e0898698ac46e0cc3fb3dcb0cac5afabd6b7d957391b9c9bba55f340294076433155fc91052d5403ec) + SHA512 ab8f2cda4490012936b094a1321e64b85e1fa1f8d070fae135a514f87f695201b845f4192e4a02954e2767d44314c0a95d727118853528182952d15890130261) vcpkg_extract_source_archive(${ARCHIVE}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) diff --git a/ports/gl2ps/CONTROL b/ports/gl2ps/CONTROL new file mode 100644 index 000000000..16c52f64a --- /dev/null +++ b/ports/gl2ps/CONTROL @@ -0,0 +1,4 @@ +Source: gl2ps +Version: 1.4.0 +Description: OpenGL to PostScript Printing Library +Build-Depends: freeglut, zlib, libpng diff --git a/ports/gl2ps/portfile.cmake b/ports/gl2ps/portfile.cmake new file mode 100644 index 000000000..7f08f8de4 --- /dev/null +++ b/ports/gl2ps/portfile.cmake @@ -0,0 +1,24 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gl2ps-gl2ps_1_4_0-e7b16f8f80382e45b681651e6381de09250243a6) +vcpkg_download_distfile(ARCHIVE + URLS "http://gitlab.onelab.info/gl2ps/gl2ps/repository/archive.tar.gz?ref=gl2ps_1_4_0" + FILENAME "gl2ps_1_4_0.tar.gz" + SHA512 6ec18debdf94e8de22ca7084fe6fef72fb858fc6295a35fa3c98c3c45211f9f72e23a14224a85877f64031077da4978b8d5d81f24dfe18de8c2ec32a680eba60 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/separate-static-dynamic-build.patch" +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON +) + +vcpkg_install_cmake() + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/COPYING.GL2PS DESTINATION ${CURRENT_PACKAGES_DIR}/share/gl2ps RENAME copyright) +file(INSTALL ${SOURCE_PATH}/COPYING.LGPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/gl2ps RENAME copyright.LGPL) diff --git a/ports/gl2ps/separate-static-dynamic-build.patch b/ports/gl2ps/separate-static-dynamic-build.patch new file mode 100644 index 000000000..fe2267e6a --- /dev/null +++ b/ports/gl2ps/separate-static-dynamic-build.patch @@ -0,0 +1,214 @@ +diff --git "a/CMakeLists.txt" "b/CMakeLists.txt" +index 40da57e..39acf6b 100644 +--- "a/CMakeLists.txt" ++++ "b/CMakeLists.txt" +@@ -1,34 +1,34 @@ + # GL2PS, an OpenGL to PostScript Printing Library + # Copyright (C) 1999-2017 C. Geuzaine +-# ++# + # This program is free software; you can redistribute it and/or + # modify it under the terms of either: +-# ++# + # a) the GNU Library General Public License as published by the Free + # Software Foundation, either version 2 of the License, or (at your + # option) any later version; or +-# ++# + # b) the GL2PS License as published by Christophe Geuzaine, either + # version 2 of the License, or (at your option) any later version. +-# ++# + # This program is distributed in the hope that it will be useful, but + # WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either + # the GNU Library General Public License or the GL2PS License for + # more details. +-# ++# + # You should have received a copy of the GNU Library General Public + # License along with this library in the file named "COPYING.LGPL"; + # if not, write to the Free Software Foundation, Inc., 675 Mass Ave, + # Cambridge, MA 02139, USA. +-# ++# + # You should have received a copy of the GL2PS License with this + # library in the file named "COPYING.GL2PS"; if not, I will be glad + # to provide one. +-# ++# + # For the latest info about gl2ps and a full list of contributors, + # see http://www.geuz.org/gl2ps/. +-# ++# + # Please report all bugs and problems to <gl2ps@geuz.org>. + + cmake_minimum_required(VERSION 2.4 FATAL_ERROR) +@@ -55,8 +55,8 @@ set(GL2PS_EXTRA_VERSION "" CACHE STRING "GL2PS extra version string") + set(GL2PS_VERSION "${GL2PS_MAJOR_VERSION}.${GL2PS_MINOR_VERSION}") + set(GL2PS_VERSION "${GL2PS_VERSION}.${GL2PS_PATCH_VERSION}${GL2PS_EXTRA_VERSION}") + +-execute_process(COMMAND date "+%Y%m%d" OUTPUT_VARIABLE DATE +- OUTPUT_STRIP_TRAILING_WHITESPACE) ++execute_process(COMMAND date "+%Y%m%d" OUTPUT_VARIABLE DATE ++OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT DATE) + set(DATE "unknown") + endif(NOT DATE) +@@ -113,84 +113,93 @@ endif(MATH_LIBRARY) + + include_directories(${EXTERNAL_INCLUDES}) + +-if(OPENGL_FOUND) +- add_library(lib STATIC gl2ps.c gl2ps.h) +- set_target_properties(lib PROPERTIES OUTPUT_NAME gl2ps) +- +- add_library(shared SHARED gl2ps.c gl2ps.h) +- target_link_libraries(shared ${EXTERNAL_LIBRARIES}) +- set_target_properties(shared PROPERTIES OUTPUT_NAME gl2ps) +- set_target_properties(shared PROPERTIES +- VERSION ${GL2PS_MAJOR_VERSION}.${GL2PS_MINOR_VERSION}.${GL2PS_PATCH_VERSION} +- SOVERSION ${GL2PS_MAJOR_VERSION}) +- if(MSVC) +- set_target_properties(shared PROPERTIES COMPILE_FLAGS "-DGL2PSDLL -DGL2PSDLL_EXPORTS") +- endif(MSVC) +- +- install(TARGETS lib shared DESTINATION lib${LIB_SUFFIX}) +-endif(OPENGL_FOUND) ++ ++add_library(gl2ps gl2ps.c gl2ps.h) ++target_link_libraries(gl2ps ${EXTERNAL_LIBRARIES}) ++set_target_properties(gl2ps PROPERTIES ++ VERSION ${GL2PS_MAJOR_VERSION}.${GL2PS_MINOR_VERSION}.${GL2PS_PATCH_VERSION} ++SOVERSION ${GL2PS_MAJOR_VERSION}) ++ ++if(BUILD_SHARED_LIBS) ++ target_compile_definitions(gl2ps PRIVATE -DGL2PSDLL -DGL2PSDLL_EXPORTS) ++endif() ++ ++install( ++ TARGETS gl2ps ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++) ++ + + if(WIN32) +- set(GL2PS_DOC .) ++ set(GL2PS_DOC share/gl2ps/docs) + else(WIN32) + set(GL2PS_DOC share/doc/gl2ps) + endif(WIN32) + ++if(NOT DISABLE_INSTALL_HEADERS) + install(FILES gl2ps.h DESTINATION include) + install(FILES ${CMAKE_SOURCE_DIR}/README.txt DESTINATION ${GL2PS_DOC}) + install(FILES ${CMAKE_SOURCE_DIR}/COPYING.LGPL DESTINATION ${GL2PS_DOC}) + install(FILES ${CMAKE_SOURCE_DIR}/COPYING.GL2PS DESTINATION ${GL2PS_DOC}) + install(FILES ${CMAKE_SOURCE_DIR}/gl2psTest.c DESTINATION ${GL2PS_DOC}) + install(FILES ${CMAKE_SOURCE_DIR}/gl2psTestSimple.c DESTINATION ${GL2PS_DOC}) ++endif() ++ ++if(BUILD_TESTS) ++ ++ if(GLUT_FOUND) ++ add_executable(gl2psTest gl2psTest.c) ++ target_link_libraries(gl2psTest gl2ps ${EXTERNAL_LIBRARIES}) ++ add_executable(gl2psTestSimple gl2psTestSimple.c) ++ target_link_libraries(gl2psTestSimple gl2ps ${EXTERNAL_LIBRARIES}) ++ endif(GLUT_FOUND) ++ ++ find_package(LATEX) ++ if(PDFLATEX_COMPILER) ++ add_custom_command(OUTPUT gl2ps.pdf DEPENDS gl2ps.tex ++ COMMAND ${PDFLATEX_COMPILER} ARGS ${CMAKE_SOURCE_DIR}/gl2ps.tex ++ COMMAND ${PDFLATEX_COMPILER} ARGS ${CMAKE_SOURCE_DIR}/gl2ps.tex ++ COMMAND ${PDFLATEX_COMPILER} ARGS ${CMAKE_SOURCE_DIR}/gl2ps.tex ++ COMMAND ${CMAKE_COMMAND} -E copy gl2ps.pdf ${CMAKE_SOURCE_DIR}) ++ add_custom_target(pdf ALL DEPENDS gl2ps.pdf) ++ install(FILES gl2ps.pdf DESTINATION ${GL2PS_DOC}) ++ find_program(TTH tth) ++ if(TTH) ++ add_custom_command(OUTPUT gl2ps.html DEPENDS gl2ps.tex gl2ps.pdf ++ COMMAND ${CMAKE_COMMAND} -E copy_if_different ++ ${CMAKE_SOURCE_DIR}/gl2ps.tex ${CMAKE_BINARY_DIR}/gl2ps.tex ++ COMMAND ${TTH} ARGS -w1 gl2ps.tex) ++ add_custom_target(html DEPENDS gl2ps.html) ++ endif(TTH) ++ endif(PDFLATEX_COMPILER) ++ ++endif() + +-if(GLUT_FOUND) +- add_executable(gl2psTest WIN32 gl2psTest.c) +- target_link_libraries(gl2psTest lib ${EXTERNAL_LIBRARIES}) +- add_executable(gl2psTestSimple WIN32 gl2psTestSimple.c) +- target_link_libraries(gl2psTestSimple lib ${EXTERNAL_LIBRARIES}) +-endif(GLUT_FOUND) +- +-find_package(LATEX) +-if(PDFLATEX_COMPILER) +- add_custom_command(OUTPUT gl2ps.pdf DEPENDS gl2ps.tex +- COMMAND ${PDFLATEX_COMPILER} ARGS ${CMAKE_SOURCE_DIR}/gl2ps.tex +- COMMAND ${PDFLATEX_COMPILER} ARGS ${CMAKE_SOURCE_DIR}/gl2ps.tex +- COMMAND ${PDFLATEX_COMPILER} ARGS ${CMAKE_SOURCE_DIR}/gl2ps.tex +- COMMAND ${CMAKE_COMMAND} -E copy gl2ps.pdf ${CMAKE_SOURCE_DIR}) +- add_custom_target(pdf ALL DEPENDS gl2ps.pdf) +- install(FILES gl2ps.pdf DESTINATION ${GL2PS_DOC}) +- find_program(TTH tth) +- if(TTH) +- add_custom_command(OUTPUT gl2ps.html DEPENDS gl2ps.tex gl2ps.pdf +- COMMAND ${CMAKE_COMMAND} -E copy_if_different +- ${CMAKE_SOURCE_DIR}/gl2ps.tex ${CMAKE_BINARY_DIR}/gl2ps.tex +- COMMAND ${TTH} ARGS -w1 gl2ps.tex) +- add_custom_target(html DEPENDS gl2ps.html) +- endif(TTH) +-endif(PDFLATEX_COMPILER) + + set(CPACK_PACKAGE_VENDOR "Christophe Geuzaine") + set(CPACK_PACKAGE_VERSION_MAJOR ${GL2PS_MAJOR_VERSION}) + set(CPACK_PACKAGE_VERSION_MINOR ${GL2PS_MINOR_VERSION}) + set(CPACK_PACKAGE_VERSION_PATCH ${GL2PS_PATCH_VERSION}) + set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README.txt) +-set(CPACK_PACKAGE_DESCRIPTION_SUMMARY +- "An OpenGL to PostScript (and PDF, and SVG...) printing library") +-set(CPACK_PACKAGE_FILE_NAME gl2ps-${GL2PS_VERSION}-${GL2PS_OS}) +-set(CPACK_PACKAGE_INSTALL_DIRECTORY "gl2ps") +-set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING.LGPL) +-set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.txt) +-set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.txt) +-set(CPACK_PACKAGE_EXECUTABLE "gl2ps;gl2ps") +-set(CPACK_STRIP_FILES TRUE) +-set(CPACK_SOURCE_PACKAGE_FILE_NAME gl2ps-${GL2PS_VERSION}-source) +-set(CPACK_SOURCE_GENERATOR TGZ) +-set(CPACK_SOURCE_IGNORE_FILES "TODO.txt" "${CMAKE_BINARY_DIR}" "/CVS/" +- "/.svn" "~$" "DS_Store$" "/tmp/" "/bin/" "/lib/") +-if(WIN32) +- set(CPACK_GENERATOR ZIP) +-else(WIN32) +- set(CPACK_GENERATOR TGZ) +-endif(WIN32) +- +-include(CPack) ++set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ++ "An OpenGL to PostScript (and PDF, and SVG...) printing library") ++ set(CPACK_PACKAGE_FILE_NAME gl2ps-${GL2PS_VERSION}-${GL2PS_OS}) ++ set(CPACK_PACKAGE_INSTALL_DIRECTORY "gl2ps") ++ set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING.LGPL) ++ set(CPACK_RESOURCE_FILE_README ${CMAKE_SOURCE_DIR}/README.txt) ++ set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_SOURCE_DIR}/README.txt) ++ set(CPACK_PACKAGE_EXECUTABLE "gl2ps;gl2ps") ++ set(CPACK_STRIP_FILES TRUE) ++ set(CPACK_SOURCE_PACKAGE_FILE_NAME gl2ps-${GL2PS_VERSION}-source) ++ set(CPACK_SOURCE_GENERATOR TGZ) ++ set(CPACK_SOURCE_IGNORE_FILES "TODO.txt" "${CMAKE_BINARY_DIR}" "/CVS/" ++ "/.svn" "~$" "DS_Store$" "/tmp/" "/bin/" "/lib/") ++ if(WIN32) ++ set(CPACK_GENERATOR ZIP) ++ else(WIN32) ++ set(CPACK_GENERATOR TGZ) ++ endif(WIN32) ++ ++ # include(CPack) diff --git a/ports/glew/CONTROL b/ports/glew/CONTROL index 6c56fefe9..1d7fc62f5 100644 --- a/ports/glew/CONTROL +++ b/ports/glew/CONTROL @@ -1,3 +1,3 @@ Source: glew -Version: 2.0.0-2 +Version: 2.1.0 Description: The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library.
\ No newline at end of file diff --git a/ports/glew/portfile.cmake b/ports/glew/portfile.cmake index 8ca69eb5f..30f55451a 100644 --- a/ports/glew/portfile.cmake +++ b/ports/glew/portfile.cmake @@ -1,13 +1,13 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/20170423/glew-2.0.0) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glew/glew-2.1.0) vcpkg_download_distfile(ARCHIVE_FILE - URLS "https://sourceforge.net/projects/glew/files/glew/snapshots/glew-20170423.tgz" - FILENAME "glew-20170423.tgz" - SHA512 2d4651196e01b4db7b210fc60505bf50ac9e37b49c8eee9c9bbfeadb4cb6f87f4c907e60e708a7371ff4b7596bee51ed35a76fba76f9a13a1f32f123121f1350 + URLS "https://sourceforge.net/projects/glew/files/glew/2.1.0/glew-2.1.0.tgz" + FILENAME "glew-2.1.0.tgz" + SHA512 9a9b4d81482ccaac4b476c34ed537585ae754a82ebb51c3efa16d953c25cc3931be46ed2e49e79c730cd8afc6a1b78c97d52cd714044a339c3bc29734cd4d2ab ) -vcpkg_extract_source_archive(${ARCHIVE_FILE} ${CURRENT_BUILDTREES_DIR}/src/20170423) +vcpkg_extract_source_archive(${ARCHIVE_FILE} ${CURRENT_BUILDTREES_DIR}/src/glew) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/build/cmake diff --git a/ports/glib/CONTROL b/ports/glib/CONTROL index 9ae5ce296..2d67cd26d 100644 --- a/ports/glib/CONTROL +++ b/ports/glib/CONTROL @@ -1,4 +1,4 @@ Source: glib -Version: 2.52.2 +Version: 2.52.3 Description: Portable, general-purpose utility library. Build-Depends: zlib, pcre, libffi, gettext, libiconv diff --git a/ports/glib/portfile.cmake b/ports/glib/portfile.cmake index e23f5dcb9..9482b4386 100644 --- a/ports/glib/portfile.cmake +++ b/ports/glib/portfile.cmake @@ -10,12 +10,12 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static) endif() include(vcpkg_common_functions) -set(GLIB_VERSION 2.52.2) +set(GLIB_VERSION 2.52.3) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glib-${GLIB_VERSION}) vcpkg_download_distfile(ARCHIVE URLS "https://ftp.gnome.org/pub/gnome/sources/glib/2.52/glib-${GLIB_VERSION}.tar.xz" FILENAME "glib-${GLIB_VERSION}.tar.xz" - SHA512 3ea49b75b6f80d9974ebd3c40518d5aaffffd9d9d008c1ae3302690fa34899b91ae59c87f8235077129bbd8b01ef19211efb89bc7fdb08d0254b07735b1ba92d) + SHA512 a068f2519cfb82de8d4b7f004e7c1f15e841cad4046430a83b02b359d011e0c4077cdff447a1687ed7c68f1a11b4cf66b9ed9fc23ab5f0c7c6be84eb0ddc3017) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_apply_patches( diff --git a/ports/gtk/CONTROL b/ports/gtk/CONTROL index 6a5a0e8b7..a668ff3f5 100644 --- a/ports/gtk/CONTROL +++ b/ports/gtk/CONTROL @@ -1,4 +1,4 @@ Source: gtk -Version: 3.22.15 +Version: 3.22.19 Description: Portable library for creating graphical user interfaces. Build-Depends: glib, atk, gdk-pixbuf, pango, cairo, libepoxy, gettext diff --git a/ports/gtk/portfile.cmake b/ports/gtk/portfile.cmake index 29af53e58..b915ce5f3 100644 --- a/ports/gtk/portfile.cmake +++ b/ports/gtk/portfile.cmake @@ -1,11 +1,11 @@ include(vcpkg_common_functions) -set(GTK_VERSION 3.22.15) +set(GTK_VERSION 3.22.19) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gtk+-${GTK_VERSION}) vcpkg_download_distfile(ARCHIVE URLS "https://ftp.gnome.org/pub/gnome/sources/gtk+/3.22/gtk+-${GTK_VERSION}.tar.xz" FILENAME "gtk+-${GTK_VERSION}.tar.xz" - SHA512 c99c4a52bc447a21be20546bdc7808081abde076af9603424c1de20af031ac3f9bd121709d4c18705db8ba2f66ace0aae9b32741347788a8d81afa358d67e758) + SHA512 c83198794433ee6eb29f8740d59bd7056cd36808b4bff1a99563ab1a1742e6635dab4f2a8be33317f74d3b336f0d1adc28dd91410da056b50a08c215f184dce2) vcpkg_extract_source_archive(${ARCHIVE}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) diff --git a/ports/harfbuzz/CONTROL b/ports/harfbuzz/CONTROL index 5ed9e68b8..acc0b6c7d 100644 --- a/ports/harfbuzz/CONTROL +++ b/ports/harfbuzz/CONTROL @@ -1,4 +1,4 @@ Source: harfbuzz Version: 1.4.6-1 Description: HarfBuzz OpenType text shaping engine -Build-Depends: freetype, glib [windows] +Build-Depends: freetype, glib (windows) diff --git a/ports/highfive/CONTROL b/ports/highfive/CONTROL new file mode 100644 index 000000000..17aa55c8f --- /dev/null +++ b/ports/highfive/CONTROL @@ -0,0 +1,4 @@ +Source: highfive +Version: 1.3 +Description: HighFive is a modern C++/C++11 friendly interface for libhdf5 +Build-Depends: hdf5, boost
\ No newline at end of file diff --git a/ports/highfive/portfile.cmake b/ports/highfive/portfile.cmake new file mode 100644 index 000000000..9fea72553 --- /dev/null +++ b/ports/highfive/portfile.cmake @@ -0,0 +1,13 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/HighFive-1.3) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/BlueBrain/HighFive/archive/v1.3.tar.gz" + FILENAME "highfive.v1.3.tar.gz" + SHA512 258efae1ef5eed45ac1cf93c21c79fab9ee3c340d49a36a4aa2b43c98df1c80db9167a40a0b6a59c4f99b7c190d41d545b53c0f2c5c59aabaffc4b2584b4390b +) +vcpkg_extract_source_archive(${ARCHIVE}) + +# Copy the highfive header files +file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.hpp") +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/highfive RENAME copyright) diff --git a/ports/jsoncpp/CONTROL b/ports/jsoncpp/CONTROL index d4ac63bd3..19f3e054a 100644 --- a/ports/jsoncpp/CONTROL +++ b/ports/jsoncpp/CONTROL @@ -1,3 +1,3 @@ Source: jsoncpp -Version: 1.7.7 +Version: 1.8.1 Description: jsoncpp is an implementation of a JSON reader and writer in C++. JSON (JavaScript Object Notation) is a lightweight data-interchange format that it is easy to parse and redeable for human. diff --git a/ports/jsoncpp/portfile.cmake b/ports/jsoncpp/portfile.cmake index f4b89adca..4f460fda7 100644 --- a/ports/jsoncpp/portfile.cmake +++ b/ports/jsoncpp/portfile.cmake @@ -1,11 +1,11 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/jsoncpp-1.7.7) -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/open-source-parsers/jsoncpp/archive/1.7.7.zip" - FILENAME "jsoncpp-1.7.7.zip" - SHA512 3801faab0b1982bc41dac3049e0f7d24ea3dc759b77afc1ca7365b95a36460f87a74a0f5c6efd4c4a315ea2ca904b38f454b0a70133cda339c4a01ae8049cecb +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO open-source-parsers/jsoncpp + REF 1.8.1 + SHA512 4203826fca4c366b51d28ffc928399c914ffaba8be1cada64ff118b5742e6b469d3fc3e59344587d851447857b479794c5697d4fd11a9a55b32a3a7a801b745b + HEAD_REF master ) -vcpkg_extract_source_archive(${ARCHIVE}) if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) set(JSONCPP_STATIC OFF) @@ -17,29 +17,21 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DJSONCPP_WITH_CMAKE_PACKAGE:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=${JSONCPP_STATIC} -DBUILD_SHARED_LIBS:BOOL=${JSONCPP_DYNAMIC} + -DJSONCPP_WITH_PKGCONFIG_SUPPORT:BOOL=OFF + -DJSONCPP_WITH_TESTS:BOOL=OFF ) vcpkg_install_cmake() # Fix CMake files -file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share) -file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/jsoncpp ${CURRENT_PACKAGES_DIR}/share/jsoncpp) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake) -file(READ ${CURRENT_PACKAGES_DIR}/share/jsoncpp/jsoncppConfig.cmake _contents) -string(REPLACE "get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\n\n" "\n" _contents "${_contents}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/jsoncpp/jsoncppConfig.cmake ${_contents}) +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/jsoncpp) -file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/jsoncpp/jsoncppConfig-debug.cmake _contents) -string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" _contents "${_contents}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/jsoncpp/jsoncppConfig-debug.cmake "${_contents}") - -# Remove useless files in debug +# Remove includes in debug file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig) # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/jsoncpp) diff --git a/ports/jxrlib/CONTROL b/ports/jxrlib/CONTROL index 062850e06..a125cb176 100644 --- a/ports/jxrlib/CONTROL +++ b/ports/jxrlib/CONTROL @@ -1,3 +1,3 @@ Source: jxrlib -Version: 1.1-2 +Version: 1.1-3 Description: Open source implementation of the jpegxr image format standard. diff --git a/ports/jxrlib/portfile.cmake b/ports/jxrlib/portfile.cmake index 57c9dc1fe..c7c089ff7 100644 --- a/ports/jxrlib/portfile.cmake +++ b/ports/jxrlib/portfile.cmake @@ -26,4 +26,4 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(COPY ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/jxrlib) file(RENAME ${CURRENT_PACKAGES_DIR}/share/jxrlib/LICENSE ${CURRENT_PACKAGES_DIR}/share/jxrlib/copyright) -vcpkg_copy_pdbs()
\ No newline at end of file +vcpkg_copy_pdbs() diff --git a/ports/lcms/CMakeLists.txt b/ports/lcms/CMakeLists.txt index cd69bab3b..809fe505e 100644 --- a/ports/lcms/CMakeLists.txt +++ b/ports/lcms/CMakeLists.txt @@ -34,6 +34,11 @@ set(SRCS ) add_definitions(-DUNICODE -D_UNICODE) + +if(BUILD_SHARED_LIBS) + add_definitions(-DCMS_DLL_BUILD) +endif() + string(REPLACE "/utf-8" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") include_directories( diff --git a/ports/lcms/CONTROL b/ports/lcms/CONTROL index 2349503e9..b8c222333 100644 --- a/ports/lcms/CONTROL +++ b/ports/lcms/CONTROL @@ -1,4 +1,4 @@ Source: lcms -Version: 2.8-1 +Version: 2.8-2 Build-Depends: Description: Little CMS.
\ No newline at end of file diff --git a/ports/lcms/portfile.cmake b/ports/lcms/portfile.cmake index 4487cce6a..7a043d1f2 100644 --- a/ports/lcms/portfile.cmake +++ b/ports/lcms/portfile.cmake @@ -1,22 +1,18 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lcms2-2.8) -vcpkg_download_distfile(ARCHIVE - URLS "https://sourceforge.net/projects/lcms/files/lcms/2.8/lcms2-2.8.tar.gz/download" - FILENAME "lcms2-2.8.tar.gz" - SHA512 a9478885b4892c79314a2ef9ab560e6655ac8f2d17abae0805e8b871138bb190e21f0e5c805398449f9dad528dc50baaf9e3cce8b8158eb8ff74179be5733f8f -) -vcpkg_extract_source_archive(${ARCHIVE}) -message(STATUS ${SOURCE_PATH}) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mm2/Little-CMS + REF lcms2.8 + SHA512 ad904ce8acead6c8e255feb8386c1ab3fa432c3b36a3b521bc5c50993cb47ce4d42be0ad240dd8dd3bfeb3c0e884d8184f58797da5ef297b2f9a0e7da9788644 + HEAD_REF master +) -set(USE_SHARED_LIBRARY OFF) -if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - set(USE_SHARED_LIBRARY ON) -endif() +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_DEBUG -DSKIP_INSTALL_HEADERS=ON ) @@ -32,4 +28,4 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) vcpkg_apply_patches( SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include PATCHES "${CMAKE_CURRENT_LIST_DIR}/shared.patch") -endif(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) +endif() diff --git a/ports/lcms/shared.patch b/ports/lcms/shared.patch index b3e7bf75f..2d7506c52 100644 --- a/ports/lcms/shared.patch +++ b/ports/lcms/shared.patch @@ -4,7 +4,7 @@ #endif // CMS_USE_BIG_ENDIAN -+#define CMS_DLL_BUILD ++#define CMS_DLL // Calling convention -- this is hardly platform and compiler dependent #ifdef CMS_IS_WINDOWS_ diff --git a/ports/libccd/portfile.cmake b/ports/libccd/portfile.cmake deleted file mode 100644 index 963000ec5..000000000 --- a/ports/libccd/portfile.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# Common Ambient Variables: -# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> -# TARGET_TRIPLET is the current triplet (x86-windows, etc) -# PORT is the current port name (zlib, etc) -# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} -# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} -# - -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libccd-16b9379fb6e8610566fe5e1396166daf7106f165) -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/danfis/libccd/archive/16b9379fb6e8610566fe5e1396166daf7106f165.zip" - FILENAME "libccd-16b9379fb6e8610566fe5e1396166daf7106f165.zip" - SHA512 6cb3ea713f1b1ac1bf48c9ee7e14cb85b3ec5c822ce239330913edc00cb84c846b49ec090cbfa226ef8de70bac97199eb2bf4c651225e3cfc6f6a9dd441aa7db -) -vcpkg_extract_source_archive(${ARCHIVE}) - -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - # OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2 - # OPTIONS_RELEASE -DOPTIMIZE=1 - # OPTIONS_DEBUG -DDEBUGGABLE=1 -) - -vcpkg_install_cmake() - -# Avoid a copy of file in debug -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) - -# Handle copyright -file(INSTALL ${SOURCE_PATH}/BSD-LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libccd RENAME copyright) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc) - -# Miscellaneous cleanup -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/ccd) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/ccd) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig) - -vcpkg_copy_pdbs()
\ No newline at end of file diff --git a/ports/libharu/CONTROL b/ports/libharu/CONTROL new file mode 100644 index 000000000..b32612433 --- /dev/null +++ b/ports/libharu/CONTROL @@ -0,0 +1,4 @@ +Source: libharu +Version: 2017-08-15-d84867ebf9f-1 +Description: libharu - free PDF library +Build-Depends: zlib,libpng diff --git a/ports/libharu/portfile.cmake b/ports/libharu/portfile.cmake new file mode 100644 index 000000000..a1ae49816 --- /dev/null +++ b/ports/libharu/portfile.cmake @@ -0,0 +1,58 @@ +include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO libharu/libharu + REF d84867ebf9f3de6afd661d2cdaff102457fbc371 + SHA512 789579dd52c1056ae90a4ce5360c26ba92cadae5341a3901c4159afe624129a1f628fa6412952a398e048b0e5040c93f7ed5b4e4bc620a22d897098298fe2a99 + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} +) + +vcpkg_build_cmake() + +file(GLOB DLLS + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.dll" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/*.dll" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/Release/*.dll" +) +file(GLOB LIBS + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.lib" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/*.lib" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/Release/*.lib" +) +file(GLOB DEBUG_DLLS + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.dll" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Debug/*.dll" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*/Debug/*.dll" +) +file(GLOB DEBUG_LIBS + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.lib" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Debug/*.lib" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*/Debug/*.lib" +) +file(GLOB HEADERS "${SOURCE_PATH}/include/*.h" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/include/*.h") + +if(DLLS) + file(INSTALL ${DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin) +endif() +file(INSTALL ${LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib) + +if(DEBUG_DLLS) + file(INSTALL ${DEBUG_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() +file(INSTALL ${DEBUG_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) + +file(INSTALL ${HEADERS} DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +file(INSTALL ${SOURCE_PATH}/LICENCE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libharu RENAME copyright) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) + file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libhpdfs.lib ${CURRENT_PACKAGES_DIR}/lib/libhpdf.lib) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libhpdfsd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libhpdfd.lib) +endif() + +vcpkg_copy_pdbs() diff --git a/ports/libmad/CMakeLists.txt b/ports/libmad/CMakeLists.txt index 8e15017c0..522c0fbea 100644 --- a/ports/libmad/CMakeLists.txt +++ b/ports/libmad/CMakeLists.txt @@ -53,5 +53,5 @@ install( install( FILES mad.h - DESTINATION include/mad + DESTINATION include ) diff --git a/ports/libmad/portfile.cmake b/ports/libmad/portfile.cmake index d9e20ecb5..65b926d55 100644 --- a/ports/libmad/portfile.cmake +++ b/ports/libmad/portfile.cmake @@ -7,6 +7,11 @@ vcpkg_download_distfile(ARCHIVE ) vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES "${CMAKE_CURRENT_LIST_DIR}/use_fpm_default.patch" +) + #The archive only contains a Visual Studio 6.0 era DSP project file, so use a custom CMakeLists.txt file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) diff --git a/ports/libmad/use_fpm_default.patch b/ports/libmad/use_fpm_default.patch new file mode 100644 index 000000000..f20c8265e --- /dev/null +++ b/ports/libmad/use_fpm_default.patch @@ -0,0 +1,16 @@ +--- mad.h 2004-01-23 10:36:03.000000000 +0100 ++++ mad.h 2017-08-12 16:03:38.060392600 +0200 +@@ -24,7 +24,7 @@ + extern "C" { + # endif + +-# define FPM_INTEL ++# define FPM_DEFAULT +--- msvc++/mad.h 2017-08-12 16:04:30.678146600 +0200 ++++ msvc++/mad.h 2017-08-12 16:04:00.779378000 +0200 +@@ -24,7 +24,7 @@ + extern "C" { + # endif + +-# define FPM_INTEL ++# define FPM_DEFAULT diff --git a/ports/libogg/CONTROL b/ports/libogg/CONTROL index fb4557e57..47fd8faab 100644 --- a/ports/libogg/CONTROL +++ b/ports/libogg/CONTROL @@ -1,3 +1,3 @@ Source: libogg -Version: 2017-07-27-cab46b19847 +Version: 1.3.2-cab46b1-2 Description: Ogg is a multimedia container format, and the native file and stream format for the Xiph.org multimedia codecs. diff --git a/ports/libogg/portfile.cmake b/ports/libogg/portfile.cmake index fb666acde..a3640c54c 100644 --- a/ports/libogg/portfile.cmake +++ b/ports/libogg/portfile.cmake @@ -9,6 +9,9 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON ) vcpkg_install_cmake() diff --git a/ports/libp7-baical/CMakeLists.txt b/ports/libp7-baical/CMakeLists.txt index c4559c603..6b1044e43 100644 --- a/ports/libp7-baical/CMakeLists.txt +++ b/ports/libp7-baical/CMakeLists.txt @@ -3,13 +3,14 @@ cmake_minimum_required(VERSION 3.0) set(SOURCES "Sources/ClBaical.cpp" "Sources/ClFile.cpp" - "Sources/ClText.cpp" "Sources/Client.cpp" "Sources/ClNull.cpp" + "Sources/ClText.cpp" "Sources/CRC32.cpp" "Sources/Proxy.cpp" "Sources/Telemetry.cpp" - "Sources/Trace.cpp") + "Sources/Trace.cpp" +) if(WIN32) set(RESOURCES "Sources/P7Client.rc") diff --git a/ports/libp7-baical/CONTROL b/ports/libp7-baical/CONTROL index df6cf94b6..e117adea5 100644 --- a/ports/libp7-baical/CONTROL +++ b/ports/libp7-baical/CONTROL @@ -1,3 +1,3 @@ Source: libp7-baical -Version: 4.1 +Version: 4.4-1 Description: P7 is a library for high-speed sending telemetry & trace data from application diff --git a/ports/libp7-baical/portfile.cmake b/ports/libp7-baical/portfile.cmake index f298186e0..bb9b751f4 100644 --- a/ports/libp7-baical/portfile.cmake +++ b/ports/libp7-baical/portfile.cmake @@ -4,8 +4,12 @@ if(VCPKG_TARGET_ARCHITECTURE STREQUAL arm) message(FATAL_ERROR "libP7 does not support ARM") endif() -set(LIBP7_VERSION 4.1) -set(LIBP7_HASH 6259416378f1fe60ad6097faf9facd2de1a3ea13e8015a5727d6a179caa88a7f6707b47273afceebc16b39883da4768f29feac199f7d6c354b744b643c2044ab) +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(FATAL_ERROR "libP7 does not support UWP") +endif() + +set(LIBP7_VERSION 4.4) +set(LIBP7_HASH ce33db9a0c731e4dff95646703fe5fd96015f1c528377aa5dbe2e533529b0e8c45a4b74ee2b4616a811a7f9038c12edf106b08b3c21cec9cb6bdf85ad6e1d64f) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libP7_v${LIBP7_VERSION}) vcpkg_download_distfile(ARCHIVE diff --git a/ports/libpng/CONTROL b/ports/libpng/CONTROL index c9b3dc2d2..3238eec3b 100644 --- a/ports/libpng/CONTROL +++ b/ports/libpng/CONTROL @@ -1,4 +1,4 @@ Source: libpng -Version: 1.6.31 +Version: 1.6.32 Build-Depends: zlib Description: libpng is a library implementing an interface for reading and writing PNG (Portable Network Graphics) format files. diff --git a/ports/libpng/portfile.cmake b/ports/libpng/portfile.cmake index baa39a903..e012bb6dc 100644 --- a/ports/libpng/portfile.cmake +++ b/ports/libpng/portfile.cmake @@ -1,11 +1,11 @@ include(vcpkg_common_functions) -set(LIBPNG_VERSION 1.6.31) +set(LIBPNG_VERSION 1.6.32) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libpng-${LIBPNG_VERSION}) vcpkg_download_distfile(ARCHIVE URLS "https://downloads.sourceforge.net/project/libpng/libpng16/${LIBPNG_VERSION}/libpng-${LIBPNG_VERSION}.tar.xz" FILENAME "libpng-${LIBPNG_VERSION}.tar.xz" - SHA512 714da63e19d32eadeeb44edf7f2afeaf6ac59f2756e0951015313a98c0f3c1216296886301c5704958b56f4c96b00725791ba2efe9f26b4a92cd743410cc36a9 + SHA512 24cf4d38dc08d1db7721fc580d8bf6cee9a105afcea32f1245b7bb3727c8a8645ad733a24534782ef5dfb0d4315a5fd6b0eee9e7f0704e0c635350f80c19a708 ) vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_apply_patches( diff --git a/ports/libraw/CONTROL b/ports/libraw/CONTROL index 9d355533b..9d23b7740 100644 --- a/ports/libraw/CONTROL +++ b/ports/libraw/CONTROL @@ -1,4 +1,4 @@ Source: libraw -Version: 0.18.2-2 -Build-Depends: lcms, libjpeg-turbo +Version: 0.18.2-3 +Build-Depends: lcms, jasper Description: raw image decoder library diff --git a/ports/libraw/portfile.cmake b/ports/libraw/portfile.cmake index 0b13213ad..797ca5aa0 100644 --- a/ports/libraw/portfile.cmake +++ b/ports/libraw/portfile.cmake @@ -23,13 +23,21 @@ file(COPY ${LIBRAW_CMAKE_SOURCE_PATH}/cmake DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DINSTALL_CMAKE_MODULE_PATH=${CURRENT_PACKAGES_DIR}/share/libraw ) -vcpkg_build_cmake() vcpkg_install_cmake() +file(READ ${CURRENT_PACKAGES_DIR}/include/libraw/libraw_types.h LIBRAW_H) +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + string(REPLACE "#ifdef LIBRAW_NODLL" "#if 1" LIBRAW_H "${LIBRAW_H}") +else() + string(REPLACE "#ifdef LIBRAW_NODLL" "#if 0" LIBRAW_H "${LIBRAW_H}") +endif() +file(WRITE ${CURRENT_PACKAGES_DIR}/include/libraw/libraw_types.h "${LIBRAW_H}") + # Rename thread-safe version to be "raw.lib". This is unfortunately needed # because otherwise libraries that build on top of libraw have to choose. file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/raw.lib ${CURRENT_PACKAGES_DIR}/debug/lib/raw.lib) diff --git a/ports/libsigcpp/CMakeLists.txt b/ports/libsigcpp/CMakeLists.txt index 7a669a24e..30c3c610e 100644 --- a/ports/libsigcpp/CMakeLists.txt +++ b/ports/libsigcpp/CMakeLists.txt @@ -5,14 +5,14 @@ set(SIGCPP_API_VERSION 2.0) add_definitions(-DSIGC_BUILD) -include_directories(./MSVC_Net2013) # config file for windows is there +include_directories(./MSVC_Net2017) # config file for windows is there include_directories(.) + set(SICGPP_SOURCES sigc++/connection.cc sigc++/signal_base.cc sigc++/trackable.cc - sigc++/adaptors/lambda/lambda.cc sigc++/functors/slot_base.cc) add_library(sigc ${SICGPP_SOURCES}) @@ -20,12 +20,13 @@ set_target_properties(sigc PROPERTIES OUTPUT_NAME sigc-${SIGCPP_API_VERSION}) install(TARGETS sigc RUNTIME DESTINATION bin ARCHIVE DESTINATION lib) if(NOT SIGCPP_SKIP_HEADERS) - install(FILES MSVC_Net2013/sigc++config.h DESTINATION include) + install(FILES MSVC_Net2017/sigc++config.h DESTINATION include) install(FILES sigc++/sigc++.h DESTINATION include/sigc++) install(FILES sigc++/bind.h DESTINATION include/sigc++) install(FILES sigc++/bind_return.h DESTINATION include/sigc++) install(FILES sigc++/connection.h DESTINATION include/sigc++) install(FILES sigc++/limit_reference.h DESTINATION include/sigc++) + install(FILES sigc++/member_method_trait.h DESTINATION include/sigc++) install(FILES sigc++/reference_wrapper.h DESTINATION include/sigc++) install(FILES sigc++/retype_return.h DESTINATION include/sigc++) install(FILES sigc++/signal.h DESTINATION include/sigc++) @@ -34,24 +35,30 @@ if(NOT SIGCPP_SKIP_HEADERS) install(FILES sigc++/trackable.h DESTINATION include/sigc++) install(FILES sigc++/type_traits.h DESTINATION include/sigc++) install(FILES sigc++/visit_each.h DESTINATION include/sigc++) + install(FILES sigc++/weak_raw_ptr.h DESTINATION include/sigc++) install(FILES sigc++/adaptors/adaptors.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/adaptor_base.h DESTINATION include/sigc++/adaptors) install(FILES sigc++/adaptors/adaptor_trait.h DESTINATION include/sigc++/adaptors) + install(FILES sigc++/adaptors/adapts.h DESTINATION include/sigc++/adaptors) install(FILES sigc++/adaptors/bind.h DESTINATION include/sigc++/adaptors) install(FILES sigc++/adaptors/bind_return.h DESTINATION include/sigc++/adaptors) install(FILES sigc++/adaptors/bound_argument.h DESTINATION include/sigc++/adaptors) install(FILES sigc++/adaptors/compose.h DESTINATION include/sigc++/adaptors) - install(FILES sigc++/adaptors/deduce_result_type.h DESTINATION include/sigc++/adaptors) install(FILES sigc++/adaptors/exception_catch.h DESTINATION include/sigc++/adaptors) install(FILES sigc++/adaptors/hide.h DESTINATION include/sigc++/adaptors) install(FILES sigc++/adaptors/retype.h DESTINATION include/sigc++/adaptors) install(FILES sigc++/adaptors/retype_return.h DESTINATION include/sigc++/adaptors) install(FILES sigc++/adaptors/track_obj.h DESTINATION include/sigc++/adaptors) - install(FILES sigc++/adaptors/lambda/base.h DESTINATION include/sigc++/adaptors/lambda) - install(FILES sigc++/adaptors/lambda/select.h DESTINATION include/sigc++/adaptors/lambda) + install(FILES sigc++/adaptors/tuple_visitor_visit_each.h DESTINATION include/sigc++/adaptors) install(FILES sigc++/functors/functors.h DESTINATION include/sigc++/functors) install(FILES sigc++/functors/functor_trait.h DESTINATION include/sigc++/functors) install(FILES sigc++/functors/mem_fun.h DESTINATION include/sigc++/functors) install(FILES sigc++/functors/ptr_fun.h DESTINATION include/sigc++/functors) install(FILES sigc++/functors/slot.h DESTINATION include/sigc++/functors) install(FILES sigc++/functors/slot_base.h DESTINATION include/sigc++/functors) + install(FILES sigc++/tuple-utils/tuple_cdr.h DESTINATION include/sigc++/tuple-utils) + install(FILES sigc++/tuple-utils/tuple_end.h DESTINATION include/sigc++/tuple-utils) + install(FILES sigc++/tuple-utils/tuple_for_each.h DESTINATION include/sigc++/tuple-utils) + install(FILES sigc++/tuple-utils/tuple_start.h DESTINATION include/sigc++/tuple-utils) + install(FILES sigc++/tuple-utils/tuple_transform_each.h DESTINATION include/sigc++/tuple-utils) endif() diff --git a/ports/libsigcpp/CONTROL b/ports/libsigcpp/CONTROL index 02b2e4b83..da2338200 100644 --- a/ports/libsigcpp/CONTROL +++ b/ports/libsigcpp/CONTROL @@ -1,3 +1,3 @@ Source: libsigcpp
-Version: 2.10
+Version: 2.99
Description: Typesafe callback framework for C++
diff --git a/ports/libsigcpp/portfile.cmake b/ports/libsigcpp/portfile.cmake index c98a26717..7525c1aae 100644 --- a/ports/libsigcpp/portfile.cmake +++ b/ports/libsigcpp/portfile.cmake @@ -1,10 +1,10 @@ include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libsigc++-2.10.0)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libsigc++-2.99.9)
vcpkg_download_distfile(ARCHIVE
- URLS "http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.10/libsigc++-2.10.0.tar.xz"
- FILENAME "libsigc++-2.10.0.tar.xz"
- SHA512 5b96df21d6bd6ba41520c7219e77695a86aabc60b7259262c7a9f4b8475ce0e2fd8dc37bcf7c17e24e818ff28c262d682b964c83e215b51bdbe000f3f58794ae)
+ URLS "http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.99/libsigc++-2.99.9.tar.xz"
+ FILENAME "libsigc++-2.99.9.tar.xz"
+ SHA512 3e8f8176a4618938a16b2367466415aff8ec10d83ef84de8973373a63fc0b9708d14115ad5c039c81b570385b205944651849a68e618c37c171cd748dd5b2403)
vcpkg_extract_source_archive(${ARCHIVE})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
diff --git a/ports/libuv/CONTROL b/ports/libuv/CONTROL index bbfcda090..61f5711d1 100644 --- a/ports/libuv/CONTROL +++ b/ports/libuv/CONTROL @@ -1,3 +1,3 @@ Source: libuv -Version: 1.13.1 +Version: 1.14.0 Description: libuv is a multi-platform support library with a focus on asynchronous I/O.
\ No newline at end of file diff --git a/ports/libuv/portfile.cmake b/ports/libuv/portfile.cmake index 47447df99..a75385132 100644 --- a/ports/libuv/portfile.cmake +++ b/ports/libuv/portfile.cmake @@ -2,8 +2,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libuv/libuv - REF v1.13.1 - SHA512 5d4bbc90f353ea438e8eac3ea0c4e89c09d3f51629c1d06b52072f04d8cccfd7119189ba21ad13eb8df28575e0844fbb1b09ed903bd95f6ea806e6cba353ef1a + REF v1.14.0 + SHA512 a838f2e97250a78861b72458d9278935d9e8151d69de21de19499dfe9d7304d65ce578c007356b75cd4ce2c17735292d93cdb2fcc206d4e2430ee3f9a2fc7222 HEAD_REF v1.x) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) diff --git a/ports/libxml2/portfile.cmake b/ports/libxml2/portfile.cmake index de98368c9..d50183f1d 100644 --- a/ports/libxml2/portfile.cmake +++ b/ports/libxml2/portfile.cmake @@ -9,7 +9,7 @@ include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libxml2-2.9.4) vcpkg_download_distfile(ARCHIVE - URLS "ftp://xmlsoft.org/libxml2/libxml2-2.9.4.tar.gz" + URLS "ftp://xmlsoft.org/libxml2/libxml2-2.9.4.tar.gz" "http://xmlsoft.org/sources/libxml2-2.9.4.tar.gz" FILENAME "libxml2-2.9.4.tar.gz" SHA512 f5174ab1a3a0ec0037a47f47aa47def36674e02bfb42b57f609563f84c6247c585dbbb133c056953a5adb968d328f18cbc102eb0d00d48eb7c95478389e5daf9 ) @@ -29,4 +29,4 @@ vcpkg_install_cmake() file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libxml2) file(RENAME ${CURRENT_PACKAGES_DIR}/share/libxml2/COPYING ${CURRENT_PACKAGES_DIR}/share/libxml2/copyright) -vcpkg_copy_pdbs()
\ No newline at end of file +vcpkg_copy_pdbs() diff --git a/ports/lz4/CMakeLists.txt b/ports/lz4/CMakeLists.txt index a5366f5ab..b082ab374 100644 --- a/ports/lz4/CMakeLists.txt +++ b/ports/lz4/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.0) -project(lz4) +project(lz4 C) if(BUILD_SHARED_LIBS) add_definitions(-DLZ4_DLL_EXPORT) diff --git a/ports/lz4/CONTROL b/ports/lz4/CONTROL index b48ba5424..c6d730c2d 100644 --- a/ports/lz4/CONTROL +++ b/ports/lz4/CONTROL @@ -1,3 +1,3 @@ Source: lz4
-Version: 1.7.5
+Version: 1.8.0
Description: Lossless compression algorithm, providing compression speed at 400 MB/s per core.
diff --git a/ports/lz4/auto-define-import-macro.patch b/ports/lz4/auto-define-import-macro.patch deleted file mode 100644 index 314c228db..000000000 --- a/ports/lz4/auto-define-import-macro.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/lz4.h b/lz4.h -index 7420ad8..c1c3e56 100644 ---- a/lz4.h -+++ b/lz4.h -@@ -73,6 +73,9 @@ extern "C" { - * LZ4_DLL_EXPORT : - * Enable exporting of functions when building a Windows DLL - */ -+ -+#define LZ4_DLL_IMPORT 1 -+ - #if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1) - # define LZ4LIB_API __declspec(dllexport) - #elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1) -diff --git a/lz4frame.h b/lz4frame.h -index 3104d2e..4442461 100644 ---- a/lz4frame.h -+++ b/lz4frame.h -@@ -55,6 +55,9 @@ extern "C" { - * LZ4_DLL_EXPORT : - * Enable exporting of functions when building a Windows DLL - */ -+ -+#define LZ4_DLL_IMPORT 1 -+ - #if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1) - # define LZ4FLIB_API __declspec(dllexport) - #elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1) diff --git a/ports/lz4/portfile.cmake b/ports/lz4/portfile.cmake index dc6f80ed9..6664c2b79 100644 --- a/ports/lz4/portfile.cmake +++ b/ports/lz4/portfile.cmake @@ -1,12 +1,10 @@ -
include(vcpkg_common_functions)
-set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lz4-1.7.5)
-vcpkg_download_distfile(ARCHIVE
- URLS "https://github.com/lz4/lz4/archive/v1.7.5.zip"
- FILENAME "lz4-1.7.5.zip"
- SHA512 09968b67a5cd8555f6e1d95b99971a82d228c6d8d9f9dd9e9a33c9633bed9bcf1e370c2ff44e58c6ca72d103c149585b3e83061c690f3e857eb5f53d586f86a4)
-
-vcpkg_extract_source_archive(${ARCHIVE})
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO lz4/lz4
+ REF v1.8.0
+ SHA512 aea46d4a900a3ede7dd7b498ee938ecd98397d3277c5b3a85b4236a44777cba85cd68a2f32c993b872afda96c5dafe0cb3dd391101fe8181e17c9f48884c1535
+ HEAD_REF dev)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
@@ -19,12 +17,15 @@ vcpkg_configure_cmake( vcpkg_install_cmake()
vcpkg_copy_pdbs()
-if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
- vcpkg_apply_patches(
- SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
- PATCHES
- ${CMAKE_CURRENT_LIST_DIR}/auto-define-import-macro.patch)
-endif()
+foreach(FILE lz4.h lz4frame.h)
+ file(READ ${CURRENT_PACKAGES_DIR}/include/${FILE} LZ4_HEADER)
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ string(REPLACE "defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)" "1" LZ4_HEADER "${LZ4_HEADER}")
+ else()
+ string(REPLACE "defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)" "0" LZ4_HEADER "${LZ4_HEADER}")
+ endif()
+ file(WRITE ${CURRENT_PACKAGES_DIR}/include/${FILE} "${LZ4_HEADER}")
+endforeach()
file(COPY ${SOURCE_PATH}/lib/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/lz4)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/lz4/LICENSE ${CURRENT_PACKAGES_DIR}/share/lz4/copyright)
diff --git a/ports/lzfse/CONTROL b/ports/lzfse/CONTROL new file mode 100644 index 000000000..7559d661e --- /dev/null +++ b/ports/lzfse/CONTROL @@ -0,0 +1,3 @@ +Source: lzfse +Version: 1.0 +Description: Lempel-Ziv style data compressor using Finite State Entropy coding. diff --git a/ports/lzfse/disable-cli-option.patch b/ports/lzfse/disable-cli-option.patch new file mode 100644 index 000000000..260b7a2be --- /dev/null +++ b/ports/lzfse/disable-cli-option.patch @@ -0,0 +1,51 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 336a68d..96a2a74 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -67,18 +67,20 @@ add_library(lzfse + src/lzvn_encode_base.c) + lzfse_add_compiler_flags(lzfse -Wall -Wno-unknown-pragmas -Wno-unused-variable) + +-add_executable(lzfse_cli +- src/lzfse_main.c) +-target_link_libraries(lzfse_cli lzfse) +-set_target_properties(lzfse_cli PROPERTIES OUTPUT_NAME lzfse) +-lzfse_add_compiler_flags(lzfse_cli -Wall -Wno-unknown-pragmas -Wno-unused-variable) +- +-if(CMAKE_VERSION VERSION_LESS 3.1 OR CMAKE_C_COMPLIER_ID STREQUAL "Intel") +- lzfse_add_compiler_flags(lzfse -std=c99) +- lzfse_add_compiler_flags(lzfse_cli -std=c99) +-else() +- set_property(TARGET lzfse PROPERTY C_STANDARD 99) +- set_property(TARGET lzfse_cli PROPERTY C_STANDARD 99) ++if(NOT LZFSE_DISABLE_CLI) ++ add_executable(lzfse_cli ++ src/lzfse_main.c) ++ target_link_libraries(lzfse_cli lzfse) ++ set_target_properties(lzfse_cli PROPERTIES OUTPUT_NAME lzfse) ++ lzfse_add_compiler_flags(lzfse_cli -Wall -Wno-unknown-pragmas -Wno-unused-variable) ++ ++ if(CMAKE_VERSION VERSION_LESS 3.1 OR CMAKE_C_COMPLIER_ID STREQUAL "Intel") ++ lzfse_add_compiler_flags(lzfse -std=c99) ++ lzfse_add_compiler_flags(lzfse_cli -std=c99) ++ else() ++ set_property(TARGET lzfse PROPERTY C_STANDARD 99) ++ set_property(TARGET lzfse_cli PROPERTY C_STANDARD 99) ++ endif() + endif() + + set_target_properties(lzfse PROPERTIES +@@ -95,7 +97,12 @@ endif() + if(NOT LZFSE_BUNDLE_MODE) + include(GNUInstallDirs) + +- install(TARGETS lzfse lzfse_cli ++ if(NOT LZFSE_DISABLE_CLI) ++ install(TARGETS lzfse_cli ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ++ endif() ++ ++ install(TARGETS lzfse + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") diff --git a/ports/lzfse/portfile.cmake b/ports/lzfse/portfile.cmake new file mode 100644 index 000000000..80d9e2f10 --- /dev/null +++ b/ports/lzfse/portfile.cmake @@ -0,0 +1,37 @@ +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") + message(FATAL_ERROR "ARM build not supported") +endif() + +include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO lzfse/lzfse + REF lzfse-1.0 + SHA512 9d7ca44e6d3d2bdf4b82b0eb66c14922369b8b6fe2cf891187a77c6708b8d26c2c1b2ccddec6059e85dbbbb37c497419549f02812b5f34d06238ac246a8cf912 + HEAD_REF master) + +vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/disable-cli-option.patch) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DLZFSE_DISABLE_TESTS=ON + -DLZFSE_DISABLE_CLI=ON) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +file(READ ${CURRENT_PACKAGES_DIR}/include/lzfse.h LZFSE_H) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + string(REPLACE "defined(LZFSE_DLL)" "1" LZFSE_H "${LZFSE_H}") +else() + string(REPLACE "defined(LZFSE_DLL)" "0" LZFSE_H "${LZFSE_H}") +endif() +file(WRITE ${CURRENT_PACKAGES_DIR}/include/lzfse.h "${LZFSE_H}") + +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/lzfse) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/lzfse/LICENSE ${CURRENT_PACKAGES_DIR}/share/lzfse/copyright) diff --git a/ports/mongo-c-driver/CONTROL b/ports/mongo-c-driver/CONTROL index 8d77eeca5..a460b313c 100644 --- a/ports/mongo-c-driver/CONTROL +++ b/ports/mongo-c-driver/CONTROL @@ -1,4 +1,4 @@ Source: mongo-c-driver Version: 1.6.2 -Build-Depends: libbson, openssl [uwp] +Build-Depends: libbson, openssl (uwp) Description: Client library written in C for MongoDB.
\ No newline at end of file diff --git a/ports/mpfr/CMakeLists.txt b/ports/mpfr/CMakeLists.txt new file mode 100644 index 000000000..8a989ff28 --- /dev/null +++ b/ports/mpfr/CMakeLists.txt @@ -0,0 +1,275 @@ +cmake_minimum_required(VERSION 3.3.0) + +project(MPFR VERSION 3.1.5 LANGUAGES C) + +# Find GMP (or MPIR) +find_library(GMP_LIBRARY NAMES gmp mpir) +find_path(GMP_INCLUDE_DIR "gmp.h") + +set(GMP_LIBRARIES ${GMP_LIBRARY}) +set(GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR}) + +# Sources +set(SRCS + src/mpfr.h + src/mpf2mpfr.h + src/mpfr-gmp.h + src/mpfr-impl.h + src/mpfr-intmax.h + src/mpfr-longlong.h + src/mpfr-thread.h + src/exceptions.c + src/extract.c + src/uceil_exp2.c + src/uceil_log2.c + src/ufloor_log2.c + src/add.c + src/add1.c + src/add_ui.c + src/agm.c + src/clear.c + src/cmp.c + src/cmp_abs.c + src/cmp_si.c + src/cmp_ui.c + src/comparisons.c + src/div_2exp.c + src/div_2si.c + src/div_2ui.c + src/div.c + src/div_ui.c + src/dump.c + src/eq.c + src/exp10.c + src/exp2.c + src/exp3.c + src/exp.c + src/frac.c + src/frexp.c + src/get_d.c + src/get_exp.c + src/get_str.c + src/init.c + src/inp_str.c + src/isinteger.c + src/isinf.c + src/isnan.c + src/isnum.c + src/const_log2.c + src/log.c + src/modf.c + src/mul_2exp.c + src/mul_2si.c + src/mul_2ui.c + src/mul.c + src/mul_ui.c + src/neg.c + src/next.c + src/out_str.c + src/printf.c + src/vasprintf.c + src/const_pi.c + src/pow.c + src/pow_si.c + src/pow_ui.c + src/print_raw.c + src/print_rnd_mode.c + src/reldiff.c + src/round_prec.c + src/set.c + src/setmax.c + src/setmin.c + src/set_d.c + src/set_dfl_prec.c + src/set_exp.c + src/set_rnd.c + src/set_f.c + src/set_prc_raw.c + src/set_prec.c + src/set_q.c + src/set_si.c + src/set_str.c + src/set_str_raw.c + src/set_ui.c + src/set_z.c + src/sqrt.c + src/sqrt_ui.c + src/sub.c + src/sub1.c + src/sub_ui.c + src/rint.c + src/ui_div.c + src/ui_sub.c + src/urandom.c + src/urandomb.c + src/get_z_exp.c + src/swap.c + src/factorial.c + src/cosh.c + src/sinh.c + src/tanh.c + src/sinh_cosh.c + src/acosh.c + src/asinh.c + src/atanh.c + src/atan.c + src/cmp2.c + src/exp_2.c + src/asin.c + src/const_euler.c + src/cos.c + src/sin.c + src/tan.c + src/fma.c + src/fms.c + src/hypot.c + src/log1p.c + src/expm1.c + src/log2.c + src/log10.c + src/ui_pow.c + src/ui_pow_ui.c + src/minmax.c + src/dim.c + src/signbit.c + src/copysign.c + src/setsign.c + src/gmp_op.c + src/init2.c + src/acos.c + src/sin_cos.c + src/set_nan.c + src/set_inf.c + src/set_zero.c + src/powerof2.c + src/gamma.c + src/set_ld.c + src/get_ld.c + src/cbrt.c + src/volatile.c + src/fits_s.h + src/fits_sshort.c + src/fits_sint.c + src/fits_slong.c + src/fits_u.h + src/fits_ushort.c + src/fits_uint.c + src/fits_ulong.c + src/fits_uintmax.c + src/fits_intmax.c + src/get_si.c + src/get_ui.c + src/zeta.c + src/cmp_d.c + src/erf.c + src/inits.c + src/inits2.c + src/clears.c + src/sgn.c + src/check.c + src/sub1sp.c + src/version.c + src/mpn_exp.c + src/mpfr-gmp.c + src/mp_clz_tab.c + src/sum.c + src/add1sp.c + src/free_cache.c + src/si_op.c + src/cmp_ld.c + src/set_ui_2exp.c + src/set_si_2exp.c + src/set_uj.c + src/set_sj.c + src/get_sj.c + src/get_uj.c + src/get_z.c + src/iszero.c + src/cache.c + src/sqr.c + src/int_ceil_log2.c + src/isqrt.c + src/strtofr.c + src/pow_z.c + src/logging.c + src/mulders.c + src/get_f.c + src/round_p.c + src/erfc.c + src/atan2.c + src/subnormal.c + src/const_catalan.c + src/root.c + src/gen_inverse.h + src/sec.c + src/csc.c + src/cot.c + src/eint.c + src/sech.c + src/csch.c + src/coth.c + src/round_near_x.c + src/constant.c + src/abort_prec_max.c + src/stack_interface.c + src/lngamma.c + src/zeta_ui.c + src/set_d64.c + src/get_d64.c + src/jn.c + src/yn.c + src/rem1.c + src/get_patches.c + src/add_d.c + src/sub_d.c + src/d_sub.c + src/mul_d.c + src/div_d.c + src/d_div.c + src/li2.c + src/rec_sqrt.c + src/min_prec.c + src/buildopt.c + src/digamma.c + src/bernoulli.c + src/isregular.c + src/set_flt.c + src/get_flt.c + src/scale2.c + src/set_z_exp.c + src/ai.c + src/gammaonethird.c + src/ieee_floats.h + src/grandom.c) + +configure_file("src/mparam_h.in" "mparam.h") + +# Create and configure the target +add_library(mpfr ${SRCS}) + +# target_compile_definitions(mpfr PRIVATE HAVE_CONFIG_H) +target_compile_definitions(mpfr PRIVATE __MPFR_WITHIN_MPFR) +if(BUILD_SHARED_LIBS) + target_compile_definitions(mpfr PRIVATE __GMP_LIBGMP_DLL) +endif() + +target_link_libraries(mpfr ${GMP_LIBRARIES}) + +target_include_directories(mpfr PUBLIC ${GMP_INCLUDE_DIRS}) +target_include_directories(mpfr PRIVATE ${CMAKE_BINARY_DIR}) +target_include_directories(mpfr PRIVATE ${PROJECT_SOURCE_DIR}) +target_include_directories(mpfr PRIVATE ${PROJECT_SOURCE_DIR}/src) + +# Install +install( + TARGETS mpfr + EXPORT MPFRExports + RUNTIME DESTINATION "bin" + LIBRARY DESTINATION "lib" + ARCHIVE DESTINATION "lib" + ) + +install( + FILES src/mpfr.h + DESTINATION "include" +)
\ No newline at end of file diff --git a/ports/mpfr/CONTROL b/ports/mpfr/CONTROL new file mode 100644 index 000000000..16224d73b --- /dev/null +++ b/ports/mpfr/CONTROL @@ -0,0 +1,4 @@ +Source: mpfr +Version: 3.1.5 +Description: The MPFR library is a C library for multiple-precision floating-point computations with correct rounding +Build-Depends: mpir
\ No newline at end of file diff --git a/ports/mpfr/portfile.cmake b/ports/mpfr/portfile.cmake new file mode 100644 index 000000000..6a61d4038 --- /dev/null +++ b/ports/mpfr/portfile.cmake @@ -0,0 +1,23 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpfr-3.1.5) +vcpkg_download_distfile(ARCHIVE + URLS "http://www.mpfr.org/mpfr-current/mpfr-3.1.5.tar.xz" + FILENAME "mpfr-3.1.5.tar.xz" + SHA512 3643469b9099b31e41d6ec9158196cd1c30894030c8864ee5b1b1e91b488bccbf7c263c951b03fe9f4ae6f9d29279e157a7dfed0885467d875f107a3d964f032 +) + +vcpkg_extract_source_archive(${ARCHIVE}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mpfr) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/mpfr/COPYING ${CURRENT_PACKAGES_DIR}/share/mpfr/copyright) diff --git a/ports/openssl/fix-uwp-pathlib.patch b/ports/openssl/fix-uwp-pathlib.patch deleted file mode 100644 index 17a1a4e10..000000000 --- a/ports/openssl/fix-uwp-pathlib.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git "a/ms/setVSvars.bat" "b/ms/setVSvars.bat" -index e6ebc0a7..cde9afb2 100644 ---- "a/ms/setVSvars.bat" -+++ "b/ms/setVSvars.bat" -@@ -179,7 +179,7 @@ exit /b - call:setVar _VS14VC VisualStudio14VC - call:setVar _WKITS10 WindowsKits10.0 - set PATH=%_VS14VCBin%;%PATH% -- set "LIBPATH=%_WKITS10%UnionMetadata\Facade;%_VS14VC%vcpackages;%_WKITS10%references\windows.foundation.foundationcontract\1.0.0.0\;%_WKITS10%references\windows.foundation.universalapicontract\1.0.0.0\" -+ set "LIBPATH=%_WKITS10%UnionMetadata\Facade;%_VS14VC%vcpackages;%_WKITS10%references\windows.foundation.foundationcontract\2.0.0.0\;%_WKITS10%references\windows.foundation.universalapicontract\3.0.0.0\" - goto :eof - - :end diff --git a/ports/openssl/make-openssl.bat b/ports/openssl/make-openssl.bat index 6f0afdf74..4f6488e8d 100644 --- a/ports/openssl/make-openssl.bat +++ b/ports/openssl/make-openssl.bat @@ -2,13 +2,8 @@ set build=%1 perl Configure no-asm no-hw no-dso VC-WINUNIVERSAL -FS -FIWindows.h -set LibPath=%LibPath%;%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.FoundationContract\3.0.0.0\ -set LibPath=%LibPath%;%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.FoundationContract\2.0.0.0\ -set LibPath=%LibPath%;%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.FoundationContract\1.0.0.0\ -set LibPath=%LibPath%;%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.UniversalApiContract\4.0.0.0\ -set LibPath=%LibPath%;%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.UniversalApiContract\3.0.0.0\ -set LibPath=%LibPath%;%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.UniversalApiContract\2.0.0.0\ -set LibPath=%LibPath%;%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.UniversalApiContract\1.0.0.0\ +for /D %%f in ("%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.FoundationContract\*") do set LibPath=%LibPath%;%%f\ +for /D %%f in ("%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.UniversalApiContract\*") do set LibPath=%LibPath%;%%f\ call ms\do_winuniversal.bat diff --git a/ports/openssl/portfile-uwp.cmake b/ports/openssl/portfile-uwp.cmake index e1f7a7932..4f83f2eed 100644 --- a/ports/openssl/portfile-uwp.cmake +++ b/ports/openssl/portfile-uwp.cmake @@ -43,75 +43,50 @@ vcpkg_download_distfile(ARCHIVE vcpkg_extract_source_archive(${ARCHIVE}) -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-uwp-pathlib.patch -) - file(REMOVE_RECURSE ${SOURCE_PATH}/tmp32dll) file(REMOVE_RECURSE ${SOURCE_PATH}/out32dll) file(REMOVE_RECURSE ${SOURCE_PATH}/inc32dll) -file(COPY -${CMAKE_CURRENT_LIST_DIR}/make-openssl.bat -DESTINATION ${SOURCE_PATH}) +file( + COPY ${CMAKE_CURRENT_LIST_DIR}/make-openssl.bat + DESTINATION ${SOURCE_PATH} +) message(STATUS "Build ${TARGET_TRIPLET}") - vcpkg_execute_required_process( - COMMAND ${SOURCE_PATH}/make-openssl.bat ${UWP_PLATFORM} + COMMAND ${SOURCE_PATH}/make-openssl.bat ${UWP_PLATFORM} WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME make-openssl-${TARGET_TRIPLET} ) - - message(STATUS "Build ${TARGET_TRIPLET} done") - - file( COPY ${SOURCE_PATH}/inc32/openssl DESTINATION ${CURRENT_PACKAGES_DIR}/include ) -file(INSTALL ${SOURCE_PATH}/out32dll/libeay32.dll - DESTINATION ${CURRENT_PACKAGES_DIR}/bin) - -file(INSTALL ${SOURCE_PATH}/out32dll/libeay32.pdb +file(INSTALL + ${SOURCE_PATH}/out32dll/libeay32.dll + ${SOURCE_PATH}/out32dll/libeay32.pdb + ${SOURCE_PATH}/out32dll/ssleay32.dll + ${SOURCE_PATH}/out32dll/ssleay32.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/bin) -file(INSTALL ${SOURCE_PATH}/out32dll/libeay32.lib +file(INSTALL + ${SOURCE_PATH}/out32dll/libeay32.lib + ${SOURCE_PATH}/out32dll/ssleay32.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) -file(INSTALL ${SOURCE_PATH}/out32dll/ssleay32.dll - DESTINATION ${CURRENT_PACKAGES_DIR}/bin) - -file(INSTALL ${SOURCE_PATH}/out32dll/ssleay32.pdb - DESTINATION ${CURRENT_PACKAGES_DIR}/bin) - -file(INSTALL ${SOURCE_PATH}/out32dll/ssleay32.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/lib) - - - -file(INSTALL ${SOURCE_PATH}/out32dll/libeay32.dll - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) - -file(INSTALL ${SOURCE_PATH}/out32dll/libeay32.pdb - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) - -file(INSTALL ${SOURCE_PATH}/out32dll/libeay32.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) - -file(INSTALL ${SOURCE_PATH}/out32dll/ssleay32.dll +file(INSTALL + ${SOURCE_PATH}/out32dll/libeay32.dll + ${SOURCE_PATH}/out32dll/libeay32.pdb + ${SOURCE_PATH}/out32dll/ssleay32.dll + ${SOURCE_PATH}/out32dll/ssleay32.pdb DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) -file(INSTALL ${SOURCE_PATH}/out32dll/ssleay32.pdb - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) - -file(INSTALL ${SOURCE_PATH}/out32dll/ssleay32.lib +file(INSTALL + ${SOURCE_PATH}/out32dll/libeay32.lib + ${SOURCE_PATH}/out32dll/ssleay32.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) - - file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openssl RENAME copyright) diff --git a/ports/pango/CMakeLists.txt b/ports/pango/CMakeLists.txt index 7dad7dbcf..9c7e7f182 100644 --- a/ports/pango/CMakeLists.txt +++ b/ports/pango/CMakeLists.txt @@ -81,6 +81,7 @@ pango_add_module(pango pango/pango-color.c pango/pango-context.c pango/pango-coverage.c + pango/pango-emoji.c pango/pango-engine.c pango/pango-fontmap.c pango/pango-fontset.c diff --git a/ports/pango/CONTROL b/ports/pango/CONTROL index 011f33691..44c8c9b83 100644 --- a/ports/pango/CONTROL +++ b/ports/pango/CONTROL @@ -1,4 +1,4 @@ Source: pango
-Version: 1.40.6
+Version: 1.40.11
Description: Text and font handling library.
Build-Depends: glib, gettext, cairo, fontconfig, freetype, harfbuzz
diff --git a/ports/pango/portfile.cmake b/ports/pango/portfile.cmake index 7f28b8ca7..009953534 100644 --- a/ports/pango/portfile.cmake +++ b/ports/pango/portfile.cmake @@ -1,10 +1,10 @@ include(vcpkg_common_functions)
-set(PANGO_VERSION 1.40.6)
+set(PANGO_VERSION 1.40.11)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pango-${PANGO_VERSION})
vcpkg_download_distfile(ARCHIVE
URLS "http://ftp.gnome.org/pub/GNOME/sources/pango/1.40/pango-${PANGO_VERSION}.tar.xz"
FILENAME "pango-${PANGO_VERSION}.tar.xz"
- SHA512 d916b364a77de3e68779e6d841d95bca456daf89405b92eaf51dceef093a9761cbb6c48f4c2971dec47c0bbdb645a3f3f4fb9af425274bf1d1822b278575e1f7)
+ SHA512 e4ac40f8da9c326e1e4dfaf4b1d2070601b17f88f5a12991a9a8bbc58bb08640404e2a794a5c68c5ebb2e7e80d9c186d4b26cd417bb63a23f024ef8a38bb152a)
vcpkg_extract_source_archive(${ARCHIVE})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
@@ -20,7 +20,6 @@ vcpkg_configure_cmake( OPTIONS_DEBUG
-DPANGO_SKIP_HEADERS=ON)
-vcpkg_build_cmake()
vcpkg_install_cmake()
vcpkg_copy_pdbs()
diff --git a/ports/pangolin/CONTROL b/ports/pangolin/CONTROL new file mode 100644 index 000000000..5e110627b --- /dev/null +++ b/ports/pangolin/CONTROL @@ -0,0 +1,4 @@ +Source: pangolin +Version: 0.5 +Build-Depends: eigen3 +Description: Lightweight GUI Library
\ No newline at end of file diff --git a/ports/pangolin/portfile.cmake b/ports/pangolin/portfile.cmake new file mode 100644 index 000000000..d93f9d7cd --- /dev/null +++ b/ports/pangolin/portfile.cmake @@ -0,0 +1,44 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO stevenlovegrove/Pangolin + REF v0.5 + SHA512 7ebeec108f33f1aa8b1ad08e3ca128a837b22d33e3fc580021f981784043b023a1bf563bbfa8b51d46863db770b336d24fc84ee3d836b85e0da1848281b2a5b2 + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/Pangolin") + +vcpkg_copy_pdbs() + +file(GLOB EXE ${CURRENT_PACKAGES_DIR}/lib/*.dll) +file(COPY ${EXE} DESTINATION ${CURRENT_PACKAGES_DIR}/bin) +file(REMOVE ${EXE}) + +file(GLOB DEBUG_EXE ${CURRENT_PACKAGES_DIR}/debug/lib/*.dll) +file(COPY ${DEBUG_EXE} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) +file(REMOVE ${DEBUG_EXE}) + +file(READ ${CURRENT_PACKAGES_DIR}/share/pangolin/PangolinTargets-debug.cmake PANGOLIN_TARGETS) +string(REPLACE "lib/pangolin.dll" "bin/pangolin.dll" PANGOLIN_TARGETS "${PANGOLIN_TARGETS}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/pangolin/PangolinTargets-debug.cmake "${PANGOLIN_TARGETS}") + +file(READ ${CURRENT_PACKAGES_DIR}/share/pangolin/PangolinTargets-release.cmake PANGOLIN_TARGETS) +string(REPLACE "lib/pangolin.dll" "bin/pangolin.dll" PANGOLIN_TARGETS "${PANGOLIN_TARGETS}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/pangolin/PangolinTargets-release.cmake "${PANGOLIN_TARGETS}") + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Put the license file where vcpkg expects it +file(COPY ${SOURCE_PATH}/LICENCE DESTINATION ${CURRENT_PACKAGES_DIR}/share/Pangolin/) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/Pangolin/LICENCE ${CURRENT_PACKAGES_DIR}/share/Pangolin/copyright) diff --git a/ports/pcre2/CONTROL b/ports/pcre2/CONTROL index 8a118b3e7..b25e10d49 100644 --- a/ports/pcre2/CONTROL +++ b/ports/pcre2/CONTROL @@ -1,3 +1,3 @@ Source: pcre2 -Version: 10.23 +Version: 10.30 Description: PCRE2 is a re-working of the original Perl Compatible Regular Expressions library diff --git a/ports/pcre2/portfile.cmake b/ports/pcre2/portfile.cmake index fa7bbcf4b..0f5bee964 100644 --- a/ports/pcre2/portfile.cmake +++ b/ports/pcre2/portfile.cmake @@ -1,9 +1,10 @@ +set(PCRE2_VERSION 10.30) include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pcre2-10.23) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pcre2-${PCRE2_VERSION}) vcpkg_download_distfile(ARCHIVE - URLS "https://sourceforge.net/projects/pcre/files/pcre2/10.23/pcre2-10.23.zip/download" - FILENAME "pcre2-10.23.zip" - SHA512 0f0638ce28ce17e18425d499cc516a30dabbfa868180ea320361ffeaa26d4f6f6975f12bc20024f7457fe3c6eed686976a9e5c66c2785d1ea63bee38131ea0d2) + URLS "https://sourceforge.net/projects/pcre/files/pcre2/${PCRE2_VERSION}/pcre2-${PCRE2_VERSION}.zip/download" + FILENAME "pcre2-${PCRE2_VERSION}.zip" + SHA512 03e570b946ac29498a114b27e715a0fcf25702bfc9623f9fc085ee8a3214ab3c303baccb9c0af55da6916e8ce40d931d97f1ee9628690563041a943f0aa2bc54) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/pthreads/CMakeLists.txt b/ports/pthreads/CMakeLists.txt new file mode 100644 index 000000000..7ae6bcc34 --- /dev/null +++ b/ports/pthreads/CMakeLists.txt @@ -0,0 +1,213 @@ +cmake_minimum_required(VERSION 3.9.0) + +project(pthreads) + +set(PTHREAD_PUBLIC_HEADERS pthread.h sched.h semaphore.h) + +set(PTHREAD_SHARED_SOURCES + autostatic.c + barrier.c + cancel.c + cleanup.c + condvar.c + create.c + dll.c + errno.c + exit.c + fork.c + global.c + misc.c + mutex.c + nonportable.c + private.c + rwlock.c + sched.c + semaphore.c + signal.c + spin.c + sync.c + tsd.c + attr.C +) +set(PTHREAD_STATIC_SOURCES + autostatic.c + cleanup.c + create.c + dll.c + errno.c + fork.c + global.c + pthread_attr_destroy.c + pthread_attr_getdetachstate.c + pthread_attr_getinheritsched.c + pthread_attr_getschedparam.c + pthread_attr_getschedpolicy.c + pthread_attr_getscope.c + pthread_attr_getstackaddr.c + pthread_attr_getstacksize.c + pthread_attr_init.c + pthread_attr_setdetachstate.c + pthread_attr_setinheritsched.c + pthread_attr_setschedparam.c + pthread_attr_setschedpolicy.c + pthread_attr_setscope.c + pthread_attr_setstackaddr.c + pthread_attr_setstacksize.c + pthread_barrier_destroy.c + pthread_barrier_init.c + pthread_barrier_wait.c + pthread_barrierattr_destroy.c + pthread_barrierattr_getpshared.c + pthread_barrierattr_init.c + pthread_barrierattr_setpshared.c + pthread_cancel.c + pthread_cond_destroy.c + pthread_cond_init.c + pthread_cond_signal.c + pthread_cond_wait.c + pthread_condattr_destroy.c + pthread_condattr_getpshared.c + pthread_condattr_init.c + pthread_condattr_setpshared.c + pthread_delay_np.c + pthread_detach.c + pthread_equal.c + pthread_exit.c + pthread_getconcurrency.c + pthread_getschedparam.c + pthread_getspecific.c + pthread_getunique_np.c + pthread_getw32threadhandle_np.c + pthread_join.c + pthread_key_create.c + pthread_key_delete.c + pthread_kill.c + pthread_mutex_consistent.c + pthread_mutex_destroy.c + pthread_mutex_init.c + pthread_mutex_lock.c + pthread_mutex_timedlock.c + pthread_mutex_trylock.c + pthread_mutex_unlock.c + pthread_mutexattr_destroy.c + pthread_mutexattr_getkind_np.c + pthread_mutexattr_getpshared.c + pthread_mutexattr_getrobust.c + pthread_mutexattr_gettype.c + pthread_mutexattr_init.c + pthread_mutexattr_setkind_np.c + pthread_mutexattr_setpshared.c + pthread_mutexattr_setrobust.c + pthread_mutexattr_settype.c + pthread_num_processors_np.c + pthread_once.c + pthread_rwlock_destroy.c + pthread_rwlock_init.c + pthread_rwlock_rdlock.c + pthread_rwlock_tryrdlock.c + pthread_rwlock_trywrlock.c + pthread_rwlock_unlock.c + pthread_rwlock_wrlock.c + pthread_rwlockattr_destroy.c + pthread_rwlockattr_getpshared.c + pthread_rwlockattr_init.c + pthread_rwlockattr_setpshared.c + pthread_self.c + pthread_setcancelstate.c + pthread_setcanceltype.c + pthread_setconcurrency.c + pthread_setschedparam.c + pthread_setspecific.c + pthread_spin_destroy.c + pthread_spin_init.c + pthread_spin_lock.c + pthread_spin_trylock.c + pthread_spin_unlock.c + pthread_testcancel.c + pthread_timechange_handler_np.c + pthread_win32_attach_detach_np.c + ptw32_calloc.c + ptw32_callUserDestroyRoutines.c + ptw32_cond_check_need_init.c + ptw32_getprocessors.c + ptw32_is_attr.c + ptw32_MCS_lock.c + ptw32_mutex_check_need_init.c + ptw32_new.c + ptw32_processInitialize.c + ptw32_processTerminate.c + ptw32_relmillisecs.c + ptw32_reuse.c + ptw32_rwlock_check_need_init.c + ptw32_semwait.c + ptw32_spinlock_check_need_init.c + ptw32_threadDestroy.c + ptw32_threadStart.c + ptw32_throw.c + ptw32_timespec.c + ptw32_tkAssocCreate.c + ptw32_tkAssocDestroy.c + sched_get_priority_max.c + sched_get_priority_min.c + sched_getscheduler.c + sched_setscheduler.c + sched_yield.c + sem_close.c + sem_destroy.c + sem_getvalue.c + sem_init.c + sem_open.c + sem_post_multiple.c + sem_post.c + sem_timedwait.c + sem_trywait.c + sem_unlink.c + sem_wait.c + signal.c + w32_CancelableWait.c +) + + + +option(PTW32_ARCH "x32") +add_definitions(-DPTW32_ARCH=${PTW32_ARCH} -DPTW32_RC_MSC -DHAVE_PTW32_CONFIG_H -D_TIMESPEC_DEFINED) + +if(BUILD_SHARED_LIBS) + set(PTHREAD_SOURCES ${PTHREAD_SHARED_SOURCES}) + add_definitions(-DPTW32_BUILD) +else() + set(PTHREAD_SOURCES ${PTHREAD_STATIC_SOURCES}) + add_definitions(-DPTW32_STATIC_LIB) +endif() + + +if(PTHREADS_BUILD_CPP) + set(PTHREADS_EXCEPTION_SCHEME CE) + add_definitions(/__CLEANUP_CXX) +elseif(PTHREADS_BUILD_SEH) + set(PTHREADS_EXCEPTION_SCHEME SE) + add_definitions(/__CLEANUP_SEH) +else() + set(PTHREADS_EXCEPTION_SCHEME C) +endif() + +set(PTHREADS_COMPATIBILITY_VERSION 2) +set(CMAKE_DEBUG_POSTFIX d) +set(PTHREADS_COMPILER V) + +set(PTHREADS_LIBRARY "pthreads${PTHREADS_COMPILER}${PTHREADS_EXCEPTION_SCHEME}${PTHREADS_COMPATIBILITY_VERSION}") + +include_directories(.) + +add_library(${PTHREADS_LIBRARY} ${PTHREAD_SOURCES}) + +install( + TARGETS ${PTHREADS_LIBRARY} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +if(NOT DISABLE_INSTALL_HEADERS) + install(FILES ${PTHREAD_PUBLIC_HEADERS} DESTINATION include) +endif() diff --git a/ports/pthreads/CONTROL b/ports/pthreads/CONTROL new file mode 100644 index 000000000..81b97f70b --- /dev/null +++ b/ports/pthreads/CONTROL @@ -0,0 +1,3 @@ +Source: pthreads +Version: 2.9.1 +Description: pthreads for windows diff --git a/ports/pthreads/portfile.cmake b/ports/pthreads/portfile.cmake new file mode 100644 index 000000000..cabf8a39b --- /dev/null +++ b/ports/pthreads/portfile.cmake @@ -0,0 +1,34 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pthreads-w32-2-9-1-release) +vcpkg_download_distfile(ARCHIVE + URLS "ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.tar.gz" + FILENAME "pthreads-w32-2-9-1-release.tar.gz" + SHA512 9c06e85310766834370c3dceb83faafd397da18a32411ca7645c8eb6b9495fea54ca2872f4a3e8d83cb5fdc5dea7f3f0464be5bb9af3222a6534574a184bd551 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS -DPTW32_ARCH=${VCPKG_TARGET_ARCHITECTURE} + OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=ON +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +file(GLOB HEADERS "${CURRENT_PACKAGES_DIR}/include/*.h") +foreach(HEADER ${HEADERS}) + file(READ "${HEADER}" _contents) + string(REPLACE "defined(_TIMESPEC_DEFINED)" "1" _contents "${_contents}") + string(REPLACE "defined(PTW32_RC_MSC)" "1" _contents "${_contents}") + if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + string(REPLACE "!defined(PTW32_STATIC_LIB)" "0" _contents "${_contents}") + endif() + file(WRITE "${HEADER}" "${_contents}") +endforeach() + +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/pthreads RENAME copyright) diff --git a/ports/rhash/CMakeLists.txt b/ports/rhash/CMakeLists.txt new file mode 100644 index 000000000..b395b5c9a --- /dev/null +++ b/ports/rhash/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.5) +project(rhash C) + +file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/Makefile RHASH_SOURCES REGEX "^SOURCES = .*$") +string(REPLACE "SOURCES = " "" RHASH_SOURCES "${RHASH_SOURCES}") +string(REPLACE " " ";" RHASH_SOURCES "${RHASH_SOURCES}") + +add_library(rhash ${RHASH_SOURCES}) +set_target_properties(rhash PROPERTIES COMPILE_DEFINITIONS "IN_RHASH" DEFINE_SYMBOL "RHASH_EXPORTS") + +install(TARGETS rhash RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + +if(NOT RHASH_SKIP_HEADERS) + install(FILES rhash.h rhash_torrent.h DESTINATION include) +endif() diff --git a/ports/rhash/CONTROL b/ports/rhash/CONTROL new file mode 100644 index 000000000..cfa5c6cb0 --- /dev/null +++ b/ports/rhash/CONTROL @@ -0,0 +1,3 @@ +Source: rhash +Version: 1.3.5 +Description: C library for computing a wide variety of hash sums diff --git a/ports/rhash/portfile.cmake b/ports/rhash/portfile.cmake new file mode 100644 index 000000000..749501375 --- /dev/null +++ b/ports/rhash/portfile.cmake @@ -0,0 +1,25 @@ +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + message(FATAL_ERROR "UWP builds not supported") +endif() + +include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO rhash/RHash + REF v1.3.5 + SHA512 e8450aab0c16bfb975bf4aeee218740fb4d86d5514e426b70c3edb84e4d63865cd4051939aa95c24a87a78baaedc49e40bb509b2610e89ca3745930808b3ef6c + HEAD_REF master) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}/librhash) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH}/librhash + PREFER_NINJA + OPTIONS_DEBUG + -DRHASH_SKIP_HEADERS=ON) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/rhash) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/rhash/COPYING ${CURRENT_PACKAGES_DIR}/share/rhash/copyright) diff --git a/ports/snappy/CONTROL b/ports/snappy/CONTROL index 984b00882..287c9235e 100644 --- a/ports/snappy/CONTROL +++ b/ports/snappy/CONTROL @@ -1,3 +1,3 @@ Source: snappy -Version: 1.1.6-be6dc3d +Version: 1.1.7 Description: A fast compressor/decompressor. diff --git a/ports/snappy/portfile.cmake b/ports/snappy/portfile.cmake index 7e78a7f1b..f0169c8f2 100644 --- a/ports/snappy/portfile.cmake +++ b/ports/snappy/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO google/snappy - REF be6dc3db83c4701e3e79694dcbfd1c3da03b91dd - SHA512 1e01a925a2c0bab8b9a329d005384e4b620df118317fd8408ea6afdb22278a2710d26b8d51e2ef762798c757a9e01b47db55280ebb84ca290fb88ae5b18d63e3 + REF 1.1.7 + SHA512 32046f532606ba545a4e4825c0c66a19be449f2ca2ff760a6fa170a3603731479a7deadb683546e5f8b5033414c50f4a9a29f6d23b7a41f047e566e69eca7caf HEAD_REF master ) @@ -16,18 +16,6 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/Snappy) - -if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - foreach(CONF debug release) - file(READ ${CURRENT_PACKAGES_DIR}/share/snappy/SnappyTargets-${CONF}.cmake CONFIG_FILE) - string(REPLACE "lib/snappy.dll" "bin/snappy.dll" CONFIG_FILE "${CONFIG_FILE}") - file(WRITE ${CURRENT_PACKAGES_DIR}/share/snappy/SnappyTargets-${CONF}.cmake "${CONFIG_FILE}") - endforeach() - file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) - file(RENAME ${CURRENT_PACKAGES_DIR}/lib/snappy.dll ${CURRENT_PACKAGES_DIR}/bin/snappy.dll) - file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/snappy.dll ${CURRENT_PACKAGES_DIR}/debug/bin/snappy.dll) -endif() - vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/sophus/CONTROL b/ports/sophus/CONTROL new file mode 100644 index 000000000..8214c4e7e --- /dev/null +++ b/ports/sophus/CONTROL @@ -0,0 +1,4 @@ +Source: sophus +Version: 1.0.0 +Build-Depends: eigen3, ceres +Description: Lie group library for C++ diff --git a/ports/sophus/portfile.cmake b/ports/sophus/portfile.cmake new file mode 100644 index 000000000..9a45e62b8 --- /dev/null +++ b/ports/sophus/portfile.cmake @@ -0,0 +1,27 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO strasdat/Sophus + REF v1.0.0 + SHA512 569634a8be9237d2240cf30c01e2677ece75d55f1196030f1228baca62fa22460e8ceb2a63bd46afdf7f02d8eb79c59d6ed666228b852da78590de897b278fab + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/Sophus") + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib) + +# Put the license file where vcpkg expects it +file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/Sophus/) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/Sophus/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/Sophus/copyright) diff --git a/ports/spdlog/CONTROL b/ports/spdlog/CONTROL index 540e4eb5e..e060a2665 100644 --- a/ports/spdlog/CONTROL +++ b/ports/spdlog/CONTROL @@ -1,4 +1,4 @@ Source: spdlog -Version: 0.13.0 +Version: 0.14.0 Description: Very fast, header only, C++ logging library Build-Depends: fmt diff --git a/ports/spdlog/portfile.cmake b/ports/spdlog/portfile.cmake index c0adbf457..8cd05f343 100644 --- a/ports/spdlog/portfile.cmake +++ b/ports/spdlog/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO gabime/spdlog - REF v0.13.0 - SHA512 5bb89cbeb17a054832ce70f6013d54e7641c1aa36cbad08388b4a2e63f4851943edfe292551ff01de6de1ed6325617384325a67f3e1024f346c6d22a1148c80c + REF v0.14.0 + SHA512 f49b7f26f4fde57fe16f32ab89082f0c590645c627f5b4646f633a16f3eec2926b3465e742bc4899cb802e7b974978c547638205065e9955ed9696fbcaf0b444 HEAD_REF master ) diff --git a/ports/speexdsp/CMakeLists.txt b/ports/speexdsp/CMakeLists.txt new file mode 100644 index 000000000..76a3a9118 --- /dev/null +++ b/ports/speexdsp/CMakeLists.txt @@ -0,0 +1,31 @@ +# CMAKE project for libspeexdsp +cmake_minimum_required(VERSION 3.1) +option(SOURCE_PATH "Root directory.") +project (libspeexdsp) + +file(GLOB_RECURSE LIBSPEEXDSP_SOURCES "${SOURCE_PATH}/libspeexdsp/*.c") +list(REMOVE_ITEM LIBSPEEXDSP_SOURCES "${SOURCE_PATH}/libspeexdsp/testdenoise.c" + "${SOURCE_PATH}/libspeexdsp/testecho.c" + "${SOURCE_PATH}/libspeexdsp/testjitter.c" + "${SOURCE_PATH}/libspeexdsp/testresample.c") +file(GLOB_RECURSE LIBSPEEXDSP_HEADERS "${SOURCE_PATH}/libspeexdsp/*.h") +file(GLOB_RECURSE LIBSPEEXDSP_HEADERS_PUBLIC "${SOURCE_PATH}/include/**/*.h") + +if (BUILD_SHARED_LIBS) + add_definitions(-D_WINDOWS -D_USRDLL) + list(APPEND LIBSPEEXDSP_SOURCES "${SOURCE_PATH}/win32/libspeexdsp.def") +else () + add_definitions(-D_LIB) +endif () + +add_definitions(-D_USE_SSE -DHAVE_CONFIG_H -D_WIN32) +include_directories("${SOURCE_PATH}/include" + "${SOURCE_PATH}/win32") +add_library(libspeexdsp ${LIBSPEEXDSP_SOURCES} ${LIBSPEEXDSP_HEADERS}) + +set_target_properties(libspeexdsp PROPERTIES PUBLIC_HEADER "${LIBSPEEXDSP_HEADERS_PUBLIC}") + +install(TARGETS libspeexdsp + ARCHIVE DESTINATION "lib" + RUNTIME DESTINATION "bin" + PUBLIC_HEADER DESTINATION "include/speex") diff --git a/ports/speexdsp/CONTROL b/ports/speexdsp/CONTROL new file mode 100644 index 000000000..71144ecdd --- /dev/null +++ b/ports/speexdsp/CONTROL @@ -0,0 +1,4 @@ +Source: speexdsp +Version: 1.2rc3-1 +Description: A patent-free, Open Source/Free Software DSP library. +Build-Depends: diff --git a/ports/speexdsp/portfile.cmake b/ports/speexdsp/portfile.cmake new file mode 100644 index 000000000..7784b7313 --- /dev/null +++ b/ports/speexdsp/portfile.cmake @@ -0,0 +1,24 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/speexdsp-1.2rc3) +set(CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}) +vcpkg_download_distfile(ARCHIVE_FILE + URLS "http://downloads.xiph.org/releases/speex/speexdsp-1.2rc3.tar.gz" + FILENAME "speexdsp-1.2rc3.tar.xz" + SHA512 29dfa8345df025eeb076561648a9b5c0485692be699b6da3c2a3734b4329187a1c2eb181252f4df12b21f1309ecdf59797437dfb123d160fd723491ab216e858 +) +vcpkg_extract_source_archive(${ARCHIVE_FILE}) + +vcpkg_configure_cmake( + SOURCE_PATH ${CMAKE_PATH} + OPTIONS -DSOURCE_PATH=${SOURCE_PATH} +) + +vcpkg_install_cmake() + +# Remove debug include +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Copy copright information +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/speexdsp" RENAME "copyright") + +vcpkg_copy_pdbs() diff --git a/ports/tiff/CONTROL b/ports/tiff/CONTROL index 28452b794..f5727b475 100644 --- a/ports/tiff/CONTROL +++ b/ports/tiff/CONTROL @@ -1,4 +1,4 @@ Source: tiff Version: 4.0.8 -Build-Depends: zlib, libjpeg-turbo, liblzma [windows] +Build-Depends: zlib, libjpeg-turbo, liblzma (windows) Description: A library that supports the manipulation of TIFF image files diff --git a/ports/unrar/CONTROL b/ports/unrar/CONTROL new file mode 100644 index 000000000..ce6d4dab8 --- /dev/null +++ b/ports/unrar/CONTROL @@ -0,0 +1,3 @@ +Source: unrar +Version: 5.5.8 +Description: rarlab's unrar libary diff --git a/ports/unrar/portfile.cmake b/ports/unrar/portfile.cmake new file mode 100644 index 000000000..294fe9ac2 --- /dev/null +++ b/ports/unrar/portfile.cmake @@ -0,0 +1,38 @@ +include(vcpkg_common_functions) +set(UNRAR_VERSION "5.5.8") +set(UNRAR_SHA512 9eac83707fa47a03925e5f3e8adf47889064d748304b732d12a2d379ab525b441f1aa33216377d4ef445f45c4e8ad73d2cd0b560601ceac344c60571b77fd6aa) +set(UNRAR_FILENAME unrarsrc-${UNRAR_VERSION}.tar.gz) +set(UNRAR_URL http://www.rarlab.com/rar/${UNRAR_FILENAME}) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/unrar) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + message(FATAL_ERROR "A static build is included with the dynamic build. Try VCPKG INSTALL UNRAR:X86-WINDOWS UNRAR:X64-WINDOWS") +endif() + +#SRC +vcpkg_download_distfile(ARCHIVE + URLS ${UNRAR_URL} + FILENAME ${UNRAR_FILENAME} + SHA512 ${UNRAR_SHA512} +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_build_msbuild( + PROJECT_PATH "${SOURCE_PATH}/UnRARDll.vcxproj" + OPTIONS_DEBUG /p:OutDir=../../${TARGET_TRIPLET}-dbg/ + OPTIONS_RELEASE /p:OutDir=../../${TARGET_TRIPLET}-rel/ + OPTIONS /VERBOSITY:Diagnostic /DETAILEDSUMMARY +) + +#INCLUDE (named dll.hpp in source, and unrar.h in all rarlabs distributions) +file(INSTALL ${SOURCE_PATH}/dll.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/include RENAME unrar.h) + +#DLL & LIB +file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/unrar.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/unrar.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/unrar.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/unrar.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) +vcpkg_copy_pdbs() + +#COPYRIGHT +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/unrar RENAME copyright) diff --git a/ports/xerces-c/portfile.cmake b/ports/xerces-c/portfile.cmake index 1208c9787..5623e9518 100644 --- a/ports/xerces-c/portfile.cmake +++ b/ports/xerces-c/portfile.cmake @@ -16,15 +16,13 @@ if (VCPKG_CRT_LINKAGE STREQUAL "static") set(VCPKG_CRT_LINKAGE "dynamic") endif() - -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/xerces-c-3.1.4) - -vcpkg_download_distfile(ARCHIVE - URLS "http://www-us.apache.org/dist//xerces/c/3/sources/xerces-c-3.1.4.zip" - FILENAME "xerces-c-3.1.4.zip" - SHA512 3ba1bf38875bda8a294990dba73143cfd6dbfa158b17f4db1fd0ee9a08a078af969103200eaf8957756f8363c8a661983cc95124b4978eb2162dc0344a85fff8 +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO apache/xerces-c + REF Xerces-C_3_1_4 + SHA512 6dc3e4bb68bc32a0e8ec6dcc7ec67e21239a79c909d08ccc16c96dc5de4e73800993d1c09f589606925507baf0b2a9bf6037d28c84dae826935bf1f7a151071e + HEAD_REF master ) -vcpkg_extract_source_archive(${ARCHIVE}) if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86") set(BUILD_ARCH "Win32") diff --git a/ports/zstd/CONTROL b/ports/zstd/CONTROL index 52713f2b8..ba363a585 100644 --- a/ports/zstd/CONTROL +++ b/ports/zstd/CONTROL @@ -1,3 +1,3 @@ Source: zstd -Version: 1.3.0 +Version: 1.3.1 Description: Zstandard - Fast real-time compression algorithm http://www.zstd.net diff --git a/ports/zstd/portfile.cmake b/ports/zstd/portfile.cmake index ba60826e0..1f93cac74 100644 --- a/ports/zstd/portfile.cmake +++ b/ports/zstd/portfile.cmake @@ -2,8 +2,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO facebook/zstd - REF v1.3.0 - SHA512 5eb9e001e14d3342e76eb57b672c636fd56839ba8fc0ba9a751484ea93389c72c494ad2125dc2f9be1f72481f3af34568477123f7e9d3c7504e061e4c083cb30 + REF v1.3.1 + SHA512 cc2ace7b2dd19a2bbf4c43a89d64a7ce121309f712bfb4940ccfd6f9353f1466612ef7096adcd852f54eaea8663d884acf681c83ae5b274b24c9b85f21367b7c HEAD_REF dev) if(VCPKG_LIBRARY_LINKAGE STREQUAL static) @@ -14,6 +14,11 @@ else() set(ZSTD_SHARED 1) endif() +# Enable multithreaded mode. CMake build doesn't provide a multithreaded +# library target, but it is the default in Makefile and VS projects. +set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} /DZSTD_MULTITHREAD") +set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS}") + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/build/cmake PREFER_NINJA @@ -38,4 +43,5 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) endif() file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/zstd) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/zstd/LICENSE ${CURRENT_PACKAGES_DIR}/share/zstd/copyright) +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/zstd) +file(WRITE ${CURRENT_PACKAGES_DIR}/share/zstd/copyright "ZSTD is dual licensed - see LICENSE and COPYING files\n") diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index b7bc5afab..b874afd8c 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -6,22 +6,37 @@ param( $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root +Write-Verbose("vcpkg Path " + $vcpkgRootDir) + $gitHash = "unknownhash" -if (Get-Command "git" -ErrorAction SilentlyContinue) +$oldpath = $env:path +try +{ + $env:path += ";$vcpkgRootDir\downloads\MinGit-2.14.1-32-bit\cmd" + if (Get-Command "git" -ErrorAction SilentlyContinue) + { + $gitHash = git log HEAD -n 1 --format="%cd-%H" --date=short + if ($LASTEXITCODE -ne 0) + { + $gitHash = "unknownhash" + } + } +} +finally { - $gitHash = git rev-parse HEAD + $env:path = $oldpath } -Write-Verbose("Git hash is " + $gitHash) +Write-Verbose("Git repo version string is " + $gitHash) $vcpkgSourcesPath = "$vcpkgRootDir\toolsrc" -Write-Verbose("vcpkg Path " + $vcpkgSourcesPath) if (!(Test-Path $vcpkgSourcesPath)) { New-Item -ItemType directory -Path $vcpkgSourcesPath -force | Out-Null } -try{ +try +{ pushd $vcpkgSourcesPath $msbuildExeWithPlatformToolset = & $scriptsDir\findAnyMSBuildWithCppPlatformToolset.ps1 $msbuildExe = $msbuildExeWithPlatformToolset[0] @@ -34,6 +49,7 @@ try{ Copy-Item $vcpkgSourcesPath\Release\vcpkg.exe $vcpkgRootDir\vcpkg.exe | Out-Null Copy-Item $vcpkgSourcesPath\Release\vcpkgmetricsuploader.exe $vcpkgRootDir\scripts\vcpkgmetricsuploader.exe | Out-Null } -finally{ +finally +{ popd } diff --git a/scripts/cmake/vcpkg_acquire_msys.cmake b/scripts/cmake/vcpkg_acquire_msys.cmake index 87c34c274..830022906 100644 --- a/scripts/cmake/vcpkg_acquire_msys.cmake +++ b/scripts/cmake/vcpkg_acquire_msys.cmake @@ -58,13 +58,13 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) set(URL "https://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20161025.tar.xz/download") set(ARCHIVE "msys2-base-x86_64-20161025.tar.xz") set(HASH 6c4c18ec59db80b8269698d074866438a624f1ce735ee5005a01b148b02e8f2e966ae381aa1cb4c50f6226c3b7feb271e36907cf26580df084d695b3c9f5c0eb) - set(STAMP "initialized-msys2.stamp") + set(STAMP "initialized-msys2_64.stamp") else() set(TOOLSUBPATH msys32) set(URL "https://sourceforge.net/projects/msys2/files/Base/i686/msys2-base-i686-20161025.tar.xz/download") set(ARCHIVE "msys2-base-i686-20161025.tar.xz") set(HASH c9260a38e0c6bf963adeaea098c4e376449c1dd0afe07480741d6583a1ac4c138951ccb0c5388bd148e04255a5c1a23bf5ee2d58dcd6607c14f1eaa5639a7c85) - set(STAMP "initialized-msys2_x64.stamp") + set(STAMP "initialized-msys2_32.stamp") endif() set(PATH_TO_ROOT ${TOOLPATH}/${TOOLSUBPATH}) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index d142f57fe..c9aeb0f77 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -1,14 +1,8 @@ [CmdletBinding()] param( - [string]$Dependency, - [ValidateNotNullOrEmpty()] - [string]$downloadPromptOverride = "0" + [string]$Dependency ) -$downloadPromptOverride_NO_OVERRIDE= 0 -$downloadPromptOverride_DO_NOT_PROMPT = 1 -$downloadPromptOverride_ALWAYS_PROMPT = 2 - if ($PSVersionTable.PSEdition -ne "Core") { Import-Module BitsTransfer -Verbose:$false } @@ -22,38 +16,6 @@ $downloadsDir = "$vcpkgRootDir\downloads" function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { - function promptForDownload([string]$title, [string]$message, [string]$yesDescription, [string]$noDescription, [string]$downloadPromptOverride) - { - $do_not_prompt = ($downloadPromptOverride -eq $downloadPromptOverride_DO_NOT_PROMPT) -Or - (Test-Path "$downloadsDir\AlwaysAllowEverything") -Or - (Test-Path "$downloadsDir\AlwaysAllowDownloads") - - if (($downloadPromptOverride -ne $downloadPromptOverride_ALWAYS_PROMPT) -And $do_not_prompt) - { - return $true - } - - $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", $yesDescription - $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", $noDescription - $AlwaysAllowDownloads = New-Object System.Management.Automation.Host.ChoiceDescription "&Always Allow Downloads", ($yesDescription + "(Future download prompts will not be displayed)") - - $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no, $AlwaysAllowDownloads) - $result = $host.ui.PromptForChoice($title, $message, $options, 0) - - switch ($result) - { - 0 {return $true} - 1 {return $false} - 2 { - New-Item "$downloadsDir\AlwaysAllowDownloads" -type file -force | Out-Null - return $true - } - } - - throw "Unexpected result" - } - - function performDownload( [Parameter(Mandatory=$true)][string]$Dependency, [Parameter(Mandatory=$true)][string]$url, [Parameter(Mandatory=$true)][string]$downloadDir, @@ -66,16 +28,8 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) return } - $title = "Download " + $Dependency - $message = ("No suitable version of " + $Dependency + " was found (requires $requiredVersion or higher). Download portable version?") - $yesDescription = "Downloads " + $Dependency + " v" + $downloadVersion +" app-locally." - $noDescription = "Does not download " + $Dependency + "." - - $userAllowedDownload = promptForDownload $title $message $yesDescription $noDescription $downloadPromptOverride - if (!$userAllowedDownload) - { - throw [System.IO.FileNotFoundException] ("Could not detect suitable version of " + $Dependency + " and download not allowed") - } + # Can't print because vcpkg captures the output and expects only the path that is returned at the end of this script file + # Write-Host "A suitable version of $Dependency was not found (required v$requiredVersion). Downloading portable $Dependency v$downloadVersion..." if (!(Test-Path $downloadDir)) { @@ -202,7 +156,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $hashAlgorithm = [Security.Cryptography.HashAlgorithm]::Create("SHA256") $fileAsByteArray = [io.File]::ReadAllBytes($downloadPath) $hashByteArray = $hashAlgorithm.ComputeHash($fileAsByteArray) - $downloadedFileHash = -Join ($hashByteArray | ForEach {"{0:x2}" -f $_}) + $downloadedFileHash = -Join ($hashByteArray | ForEach-Object {"{0:x2}" -f $_}) } else { diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1 index 14bfc244b..ca807980c 100644 --- a/scripts/findVisualStudioInstallationInstances.ps1 +++ b/scripts/findVisualStudioInstallationInstances.ps1 @@ -8,7 +8,7 @@ $vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root $downloadsDir = "$vcpkgRootDir\downloads" -$nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget" 1 +$nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget" $nugetPackageDir = "$downloadsDir\nuget-packages" $SetupAPIVersion = "1.8.24" diff --git a/scripts/internalCI.ps1 b/scripts/internalCI.ps1 index 68c917f7a..67871acc1 100644 --- a/scripts/internalCI.ps1 +++ b/scripts/internalCI.ps1 @@ -1,7 +1,6 @@ $ErrorActionPreference = "Stop" New-Item -type directory downloads -errorAction SilentlyContinue | Out-Null -New-Item -type file downloads\AlwaysAllowDownloads -errorAction SilentlyContinue | Out-Null ./scripts/bootstrap.ps1 if (-not $?) { throw $? } diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index 6320e715f..d27b8ca83 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"0.0.83"
\ No newline at end of file +"0.0.85"
\ No newline at end of file diff --git a/toolsrc/include/BinaryParagraph.h b/toolsrc/include/BinaryParagraph.h index 1e12dd8a6..61e03343a 100644 --- a/toolsrc/include/BinaryParagraph.h +++ b/toolsrc/include/BinaryParagraph.h @@ -31,5 +31,11 @@ namespace vcpkg std::vector<std::string> depends; }; + struct BinaryControlFile + { + BinaryParagraph core_paragraph; + std::vector<BinaryParagraph> features; + }; + void serialize(const BinaryParagraph& pgh, std::string& out_str); }
\ No newline at end of file diff --git a/toolsrc/include/PackageSpec.h b/toolsrc/include/PackageSpec.h index 15b5e5b9b..c5ce767f9 100644 --- a/toolsrc/include/PackageSpec.h +++ b/toolsrc/include/PackageSpec.h @@ -1,14 +1,22 @@ #pragma once + #include "PackageSpecParseResult.h" -#include "SourceParagraph.h" #include "Triplet.h" #include "vcpkg_expected.h" namespace vcpkg { + struct ParsedSpecifier + { + std::string name; + std::vector<std::string> features; + std::string triplet; + + static ExpectedT<ParsedSpecifier, PackageSpecParseResult> from_string(const std::string& input); + }; + struct PackageSpec { - static std::string to_string(const std::string& name, const Triplet& triplet); static ExpectedT<PackageSpec, PackageSpecParseResult> from_name_and_triplet(const std::string& name, const Triplet& triplet); @@ -25,15 +33,45 @@ namespace vcpkg Triplet m_triplet; }; + struct FeatureSpec + { + FeatureSpec(const PackageSpec& spec, const std::string& feature) : m_spec(spec), m_feature(feature) {} + + const std::string& name() const { return m_spec.name(); } + const std::string& feature() const { return m_feature; } + const Triplet& triplet() const { return m_spec.triplet(); } + + const PackageSpec& spec() const { return m_spec; } + + std::string to_string() const; + + static std::vector<FeatureSpec> from_strings_and_triplet(const std::vector<std::string>& depends, + const Triplet& t); + + private: + PackageSpec m_spec; + std::string m_feature; + }; + struct FullPackageSpec { PackageSpec package_spec; std::vector<std::string> features; + static std::vector<FeatureSpec> to_feature_specs(const std::vector<FullPackageSpec>& specs); + static ExpectedT<FullPackageSpec, PackageSpecParseResult> from_string(const std::string& spec_as_string, const Triplet& default_triplet); }; + struct Features + { + std::string name; + std::vector<std::string> features; + + static ExpectedT<Features, PackageSpecParseResult> from_string(const std::string& input); + }; + bool operator==(const PackageSpec& left, const PackageSpec& right); bool operator!=(const PackageSpec& left, const PackageSpec& right); } diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/Paragraphs.h index 60f509266..aae46f7da 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/Paragraphs.h @@ -20,7 +20,7 @@ namespace vcpkg::Paragraphs Parse::ParseExpected<SourceControlFile> try_load_port(const Files::Filesystem& fs, const fs::path& control_path); - Expected<BinaryParagraph> try_load_cached_package(const VcpkgPaths& paths, const PackageSpec& spec); + Expected<BinaryControlFile> try_load_cached_control_package(const VcpkgPaths& paths, const PackageSpec& spec); struct LoadResults { diff --git a/toolsrc/include/SourceParagraph.h b/toolsrc/include/SourceParagraph.h index 7ddf999cc..8563d83b0 100644 --- a/toolsrc/include/SourceParagraph.h +++ b/toolsrc/include/SourceParagraph.h @@ -1,5 +1,6 @@ #pragma once +#include "PackageSpec.h" #include "Span.h" #include "vcpkg_Parse.h" #include "vcpkg_System.h" @@ -11,17 +12,22 @@ namespace vcpkg { - extern bool g_feature_packages; - - struct Triplet; - struct Dependency { - std::string name; + Features depend; std::string qualifier; + + std::string name() const; + static Dependency parse_dependency(std::string name, std::string qualifier); }; - const std::string& to_string(const Dependency& dep); + std::vector<std::string> filter_dependencies(const std::vector<Dependency>& deps, const Triplet& t); + std::vector<FeatureSpec> filter_dependencies_to_specs(const std::vector<Dependency>& deps, const Triplet& t); + + // zlib[uwp] becomes Dependency{"zlib", "uwp"} + std::vector<Dependency> expand_qualified_dependencies(const std::vector<std::string>& depends); + + const std::string to_string(const Dependency& dep); struct FeatureParagraph { @@ -58,12 +64,6 @@ namespace vcpkg return print_error_message({&error_info_list, 1}); } - std::vector<std::string> filter_dependencies(const std::vector<Dependency>& deps, const Triplet& t); - - // zlib[uwp] becomes Dependency{"zlib", "uwp"} - std::vector<Dependency> expand_qualified_dependencies(const std::vector<std::string>& depends); - std::vector<std::string> parse_comma_list(const std::string& str); - struct Supports { static ExpectedT<Supports, std::vector<std::string>> parse(const std::vector<std::string>& strs); diff --git a/toolsrc/include/StatusParagraphs.h b/toolsrc/include/StatusParagraphs.h index 2af177219..1a9ee6a03 100644 --- a/toolsrc/include/StatusParagraphs.h +++ b/toolsrc/include/StatusParagraphs.h @@ -17,6 +17,8 @@ namespace vcpkg const_iterator find(const PackageSpec& spec) const { return find(spec.name(), spec.triplet()); } const_iterator find(const std::string& name, const Triplet& triplet) const; iterator find(const std::string& name, const Triplet& triplet); + std::vector<std::unique_ptr<StatusParagraph>*> find_all(const std::string& name, const Triplet& triplet); + iterator find(const std::string& name, const Triplet& triplet, const std::string& feature); const_iterator find_installed(const PackageSpec& spec) const { diff --git a/toolsrc/include/VcpkgPaths.h b/toolsrc/include/VcpkgPaths.h index 95cd4bc28..d55c95fe1 100644 --- a/toolsrc/include/VcpkgPaths.h +++ b/toolsrc/include/VcpkgPaths.h @@ -8,11 +8,19 @@ namespace vcpkg { + struct ToolsetArchOption + { + CWStringView name; + System::CPUArchitecture host_arch; + System::CPUArchitecture target_arch; + }; + struct Toolset { fs::path dumpbin; fs::path vcvarsall; CWStringView version; + std::vector<ToolsetArchOption> supported_architectures; }; struct VcpkgPaths @@ -21,6 +29,7 @@ namespace vcpkg fs::path package_dir(const PackageSpec& spec) const; fs::path port_dir(const PackageSpec& spec) const; + fs::path port_dir(const std::string& name) const; fs::path build_info_file_path(const PackageSpec& spec) const; fs::path listfile_path(const BinaryParagraph& pgh) const; diff --git a/toolsrc/include/metrics.h b/toolsrc/include/metrics.h index 1f5ae2f32..8eae426de 100644 --- a/toolsrc/include/metrics.h +++ b/toolsrc/include/metrics.h @@ -2,19 +2,27 @@ #include <string> +#include "vcpkg_Util.h" + namespace vcpkg::Metrics { - void set_send_metrics(bool should_send_metrics); - void set_print_metrics(bool should_print_metrics); - void set_user_information(const std::string& user_id, const std::string& first_use_time); - void init_user_information(std::string& user_id, std::string& first_use_time); + struct Metrics : Util::ResourceBase + { + void set_send_metrics(bool should_send_metrics); + void set_print_metrics(bool should_print_metrics); + void set_user_information(const std::string& user_id, const std::string& first_use_time); + void init_user_information(std::string& user_id, std::string& first_use_time); - void track_metric(const std::string& name, double value); - void track_property(const std::string& name, const std::string& value); - void track_property(const std::string& name, const std::wstring& value); - bool get_compiled_metrics_enabled(); - std::wstring get_SQM_user(); + void track_metric(const std::string& name, double value); + void track_property(const std::string& name, const std::string& value); + void track_property(const std::string& name, const std::wstring& value); + + void upload(const std::string& payload); + void flush(); + }; - void upload(const std::string& payload); - void flush(); + extern Util::LockGuarded<Metrics> g_metrics; + + std::wstring get_SQM_user(); + bool get_compiled_metrics_enabled(); } diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 406d0741e..770bcf07a 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -7,6 +7,7 @@ #include <algorithm> #include <array> +#include <atomic> #include <cassert> #include <cctype> #include <chrono> @@ -22,6 +23,7 @@ #include <iterator> #include <map> #include <memory> +#include <mutex> #include <process.h> #include <regex> #include <set> diff --git a/toolsrc/include/vcpkg_Build.h b/toolsrc/include/vcpkg_Build.h index c4f3e6746..fc6f28e24 100644 --- a/toolsrc/include/vcpkg_Build.h +++ b/toolsrc/include/vcpkg_Build.h @@ -52,13 +52,15 @@ namespace vcpkg::Build SUCCEEDED, BUILD_FAILED, POST_BUILD_CHECKS_FAILED, + FILE_CONFLICTS, CASCADED_DUE_TO_MISSING_DEPENDENCIES }; - static constexpr std::array<BuildResult, 4> BuildResult_values = { + static constexpr std::array<BuildResult, 5> BuildResult_values = { BuildResult::SUCCEEDED, BuildResult::BUILD_FAILED, BuildResult::POST_BUILD_CHECKS_FAILED, + BuildResult::FILE_CONFLICTS, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES}; const std::string& to_string(const BuildResult build_result); @@ -159,7 +161,7 @@ namespace vcpkg::Build inline bool is_enabled(BuildPolicy policy) const { - auto it = m_policies.find(policy); + const auto it = m_policies.find(policy); if (it != m_policies.cend()) return it->second; return false; } diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg_Checks.h index 6d8ff5711..01cb7209b 100644 --- a/toolsrc/include/vcpkg_Checks.h +++ b/toolsrc/include/vcpkg_Checks.h @@ -5,18 +5,25 @@ namespace vcpkg::Checks { + void register_console_ctrl_handler(); + + // Indicate that an internal error has occurred and exit the tool. This should be used when invariants have been + // broken. [[noreturn]] void unreachable(const LineInfo& line_info); [[noreturn]] void exit_with_code(const LineInfo& line_info, const int exit_code); + // Exit the tool without an error message. [[noreturn]] inline void exit_fail(const LineInfo& line_info) { exit_with_code(line_info, EXIT_FAILURE); } + // Exit the tool successfully. [[noreturn]] inline void exit_success(const LineInfo& line_info) { exit_with_code(line_info, EXIT_SUCCESS); } - // Part of the reason these exist is to not include extra headers in this one to avoid circular #includes. + // Display an error message to the user and exit the tool. [[noreturn]] void exit_with_message(const LineInfo& line_info, const CStringView errorMessage); template<class Arg1, class... Args> + // Display an error message to the user and exit the tool. [[noreturn]] void exit_with_message(const LineInfo& line_info, const char* errorMessageTemplate, const Arg1 errorMessageArg1, diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 8348a64e4..756a12f01 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -55,12 +55,18 @@ namespace vcpkg::Commands const Build::BuildPackageOptions& install_plan_options, StatusParagraphs& status_db); + enum class InstallResult + { + FILE_CONFLICTS, + SUCCESS, + }; + void install_files_and_write_listfile(Files::Filesystem& fs, const fs::path& source_dir, const InstallDir& dirs); - void install_package(const VcpkgPaths& paths, - const BinaryParagraph& binary_paragraph, - StatusParagraphs* status_db); + InstallResult install_package(const VcpkgPaths& paths, + const BinaryControlFile& binary_paragraph, + StatusParagraphs* status_db); void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); } diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index e3af0fd28..235abb839 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -3,6 +3,7 @@ #include "StatusParagraphs.h" #include "VcpkgPaths.h" #include "vcpkg_Graphs.h" +#include "vcpkg_Util.h" #include "vcpkg_optional.h" #include <vector> @@ -22,7 +23,7 @@ namespace vcpkg::Dependencies std::vector<PackageSpec> dependencies(const Triplet& triplet) const; Optional<StatusParagraph> status_paragraph; - Optional<BinaryParagraph> binary_paragraph; + Optional<BinaryControlFile> binary_control_file; Optional<SourceParagraph> source_paragraph; Optional<const SourceControlFile*> source_control_file; }; @@ -30,44 +31,6 @@ namespace vcpkg::Dependencies namespace vcpkg::Dependencies { - struct FeatureSpec - { - PackageSpec spec; - std::string feature_name; - }; - - struct FeatureNodeEdges - { - std::vector<FeatureSpec> remove_edges; - std::vector<FeatureSpec> build_edges; - bool plus = false; - }; - std::vector<FeatureSpec> to_feature_specs(const std::vector<std::string>& depends, const Triplet& t); - - struct Cluster - { - std::vector<StatusParagraph> status_paragraphs; - Optional<const SourceControlFile*> source_control_file; - PackageSpec spec; - std::unordered_map<std::string, FeatureNodeEdges> edges; - std::unordered_set<std::string> to_install_features; - std::unordered_set<std::string> original_features; - bool will_remove = false; - bool transient_uninstalled = true; - Cluster() = default; - - private: - Cluster(const Cluster&) = delete; - Cluster& operator=(const Cluster&) = delete; - }; - - struct ClusterPtr - { - Cluster* ptr; - }; - - bool operator==(const ClusterPtr& l, const ClusterPtr& r); - enum class InstallPlanType { UNKNOWN, @@ -76,20 +39,22 @@ namespace vcpkg::Dependencies ALREADY_INSTALLED }; - struct InstallPlanAction + struct InstallPlanAction : Util::MoveOnlyBase { static bool compare_by_name(const InstallPlanAction* left, const InstallPlanAction* right); InstallPlanAction(); + + InstallPlanAction(const PackageSpec& spec, + const std::unordered_set<std::string>& features, + const RequestType& request_type); InstallPlanAction(const PackageSpec& spec, const AnyParagraph& any_paragraph, const RequestType& request_type); InstallPlanAction(const PackageSpec& spec, const SourceControlFile& any_paragraph, const std::unordered_set<std::string>& features, const RequestType& request_type); - InstallPlanAction(const InstallPlanAction&) = delete; - InstallPlanAction(InstallPlanAction&&) = default; - InstallPlanAction& operator=(const InstallPlanAction&) = delete; - InstallPlanAction& operator=(InstallPlanAction&&) = default; + + std::string displayname() const; PackageSpec spec; AnyParagraph any_paragraph; @@ -105,16 +70,12 @@ namespace vcpkg::Dependencies REMOVE }; - struct RemovePlanAction + struct RemovePlanAction : Util::MoveOnlyBase { static bool compare_by_name(const RemovePlanAction* left, const RemovePlanAction* right); RemovePlanAction(); RemovePlanAction(const PackageSpec& spec, const RemovePlanType& plan_type, const RequestType& request_type); - RemovePlanAction(const RemovePlanAction&) = delete; - RemovePlanAction(RemovePlanAction&&) = default; - RemovePlanAction& operator=(const RemovePlanAction&) = delete; - RemovePlanAction& operator=(RemovePlanAction&&) = default; PackageSpec spec; RemovePlanType plan_type; @@ -123,6 +84,9 @@ namespace vcpkg::Dependencies struct AnyAction { + AnyAction(InstallPlanAction&& iplan) : install_plan(std::move(iplan)) {} + AnyAction(RemovePlanAction&& rplan) : remove_plan(std::move(rplan)) {} + Optional<InstallPlanAction> install_plan; Optional<RemovePlanAction> remove_plan; }; @@ -134,16 +98,12 @@ namespace vcpkg::Dependencies ALREADY_BUILT }; - struct ExportPlanAction + struct ExportPlanAction : Util::MoveOnlyBase { static bool compare_by_name(const ExportPlanAction* left, const ExportPlanAction* right); ExportPlanAction(); ExportPlanAction(const PackageSpec& spec, const AnyParagraph& any_paragraph, const RequestType& request_type); - ExportPlanAction(const ExportPlanAction&) = delete; - ExportPlanAction(ExportPlanAction&&) = default; - ExportPlanAction& operator=(const ExportPlanAction&) = delete; - ExportPlanAction& operator=(ExportPlanAction&&) = default; PackageSpec spec; AnyParagraph any_paragraph; @@ -151,25 +111,21 @@ namespace vcpkg::Dependencies RequestType request_type; }; - __interface PortFileProvider { virtual const SourceControlFile& get_control_file(const PackageSpec& spec) const; }; + __interface PortFileProvider { virtual const SourceControlFile& get_control_file(const std::string& spec) const; }; - struct MapPortFile : PortFileProvider + struct MapPortFile : Util::ResourceBase, PortFileProvider { - const std::unordered_map<PackageSpec, SourceControlFile>& ports; - explicit MapPortFile(const std::unordered_map<PackageSpec, SourceControlFile>& map); - const SourceControlFile& get_control_file(const PackageSpec& spec) const override; + const std::unordered_map<std::string, SourceControlFile>& ports; + explicit MapPortFile(const std::unordered_map<std::string, SourceControlFile>& map); + const SourceControlFile& get_control_file(const std::string& spec) const override; }; - struct PathsPortFile : PortFileProvider + struct PathsPortFile : Util::ResourceBase, PortFileProvider { const VcpkgPaths& ports; - mutable std::unordered_map<PackageSpec, SourceControlFile> cache; + mutable std::unordered_map<std::string, SourceControlFile> cache; explicit PathsPortFile(const VcpkgPaths& paths); - const SourceControlFile& get_control_file(const PackageSpec& spec) const override; - - private: - PathsPortFile(const PathsPortFile&) = delete; - PathsPortFile& operator=(const PathsPortFile&) = delete; + const SourceControlFile& get_control_file(const std::string& spec) const override; }; std::vector<InstallPlanAction> create_install_plan(const PortFileProvider& port_file_provider, @@ -182,31 +138,8 @@ namespace vcpkg::Dependencies std::vector<ExportPlanAction> create_export_plan(const VcpkgPaths& paths, const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db); -} -template<> -struct std::hash<vcpkg::Dependencies::ClusterPtr> -{ - size_t operator()(const vcpkg::Dependencies::ClusterPtr& value) const - { - return std::hash<vcpkg::PackageSpec>()(value.ptr->spec); - } -}; - -namespace vcpkg::Dependencies -{ - struct GraphPlan - { - Graphs::Graph<ClusterPtr> remove_graph; - Graphs::Graph<ClusterPtr> install_graph; - }; - bool mark_plus(const std::string& feature, - Cluster& cluster, - std::unordered_map<PackageSpec, Cluster>& pkg_to_cluster, - GraphPlan& graph_plan); - void mark_minus(Cluster& cluster, std::unordered_map<PackageSpec, Cluster>& pkg_to_cluster, GraphPlan& graph_plan); - - std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<PackageSpec, SourceControlFile>& map, - const std::vector<FullPackageSpec>& specs, + std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFile>& map, + const std::vector<FeatureSpec>& specs, const StatusParagraphs& status_db); } diff --git a/toolsrc/include/vcpkg_GlobalState.h b/toolsrc/include/vcpkg_GlobalState.h new file mode 100644 index 000000000..6522a25bf --- /dev/null +++ b/toolsrc/include/vcpkg_GlobalState.h @@ -0,0 +1,19 @@ +#pragma once + +#include <atomic> + +#include "vcpkg_Chrono.h" +#include "vcpkg_Util.h" + +namespace vcpkg +{ + struct GlobalState + { + static Util::LockGuarded<ElapsedTime> timer; + static std::atomic<bool> debugging; + static std::atomic<bool> feature_packages; + + static std::atomic<int> g_init_console_cp; + static std::atomic<int> g_init_console_output_cp; + }; +}
\ No newline at end of file diff --git a/toolsrc/include/vcpkg_Parse.h b/toolsrc/include/vcpkg_Parse.h index a2eb152dc..e663448b9 100644 --- a/toolsrc/include/vcpkg_Parse.h +++ b/toolsrc/include/vcpkg_Parse.h @@ -33,4 +33,6 @@ namespace vcpkg::Parse RawParagraph&& fields; std::vector<std::string> missing_fields; }; + + std::vector<std::string> parse_comma_list(const std::string& str); } diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg_Strings.h index 325a2cb4c..61f6fab61 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg_Strings.h @@ -19,10 +19,12 @@ namespace vcpkg::Strings::details inline long long to_printf_arg(const long long s) { return s; } - inline double to_printf_arg(const double s) { return s; } + inline unsigned long to_printf_arg(const unsigned long s) { return s; } inline size_t to_printf_arg(const size_t s) { return s; } + inline double to_printf_arg(const double s) { return s; } + std::string format_internal(const char* fmtstr, ...); inline const wchar_t* to_wprintf_arg(const std::wstring& s) { return s.c_str(); } @@ -34,6 +36,9 @@ namespace vcpkg::Strings::details namespace vcpkg::Strings { + static constexpr const char* EMPTY = ""; + static constexpr const wchar_t* WEMPTY = L""; + template<class... Args> std::string format(const char* fmtstr, const Args&... args) { @@ -63,20 +68,20 @@ namespace vcpkg::Strings template<class Container, class Transformer, class CharType> std::basic_string<CharType> join(const CharType* delimiter, const Container& v, Transformer transformer) { - if (v.size() == 0) + const auto begin = v.begin(); + const auto end = v.end(); + + if (begin == end) { return std::basic_string<CharType>(); } std::basic_string<CharType> output; - size_t size = v.size(); - - output.append(transformer(v[0])); - - for (size_t i = 1; i < size; ++i) + output.append(transformer(*begin)); + for (auto it = std::next(begin); it != end; ++it) { output.append(delimiter); - output.append(transformer(v[i])); + output.append(transformer(*it)); } return output; @@ -84,7 +89,7 @@ namespace vcpkg::Strings template<class Container, class CharType> std::basic_string<CharType> join(const CharType* delimiter, const Container& v) { - using Element = decltype(v[0]); + using Element = decltype(*v.begin()); return join(delimiter, v, [](const Element& x) -> const Element& { return x; }); } diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index 2ea0241f6..9dd9ea8bd 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -23,7 +23,7 @@ namespace vcpkg::System ExitCodeAndOutput cmd_execute_and_capture_output(const CWStringView cmd_line); - std::wstring create_powershell_script_cmd(const fs::path& script_path, const CWStringView args = L""); + std::wstring create_powershell_script_cmd(const fs::path& script_path, const CWStringView args = Strings::WEMPTY); enum class Color { @@ -32,6 +32,7 @@ namespace vcpkg::System warning = 14, }; + void println(); void print(const CStringView message); void println(const CStringView message); void print(const Color c, const CStringView message); @@ -77,6 +78,8 @@ namespace vcpkg::System CPUArchitecture get_host_processor(); + std::vector<CPUArchitecture> get_supported_host_architectures(); + const fs::path& get_ProgramFiles_32_bit(); const fs::path& get_ProgramFiles_platform_bitness(); diff --git a/toolsrc/include/vcpkg_Util.h b/toolsrc/include/vcpkg_Util.h index 671997e7e..c76ca01ac 100644 --- a/toolsrc/include/vcpkg_Util.h +++ b/toolsrc/include/vcpkg_Util.h @@ -1,20 +1,19 @@ #pragma once #include <map> +#include <mutex> #include <utility> #include <vector> namespace vcpkg::Util { template<class Cont, class Func> - using FmapOut = decltype(std::declval<Func>()(std::declval<Cont>()[0])); + using FmapOut = decltype(std::declval<Func>()(*begin(std::declval<Cont>()))); template<class Cont, class Func, class Out = FmapOut<Cont, Func>> - std::vector<Out> fmap(const Cont& xs, Func&& f) + std::vector<Out> fmap(Cont&& xs, Func&& f) { - using O = decltype(f(xs[0])); - - std::vector<O> ret; + std::vector<Out> ret; ret.reserve(xs.size()); for (auto&& x : xs) @@ -23,6 +22,21 @@ namespace vcpkg::Util return ret; } + template<class Cont, class Func> + using FmapFlattenOut = std::decay_t<decltype(*begin(std::declval<Func>()(*begin(std::declval<Cont>()))))>; + + template<class Cont, class Func, class Out = FmapFlattenOut<Cont, Func>> + std::vector<Out> fmap_flatten(Cont&& xs, Func&& f) + { + std::vector<Out> ret; + + for (auto&& x : xs) + for (auto&& y : f(x)) + ret.push_back(std::move(y)); + + return ret; + } + template<class Container, class Pred> void unstable_keep_if(Container& cont, Pred pred) { @@ -62,4 +76,54 @@ namespace vcpkg::Util (*output)[key].push_back(&element); } } + + struct MoveOnlyBase + { + MoveOnlyBase() = default; + MoveOnlyBase(const MoveOnlyBase&) = delete; + MoveOnlyBase(MoveOnlyBase&&) = default; + + MoveOnlyBase& operator=(const MoveOnlyBase&) = delete; + MoveOnlyBase& operator=(MoveOnlyBase&&) = default; + }; + + struct ResourceBase + { + ResourceBase() = default; + ResourceBase(const ResourceBase&) = delete; + ResourceBase(ResourceBase&&) = delete; + + ResourceBase& operator=(const ResourceBase&) = delete; + ResourceBase& operator=(ResourceBase&&) = delete; + }; + + template<class T> + struct LockGuardPtr; + + template<class T> + struct LockGuarded + { + friend struct LockGuardPtr<T>; + + LockGuardPtr<T> lock() { return *this; } + + private: + std::mutex m_mutex; + T m_t; + }; + + template<class T> + struct LockGuardPtr + { + T& operator*() { return m_ptr; } + T* operator->() { return &m_ptr; } + + T* get() { return &m_ptr; } + + LockGuardPtr(LockGuarded<T>& sync) : m_lock(sync.m_mutex), m_ptr(sync.m_t) {} + + private: + std::unique_lock<std::mutex> m_lock; + T& m_ptr; + }; }
\ No newline at end of file diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkglib.h index bd2400b77..0bb75f9b5 100644 --- a/toolsrc/include/vcpkglib.h +++ b/toolsrc/include/vcpkglib.h @@ -6,8 +6,6 @@ namespace vcpkg { - extern bool g_debugging; - StatusParagraphs database_load_check(const VcpkgPaths& paths); void write_update(const VcpkgPaths& paths, const StatusParagraph& p); @@ -36,5 +34,5 @@ namespace vcpkg const fs::path& cmake_script, const std::vector<CMakeVariable>& pass_variables); - std::string shorten_description(const std::string& desc); + std::string shorten_text(const std::string& desc, size_t length); } // namespace vcpkg diff --git a/toolsrc/src/BinaryParagraph.cpp b/toolsrc/src/BinaryParagraph.cpp index 49e9d58e5..1504912ab 100644 --- a/toolsrc/src/BinaryParagraph.cpp +++ b/toolsrc/src/BinaryParagraph.cpp @@ -56,7 +56,7 @@ namespace vcpkg this->default_features = parse_comma_list(parser.optional_field(Fields::DEFAULTFEATURES)); } - if (auto err = parser.error_info(this->spec.to_string())) + if (const auto err = parser.error_info(this->spec.to_string())) { System::println( System::Color::error, "Error: while parsing the Binary Paragraph for %s", this->spec.to_string()); @@ -80,14 +80,18 @@ namespace vcpkg BinaryParagraph::BinaryParagraph(const SourceParagraph& spgh, const FeatureParagraph& fpgh, const Triplet& triplet) { this->spec = PackageSpec::from_name_and_triplet(spgh.name, triplet).value_or_exit(VCPKG_LINE_INFO); - this->version = ""; + this->version = Strings::EMPTY; this->feature = fpgh.name; this->description = fpgh.description; - this->maintainer = ""; + this->maintainer = Strings::EMPTY; this->depends = filter_dependencies(fpgh.depends, triplet); } - std::string BinaryParagraph::displayname() const { return this->spec.to_string(); } + std::string BinaryParagraph::displayname() const + { + const auto f = this->feature.empty() ? "core" : this->feature; + return Strings::format("%s[%s]:%s", this->spec.name(), f, this->spec.triplet()); + } std::string BinaryParagraph::dir() const { return this->spec.dir(); } diff --git a/toolsrc/src/PackageSpec.cpp b/toolsrc/src/PackageSpec.cpp index a7e5648cd..890de8899 100644 --- a/toolsrc/src/PackageSpec.cpp +++ b/toolsrc/src/PackageSpec.cpp @@ -1,8 +1,11 @@ #include "pch.h" #include "PackageSpec.h" +#include "vcpkg_Parse.h" #include "vcpkg_Util.h" +using vcpkg::Parse::parse_comma_list; + namespace vcpkg { static bool is_valid_package_spec_char(char c) @@ -10,55 +13,69 @@ namespace vcpkg return (c == '-') || isdigit(c) || (isalpha(c) && islower(c)) || (c == '[') || (c == ']'); } - ExpectedT<FullPackageSpec, PackageSpecParseResult> FullPackageSpec::from_string(const std::string& spec_as_string, - const Triplet& default_triplet) + std::string FeatureSpec::to_string() const { - auto pos = spec_as_string.find(':'); - auto pos_l_bracket = spec_as_string.find('['); - auto pos_r_bracket = spec_as_string.find(']'); + if (feature().empty()) return spec().to_string(); + return Strings::format("%s[%s]:%s", name(), feature(), triplet()); + } - FullPackageSpec f; - if (pos == std::string::npos && pos_l_bracket == std::string::npos) - { - f.package_spec = - PackageSpec::from_name_and_triplet(spec_as_string, default_triplet).value_or_exit(VCPKG_LINE_INFO); - return f; - } - else if (pos == std::string::npos) + std::vector<FeatureSpec> FeatureSpec::from_strings_and_triplet(const std::vector<std::string>& depends, + const Triplet& triplet) + { + std::vector<FeatureSpec> f_specs; + for (auto&& depend : depends) { - if (pos_r_bracket == std::string::npos || pos_l_bracket >= pos_r_bracket) + auto maybe_spec = ParsedSpecifier::from_string(depend); + if (auto spec = maybe_spec.get()) { - return PackageSpecParseResult::INVALID_CHARACTERS; + Checks::check_exit(VCPKG_LINE_INFO, + spec->triplet.empty(), + "error: triplets cannot currently be specified in this context: %s", + depend); + PackageSpec pspec = + PackageSpec::from_name_and_triplet(spec->name, triplet).value_or_exit(VCPKG_LINE_INFO); + + for (auto&& feature : spec->features) + f_specs.push_back(FeatureSpec{pspec, feature}); + + if (spec->features.empty()) f_specs.push_back(FeatureSpec{pspec, Strings::EMPTY}); } - const std::string name = spec_as_string.substr(0, pos_l_bracket); - f.package_spec = PackageSpec::from_name_and_triplet(name, default_triplet).value_or_exit(VCPKG_LINE_INFO); - f.features = parse_comma_list(spec_as_string.substr(pos_l_bracket + 1, pos_r_bracket - pos_l_bracket - 1)); - return f; - } - else if (pos_l_bracket == std::string::npos && pos_r_bracket == std::string::npos) - { - const std::string name = spec_as_string.substr(0, pos); - const Triplet triplet = Triplet::from_canonical_name(spec_as_string.substr(pos + 1)); - f.package_spec = PackageSpec::from_name_and_triplet(name, triplet).value_or_exit(VCPKG_LINE_INFO); - } - else - { - if (pos_r_bracket == std::string::npos || pos_l_bracket >= pos_r_bracket) + else { - return PackageSpecParseResult::INVALID_CHARACTERS; + Checks::exit_with_message(VCPKG_LINE_INFO, + "error while parsing feature list: %s: %s", + vcpkg::to_string(maybe_spec.error()), + depend); } - const std::string name = spec_as_string.substr(0, pos_l_bracket); - f.features = parse_comma_list(spec_as_string.substr(pos_l_bracket + 1, pos_r_bracket - pos_l_bracket - 1)); - const Triplet triplet = Triplet::from_canonical_name(spec_as_string.substr(pos + 1)); - f.package_spec = PackageSpec::from_name_and_triplet(name, triplet).value_or_exit(VCPKG_LINE_INFO); } + return f_specs; + } - auto pos2 = spec_as_string.find(':', pos + 1); - if (pos2 != std::string::npos) + std::vector<FeatureSpec> FullPackageSpec::to_feature_specs(const std::vector<FullPackageSpec>& specs) + { + std::vector<FeatureSpec> ret; + for (auto&& spec : specs) { - return PackageSpecParseResult::TOO_MANY_COLONS; + ret.emplace_back(spec.package_spec, Strings::EMPTY); + for (auto&& feature : spec.features) + ret.emplace_back(spec.package_spec, feature); } - return f; + return ret; + } + + ExpectedT<FullPackageSpec, PackageSpecParseResult> FullPackageSpec::from_string(const std::string& spec_as_string, + const Triplet& default_triplet) + { + auto res = ParsedSpecifier::from_string(spec_as_string); + if (auto p = res.get()) + { + FullPackageSpec fspec; + Triplet t = p->triplet.empty() ? default_triplet : Triplet::from_canonical_name(p->triplet); + fspec.package_spec = PackageSpec::from_name_and_triplet(p->name, t).value_or_exit(VCPKG_LINE_INFO); + fspec.features = std::move(p->features); + return fspec; + } + return res.error(); } ExpectedT<PackageSpec, PackageSpecParseResult> PackageSpec::from_name_and_triplet(const std::string& name, @@ -81,11 +98,7 @@ namespace vcpkg std::string PackageSpec::dir() const { return Strings::format("%s_%s", this->m_name, this->m_triplet); } - std::string PackageSpec::to_string(const std::string& name, const Triplet& triplet) - { - return Strings::format("%s:%s", name, triplet); - } - std::string PackageSpec::to_string() const { return to_string(this->name(), this->triplet()); } + std::string PackageSpec::to_string() const { return Strings::format("%s:%s", this->name(), this->triplet()); } bool operator==(const PackageSpec& left, const PackageSpec& right) { @@ -93,4 +106,70 @@ namespace vcpkg } bool operator!=(const PackageSpec& left, const PackageSpec& right) { return !(left == right); } + + ExpectedT<ParsedSpecifier, PackageSpecParseResult> ParsedSpecifier::from_string(const std::string& input) + { + auto pos = input.find(':'); + auto pos_l_bracket = input.find('['); + auto pos_r_bracket = input.find(']'); + + ParsedSpecifier f; + if (pos == std::string::npos && pos_l_bracket == std::string::npos) + { + f.name = input; + return f; + } + else if (pos == std::string::npos) + { + if (pos_r_bracket == std::string::npos || pos_l_bracket >= pos_r_bracket) + { + return PackageSpecParseResult::INVALID_CHARACTERS; + } + const std::string name = input.substr(0, pos_l_bracket); + f.name = name; + f.features = parse_comma_list(input.substr(pos_l_bracket + 1, pos_r_bracket - pos_l_bracket - 1)); + return f; + } + else if (pos_l_bracket == std::string::npos && pos_r_bracket == std::string::npos) + { + const std::string name = input.substr(0, pos); + f.triplet = input.substr(pos + 1); + f.name = name; + } + else + { + if (pos_r_bracket == std::string::npos || pos_l_bracket >= pos_r_bracket) + { + return PackageSpecParseResult::INVALID_CHARACTERS; + } + const std::string name = input.substr(0, pos_l_bracket); + f.features = parse_comma_list(input.substr(pos_l_bracket + 1, pos_r_bracket - pos_l_bracket - 1)); + f.triplet = input.substr(pos + 1); + f.name = name; + } + + auto pos2 = input.find(':', pos + 1); + if (pos2 != std::string::npos) + { + return PackageSpecParseResult::TOO_MANY_COLONS; + } + return f; + } + + ExpectedT<Features, PackageSpecParseResult> Features::from_string(const std::string& name) + { + auto maybe_spec = ParsedSpecifier::from_string(name); + if (auto spec = maybe_spec.get()) + { + Checks::check_exit( + VCPKG_LINE_INFO, spec->triplet.empty(), "error: triplet not allowed in specifier: %s", name); + + Features f; + f.name = spec->name; + f.features = spec->features; + return f; + } + + return maybe_spec.error(); + } } diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/Paragraphs.cpp index 3749e919e..a7dee4fd3 100644 --- a/toolsrc/src/Paragraphs.cpp +++ b/toolsrc/src/Paragraphs.cpp @@ -3,6 +3,8 @@ #include "ParagraphParseResult.h" #include "Paragraphs.h" #include "vcpkg_Files.h" +#include "vcpkg_GlobalState.h" +#include "vcpkg_Util.h" using namespace vcpkg::Parse; @@ -209,7 +211,7 @@ namespace vcpkg::Paragraphs if (auto vector_pghs = pghs.get()) { auto csf = SourceControlFile::parse_control_file(std::move(*vector_pghs)); - if (!g_feature_packages) + if (!GlobalState::feature_packages) { if (auto ptr = csf.get()) { @@ -226,14 +228,21 @@ namespace vcpkg::Paragraphs return error_info; } - Expected<BinaryParagraph> try_load_cached_package(const VcpkgPaths& paths, const PackageSpec& spec) + Expected<BinaryControlFile> try_load_cached_control_package(const VcpkgPaths& paths, const PackageSpec& spec) { - Expected<std::unordered_map<std::string, std::string>> pghs = - get_single_paragraph(paths.get_filesystem(), paths.package_dir(spec) / "CONTROL"); + Expected<std::vector<std::unordered_map<std::string, std::string>>> pghs = + get_paragraphs(paths.get_filesystem(), paths.package_dir(spec) / "CONTROL"); if (auto p = pghs.get()) { - return BinaryParagraph(*p); + BinaryControlFile bcf; + bcf.core_paragraph = BinaryParagraph(p->front()); + p->erase(p->begin()); + + bcf.features = + Util::fmap(*p, [&](auto&& raw_feature) -> BinaryParagraph { return BinaryParagraph(raw_feature); }); + + return bcf; } return pghs.error(); diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index a5d923ad2..473c81cfa 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -10,9 +10,9 @@ #include "vcpkg_System.h" #include "vcpkg_Util.h" -using vcpkg::Build::PreBuildInfo; using vcpkg::Build::BuildInfo; using vcpkg::Build::BuildPolicy; +using vcpkg::Build::PreBuildInfo; namespace vcpkg::PostBuildLint { @@ -369,12 +369,12 @@ namespace vcpkg::PostBuildLint std::vector<FileAndArch> binaries_with_invalid_architecture) { System::println(System::Color::warning, "The following files were built for an incorrect architecture:"); - System::println(""); + System::println(); for (const FileAndArch& b : binaries_with_invalid_architecture) { System::println(" %s", b.file.generic_string()); System::println("Expected %s, but was: %s", expected_architecture, b.actual_arch); - System::println(""); + System::println(); } } @@ -487,7 +487,7 @@ namespace vcpkg::PostBuildLint System::println(System::Color::warning, "Release binaries were not found"); } - System::println(""); + System::println(); return LintStatus::ERROR_DETECTED; } @@ -621,12 +621,12 @@ namespace vcpkg::PostBuildLint System::println(System::Color::warning, "Expected %s crt linkage, but the following libs had invalid crt linkage:", expected_build_type.to_string()); - System::println(""); + System::println(); for (const BuildType_and_file btf : libs_with_invalid_crt) { System::println(" %s: %s", btf.file.generic_string(), btf.build_type.to_string()); } - System::println(""); + System::println(); System::println(System::Color::warning, "To inspect the lib files, use:\n dumpbin.exe /directives mylibfile.lib"); @@ -675,12 +675,12 @@ namespace vcpkg::PostBuildLint if (!dlls_with_outdated_crt.empty()) { System::println(System::Color::warning, "Detected outdated dynamic CRT in the following files:"); - System::println(""); + System::println(); for (const OutdatedDynamicCrt_and_file btf : dlls_with_outdated_crt) { System::println(" %s: %s", btf.file.generic_string(), btf.outdated_crt.name); } - System::println(""); + System::println(); System::println(System::Color::warning, "To inspect the dll files, use:\n dumpbin.exe /dependents mydllfile.dll"); diff --git a/toolsrc/src/SourceParagraph.cpp b/toolsrc/src/SourceParagraph.cpp index a34167db7..50d6ecf07 100644 --- a/toolsrc/src/SourceParagraph.cpp +++ b/toolsrc/src/SourceParagraph.cpp @@ -1,5 +1,6 @@ #include "pch.h" +#include "PackageSpec.h" #include "SourceParagraph.h" #include "Triplet.h" #include "vcpkg_Checks.h" @@ -12,7 +13,6 @@ namespace vcpkg { using namespace vcpkg::Parse; - bool g_feature_packages = false; namespace Fields { static const std::string BUILD_DEPENDS = "Build-Depends"; @@ -28,7 +28,11 @@ namespace vcpkg static span<const std::string> get_list_of_valid_fields() { static const std::string valid_fields[] = { - Fields::SOURCE, Fields::VERSION, Fields::DESCRIPTION, Fields::MAINTAINER, Fields::BUILD_DEPENDS, + Fields::SOURCE, + Fields::VERSION, + Fields::DESCRIPTION, + Fields::MAINTAINER, + Fields::BUILD_DEPENDS, }; return valid_fields; @@ -152,57 +156,52 @@ namespace vcpkg return std::move(control_file); } + Dependency Dependency::parse_dependency(std::string name, std::string qualifier) + { + Dependency dep; + dep.qualifier = qualifier; + if (auto maybe_features = Features::from_string(name)) + dep.depend = *maybe_features.get(); + else + Checks::exit_with_message( + VCPKG_LINE_INFO, "error while parsing dependency: %s: %s", to_string(maybe_features.error()), name); + return dep; + } + + std::string Dependency::name() const + { + std::string str = this->depend.name; + if (this->depend.features.empty()) return str; + + str += "["; + for (auto&& s : this->depend.features) + { + str += s + ","; + } + str.pop_back(); + str += "]"; + return str; + } + std::vector<Dependency> vcpkg::expand_qualified_dependencies(const std::vector<std::string>& depends) { return Util::fmap(depends, [&](const std::string& depend_string) -> Dependency { auto pos = depend_string.find(' '); - if (pos == std::string::npos) return {depend_string, ""}; + if (pos == std::string::npos) return Dependency::parse_dependency(depend_string, Strings::EMPTY); // expect of the form "\w+ \[\w+\]" Dependency dep; - dep.name = depend_string.substr(0, pos); - if (depend_string.c_str()[pos + 1] != '[' || depend_string[depend_string.size() - 1] != ']') + + dep.depend.name = depend_string.substr(0, pos); + if (depend_string.c_str()[pos + 1] != '(' || depend_string[depend_string.size() - 1] != ')') { // Error, but for now just slurp the entire string. - return {depend_string, ""}; + return Dependency::parse_dependency(depend_string, Strings::EMPTY); } dep.qualifier = depend_string.substr(pos + 2, depend_string.size() - pos - 3); return dep; }); } - std::vector<std::string> parse_comma_list(const std::string& str) - { - if (str.empty()) - { - return {}; - } - - std::vector<std::string> out; - - size_t cur = 0; - do - { - auto pos = str.find(',', cur); - if (pos == std::string::npos) - { - out.push_back(str.substr(cur)); - break; - } - out.push_back(str.substr(cur, pos - cur)); - - // skip comma and space - ++pos; - if (str[pos] == ' ') - { - ++pos; - } - - cur = pos; - } while (cur != std::string::npos); - - return out; - } - std::vector<std::string> filter_dependencies(const std::vector<vcpkg::Dependency>& deps, const Triplet& t) { std::vector<std::string> ret; @@ -210,13 +209,22 @@ namespace vcpkg { if (dep.qualifier.empty() || t.canonical_name().find(dep.qualifier) != std::string::npos) { - ret.push_back(dep.name); + ret.emplace_back(dep.name()); } } return ret; } - const std::string& to_string(const Dependency& dep) { return dep.name; } + std::vector<FeatureSpec> filter_dependencies_to_specs(const std::vector<Dependency>& deps, const Triplet& t) + { + return FeatureSpec::from_strings_and_triplet(filter_dependencies(deps, t), t); + } + + const std::string to_string(const Dependency& dep) + { + std::string name = dep.name(); + return name; + } ExpectedT<Supports, std::vector<std::string>> Supports::parse(const std::vector<std::string>& strs) { diff --git a/toolsrc/src/StatusParagraphs.cpp b/toolsrc/src/StatusParagraphs.cpp index 27f3c30a2..02ee61f75 100644 --- a/toolsrc/src/StatusParagraphs.cpp +++ b/toolsrc/src/StatusParagraphs.cpp @@ -27,6 +27,30 @@ namespace vcpkg }); } + std::vector<std::unique_ptr<StatusParagraph>*> StatusParagraphs::find_all(const std::string& name, + const Triplet& triplet) + { + std::vector<std::unique_ptr<StatusParagraph>*> spghs; + for (auto&& p : *this) + { + if (p->package.spec.name() == name && p->package.spec.triplet() == triplet) + { + spghs.emplace_back(&p); + } + } + return spghs; + } + + StatusParagraphs::iterator StatusParagraphs::find(const std::string& name, + const Triplet& triplet, + const std::string& feature) + { + return std::find_if(begin(), end(), [&](const std::unique_ptr<StatusParagraph>& pgh) { + const PackageSpec& spec = pgh->package.spec; + return spec.name() == name && spec.triplet() == triplet && pgh->package.feature == feature; + }); + } + StatusParagraphs::const_iterator StatusParagraphs::find_installed(const std::string& name, const Triplet& triplet) const { @@ -43,7 +67,7 @@ namespace vcpkg { Checks::check_exit(VCPKG_LINE_INFO, pgh != nullptr, "Inserted null paragraph"); const PackageSpec& spec = pgh->package.spec; - auto ptr = find(spec.name(), spec.triplet()); + auto ptr = find(spec.name(), spec.triplet(), pgh->package.feature); if (ptr == end()) { paragraphs.push_back(std::move(pgh)); diff --git a/toolsrc/src/VcpkgCmdArguments.cpp b/toolsrc/src/VcpkgCmdArguments.cpp index ebf4c5fc5..cb261930e 100644 --- a/toolsrc/src/VcpkgCmdArguments.cpp +++ b/toolsrc/src/VcpkgCmdArguments.cpp @@ -3,6 +3,7 @@ #include "VcpkgCmdArguments.h" #include "metrics.h" #include "vcpkg_Commands.h" +#include "vcpkg_GlobalState.h" #include "vcpkg_System.h" namespace vcpkg @@ -15,7 +16,7 @@ namespace vcpkg if (arg_begin == arg_end) { System::println(System::Color::error, "Error: expected value after %s", option_name); - Metrics::track_property("error", "error option name"); + Metrics::g_metrics.lock()->track_property("error", "error option name"); Commands::Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -23,7 +24,7 @@ namespace vcpkg if (option_field != nullptr) { System::println(System::Color::error, "Error: %s specified multiple times", option_name); - Metrics::track_property("error", "error option specified multiple times"); + Metrics::g_metrics.lock()->track_property("error", "error option specified multiple times"); Commands::Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -36,7 +37,7 @@ namespace vcpkg if (option_field && option_field != new_setting) { System::println(System::Color::error, "Error: conflicting values specified for --%s", option_name); - Metrics::track_property("error", "error conflicting switches"); + Metrics::g_metrics.lock()->track_property("error", "error conflicting switches"); Commands::Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -70,7 +71,7 @@ namespace vcpkg if (arg[0] == '-' && arg[1] != '-') { - Metrics::track_property("error", "error short options are not supported"); + Metrics::g_metrics.lock()->track_property("error", "error short options are not supported"); Checks::exit_with_message(VCPKG_LINE_INFO, "Error: short options are not supported: %s", arg); } @@ -119,11 +120,11 @@ namespace vcpkg } if (arg == "--featurepackages") { - g_feature_packages = true; + GlobalState::feature_packages = true; continue; } - auto eq_pos = arg.find('='); + const auto eq_pos = arg.find('='); if (eq_pos != std::string::npos) { args.optional_command_arguments.emplace(arg.substr(0, eq_pos), arg.substr(eq_pos + 1)); @@ -157,7 +158,7 @@ namespace vcpkg auto options_copy = this->optional_command_arguments; for (const std::string& option : valid_switches) { - auto it = options_copy.find(option); + const auto it = options_copy.find(option); if (it != options_copy.end()) { if (it->second.has_value()) @@ -176,7 +177,7 @@ namespace vcpkg for (const std::string& option : valid_settings) { - auto it = options_copy.find(option); + const auto it = options_copy.find(option); if (it != options_copy.end()) { if (!it->second.has_value()) @@ -221,17 +222,17 @@ namespace vcpkg void VcpkgCmdArguments::check_max_arg_count(const size_t expected_arg_count) const { - return check_max_arg_count(expected_arg_count, ""); + return check_max_arg_count(expected_arg_count, Strings::EMPTY); } void VcpkgCmdArguments::check_min_arg_count(const size_t expected_arg_count) const { - return check_min_arg_count(expected_arg_count, ""); + return check_min_arg_count(expected_arg_count, Strings::EMPTY); } void VcpkgCmdArguments::check_exact_arg_count(const size_t expected_arg_count) const { - return check_exact_arg_count(expected_arg_count, ""); + return check_exact_arg_count(expected_arg_count, Strings::EMPTY); } void VcpkgCmdArguments::check_max_arg_count(const size_t expected_arg_count, const std::string& example_text) const diff --git a/toolsrc/src/VcpkgPaths.cpp b/toolsrc/src/VcpkgPaths.cpp index 60204bcdd..ef9209b78 100644 --- a/toolsrc/src/VcpkgPaths.cpp +++ b/toolsrc/src/VcpkgPaths.cpp @@ -10,6 +10,16 @@ namespace vcpkg { + static std::string WORKAROUND_ISSUE_1712(const std::string& line) + { + auto colon_pos = line.find(':'); + if (colon_pos != std::string::npos && colon_pos > 0) + { + return line.substr(colon_pos - 1); + } + return line; + } + static bool exists_and_has_equal_or_greater_version(const std::wstring& version_cmd, const std::array<int, 3>& expected_version) { @@ -87,12 +97,15 @@ namespace vcpkg "(No sufficient installed version was found)", Strings::to_utf8(tool_name), version_as_string); - Metrics::track_property("error", "powershell install failed"); - Metrics::track_property("installcmd", install_cmd); + { + auto locked_metrics = Metrics::g_metrics.lock(); + locked_metrics->track_property("error", "powershell install failed"); + locked_metrics->track_property("dependency", tool_name); + } Checks::exit_with_code(VCPKG_LINE_INFO, rc.exit_code); } - const fs::path actual_downloaded_path = Strings::trimmed(rc.output); + const fs::path actual_downloaded_path = WORKAROUND_ISSUE_1712(Strings::trimmed(rc.output)); std::error_code ec; auto eq = fs::stdfs::equivalent(expected_downloaded_path, actual_downloaded_path, ec); Checks::check_exit(VCPKG_LINE_INFO, @@ -130,7 +143,7 @@ namespace vcpkg fs::path get_nuget_path(const fs::path& downloads_folder, const fs::path& scripts_folder) { static constexpr std::array<int, 3> expected_version = {4, 1, 0}; - static const std::wstring version_check_arguments = L""; + static const std::wstring version_check_arguments = Strings::WEMPTY; const fs::path downloaded_copy = downloads_folder / "nuget-4.1.0" / "nuget.exe"; const std::vector<fs::path> from_path = find_from_PATH(L"nuget"); @@ -186,7 +199,7 @@ namespace vcpkg if (paths.root.empty()) { - Metrics::track_property("error", "Invalid vcpkg root directory"); + Metrics::g_metrics.lock()->track_property("error", "Invalid vcpkg root directory"); Checks::exit_with_message(VCPKG_LINE_INFO, "Invalid vcpkg root directory: %s", paths.root.string()); } @@ -214,6 +227,7 @@ namespace vcpkg fs::path VcpkgPaths::package_dir(const PackageSpec& spec) const { return this->packages / spec.dir(); } fs::path VcpkgPaths::port_dir(const PackageSpec& spec) const { return this->ports / spec.name(); } + fs::path VcpkgPaths::port_dir(const std::string& name) const { return this->ports / name; } fs::path VcpkgPaths::build_info_file_path(const PackageSpec& spec) const { @@ -260,7 +274,7 @@ namespace vcpkg const std::wstring cmd = System::create_powershell_script_cmd(script); System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd); Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Could not run script to detect VS 2017 instances"); - return Strings::split(ec_data.output, "\n"); + return Util::fmap(Strings::split(ec_data.output, "\n"), WORKAROUND_ISSUE_1712); } static Optional<fs::path> get_VS2015_installation_instance() @@ -278,6 +292,8 @@ namespace vcpkg static std::vector<Toolset> find_toolset_instances(const VcpkgPaths& paths) { + using CPU = System::CPUArchitecture; + const auto& fs = paths.get_filesystem(); const std::vector<std::string> vs2017_installation_instances = get_VS2017_installation_instances(paths); @@ -297,9 +313,26 @@ namespace vcpkg { const fs::path vs2015_dumpbin_exe = *v / "VC" / "bin" / "dumpbin.exe"; paths_examined.push_back(vs2015_dumpbin_exe); + + const fs::path vs2015_bin_dir = vs2015_vcvarsall_bat.parent_path() / "bin"; + std::vector<ToolsetArchOption> supported_architectures; + if (fs.exists(vs2015_bin_dir / "vcvars32.bat")) + supported_architectures.push_back({L"x86", CPU::X86, CPU::X86}); + if (fs.exists(vs2015_bin_dir / "amd64\\vcvars64.bat")) + supported_architectures.push_back({L"x64", CPU::X64, CPU::X64}); + if (fs.exists(vs2015_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat")) + supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); + if (fs.exists(vs2015_bin_dir / "x86_arm\\vcvarsx86_arm.bat")) + supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM}); + if (fs.exists(vs2015_bin_dir / "amd64_x86\\vcvarsamd64_x86.bat")) + supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86}); + if (fs.exists(vs2015_bin_dir / "amd64_arm\\vcvarsamd64_arm.bat")) + supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM}); + if (fs.exists(vs2015_dumpbin_exe)) { - found_toolsets.push_back({vs2015_dumpbin_exe, vs2015_vcvarsall_bat, L"v140"}); + found_toolsets.push_back( + {vs2015_dumpbin_exe, vs2015_vcvarsall_bat, L"v140", supported_architectures}); } } } @@ -311,10 +344,26 @@ namespace vcpkg const fs::path vc_dir = instance / "VC"; // Skip any instances that do not have vcvarsall. - const fs::path vcvarsall_bat = vc_dir / "Auxiliary" / "Build" / "vcvarsall.bat"; + 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({L"x86", CPU::X86, CPU::X86}); + if (fs.exists(vcvarsall_dir / "vcvars64.bat")) + supported_architectures.push_back({L"amd64", CPU::X64, CPU::X64}); + if (fs.exists(vcvarsall_dir / "vcvarsx86_amd64.bat")) + supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); + if (fs.exists(vcvarsall_dir / "vcvarsx86_arm.bat")) + supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM}); + if (fs.exists(vcvarsall_dir / "vcvarsamd64_x86.bat")) + supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86}); + if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm.bat")) + supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM}); + // 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); @@ -331,7 +380,7 @@ namespace vcpkg paths_examined.push_back(dumpbin_path); if (fs.exists(dumpbin_path)) { - vs2017_toolset = Toolset{dumpbin_path, vcvarsall_bat, L"v141"}; + vs2017_toolset = Toolset{dumpbin_path, vcvarsall_bat, L"v141", supported_architectures}; break; } } diff --git a/toolsrc/src/coff_file_reader.cpp b/toolsrc/src/coff_file_reader.cpp index 6c38c452b..10c1437c6 100644 --- a/toolsrc/src/coff_file_reader.cpp +++ b/toolsrc/src/coff_file_reader.cpp @@ -24,7 +24,7 @@ namespace vcpkg::COFFFileReader template<class T> static T peek_value_from_stream(fstream& fs) { - fpos_t original_pos = fs.tellg().seekpos(); + const fpos_t original_pos = fs.tellg().seekpos(); T data; fs.read(reinterpret_cast<char*>(&data), sizeof data); fs.seekg(original_pos); @@ -236,7 +236,7 @@ namespace vcpkg::COFFFileReader read_and_verify_PE_signature(fs); CoffFileHeader header = CoffFileHeader::read(fs); - MachineType machine = header.machine_type(); + const MachineType machine = header.machine_type(); return {machine}; } @@ -282,7 +282,7 @@ namespace vcpkg::COFFFileReader marker.advance_by(ArchiveMemberHeader::HEADER_SIZE + second_linker_member_header.member_size()); marker.seek_to_marker(fs); - bool hasLongnameMemberHeader = peek_value_from_stream<uint16_t>(fs) == 0x2F2F; + const bool hasLongnameMemberHeader = peek_value_from_stream<uint16_t>(fs) == 0x2F2F; if (hasLongnameMemberHeader) { const ArchiveMemberHeader longnames_member_header = ArchiveMemberHeader::read(fs); diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index 4da9cede2..26a783a4b 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -29,8 +29,8 @@ namespace vcpkg::Commands::BuildCommand const PackageSpec& spec = full_spec.package_spec; if (options.find(OPTION_CHECKS_ONLY) != options.end()) { - auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, spec.triplet()); - auto build_info = Build::read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec)); + const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, spec.triplet()); + const auto build_info = Build::read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec)); const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info); Checks::check_exit(VCPKG_LINE_INFO, error_count == 0); Checks::exit_success(VCPKG_LINE_INFO); @@ -45,7 +45,7 @@ namespace vcpkg::Commands::BuildCommand Checks::exit_fail(VCPKG_LINE_INFO); } - for (std::string str : full_spec.features) + for (const std::string& str : full_spec.features) { System::println("%s \n", str); } @@ -56,8 +56,8 @@ namespace vcpkg::Commands::BuildCommand scf->core_paragraph->name, spec.name()); - StatusParagraphs status_db = database_load_check(paths); - Build::BuildPackageOptions build_package_options{Build::UseHeadVersion::NO, Build::AllowDownloads::YES}; + const StatusParagraphs status_db = database_load_check(paths); + const Build::BuildPackageOptions build_package_options{Build::UseHeadVersion::NO, Build::AllowDownloads::YES}; const Build::BuildPackageConfig build_config{ *scf->core_paragraph, spec.triplet(), paths.port_dir(spec), build_package_options}; @@ -68,12 +68,12 @@ namespace vcpkg::Commands::BuildCommand System::println(System::Color::error, "The build command requires all dependencies to be already installed."); System::println("The following dependencies are missing:"); - System::println(""); + System::println(); for (const auto& p : result.unmet_dependencies) { System::println(" %s", p); } - System::println(""); + System::println(); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -92,7 +92,7 @@ namespace vcpkg::Commands::BuildCommand static const std::string example = Commands::Help::create_example_string("build zlib:x64-windows"); args.check_exact_arg_count( 1, example); // Build only takes a single package and all dependencies must already be installed - std::string command_argument = args.command_arguments.at(0); + const std::string command_argument = args.command_arguments.at(0); const FullPackageSpec spec = Input::check_and_get_full_package_spec(command_argument, default_triplet, example); Input::check_triplet(spec.package_spec.triplet(), paths); const std::unordered_set<std::string> options = diff --git a/toolsrc/src/commands_cache.cpp b/toolsrc/src/commands_cache.cpp index 75de78461..fa0c62ee4 100644 --- a/toolsrc/src/commands_cache.cpp +++ b/toolsrc/src/commands_cache.cpp @@ -15,7 +15,7 @@ namespace vcpkg::Commands::Cache { const Expected<std::unordered_map<std::string, std::string>> pghs = Paragraphs::get_single_paragraph(paths.get_filesystem(), path / "CONTROL"); - if (auto p = pghs.get()) + if (const auto p = pghs.get()) { const BinaryParagraph binary_paragraph = BinaryParagraph(*p); output.push_back(binary_paragraph); diff --git a/toolsrc/src/commands_depends.cpp b/toolsrc/src/commands_depends.cpp index 2d1fb658b..ffad91226 100644 --- a/toolsrc/src/commands_depends.cpp +++ b/toolsrc/src/commands_depends.cpp @@ -33,7 +33,7 @@ namespace vcpkg::Commands::DependInfo for (const Dependency& dependency : source_paragraph.depends) { - if (Strings::case_insensitive_ascii_contains(dependency.name, filter)) + if (Strings::case_insensitive_ascii_contains(dependency.name(), filter)) { return false; } @@ -46,7 +46,7 @@ namespace vcpkg::Commands::DependInfo for (auto&& source_control_file : source_control_files) { const SourceParagraph& source_paragraph = *source_control_file->core_paragraph; - auto s = Strings::join(", ", source_paragraph.depends, [](const Dependency& d) { return d.name; }); + const auto s = Strings::join(", ", source_paragraph.depends, [](const Dependency& d) { return d.name(); }); System::println("%s: %s", source_paragraph.name, s); } diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index 4e83fcca8..e72931e63 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -8,75 +8,96 @@ namespace vcpkg::Commands::Edit { void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) { + static const std::string OPTION_BUILDTREES = "--buildtrees"; + auto& fs = paths.get_filesystem(); - static const std::string example = Commands::Help::create_example_string("edit zlib"); - args.check_exact_arg_count(1, example); - args.check_and_get_optional_command_arguments({}); + static const std::string EXAMPLE = Commands::Help::create_example_string("edit zlib"); + args.check_exact_arg_count(1, EXAMPLE); + const std::unordered_set<std::string> options = + args.check_and_get_optional_command_arguments({OPTION_BUILDTREES}); const std::string port_name = args.command_arguments.at(0); const fs::path portpath = paths.ports / port_name; Checks::check_exit(VCPKG_LINE_INFO, fs.is_directory(portpath), R"(Could not find port named "%s")", port_name); // Find the user's selected editor - std::wstring env_EDITOR; + std::wstring env_editor; + + if (env_editor.empty()) + { + const Optional<std::wstring> env_editor_optional = System::get_environment_variable(L"EDITOR"); + if (const auto e = env_editor_optional.get()) + { + env_editor = *e; + } + } - if (env_EDITOR.empty()) + if (env_editor.empty()) { - const Optional<std::wstring> env_EDITOR_optional = System::get_environment_variable(L"EDITOR"); - if (auto e = env_EDITOR_optional.get()) + const fs::path code_exe_path = System::get_ProgramFiles_platform_bitness() / "Microsoft VS Code/Code.exe"; + if (fs.exists(code_exe_path)) { - env_EDITOR = *e; + env_editor = code_exe_path; } } - if (env_EDITOR.empty()) + if (env_editor.empty()) { - const fs::path CODE_EXE_PATH = System::get_ProgramFiles_32_bit() / "Microsoft VS Code/Code.exe"; - if (fs.exists(CODE_EXE_PATH)) + const fs::path code_exe_path = System::get_ProgramFiles_32_bit() / "Microsoft VS Code/Code.exe"; + if (fs.exists(code_exe_path)) { - env_EDITOR = CODE_EXE_PATH; + env_editor = code_exe_path; } } - if (env_EDITOR.empty()) + if (env_editor.empty()) { - static const std::array<const wchar_t*, 4> regkeys = { + static const std::array<const wchar_t*, 4> REGKEYS = { LR"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C26E74D1-022E-4238-8B9D-1E7564A36CC9}_is1)", LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C26E74D1-022E-4238-8B9D-1E7564A36CC9}_is1)", LR"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1)", LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1)", }; - for (auto&& keypath : regkeys) + for (auto&& keypath : REGKEYS) { const Optional<std::wstring> code_installpath = System::get_registry_string(HKEY_LOCAL_MACHINE, keypath, L"InstallLocation"); - if (auto c = code_installpath.get()) + if (const auto c = code_installpath.get()) { auto p = fs::path(*c) / "Code.exe"; if (fs.exists(p)) { - env_EDITOR = p.native(); + env_editor = p.native(); break; } auto p_insiders = fs::path(*c) / "Code - Insiders.exe"; if (fs.exists(p_insiders)) { - env_EDITOR = p_insiders.native(); + env_editor = p_insiders.native(); break; } } } } - if (env_EDITOR.empty()) + if (env_editor.empty()) { Checks::exit_with_message( VCPKG_LINE_INFO, "Visual Studio Code was not found and the environment variable EDITOR is not set"); } - std::wstring cmdLine = Strings::wformat( - LR"("%s" "%s" "%s" -n)", env_EDITOR, portpath.native(), (portpath / "portfile.cmake").native()); - Checks::exit_with_code(VCPKG_LINE_INFO, System::cmd_execute(cmdLine)); + if (options.find(OPTION_BUILDTREES) != options.cend()) + { + const auto buildtrees_current_dir = paths.buildtrees / port_name; + + const std::wstring cmd_line = + Strings::wformat(LR"("%s" "%s" -n)", env_editor, buildtrees_current_dir.native()); + Checks::exit_with_code(VCPKG_LINE_INFO, System::cmd_execute(cmd_line)); + } + + const std::wstring cmd_line = Strings::wformat( + LR"("%s" "%s" "%s" -n)", env_editor, portpath.native(), (portpath / "portfile.cmake").native()); + Checks::exit_with_code(VCPKG_LINE_INFO, System::cmd_execute(cmd_line)); } } diff --git a/toolsrc/src/commands_env.cpp b/toolsrc/src/commands_env.cpp index dd7172b89..073c501f5 100644 --- a/toolsrc/src/commands_env.cpp +++ b/toolsrc/src/commands_env.cpp @@ -8,12 +8,13 @@ namespace vcpkg::Commands::Env { void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) { - static const std::string example = Commands::Help::create_example_string(R"(env --Triplet x64-windows)"); - args.check_exact_arg_count(0, example); + static const std::string EXAMPLE = Commands::Help::create_example_string(R"(env --Triplet x64-windows)"); + args.check_exact_arg_count(0, EXAMPLE); args.check_and_get_optional_command_arguments({}); - auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, default_triplet); - System::cmd_execute_clean(Build::make_build_env_cmd(pre_build_info, paths.get_toolset(pre_build_info.platform_toolset)) + L" && cmd"); + const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, default_triplet); + System::cmd_execute_clean( + Build::make_build_env_cmd(pre_build_info, paths.get_toolset(pre_build_info.platform_toolset)) + L" && cmd"); Checks::exit_success(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/commands_export.cpp b/toolsrc/src/commands_export.cpp index 4adfbc0f6..dbfb09aab 100644 --- a/toolsrc/src/commands_export.cpp +++ b/toolsrc/src/commands_export.cpp @@ -11,10 +11,10 @@ namespace vcpkg::Commands::Export { - using Install::InstallDir; using Dependencies::ExportPlanAction; - using Dependencies::RequestType; using Dependencies::ExportPlanType; + using Dependencies::RequestType; + using Install::InstallDir; static std::string create_nuspec_file_contents(const std::string& raw_exported_dir, const std::string& targets_redirect_path, @@ -67,7 +67,7 @@ namespace vcpkg::Commands::Export for (const ExportPlanType plan_type : order) { - auto it = group_by_plan_type.find(plan_type); + const auto it = group_by_plan_type.find(plan_type); if (it == group_by_plan_type.cend()) { continue; @@ -205,11 +205,9 @@ namespace vcpkg::Commands::Export static Optional<std::string> maybe_lookup(std::unordered_map<std::string, std::string> const& m, std::string const& key) { - auto it = m.find(key); - if (it != m.end()) - return it->second; - else - return nullopt; + const auto it = m.find(key); + if (it != m.end()) return it->second; + return nullopt; } void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) @@ -235,10 +233,15 @@ namespace vcpkg::Commands::Export const auto options = args.check_and_get_optional_command_arguments( { - OPTION_DRY_RUN, OPTION_RAW, OPTION_NUGET, OPTION_ZIP, OPTION_7ZIP, + OPTION_DRY_RUN, + OPTION_RAW, + OPTION_NUGET, + OPTION_ZIP, + OPTION_7ZIP, }, { - OPTION_NUGET_ID, OPTION_NUGET_VERSION, + OPTION_NUGET_ID, + OPTION_NUGET_VERSION, }); const bool dryRun = options.switches.find(OPTION_DRY_RUN) != options.switches.cend(); const bool raw = options.switches.find(OPTION_RAW) != options.switches.cend(); @@ -261,7 +264,7 @@ namespace vcpkg::Commands::Export VCPKG_LINE_INFO, !maybe_nuget_version || nuget, "--nuget-version is only valid with --nuget"); // create the plan - StatusParagraphs status_db = database_load_check(paths); + const StatusParagraphs status_db = database_load_check(paths); std::vector<ExportPlanAction> export_plan = Dependencies::create_export_plan(paths, specs, status_db); Checks::check_exit(VCPKG_LINE_INFO, !export_plan.empty(), "Export plan cannot be empty"); @@ -280,7 +283,7 @@ namespace vcpkg::Commands::Export "Additional packages (*) need to be exported to complete this operation."); } - auto it = group_by_plan_type.find(ExportPlanType::PORT_AVAILABLE_BUT_NOT_BUILT); + const auto it = group_by_plan_type.find(ExportPlanType::PORT_AVAILABLE_BUT_NOT_BUILT); if (it != group_by_plan_type.cend() && !it->second.empty()) { System::println(System::Color::error, "There are packages that have not been built."); @@ -290,7 +293,7 @@ namespace vcpkg::Commands::Export Util::erase_remove_if( unbuilt, [](const ExportPlanAction* a) { return a->request_type != RequestType::USER_REQUESTED; }); - auto s = Strings::join(" ", unbuilt, [](const ExportPlanAction* a) { return a->spec.to_string(); }); + const auto s = Strings::join(" ", unbuilt, [](const ExportPlanAction* a) { return a->spec.to_string(); }); System::println("To build them, run:\n" " vcpkg install %s", s); @@ -323,7 +326,7 @@ namespace vcpkg::Commands::Export System::println("Exporting package %s... ", display_name); const BinaryParagraph& binary_paragraph = - action.any_paragraph.binary_paragraph.value_or_exit(VCPKG_LINE_INFO); + action.any_paragraph.binary_control_file.value_or_exit(VCPKG_LINE_INFO).core_paragraph; const InstallDir dirs = InstallDir::from_destination_root( raw_exported_dir_path / "installed", action.spec.triplet().to_string(), @@ -355,7 +358,7 @@ namespace vcpkg::Commands::Export Checks::check_exit(VCPKG_LINE_INFO, !ec); } - auto print_next_step_info = [](const fs::path& prefix) { + const auto print_next_step_info = [](const fs::path& prefix) { const fs::path cmake_toolchain = prefix / "scripts" / "buildsystems" / "vcpkg.cmake"; const CMakeVariable cmake_variable = CMakeVariable(L"CMAKE_TOOLCHAIN_FILE", cmake_toolchain.generic_string()); diff --git a/toolsrc/src/commands_hash.cpp b/toolsrc/src/commands_hash.cpp index 0da2b031f..b3211b9f8 100644 --- a/toolsrc/src/commands_hash.cpp +++ b/toolsrc/src/commands_hash.cpp @@ -6,22 +6,22 @@ namespace vcpkg::Commands::Hash { - static void do_file_hash(fs::path const& path, std::wstring const& hashType) + static void do_file_hash(fs::path const& path, std::wstring const& hash_type) { - auto cmd_line = Strings::wformat(LR"(CertUtil.exe -hashfile "%s" %s)", path.c_str(), hashType); - auto ec_data = System::cmd_execute_and_capture_output(cmd_line); + const auto cmd_line = Strings::wformat(LR"(CertUtil.exe -hashfile "%s" %s)", path.c_str(), 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", Strings::to_utf8(cmd_line)); std::string const& output = ec_data.output; - auto start = output.find_first_of("\r\n"); + const auto start = output.find_first_of("\r\n"); Checks::check_exit(VCPKG_LINE_INFO, start != std::string::npos, "Unexpected output format from command: %s", Strings::to_utf8(cmd_line)); - auto end = output.find_first_of("\r\n", start + 1); + 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", @@ -34,11 +34,11 @@ namespace vcpkg::Commands::Hash void perform_and_exit(const VcpkgCmdArguments& args) { - static const std::string example = + static const std::string EXAMPLE = Strings::format("The argument should be a file path\n%s", Commands::Help::create_example_string("hash boost_1_62_0.tar.bz2")); - args.check_min_arg_count(1, example); - args.check_max_arg_count(2, example); + args.check_min_arg_count(1, EXAMPLE); + args.check_max_arg_count(2, EXAMPLE); args.check_and_get_optional_command_arguments({}); if (args.command_arguments.size() == 1) diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp index 2ce5b6c62..8b1eec5eb 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/commands_install.cpp @@ -6,6 +6,7 @@ #include "vcpkg_Commands.h" #include "vcpkg_Dependencies.h" #include "vcpkg_Files.h" +#include "vcpkg_GlobalState.h" #include "vcpkg_Input.h" #include "vcpkg_System.h" #include "vcpkg_Util.h" @@ -13,11 +14,7 @@ namespace vcpkg::Commands::Install { - using Dependencies::InstallPlanAction; - using Dependencies::RequestType; - using Dependencies::InstallPlanType; - using Dependencies::RemovePlanAction; - using Dependencies::RemovePlanType; + using namespace Dependencies; InstallDir InstallDir::from_destination_root(const fs::path& destination_root, const std::string& destination_subdirectory, @@ -176,45 +173,10 @@ namespace vcpkg::Commands::Install return SortedVector<std::string>(std::move(installed_files)); } - static void print_plan(const std::map<InstallPlanType, std::vector<const InstallPlanAction*>>& group_by_plan_type) + InstallResult install_package(const VcpkgPaths& paths, const BinaryControlFile& bcf, StatusParagraphs* status_db) { - static constexpr std::array<InstallPlanType, 3> order = { - InstallPlanType::ALREADY_INSTALLED, InstallPlanType::BUILD_AND_INSTALL, InstallPlanType::INSTALL}; - - for (const InstallPlanType plan_type : order) - { - auto it = group_by_plan_type.find(plan_type); - if (it == group_by_plan_type.cend()) - { - continue; - } - - std::vector<const InstallPlanAction*> cont = it->second; - std::sort(cont.begin(), cont.end(), &InstallPlanAction::compare_by_name); - const std::string as_string = Strings::join("\n", cont, [](const InstallPlanAction* p) { - return Dependencies::to_output_string(p->request_type, p->spec.to_string()); - }); - - switch (plan_type) - { - case InstallPlanType::ALREADY_INSTALLED: - System::println("The following packages are already installed:\n%s", as_string); - continue; - case InstallPlanType::BUILD_AND_INSTALL: - System::println("The following packages will be built and installed:\n%s", as_string); - continue; - case InstallPlanType::INSTALL: - System::println("The following packages will be installed:\n%s", as_string); - continue; - default: Checks::unreachable(VCPKG_LINE_INFO); - } - } - } - - void install_package(const VcpkgPaths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs* status_db) - { - const fs::path package_dir = paths.package_dir(binary_paragraph.spec); - const Triplet& triplet = binary_paragraph.spec.triplet(); + const fs::path package_dir = paths.package_dir(bcf.core_paragraph.spec); + const Triplet& triplet = bcf.core_paragraph.spec.triplet(); const std::vector<StatusParagraphAndAssociatedFiles> pgh_and_files = get_installed_files(paths, *status_db); const SortedVector<std::string> package_files = @@ -234,35 +196,52 @@ namespace vcpkg::Commands::Install System::println(System::Color::error, "The following files are already installed in %s and are in conflict with %s", triplet_install_path.generic_string(), - binary_paragraph.spec); + bcf.core_paragraph.spec); System::print("\n "); System::println(Strings::join("\n ", intersection)); - System::println(""); - Checks::exit_fail(VCPKG_LINE_INFO); + System::println(); + return InstallResult::FILE_CONFLICTS; } StatusParagraph source_paragraph; - source_paragraph.package = binary_paragraph; + source_paragraph.package = bcf.core_paragraph; source_paragraph.want = Want::INSTALL; source_paragraph.state = InstallState::HALF_INSTALLED; - for (auto&& dep : source_paragraph.package.depends) - { - if (status_db->find_installed(dep, source_paragraph.package.spec.triplet()) == status_db->end()) - { - Checks::unreachable(VCPKG_LINE_INFO); - } - } + write_update(paths, source_paragraph); status_db->insert(std::make_unique<StatusParagraph>(source_paragraph)); + std::vector<StatusParagraph> features_spghs; + for (auto&& feature : bcf.features) + { + features_spghs.emplace_back(); + + StatusParagraph& feature_paragraph = features_spghs.back(); + feature_paragraph.package = feature; + feature_paragraph.want = Want::INSTALL; + feature_paragraph.state = InstallState::HALF_INSTALLED; + + write_update(paths, feature_paragraph); + status_db->insert(std::make_unique<StatusParagraph>(feature_paragraph)); + } + const InstallDir install_dir = InstallDir::from_destination_root( - paths.installed, triplet.to_string(), paths.listfile_path(binary_paragraph)); + paths.installed, triplet.to_string(), paths.listfile_path(bcf.core_paragraph)); install_files_and_write_listfile(paths.get_filesystem(), package_dir, install_dir); source_paragraph.state = InstallState::INSTALLED; write_update(paths, source_paragraph); status_db->insert(std::make_unique<StatusParagraph>(source_paragraph)); + + for (auto&& feature_paragraph : features_spghs) + { + feature_paragraph.state = InstallState::INSTALLED; + write_update(paths, feature_paragraph); + status_db->insert(std::make_unique<StatusParagraph>(feature_paragraph)); + } + + return InstallResult::SUCCESS; } using Build::BuildResult; @@ -274,6 +253,8 @@ namespace vcpkg::Commands::Install { const InstallPlanType& plan_type = action.plan_type; const std::string display_name = action.spec.to_string(); + const std::string display_name_with_features = + GlobalState::feature_packages ? action.displayname() : display_name; const bool is_user_requested = action.request_type == RequestType::USER_REQUESTED; const bool use_head_version = to_bool(build_package_options.use_head_version); @@ -281,75 +262,65 @@ namespace vcpkg::Commands::Install if (plan_type == InstallPlanType::ALREADY_INSTALLED) { if (use_head_version && is_user_requested) - { System::println( System::Color::warning, "Package %s is already installed -- not building from HEAD", display_name); - } else - { System::println(System::Color::success, "Package %s is already installed", display_name); - } return BuildResult::SUCCEEDED; } - if (plan_type == InstallPlanType::BUILD_AND_INSTALL && !g_feature_packages) + if (plan_type == InstallPlanType::BUILD_AND_INSTALL) { if (use_head_version) - System::println("Building package %s from HEAD... ", display_name); + System::println("Building package %s from HEAD... ", display_name_with_features); else - System::println("Building package %s... ", display_name); - - const Build::BuildPackageConfig build_config{ - action.any_paragraph.source_paragraph.value_or_exit(VCPKG_LINE_INFO), - action.spec.triplet(), - paths.port_dir(action.spec), - build_package_options}; - const auto result = Build::build_package(paths, build_config, status_db); + System::println("Building package %s... ", display_name_with_features); + + const auto result = [&]() -> Build::ExtendedBuildResult { + if (GlobalState::feature_packages) + { + const Build::BuildPackageConfig build_config{ + *action.any_paragraph.source_control_file.value_or_exit(VCPKG_LINE_INFO), + action.spec.triplet(), + paths.port_dir(action.spec), + build_package_options, + action.feature_list}; + return Build::build_package(paths, build_config, status_db); + } + else + { + const Build::BuildPackageConfig build_config{ + action.any_paragraph.source_paragraph.value_or_exit(VCPKG_LINE_INFO), + action.spec.triplet(), + paths.port_dir(action.spec), + build_package_options}; + return Build::build_package(paths, build_config, status_db); + } + }(); + if (result.code != Build::BuildResult::SUCCEEDED) { System::println(System::Color::error, Build::create_error_message(result.code, action.spec)); return result.code; } - System::println("Building package %s... done", display_name); - const BinaryParagraph bpgh = - Paragraphs::try_load_cached_package(paths, action.spec).value_or_exit(VCPKG_LINE_INFO); - System::println("Installing package %s... ", display_name); - install_package(paths, bpgh, &status_db); - System::println(System::Color::success, "Installing package %s... done", display_name); - return BuildResult::SUCCEEDED; - } + System::println("Building package %s... done", display_name_with_features); - if (plan_type == InstallPlanType::BUILD_AND_INSTALL && g_feature_packages) - { - if (use_head_version) - System::println("Building package %s from HEAD... ", display_name); - else - System::println("Building package %s... ", display_name); - - const Build::BuildPackageConfig build_config{ - *action.any_paragraph.source_control_file.value_or_exit(VCPKG_LINE_INFO), - action.spec.triplet(), - paths.port_dir(action.spec), - build_package_options, - action.feature_list}; - const auto result = Build::build_package(paths, build_config, status_db); - if (result.code != Build::BuildResult::SUCCEEDED) + const BinaryControlFile bcf = + Paragraphs::try_load_cached_control_package(paths, action.spec).value_or_exit(VCPKG_LINE_INFO); + System::println("Installing package %s... ", display_name_with_features); + auto install_result = install_package(paths, bcf, &status_db); + switch (install_result) { - System::println(System::Color::error, Build::create_error_message(result.code, action.spec)); - return result.code; + case InstallResult::SUCCESS: + System::println(System::Color::success, "Installing package %s... done", display_name); + return BuildResult::SUCCEEDED; + case InstallResult::FILE_CONFLICTS: return BuildResult::FILE_CONFLICTS; + default: Checks::unreachable(VCPKG_LINE_INFO); } - System::println("Building package %s... done", display_name); - - const BinaryParagraph bpgh = - Paragraphs::try_load_cached_package(paths, action.spec).value_or_exit(VCPKG_LINE_INFO); - System::println("Installing package %s... ", display_name); - install_package(paths, bpgh, &status_db); - System::println(System::Color::success, "Installing package %s... done", display_name); - return BuildResult::SUCCEEDED; } - if (plan_type == InstallPlanType::INSTALL && !g_feature_packages) + if (plan_type == InstallPlanType::INSTALL) { if (use_head_version && is_user_requested) { @@ -357,80 +328,267 @@ namespace vcpkg::Commands::Install System::Color::warning, "Package %s is already built -- not building from HEAD", display_name); } System::println("Installing package %s... ", display_name); - install_package(paths, action.any_paragraph.binary_paragraph.value_or_exit(VCPKG_LINE_INFO), &status_db); - System::println(System::Color::success, "Installing package %s... done", display_name); - return BuildResult::SUCCEEDED; + auto install_result = install_package( + paths, action.any_paragraph.binary_control_file.value_or_exit(VCPKG_LINE_INFO), &status_db); + switch (install_result) + { + case InstallResult::SUCCESS: + System::println(System::Color::success, "Installing package %s... done", display_name); + return BuildResult::SUCCEEDED; + case InstallResult::FILE_CONFLICTS: return BuildResult::FILE_CONFLICTS; + default: Checks::unreachable(VCPKG_LINE_INFO); + } } Checks::unreachable(VCPKG_LINE_INFO); } + static void print_plan(const std::vector<AnyAction>& action_plan, bool is_recursive) + { + std::vector<const RemovePlanAction*> remove_plans; + std::vector<const InstallPlanAction*> rebuilt_plans; + std::vector<const InstallPlanAction*> only_install_plans; + std::vector<const InstallPlanAction*> new_plans; + std::vector<const InstallPlanAction*> already_installed_plans; + + const bool has_non_user_requested_packages = Util::find_if(action_plan, [](const AnyAction& package) -> bool { + if (auto iplan = package.install_plan.get()) + return iplan->request_type != RequestType::USER_REQUESTED; + else + return false; + }) != action_plan.cend(); + + for (auto&& action : action_plan) + { + if (auto install_action = action.install_plan.get()) + { + // remove plans are guaranteed to come before install plans, so we know the plan will be contained if at + // all. + auto it = Util::find_if( + remove_plans, [&](const RemovePlanAction* plan) { return plan->spec == install_action->spec; }); + if (it != remove_plans.end()) + { + rebuilt_plans.emplace_back(install_action); + } + else + { + switch (install_action->plan_type) + { + case InstallPlanType::INSTALL: only_install_plans.emplace_back(install_action); break; + case InstallPlanType::ALREADY_INSTALLED: + if (install_action->request_type == RequestType::USER_REQUESTED) + already_installed_plans.emplace_back(install_action); + break; + case InstallPlanType::BUILD_AND_INSTALL: new_plans.emplace_back(install_action); break; + default: Checks::unreachable(VCPKG_LINE_INFO); + } + } + } + else if (auto remove_action = action.remove_plan.get()) + { + remove_plans.emplace_back(remove_action); + } + } + + std::sort(remove_plans.begin(), remove_plans.end(), &RemovePlanAction::compare_by_name); + std::sort(rebuilt_plans.begin(), rebuilt_plans.end(), &InstallPlanAction::compare_by_name); + std::sort(only_install_plans.begin(), only_install_plans.end(), &InstallPlanAction::compare_by_name); + std::sort(new_plans.begin(), new_plans.end(), &InstallPlanAction::compare_by_name); + std::sort(already_installed_plans.begin(), already_installed_plans.end(), &InstallPlanAction::compare_by_name); + + if (already_installed_plans.size() > 0) + { + const std::string already_string = + Strings::join("\n", already_installed_plans, [](const InstallPlanAction* p) { + return to_output_string(p->request_type, p->displayname()); + }); + System::println("The following packages are already installed:\n%s", already_string); + } + + if (rebuilt_plans.size() > 0) + { + const std::string rebuilt_string = Strings::join("\n", rebuilt_plans, [](const InstallPlanAction* p) { + return to_output_string(p->request_type, p->displayname()); + }); + System::println("The following packages will be rebuilt:\n%s", rebuilt_string); + } + + if (new_plans.size() > 0) + { + const std::string new_string = Strings::join("\n", new_plans, [](const InstallPlanAction* p) { + return to_output_string(p->request_type, p->displayname()); + }); + System::println("The following packages will be built and installed:\n%s", new_string); + } + + if (only_install_plans.size() > 0) + { + const std::string only_install_string = + Strings::join("\n", only_install_plans, [](const InstallPlanAction* p) { + return to_output_string(p->request_type, p->displayname()); + }); + System::println("The following packages will be directly installed:\n%s", only_install_string); + } + + if (has_non_user_requested_packages) + System::println("Additional packages (*) will be installed to complete this operation."); + + if (remove_plans.size() > 0 && !is_recursive) + { + System::println(System::Color::warning, + "If you are sure you want to rebuild the above packages, run the command with the " + "--recurse option"); + Checks::exit_fail(VCPKG_LINE_INFO); + } + } + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) { static const std::string OPTION_DRY_RUN = "--dry-run"; static const std::string OPTION_USE_HEAD_VERSION = "--head"; static const std::string OPTION_NO_DOWNLOADS = "--no-downloads"; + static const std::string OPTION_RECURSE = "--recurse"; // input sanitization static const std::string example = Commands::Help::create_example_string("install zlib zlib:x64-windows curl boost"); args.check_min_arg_count(1, example); - const std::vector<PackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) { - return Input::check_and_get_package_spec(arg, default_triplet, example); + const std::vector<FullPackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) { + return Input::check_and_get_full_package_spec(arg, default_triplet, example); }); + for (auto&& spec : specs) - Input::check_triplet(spec.triplet(), paths); + { + Input::check_triplet(spec.package_spec.triplet(), paths); + if (!spec.features.empty() && !GlobalState::feature_packages) + { + Checks::exit_with_message( + VCPKG_LINE_INFO, "Feature packages are experimentally available under the --featurepackages flag."); + } + } const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments( - {OPTION_DRY_RUN, OPTION_USE_HEAD_VERSION, OPTION_NO_DOWNLOADS}); + {OPTION_DRY_RUN, OPTION_USE_HEAD_VERSION, OPTION_NO_DOWNLOADS, OPTION_RECURSE}); const bool dryRun = options.find(OPTION_DRY_RUN) != options.cend(); const bool use_head_version = options.find(OPTION_USE_HEAD_VERSION) != options.cend(); const bool no_downloads = options.find(OPTION_NO_DOWNLOADS) != options.cend(); + const bool is_recursive = options.find(OPTION_RECURSE) != options.cend(); // create the plan StatusParagraphs status_db = database_load_check(paths); - Dependencies::PathsPortFile paths_port_file(paths); - std::vector<InstallPlanAction> install_plan = - Dependencies::create_install_plan(paths_port_file, specs, status_db); - Checks::check_exit(VCPKG_LINE_INFO, !install_plan.empty(), "Install plan cannot be empty"); - - // log the plan - const std::string specs_string = - Strings::join(",", install_plan, [](const InstallPlanAction& plan) { return plan.spec.to_string(); }); - Metrics::track_property("installplan", specs_string); - - std::map<InstallPlanType, std::vector<const InstallPlanAction*>> group_by_plan_type; - Util::group_by(install_plan, &group_by_plan_type, [](const InstallPlanAction& p) { return p.plan_type; }); - print_plan(group_by_plan_type); + const Build::BuildPackageOptions install_plan_options = {Build::to_use_head_version(use_head_version), + Build::to_allow_downloads(!no_downloads)}; - const bool has_non_user_requested_packages = - Util::find_if(install_plan, [](const InstallPlanAction& package) -> bool { - return package.request_type != RequestType::USER_REQUESTED; - }) != install_plan.cend(); + std::vector<AnyAction> action_plan; - if (has_non_user_requested_packages) + if (GlobalState::feature_packages) { - System::println("Additional packages (*) will be installed to complete this operation."); + std::unordered_map<std::string, SourceControlFile> scf_map; + auto all_ports = Paragraphs::try_load_all_ports(paths.get_filesystem(), paths.ports); + for (auto&& port : all_ports.paragraphs) + { + scf_map[port->core_paragraph->name] = std::move(*port); + } + action_plan = create_feature_install_plan(scf_map, FullPackageSpec::to_feature_specs(specs), status_db); + } + else + { + Dependencies::PathsPortFile paths_port_file(paths); + auto install_plan = Dependencies::create_install_plan( + paths_port_file, Util::fmap(specs, [](auto&& spec) { return spec.package_spec; }), status_db); + + action_plan = Util::fmap( + install_plan, [](InstallPlanAction& install_action) { return AnyAction(std::move(install_action)); }); } + // install plan will be empty if it is already installed - need to change this at status paragraph part + Checks::check_exit(VCPKG_LINE_INFO, !action_plan.empty(), "Install plan cannot be empty"); + + // log the plan + const std::string specs_string = Strings::join(",", action_plan, [](const AnyAction& action) { + if (auto iaction = action.install_plan.get()) + return iaction->spec.to_string(); + else if (auto raction = action.remove_plan.get()) + return "R$" + raction->spec.to_string(); + Checks::unreachable(VCPKG_LINE_INFO); + }); + + Metrics::g_metrics.lock()->track_property("installplan", specs_string); + + print_plan(action_plan, is_recursive); + if (dryRun) { Checks::exit_success(VCPKG_LINE_INFO); } - const Build::BuildPackageOptions install_plan_options = {Build::to_use_head_version(use_head_version), - Build::to_allow_downloads(!no_downloads)}; - // execute the plan - for (const InstallPlanAction& action : install_plan) + if (GlobalState::feature_packages) + { + for (const auto& action : action_plan) + { + if (auto install_action = action.install_plan.get()) + { + const BuildResult result = + perform_install_plan_action(paths, *install_action, install_plan_options, status_db); + if (result != BuildResult::SUCCEEDED) + { + System::println(Build::create_user_troubleshooting_message(install_action->spec)); + Checks::exit_fail(VCPKG_LINE_INFO); + } + } + else if (auto remove_action = action.remove_plan.get()) + { + static const std::string OPTION_PURGE = "--purge"; + static const std::string OPTION_NO_PURGE = "--no-purge"; + + const bool alsoRemoveFolderFromPackages = options.find(OPTION_NO_PURGE) == options.end(); + if (options.find(OPTION_PURGE) != options.end() && !alsoRemoveFolderFromPackages) + { + // User specified --purge and --no-purge + System::println(System::Color::error, "Error: cannot specify both --no-purge and --purge."); + System::print(example); + Checks::exit_fail(VCPKG_LINE_INFO); + } + const std::string display_name = remove_action->spec.to_string(); + switch (remove_action->plan_type) + { + case RemovePlanType::NOT_INSTALLED: + System::println(System::Color::success, "Package %s is not installed", display_name); + break; + case RemovePlanType::REMOVE: + System::println("Removing package %s... ", display_name); + Commands::Remove::remove_package(paths, remove_action->spec, &status_db); + System::println(System::Color::success, "Removing package %s... done", display_name); + break; + case RemovePlanType::UNKNOWN: + default: Checks::unreachable(VCPKG_LINE_INFO); + } + + if (alsoRemoveFolderFromPackages) + { + System::println("Purging package %s... ", display_name); + Files::Filesystem& fs = paths.get_filesystem(); + std::error_code ec; + fs.remove_all(paths.packages / remove_action->spec.dir(), ec); + System::println(System::Color::success, "Purging package %s... done", display_name); + } + } + } + } + else { - const BuildResult result = perform_install_plan_action(paths, action, install_plan_options, status_db); - if (result != BuildResult::SUCCEEDED) + for (const auto& action : action_plan) { - System::println(Build::create_user_troubleshooting_message(action.spec)); - Checks::exit_fail(VCPKG_LINE_INFO); + const auto& iaction = action.install_plan.value_or_exit(VCPKG_LINE_INFO); + const BuildResult result = perform_install_plan_action(paths, iaction, install_plan_options, status_db); + if (result != BuildResult::SUCCEEDED) + { + System::println(Build::create_user_troubleshooting_message(iaction.spec)); + Checks::exit_fail(VCPKG_LINE_INFO); + } } } diff --git a/toolsrc/src/commands_list.cpp b/toolsrc/src/commands_list.cpp index 9bc9bcc08..3cfa7e184 100644 --- a/toolsrc/src/commands_list.cpp +++ b/toolsrc/src/commands_list.cpp @@ -12,14 +12,14 @@ namespace vcpkg::Commands::List { if (FullDesc) { - System::println("%-27s %-16s %s", pgh.package.displayname(), pgh.package.version, pgh.package.description); + System::println("%-30s %-16s %s", pgh.package.displayname(), pgh.package.version, pgh.package.description); } else { - System::println("%-27s %-16s %s", - pgh.package.displayname(), - pgh.package.version, - vcpkg::shorten_description(pgh.package.description)); + System::println("%-30s %-16s %s", + vcpkg::shorten_text(pgh.package.displayname(), 30), + vcpkg::shorten_text(pgh.package.version, 16), + vcpkg::shorten_text(pgh.package.description, 71)); } } diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp index eabf2b9ae..cca541c85 100644 --- a/toolsrc/src/commands_remove.cpp +++ b/toolsrc/src/commands_remove.cpp @@ -17,13 +17,19 @@ namespace vcpkg::Commands::Remove void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db) { auto& fs = paths.get_filesystem(); - StatusParagraph& pkg = **status_db->find(spec.name(), spec.triplet()); + auto spghs = status_db->find_all(spec.name(), spec.triplet()); + auto core_pkg = **status_db->find(spec.name(), spec.triplet(), Strings::EMPTY); - pkg.want = Want::PURGE; - pkg.state = InstallState::HALF_INSTALLED; - write_update(paths, pkg); + for (auto&& spgh : spghs) + { + StatusParagraph& pkg = **spgh; + if (pkg.state != InstallState::INSTALLED) continue; + pkg.want = Want::PURGE; + pkg.state = InstallState::HALF_INSTALLED; + write_update(paths, pkg); + } - auto maybe_lines = fs.read_lines(paths.listfile_path(pkg.package)); + auto maybe_lines = fs.read_lines(paths.listfile_path(core_pkg.package)); if (auto lines = maybe_lines.get()) { @@ -80,11 +86,16 @@ namespace vcpkg::Commands::Remove } } - fs.remove(paths.listfile_path(pkg.package)); + fs.remove(paths.listfile_path(core_pkg.package)); } - pkg.state = InstallState::NOT_INSTALLED; - write_update(paths, pkg); + for (auto&& spgh : spghs) + { + StatusParagraph& pkg = **spgh; + if (pkg.state != InstallState::HALF_INSTALLED) continue; + pkg.state = InstallState::NOT_INSTALLED; + write_update(paths, pkg); + } } static void print_plan(const std::map<RemovePlanType, std::vector<const RemovePlanAction*>>& group_by_plan_type) @@ -140,7 +151,7 @@ namespace vcpkg::Commands::Remove if (specs.empty()) { - System::println(System::Color::success, "There are no oudated packages."); + System::println(System::Color::success, "There are no outdated packages."); Checks::exit_success(VCPKG_LINE_INFO); } } diff --git a/toolsrc/src/commands_search.cpp b/toolsrc/src/commands_search.cpp index fee99a5db..529d52a8b 100644 --- a/toolsrc/src/commands_search.cpp +++ b/toolsrc/src/commands_search.cpp @@ -3,6 +3,7 @@ #include "Paragraphs.h" #include "SourceParagraph.h" #include "vcpkg_Commands.h" +#include "vcpkg_GlobalState.h" #include "vcpkg_System.h" #include "vcpkglib.h" @@ -39,7 +40,7 @@ namespace vcpkg::Commands::Search s.append(Strings::format("%s;", name)); for (const Dependency& d : source_paragraph.depends) { - const std::string dependency_name = replace_dashes_with_underscore(d.name); + const std::string dependency_name = replace_dashes_with_underscore(d.name()); s.append(Strings::format("%s -> %s;", name, dependency_name)); } } @@ -57,9 +58,9 @@ namespace vcpkg::Commands::Search else { System::println("%-20s %-16s %s", - source_paragraph.name, - source_paragraph.version, - vcpkg::shorten_description(source_paragraph.description)); + vcpkg::shorten_text(source_paragraph.name, 20), + vcpkg::shorten_text(source_paragraph.version, 16), + vcpkg::shorten_text(source_paragraph.description, 81)); } } @@ -72,8 +73,8 @@ namespace vcpkg::Commands::Search else { System::println("%-37s %s", - name + "[" + feature_paragraph.name + "]", - vcpkg::shorten_description(feature_paragraph.description)); + vcpkg::shorten_text(name + "[" + feature_paragraph.name + "]", 37), + vcpkg::shorten_text(feature_paragraph.description, 81)); } } @@ -90,7 +91,7 @@ namespace vcpkg::Commands::Search if (!sources_and_errors.errors.empty()) { - if (vcpkg::g_debugging) + if (GlobalState::debugging) { print_error_message(sources_and_errors.errors); } diff --git a/toolsrc/src/commands_version.cpp b/toolsrc/src/commands_version.cpp index cd21f2561..af81cd26e 100644 --- a/toolsrc/src/commands_version.cpp +++ b/toolsrc/src/commands_version.cpp @@ -20,7 +20,7 @@ namespace vcpkg::Commands::Version #ifndef NDEBUG + std::string("-debug") #endif - + std::string(Metrics::get_compiled_metrics_enabled() ? "" : "-external"); + + std::string(Metrics::get_compiled_metrics_enabled() ? Strings::EMPTY : "-external"); return s_version; } diff --git a/toolsrc/src/metrics.cpp b/toolsrc/src/metrics.cpp index 7992f3e51..8a7d02a30 100644 --- a/toolsrc/src/metrics.cpp +++ b/toolsrc/src/metrics.cpp @@ -8,6 +8,8 @@ namespace vcpkg::Metrics { + Util::LockGuarded<Metrics> g_metrics; + static std::string get_current_date_time() { struct tm newtime; @@ -23,7 +25,7 @@ namespace vcpkg::Metrics errno_t err = gmtime_s(&newtime, &now); if (err) { - return ""; + return Strings::EMPTY; } strftime(&date[0], date.size(), "%Y-%m-%dT%H:%M:%S", &newtime); @@ -123,16 +125,16 @@ namespace vcpkg::Metrics path += L"\\kernel32.dll"; auto versz = GetFileVersionInfoSizeW(path.c_str(), nullptr); - if (versz == 0) return ""; + if (versz == 0) return Strings::EMPTY; std::vector<char> verbuf; verbuf.resize(versz); - if (!GetFileVersionInfoW(path.c_str(), 0, static_cast<DWORD>(verbuf.size()), &verbuf[0])) return ""; + if (!GetFileVersionInfoW(path.c_str(), 0, static_cast<DWORD>(verbuf.size()), &verbuf[0])) return Strings::EMPTY; void* rootblock; UINT rootblocksize; - if (!VerQueryValueW(&verbuf[0], L"\\", &rootblock, &rootblocksize)) return ""; + if (!VerQueryValueW(&verbuf[0], L"\\", &rootblock, &rootblocksize)) return Strings::EMPTY; auto rootblock_ffi = static_cast<VS_FIXEDFILEINFO*>(rootblock); @@ -223,25 +225,25 @@ namespace vcpkg::Metrics return hkcu_sqmclient.value_or(L"{}"); } - void set_user_information(const std::string& user_id, const std::string& first_use_time) + void Metrics::set_user_information(const std::string& user_id, const std::string& first_use_time) { g_metricmessage.user_id = user_id; g_metricmessage.user_timestamp = first_use_time; } - void init_user_information(std::string& user_id, std::string& first_use_time) + void Metrics::init_user_information(std::string& user_id, std::string& first_use_time) { user_id = generate_random_UUID(); first_use_time = get_current_date_time(); } - void set_send_metrics(bool should_send_metrics) { g_should_send_metrics = should_send_metrics; } + void Metrics::set_send_metrics(bool should_send_metrics) { g_should_send_metrics = should_send_metrics; } - void set_print_metrics(bool should_print_metrics) { g_should_print_metrics = should_print_metrics; } + void Metrics::set_print_metrics(bool should_print_metrics) { g_should_print_metrics = should_print_metrics; } - void track_metric(const std::string& name, double value) { g_metricmessage.TrackMetric(name, value); } + void Metrics::track_metric(const std::string& name, double value) { g_metricmessage.TrackMetric(name, value); } - void track_property(const std::string& name, const std::wstring& value) + void Metrics::track_property(const std::string& name, const std::wstring& value) { // Note: this is not valid UTF-16 -> UTF-8, it just yields a close enough approximation for our purposes. std::string converted_value; @@ -252,12 +254,12 @@ namespace vcpkg::Metrics g_metricmessage.TrackProperty(name, converted_value); } - void track_property(const std::string& name, const std::string& value) + void Metrics::track_property(const std::string& name, const std::string& value) { g_metricmessage.TrackProperty(name, value); } - void upload(const std::string& payload) + void Metrics::upload(const std::string& payload) { HINTERNET hSession = nullptr, hConnect = nullptr, hRequest = nullptr; BOOL bResults = FALSE; @@ -349,7 +351,7 @@ namespace vcpkg::Metrics return fs::path(buf, buf + bytes); } - void flush() + void Metrics::flush() { std::string payload = g_metricmessage.format_event_data_template(); if (g_should_print_metrics) std::cerr << payload << "\n"; @@ -375,7 +377,7 @@ namespace vcpkg::Metrics path = vcpkgdir / "scripts" / "vcpkgmetricsuploader.exe"; if (fs.exists(path)) return path; - return L""; + return Strings::WEMPTY; }(); std::error_code ec; diff --git a/toolsrc/src/test_install_plan.cpp b/toolsrc/src/test_install_plan.cpp index d02af5662..6c9311264 100644 --- a/toolsrc/src/test_install_plan.cpp +++ b/toolsrc/src/test_install_plan.cpp @@ -6,32 +6,62 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace vcpkg; -namespace UnitTest1 +namespace Microsoft::VisualStudio::CppUnitTestFramework { - class InstallPlanTests : public TestClass<InstallPlanTests> + template<> + inline std::wstring ToString<vcpkg::Dependencies::InstallPlanType>(const vcpkg::Dependencies::InstallPlanType& t) { - struct PackageSpecMap + switch (t) { - std::unordered_map<PackageSpec, SourceControlFile> map; - Triplet triplet; - PackageSpecMap(const Triplet& t) { triplet = t; } + case Dependencies::InstallPlanType::ALREADY_INSTALLED: return L"ALREADY_INSTALLED"; + case Dependencies::InstallPlanType::BUILD_AND_INSTALL: return L"BUILD_AND_INSTALL"; + case Dependencies::InstallPlanType::INSTALL: return L"INSTALL"; + case Dependencies::InstallPlanType::UNKNOWN: return L"UNKNOWN"; + default: return ToString((int)t); + } + } - PackageSpec get_package_spec(std::vector<std::unordered_map<std::string, std::string>>&& fields) - { - auto m_pgh = vcpkg::SourceControlFile::parse_control_file(std::move(fields)); - Assert::IsTrue(m_pgh.has_value()); - auto& scf = *m_pgh.get(); + template<> + inline std::wstring ToString<vcpkg::Dependencies::RequestType>(const vcpkg::Dependencies::RequestType& t) + { + switch (t) + { + case Dependencies::RequestType::AUTO_SELECTED: return L"AUTO_SELECTED"; + case Dependencies::RequestType::USER_REQUESTED: return L"USER_REQUESTED"; + case Dependencies::RequestType::UNKNOWN: return L"UNKNOWN"; + default: return ToString((int)t); + } + } +} - auto spec = PackageSpec::from_name_and_triplet(scf->core_paragraph->name, triplet); - Assert::IsTrue(spec.has_value()); - map.emplace(*spec.get(), std::move(*scf.get())); - return PackageSpec{*spec.get()}; - } - PackageSpec set_package_map(std::string source, std::string version, std::string build_depends) +namespace UnitTest1 +{ + class InstallPlanTests : public TestClass<InstallPlanTests> + { + static std::unique_ptr<SourceControlFile> make_control_file( + const char* name, + const char* depends, + const std::vector<std::pair<const char*, const char*>>& features = {}) + { + using Pgh = std::unordered_map<std::string, std::string>; + std::vector<Pgh> scf_pghs; + scf_pghs.push_back(Pgh{ + {"Source", name}, + {"Version", "0"}, + {"Build-Depends", depends}, + }); + for (auto&& feature : features) { - return get_package_spec({{{"Source", source}, {"Version", version}, {"Build-Depends", build_depends}}}); + scf_pghs.push_back(Pgh{ + {"Feature", feature.first}, + {"Description", "feature"}, + {"Build-Depends", feature.second}, + }); } - }; + auto m_pgh = vcpkg::SourceControlFile::parse_control_file(std::move(scf_pghs)); + Assert::IsTrue(m_pgh.has_value()); + return std::move(*m_pgh.get()); + } static void features_check(Dependencies::AnyAction* install_action, std::string pkg_name, @@ -68,16 +98,60 @@ namespace UnitTest1 Assert::AreEqual(pkg_name.c_str(), plan.spec.name().c_str()); } + static std::unique_ptr<StatusParagraph> make_status_pgh(const char* name, const char* depends = "") + { + using Pgh = std::unordered_map<std::string, std::string>; + return std::make_unique<StatusParagraph>(Pgh{{"Package", name}, + {"Version", "1"}, + {"Architecture", "x86-windows"}, + {"Multi-Arch", "same"}, + {"Depends", depends}, + {"Status", "install ok installed"}}); + } + static std::unique_ptr<StatusParagraph> make_status_feature_pgh(const char* name, + const char* feature, + const char* depends = "") + { + using Pgh = std::unordered_map<std::string, std::string>; + return std::make_unique<StatusParagraph>(Pgh{{"Package", name}, + {"Version", "1"}, + {"Feature", feature}, + {"Architecture", "x86-windows"}, + {"Multi-Arch", "same"}, + {"Depends", depends}, + {"Status", "install ok installed"}}); + } + struct PackageSpecMap + { + std::unordered_map<std::string, SourceControlFile> map; + Triplet triplet; + PackageSpecMap(const Triplet& t) { triplet = t; } + + PackageSpec emplace(const char* name, + const char* depends = "", + const std::vector<std::pair<const char*, const char*>>& features = {}) + { + return emplace(std::move(*make_control_file(name, depends, features))); + } + PackageSpec emplace(vcpkg::SourceControlFile&& scf) + { + auto spec = PackageSpec::from_name_and_triplet(scf.core_paragraph->name, triplet); + Assert::IsTrue(spec.has_value()); + map.emplace(scf.core_paragraph->name, std::move(scf)); + return PackageSpec{*spec.get()}; + } + }; + TEST_METHOD(basic_install_scheme) { std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; PackageSpecMap spec_map(Triplet::X86_WINDOWS); - auto spec_a = spec_map.set_package_map("a", "1.2.8", "b"); - auto spec_b = spec_map.set_package_map("b", "1.3", "c"); - auto spec_c = spec_map.set_package_map("c", "2.5.3", ""); + auto spec_a = spec_map.emplace("a", "b"); + auto spec_b = spec_map.emplace("b", "c"); + auto spec_c = spec_map.emplace("c"); - auto map_port = Dependencies::MapPortFile(spec_map.map); + Dependencies::MapPortFile map_port(spec_map.map); auto install_plan = Dependencies::create_install_plan(map_port, {spec_a}, StatusParagraphs(std::move(status_paragraphs))); @@ -92,16 +166,16 @@ namespace UnitTest1 std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; PackageSpecMap spec_map(Triplet::X86_WINDOWS); - auto spec_a = spec_map.set_package_map("a", "1.2.8", "d"); - auto spec_b = spec_map.set_package_map("b", "1.3", "d, e"); - auto spec_c = spec_map.set_package_map("c", "2.5.3", "e, h"); - auto spec_d = spec_map.set_package_map("d", "4.0", "f, g, h"); - auto spec_e = spec_map.set_package_map("e", "1.0", "g"); - auto spec_f = spec_map.set_package_map("f", "1.0", ""); - auto spec_g = spec_map.set_package_map("g", "1.0", ""); - auto spec_h = spec_map.set_package_map("h", "1.0", ""); - - auto map_port = Dependencies::MapPortFile(spec_map.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"); + auto spec_d = spec_map.emplace("d", "f, g, h"); + auto spec_e = spec_map.emplace("e", "g"); + auto spec_f = spec_map.emplace("f"); + auto spec_g = spec_map.emplace("g"); + auto spec_h = spec_map.emplace("h"); + + Dependencies::MapPortFile map_port(spec_map.map); auto install_plan = Dependencies::create_install_plan( map_port, {spec_a, spec_b, spec_c}, StatusParagraphs(std::move(status_paragraphs))); @@ -127,37 +201,74 @@ namespace UnitTest1 Assert::IsTrue(e_pos > g_pos); } + TEST_METHOD(existing_package_scheme) + { + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + status_paragraphs.push_back(make_status_pgh("a")); + + PackageSpecMap spec_map(Triplet::X86_WINDOWS); + auto spec_a = FullPackageSpec{spec_map.emplace("a")}; + + auto install_plan = + Dependencies::create_feature_install_plan(spec_map.map, + FullPackageSpec::to_feature_specs({spec_a}), + StatusParagraphs(std::move(status_paragraphs))); + + Assert::AreEqual(size_t(1), install_plan.size()); + auto p = install_plan[0].install_plan.get(); + Assert::IsNotNull(p); + Assert::AreEqual("a", p->spec.name().c_str()); + Assert::AreEqual(Dependencies::InstallPlanType::ALREADY_INSTALLED, p->plan_type); + Assert::AreEqual(Dependencies::RequestType::USER_REQUESTED, p->request_type); + } + + TEST_METHOD(user_requested_package_scheme) + { + std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; + + PackageSpecMap spec_map(Triplet::X86_WINDOWS); + auto spec_a = FullPackageSpec{spec_map.emplace("a", "b")}; + auto spec_b = FullPackageSpec{spec_map.emplace("b")}; + + auto install_plan = + Dependencies::create_feature_install_plan(spec_map.map, + FullPackageSpec::to_feature_specs({spec_a}), + StatusParagraphs(std::move(status_paragraphs))); + + Assert::AreEqual(size_t(2), install_plan.size()); + auto p = install_plan[0].install_plan.get(); + Assert::IsNotNull(p); + Assert::AreEqual("b", p->spec.name().c_str()); + Assert::AreEqual(Dependencies::InstallPlanType::BUILD_AND_INSTALL, p->plan_type); + Assert::AreEqual(Dependencies::RequestType::AUTO_SELECTED, p->request_type); + + auto p2 = install_plan[1].install_plan.get(); + Assert::IsNotNull(p2); + Assert::AreEqual("a", p2->spec.name().c_str()); + Assert::AreEqual(Dependencies::InstallPlanType::BUILD_AND_INSTALL, p2->plan_type); + Assert::AreEqual(Dependencies::RequestType::USER_REQUESTED, p2->request_type); + } + TEST_METHOD(long_install_scheme) { - using Pgh = std::unordered_map<std::string, std::string>; std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "j"}, - {"Version", "1.2.8"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", "k"}, - {"Status", "install ok installed"}})); - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "k"}, - {"Version", "1.2.8"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", ""}, - {"Status", "install ok installed"}})); + status_paragraphs.push_back(make_status_pgh("j", "k")); + status_paragraphs.push_back(make_status_pgh("k")); PackageSpecMap spec_map(Triplet::X86_WINDOWS); - auto spec_a = spec_map.set_package_map("a", "1.2.8", "b, c, d, e, f, g, h, j, k"); - auto spec_b = spec_map.set_package_map("b", "1.2.8", "c, d, e, f, g, h, j, k"); - auto spec_c = spec_map.set_package_map("c", "1.2.8", "d, e, f, g, h, j, k"); - auto spec_d = spec_map.set_package_map("d", "1.2.8", "e, f, g, h, j, k"); - auto spec_e = spec_map.set_package_map("e", "1.2.8", "f, g, h, j, k"); - auto spec_f = spec_map.set_package_map("f", "1.2.8", "g, h, j, k"); - auto spec_g = spec_map.set_package_map("g", "1.2.8", "h, j, k"); - auto spec_h = spec_map.set_package_map("h", "1.2.8", "j, k"); - auto spec_j = spec_map.set_package_map("j", "1.2.8", "k"); - auto spec_k = spec_map.set_package_map("k", "1.2.8", ""); - - auto map_port = Dependencies::MapPortFile(spec_map.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"); + auto spec_c = spec_map.emplace("c", "d, e, f, g, h, j, k"); + auto spec_d = spec_map.emplace("d", "e, f, g, h, j, k"); + auto spec_e = spec_map.emplace("e", "f, g, h, j, k"); + auto spec_f = spec_map.emplace("f", "g, h, j, k"); + auto spec_g = spec_map.emplace("g", "h, j, k"); + auto spec_h = spec_map.emplace("h", "j, k"); + auto spec_j = spec_map.emplace("j", "k"); + auto spec_k = spec_map.emplace("k"); + + Dependencies::MapPortFile map_port(spec_map.map); auto install_plan = Dependencies::create_install_plan(map_port, {spec_a}, StatusParagraphs(std::move(status_paragraphs))); @@ -174,162 +285,85 @@ namespace UnitTest1 TEST_METHOD(basic_feature_test_1) { - using Pgh = std::unordered_map<std::string, std::string>; - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "a"}, - {"Default-Features", ""}, - {"Version", "1.3.8"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", "b, b[beefeatureone]"}, - {"Status", "install ok installed"}})); - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "b"}, - {"Feature", "beefeatureone"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", ""}, - {"Status", "install ok installed"}})); - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "b"}, - {"Default-Features", "beefeatureone"}, - {"Version", "1.3"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", ""}, - {"Status", "install ok installed"}})); + status_paragraphs.push_back(make_status_pgh("a", "b, b[b1]")); + status_paragraphs.push_back(make_status_pgh("b")); + status_paragraphs.push_back(make_status_feature_pgh("b", "b1")); PackageSpecMap spec_map(Triplet::X86_WINDOWS); - auto spec_a = - FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "a"}, {"Version", "1.3.8"}, {"Build-Depends", "b, b[beefeatureone]"}}, - {{"Feature", "featureone"}, - {"Description", "the first feature for a"}, - {"Build-Depends", "b[beefeaturetwo]"}}, - }), - {"featureone"}}; - auto spec_b = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "b"}, {"Version", "1.3"}, {"Build-Depends", ""}}, - {{"Feature", "beefeatureone"}, {"Description", "the first feature for b"}, {"Build-Depends", ""}}, - {{"Feature", "beefeaturetwo"}, {"Description", "the second feature for b"}, {"Build-Depends", ""}}, - {{"Feature", "beefeaturethree"}, {"Description", "the third feature for b"}, {"Build-Depends", ""}}, - })}; + 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", ""}})}; - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, {spec_a}, StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = + Dependencies::create_feature_install_plan(spec_map.map, + FullPackageSpec::to_feature_specs({spec_a}), + StatusParagraphs(std::move(status_paragraphs))); Assert::AreEqual(size_t(4), install_plan.size()); remove_plan_check(&install_plan[0], "a"); remove_plan_check(&install_plan[1], "b"); - features_check(&install_plan[2], "b", {"beefeatureone", "core", "beefeatureone"}); - features_check(&install_plan[3], "a", {"featureone", "core"}); + features_check(&install_plan[2], "b", {"b1", "core", "b1"}); + features_check(&install_plan[3], "a", {"a1", "core"}); } TEST_METHOD(basic_feature_test_2) { - using Pgh = std::unordered_map<std::string, std::string>; - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; PackageSpecMap spec_map(Triplet::X86_WINDOWS); - auto spec_a = - FullPackageSpec{spec_map.get_package_spec( - {{{"Source", "a"}, {"Version", "1.3.8"}, {"Build-Depends", "b[beefeatureone]"}}, - {{"Feature", "featureone"}, - {"Description", "the first feature for a"}, - {"Build-Depends", "b[beefeaturetwo]"}} - - }), - {"featureone"}}; - auto spec_b = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "b"}, {"Version", "1.3"}, {"Build-Depends", ""}}, - {{"Feature", "beefeatureone"}, {"Description", "the first feature for b"}, {"Build-Depends", ""}}, - {{"Feature", "beefeaturetwo"}, {"Description", "the second feature for b"}, {"Build-Depends", ""}}, - {{"Feature", "beefeaturethree"}, {"Description", "the third feature for b"}, {"Build-Depends", ""}}, - })}; + 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", ""}})}; - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, {spec_a}, StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = + Dependencies::create_feature_install_plan(spec_map.map, + FullPackageSpec::to_feature_specs({spec_a}), + StatusParagraphs(std::move(status_paragraphs))); Assert::AreEqual(size_t(2), install_plan.size()); - features_check(&install_plan[0], "b", {"beefeatureone", "beefeaturetwo", "core"}); - features_check(&install_plan[1], "a", {"featureone", "core"}); + features_check(&install_plan[0], "b", {"b1", "b2", "core"}); + features_check(&install_plan[1], "a", {"a1", "core"}); } TEST_METHOD(basic_feature_test_3) { - using Pgh = std::unordered_map<std::string, std::string>; - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "a"}, - {"Default-Features", ""}, - {"Version", "1.3"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", ""}, - {"Status", "install ok installed"}})); + status_paragraphs.push_back(make_status_pgh("a")); PackageSpecMap spec_map(Triplet::X86_WINDOWS); - auto spec_a = FullPackageSpec{ - spec_map.get_package_spec( - {{{"Source", "a"}, {"Version", "1.3"}, {"Build-Depends", "b"}}, - {{"Feature", "one"}, {"Description", "the first feature for a"}, {"Build-Depends", ""}}}), - {"core"}}; - auto spec_b = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "b"}, {"Version", "1.3"}, {"Build-Depends", ""}}, - })}; - auto spec_c = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "c"}, {"Version", "1.3"}, {"Build-Depends", "a[one]"}}, - }), - {"core"}}; + auto spec_a = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}}), {"core"}}; + auto spec_b = FullPackageSpec{spec_map.emplace("b")}; + auto spec_c = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, {spec_c, spec_a}, StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = + Dependencies::create_feature_install_plan(spec_map.map, + FullPackageSpec::to_feature_specs({spec_c, spec_a}), + StatusParagraphs(std::move(status_paragraphs))); Assert::AreEqual(size_t(4), install_plan.size()); remove_plan_check(&install_plan[0], "a"); features_check(&install_plan[1], "b", {"core"}); - features_check(&install_plan[2], "a", {"one", "core"}); + features_check(&install_plan[2], "a", {"a1", "core"}); features_check(&install_plan[3], "c", {"core"}); } TEST_METHOD(basic_feature_test_4) { - using Pgh = std::unordered_map<std::string, std::string>; - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "a"}, - {"Default-Features", ""}, - {"Version", "1.3"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", ""}, - {"Status", "install ok installed"}})); - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "a"}, - {"Feature", "one"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", ""}, - {"Status", "install ok installed"}})); + status_paragraphs.push_back(make_status_pgh("a")); + status_paragraphs.push_back(make_status_feature_pgh("a", "a1", "")); PackageSpecMap spec_map(Triplet::X86_WINDOWS); - auto spec_a = FullPackageSpec{ - spec_map.get_package_spec( - {{{"Source", "a"}, {"Version", "1.3"}, {"Build-Depends", "b"}}, - {{"Feature", "one"}, {"Description", "the first feature for a"}, {"Build-Depends", ""}}}), - }; - auto spec_b = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "b"}, {"Version", "1.3"}, {"Build-Depends", ""}}, - })}; - auto spec_c = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "c"}, {"Version", "1.3"}, {"Build-Depends", "a[one]"}}, - }), - {"core"}}; + auto spec_a = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}})}; + auto spec_b = FullPackageSpec{spec_map.emplace("b")}; + auto spec_c = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, {spec_c}, StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = + Dependencies::create_feature_install_plan(spec_map.map, + FullPackageSpec::to_feature_specs({spec_c}), + StatusParagraphs(std::move(status_paragraphs))); Assert::AreEqual(size_t(1), install_plan.size()); features_check(&install_plan[0], "c", {"core"}); @@ -337,168 +371,93 @@ namespace UnitTest1 TEST_METHOD(basic_feature_test_5) { - using Pgh = std::unordered_map<std::string, std::string>; - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; PackageSpecMap spec_map(Triplet::X86_WINDOWS); - auto spec_a = FullPackageSpec{ - spec_map.get_package_spec( - {{{"Source", "a"}, {"Version", "1.3"}, {"Build-Depends", ""}}, - {{"Feature", "1"}, {"Description", "the first feature for a"}, {"Build-Depends", "b[1]"}}, - {{"Feature", "2"}, {"Description", "the first feature for a"}, {"Build-Depends", "b[2]"}}, - {{"Feature", "3"}, {"Description", "the first feature for a"}, {"Build-Depends", "a[2]"}}}), - {"3"}}; - auto spec_b = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "b"}, {"Version", "1.3"}, {"Build-Depends", ""}}, - {{"Feature", "1"}, {"Description", "the first feature for a"}, {"Build-Depends", ""}}, - {{"Feature", "2"}, {"Description", "the first feature for a"}, {"Build-Depends", ""}}, - })}; + auto spec_a = + FullPackageSpec{spec_map.emplace("a", "", {{"a1", "b[b1]"}, {"a2", "b[b2]"}, {"a3", "a[a2]"}}), {"a3"}}; + auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}, {"b2", ""}})}; - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, {spec_a}, StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = + Dependencies::create_feature_install_plan(spec_map.map, + FullPackageSpec::to_feature_specs({spec_a}), + StatusParagraphs(std::move(status_paragraphs))); Assert::AreEqual(size_t(2), install_plan.size()); - features_check(&install_plan[0], "b", {"core", "2"}); - features_check(&install_plan[1], "a", {"core", "3", "2"}); + features_check(&install_plan[0], "b", {"core", "b2"}); + features_check(&install_plan[1], "a", {"core", "a3", "a2"}); } TEST_METHOD(basic_feature_test_6) { - using Pgh = std::unordered_map<std::string, std::string>; - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "b"}, - {"Default-Features", ""}, - {"Version", "1.3"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", ""}, - {"Status", "install ok installed"}})); - PackageSpecMap spec_map(Triplet::X86_WINDOWS); + status_paragraphs.push_back(make_status_pgh("b")); - auto spec_a = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "a"}, {"Version", "1.3"}, {"Build-Depends", "b[core]"}}, - }), - {"core"}}; - auto spec_b = FullPackageSpec{ - spec_map.get_package_spec({ - {{"Source", "b"}, {"Version", "1.3"}, {"Build-Depends", ""}}, - {{"Feature", "1"}, {"Description", "the first feature for a"}, {"Build-Depends", ""}}, - }), - {"1"}}; + PackageSpecMap spec_map(Triplet::X86_WINDOWS); + auto spec_a = FullPackageSpec{spec_map.emplace("a", "b[core]"), {"core"}}; + auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}}), {"b1"}}; - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, {spec_a, spec_b}, StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = + Dependencies::create_feature_install_plan(spec_map.map, + FullPackageSpec::to_feature_specs({spec_a, spec_b}), + StatusParagraphs(std::move(status_paragraphs))); Assert::AreEqual(size_t(3), install_plan.size()); remove_plan_check(&install_plan[0], "b"); - features_check(&install_plan[1], "b", {"core", "1"}); + features_check(&install_plan[1], "b", {"core", "b1"}); features_check(&install_plan[2], "a", {"core"}); } TEST_METHOD(basic_feature_test_7) { - using Pgh = std::unordered_map<std::string, std::string>; - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "x"}, - {"Default-Features", ""}, - {"Version", "1.3"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", "b"}, - {"Status", "install ok installed"}})); - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "b"}, - {"Default-Features", ""}, - {"Version", "1.3"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", ""}, - {"Status", "install ok installed"}})); + status_paragraphs.push_back(make_status_pgh("x", "b")); + status_paragraphs.push_back(make_status_pgh("b")); + PackageSpecMap spec_map(Triplet::X86_WINDOWS); - auto spec_a = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "a"}, {"Version", "1.3"}, {"Build-Depends", ""}}, - })}; - auto spec_x = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "x"}, {"Version", "1.3"}, {"Build-Depends", "a"}}, - }), - {"core"}}; - auto spec_b = FullPackageSpec{ - spec_map.get_package_spec({ - {{"Source", "b"}, {"Version", "1.3"}, {"Build-Depends", ""}, {"Default-Features", ""}}, - {{"Feature", "1"}, {"Description", "the first feature for a"}, {"Build-Depends", ""}}, - }), - {"1"}}; + auto spec_a = FullPackageSpec{spec_map.emplace("a")}; + auto spec_x = FullPackageSpec{spec_map.emplace("x", "a"), {"core"}}; + auto spec_b = FullPackageSpec{spec_map.emplace("b", "", {{"b1", ""}}), {"b1"}}; - auto install_plan = Dependencies::create_feature_install_plan( - spec_map.map, {spec_b, spec_x}, StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = + Dependencies::create_feature_install_plan(spec_map.map, + FullPackageSpec::to_feature_specs({spec_b}), + StatusParagraphs(std::move(status_paragraphs))); Assert::AreEqual(size_t(5), install_plan.size()); remove_plan_check(&install_plan[0], "x"); remove_plan_check(&install_plan[1], "b"); // TODO: order here may change but A < X, and B anywhere - features_check(&install_plan[2], "a", {"core"}); - features_check(&install_plan[3], "x", {"core"}); - features_check(&install_plan[4], "b", {"core", "1"}); + features_check(&install_plan[2], "b", {"core", "b1"}); + features_check(&install_plan[3], "a", {"core"}); + features_check(&install_plan[4], "x", {"core"}); } TEST_METHOD(basic_feature_test_8) { - using Pgh = std::unordered_map<std::string, std::string>; - std::vector<std::unique_ptr<StatusParagraph>> status_paragraphs; - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "a"}, - {"Default-Features", ""}, - {"Version", "1.3"}, - {"Architecture", "x64-windows"}, - {"Multi-Arch", "same"}, - {"Depends", ""}, - {"Status", "install ok installed"}})); - status_paragraphs.push_back(std::make_unique<StatusParagraph>(Pgh{{"Package", "a"}, - {"Default-Features", ""}, - {"Version", "1.3"}, - {"Architecture", "x86-windows"}, - {"Multi-Arch", "same"}, - {"Depends", ""}, - {"Status", "install ok installed"}})); + status_paragraphs.push_back(make_status_pgh("a")); + status_paragraphs.push_back(make_status_pgh("a")); + status_paragraphs.back()->package.spec = + PackageSpec::from_name_and_triplet("a", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); PackageSpecMap spec_map(Triplet::X64_WINDOWS); - - auto spec_a_64 = FullPackageSpec{ - spec_map.get_package_spec( - {{{"Source", "a"}, {"Version", "1.3"}, {"Build-Depends", "b"}}, - {{"Feature", "one"}, {"Description", "the first feature for a"}, {"Build-Depends", ""}}}), - {"core"}}; - auto spec_b_64 = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "b"}, {"Version", "1.3"}, {"Build-Depends", ""}}, - })}; - auto spec_c_64 = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "c"}, {"Version", "1.3"}, {"Build-Depends", "a[one]"}}, - }), - {"core"}}; + auto spec_a_64 = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}}), {"core"}}; + auto spec_b_64 = FullPackageSpec{spec_map.emplace("b")}; + auto spec_c_64 = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; spec_map.triplet = Triplet::X86_WINDOWS; - auto spec_a_86 = FullPackageSpec{ - spec_map.get_package_spec( - {{{"Source", "a"}, {"Version", "1.3"}, {"Build-Depends", "b"}}, - {{"Feature", "one"}, {"Description", "the first feature for a"}, {"Build-Depends", ""}}}), - {"core"}}; - auto spec_b_86 = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "b"}, {"Version", "1.3"}, {"Build-Depends", ""}}, - })}; - auto spec_c_86 = FullPackageSpec{spec_map.get_package_spec({ - {{"Source", "c"}, {"Version", "1.3"}, {"Build-Depends", "a[one]"}}, - }), - {"core"}}; + auto spec_a_86 = FullPackageSpec{spec_map.emplace("a", "b", {{"a1", ""}}), {"core"}}; + auto spec_b_86 = FullPackageSpec{spec_map.emplace("b")}; + auto spec_c_86 = FullPackageSpec{spec_map.emplace("c", "a[a1]"), {"core"}}; - auto install_plan = - Dependencies::create_feature_install_plan(spec_map.map, - {spec_c_64, spec_a_86, spec_a_64, spec_c_86}, - StatusParagraphs(std::move(status_paragraphs))); + auto install_plan = Dependencies::create_feature_install_plan( + spec_map.map, + FullPackageSpec::to_feature_specs({spec_c_64, spec_a_86, spec_a_64, spec_c_86}), + StatusParagraphs(std::move(status_paragraphs))); /*Assert::AreEqual(size_t(8), install_plan.size()); auto iterator_pos = [&](const PackageSpec& spec, size_t start) -> int { @@ -517,10 +476,10 @@ namespace UnitTest1 remove_plan_check(&install_plan[0], "a", Triplet::X64_WINDOWS); remove_plan_check(&install_plan[1], "a"); features_check(&install_plan[2], "b", {"core"}, Triplet::X64_WINDOWS); - features_check(&install_plan[3], "a", {"one", "core"}, Triplet::X64_WINDOWS); + features_check(&install_plan[3], "a", {"a1", "core"}, Triplet::X64_WINDOWS); features_check(&install_plan[4], "c", {"core"}, Triplet::X64_WINDOWS); features_check(&install_plan[5], "b", {"core"}); - features_check(&install_plan[6], "a", {"one", "core"}); + features_check(&install_plan[6], "a", {"a1", "core"}); features_check(&install_plan[7], "c", {"core"}); } }; diff --git a/toolsrc/src/tests_dependencies.cpp b/toolsrc/src/tests_dependencies.cpp index 995d46873..6a6981d73 100644 --- a/toolsrc/src/tests_dependencies.cpp +++ b/toolsrc/src/tests_dependencies.cpp @@ -8,6 +8,7 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace vcpkg; +using Parse::parse_comma_list; namespace UnitTest1 { @@ -15,15 +16,15 @@ namespace UnitTest1 { TEST_METHOD(parse_depends_one) { - auto v = expand_qualified_dependencies(parse_comma_list("libA [windows]")); + auto v = expand_qualified_dependencies(parse_comma_list("libA (windows)")); Assert::AreEqual(size_t(1), v.size()); - Assert::AreEqual("libA", v[0].name.c_str()); + Assert::AreEqual("libA", v[0].depend.name.c_str()); Assert::AreEqual("windows", v[0].qualifier.c_str()); } TEST_METHOD(filter_depends) { - auto deps = expand_qualified_dependencies(parse_comma_list("libA [windows], libB, libC [uwp]")); + auto deps = expand_qualified_dependencies(parse_comma_list("libA (windows), libB, libC (uwp)")); auto v = filter_dependencies(deps, Triplet::X64_WINDOWS); Assert::AreEqual(size_t(2), v.size()); Assert::AreEqual("libA", v[0].c_str()); @@ -41,7 +42,15 @@ namespace UnitTest1 TEST_METHOD(parse_supports_all) { auto v = Supports::parse({ - "x64", "x86", "arm", "windows", "uwp", "v140", "v141", "crt-static", "crt-dynamic", + "x64", + "x86", + "arm", + "windows", + "uwp", + "v140", + "v141", + "crt-static", + "crt-dynamic", }); Assert::AreNotEqual(uintptr_t(0), uintptr_t(v.get())); @@ -74,7 +83,9 @@ namespace UnitTest1 TEST_METHOD(parse_supports_some) { auto v = Supports::parse({ - "x64", "x86", "windows", + "x64", + "x86", + "windows", }); Assert::AreNotEqual(uintptr_t(0), uintptr_t(v.get())); diff --git a/toolsrc/src/tests_package_spec.cpp b/toolsrc/src/tests_package_spec.cpp new file mode 100644 index 000000000..fa201b372 --- /dev/null +++ b/toolsrc/src/tests_package_spec.cpp @@ -0,0 +1,119 @@ +#include "BinaryParagraph.h" +#include "CppUnitTest.h" +#include "Paragraphs.h" +#include "vcpkg_Strings.h" + +#pragma comment(lib, "version") +#pragma comment(lib, "winhttp") + +using namespace Microsoft::VisualStudio::CppUnitTestFramework; + +namespace Microsoft::VisualStudio::CppUnitTestFramework +{ + template<> + inline std::wstring ToString<vcpkg::PackageSpecParseResult>(const vcpkg::PackageSpecParseResult& t) + { + return ToString(static_cast<uint32_t>(t)); + } + + template<> + inline std::wstring ToString<vcpkg::PackageSpec>(const vcpkg::PackageSpec& t) + { + return ToString(t.to_string()); + } +} + +namespace Strings = vcpkg::Strings; + +namespace UnitTest1 +{ + using namespace vcpkg; + + class SpecifierConversion : public TestClass<SpecifierConversion> + { + TEST_METHOD(full_package_spec_to_feature_specs) + { + auto a_spec = PackageSpec::from_name_and_triplet("a", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); + auto b_spec = PackageSpec::from_name_and_triplet("b", Triplet::X64_WINDOWS).value_or_exit(VCPKG_LINE_INFO); + + auto fspecs = FullPackageSpec::to_feature_specs({{a_spec, {"0", "1"}}, {b_spec, {"2", "3"}}}); + + Assert::AreEqual(size_t(6), fspecs.size()); + + std::array<const char*, 6> features = {"", "0", "1", "", "2", "3"}; + std::array<PackageSpec*, 6> specs = {&a_spec, &a_spec, &a_spec, &b_spec, &b_spec, &b_spec}; + + for (int i = 0; i < features.size(); ++i) + { + Assert::AreEqual(features[i], fspecs[i].feature().c_str()); + Assert::AreEqual(*specs[i], fspecs[i].spec()); + } + } + }; + + class SpecifierParsing : public TestClass<SpecifierParsing> + { + TEST_METHOD(parsed_specifier_from_string) + { + auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib"); + Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, maybe_spec.error()); + auto spec = maybe_spec.get(); + Assert::AreEqual("zlib", spec->name.c_str()); + Assert::AreEqual(size_t(0), spec->features.size()); + Assert::AreEqual("", spec->triplet.c_str()); + } + + TEST_METHOD(parsed_specifier_from_string_with_triplet) + { + auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib:x64-uwp"); + Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, maybe_spec.error()); + auto spec = maybe_spec.get(); + Assert::AreEqual("zlib", spec->name.c_str()); + Assert::AreEqual("x64-uwp", spec->triplet.c_str()); + } + + TEST_METHOD(parsed_specifier_from_string_with_colons) + { + auto ec = vcpkg::ParsedSpecifier::from_string("zlib:x86-uwp:").error(); + Assert::AreEqual(vcpkg::PackageSpecParseResult::TOO_MANY_COLONS, ec); + } + + TEST_METHOD(parsed_specifier_from_string_with_feature) + { + auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib[feature]:x64-uwp"); + Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, maybe_spec.error()); + auto spec = maybe_spec.get(); + Assert::AreEqual("zlib", spec->name.c_str()); + Assert::IsTrue(spec->features.size() == 1); + Assert::AreEqual("feature", spec->features.front().c_str()); + Assert::AreEqual("x64-uwp", spec->triplet.c_str()); + } + + TEST_METHOD(parsed_specifier_from_string_with_many_features) + { + auto maybe_spec = vcpkg::ParsedSpecifier::from_string("zlib[0, 1,2]"); + Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, maybe_spec.error()); + auto spec = maybe_spec.get(); + Assert::AreEqual("zlib", spec->name.c_str()); + Assert::IsTrue(spec->features.size() == 3); + Assert::AreEqual("0", spec->features[0].c_str()); + Assert::AreEqual("1", spec->features[1].c_str()); + Assert::AreEqual("2", spec->features[2].c_str()); + Assert::AreEqual("", spec->triplet.c_str()); + } + + TEST_METHOD(utf8_to_utf16) + { + auto str = vcpkg::Strings::to_utf16("abc"); + Assert::AreEqual(L"abc", str.c_str()); + } + + TEST_METHOD(utf8_to_utf16_with_whitespace) + { + auto str = vcpkg::Strings::to_utf16("abc -x86-windows"); + Assert::AreEqual(L"abc -x86-windows", str.c_str()); + } + }; + + TEST_CLASS(Metrics){}; +} diff --git a/toolsrc/src/tests_paragraph.cpp b/toolsrc/src/tests_paragraph.cpp index dd9a40160..47a07e12d 100644 --- a/toolsrc/src/tests_paragraph.cpp +++ b/toolsrc/src/tests_paragraph.cpp @@ -27,7 +27,8 @@ namespace UnitTest1 { auto m_pgh = vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, {"Version", "1.2.8"}, + {"Source", "zlib"}, + {"Version", "1.2.8"}, }}); Assert::IsTrue(m_pgh.has_value()); @@ -59,7 +60,7 @@ namespace UnitTest1 Assert::AreEqual("m", pgh->core_paragraph->maintainer.c_str()); Assert::AreEqual("d", pgh->core_paragraph->description.c_str()); Assert::AreEqual(size_t(1), pgh->core_paragraph->depends.size()); - Assert::AreEqual("bd", pgh->core_paragraph->depends[0].name.c_str()); + Assert::AreEqual("bd", pgh->core_paragraph->depends[0].name().c_str()); Assert::AreEqual(size_t(1), pgh->core_paragraph->supports.size()); Assert::AreEqual("x64", pgh->core_paragraph->supports[0].c_str()); } @@ -68,36 +69,42 @@ namespace UnitTest1 { auto m_pgh = vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, {"Version", "1.2.8"}, {"Build-Depends", "z, openssl"}, + {"Source", "zlib"}, + {"Version", "1.2.8"}, + {"Build-Depends", "z, openssl"}, }}); Assert::IsTrue(m_pgh.has_value()); auto& pgh = *m_pgh.get(); Assert::AreEqual(size_t(2), pgh->core_paragraph->depends.size()); - Assert::AreEqual("z", pgh->core_paragraph->depends[0].name.c_str()); - Assert::AreEqual("openssl", pgh->core_paragraph->depends[1].name.c_str()); + Assert::AreEqual("z", pgh->core_paragraph->depends[0].name().c_str()); + Assert::AreEqual("openssl", pgh->core_paragraph->depends[1].name().c_str()); } TEST_METHOD(SourceParagraph_Three_Depends) { auto m_pgh = vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, {"Version", "1.2.8"}, {"Build-Depends", "z, openssl, xyz"}, + {"Source", "zlib"}, + {"Version", "1.2.8"}, + {"Build-Depends", "z, openssl, xyz"}, }}); Assert::IsTrue(m_pgh.has_value()); auto& pgh = *m_pgh.get(); Assert::AreEqual(size_t(3), pgh->core_paragraph->depends.size()); - Assert::AreEqual("z", pgh->core_paragraph->depends[0].name.c_str()); - Assert::AreEqual("openssl", pgh->core_paragraph->depends[1].name.c_str()); - Assert::AreEqual("xyz", pgh->core_paragraph->depends[2].name.c_str()); + Assert::AreEqual("z", pgh->core_paragraph->depends[0].name().c_str()); + Assert::AreEqual("openssl", pgh->core_paragraph->depends[1].name().c_str()); + Assert::AreEqual("xyz", pgh->core_paragraph->depends[2].name().c_str()); } TEST_METHOD(SourceParagraph_Three_Supports) { auto m_pgh = vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, {"Version", "1.2.8"}, {"Supports", "x64, windows, uwp"}, + {"Source", "zlib"}, + {"Version", "1.2.8"}, + {"Supports", "x64, windows, uwp"}, }}); Assert::IsTrue(m_pgh.has_value()); auto& pgh = *m_pgh.get(); @@ -112,7 +119,9 @@ namespace UnitTest1 { auto m_pgh = vcpkg::SourceControlFile::parse_control_file(std::vector<std::unordered_map<std::string, std::string>>{{ - {"Source", "zlib"}, {"Version", "1.2.8"}, {"Build-Depends", "libA [windows], libB [uwp]"}, + {"Source", "zlib"}, + {"Version", "1.2.8"}, + {"Build-Depends", "libA (windows), libB (uwp)"}, }}); Assert::IsTrue(m_pgh.has_value()); auto& pgh = *m_pgh.get(); @@ -122,16 +131,19 @@ namespace UnitTest1 Assert::AreEqual("", pgh->core_paragraph->maintainer.c_str()); Assert::AreEqual("", pgh->core_paragraph->description.c_str()); Assert::AreEqual(size_t(2), pgh->core_paragraph->depends.size()); - Assert::AreEqual("libA", pgh->core_paragraph->depends[0].name.c_str()); + Assert::AreEqual("libA", pgh->core_paragraph->depends[0].name().c_str()); Assert::AreEqual("windows", pgh->core_paragraph->depends[0].qualifier.c_str()); - Assert::AreEqual("libB", pgh->core_paragraph->depends[1].name.c_str()); + Assert::AreEqual("libB", pgh->core_paragraph->depends[1].name().c_str()); Assert::AreEqual("uwp", pgh->core_paragraph->depends[1].qualifier.c_str()); } TEST_METHOD(BinaryParagraph_Construct_Minimum) { vcpkg::BinaryParagraph pgh({ - {"Package", "zlib"}, {"Version", "1.2.8"}, {"Architecture", "x86-windows"}, {"Multi-Arch", "same"}, + {"Package", "zlib"}, + {"Version", "1.2.8"}, + {"Architecture", "x86-windows"}, + {"Multi-Arch", "same"}, }); Assert::AreEqual("zlib", pgh.spec.name().c_str()); @@ -320,7 +332,10 @@ namespace UnitTest1 TEST_METHOD(BinaryParagraph_serialize_min) { vcpkg::BinaryParagraph pgh({ - {"Package", "zlib"}, {"Version", "1.2.8"}, {"Architecture", "x86-windows"}, {"Multi-Arch", "same"}, + {"Package", "zlib"}, + {"Version", "1.2.8"}, + {"Architecture", "x86-windows"}, + {"Multi-Arch", "same"}, }); std::string ss = Strings::serialize(pgh); auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss).value_or_exit(VCPKG_LINE_INFO); @@ -369,45 +384,5 @@ namespace UnitTest1 Assert::AreEqual(size_t(1), pghs.size()); Assert::AreEqual("a, b, c", pghs[0]["Depends"].c_str()); } - - TEST_METHOD(package_spec_parse) - { - vcpkg::ExpectedT<vcpkg::FullPackageSpec, vcpkg::PackageSpecParseResult> spec = - vcpkg::FullPackageSpec::from_string("zlib", vcpkg::Triplet::X86_WINDOWS); - Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, spec.error()); - Assert::AreEqual("zlib", spec.get()->package_spec.name().c_str()); - Assert::AreEqual(vcpkg::Triplet::X86_WINDOWS.canonical_name(), - spec.get()->package_spec.triplet().canonical_name()); - } - - TEST_METHOD(package_spec_parse_with_arch) - { - vcpkg::ExpectedT<vcpkg::FullPackageSpec, vcpkg::PackageSpecParseResult> spec = - vcpkg::FullPackageSpec::from_string("zlib:x64-uwp", vcpkg::Triplet::X86_WINDOWS); - Assert::AreEqual(vcpkg::PackageSpecParseResult::SUCCESS, spec.error()); - Assert::AreEqual("zlib", spec.get()->package_spec.name().c_str()); - Assert::AreEqual(vcpkg::Triplet::X64_UWP.canonical_name(), - spec.get()->package_spec.triplet().canonical_name()); - } - - TEST_METHOD(package_spec_parse_with_multiple_colon) - { - auto ec = vcpkg::FullPackageSpec::from_string("zlib:x86-uwp:", vcpkg::Triplet::X86_WINDOWS).error(); - Assert::AreEqual(vcpkg::PackageSpecParseResult::TOO_MANY_COLONS, ec); - } - - TEST_METHOD(utf8_to_utf16) - { - auto str = vcpkg::Strings::to_utf16("abc"); - Assert::AreEqual(L"abc", str.c_str()); - } - - TEST_METHOD(utf8_to_utf16_with_whitespace) - { - auto str = vcpkg::Strings::to_utf16("abc -x86-windows"); - Assert::AreEqual(L"abc -x86-windows", str.c_str()); - } }; - - TEST_CLASS(Metrics){}; } diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 738b7b284..781f03585 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -6,6 +6,7 @@ #include "vcpkg_Chrono.h" #include "vcpkg_Commands.h" #include "vcpkg_Files.h" +#include "vcpkg_GlobalState.h" #include "vcpkg_Input.h" #include "vcpkg_Strings.h" #include "vcpkg_System.h" @@ -26,14 +27,14 @@ void invalid_command(const std::string& cmd) static void inner(const VcpkgCmdArguments& args) { - Metrics::track_property("command", args.command); + Metrics::g_metrics.lock()->track_property("command", args.command); if (args.command.empty()) { Commands::Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } - if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_c())) + if (const auto command_function = Commands::find(args.command, Commands::get_available_commands_type_c())) { return command_function(args); } @@ -46,7 +47,7 @@ static void inner(const VcpkgCmdArguments& args) else { const Optional<std::wstring> vcpkg_root_dir_env = System::get_environment_variable(L"VCPKG_ROOT"); - if (auto v = vcpkg_root_dir_env.get()) + if (const auto v = vcpkg_root_dir_env.get()) { vcpkg_root_dir = fs::stdfs::absolute(*v); } @@ -66,10 +67,10 @@ static void inner(const VcpkgCmdArguments& args) vcpkg_root_dir.string(), expected_paths.error().message()); const VcpkgPaths paths = expected_paths.value_or_exit(VCPKG_LINE_INFO); - int exit_code = _wchdir(paths.root.c_str()); + const int exit_code = _wchdir(paths.root.c_str()); Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Changing the working dir failed"); - if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_b())) + if (const auto command_function = Commands::find(args.command, Commands::get_available_commands_type_b())) { return command_function(args, paths); } @@ -83,7 +84,7 @@ static void inner(const VcpkgCmdArguments& args) { const Optional<std::wstring> vcpkg_default_triplet_env = System::get_environment_variable(L"VCPKG_DEFAULT_TRIPLET"); - if (auto v = vcpkg_default_triplet_env.get()) + if (const auto v = vcpkg_default_triplet_env.get()) { default_triplet = Triplet::from_canonical_name(Strings::to_utf8(*v)); } @@ -95,7 +96,7 @@ static void inner(const VcpkgCmdArguments& args) Input::check_triplet(default_triplet, paths); - if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_a())) + if (const auto command_function = Commands::find(args.command, Commands::get_available_commands_type_a())) { return command_function(args, paths, default_triplet); } @@ -117,7 +118,7 @@ static void loadConfig() try { auto maybe_pghs = Paragraphs::get_paragraphs(Files::get_real_filesystem(), localappdata / "vcpkg" / "config"); - if (auto p_pghs = maybe_pghs.get()) + if (const auto p_pghs = maybe_pghs.get()) { const auto& pghs = *p_pghs; @@ -134,7 +135,7 @@ static void loadConfig() auto user_time = keys["User-Since"]; if (!user_id.empty() && !user_time.empty()) { - Metrics::set_user_information(user_id, user_time); + Metrics::g_metrics.lock()->set_user_information(user_id, user_time); return; } } @@ -145,8 +146,11 @@ static void loadConfig() // config file not found, could not be read, or invalid std::string user_id, user_time; - Metrics::init_user_information(user_id, user_time); - Metrics::set_user_information(user_id, user_time); + { + auto locked_metrics = Metrics::g_metrics.lock(); + locked_metrics->init_user_information(user_id, user_time); + locked_metrics->set_user_information(user_id, user_time); + } try { std::error_code ec; @@ -184,34 +188,37 @@ static std::string trim_path_from_command_line(const std::string& full_command_l return std::string(it, full_command_line.cend()); } -static ElapsedTime g_timer; - int wmain(const int argc, const wchar_t* const* const argv) { if (argc == 0) std::abort(); - g_timer = ElapsedTime::create_started(); - atexit([]() { - auto elapsed_us = g_timer.microseconds(); - Metrics::track_metric("elapsed_us", elapsed_us); - g_debugging = false; - Metrics::flush(); - }); + GlobalState::g_init_console_cp = GetConsoleCP(); + GlobalState::g_init_console_output_cp = GetConsoleOutputCP(); + + SetConsoleCP(65001); + SetConsoleOutputCP(65001); - Metrics::track_property("version", Commands::Version::version()); + *GlobalState::timer.lock() = ElapsedTime::create_started(); const std::string trimmed_command_line = trim_path_from_command_line(Strings::to_utf8(GetCommandLineW())); - Metrics::track_property("cmdline", trimmed_command_line); + + { + auto locked_metrics = Metrics::g_metrics.lock(); + locked_metrics->track_property("version", Commands::Version::version()); + locked_metrics->track_property("cmdline", trimmed_command_line); + } loadConfig(); - Metrics::track_property("sqmuser", Metrics::get_SQM_user()); + Metrics::g_metrics.lock()->track_property("sqmuser", Metrics::get_SQM_user()); const VcpkgCmdArguments args = VcpkgCmdArguments::create_from_command_line(argc, argv); - if (auto p = args.printmetrics.get()) Metrics::set_print_metrics(*p); - if (auto p = args.sendmetrics.get()) Metrics::set_send_metrics(*p); - if (auto p = args.debug.get()) g_debugging = *p; + if (const auto p = args.printmetrics.get()) Metrics::g_metrics.lock()->set_print_metrics(*p); + if (const auto p = args.sendmetrics.get()) Metrics::g_metrics.lock()->set_send_metrics(*p); + if (const auto p = args.debug.get()) GlobalState::debugging = *p; + + Checks::register_console_ctrl_handler(); - if (g_debugging) + if (GlobalState::debugging) { inner(args); Checks::exit_fail(VCPKG_LINE_INFO); @@ -231,7 +238,7 @@ int wmain(const int argc, const wchar_t* const* const argv) { exc_msg = "unknown error(...)"; } - Metrics::track_property("error", exc_msg); + Metrics::g_metrics.lock()->track_property("error", exc_msg); fflush(stdout); System::print("vcpkg.exe has crashed.\n" diff --git a/toolsrc/src/vcpkg_Build.cpp b/toolsrc/src/vcpkg_Build.cpp index a0d690f37..a2fa99ac8 100644 --- a/toolsrc/src/vcpkg_Build.cpp +++ b/toolsrc/src/vcpkg_Build.cpp @@ -8,6 +8,7 @@ #include "vcpkg_Chrono.h" #include "vcpkg_Commands.h" #include "vcpkg_Enums.h" +#include "vcpkg_GlobalState.h" #include "vcpkg_System.h" #include "vcpkg_optional.h" #include "vcpkglib.h" @@ -29,46 +30,27 @@ namespace vcpkg::Build CWStringView to_vcvarsall_target(const std::string& cmake_system_name) { - if (cmake_system_name == "") return L""; - if (cmake_system_name == "Windows") return L""; + if (cmake_system_name == Strings::EMPTY) return Strings::WEMPTY; + if (cmake_system_name == "Windows") return Strings::WEMPTY; if (cmake_system_name == "WindowsStore") return L"store"; Checks::exit_with_message(VCPKG_LINE_INFO, "Unsupported vcvarsall target %s", cmake_system_name); } - CWStringView to_vcvarsall_toolchain(const std::string& target_architecture) + CWStringView to_vcvarsall_toolchain(const std::string& target_architecture, const Toolset& toolset) { - using CPU = System::CPUArchitecture; + auto maybe_target_arch = System::to_cpu_architecture(target_architecture); + Checks::check_exit( + VCPKG_LINE_INFO, maybe_target_arch.has_value(), "Invalid architecture string: %s", target_architecture); + auto target_arch = maybe_target_arch.value_or_exit(VCPKG_LINE_INFO); + auto host_architectures = System::get_supported_host_architectures(); - struct ArchOption + for (auto&& host : host_architectures) { - CWStringView name; - CPU host_arch; - CPU target_arch; - }; - - static constexpr ArchOption X86 = {L"x86", CPU::X86, CPU::X86}; - static constexpr ArchOption X86_X64 = {L"x86_x64", CPU::X86, CPU::X64}; - static constexpr ArchOption X86_ARM = {L"x86_arm", CPU::X86, CPU::ARM}; - static constexpr ArchOption X86_ARM64 = {L"x86_arm64", CPU::X86, CPU::ARM64}; - - static constexpr ArchOption X64 = {L"amd64", CPU::X64, CPU::X64}; - static constexpr ArchOption X64_X86 = {L"amd64_x86", CPU::X64, CPU::X86}; - static constexpr ArchOption X64_ARM = {L"amd64_arm", CPU::X64, CPU::ARM}; - static constexpr ArchOption X64_ARM64 = {L"amd64_arm64", CPU::X64, CPU::ARM64}; - - static constexpr std::array<ArchOption, 8> VALUES = { - X86, X86_X64, X86_ARM, X86_ARM64, X64, X64_X86, X64_ARM, X64_ARM64}; - - auto target_arch = System::to_cpu_architecture(target_architecture); - auto host_arch = System::get_host_processor(); - - for (auto&& value : VALUES) - { - if (target_arch == value.target_arch && host_arch == value.host_arch) - { - return value.name; - } + 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; } Checks::exit_with_message(VCPKG_LINE_INFO, "Unsupported toolchain combination %s", target_architecture); @@ -77,40 +59,48 @@ namespace vcpkg::Build std::wstring make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset) { const wchar_t* tonull = L" >nul"; - if (g_debugging) + if (GlobalState::debugging) { - tonull = L""; + tonull = Strings::WEMPTY; } - auto arch = to_vcvarsall_toolchain(pre_build_info.target_architecture); - auto target = to_vcvarsall_target(pre_build_info.cmake_system_name); + const auto arch = to_vcvarsall_toolchain(pre_build_info.target_architecture, toolset); + const auto target = to_vcvarsall_target(pre_build_info.cmake_system_name); return Strings::wformat(LR"("%s" %s %s %s 2>&1)", toolset.vcvarsall.native(), arch, target, tonull); } - static void create_binary_control_file(const VcpkgPaths& paths, - const SourceParagraph& source_paragraph, + static void create_binary_feature_control_file(const SourceParagraph& source_paragraph, + const FeatureParagraph& feature_paragraph, + const Triplet& triplet, + BinaryControlFile& bcf) + { + BinaryParagraph bpgh(source_paragraph, feature_paragraph, triplet); + bcf.features.emplace_back(std::move(bpgh)); + } + + static void create_binary_control_file(const SourceParagraph& source_paragraph, const Triplet& triplet, - const BuildInfo& build_info) + const BuildInfo& build_info, + BinaryControlFile& bcf) { - BinaryParagraph bpgh = BinaryParagraph(source_paragraph, triplet); - if (auto p_ver = build_info.version.get()) + BinaryParagraph bpgh(source_paragraph, triplet); + if (const auto p_ver = build_info.version.get()) { bpgh.version = *p_ver; } - const fs::path binary_control_file = paths.packages / bpgh.dir() / "CONTROL"; - paths.get_filesystem().write_contents(binary_control_file, Strings::serialize(bpgh)); + bcf.core_paragraph = std::move(bpgh); } - static void create_binary_feature_control_file(const VcpkgPaths& paths, - const SourceParagraph& source_paragraph, - const FeatureParagraph& feature_paragraph, - const Triplet& triplet, - const BuildInfo& build_info) + static void write_binary_control_file(const VcpkgPaths& paths, BinaryControlFile bcf) { - BinaryParagraph bpgh = BinaryParagraph(source_paragraph, feature_paragraph, triplet); - const fs::path binary_control_file = paths.packages / bpgh.dir() / "CONTROL"; - paths.get_filesystem().write_contents(binary_control_file, Strings::serialize(bpgh)); + std::string start = Strings::serialize(bcf.core_paragraph); + for (auto&& feature : bcf.features) + { + start += "\n" + Strings::serialize(feature); + } + const fs::path binary_control_file = paths.packages / bcf.core_paragraph.dir() / "CONTROL"; + paths.get_filesystem().write_contents(binary_control_file, start); } ExtendedBuildResult build_package(const VcpkgPaths& paths, @@ -142,12 +132,12 @@ namespace vcpkg::Build const fs::path& git_exe_path = paths.get_git_exe(); const fs::path ports_cmake_script_path = paths.ports_cmake; - auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet); + const auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet); const Toolset& toolset = paths.get_toolset(pre_build_info.platform_toolset); const auto cmd_set_environment = make_build_env_cmd(pre_build_info, toolset); std::string features; - if (g_feature_packages) + if (GlobalState::feature_packages) { if (config.feature_list) { @@ -181,26 +171,33 @@ namespace vcpkg::Build const ElapsedTime timer = ElapsedTime::create_started(); - int return_code = System::cmd_execute_clean(command); - auto buildtimeus = timer.microseconds(); + const int return_code = System::cmd_execute_clean(command); + const auto buildtimeus = timer.microseconds(); const auto spec_string = spec.to_string(); - Metrics::track_metric("buildtimeus-" + spec_string, buildtimeus); - if (return_code != 0) { - Metrics::track_property("error", "build failed"); - Metrics::track_property("build_error", spec_string); - return {BuildResult::BUILD_FAILED, {}}; + auto locked_metrics = Metrics::g_metrics.lock(); + locked_metrics->track_metric("buildtimeus-" + spec_string, buildtimeus); + if (return_code != 0) + { + locked_metrics->track_property("error", "build failed"); + locked_metrics->track_property("build_error", spec_string); + return {BuildResult::BUILD_FAILED, {}}; + } } - auto build_info = read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec)); + const BuildInfo build_info = read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec)); const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info); + BinaryControlFile bcf; + + create_binary_control_file(config.src, triplet, build_info, bcf); + if (error_count != 0) { return {BuildResult::POST_BUILD_CHECKS_FAILED, {}}; } - if (g_feature_packages) + if (GlobalState::feature_packages) { if (config.feature_list) { @@ -209,13 +206,13 @@ namespace vcpkg::Build for (auto&& f_pgh : config.scf->feature_paragraphs) { if (f_pgh->name == feature) - create_binary_feature_control_file( - paths, *config.scf->core_paragraph, *f_pgh, triplet, build_info); + create_binary_feature_control_file(*config.scf->core_paragraph, *f_pgh, triplet, bcf); } } } } - create_binary_control_file(paths, config.src, triplet, build_info); + + write_binary_control_file(paths, bcf); // const fs::path port_buildtrees_dir = paths.buildtrees / spec.name; // delete_directory(port_buildtrees_dir); @@ -228,6 +225,7 @@ namespace vcpkg::Build static const std::string NULLVALUE_STRING = Enums::nullvalue_to_string("vcpkg::Commands::Build::BuildResult"); static const std::string SUCCEEDED_STRING = "SUCCEEDED"; static const std::string BUILD_FAILED_STRING = "BUILD_FAILED"; + static const std::string FILE_CONFLICTS_STRING = "FILE_CONFLICTS"; static const std::string POST_BUILD_CHECKS_FAILED_STRING = "POST_BUILD_CHECKS_FAILED"; static const std::string CASCADED_DUE_TO_MISSING_DEPENDENCIES_STRING = "CASCADED_DUE_TO_MISSING_DEPENDENCIES"; @@ -238,6 +236,7 @@ namespace vcpkg::Build case BuildResult::BUILD_FAILED: return BUILD_FAILED_STRING; case BuildResult::POST_BUILD_CHECKS_FAILED: return POST_BUILD_CHECKS_FAILED_STRING; case BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES: return CASCADED_DUE_TO_MISSING_DEPENDENCIES_STRING; + case BuildResult::FILE_CONFLICTS: return FILE_CONFLICTS_STRING; default: Checks::unreachable(VCPKG_LINE_INFO); } } @@ -270,7 +269,7 @@ namespace vcpkg::Build parser.required_field(BuildInfoRequiredField::CRT_LINKAGE, crt_linkage_as_string); auto crtlinkage = to_linkage_type(crt_linkage_as_string); - if (auto p = crtlinkage.get()) + if (const auto p = crtlinkage.get()) build_info.crt_linkage = *p; else Checks::exit_with_message(VCPKG_LINE_INFO, "Invalid crt linkage type: [%s]", crt_linkage_as_string); @@ -280,7 +279,7 @@ namespace vcpkg::Build std::string library_linkage_as_string; parser.required_field(BuildInfoRequiredField::LIBRARY_LINKAGE, library_linkage_as_string); auto liblinkage = to_linkage_type(library_linkage_as_string); - if (auto p = liblinkage.get()) + if (const auto p = liblinkage.get()) build_info.library_linkage = *p; else Checks::exit_with_message( @@ -293,9 +292,8 @@ namespace vcpkg::Build for (auto policy : g_all_policies) { const auto setting = parser.optional_field(to_string(policy)); - if (setting.empty()) - continue; - else if (setting == "enabled") + if (setting.empty()) continue; + if (setting == "enabled") policies.emplace(policy, true); else if (setting == "disabled") policies.emplace(policy, false); @@ -304,7 +302,7 @@ namespace vcpkg::Build VCPKG_LINE_INFO, "Unknown setting for policy '%s': %s", to_string(policy), setting); } - if (auto err = parser.error_info("PostBuildInformation")) + if (const auto err = parser.error_info("PostBuildInformation")) { print_error_message(err); Checks::exit_fail(VCPKG_LINE_INFO); @@ -338,14 +336,14 @@ namespace vcpkg::Build }); const std::wstring command = Strings::wformat(LR"(%s)", cmd_launch_cmake); - auto ec_data = System::cmd_execute_and_capture_output(command); + const auto ec_data = System::cmd_execute_and_capture_output(command); Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0); const std::vector<std::string> lines = Strings::split(ec_data.output, "\n"); PreBuildInfo pre_build_info; - auto e = lines.cend(); + const auto e = lines.cend(); auto cur = std::find(lines.cbegin(), e, FLAG_GUID); if (cur != e) ++cur; @@ -361,7 +359,7 @@ namespace vcpkg::Build const bool variable_with_no_value = s.size() == 1; const std::string variable_name = s.at(0); - const std::string variable_value = variable_with_no_value ? "" : s.at(1); + const std::string variable_value = variable_with_no_value ? Strings::EMPTY : s.at(1); if (variable_name == "VCPKG_TARGET_ARCHITECTURE") { diff --git a/toolsrc/src/vcpkg_Checks.cpp b/toolsrc/src/vcpkg_Checks.cpp index 2674b889a..b6a88a011 100644 --- a/toolsrc/src/vcpkg_Checks.cpp +++ b/toolsrc/src/vcpkg_Checks.cpp @@ -1,11 +1,40 @@ #include "pch.h" +#include "metrics.h" #include "vcpkg_Checks.h" +#include "vcpkg_GlobalState.h" #include "vcpkg_System.h" #include "vcpkglib.h" namespace vcpkg::Checks { + [[noreturn]] static void cleanup_and_exit(const int exit_code) + { + auto elapsed_us = GlobalState::timer.lock()->microseconds(); + + auto metrics = Metrics::g_metrics.lock(); + metrics->track_metric("elapsed_us", elapsed_us); + GlobalState::debugging = false; + metrics->flush(); + + SetConsoleCP(GlobalState::g_init_console_cp); + SetConsoleOutputCP(GlobalState::g_init_console_output_cp); + + ::exit(exit_code); + } + + static BOOL CtrlHandler(DWORD fdwCtrlType) + { + { + auto locked_metrics = Metrics::g_metrics.lock(); + locked_metrics->track_property("CtrlHandler", std::to_string(fdwCtrlType)); + locked_metrics->track_property("error", "CtrlHandler was fired."); + } + cleanup_and_exit(EXIT_FAILURE); + } + + void register_console_ctrl_handler() { SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE); } + [[noreturn]] void unreachable(const LineInfo& line_info) { System::println(System::Color::error, "Error: Unreachable code was reached"); @@ -13,14 +42,14 @@ namespace vcpkg::Checks #ifndef NDEBUG std::abort(); #else - ::exit(EXIT_FAILURE); + cleanup_and_exit(EXIT_FAILURE); #endif } [[noreturn]] void exit_with_code(const LineInfo& line_info, const int exit_code) { Debug::println(System::Color::error, line_info.to_string()); - ::exit(exit_code); + cleanup_and_exit(exit_code); } [[noreturn]] void exit_with_message(const LineInfo& line_info, const CStringView errorMessage) @@ -33,7 +62,7 @@ namespace vcpkg::Checks { if (!expression) { - exit_with_message(line_info, ""); + exit_with_message(line_info, Strings::EMPTY); } } diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg_Dependencies.cpp index 820e51b33..1a0f0a6ed 100644 --- a/toolsrc/src/vcpkg_Dependencies.cpp +++ b/toolsrc/src/vcpkg_Dependencies.cpp @@ -7,12 +7,105 @@ #include "vcpkg_Dependencies.h" #include "vcpkg_Files.h" #include "vcpkg_Graphs.h" +#include "vcpkg_Strings.h" #include "vcpkg_Util.h" #include "vcpkglib.h" namespace vcpkg::Dependencies { + struct FeatureNodeEdges + { + std::vector<FeatureSpec> remove_edges; + std::vector<FeatureSpec> build_edges; + bool plus = false; + }; + + struct Cluster : Util::MoveOnlyBase + { + std::vector<StatusParagraph*> status_paragraphs; + Optional<const SourceControlFile*> source_control_file; + PackageSpec spec; + std::unordered_map<std::string, FeatureNodeEdges> edges; + std::unordered_set<std::string> to_install_features; + std::unordered_set<std::string> original_features; + bool will_remove = false; + bool transient_uninstalled = true; + RequestType request_type = RequestType::AUTO_SELECTED; + }; + + struct ClusterPtr + { + Cluster* ptr; + + Cluster* operator->() const { return ptr; } + }; + bool operator==(const ClusterPtr& l, const ClusterPtr& r) { return l.ptr == r.ptr; } +} + +template<> +struct std::hash<vcpkg::Dependencies::ClusterPtr> +{ + size_t operator()(const vcpkg::Dependencies::ClusterPtr& value) const + { + return std::hash<vcpkg::PackageSpec>()(value.ptr->spec); + } +}; + +namespace vcpkg::Dependencies +{ + struct GraphPlan + { + Graphs::Graph<ClusterPtr> remove_graph; + Graphs::Graph<ClusterPtr> install_graph; + }; + + struct ClusterGraph : Util::MoveOnlyBase + { + explicit ClusterGraph(std::unordered_map<std::string, const SourceControlFile*>&& ports) + : m_ports(std::move(ports)) + { + } + + Cluster& get(const PackageSpec& spec) + { + auto it = m_graph.find(spec); + if (it == m_graph.end()) + { + // Load on-demand from m_ports + auto it_ports = m_ports.find(spec.name()); + if (it_ports != m_ports.end()) + { + auto& clust = m_graph[spec]; + clust.spec = spec; + cluster_from_scf(*it_ports->second, clust); + return clust; + } + return m_graph[spec]; + } + return it->second; + } + + private: + void cluster_from_scf(const SourceControlFile& scf, Cluster& out_cluster) const + { + FeatureNodeEdges core_dependencies; + core_dependencies.build_edges = + filter_dependencies_to_specs(scf.core_paragraph->depends, out_cluster.spec.triplet()); + out_cluster.edges.emplace("core", std::move(core_dependencies)); + + 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.emplace(feature->name, std::move(added_edges)); + } + out_cluster.source_control_file = &scf; + } + + std::unordered_map<PackageSpec, Cluster> m_graph; + std::unordered_map<std::string, const SourceControlFile*> m_ports; + }; std::vector<PackageSpec> AnyParagraph::dependencies(const Triplet& triplet) const { @@ -27,9 +120,11 @@ namespace vcpkg::Dependencies return to_package_specs(p->package.depends); } - if (auto p = this->binary_paragraph.get()) + if (auto p = this->binary_control_file.get()) { - return to_package_specs(p->depends); + auto deps = Util::fmap_flatten(p->features, [](const BinaryParagraph& pgh) { return pgh.depends; }); + deps.insert(deps.end(), p->core_paragraph.depends.begin(), p->core_paragraph.depends.end()); + return to_package_specs(deps); } if (auto p = this->source_paragraph.get()) @@ -51,54 +146,57 @@ namespace vcpkg::Dependencies } } - InstallPlanAction::InstallPlanAction() - : spec(), any_paragraph(), plan_type(InstallPlanType::UNKNOWN), request_type(RequestType::UNKNOWN) - { - } + InstallPlanAction::InstallPlanAction() : plan_type(InstallPlanType::UNKNOWN), request_type(RequestType::UNKNOWN) {} InstallPlanAction::InstallPlanAction(const PackageSpec& spec, const SourceControlFile& any_paragraph, const std::unordered_set<std::string>& features, const RequestType& request_type) - : InstallPlanAction() + : spec(spec), plan_type(InstallPlanType::BUILD_AND_INSTALL), request_type(request_type), feature_list(features) { - this->spec = spec; - this->request_type = request_type; - - this->plan_type = InstallPlanType::BUILD_AND_INSTALL; this->any_paragraph.source_control_file = &any_paragraph; - this->feature_list = features; + } + + InstallPlanAction::InstallPlanAction(const PackageSpec& spec, + const std::unordered_set<std::string>& features, + const RequestType& request_type) + : spec(spec), plan_type(InstallPlanType::ALREADY_INSTALLED), request_type(request_type), feature_list(features) + { } InstallPlanAction::InstallPlanAction(const PackageSpec& spec, const AnyParagraph& any_paragraph, const RequestType& request_type) - : InstallPlanAction() + : spec(spec), any_paragraph(any_paragraph), plan_type(InstallPlanType::UNKNOWN), request_type(request_type) { - this->spec = spec; - this->request_type = request_type; if (auto p = any_paragraph.status_paragraph.get()) { this->plan_type = InstallPlanType::ALREADY_INSTALLED; - this->any_paragraph.status_paragraph = *p; return; } - if (auto p = any_paragraph.binary_paragraph.get()) + if (auto p = any_paragraph.binary_control_file.get()) { this->plan_type = InstallPlanType::INSTALL; - this->any_paragraph.binary_paragraph = *p; return; } if (auto p = any_paragraph.source_paragraph.get()) { this->plan_type = InstallPlanType::BUILD_AND_INSTALL; - this->any_paragraph.source_paragraph = *p; return; } + } - this->plan_type = InstallPlanType::UNKNOWN; + std::string InstallPlanAction::displayname() const + { + if (this->feature_list.empty()) + { + return this->spec.to_string(); + } + + const std::string features = Strings::join(",", this->feature_list); + return Strings::format("%s[%s]:%s", this->spec.name(), features, this->spec.triplet()); } bool InstallPlanAction::compare_by_name(const InstallPlanAction* left, const InstallPlanAction* right) @@ -120,34 +218,24 @@ namespace vcpkg::Dependencies return left->spec.name() < right->spec.name(); } - ExportPlanAction::ExportPlanAction() - : spec(), any_paragraph(), plan_type(ExportPlanType::UNKNOWN), request_type(RequestType::UNKNOWN) - { - } + ExportPlanAction::ExportPlanAction() : plan_type(ExportPlanType::UNKNOWN), request_type(RequestType::UNKNOWN) {} ExportPlanAction::ExportPlanAction(const PackageSpec& spec, const AnyParagraph& any_paragraph, const RequestType& request_type) - : ExportPlanAction() + : spec(spec), any_paragraph(any_paragraph), plan_type(ExportPlanType::UNKNOWN), request_type(request_type) { - this->spec = spec; - this->request_type = request_type; - - if (auto p = any_paragraph.binary_paragraph.get()) + if (auto p = any_paragraph.binary_control_file.get()) { this->plan_type = ExportPlanType::ALREADY_BUILT; - this->any_paragraph.binary_paragraph = *p; return; } if (auto p = any_paragraph.source_paragraph.get()) { this->plan_type = ExportPlanType::PORT_AVAILABLE_BUT_NOT_BUILT; - this->any_paragraph.source_paragraph = *p; return; } - - this->plan_type = ExportPlanType::UNKNOWN; } bool RemovePlanAction::compare_by_name(const RemovePlanAction* left, const RemovePlanAction* right) @@ -155,9 +243,9 @@ namespace vcpkg::Dependencies return left->spec.name() < right->spec.name(); } - MapPortFile::MapPortFile(const std::unordered_map<PackageSpec, SourceControlFile>& map) : ports(map) {} + MapPortFile::MapPortFile(const std::unordered_map<std::string, SourceControlFile>& map) : ports(map) {} - const SourceControlFile& MapPortFile::get_control_file(const PackageSpec& spec) const + const SourceControlFile& MapPortFile::get_control_file(const std::string& spec) const { auto scf = ports.find(spec); if (scf == ports.end()) @@ -169,9 +257,9 @@ namespace vcpkg::Dependencies PathsPortFile::PathsPortFile(const VcpkgPaths& paths) : ports(paths) {} - const SourceControlFile& PathsPortFile::get_control_file(const PackageSpec& spec) const + const SourceControlFile& PathsPortFile::get_control_file(const std::string& spec) const { - std::unordered_map<PackageSpec, SourceControlFile>::iterator cache_it = cache.find(spec); + auto cache_it = cache.find(spec); if (cache_it != cache.end()) { return cache_it->second; @@ -219,7 +307,9 @@ namespace vcpkg::Dependencies auto it = status_db.find_installed(spec); if (it != status_db.end()) return InstallPlanAction{spec, {*it->get(), nullopt, nullopt}, request_type}; return InstallPlanAction{ - spec, {nullopt, nullopt, *port_file_provider.get_control_file(spec).core_paragraph}, request_type}; + spec, + {nullopt, nullopt, *port_file_provider.get_control_file(spec.name()).core_paragraph}, + request_type}; } }; @@ -319,9 +409,9 @@ namespace vcpkg::Dependencies ? RequestType::USER_REQUESTED : RequestType::AUTO_SELECTED; - Expected<BinaryParagraph> maybe_bpgh = Paragraphs::try_load_cached_package(paths, spec); - if (auto bpgh = maybe_bpgh.get()) - return ExportPlanAction{spec, {nullopt, *bpgh, nullopt}, request_type}; + Expected<BinaryControlFile> maybe_bpgh = Paragraphs::try_load_cached_control_package(paths, spec); + if (auto bcf = maybe_bpgh.get()) + return ExportPlanAction{spec, AnyParagraph{nullopt, std::move(*bcf), nullopt}, request_type}; auto maybe_scf = Paragraphs::try_load_port(paths.get_filesystem(), paths.port_dir(spec)); if (auto scf = maybe_scf.get()) @@ -339,93 +429,79 @@ namespace vcpkg::Dependencies return toposort; } - std::vector<FeatureSpec> to_feature_specs(const std::vector<std::string>& depends, const Triplet& triplet) + enum class MarkPlusResult { - std::vector<FeatureSpec> f_specs; - for (auto&& depend : depends) - { - int end = (int)depend.find(']'); - if (end != std::string::npos) - { - int start = (int)depend.find('['); + FEATURE_NOT_FOUND, + SUCCESS, + }; - auto feature_name = depend.substr(start + 1, end - start - 1); - auto package_name = depend.substr(0, start); - auto p_spec = PackageSpec::from_name_and_triplet(package_name, triplet).value_or_exit(VCPKG_LINE_INFO); - auto feature_spec = FeatureSpec{p_spec, feature_name}; - f_specs.emplace_back(std::move(feature_spec)); - } - else - { - auto p_spec = PackageSpec::from_name_and_triplet(depend, triplet).value_or_exit(VCPKG_LINE_INFO); - - auto feature_spec = FeatureSpec{p_spec, ""}; - f_specs.emplace_back(std::move(feature_spec)); - } - } - return f_specs; - } + MarkPlusResult mark_plus(const std::string& feature, + Cluster& cluster, + ClusterGraph& pkg_to_cluster, + GraphPlan& graph_plan); + void mark_minus(Cluster& cluster, ClusterGraph& pkg_to_cluster, GraphPlan& graph_plan); - bool mark_plus(const std::string& feature, - Cluster& cluster, - std::unordered_map<PackageSpec, Cluster>& pkg_to_cluster, - GraphPlan& graph_plan) + MarkPlusResult mark_plus(const std::string& feature, Cluster& cluster, ClusterGraph& graph, GraphPlan& graph_plan) { - auto it = cluster.edges.find(feature); - std::string updated_feature = feature; - if (updated_feature == "") - { - updated_feature = "core"; - it = cluster.edges.find("core"); - } - if (it == cluster.edges.end()) + if (feature.empty()) { - Checks::unreachable(VCPKG_LINE_INFO); + // Indicates that core was not specified in the reference + return mark_plus("core", cluster, graph, graph_plan); } - if (cluster.edges[updated_feature].plus) return true; + auto it = cluster.edges.find(feature); + if (it == cluster.edges.end()) return MarkPlusResult::FEATURE_NOT_FOUND; + + if (cluster.edges[feature].plus) return MarkPlusResult::SUCCESS; - if (cluster.original_features.find(updated_feature) == cluster.original_features.end()) + if (cluster.original_features.find(feature) == cluster.original_features.end()) { cluster.transient_uninstalled = true; } if (!cluster.transient_uninstalled) { - return false; + return MarkPlusResult::SUCCESS; } - cluster.edges[updated_feature].plus = true; + cluster.edges[feature].plus = true; if (!cluster.original_features.empty()) { - mark_minus(cluster, pkg_to_cluster, graph_plan); + mark_minus(cluster, graph, graph_plan); } graph_plan.install_graph.add_vertex({&cluster}); auto& tracked = cluster.to_install_features; - tracked.insert(updated_feature); - if (tracked.find("core") == tracked.end() && tracked.find("") == tracked.end()) + tracked.insert(feature); + + if (feature != "core") { - cluster.to_install_features.insert("core"); - for (auto&& depend : cluster.edges["core"].build_edges) - { - auto& depend_cluster = pkg_to_cluster[depend.spec]; - mark_plus(depend.feature_name, depend_cluster, pkg_to_cluster, graph_plan); - graph_plan.install_graph.add_edge({&cluster}, {&depend_cluster}); - } + // All features implicitly depend on core + auto res = mark_plus("core", cluster, graph, graph_plan); + + // Should be impossible for "core" to not exist + Checks::check_exit(VCPKG_LINE_INFO, res == MarkPlusResult::SUCCESS); } - for (auto&& depend : cluster.edges[updated_feature].build_edges) + for (auto&& depend : cluster.edges[feature].build_edges) { - auto& depend_cluster = pkg_to_cluster[depend.spec]; - mark_plus(depend.feature_name, depend_cluster, pkg_to_cluster, graph_plan); + auto& depend_cluster = graph.get(depend.spec()); + auto res = mark_plus(depend.feature(), depend_cluster, graph, graph_plan); + + 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 true; + + return MarkPlusResult::SUCCESS; } - void mark_minus(Cluster& cluster, std::unordered_map<PackageSpec, Cluster>& pkg_to_cluster, GraphPlan& graph_plan) + void mark_minus(Cluster& cluster, ClusterGraph& graph, GraphPlan& graph_plan) { if (cluster.will_remove) return; cluster.will_remove = true; @@ -436,89 +512,93 @@ namespace vcpkg::Dependencies auto& remove_edges_edges = pair.second.remove_edges; for (auto&& depend : remove_edges_edges) { - auto& depend_cluster = pkg_to_cluster[depend.spec]; + auto& depend_cluster = graph.get(depend.spec()); graph_plan.remove_graph.add_edge({&cluster}, {&depend_cluster}); - depend_cluster.transient_uninstalled = true; - mark_minus(depend_cluster, pkg_to_cluster, graph_plan); + mark_minus(depend_cluster, graph, graph_plan); } } + + cluster.transient_uninstalled = true; for (auto&& original_feature : cluster.original_features) { - cluster.transient_uninstalled = true; - mark_plus(original_feature, cluster, pkg_to_cluster, graph_plan); + auto res = mark_plus(original_feature, cluster, graph, graph_plan); + if (res != MarkPlusResult::SUCCESS) + { + System::println(System::Color::warning, + "Warning: could not reinstall feature %s", + FeatureSpec{cluster.spec, original_feature}); + } } } - std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<PackageSpec, SourceControlFile>& map, - const std::vector<FullPackageSpec>& specs, - const StatusParagraphs& status_db) + + static ClusterGraph create_feature_install_graph(const std::unordered_map<std::string, SourceControlFile>& map, + const StatusParagraphs& status_db) { - std::unordered_map<PackageSpec, Cluster> pkg_spec_to_package_node; + std::unordered_map<std::string, const SourceControlFile*> ptr_map; + for (auto&& p : map) + ptr_map.emplace(p.first, &p.second); + ClusterGraph graph(std::move(ptr_map)); + + auto installed_ports = get_installed_ports(status_db); - for (const auto& it : map) + for (auto&& status_paragraph : installed_ports) { - Cluster& node = pkg_spec_to_package_node[it.first]; + Cluster& cluster = graph.get(status_paragraph->package.spec); - node.spec = it.first; - FeatureNodeEdges core_dependencies; - auto core_depends = filter_dependencies(it.second.core_paragraph->depends, node.spec.triplet()); - core_dependencies.build_edges = to_feature_specs(core_depends, node.spec.triplet()); - node.edges["core"] = std::move(core_dependencies); + cluster.transient_uninstalled = false; - for (const auto& feature : it.second.feature_paragraphs) + cluster.status_paragraphs.emplace_back(status_paragraph); + + 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()) { - FeatureNodeEdges added_edges; - auto depends = filter_dependencies(feature->depends, node.spec.triplet()); - added_edges.build_edges = to_feature_specs(depends, node.spec.triplet()); - node.edges.emplace(feature->name, std::move(added_edges)); + cluster.original_features.insert("core"); + } + else + { + cluster.original_features.insert(status_paragraph_feature); } - node.source_control_file = &it.second; } - for (auto&& status_paragraph : get_installed_ports(status_db)) + for (auto&& status_paragraph : installed_ports) { auto& spec = status_paragraph->package.spec; auto& status_paragraph_feature = status_paragraph->package.feature; - Cluster& cluster = pkg_spec_to_package_node[spec]; - - cluster.transient_uninstalled = false; - auto reverse_edges = - to_feature_specs(status_paragraph->package.depends, status_paragraph->package.spec.triplet()); + auto reverse_edges = FeatureSpec::from_strings_and_triplet(status_paragraph->package.depends, + status_paragraph->package.spec.triplet()); for (auto&& dependency : reverse_edges) { - auto pkg_node = pkg_spec_to_package_node.find(dependency.spec); - auto depends_name = dependency.feature_name; - if (depends_name == "") - { - for (auto&& default_feature : status_paragraph->package.default_features) - { - auto& target_node = pkg_node->second.edges[default_feature]; - target_node.remove_edges.emplace_back(FeatureSpec{spec, status_paragraph_feature}); - } - depends_name = "core"; - } - auto& target_node = pkg_node->second.edges[depends_name]; + 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[depends_name]; target_node.remove_edges.emplace_back(FeatureSpec{spec, status_paragraph_feature}); } - cluster.status_paragraphs.emplace_back(*status_paragraph); - if (status_paragraph_feature == "") - { - cluster.original_features.insert("core"); - } - else - { - cluster.original_features.insert(status_paragraph_feature); - } } + return graph; + } + + std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFile>& map, + const std::vector<FeatureSpec>& specs, + const StatusParagraphs& status_db) + { + ClusterGraph graph = create_feature_install_graph(map, status_db); GraphPlan graph_plan; for (auto&& spec : specs) { - Cluster& spec_cluster = pkg_spec_to_package_node[spec.package_spec]; - for (auto&& feature : spec.features) - { - mark_plus(feature, spec_cluster, pkg_spec_to_package_node, graph_plan); - } + Cluster& spec_cluster = graph.get(spec.spec()); + spec_cluster.request_type = RequestType::USER_REQUESTED; + auto res = mark_plus(spec.feature(), spec_cluster, graph, graph_plan); + + Checks::check_exit( + VCPKG_LINE_INFO, res == MarkPlusResult::SUCCESS, "Error: Unable to locate feature %s", spec); + + graph_plan.install_graph.add_vertex(ClusterPtr{&spec_cluster}); } Graphs::GraphAdjacencyProvider<ClusterPtr> adjacency_remove_graph(graph_plan.remove_graph.adjacency_list()); @@ -529,38 +609,46 @@ namespace vcpkg::Dependencies auto insert_vertex_list = graph_plan.install_graph.vertex_list(); auto insert_toposort = Graphs::topological_sort(insert_vertex_list, adjacency_install_graph); - std::vector<AnyAction> install_plan; + std::vector<AnyAction> plan; - for (auto&& like_cluster : remove_toposort) + for (auto&& p_cluster : remove_toposort) { - auto scf = *like_cluster.ptr->source_control_file.get(); - - AnyAction any_plan; - any_plan.remove_plan = RemovePlanAction{ - PackageSpec::from_name_and_triplet(scf->core_paragraph->name, like_cluster.ptr->spec.triplet()) - .value_or_exit(VCPKG_LINE_INFO), + 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), RemovePlanType::REMOVE, - RequestType::AUTO_SELECTED}; - - install_plan.emplace_back(std::move(any_plan)); + p_cluster->request_type, + }); } - for (auto&& like_cluster : insert_toposort) + for (auto&& p_cluster : insert_toposort) { - if (!like_cluster.ptr->transient_uninstalled) continue; - - auto scf = *like_cluster.ptr->source_control_file.get(); - auto pkg_spec = - PackageSpec::from_name_and_triplet(scf->core_paragraph->name, like_cluster.ptr->spec.triplet()) - .value_or_exit(VCPKG_LINE_INFO); - auto action = - InstallPlanAction{pkg_spec, *scf, like_cluster.ptr->to_install_features, RequestType::AUTO_SELECTED}; - - AnyAction any_plan; - any_plan.install_plan = std::move(action); - install_plan.emplace_back(std::move(any_plan)); + 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); + plan.emplace_back(InstallPlanAction{ + p_cluster->spec, + *pscf, + p_cluster->to_install_features, + p_cluster->request_type, + }); + } + else + { + // 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; + plan.emplace_back(InstallPlanAction{ + p_cluster->spec, + p_cluster->original_features, + p_cluster->request_type, + }); + } } - return install_plan; + return plan; } } diff --git a/toolsrc/src/vcpkg_Files.cpp b/toolsrc/src/vcpkg_Files.cpp index 29da7e684..24edb779f 100644 --- a/toolsrc/src/vcpkg_Files.cpp +++ b/toolsrc/src/vcpkg_Files.cpp @@ -186,11 +186,11 @@ namespace vcpkg::Files void print_paths(const std::vector<fs::path>& paths) { - System::println(""); + System::println(); for (const fs::path& p : paths) { System::println(" %s", p.generic_string()); } - System::println(""); + System::println(); } } diff --git a/toolsrc/src/vcpkg_GlobalState.cpp b/toolsrc/src/vcpkg_GlobalState.cpp new file mode 100644 index 000000000..2221222c0 --- /dev/null +++ b/toolsrc/src/vcpkg_GlobalState.cpp @@ -0,0 +1,13 @@ +#include "pch.h" + +#include "vcpkg_GlobalState.h" + +namespace vcpkg +{ + Util::LockGuarded<ElapsedTime> GlobalState::timer; + std::atomic<bool> GlobalState::debugging = false; + std::atomic<bool> GlobalState::feature_packages = false; + + std::atomic<int> GlobalState::g_init_console_cp = 0; + std::atomic<int> GlobalState::g_init_console_output_cp = 0; +} diff --git a/toolsrc/src/vcpkg_Input.cpp b/toolsrc/src/vcpkg_Input.cpp index f4e9a07c2..153e6a942 100644 --- a/toolsrc/src/vcpkg_Input.cpp +++ b/toolsrc/src/vcpkg_Input.cpp @@ -29,7 +29,7 @@ namespace vcpkg::Input if (!paths.is_valid_triplet(t)) { System::println(System::Color::error, "Error: invalid triplet: %s", t); - Metrics::track_property("error", "invalid triplet: " + t.to_string()); + Metrics::g_metrics.lock()->track_property("error", "invalid triplet: " + t.to_string()); Commands::Help::help_topic_valid_triplet(paths); Checks::exit_fail(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/vcpkg_Parse.cpp b/toolsrc/src/vcpkg_Parse.cpp index 659af2939..b54f7360b 100644 --- a/toolsrc/src/vcpkg_Parse.cpp +++ b/toolsrc/src/vcpkg_Parse.cpp @@ -30,7 +30,7 @@ namespace vcpkg::Parse } std::string ParagraphParser::optional_field(const std::string& fieldname) { - return remove_field(&fields, fieldname).value_or(""); + return remove_field(&fields, fieldname).value_or(Strings::EMPTY); } std::unique_ptr<ParseControlErrorInfo> ParagraphParser::error_info(const std::string& name) const { @@ -44,4 +44,37 @@ namespace vcpkg::Parse } return nullptr; } + + std::vector<std::string> parse_comma_list(const std::string& str) + { + if (str.empty()) + { + return {}; + } + + std::vector<std::string> out; + + size_t cur = 0; + do + { + auto pos = str.find(',', cur); + if (pos == std::string::npos) + { + out.push_back(str.substr(cur)); + break; + } + out.push_back(str.substr(cur, pos - cur)); + + // skip comma and space + ++pos; + if (str[pos] == ' ') + { + ++pos; + } + + cur = pos; + } while (cur != std::string::npos); + + return out; + } } diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index 0c1c1f9f9..15851829d 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -130,7 +130,7 @@ namespace vcpkg::Strings trim(&s); } - Util::erase_remove_if(*strings, [](const std::string& s) { return s == ""; }); + Util::erase_remove_if(*strings, [](const std::string& s) { return s.empty(); }); } std::vector<std::string> split(const std::string& s, const std::string& delimiter) diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index 883fe6612..f5106b25e 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include "vcpkg_Checks.h" +#include "vcpkg_GlobalState.h" #include "vcpkg_System.h" #include "vcpkglib.h" @@ -18,7 +19,7 @@ namespace vcpkg::System fs::path get_exe_path_of_current_process() { wchar_t buf[_MAX_PATH]; - int bytes = GetModuleFileNameW(nullptr, buf, _MAX_PATH); + const int bytes = GetModuleFileNameW(nullptr, buf, _MAX_PATH); if (bytes == 0) std::abort(); return fs::path(buf, buf + bytes); } @@ -36,18 +37,32 @@ namespace vcpkg::System CPUArchitecture get_host_processor() { auto w6432 = get_environment_variable(L"PROCESSOR_ARCHITEW6432"); - if (auto p = w6432.get()) return to_cpu_architecture(Strings::to_utf8(*p)).value_or_exit(VCPKG_LINE_INFO); + if (const auto p = w6432.get()) return to_cpu_architecture(Strings::to_utf8(*p)).value_or_exit(VCPKG_LINE_INFO); - auto procarch = get_environment_variable(L"PROCESSOR_ARCHITECTURE").value_or_exit(VCPKG_LINE_INFO); + const auto procarch = get_environment_variable(L"PROCESSOR_ARCHITECTURE").value_or_exit(VCPKG_LINE_INFO); return to_cpu_architecture(Strings::to_utf8(procarch)).value_or_exit(VCPKG_LINE_INFO); } + std::vector<CPUArchitecture> get_supported_host_architectures() + { + std::vector<CPUArchitecture> supported_architectures; + supported_architectures.push_back(get_host_processor()); + + // AMD64 machines support to run x86 applications + if (supported_architectures.back() == CPUArchitecture::X64) + { + supported_architectures.push_back(CPUArchitecture::X86); + } + + return supported_architectures; + } + int cmd_execute_clean(const CWStringView cmd_line) { - static const std::wstring system_root = get_environment_variable(L"SystemRoot").value_or_exit(VCPKG_LINE_INFO); - static const std::wstring system_32 = system_root + LR"(\system32)"; - static const std::wstring new_PATH = Strings::wformat( - LR"(Path=%s;%s;%s\Wbem;%s\WindowsPowerShell\v1.0\)", system_32, system_root, system_32, system_32); + static const std::wstring SYSTEM_ROOT = get_environment_variable(L"SystemRoot").value_or_exit(VCPKG_LINE_INFO); + static const std::wstring SYSTEM_32 = SYSTEM_ROOT + LR"(\system32)"; + static const std::wstring NEW_PATH = Strings::wformat( + LR"(Path=%s;%s;%s\Wbem;%s\WindowsPowerShell\v1.0\)", SYSTEM_32, SYSTEM_ROOT, SYSTEM_32, SYSTEM_32); std::vector<std::wstring> env_wstrings = { L"ALLUSERSPROFILE", @@ -94,43 +109,69 @@ namespace vcpkg::System }; // Flush stdout before launching external process - fflush(nullptr); + fflush(nullptr); - std::vector<const wchar_t*> env_cstr; - env_cstr.reserve(env_wstrings.size() + 2); + std::wstring env_cstr; for (auto&& env_wstring : env_wstrings) { const Optional<std::wstring> value = System::get_environment_variable(env_wstring); - auto v = value.get(); + const auto v = value.get(); if (!v || v->empty()) continue; - env_wstring.push_back(L'='); - env_wstring.append(*v); - env_cstr.push_back(env_wstring.c_str()); + env_cstr.append(env_wstring); + env_cstr.push_back(L'='); + env_cstr.append(*v); + env_cstr.push_back(L'\0'); } - env_cstr.push_back(new_PATH.c_str()); - env_cstr.push_back(nullptr); + env_cstr.append(NEW_PATH); + env_cstr.push_back(L'\0'); + + STARTUPINFOW startup_info; + memset(&startup_info, 0, sizeof(STARTUPINFOW)); + startup_info.cb = sizeof(STARTUPINFOW); + + PROCESS_INFORMATION process_info; + memset(&process_info, 0, sizeof(PROCESS_INFORMATION)); // Basically we are wrapping it in quotes - const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s")###", cmd_line); - Debug::println("_wspawnlpe(cmd.exe /c %s)", Strings::to_utf8(actual_cmd_line)); - auto exit_code = - _wspawnlpe(_P_WAIT, L"cmd.exe", L"cmd.exe", L"/c", actual_cmd_line.c_str(), nullptr, env_cstr.data()); - Debug::println("_wspawnlpe() returned %d", exit_code); + std::wstring actual_cmd_line = Strings::wformat(LR"###(cmd.exe /c "%s")###", cmd_line); + Debug::println("CreateProcessW(%s)", Strings::to_utf8(actual_cmd_line)); + bool succeeded = TRUE == CreateProcessW(nullptr, + actual_cmd_line.data(), + nullptr, + nullptr, + FALSE, + BELOW_NORMAL_PRIORITY_CLASS | CREATE_UNICODE_ENVIRONMENT, + env_cstr.data(), + nullptr, + &startup_info, + &process_info); + + Checks::check_exit(VCPKG_LINE_INFO, succeeded, "Process creation failed with error code: %lu", GetLastError()); + + CloseHandle(process_info.hThread); + + const DWORD result = WaitForSingleObject(process_info.hProcess, INFINITE); + Checks::check_exit(VCPKG_LINE_INFO, result != WAIT_FAILED, "WaitForSingleObject failed"); + + DWORD exit_code = 0; + GetExitCodeProcess(process_info.hProcess, &exit_code); + + Debug::println("CreateProcessW() returned %lu", exit_code); return static_cast<int>(exit_code); } int cmd_execute(const CWStringView cmd_line) { // Flush stdout before launching external process - fflush(nullptr); + fflush(nullptr); // Basically we are wrapping it in quotes const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s")###", cmd_line); Debug::println("_wsystem(%s)", Strings::to_utf8(actual_cmd_line)); - int exit_code = _wsystem(actual_cmd_line.c_str()); + const int exit_code = _wsystem(actual_cmd_line.c_str()); Debug::println("_wsystem() returned %d", exit_code); return exit_code; } @@ -143,24 +184,25 @@ namespace vcpkg::System const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s 2>&1")###", cmd_line); Debug::println("_wpopen(%s)", Strings::to_utf8(actual_cmd_line)); - std::string output; - char buf[1024]; - auto pipe = _wpopen(actual_cmd_line.c_str(), L"r"); + std::wstring output; + wchar_t buf[1024]; + const auto pipe = _wpopen(actual_cmd_line.c_str(), L"r"); if (pipe == nullptr) { - return {1, output}; + return {1, Strings::to_utf8(output)}; } - while (fgets(buf, 1024, pipe)) + while (fgetws(buf, 1024, pipe)) { output.append(buf); } if (!feof(pipe)) { - return {1, output}; + return {1, Strings::to_utf8(output)}; } - auto ec = _pclose(pipe); - Debug::println("_wpopen() returned %d", ec); - return {ec, output}; + + const auto ec = _pclose(pipe); + Debug::println("_pclose() returned %d", ec); + return {ec, Strings::to_utf8(output)}; } std::wstring create_powershell_script_cmd(const fs::path& script_path, const CWStringView args) @@ -170,6 +212,8 @@ namespace vcpkg::System LR"(powershell -NoProfile -ExecutionPolicy Bypass -Command "& {& '%s' %s}")", script_path.native(), args); } + void println() { println(Strings::EMPTY); } + void print(const CStringView message) { fputs(message, stdout); } void println(const CStringView message) @@ -180,15 +224,15 @@ namespace vcpkg::System void print(const Color c, const CStringView message) { - HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); + const HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE); - CONSOLE_SCREEN_BUFFER_INFO consoleScreenBufferInfo{}; - GetConsoleScreenBufferInfo(hConsole, &consoleScreenBufferInfo); - auto original_color = consoleScreenBufferInfo.wAttributes; + CONSOLE_SCREEN_BUFFER_INFO console_screen_buffer_info{}; + GetConsoleScreenBufferInfo(console_handle, &console_screen_buffer_info); + const auto original_color = console_screen_buffer_info.wAttributes; - SetConsoleTextAttribute(hConsole, static_cast<WORD>(c) | (original_color & 0xF0)); + SetConsoleTextAttribute(console_handle, static_cast<WORD>(c) | (original_color & 0xF0)); print(message); - SetConsoleTextAttribute(hConsole, original_color); + SetConsoleTextAttribute(console_handle, original_color); } void println(const Color c, const CStringView message) @@ -199,13 +243,13 @@ namespace vcpkg::System Optional<std::wstring> get_environment_variable(const CWStringView varname) noexcept { - auto sz = GetEnvironmentVariableW(varname, nullptr, 0); + const auto sz = GetEnvironmentVariableW(varname, nullptr, 0); if (sz == 0) return nullopt; std::wstring ret(sz, L'\0'); Checks::check_exit(VCPKG_LINE_INFO, MAXDWORD >= ret.size()); - auto sz2 = GetEnvironmentVariableW(varname, ret.data(), static_cast<DWORD>(ret.size())); + const auto sz2 = GetEnvironmentVariableW(varname, ret.data(), static_cast<DWORD>(ret.size())); Checks::check_exit(VCPKG_LINE_INFO, sz2 + 1 == sz); ret.pop_back(); return ret; @@ -216,23 +260,23 @@ namespace vcpkg::System return hkey_type == REG_SZ || hkey_type == REG_MULTI_SZ || hkey_type == REG_EXPAND_SZ; } - Optional<std::wstring> get_registry_string(HKEY base, const CWStringView subKey, const CWStringView valuename) + Optional<std::wstring> get_registry_string(HKEY base, const CWStringView sub_key, const CWStringView valuename) { HKEY k = nullptr; - LSTATUS ec = RegOpenKeyExW(base, subKey, NULL, KEY_READ, &k); + const LSTATUS ec = RegOpenKeyExW(base, sub_key, NULL, KEY_READ, &k); if (ec != ERROR_SUCCESS) return nullopt; - DWORD dwBufferSize = 0; - DWORD dwType = 0; - auto rc = RegQueryValueExW(k, valuename, nullptr, &dwType, nullptr, &dwBufferSize); - if (rc != ERROR_SUCCESS || !is_string_keytype(dwType) || dwBufferSize == 0 || - dwBufferSize % sizeof(wchar_t) != 0) + DWORD dw_buffer_size = 0; + DWORD dw_type = 0; + auto rc = RegQueryValueExW(k, valuename, nullptr, &dw_type, nullptr, &dw_buffer_size); + if (rc != ERROR_SUCCESS || !is_string_keytype(dw_type) || dw_buffer_size == 0 || + dw_buffer_size % sizeof(wchar_t) != 0) return nullopt; std::wstring ret; - ret.resize(dwBufferSize / sizeof(wchar_t)); + ret.resize(dw_buffer_size / sizeof(wchar_t)); - rc = RegQueryValueExW(k, valuename, nullptr, &dwType, reinterpret_cast<LPBYTE>(ret.data()), &dwBufferSize); - if (rc != ERROR_SUCCESS || !is_string_keytype(dwType) || dwBufferSize != sizeof(wchar_t) * ret.size()) + rc = RegQueryValueExW(k, valuename, nullptr, &dw_type, reinterpret_cast<LPBYTE>(ret.data()), &dw_buffer_size); + if (rc != ERROR_SUCCESS || !is_string_keytype(dw_type) || dw_buffer_size != sizeof(wchar_t) * ret.size()) return nullopt; ret.pop_back(); // remove extra trailing null byte @@ -276,7 +320,7 @@ namespace vcpkg::Debug { void println(const CStringView message) { - if (g_debugging) + if (GlobalState::debugging) { System::println("[DEBUG] %s", message); } @@ -284,7 +328,7 @@ namespace vcpkg::Debug void println(const System::Color c, const CStringView message) { - if (g_debugging) + if (GlobalState::debugging) { System::println(c, "[DEBUG] %s", message); } diff --git a/toolsrc/src/vcpkg_metrics_uploader.cpp b/toolsrc/src/vcpkg_metrics_uploader.cpp index 38bf7ff9c..cef4f4756 100644 --- a/toolsrc/src/vcpkg_metrics_uploader.cpp +++ b/toolsrc/src/vcpkg_metrics_uploader.cpp @@ -11,5 +11,8 @@ int WINAPI WinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int) LPWSTR* szArgList = CommandLineToArgvW(GetCommandLineW(), &argCount); Checks::check_exit(VCPKG_LINE_INFO, argCount == 2, "Requires exactly one argument, the path to the payload file"); - Metrics::upload(Files::get_real_filesystem().read_contents(szArgList[1]).value_or_exit(VCPKG_LINE_INFO)); + auto v = Files::get_real_filesystem().read_contents(szArgList[1]).value_or_exit(VCPKG_LINE_INFO); + Metrics::g_metrics.lock()->upload(v); + LocalFree(szArgList); + return 0; } diff --git a/toolsrc/src/vcpkglib.cpp b/toolsrc/src/vcpkglib.cpp index 6b180b532..5cdafdbc8 100644 --- a/toolsrc/src/vcpkglib.cpp +++ b/toolsrc/src/vcpkglib.cpp @@ -9,8 +9,6 @@ namespace vcpkg { - bool g_debugging = false; - static StatusParagraphs load_current_database(Files::Filesystem& fs, const fs::path& vcpkg_dir_status_file, const fs::path& vcpkg_dir_status_file_old) @@ -41,7 +39,7 @@ namespace vcpkg { auto& fs = paths.get_filesystem(); - auto updates_dir = paths.vcpkg_dir_updates; + const auto updates_dir = paths.vcpkg_dir_updates; std::error_code ec; fs.create_directory(paths.installed, ec); @@ -92,9 +90,9 @@ namespace vcpkg static int update_id = 0; auto& fs = paths.get_filesystem(); - auto my_update_id = update_id++; - auto tmp_update_filename = paths.vcpkg_dir_updates / "incomplete"; - auto update_filename = paths.vcpkg_dir_updates / std::to_string(my_update_id); + const auto my_update_id = update_id++; + const auto tmp_update_filename = paths.vcpkg_dir_updates / "incomplete"; + const auto update_filename = paths.vcpkg_dir_updates / std::to_string(my_update_id); fs.write_contents(tmp_update_filename, Strings::serialize(p)); fs.rename(tmp_update_filename, update_filename); @@ -119,7 +117,7 @@ namespace vcpkg if (!was_tracked) { was_tracked = true; - Metrics::track_property("listfile", "update to new format"); + Metrics::g_metrics.lock()->track_property("listfile", "update to new format"); } // The files are sorted such that directories are placed just before the files they contain @@ -191,7 +189,7 @@ namespace vcpkg for (const std::unique_ptr<StatusParagraph>& pgh : status_db) { - if (pgh->state != InstallState::INSTALLED) + if (pgh->state != InstallState::INSTALLED || !pgh->package.feature.empty()) { continue; } @@ -235,14 +233,15 @@ namespace vcpkg const fs::path& cmake_script, const std::vector<CMakeVariable>& pass_variables) { - std::wstring cmd_cmake_pass_variables = Strings::join(L" ", pass_variables, [](auto&& v) { return v.s; }); + const std::wstring cmd_cmake_pass_variables = Strings::join(L" ", pass_variables, [](auto&& v) { return v.s; }); return Strings::wformat( LR"("%s" %s -P "%s")", cmake_exe.native(), cmd_cmake_pass_variables, cmake_script.generic_wstring()); } - std::string shorten_description(const std::string& desc) + std::string shorten_text(const std::string& desc, size_t length) { + Checks::check_exit(VCPKG_LINE_INFO, length >= 3); auto simple_desc = std::regex_replace(desc, std::regex("\\s+"), " "); - return simple_desc.size() <= 52 ? simple_desc : simple_desc.substr(0, 49) + "..."; + return simple_desc.size() <= length ? simple_desc : simple_desc.substr(0, length - 3) + "..."; } } diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 200f91d1c..edecd7720 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -161,6 +161,7 @@ <ClInclude Include="..\include\vcpkg_Chrono.h" /> <ClInclude Include="..\include\triplet.h" /> <ClInclude Include="..\include\vcpkglib.h" /> + <ClInclude Include="..\include\vcpkg_GlobalState.h" /> <ClInclude Include="..\include\vcpkg_Parse.h" /> <ClInclude Include="..\include\vcpkg_Checks.h" /> <ClInclude Include="..\include\VcpkgCmdArguments.h" /> @@ -227,6 +228,7 @@ <ClCompile Include="..\src\StatusParagraph.cpp" /> <ClCompile Include="..\src\StatusParagraphs.cpp" /> <ClCompile Include="..\src\triplet.cpp" /> + <ClCompile Include="..\src\vcpkg_GlobalState.cpp" /> <ClCompile Include="..\src\vcpkg_Parse.cpp" /> <ClCompile Include="..\src\vcpkg_Checks.cpp" /> <ClCompile Include="..\src\VcpkgCmdArguments.cpp" /> diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 4f51dfa9a..2fbf3d929 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -177,6 +177,9 @@ <ClCompile Include="..\src\vcpkg_Parse.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="..\src\vcpkg_GlobalState.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\include\SourceParagraph.h"> @@ -302,5 +305,8 @@ <ClInclude Include="..\include\vcpkg_Parse.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="..\include\vcpkg_GlobalState.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> </Project>
\ No newline at end of file diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj b/toolsrc/vcpkgtest/vcpkgtest.vcxproj index ca66260d4..041e74d31 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj @@ -21,6 +21,7 @@ <ItemGroup> <ClCompile Include="..\src\tests_arguments.cpp" /> <ClCompile Include="..\src\tests_dependencies.cpp" /> + <ClCompile Include="..\src\tests_package_spec.cpp" /> <ClCompile Include="..\src\tests_paragraph.cpp" /> <ClCompile Include="..\src\test_install_plan.cpp" /> </ItemGroup> diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters b/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters index e376e59f4..b31dbd951 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters @@ -27,5 +27,8 @@ <ClCompile Include="..\src\test_install_plan.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="..\src\tests_package_spec.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> </Project>
\ No newline at end of file |
