From 2581afcbb301cc4a57b9d508abe0a1073363d9d9 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Wed, 11 Jan 2017 11:54:00 +0100 Subject: [PATCH 001/137] Added msmpi port --- ports/msmpi/CONTROL | 3 ++ ports/msmpi/portfile.cmake | 93 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 ports/msmpi/CONTROL create mode 100644 ports/msmpi/portfile.cmake diff --git a/ports/msmpi/CONTROL b/ports/msmpi/CONTROL new file mode 100644 index 00000000000..3d55547a293 --- /dev/null +++ b/ports/msmpi/CONTROL @@ -0,0 +1,3 @@ +Source: msmpi +Version: 7.1 +Description: Microsoft MPI diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake new file mode 100644 index 00000000000..0cb1701ce52 --- /dev/null +++ b/ports/msmpi/portfile.cmake @@ -0,0 +1,93 @@ +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/msmpi-7.1) + +vcpkg_find_acquire_program(7Z) + +vcpkg_download_distfile(SDK_ARCHIVE + URLS "https://download.microsoft.com/download/E/8/A/E8A080AF-040D-43FF-97B4-065D4F220301/msmpisdk.msi" + FILENAME "msmpisdk-7.1.msi" + SHA512 e3b479189e0effc83c030c74ac6e6762f577cfa94bffb2b35192aab3329b5cfad7933c353c0304754e6b097912b81dbfd4d4b52a5fe5563bd4f3578cd1cf71d7 +) +vcpkg_download_distfile(REDIST_ARCHIVE + URLS "https://download.microsoft.com/download/E/8/A/E8A080AF-040D-43FF-97B4-065D4F220301/MSMpiSetup.exe" + FILENAME "MSMpiSetup-7.1.exe" + SHA512 f75c448e49b1ab4f5e60c958f0c7c1766e06665d65d2bdec42578aa77fb9d5fdc0215cee6ec51909e77d13451490bfff1c324bf9eb4311cb886b98a6ad469a2d +) + +file(TO_NATIVE_PATH "${SDK_ARCHIVE}" SDK_ARCHIVE) +file(TO_NATIVE_PATH "${SOURCE_PATH}/sdk" SDK_SOURCE_DIR) + +vcpkg_execute_required_process( + COMMAND msiexec /a ${SDK_ARCHIVE} /qn TARGETDIR=${SDK_SOURCE_DIR} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} + LOGNAME extract-sdk +) + +vcpkg_execute_required_process( + COMMAND ${7Z} e -o${SOURCE_PATH}/redist -aoa ${REDIST_ARCHIVE} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} + LOGNAME extract-redist +) + +set(SOURCE_INCLUDE_PATH "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/Include") +set(SOURCE_LIB_PATH "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/Lib") +set(SOURCE_BIN_PATH "${SOURCE_PATH}/redist") + +# Install include files +file(INSTALL + "${SOURCE_INCLUDE_PATH}/mpi.h" + "${SOURCE_INCLUDE_PATH}/mpif.h" + "${SOURCE_INCLUDE_PATH}/mpi.f90" + "${SOURCE_INCLUDE_PATH}/${TRIPLET_SYSTEM_ARCH}/mpifptr.h" + DESTINATION + ${CURRENT_PACKAGES_DIR}/include +) + +# NOTE: we do not install the dlls here since they are not architecture independent (x86 only) +# and they seam not to be required by neither mpiexec nor programs build against msmpi.lib + +# Install release libraries and tools +file(INSTALL + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib" + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifec.lib" + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifmc.lib" + DESTINATION + ${CURRENT_PACKAGES_DIR}/lib +) +# file(INSTALL +# "${SOURCE_BIN_PATH}/msmpi.dll" +# "${SOURCE_BIN_PATH}/msmpires.dll" +# DESTINATION +# ${CURRENT_PACKAGES_DIR}/bin +# ) + +# Install debug libraries +# NOTE: since the binary distribution does not include any debug libraries we simply install the release libraries +file(INSTALL + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib" + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifec.lib" + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifmc.lib" + DESTINATION + ${CURRENT_PACKAGES_DIR}/debug/lib +) +# file(INSTALL +# "${SOURCE_BIN_PATH}/msmpi.dll" +# "${SOURCE_BIN_PATH}/msmpires.dll" +# DESTINATION +# ${CURRENT_PACKAGES_DIR}/debug/bin +# ) + +# Install tools +file(INSTALL + "${SOURCE_BIN_PATH}/mpiexec.exe" + "${SOURCE_BIN_PATH}/msmpilaunchsvc.exe" + "${SOURCE_BIN_PATH}/smpd.exe" + "${SOURCE_BIN_PATH}/mpitrace.man" + DESTINATION + ${CURRENT_PACKAGES_DIR}/tools +) + +# Handle copyright +file(COPY "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/License/license_sdk.rtf" DESTINATION ${CURRENT_PACKAGES_DIR}/share/msmpi) +#TODO: convert RTF to simple text?! +file(RENAME ${CURRENT_PACKAGES_DIR}/share/msmpi/license_sdk.rtf ${CURRENT_PACKAGES_DIR}/share/msmpi/copyright) From 7197fbb53830b5feaeef6a7d4499191d4ad085f8 Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Wed, 11 Jan 2017 12:04:38 +0100 Subject: [PATCH 002/137] Add port for parmetis --- ports/parmetis/CONTROL | 4 ++ ports/parmetis/fix-gklib-vs14-math.patch | 11 +++++ .../parmetis/fix-libparmetis-cmakelist.patch | 15 ++++++ ports/parmetis/fix-metis-vs14-math.patch | 11 +++++ ports/parmetis/fix-root-cmakelist.patch | 29 ++++++++++++ ports/parmetis/portfile.cmake | 46 +++++++++++++++++++ 6 files changed, 116 insertions(+) create mode 100644 ports/parmetis/CONTROL create mode 100644 ports/parmetis/fix-gklib-vs14-math.patch create mode 100644 ports/parmetis/fix-libparmetis-cmakelist.patch create mode 100644 ports/parmetis/fix-metis-vs14-math.patch create mode 100644 ports/parmetis/fix-root-cmakelist.patch create mode 100644 ports/parmetis/portfile.cmake diff --git a/ports/parmetis/CONTROL b/ports/parmetis/CONTROL new file mode 100644 index 00000000000..86a367cbd14 --- /dev/null +++ b/ports/parmetis/CONTROL @@ -0,0 +1,4 @@ +Source: parmetis +Version: 4.0.3 +Description: Parallel Graph Partitioning and Fill-reducing Matrix Ordering +Build-Depends: metis, msmpi diff --git a/ports/parmetis/fix-gklib-vs14-math.patch b/ports/parmetis/fix-gklib-vs14-math.patch new file mode 100644 index 00000000000..059890e36f6 --- /dev/null +++ b/ports/parmetis/fix-gklib-vs14-math.patch @@ -0,0 +1,11 @@ +--- a/metis/GKlib/gk_arch.h Wed Dec 21 18:34:18 2016 ++++ b/metis/GKlib/gk_arch.h Wed Dec 21 18:30:49 2016 +@@ -58,7 +58,7 @@ + #define PTRDIFF_MAX INT64_MAX + #endif + +-#ifdef __MSC__ ++#if defined(__MSC__) && (_MSC_VER < 1900) + /* MSC does not have rint() function */ + #define rint(x) ((int)((x)+0.5)) + diff --git a/ports/parmetis/fix-libparmetis-cmakelist.patch b/ports/parmetis/fix-libparmetis-cmakelist.patch new file mode 100644 index 00000000000..6cdd7be6222 --- /dev/null +++ b/ports/parmetis/fix-libparmetis-cmakelist.patch @@ -0,0 +1,15 @@ +--- a/libparmetis/CMakeLists.txt Sat Mar 30 17:24:50 2013 ++++ b/libparmetis/CMakeLists.txt Wed Dec 21 19:40:28 2016 +@@ -5,10 +5,10 @@ + # Create libparmetis + add_library(parmetis ${ParMETIS_LIBRARY_TYPE} ${parmetis_sources}) + # Link with metis and MPI libraries. +-target_link_libraries(parmetis metis ${MPI_LIBRARIES}) ++target_link_libraries(parmetis ${METIS_LIBRARY} ${MPI_LIBRARIES}) + set_target_properties(parmetis PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}") + + install(TARGETS parmetis + LIBRARY DESTINATION lib +- RUNTIME DESTINATION lib ++ RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib) diff --git a/ports/parmetis/fix-metis-vs14-math.patch b/ports/parmetis/fix-metis-vs14-math.patch new file mode 100644 index 00000000000..ddf10052a75 --- /dev/null +++ b/ports/parmetis/fix-metis-vs14-math.patch @@ -0,0 +1,11 @@ +--- a/metis/libmetis/metislib.h Sat Mar 30 17:24:45 2013 ++++ b/metis/libmetis/metislib.h Wed Dec 21 18:30:59 2016 +@@ -31,7 +31,7 @@ + #include + + +-#if defined(COMPILER_MSC) ++#if defined(COMPILER_MSC) && (_MSC_VER < 1900) + #if defined(rint) + #undef rint + #endif diff --git a/ports/parmetis/fix-root-cmakelist.patch b/ports/parmetis/fix-root-cmakelist.patch new file mode 100644 index 00000000000..914bf9189c7 --- /dev/null +++ b/ports/parmetis/fix-root-cmakelist.patch @@ -0,0 +1,29 @@ +--- a/CMakeLists.txt Sat Mar 30 17:24:50 2013 ++++ b/CMakeLists.txt Wed Dec 21 19:38:12 2016 +@@ -16,6 +16,9 @@ + # endif() + # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_COMPILE_FLAGS}") + ++find_package(MPI REQUIRED) ++find_library(METIS_LIBRARY NAMES metis) ++ + # Prepare libraries. + if(SHARED) + set(ParMETIS_LIBRARY_TYPE SHARED) +@@ -30,13 +33,13 @@ + include_directories(include) + include_directories(${MPI_INCLUDE_PATH}) + include_directories(${GKLIB_PATH}) +-include_directories(${METIS_PATH}/include) ++# include_directories(${METIS_PATH}/include) + + # List of directories that cmake will look for CMakeLists.txt +-add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis) ++# add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis) + add_subdirectory(include) + add_subdirectory(libparmetis) +-add_subdirectory(programs) ++# add_subdirectory(programs) + + # This is for testing during development and is not being distributed + #add_subdirectory(test) diff --git a/ports/parmetis/portfile.cmake b/ports/parmetis/portfile.cmake new file mode 100644 index 00000000000..c6022ad4737 --- /dev/null +++ b/ports/parmetis/portfile.cmake @@ -0,0 +1,46 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = +# 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/parmetis-4.0.3) +vcpkg_download_distfile(ARCHIVE + URLS "http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-4.0.3.tar.gz" + FILENAME "parmetis-4.0.3.tar.gz" + SHA512 454a91921ca35c981df11c9846a11963ff8fd8407a25179453af33f8fe69493f6dd7f2a0b8feed9a7d3f121e45b715749dd7a94873eaac2bae4cad1e535ca132 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/fix-metis-vs14-math.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-gklib-vs14-math.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-root-cmakelist.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-libparmetis-cmakelist.patch +) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(ADDITIONAL_OPTIONS -DSHARED=ON -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON) +else() + set(ADDITIONAL_OPTIONS -DSHARED=OFF) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + ${ADDITIONAL_OPTIONS} +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/parmetis) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/parmetis/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/parmetis/copyright) From fda4bb11ce8403ab05f30bc6965c76f9621cff7a Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Wed, 11 Jan 2017 12:18:49 +0100 Subject: [PATCH 003/137] Add port for hdf5 --- ports/hdf5/CONTROL | 4 ++++ ports/hdf5/portfile.cmake | 44 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 ports/hdf5/CONTROL create mode 100644 ports/hdf5/portfile.cmake diff --git a/ports/hdf5/CONTROL b/ports/hdf5/CONTROL new file mode 100644 index 00000000000..46049af8706 --- /dev/null +++ b/ports/hdf5/CONTROL @@ -0,0 +1,4 @@ +Source: hdf5 +Version: 1.8.18 +Description: HDF5 is a data model, library, and file format for storing and managing data +Build-Depends: zlib, szip, msmpi \ No newline at end of file diff --git a/ports/hdf5/portfile.cmake b/ports/hdf5/portfile.cmake new file mode 100644 index 00000000000..a09f758b67f --- /dev/null +++ b/ports/hdf5/portfile.cmake @@ -0,0 +1,44 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = +# 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/hdf5-1.8.18) +vcpkg_download_distfile(ARCHIVE + URLS "https://support.hdfgroup.org/ftp/HDF5/current18/src/hdf5-1.8.18.tar.bz2" + FILENAME "hdf5-1.8.18.tar.bz2" + SHA512 01f6d14bdd3be2ced9c63cc9e1820cd7ea11db649ff9f3a3055c18c4b0fffe777fd23baad536e3bce31c4d76fe17db64a3972762e1bb4d232927c1ca140e72b2 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=1 + -DBUILD_TESTING=OFF + -DHDF5_BUILD_EXAMPLES=OFF + -DHDF5_BUILD_TOOLS=OFF + -DHDF5_BUILD_CPP_LIB=OFF + -DHDF5_ENABLE_PARALLEL=ON + -DHDF5_ENABLE_Z_LIB_SUPPORT=ON + -DHDF5_ENABLE_SZIP_SUPPORT=ON + -DHDF5_ENABLE_SZIP_ENCODING=ON + -DHDF5_INSTALL_DATA_DIR=share/hdf5/data + -DHDF5_INSTALL_CMAKE_DIR=share/hdf5 +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(RENAME ${CURRENT_PACKAGES_DIR}/share/hdf5/data/COPYING ${CURRENT_PACKAGES_DIR}/share/hdf5/copyright) + +file(READ ${CURRENT_PACKAGES_DIR}/debug/share/hdf5/hdf5-targets-debug.cmake HDF5_TARGETS_DEBUG_MODULE) +string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" HDF5_TARGETS_DEBUG_MODULE "${HDF5_TARGETS_DEBUG_MODULE}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/hdf5/hdf5-targets-debug.cmake "${HDF5_TARGETS_DEBUG_MODULE}") + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) From 9e2fd15455023960aa9ad5fef6fd98f95e7da79f Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Thu, 19 Jan 2017 06:31:42 +0100 Subject: [PATCH 004/137] Do not simply rename "license_sdk.rtf" to "copyright" --- ports/msmpi/portfile.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index 0cb1701ce52..9fc169a286d 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -89,5 +89,4 @@ file(INSTALL # Handle copyright file(COPY "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/License/license_sdk.rtf" DESTINATION ${CURRENT_PACKAGES_DIR}/share/msmpi) -#TODO: convert RTF to simple text?! -file(RENAME ${CURRENT_PACKAGES_DIR}/share/msmpi/license_sdk.rtf ${CURRENT_PACKAGES_DIR}/share/msmpi/copyright) +file(WRITE ${CURRENT_PACKAGES_DIR}/share/msmpi/copyright "See the accompanying license_sdk.rtf") From 9ee6208e02128f0d22859ffe91cb29ac49a13f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Wed, 1 Feb 2017 12:49:09 -0500 Subject: [PATCH 005/137] Install grpc_cpp_plugin.exe into tools folder --- ports/grpc/portfile.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/grpc/portfile.cmake b/ports/grpc/portfile.cmake index ffd71d13755..90915976cea 100644 --- a/ports/grpc/portfile.cmake +++ b/ports/grpc/portfile.cmake @@ -53,6 +53,8 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets-release.cmake ${C file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/gRPC/gRPCTargets-debug.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-debug.cmake) file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/grpc RENAME copyright) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/grpc_cpp_plugin.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) From 95af9aac7c39765d1524b7c9c39dc283e9f0facf Mon Sep 17 00:00:00 2001 From: codicodi Date: Fri, 3 Feb 2017 17:16:13 +0100 Subject: [PATCH 006/137] Add Ninja support --- ports/fmt/CONTROL | 2 +- ports/fmt/portfile.cmake | 1 + scripts/cmake/vcpkg_build_cmake.cmake | 12 +++++++++--- scripts/cmake/vcpkg_configure_cmake.cmake | 14 ++++++++++---- scripts/cmake/vcpkg_find_acquire_program.cmake | 16 ++++++++++++---- scripts/cmake/vcpkg_install_cmake.cmake | 12 +++++++++--- scripts/templates/portfile.in.cmake | 1 + 7 files changed, 43 insertions(+), 15 deletions(-) diff --git a/ports/fmt/CONTROL b/ports/fmt/CONTROL index ce2bfc4e0b4..2c90cc300f5 100644 --- a/ports/fmt/CONTROL +++ b/ports/fmt/CONTROL @@ -1,3 +1,3 @@ Source: fmt -Version: 3.0.1-2 +Version: 3.0.1-3 Description: Formatting library for C++. It can be used as a safe alternative to printf or as a fast alternative to IOStreams. diff --git a/ports/fmt/portfile.cmake b/ports/fmt/portfile.cmake index 3ea33e77901..5fbbcc12ed9 100644 --- a/ports/fmt/portfile.cmake +++ b/ports/fmt/portfile.cmake @@ -13,6 +13,7 @@ vcpkg_extract_source_archive(${ARCHIVE_FILE}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DFMT_CMAKE_DIR=share/fmt -DFMT_TEST=OFF diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 6d7cfe6434d..2e73a72d609 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -1,7 +1,7 @@ function(vcpkg_build_cmake) cmake_parse_arguments(_bc "MSVC_64_TOOLSET;DISABLE_PARALLEL" "" "" ${ARGN}) - set(MSVC_EXTRA_ARGS) + set(MSVC_EXTRA_ARGS /p:VCPkgLocalAppDataDisabled=true) # Specifies the architecture of the toolset, NOT the architecture of the produced binary if (_bc_MSVC_64_TOOLSET) @@ -12,9 +12,15 @@ function(vcpkg_build_cmake) list(APPEND MSVC_EXTRA_ARGS "/m") endif() + if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/build.ninja) + set(BUILD_ARGS -v) # verbose output + else() + set(BUILD_ARGS ${MSVC_EXTRA_ARGS}) + endif() + message(STATUS "Build ${TARGET_TRIPLET}-rel") vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Release -- /p:VCPkgLocalAppDataDisabled=true ${MSVC_EXTRA_ARGS} + COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${BUILD_ARGS} WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel LOGNAME build-${TARGET_TRIPLET}-rel ) @@ -22,7 +28,7 @@ function(vcpkg_build_cmake) message(STATUS "Build ${TARGET_TRIPLET}-dbg") vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Debug -- /p:VCPkgLocalAppDataDisabled=true ${MSVC_EXTRA_ARGS} + COMMAND ${CMAKE_COMMAND} --build . --config Debug -- ${BUILD_ARGS} WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg LOGNAME build-${TARGET_TRIPLET}-dbg ) diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index fbebe13a49f..42570226fc7 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -1,6 +1,5 @@ -find_program(vcpkg_configure_cmake_NINJA ninja) function(vcpkg_configure_cmake) - cmake_parse_arguments(_csc "" "SOURCE_PATH;GENERATOR" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN}) + cmake_parse_arguments(_csc "PREFER_NINJA" "SOURCE_PATH;GENERATOR" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN}) if(NOT VCPKG_PLATFORM_TOOLSET) message(FATAL_ERROR "Vcpkg has been updated with VS2017 support, however you need to rebuild vcpkg.exe by re-running bootstrap.ps1\n powershell -exec bypass scripts\\bootstrap.ps1\n") @@ -8,14 +7,14 @@ function(vcpkg_configure_cmake) if(_csc_GENERATOR) set(GENERATOR ${_csc_GENERATOR}) + elseif(_csc_PREFER_NINJA AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(GENERATOR "Ninja") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 Win64") elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 ARM") - # elseif(NOT vcpkg_configure_cmake_NINJA MATCHES "NOTFOUND") - # set(GENERATOR "Ninja") elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") @@ -36,6 +35,13 @@ function(vcpkg_configure_cmake) elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm") set(GENERATOR "Visual Studio 15 2017 ARM" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") endif() + + # If we use Ninja, make sure it's on PATH + if(GENERATOR STREQUAL "Ninja") + vcpkg_find_acquire_program(NINJA) + get_filename_component(NINJA_PATH ${NINJA} DIRECTORY) + set(ENV{PATH} "${NINJA_PATH};$ENV{PATH}") + endif() file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index cd4a554f472..04429138293 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -4,6 +4,7 @@ function(vcpkg_find_acquire_program VAR) endif() unset(NOEXTRACT) + unset(SUBDIR) if(VAR MATCHES "PERL") set(PROGNAME perl) @@ -63,6 +64,13 @@ function(vcpkg_find_acquire_program VAR) set(URL "http://7-zip.org/a/7z1604.msi") set(ARCHIVE "7z1604.msi") set(HASH 556f95f7566fe23704d136239e4cf5e2a26f939ab43b44145c91b70d031a088d553e5c21301f1242a2295dcde3143b356211f0108c68e65eef8572407618326d) + elseif(VAR MATCHES "NINJA") + set(PROGNAME ninja) + set(SUBDIR "ninja-1.7.2") + set(PATHS ${DOWNLOADS}/tools/ninja/${SUBDIR}) + set(URL "https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip") + set(ARCHIVE "ninja-win.zip") + set(HASH cccab9281b274c564f9ad77a2115be1f19be67d7b2ee14a55d1db1b27f3b68db8e76076e4f804b61eb8e573e26a8ecc9985675a8dcf03fd7a77b7f57234f1393) else() message(FATAL "unknown tool ${VAR} -- unable to acquire.") endif() @@ -73,15 +81,15 @@ function(vcpkg_find_acquire_program VAR) EXPECTED_HASH SHA512=${HASH} SHOW_PROGRESS ) - file(MAKE_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}) + file(MAKE_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}) if(DEFINED NOEXTRACT) - file(COPY ${DOWNLOADS}/${ARCHIVE} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}) + file(COPY ${DOWNLOADS}/${ARCHIVE} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}) else() get_filename_component(ARCHIVE_EXTENSION ${ARCHIVE} EXT) string(TOLOWER "${ARCHIVE_EXTENSION}" ARCHIVE_EXTENSION) if(${ARCHIVE_EXTENSION} STREQUAL ".msi") file(TO_NATIVE_PATH "${DOWNLOADS}/${ARCHIVE}" ARCHIVE_NATIVE_PATH) - file(TO_NATIVE_PATH "${DOWNLOADS}/tools/${PROGNAME}" DESTINATION_NATIVE_PATH) + file(TO_NATIVE_PATH "${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}" DESTINATION_NATIVE_PATH) execute_process( COMMAND msiexec /a ${ARCHIVE_NATIVE_PATH} /qn TARGETDIR=${DESTINATION_NATIVE_PATH} WORKING_DIRECTORY ${DOWNLOADS} @@ -89,7 +97,7 @@ function(vcpkg_find_acquire_program VAR) else() execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf ${DOWNLOADS}/${ARCHIVE} - WORKING_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME} + WORKING_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR} ) endif() endif() diff --git a/scripts/cmake/vcpkg_install_cmake.cmake b/scripts/cmake/vcpkg_install_cmake.cmake index f29f3ce5dbe..5997fa76424 100644 --- a/scripts/cmake/vcpkg_install_cmake.cmake +++ b/scripts/cmake/vcpkg_install_cmake.cmake @@ -1,7 +1,7 @@ function(vcpkg_install_cmake) cmake_parse_arguments(_bc "MSVC_64_TOOLSET;DISABLE_PARALLEL" "" "" ${ARGN}) - set(MSVC_EXTRA_ARGS) + set(MSVC_EXTRA_ARGS /p:VCPkgLocalAppDataDisabled=true) # Specifies the architecture of the toolset, NOT the architecture of the produced binary if (_bc_MSVC_64_TOOLSET) @@ -11,10 +11,16 @@ function(vcpkg_install_cmake) if (NOT _bc_DISABLE_PARALLEL) list(APPEND MSVC_EXTRA_ARGS "/m") endif() + + if(EXISTS ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/build.ninja) + set(BUILD_ARGS -v) # verbose output + else() + set(BUILD_ARGS ${MSVC_EXTRA_ARGS}) + endif() message(STATUS "Package ${TARGET_TRIPLET}-rel") vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Release --target install -- /p:VCPkgLocalAppDataDisabled=true ${MSVC_EXTRA_ARGS} + COMMAND ${CMAKE_COMMAND} --build . --config Release --target install -- ${BUILD_ARGS} WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel LOGNAME package-${TARGET_TRIPLET}-rel ) @@ -22,7 +28,7 @@ function(vcpkg_install_cmake) message(STATUS "Package ${TARGET_TRIPLET}-dbg") vcpkg_execute_required_process( - COMMAND ${CMAKE_COMMAND} --build . --config Debug --target install -- /p:VCPkgLocalAppDataDisabled=true ${MSVC_EXTRA_ARGS} + COMMAND ${CMAKE_COMMAND} --build . --config Debug --target install -- ${BUILD_ARGS} WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg LOGNAME package-${TARGET_TRIPLET}-dbg ) diff --git a/scripts/templates/portfile.in.cmake b/scripts/templates/portfile.in.cmake index c848b6445bd..ef72431ff4a 100644 --- a/scripts/templates/portfile.in.cmake +++ b/scripts/templates/portfile.in.cmake @@ -17,6 +17,7 @@ vcpkg_extract_source_archive(${ARCHIVE}) 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 From a923738dab74e0b2f1a611cac162d71efd9aaee2 Mon Sep 17 00:00:00 2001 From: flysha Date: Sun, 5 Feb 2017 18:28:50 +0800 Subject: [PATCH 007/137] add sqlite-modern-cpp https://github.com/aminroosta/sqlite_modern_cpp --- ports/sqlite-modern-cpp/CONTROL | 3 +++ ports/sqlite-modern-cpp/portfile.cmake | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 ports/sqlite-modern-cpp/CONTROL create mode 100644 ports/sqlite-modern-cpp/portfile.cmake diff --git a/ports/sqlite-modern-cpp/CONTROL b/ports/sqlite-modern-cpp/CONTROL new file mode 100644 index 00000000000..5b16bd9dc41 --- /dev/null +++ b/ports/sqlite-modern-cpp/CONTROL @@ -0,0 +1,3 @@ +Source: sqlite-modern-cpp +Version: 2.4 +Description: The C++14 wrapper around sqlite library diff --git a/ports/sqlite-modern-cpp/portfile.cmake b/ports/sqlite-modern-cpp/portfile.cmake new file mode 100644 index 00000000000..a7b0f81eddc --- /dev/null +++ b/ports/sqlite-modern-cpp/portfile.cmake @@ -0,0 +1,21 @@ +# header only +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/sqlite_modern_cpp-2.4) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/aminroosta/sqlite_modern_cpp/archive/v2.4.tar.gz" + FILENAME "sqlite_modern_cpp-2.4.tar.gz" + SHA512 99d8220c9dcbf7383c75ef8061bc792a4ea0b7e6e1290992f1604f66e77fcb5055af8c54c2d82b6a8d331359e2829d987b7528208f032f32699e1349296792db +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(INSTALL ${SOURCE_PATH}/hdr/ DESTINATION ${CURRENT_PACKAGES_DIR}/include) + +# Handle copyright +message("Download license...") +vcpkg_download_distfile(LICENSE + URLS https://raw.githubusercontent.com/aminroosta/sqlite_modern_cpp/1d7747fcbb16325ec6673477b06f0c780de24a27/License.txt + FILENAME "sqlite_modern_cpp-2.4-license-mit.txt" + SHA512 4ffc41d14902b37841463b9e9274537cb48523a7ab7e5fbbbd14a01820d141e367851b0496aa18546ddab96100e7381db7fc35621c795a97c3290b618e18a8bd +) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/sqlite-modern-cpp) +file(RENAME ${LICENSE} ${CURRENT_PACKAGES_DIR}/share/sqlite-modern-cpp/copyright) From 0bbae46a9cae7edcee9fe613d1f59e4c20af8af6 Mon Sep 17 00:00:00 2001 From: flysha Date: Sun, 5 Feb 2017 18:30:37 +0800 Subject: [PATCH 008/137] [sqlite-modern-cpp] add build-depends --- ports/sqlite-modern-cpp/CONTROL | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/sqlite-modern-cpp/CONTROL b/ports/sqlite-modern-cpp/CONTROL index 5b16bd9dc41..641b3229cab 100644 --- a/ports/sqlite-modern-cpp/CONTROL +++ b/ports/sqlite-modern-cpp/CONTROL @@ -1,3 +1,4 @@ Source: sqlite-modern-cpp Version: 2.4 +Build-Depends: sqlite3 Description: The C++14 wrapper around sqlite library From 8c322ca613a51798741812dc4d0125dc9324b448 Mon Sep 17 00:00:00 2001 From: Max Smolens Date: Tue, 7 Feb 2017 15:30:19 -0500 Subject: [PATCH 009/137] [grpc] Fix exported targets Fix gRPC's exported targets. Now CMake projects can do: find_package(gRPC CONFIG REQUIRED) and then use the exported targets such as gRPC::grpc and gRPC::grpc++. Additionally, install gRPC tools and protoc plugins into the 'tools' directory. The plugins are required to generate gRPC client and server interfaces from .proto service definitions. --- ports/grpc/portfile.cmake | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/ports/grpc/portfile.cmake b/ports/grpc/portfile.cmake index ffd71d13755..9c4ddbc0670 100644 --- a/ports/grpc/portfile.cmake +++ b/ports/grpc/portfile.cmake @@ -48,12 +48,33 @@ vcpkg_install_cmake() file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/grpc) file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCConfig.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCConfig.cmake) file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCConfigVersion.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCConfigVersion.cmake) -file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets.cmake) -file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets-release.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-release.cmake) -file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/gRPC/gRPCTargets-debug.cmake ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-debug.cmake) + +# Update import target prefix in gRPCTargets.cmake +file(READ ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets.cmake _contents) +set(pattern "get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\n") +string(REPLACE "${pattern}${pattern}" "${pattern}" _contents "${_contents}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets.cmake "${_contents}") + +# Update paths in gRPCTargets-release.cmake +file(READ ${CURRENT_PACKAGES_DIR}/lib/cmake/gRPC/gRPCTargets-release.cmake _contents) +string(REPLACE "\${_IMPORT_PREFIX}/bin/" "\${_IMPORT_PREFIX}/tools/" _contents "${_contents}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-release.cmake "${_contents}") + +# Update paths in gRPCTargets-debug.cmake +file(READ ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/gRPC/gRPCTargets-debug.cmake _contents) +string(REPLACE "\${_IMPORT_PREFIX}/bin/" "\${_IMPORT_PREFIX}/tools/" _contents "${_contents}") +string(REPLACE "\${_IMPORT_PREFIX}/lib/" "\${_IMPORT_PREFIX}/debug/lib/" _contents "${_contents}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-debug.cmake "${_contents}") file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/grpc RENAME copyright) +# Install tools and plugins +file( + INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/ + DESTINATION ${CURRENT_PACKAGES_DIR}/tools + FILES_MATCHING PATTERN "*.exe" +) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) From 8c6320916711e5ac77ef16f17ab5c6a09737939e Mon Sep 17 00:00:00 2001 From: Albert Ziegenhagel Date: Wed, 8 Feb 2017 11:12:18 +0100 Subject: [PATCH 010/137] Updated msmpi version to 8.0 & implemented checks for installed redistributable packages --- ports/msmpi/CONTROL | 2 +- ports/msmpi/portfile.cmake | 110 ++++++++++++++++++++++--------------- 2 files changed, 67 insertions(+), 45 deletions(-) diff --git a/ports/msmpi/CONTROL b/ports/msmpi/CONTROL index 3d55547a293..44752712a8c 100644 --- a/ports/msmpi/CONTROL +++ b/ports/msmpi/CONTROL @@ -1,3 +1,3 @@ Source: msmpi -Version: 7.1 +Version: 8.0 Description: Microsoft MPI diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index 9fc169a286d..b59a2f590bd 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -1,19 +1,54 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/msmpi-7.1) - -vcpkg_find_acquire_program(7Z) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/msmpi-8.0) vcpkg_download_distfile(SDK_ARCHIVE - URLS "https://download.microsoft.com/download/E/8/A/E8A080AF-040D-43FF-97B4-065D4F220301/msmpisdk.msi" - FILENAME "msmpisdk-7.1.msi" - SHA512 e3b479189e0effc83c030c74ac6e6762f577cfa94bffb2b35192aab3329b5cfad7933c353c0304754e6b097912b81dbfd4d4b52a5fe5563bd4f3578cd1cf71d7 -) -vcpkg_download_distfile(REDIST_ARCHIVE - URLS "https://download.microsoft.com/download/E/8/A/E8A080AF-040D-43FF-97B4-065D4F220301/MSMpiSetup.exe" - FILENAME "MSMpiSetup-7.1.exe" - SHA512 f75c448e49b1ab4f5e60c958f0c7c1766e06665d65d2bdec42578aa77fb9d5fdc0215cee6ec51909e77d13451490bfff1c324bf9eb4311cb886b98a6ad469a2d + URLS "https://download.microsoft.com/download/B/2/E/B2EB83FE-98C2-4156-834A-E1711E6884FB/msmpisdk.msi" + FILENAME "msmpisdk-8.0.msi" + SHA512 49c762873ba777ccb3c959a1d2ca1392e4c3c8d366e604ad707184ea432302e6649894ec6599162d0d40f3e6ebc0dada1eb9ca0da1cde0f6ba7a9b1847dac8c0 ) +# Check for correct version of installed redistributable package +set(SYSTEM_MPIEXEC_FILEPATH "$ENV{PROGRAMFILES}/Microsoft MPI/Bin/mpiexec.exe") +set(MSMPI_EXPECTED_FULL_VERSION "8.0.12438.0") + +if(EXISTS ${SYSTEM_MPIEXEC_FILEPATH}) + set(MPIEXEC_VERSION_LOGNAME "mpiexec-version") + vcpkg_execute_required_process( + COMMAND ${SYSTEM_MPIEXEC_FILEPATH} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} + LOGNAME ${MPIEXEC_VERSION_LOGNAME} + ) + file(READ ${CURRENT_BUILDTREES_DIR}/${MPIEXEC_VERSION_LOGNAME}-out.log MPIEXEC_OUTPUT) + + if(${MPIEXEC_OUTPUT} MATCHES "\\[Version ([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)\\]") + if(NOT ${CMAKE_MATCH_1} STREQUAL ${MSMPI_EXPECTED_FULL_VERSION}) + message(FATAL_ERROR + " The version of the installed MSMPI redistributable packages does not match the version to be installed\n" + " Expected version: ${MSMPI_EXPECTED_FULL_VERSION}\n" + " Found version: ${CMAKE_MATCH_1}\n") + endif() + else() + message(FATAL_ERROR + " Could not determine installed MSMPI redistributable package version.\n" + " See logs for more information:\n" + " ${CURRENT_BUILDTREES_DIR}\\${MPIEXEC_VERSION_LOGNAME}-out.log\n" + " ${CURRENT_BUILDTREES_DIR}\\${MPIEXEC_VERSION_LOGNAME}-err.log\n") + endif() +else() + vcpkg_download_distfile(REDIST_ARCHIVE + URLS "https://download.microsoft.com/download/B/2/E/B2EB83FE-98C2-4156-834A-E1711E6884FB/MSMpiSetup.exe" + FILENAME "MSMpiSetup-8.0.exe" + SHA512 f5271255817f5417de8e432cd21e5ff3c617911a30b7777560c0ceb6f4031ace5fa88fc7675759ae0964bcf4e2076fe367a06c129f3a9ad06871a08bf95ed68b + ) + + message(FATAL_ERROR + " Could not find:\n" + " ${SYSTEM_MPIEXEC_FILEPATH}\n" + " Please install the MSMPI redistributable package before trying to install this port.\n" + " The appropriate installer has been downloaded to:\n" + " ${REDIST_ARCHIVE}\n") +endif() + file(TO_NATIVE_PATH "${SDK_ARCHIVE}" SDK_ARCHIVE) file(TO_NATIVE_PATH "${SOURCE_PATH}/sdk" SDK_SOURCE_DIR) @@ -23,30 +58,23 @@ vcpkg_execute_required_process( LOGNAME extract-sdk ) -vcpkg_execute_required_process( - COMMAND ${7Z} e -o${SOURCE_PATH}/redist -aoa ${REDIST_ARCHIVE} - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} - LOGNAME extract-redist -) - set(SOURCE_INCLUDE_PATH "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/Include") set(SOURCE_LIB_PATH "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/Lib") -set(SOURCE_BIN_PATH "${SOURCE_PATH}/redist") # Install include files file(INSTALL "${SOURCE_INCLUDE_PATH}/mpi.h" "${SOURCE_INCLUDE_PATH}/mpif.h" "${SOURCE_INCLUDE_PATH}/mpi.f90" + "${SOURCE_INCLUDE_PATH}/mpio.h" + "${SOURCE_INCLUDE_PATH}/mspms.h" + "${SOURCE_INCLUDE_PATH}/pmidbg.h" "${SOURCE_INCLUDE_PATH}/${TRIPLET_SYSTEM_ARCH}/mpifptr.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include ) -# NOTE: we do not install the dlls here since they are not architecture independent (x86 only) -# and they seam not to be required by neither mpiexec nor programs build against msmpi.lib - -# Install release libraries and tools +# Install release libraries file(INSTALL "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpi.lib" "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifec.lib" @@ -54,12 +82,14 @@ file(INSTALL DESTINATION ${CURRENT_PACKAGES_DIR}/lib ) -# file(INSTALL -# "${SOURCE_BIN_PATH}/msmpi.dll" -# "${SOURCE_BIN_PATH}/msmpires.dll" -# DESTINATION -# ${CURRENT_PACKAGES_DIR}/bin -# ) +if(${TRIPLET_SYSTEM_ARCH} STREQUAL "x86") + file(INSTALL + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifes.lib" + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifms.lib" + DESTINATION + ${CURRENT_PACKAGES_DIR}/lib + ) +endif() # Install debug libraries # NOTE: since the binary distribution does not include any debug libraries we simply install the release libraries @@ -70,22 +100,14 @@ file(INSTALL DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib ) -# file(INSTALL -# "${SOURCE_BIN_PATH}/msmpi.dll" -# "${SOURCE_BIN_PATH}/msmpires.dll" -# DESTINATION -# ${CURRENT_PACKAGES_DIR}/debug/bin -# ) - -# Install tools -file(INSTALL - "${SOURCE_BIN_PATH}/mpiexec.exe" - "${SOURCE_BIN_PATH}/msmpilaunchsvc.exe" - "${SOURCE_BIN_PATH}/smpd.exe" - "${SOURCE_BIN_PATH}/mpitrace.man" - DESTINATION - ${CURRENT_PACKAGES_DIR}/tools -) +if(${TRIPLET_SYSTEM_ARCH} STREQUAL "x86") + file(INSTALL + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifes.lib" + "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifms.lib" + DESTINATION + ${CURRENT_PACKAGES_DIR}/debug/lib + ) +endif() # Handle copyright file(COPY "${SOURCE_PATH}/sdk/PFiles/Microsoft SDKs/MPI/License/license_sdk.rtf" DESTINATION ${CURRENT_PACKAGES_DIR}/share/msmpi) From 81dd967f0d2e150d028b23ac6953afb58d531218 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 8 Feb 2017 16:01:22 -0800 Subject: [PATCH 011/137] Fix warning about default constructor --- toolsrc/src/PostBuildLint.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index 90bd5584353..37db0b8b632 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -546,6 +546,8 @@ namespace vcpkg::PostBuildLint { fs::path file; OutdatedDynamicCrt outdated_crt; + + OutdatedDynamicCrt_and_file() = delete; }; static lint_status check_outdated_crt_linkage_of_dlls(const std::vector& dlls, const fs::path dumpbin_exe) From 52ebf3944d1a0aa276472f50e47de9fa61429a7c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 8 Feb 2017 16:13:27 -0800 Subject: [PATCH 012/137] Format --- toolsrc/src/PostBuildLint.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index 37db0b8b632..ac339698402 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -22,7 +22,8 @@ namespace vcpkg::PostBuildLint std::regex regex; OutdatedDynamicCrt(const std::string& name, const std::string& regex_as_string) - : name(name), regex(std::regex(regex_as_string, std::regex_constants::icase)) {} + : name(name), + regex(std::regex(regex_as_string, std::regex_constants::icase)) {} }; const std::vector& get_outdated_dynamic_crts() From 8316692e32380528dfa381329f516a121bd6b533 Mon Sep 17 00:00:00 2001 From: Felix Huang Date: Wed, 8 Feb 2017 16:39:16 -0800 Subject: [PATCH 013/137] [libraw] update to version 0.18.0 --- ports/libraw/CONTROL | 2 +- ports/libraw/portfile.cmake | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/libraw/CONTROL b/ports/libraw/CONTROL index b10e10794d2..9bb52aae0ee 100644 --- a/ports/libraw/CONTROL +++ b/ports/libraw/CONTROL @@ -1,4 +1,4 @@ Source: libraw -Version: 0.17.2-2 +Version: 0.18.0-1 Build-Depends: libjpeg-turbo Description: raw image decoder library diff --git a/ports/libraw/portfile.cmake b/ports/libraw/portfile.cmake index 159251c280c..2e25ec714a3 100644 --- a/ports/libraw/portfile.cmake +++ b/ports/libraw/portfile.cmake @@ -1,9 +1,9 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/LibRaw-0.17.2) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/LibRaw-0.18.0) vcpkg_download_distfile(ARCHIVE - URLS "http://www.libraw.org/data/LibRaw-0.17.2.zip" - FILENAME "LibRaw-0.17.2" - SHA512 97d34c84dafdcad300d607fbd4df7b120aea1ecdbc2783a8616bc423fa6a7a15adfbeb975f8dab021be09d08ef466c401a3b65bfd1abcfa49d31d4ab91873e60 + URLS "http://www.libraw.org/data/LibRaw-0.18.0.zip" + FILENAME "LibRaw-0.18.0.zip" + SHA512 c66ae2331caffe18c2835d76d6106052125fab2f549a6f06687b4c1fedaae1c46ee0e4ae4c23b0480976870d76e8cfdbb91dd3cf11e3433ccc070bf03c538bb1 ) set(LIBRAW_CMAKE_COMMIT "a71f3b83ee3dccd7be32f9a2f410df4d9bdbde0a") set(LIBRAW_CMAKE_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/LibRaw-cmake-${LIBRAW_CMAKE_COMMIT}) From 116b1b8c66afbe11719c42d03d342bb6fe5d58b0 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 8 Feb 2017 17:39:31 -0800 Subject: [PATCH 014/137] Reorder path alterations to generally append instead of prepend. This solves the issue where some software bundles (git) provide multiple executables in the same folder, which can override other desired programs (link.exe). --- ports/libjpeg-turbo/portfile.cmake | 2 +- ports/mpg123/portfile.cmake | 2 +- ports/openssl/portfile-uwp.cmake | 2 +- ports/openssl/portfile.cmake | 2 +- ports/qca/portfile.cmake | 2 +- ports/qt5/portfile.cmake | 2 +- scripts/cmake/vcpkg_configure_cmake.cmake | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ports/libjpeg-turbo/portfile.cmake b/ports/libjpeg-turbo/portfile.cmake index aaa01547c5f..b58ba01edec 100644 --- a/ports/libjpeg-turbo/portfile.cmake +++ b/ports/libjpeg-turbo/portfile.cmake @@ -14,7 +14,7 @@ vcpkg_apply_patches( vcpkg_find_acquire_program(NASM) get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY) -set(ENV{PATH} "${NASM_EXE_PATH};$ENV{PATH}") +set(ENV{PATH} "$ENV{PATH};${NASM_EXE_PATH}") if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) set(BUILD_STATIC OFF) diff --git a/ports/mpg123/portfile.cmake b/ports/mpg123/portfile.cmake index 0308bb17e8e..76b69c48b3e 100644 --- a/ports/mpg123/portfile.cmake +++ b/ports/mpg123/portfile.cmake @@ -13,7 +13,7 @@ vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_find_acquire_program(YASM) get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) -set(ENV{PATH} "${YASM_EXE_PATH};$ENV{PATH}") +set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH}") vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} diff --git a/ports/openssl/portfile-uwp.cmake b/ports/openssl/portfile-uwp.cmake index 289c549fc39..cf2f1e7ca08 100644 --- a/ports/openssl/portfile-uwp.cmake +++ b/ports/openssl/portfile-uwp.cmake @@ -30,7 +30,7 @@ set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-OpenSSL_1_0_2k_WinRT) vcpkg_find_acquire_program(PERL) get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) -set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}") +set(ENV{PATH} "$ENV{PATH};${PERL_EXE_PATH}") vcpkg_download_distfile(ARCHIVE URLS "https://github.com/Microsoft/openssl/archive/OpenSSL_1_0_2k_WinRT.zip" diff --git a/ports/openssl/portfile.cmake b/ports/openssl/portfile.cmake index b132581198f..0422789431e 100644 --- a/ports/openssl/portfile.cmake +++ b/ports/openssl/portfile.cmake @@ -10,7 +10,7 @@ vcpkg_find_acquire_program(PERL) find_program(NMAKE nmake) get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) -set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}") +set(ENV{PATH} "$ENV{PATH};${PERL_EXE_PATH}") vcpkg_download_distfile(OPENSSL_SOURCE_ARCHIVE URLS "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" diff --git a/ports/qca/portfile.cmake b/ports/qca/portfile.cmake index 072c4b7cb44..6ad35d1f775 100644 --- a/ports/qca/portfile.cmake +++ b/ports/qca/portfile.cmake @@ -15,7 +15,7 @@ include(vcpkg_common_functions) find_program(GIT git) vcpkg_find_acquire_program(PERL) get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) -set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}") +set(ENV{PATH} "$ENV{PATH};${PERL_EXE_PATH}") # Set git variables to qca version 2.2.0 commit set(GIT_URL "git://anongit.kde.org/qca.git") diff --git a/ports/qt5/portfile.cmake b/ports/qt5/portfile.cmake index 2b337df02be..df17621f184 100644 --- a/ports/qt5/portfile.cmake +++ b/ports/qt5/portfile.cmake @@ -12,7 +12,7 @@ vcpkg_find_acquire_program(PYTHON3) get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY) get_filename_component(JOM_EXE_PATH ${JOM} DIRECTORY) -set(ENV{PATH} "${JOM_EXE_PATH};${PYTHON3_EXE_PATH};${PERL_EXE_PATH};$ENV{PATH}") +set(ENV{PATH} "${JOM_EXE_PATH};${PYTHON3_EXE_PATH};$ENV{PATH};${PERL_EXE_PATH}") set(ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include;$ENV{INCLUDE}") set(ENV{LIB} "${CURRENT_INSTALLED_DIR}/lib;$ENV{LIB}") vcpkg_download_distfile(ARCHIVE_FILE diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 42570226fc7..85a67a4019a 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -40,7 +40,7 @@ function(vcpkg_configure_cmake) if(GENERATOR STREQUAL "Ninja") vcpkg_find_acquire_program(NINJA) get_filename_component(NINJA_PATH ${NINJA} DIRECTORY) - set(ENV{PATH} "${NINJA_PATH};$ENV{PATH}") + set(ENV{PATH} "$ENV{PATH};${NINJA_PATH}") endif() file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) From 6af35363b8c9c768fe6c298605b1647a522229b2 Mon Sep 17 00:00:00 2001 From: Christopher Warrington Date: Wed, 8 Feb 2017 19:34:55 -0800 Subject: [PATCH 015/137] Upgrade Bond to 5.2.0 * Make Bond always build as a static lib. * Bond's CMake currently isn't written to be able to produce DLLs. There's a special dllimport/dllexport dance that would need to be done. * Apply patch so that Bond doesn't force Boost static libs. * Apply patch to omit installing Bond's copy of rapidjson. * Clean up empty bin/ directories, now that vcpkg is more strict. --- ports/bond/0001_boost_static_libs.patch | 23 +++++++++++++++ ports/bond/0002_omit_rapidjson.patch | 12 ++++++++ ports/bond/CONTROL | 2 +- ports/bond/portfile.cmake | 37 +++++++++++++++++-------- 4 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 ports/bond/0001_boost_static_libs.patch create mode 100644 ports/bond/0002_omit_rapidjson.patch diff --git a/ports/bond/0001_boost_static_libs.patch b/ports/bond/0001_boost_static_libs.patch new file mode 100644 index 00000000000..cc712b6c7b0 --- /dev/null +++ b/ports/bond/0001_boost_static_libs.patch @@ -0,0 +1,23 @@ +diff --git a/cmake/Config.cmake b/cmake/Config.cmake +index ed225d14..1573c915 100644 +--- a/cmake/Config.cmake ++++ b/cmake/Config.cmake +@@ -19,7 +19,7 @@ if (MSVC) + # disable MSVC warnings + add_compile_options (/bigobj /FIbond/core/warning.h /W4 /WX) + add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) +- set (Boost_USE_STATIC_LIBS ON) ++ set (Boost_USE_STATIC_LIBS OFF) + endif (MSVC) + + if (WIN32) +@@ -90,9 +90,6 @@ if (DEFINED ENV{APPVEYOR} AND ("$ENV{BOND_BUILD}" STREQUAL "C++")) + endif() + endif() + +-# disable Boost auto-linking +-add_definitions (-DBOOST_ALL_NO_LIB) +- + # VS2015U2 fixed a bug with atomics and emits a warning without this definition. + add_definitions (-D_ENABLE_ATOMIC_ALIGNMENT_FIX) + diff --git a/ports/bond/0002_omit_rapidjson.patch b/ports/bond/0002_omit_rapidjson.patch new file mode 100644 index 00000000000..3e4a0571b30 --- /dev/null +++ b/ports/bond/0002_omit_rapidjson.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0d743da4..92f91103 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -39,7 +39,6 @@ install (DIRECTORY + cpp/inc/bond + cpp/generated/bond + python/inc/bond +- thirdparty/rapidjson/include/rapidjson + DESTINATION include + PATTERN *.cpp EXCLUDE) + diff --git a/ports/bond/CONTROL b/ports/bond/CONTROL index 70384f0200f..0e804025ab4 100644 --- a/ports/bond/CONTROL +++ b/ports/bond/CONTROL @@ -1,5 +1,5 @@ Source: bond Maintainer: bond@microsoft.com -Version: 5.0.0-4-g53ea136 +Version: 5.2.0 Description: Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services. Build-Depends: boost, rapidjson diff --git a/ports/bond/portfile.cmake b/ports/bond/portfile.cmake index 8dbf7cf5357..0225a263fbd 100644 --- a/ports/bond/portfile.cmake +++ b/ports/bond/portfile.cmake @@ -1,16 +1,29 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) endif() + include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bond-53ea13692925bee4ba494ee9de3614f15c09d85d) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bond-5.2.0) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/Microsoft/bond/archive/53ea13692925bee4ba494ee9de3614f15c09d85d.zip" - FILENAME "bond-5.0.0-4-g53ea136.zip" - SHA512 fe39dc211f6b99cba3f2284d78a524305dfb8dcd1f597639c45625df369f96c3321cb6782fef9eb34d34fab69c8da9015024eee34be6d0a76d730729517183da -) + URLS "https://github.com/Microsoft/bond/archive/5.2.0.zip" + FILENAME "bond-5.2.0.zip" + SHA512 bc533d9e7431d0690b555aa4a42ca947f8025fc388f698c40cfeacf4286892ac5fd86d93df187009d4791e3eae240eb60886947cfe600838c6058274eb4d625c + ) + vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + # Change Boost_USE_STATIC_LIBS to be compatible with vcpkg's treatment + # of Boost + ${CMAKE_CURRENT_LIST_DIR}/0001_boost_static_libs.patch + # Don't install rapidjson from the (empty) submodule. With vcpkg, we get + # rapidjson from vcpkg + ${CMAKE_CURRENT_LIST_DIR}/0002_omit_rapidjson.patch +) + # To build Bond, you'll either need to have the Haskell toolchain installed # or set the environment variable BOND_GBC_PATH to point to a directory that # contains a pre-compiled version of gbc.exe. @@ -35,10 +48,10 @@ file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/bond) file(RENAME ${CURRENT_PACKAGES_DIR}/share/bond/LICENSE ${CURRENT_PACKAGES_DIR}/share/bond/copyright) # vcpkg doesn't--as of version 0.0.30--like executables such as gbc.exe in -# the output. Just delete it for now. -file(REMOVE - ${CURRENT_PACKAGES_DIR}/bin/gbc.exe - ${CURRENT_PACKAGES_DIR}/debug/bin/gbc.exe) +# the output. Just delete the bin/ directories for now. +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/bin/ + ${CURRENT_PACKAGES_DIR}/debug/bin/) # There's no way to supress installation of the headers in the debug build, # so we just delete them. From bef39cd24f44314936d416d577a1650411d84e24 Mon Sep 17 00:00:00 2001 From: Christopher Warrington Date: Wed, 8 Feb 2017 19:35:04 -0800 Subject: [PATCH 016/137] Fetch a pre-compiled gbc from GitHub The BOND_GBC_PATH environment variable is no longer consulted, and the Haskell toolchain will _not_ be used even if it exists. At the moment, the downloaded gbc is amd64 only. --- ports/bond/portfile.cmake | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/ports/bond/portfile.cmake b/ports/bond/portfile.cmake index 0225a263fbd..ca9ff156b09 100644 --- a/ports/bond/portfile.cmake +++ b/ports/bond/portfile.cmake @@ -5,14 +5,28 @@ endif() include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bond-5.2.0) + vcpkg_download_distfile(ARCHIVE URLS "https://github.com/Microsoft/bond/archive/5.2.0.zip" FILENAME "bond-5.2.0.zip" SHA512 bc533d9e7431d0690b555aa4a42ca947f8025fc388f698c40cfeacf4286892ac5fd86d93df187009d4791e3eae240eb60886947cfe600838c6058274eb4d625c - ) +) +vcpkg_download_distfile(GBC_ARCHIVE + URLS "https://github.com/Microsoft/bond/releases/download/5.2.0/gbc-5.2.0-amd64.zip" + FILENAME "gbc-5.2.0-amd64.zip" + SHA512 9413c0035939788724e08ac858bfc3b2ccefbba74ed737b22eca35ec0da576aa2bf8403e606d2ac20b3fbc827933c289630266824613e04b1921b66fef00e132 +) vcpkg_extract_source_archive(${ARCHIVE}) +# Extract the precompiled gbc +vcpkg_extract_source_archive(${GBC_ARCHIVE} ${CURRENT_BUILDTREES_DIR}/tools/) +set(FETCHED_GBC_PATH ${CURRENT_BUILDTREES_DIR}/tools/gbc-5.2.0-amd64.exe) + +if (NOT EXISTS ${FETCHED_GBC_PATH}) + message(FATAL_ERROR "Fetching GBC failed. Expected '${FETCHED_GBC_PATH}' to exists, but it doesn't.") +endif() + vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES @@ -24,21 +38,11 @@ vcpkg_apply_patches( ${CMAKE_CURRENT_LIST_DIR}/0002_omit_rapidjson.patch ) -# To build Bond, you'll either need to have the Haskell toolchain installed -# or set the environment variable BOND_GBC_PATH to point to a directory that -# contains a pre-compiled version of gbc.exe. -# -# You can get a pre-compiled version of gbc from the Bond.Compiler NuGet -# package . -# -# For instructions on installing the Haskell toolchain and getting it to -# work with Bond, see the Bond README -# - vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS -DBOND_LIBRARIES_ONLY=TRUE + -DBOND_GBC_PATH=${FETCHED_GBC_PATH} ) vcpkg_install_cmake() From cd44f885732a35f1ae9c35d1248a335c0c6ac917 Mon Sep 17 00:00:00 2001 From: Christopher Warrington Date: Wed, 8 Feb 2017 19:35:08 -0800 Subject: [PATCH 017/137] Install gbc.exe to tools/ This at least allows people to write their own codegen rules until Bond includes its own. --- .../bond/0003_rename_gbc_during_install.patch | 22 +++++++++++++++++++ ports/bond/portfile.cmake | 6 +++++ 2 files changed, 28 insertions(+) create mode 100644 ports/bond/0003_rename_gbc_during_install.patch diff --git a/ports/bond/0003_rename_gbc_during_install.patch b/ports/bond/0003_rename_gbc_during_install.patch new file mode 100644 index 00000000000..edbce6c0a8a --- /dev/null +++ b/ports/bond/0003_rename_gbc_during_install.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0d743da4..72d62c5e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -49,7 +49,14 @@ install (EXPORT bond + + # if BOND_GBC_PATH is set we must copy over that gbc to the install location + if (BOND_GBC_PATH) +- install (FILES +- ${BOND_GBC_PATH} +- DESTINATION bin) ++ if (WIN32) ++ set(INSTALLED_GBC_NAME gbc.exe) ++ else() ++ set(INSTALLED_GBC_NAME gbc) ++ endif() ++ ++ install ( ++ FILES ${BOND_GBC_PATH} ++ DESTINATION bin ++ RENAME ${INSTALLED_GBC_NAME}) + endif() diff --git a/ports/bond/portfile.cmake b/ports/bond/portfile.cmake index ca9ff156b09..d806173f139 100644 --- a/ports/bond/portfile.cmake +++ b/ports/bond/portfile.cmake @@ -36,6 +36,9 @@ vcpkg_apply_patches( # Don't install rapidjson from the (empty) submodule. With vcpkg, we get # rapidjson from vcpkg ${CMAKE_CURRENT_LIST_DIR}/0002_omit_rapidjson.patch + # Temporary until this is committed upstream. See + # https://github.com/Microsoft/bond/pull/324 for details. + ${CMAKE_CURRENT_LIST_DIR}/0003_rename_gbc_during_install.patch ) vcpkg_configure_cmake( @@ -51,6 +54,9 @@ vcpkg_install_cmake() file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/bond) file(RENAME ${CURRENT_PACKAGES_DIR}/share/bond/LICENSE ${CURRENT_PACKAGES_DIR}/share/bond/copyright) +# Drop a copy of gbc in tools/ so that it can be used +file(COPY ${CURRENT_PACKAGES_DIR}/bin/gbc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools/) + # vcpkg doesn't--as of version 0.0.30--like executables such as gbc.exe in # the output. Just delete the bin/ directories for now. file(REMOVE_RECURSE From b6b69025c3c5d64f73faa3445fa3f17c967a8337 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 8 Feb 2017 19:34:19 -0800 Subject: [PATCH 018/137] bootstrap.ps1 now detects the available Windows SDKs --- scripts/bootstrap.ps1 | 3 +- scripts/findTargetPlatformVersion.ps1 | 43 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 scripts/findTargetPlatformVersion.ps1 diff --git a/scripts/bootstrap.ps1 b/scripts/bootstrap.ps1 index 98ccb40ad75..9907e31fbc0 100644 --- a/scripts/bootstrap.ps1 +++ b/scripts/bootstrap.ps1 @@ -26,7 +26,8 @@ try{ $msbuildExeWithPlatformToolset = & $scriptsDir\findAnyMSBuildWithCppPlatformToolset.ps1 $msbuildExe = $msbuildExeWithPlatformToolset[0] $platformToolset = $msbuildExeWithPlatformToolset[1] - & $msbuildExe "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=$platformToolset /m dirs.proj + $targetPlatformVersion = & $scriptsDir\findTargetPlatformVersion.ps1 + & $msbuildExe "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=$platformToolset /p:TargetPlatformVersion=$targetPlatformVersion /m dirs.proj Write-Verbose("Placing vcpkg.exe in the correct location") diff --git a/scripts/findTargetPlatformVersion.ps1 b/scripts/findTargetPlatformVersion.ps1 new file mode 100644 index 00000000000..5bc6cf854aa --- /dev/null +++ b/scripts/findTargetPlatformVersion.ps1 @@ -0,0 +1,43 @@ +[CmdletBinding()] +param( + +) + +Import-Module BitsTransfer + +$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition +$CandidateProgramFiles = "${env:PROGRAMFILES(X86)}", "${env:PROGRAMFILES}" + +# Windows 10 SDK +foreach ($ProgramFiles in $CandidateProgramFiles) +{ + $folder = "$ProgramFiles\Windows Kits\10\Include" + if (!(Test-Path $folder)) + { + continue + } + + $win10sdkVersions = Get-ChildItem $folder | Where-Object {$_.Name -match "^10"} | Sort-Object + $win10sdkVersionCount = $win10sdkVersions.Length + + if ($win10sdkVersionCount -eq 0) + { + continue + } + + return $win10sdkVersions[$win10sdkVersionCount - 1].ToString() +} + + + +# Windows 8.1 SDK +foreach ($ProgramFiles in $CandidateProgramFiles) +{ + $folder = "$ProgramFiles\Windows Kits\8.1\Include" + if (Test-Path $folder) + { + return "8.1" + } +} + +throw "Could not detect a Windows SDK / TargetPlatformVersion" \ No newline at end of file From fb080f38cb1bd673eaef9a56ca5056960e44e60e Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 8 Feb 2017 22:28:54 -0800 Subject: [PATCH 019/137] Remove unnecessary $(PlatformToolset) condition --- toolsrc/vcpkg/vcpkg.vcxproj | 2 +- toolsrc/vcpkglib/vcpkglib.vcxproj | 2 +- toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj | 2 +- toolsrc/vcpkgtest/vcpkgtest.vcxproj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/toolsrc/vcpkg/vcpkg.vcxproj b/toolsrc/vcpkg/vcpkg.vcxproj index c91bc2a751a..fd8e5d33e1b 100644 --- a/toolsrc/vcpkg/vcpkg.vcxproj +++ b/toolsrc/vcpkg/vcpkg.vcxproj @@ -22,7 +22,7 @@ {34671B80-54F9-46F5-8310-AC429C11D4FB} vcpkg 8.1 - v140 + v140 diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 2a651e294a4..ad15ea7ea74 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -22,7 +22,7 @@ {B98C92B7-2874-4537-9D46-D14E5C237F04} vcpkglib 8.1 - v140 + v140 diff --git a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj index b66b7fd9dfd..cce816ab046 100644 --- a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj +++ b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj @@ -22,7 +22,7 @@ {7D6FDEEB-B299-4A23-85EE-F67C4DED47BE} vcpkgmetricsuploader 8.1 - v140 + v140 diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj b/toolsrc/vcpkgtest/vcpkgtest.vcxproj index 224500d829d..c0a91ce50be 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj @@ -32,7 +32,7 @@ Win32Proj vcpkgtest 8.1 - v140 + v140 From 4f8e4af36321708ee0ac98a77cdc45926ad44a58 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 8 Feb 2017 22:31:04 -0800 Subject: [PATCH 020/137] Remove unneeded Import-Module --- scripts/findTargetPlatformVersion.ps1 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/findTargetPlatformVersion.ps1 b/scripts/findTargetPlatformVersion.ps1 index 5bc6cf854aa..e9d676724a4 100644 --- a/scripts/findTargetPlatformVersion.ps1 +++ b/scripts/findTargetPlatformVersion.ps1 @@ -3,8 +3,6 @@ param( ) -Import-Module BitsTransfer - $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $CandidateProgramFiles = "${env:PROGRAMFILES(X86)}", "${env:PROGRAMFILES}" @@ -28,8 +26,6 @@ foreach ($ProgramFiles in $CandidateProgramFiles) return $win10sdkVersions[$win10sdkVersionCount - 1].ToString() } - - # Windows 8.1 SDK foreach ($ProgramFiles in $CandidateProgramFiles) { From 5693ce8b4d4f522b1aeb270c2903ca07878597ae Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 8 Feb 2017 23:15:27 -0800 Subject: [PATCH 021/137] [hdf5] Enable ninja option --- ports/hdf5/portfile.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/hdf5/portfile.cmake b/ports/hdf5/portfile.cmake index a09f758b67f..5c421f0c619 100644 --- a/ports/hdf5/portfile.cmake +++ b/ports/hdf5/portfile.cmake @@ -17,6 +17,7 @@ vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=1 -DBUILD_TESTING=OFF From 68255095226847ac9de011848f876c1df6f924ab Mon Sep 17 00:00:00 2001 From: Tobias Kohlbau Date: Thu, 9 Feb 2017 08:46:46 +0100 Subject: [PATCH 022/137] [opencv] bump to 3.2.0 Signed-off-by: Tobias Kohlbau --- ports/opencv/CONTROL | 2 +- .../opencv/opencv-installation-options.patch | 101 +++++++----------- ports/opencv/portfile.cmake | 9 +- 3 files changed, 44 insertions(+), 68 deletions(-) diff --git a/ports/opencv/CONTROL b/ports/opencv/CONTROL index 74cf1d3bc57..0c9766079a1 100644 --- a/ports/opencv/CONTROL +++ b/ports/opencv/CONTROL @@ -1,4 +1,4 @@ Source: opencv -Version: 3.1.0-1 +Version: 3.2.0 Build-Depends: zlib, libpng, libjpeg-turbo, tiff Description: computer vision library diff --git a/ports/opencv/opencv-installation-options.patch b/ports/opencv/opencv-installation-options.patch index 58033463405..cfb401836e2 100644 --- a/ports/opencv/opencv-installation-options.patch +++ b/ports/opencv/opencv-installation-options.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3ee50ff..64b0405 100644 +index cc45f6f..b4265bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -250,6 +250,10 @@ OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF ) +@@ -263,6 +263,10 @@ OCV_OPTION(INSTALL_PYTHON_EXAMPLES "Install Python examples" OFF ) OCV_OPTION(INSTALL_ANDROID_EXAMPLES "Install Android examples" OFF IF ANDROID ) OCV_OPTION(INSTALL_TO_MANGLED_PATHS "Enables mangled install paths, that help with side by side installs." OFF IF (UNIX AND NOT ANDROID AND NOT APPLE_FRAMEWORK AND BUILD_SHARED_LIBS) ) OCV_OPTION(INSTALL_TESTS "Install accuracy and performance test binaries and test data" OFF) @@ -13,36 +13,18 @@ index 3ee50ff..64b0405 100644 # OpenCV build options # =================================================== -@@ -315,7 +319,9 @@ else() +@@ -330,7 +334,9 @@ else() endif() if(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows) - if(DEFINED OpenCV_RUNTIME AND DEFINED OpenCV_ARCH) + if(DEFINED OpenCV_DISABLE_ARCH_PATH) -+ set(OpenCV_INSTALL_BINARIES_PREFIX "") ++ ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "") + elseif(DEFINED OpenCV_RUNTIME AND DEFINED OpenCV_ARCH) - set(OpenCV_INSTALL_BINARIES_PREFIX "${OpenCV_ARCH}/${OpenCV_RUNTIME}/") + ocv_update(OpenCV_INSTALL_BINARIES_PREFIX "${OpenCV_ARCH}/${OpenCV_RUNTIME}/") else() message(STATUS "Can't detect runtime and/or arch") -@@ -379,7 +385,7 @@ else() - set(OPENCV_3P_LIB_INSTALL_PATH "${OpenCV_INSTALL_BINARIES_PREFIX}staticlib${LIB_SUFFIX}") - set(OPENCV_SAMPLES_SRC_INSTALL_PATH samples/native) - set(OPENCV_JAR_INSTALL_PATH java) -- set(OPENCV_OTHER_INSTALL_PATH etc) -+ set(OPENCV_OTHER_INSTALL_PATH etc CACHE STRING "") - else() - set(OPENCV_LIB_INSTALL_PATH lib${LIB_SUFFIX}) - set(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}) -@@ -393,7 +399,7 @@ else() - if(LIB_SUFFIX AND NOT SIZEOF_VOID_P_BITS EQUAL LIB_SUFFIX) - set(OPENCV_CONFIG_INSTALL_PATH lib${LIB_SUFFIX}/cmake/opencv) - else() -- set(OPENCV_CONFIG_INSTALL_PATH share/OpenCV) -+ set(OPENCV_CONFIG_INSTALL_PATH share/OpenCV CACHE STRING "") - endif() - endif() - -@@ -734,7 +740,7 @@ if(NOT OPENCV_LICENSE_FILE) +@@ -784,7 +790,7 @@ if(NOT OPENCV_LICENSE_FILE) endif() # for UNIX it does not make sense as LICENSE and readme will be part of the package automatically @@ -50,29 +32,29 @@ index 3ee50ff..64b0405 100644 +if(ANDROID OR NOT UNIX AND INSTALL_LICENSE) install(FILES ${OPENCV_LICENSE_FILE} PERMISSIONS OWNER_READ GROUP_READ WORLD_READ - DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT libs) + DESTINATION ./ COMPONENT libs) diff --git a/cmake/OpenCVGenConfig.cmake b/cmake/OpenCVGenConfig.cmake -index dbfd7ca..8bfa448 100644 +index 206acfd..b4c223e 100644 --- a/cmake/OpenCVGenConfig.cmake +++ b/cmake/OpenCVGenConfig.cmake -@@ -103,7 +103,7 @@ set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_INCLUDE_ - set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"") - set(OpenCV_3RDPARTY_LIB_DIRS_CONFIGCMAKE "\"\${OpenCV_INSTALL_PATH}/${OPENCV_3P_LIB_INSTALL_PATH}\"") +@@ -91,7 +91,7 @@ function(ocv_gen_config TMP_DIR NESTED_PATH ROOT_NAME) + endif() + endfunction() --if(UNIX) # ANDROID configuration is created here also -+if(UNIX OR INSTALL_FORCE_UNIX_PATHS) # ANDROID configuration is created here also - #http://www.vtk.org/Wiki/CMake/Tutorials/Packaging reference - # For a command "find_package( [major[.minor]] [EXACT] [REQUIRED|QUIET])" - # cmake will look in the following dir on unix: -@@ -127,7 +127,7 @@ endif() +-if(UNIX AND NOT ANDROID) ++if((UNIX AND NOT ANDROID) OR INSTALL_FORCE_UNIX_PATHS) + ocv_gen_config("${CMAKE_BINARY_DIR}/unix-install" "" "") + endif() + +@@ -103,7 +103,7 @@ endif() # -------------------------------------------------------------------------------------------- # Part 3/3: ${BIN_DIR}/win-install/OpenCVConfig.cmake -> For use within binary installers/packages # -------------------------------------------------------------------------------------------- -if(WIN32) +if(WIN32 AND NOT INSTALL_FORCE_UNIX_PATHS) - set(OpenCV_INCLUDE_DIRS_CONFIGCMAKE "\"\${OpenCV_CONFIG_PATH}/include\" \"\${OpenCV_CONFIG_PATH}/include/opencv\"") - set(OpenCV2_INCLUDE_DIRS_CONFIGCMAKE "\"\"") - + if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows) + if(BUILD_SHARED_LIBS) + set(_lib_suffix "lib") diff --git a/cmake/OpenCVGenHeaders.cmake b/cmake/OpenCVGenHeaders.cmake index 2988979..810871b 100644 --- a/cmake/OpenCVGenHeaders.cmake @@ -97,10 +79,10 @@ index 2988979..810871b 100644 + install(FILES "${OPENCV_CONFIG_FILE_INCLUDE_DIR}/opencv2/opencv_modules.hpp" DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 COMPONENT dev) +endif() diff --git a/cmake/OpenCVModule.cmake b/cmake/OpenCVModule.cmake -index 3385385..530e53f 100644 +index 742a287..c8242dd 100644 --- a/cmake/OpenCVModule.cmake +++ b/cmake/OpenCVModule.cmake -@@ -879,7 +879,9 @@ macro(_ocv_create_module) +@@ -880,7 +880,9 @@ macro(_ocv_create_module) foreach(hdr ${OPENCV_MODULE_${m}_HEADERS}) string(REGEX REPLACE "^.*opencv2/" "opencv2/" hdr2 "${hdr}") if(NOT hdr2 MATCHES "opencv2/${m}/private.*" AND hdr2 MATCHES "^(opencv2/?.*)/[^/]+.h(..)?$" ) @@ -111,19 +93,6 @@ index 3385385..530e53f 100644 endif() endforeach() endif() -diff --git a/cmake/templates/OpenCVConfig.cmake.in b/cmake/templates/OpenCVConfig.cmake.in -index 80ffbaf..0585c9f 100644 ---- a/cmake/templates/OpenCVConfig.cmake.in -+++ b/cmake/templates/OpenCVConfig.cmake.in -@@ -112,7 +112,7 @@ set(OpenCV_USE_MANGLED_PATHS @OpenCV_USE_MANGLED_PATHS_CONFIGCMAKE@) - # Extract the directory where *this* file has been installed (determined at cmake run-time) - get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_FILE}" PATH CACHE) - --if(NOT WIN32 OR ANDROID) -+if(NOT WIN32 OR ANDROID OR "@INSTALL_FORCE_UNIX_PATHS@") - if(ANDROID) - set(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/../../..") - else() diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 1f0d720..86b9d89 100644 --- a/data/CMakeLists.txt @@ -142,19 +111,27 @@ index 1f0d720..86b9d89 100644 if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH) install(DIRECTORY "${OPENCV_TEST_DATA_PATH}/" DESTINATION "${OPENCV_TEST_DATA_INSTALL_PATH}" COMPONENT "tests") diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt -index b4e48e6..6ea20d6 100644 +index b4e48e6..d5ed455 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,7 +1,9 @@ -file(GLOB old_hdrs "opencv/*.h*") -install(FILES ${old_hdrs} -+if(INSTALL_HEADERS) -+ file(GLOB old_hdrs "opencv/*.h*") -+ install(FILES ${old_hdrs} - DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv - COMPONENT dev) +- DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv +- COMPONENT dev) -install(FILES "opencv2/opencv.hpp" -+ install(FILES "opencv2/opencv.hpp" - DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 - COMPONENT dev) +- DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 +- COMPONENT dev) ++if(INSTALL_HEADERS) ++ file(GLOB old_hdrs "opencv/*.h*") ++ install(FILES ${old_hdrs} ++ DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv ++ COMPONENT dev) ++ install(FILES "opencv2/opencv.hpp" ++ DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH}/opencv2 ++ COMPONENT dev) +endif() +\ No newline at end of file +-- +2.9.0.windows.1 + diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake index 224c99c4287..6614fbb1a78 100644 --- a/ports/opencv/portfile.cmake +++ b/ports/opencv/portfile.cmake @@ -3,11 +3,11 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static) set(VCPKG_LIBRARY_LINKAGE dynamic) endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opencv-92387b1ef8fad15196dd5f7fb4931444a68bc93a) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/opencv-3.2.0) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/opencv/opencv/archive/92387b1ef8fad15196dd5f7fb4931444a68bc93a.zip" - FILENAME "opencv-92387b1ef8fad15196dd5f7fb4931444a68bc93a.zip" - SHA512 b95fa1a5bce0ea9e9bd43173b904e5d779a2f640f4f8dbb36a12df462e8e4cdce3ff94b2fbd85cb96ddf338019f9888e9e7410c468c81b1de98d9c1da945a7eb + URLS "https://github.com/opencv/opencv/archive/3.2.0.zip" + FILENAME "opencv-3.2.0.zip" + SHA512 c6418d2a7654fe9d50611e756778df4c6736f2de76b85773efbf490bb475dd95ec1041fe57a87163ce11a7db44430cd378c8416af3319f979ced92532bf5ebb5 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -24,7 +24,6 @@ vcpkg_configure_cmake( -DBUILD_TIFF=OFF -DBUILD_JPEG=OFF -DBUILD_PNG=OFF - -DINSTALL_CREATE_DISTRIB=ON -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DBUILD_opencv_apps=OFF From 1bd912bb3e319991645ec480183db2e30fdf6b85 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 8 Feb 2017 23:51:16 -0800 Subject: [PATCH 023/137] [rapidjson] Update to 1.1.0 --- ports/rapidjson/CONTROL | 2 +- ports/rapidjson/portfile.cmake | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/rapidjson/CONTROL b/ports/rapidjson/CONTROL index 2ef641783d8..0dd6333cfe1 100644 --- a/ports/rapidjson/CONTROL +++ b/ports/rapidjson/CONTROL @@ -1,3 +1,3 @@ Source: rapidjson -Version: 1.0.2-1 +Version: 1.1.0 Description: A fast JSON parser/generator for C++ with both SAX/DOM style API diff --git a/ports/rapidjson/portfile.cmake b/ports/rapidjson/portfile.cmake index 3d923cb959c..80dc14f5d59 100644 --- a/ports/rapidjson/portfile.cmake +++ b/ports/rapidjson/portfile.cmake @@ -1,10 +1,10 @@ #header-only library include(vcpkg_common_functions) -SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/rapidjson-879def80f2e466cdf4c86dc7e53ea2dd4cafaea0) +SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/rapidjson-1.1.0) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/miloyip/rapidjson/archive/879def80f2e466cdf4c86dc7e53ea2dd4cafaea0.zip" - FILENAME "rapidjson-879def80f2e466cdf4c86dc7e53ea2dd4cafaea0.zip" - SHA512 4d9ef7cce7d179344c33245c081a142ca5fcb2a0cc170ed39e3d0add008efab8e7389feec03e1ea83b30c5778cd0600865b08bc1c23592e5154dbe1f21f9547d + URLS "https://github.com/miloyip/rapidjson/archive/v1.1.0.zip" + FILENAME "rapidjson-v1.1.0.zip" + SHA512 4ddbf6dc5d943eb971e7a62910dd78d1cc5cc3016066a443f351d4276d2be3375ed97796e672c2aecd6990f0b332826f8c8ddc7d367193d7b82f0037f4e4012c ) vcpkg_extract_source_archive(${ARCHIVE}) From b4c3c30d4039ac56f1264b3692aa3a4cc49c6869 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 8 Feb 2017 23:51:46 -0800 Subject: [PATCH 024/137] [vcpkg] Fix typo in a lint check --- toolsrc/src/PostBuildLint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index ac339698402..21d1cef1367 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -487,7 +487,7 @@ namespace vcpkg::PostBuildLint System::println("The following empty directories were found: "); Files::print_paths(empty_directories); System::println(System::color::warning, "If a directory should be populated but is not, this might indicate an error in the portfile.\n" - "If the directories are not needed and their creation cannot be disabled, use something like this in the portfile to remove them)\n" + "If the directories are not needed and their creation cannot be disabled, use something like this in the portfile to remove them:\n" "\n" R"###( file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/a/dir ${CURRENT_PACKAGES_DIR}/some/other/dir))###""\n" "\n"); From ddab90208a59a173e07754cb2a0c6a53f17e8f7c Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Wed, 8 Feb 2017 23:55:50 -0800 Subject: [PATCH 025/137] [sqlite-modern-cpp] Avoid moving downloaded file --- ports/sqlite-modern-cpp/portfile.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/sqlite-modern-cpp/portfile.cmake b/ports/sqlite-modern-cpp/portfile.cmake index a7b0f81eddc..3171b555023 100644 --- a/ports/sqlite-modern-cpp/portfile.cmake +++ b/ports/sqlite-modern-cpp/portfile.cmake @@ -11,11 +11,10 @@ vcpkg_extract_source_archive(${ARCHIVE}) file(INSTALL ${SOURCE_PATH}/hdr/ DESTINATION ${CURRENT_PACKAGES_DIR}/include) # Handle copyright -message("Download license...") vcpkg_download_distfile(LICENSE URLS https://raw.githubusercontent.com/aminroosta/sqlite_modern_cpp/1d7747fcbb16325ec6673477b06f0c780de24a27/License.txt FILENAME "sqlite_modern_cpp-2.4-license-mit.txt" SHA512 4ffc41d14902b37841463b9e9274537cb48523a7ab7e5fbbbd14a01820d141e367851b0496aa18546ddab96100e7381db7fc35621c795a97c3290b618e18a8bd ) file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/sqlite-modern-cpp) -file(RENAME ${LICENSE} ${CURRENT_PACKAGES_DIR}/share/sqlite-modern-cpp/copyright) +file(INSTALL ${LICENSE} DESTINATION ${CURRENT_PACKAGES_DIR}/share/sqlite-modern-cpp RENAME copyright) From 47109bb96aa257f300b142e4d0ac6e115ec5150f Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 9 Feb 2017 00:04:05 -0800 Subject: [PATCH 026/137] [grpc] Bump package version to match change in cmake config file output --- ports/grpc/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/grpc/CONTROL b/ports/grpc/CONTROL index b9d19da4c0e..3de78c477d3 100644 --- a/ports/grpc/CONTROL +++ b/ports/grpc/CONTROL @@ -1,4 +1,4 @@ Source: grpc -Version: 1.1.0-dev-1674f65-1 +Version: 1.1.0-dev-1674f65-2 Build-Depends: zlib, openssl, protobuf Description: An RPC library and framework \ No newline at end of file From f19c145ab5129bc68aa17d6f377ae0d772b913ca Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 9 Feb 2017 00:33:02 -0800 Subject: [PATCH 027/137] [openvr] Initial commit of 1.0.5 --- ports/openvr/CONTROL | 3 +++ ports/openvr/portfile.cmake | 54 +++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 ports/openvr/CONTROL create mode 100644 ports/openvr/portfile.cmake diff --git a/ports/openvr/CONTROL b/ports/openvr/CONTROL new file mode 100644 index 00000000000..2a2228ba2f1 --- /dev/null +++ b/ports/openvr/CONTROL @@ -0,0 +1,3 @@ +Source: openvr +Version: 1.0.5 +Description: an API and runtime that allows access to VR hardware from multiple vendors without requiring that applications have specific knowledge of the hardware they are targeting. diff --git a/ports/openvr/portfile.cmake b/ports/openvr/portfile.cmake new file mode 100644 index 00000000000..94e90143db0 --- /dev/null +++ b/ports/openvr/portfile.cmake @@ -0,0 +1,54 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = +# 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/openvr-1.0.5) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/ValveSoftware/openvr/archive/v1.0.5.zip" + FILENAME "openvr-v1.0.5.zip" + SHA512 18c2e3f7a8754d0e9389c953d0af70788c77adf43f51d25b6664beaeb407dc8d2daa755396c45ce2b4be1b08d333b378810dbebdf3c9bb5f5a03a9d372dc97b0 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +set(VCPKG_LIBRARY_LINKAGE dynamic) + +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(ARCH_PATH "win64") +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + set(ARCH_PATH "win32") +else() + message(FATAL_ERROR "Package only supports x64 and x86 windows.") +endif() + +if(VCPKG_CMAKE_SYSTEM_NAME) + message(FATAL_ERROR "Package only supports windows desktop.") +endif() + +file(MAKE_DIRECTORY + ${CURRENT_PACKAGES_DIR}/lib + ${CURRENT_PACKAGES_DIR}/bin + ${CURRENT_PACKAGES_DIR}/debug/lib + ${CURRENT_PACKAGES_DIR}/debug/bin +) +file(COPY ${SOURCE_PATH}/lib/${ARCH_PATH}/openvr_api.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) +file(COPY ${SOURCE_PATH}/lib/${ARCH_PATH}/openvr_api.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) +file(COPY + ${SOURCE_PATH}/bin/${ARCH_PATH}/openvr_api.dll + ${SOURCE_PATH}/bin/${ARCH_PATH}/openvr_api.pdb + DESTINATION ${CURRENT_PACKAGES_DIR}/bin +) +file(COPY + ${SOURCE_PATH}/bin/${ARCH_PATH}/openvr_api.dll + ${SOURCE_PATH}/bin/${ARCH_PATH}/openvr_api.pdb + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin +) +file(COPY ${SOURCE_PATH}/headers DESTINATION ${CURRENT_PACKAGES_DIR}) +file(RENAME ${CURRENT_PACKAGES_DIR}/headers ${CURRENT_PACKAGES_DIR}/include) + +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/openvr) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/openvr/LICENSE ${CURRENT_PACKAGES_DIR}/share/openvr/copyright) From 6ca475a5b47e0a49e2cdd4e65f3c51913a431328 Mon Sep 17 00:00:00 2001 From: codicodi Date: Thu, 9 Feb 2017 18:13:52 +0100 Subject: [PATCH 028/137] add libepoxy --- ports/libepoxy/CONTROL | 3 + ports/libepoxy/portfile.cmake | 17 +++++ scripts/cmake/vcpkg_common_functions.cmake | 2 + scripts/cmake/vcpkg_configure_meson.cmake | 72 +++++++++++++++++++ .../cmake/vcpkg_find_acquire_program.cmake | 25 ++++++- scripts/cmake/vcpkg_install_meson.cmake | 23 ++++++ 6 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 ports/libepoxy/CONTROL create mode 100644 ports/libepoxy/portfile.cmake create mode 100644 scripts/cmake/vcpkg_configure_meson.cmake create mode 100644 scripts/cmake/vcpkg_install_meson.cmake diff --git a/ports/libepoxy/CONTROL b/ports/libepoxy/CONTROL new file mode 100644 index 00000000000..8ac70cd2242 --- /dev/null +++ b/ports/libepoxy/CONTROL @@ -0,0 +1,3 @@ +Source: libepoxy +Version: 1.4.0-2432daf +Description: Epoxy is a library for handling OpenGL function pointer management for you diff --git a/ports/libepoxy/portfile.cmake b/ports/libepoxy/portfile.cmake new file mode 100644 index 00000000000..add95b480fa --- /dev/null +++ b/ports/libepoxy/portfile.cmake @@ -0,0 +1,17 @@ + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libepoxy-2432daf4cf58b5ff11e008ca34811588285c43b3) +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/anholt/libepoxy/archive/2432daf4cf58b5ff11e008ca34811588285c43b3.zip" + FILENAME "libepoxy-2432daf4cf58b5ff11e008ca34811588285c43b3.zip" + SHA512 70b59b6c5722eb87522927fdedab44f74ffd2d71d2ae42509de07b0c3e13f71320b25da0d4c75dca75c4208ea7a525483267d6ccb8acd5274728c015c7ac4006) + +vcpkg_extract_source_archive(${ARCHIVE}) + +vcpkg_configure_meson(SOURCE_PATH ${SOURCE_PATH}) +vcpkg_install_meson() + +vcpkg_copy_pdbs() + +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libepoxy) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/libepoxy/COPYING ${CURRENT_PACKAGES_DIR}/share/libepoxy/copyright) diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index 6e60bf2bc35..fb626efe8ae 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -7,7 +7,9 @@ include(vcpkg_build_cmake) include(vcpkg_build_msbuild) include(vcpkg_build_qmake) include(vcpkg_install_cmake) +include(vcpkg_install_meson) include(vcpkg_configure_cmake) +include(vcpkg_configure_meson) include(vcpkg_configure_qmake) include(vcpkg_apply_patches) include(vcpkg_copy_pdbs) diff --git a/scripts/cmake/vcpkg_configure_meson.cmake b/scripts/cmake/vcpkg_configure_meson.cmake new file mode 100644 index 00000000000..277f91e1177 --- /dev/null +++ b/scripts/cmake/vcpkg_configure_meson.cmake @@ -0,0 +1,72 @@ +function(vcpkg_configure_meson) + cmake_parse_arguments(_vcm "" "SOURCE_PATH" "OPTIONS;OPTIONS_DEBUG;OPTIONS_RELEASE" ${ARGN}) + + file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + + # use the same compiler options as in vcpkg_configure_cmake + set(MESON_COMMON_CFLAGS "${MESON_COMMON_CFLAGS} /DWIN32 /D_WINDOWS /W3 /utf-8") + set(MESON_COMMON_CXXFLAGS "${MESON_COMMON_CXXFLAGS} /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc") + + if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic) + set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") + + set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MD /O2 /Oi /Gy /DNDEBUG /Zi") + set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MD /O2 /Oi /Gy /DNDEBUG /Zi") + elseif(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static) + set(MESON_DEBUG_CFLAGS "${MESON_DEBUG_CFLAGS} /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1") + set(MESON_DEBUG_CXXFLAGS "${MESON_DEBUG_CXXFLAGS} /D_DEBUG /MTd /Zi /Ob0 /Od /RTC1") + + set(MESON_RELEASE_CFLAGS "${MESON_RELEASE_CFLAGS} /MT /O2 /Oi /Gy /DNDEBUG /Zi") + set(MESON_RELEASE_CXXFLAGS "${MESON_RELEASE_CXXFLAGS} /MT /O2 /Oi /Gy /DNDEBUG /Zi") + endif() + + set(MESON_COMMON_LDFLAGS "${MESON_COMMON_LDFLAGS} /DEBUG") + set(MESON_RELEASE_LDFLAGS "${MESON_RELEASE_LDFLAGS} /INCREMENTAL:NO /OPT:REF /OPT:ICF") + + # select meson cmd-line options + list(APPEND _vcm_OPTIONS --buildtype plain --backend ninja) + if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + list(APPEND _vcm_OPTIONS --default-library shared) + else() + list(APPEND _vcm_OPTIONS --default-library static) + endif() + + list(APPEND _vcm_OPTIONS_DEBUG --prefix ${CURRENT_PACKAGES_DIR}/debug --includedir ../include) + list(APPEND _vcm_OPTIONS_RELEASE --prefix ${CURRENT_PACKAGES_DIR}) + + vcpkg_find_acquire_program(MESON) + vcpkg_find_acquire_program(NINJA) + get_filename_component(NINJA_PATH ${NINJA} DIRECTORY) + set(ENV{PATH} "$ENV{PATH};${NINJA_PATH}") + + # configure release + message(STATUS "Configuring ${TARGET_TRIPLET}-rel") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) + set(ENV{CFLAGS} "${MESON_COMMON_CFLAGS} ${MESON_RELEASE_CFLAGS}") + set(ENV{CXXFLAGS} "${MESON_COMMON_CXXFLAGS} ${MESON_RELEASE_CXXFLAGS}") + set(ENV{LDFLAGS} "${MESON_COMMON_LDFLAGS} ${MESON_RELEASE_LDFLAGS}") + set(ENV{CPPFLAGS} "${MESON_COMMON_CPPFLAGS} ${MESON_RELEASE_CPPFLAGS}") + vcpkg_execute_required_process( + COMMAND ${MESON} ${_vcm_OPTIONS} ${_vcm_OPTIONS_RELEASE} ${_vcm_SOURCE_PATH} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME config-${TARGET_TRIPLET}-rel + ) + message(STATUS "Configuring ${TARGET_TRIPLET}-rel done") + + # configure debug + message(STATUS "Configuring ${TARGET_TRIPLET}-dbg") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) + set(ENV{CFLAGS} "${MESON_COMMON_CFLAGS} ${MESON_DEBUG_CFLAGS}") + set(ENV{CXXFLAGS} "${MESON_COMMON_CXXFLAGS} ${MESON_DEBUG_CXXFLAGS}") + set(ENV{LDFLAGS} "${MESON_COMMON_LDFLAGS} ${MESON_DEBUG_LDFLAGS}") + set(ENV{CPPFLAGS} "${MESON_COMMON_CPPFLAGS} ${MESON_DEBUG_CPPFLAGS}") + vcpkg_execute_required_process( + COMMAND ${MESON} ${_vcm_OPTIONS} ${_vcm_OPTIONS_DEBUG} ${_vcm_SOURCE_PATH} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME config-${TARGET_TRIPLET}-dbg + ) + message(STATUS "Configuring ${TARGET_TRIPLET}-dbg done") + +endfunction() diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 04429138293..b9a397fcc87 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -5,6 +5,7 @@ function(vcpkg_find_acquire_program VAR) unset(NOEXTRACT) unset(SUBDIR) + unset(REQUIRED_INTERPRETER) if(VAR MATCHES "PERL") set(PROGNAME perl) @@ -70,12 +71,30 @@ function(vcpkg_find_acquire_program VAR) set(PATHS ${DOWNLOADS}/tools/ninja/${SUBDIR}) set(URL "https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip") set(ARCHIVE "ninja-win.zip") - set(HASH cccab9281b274c564f9ad77a2115be1f19be67d7b2ee14a55d1db1b27f3b68db8e76076e4f804b61eb8e573e26a8ecc9985675a8dcf03fd7a77b7f57234f1393) + set(HASH cccab9281b274c564f9ad77a2115be1f19be67d7b2ee14a55d1db1b27f3b68db8e76076e4f804b61eb8e573e26a8ecc9985675a8dcf03fd7a77b7f57234f1393) + elseif(VAR MATCHES "MESON") + set(PROGNAME meson) + set(REQUIRED_INTERPRETER PYTHON3) + set(SCRIPTNAME meson.py) + set(PATHS ${DOWNLOADS}/tools/meson/meson-0.38.1) + set(URL "https://github.com/mesonbuild/meson/archive/0.38.1.zip") + set(ARCHIVE "meson-0.38.1.zip") + set(HASH 89642b1d976af7e29e9ca2b1a378510ce286ebd90a8234e898f3dd9dd7151538fdfc61fba770681605dad843b77b344fee94f992f18328655669d5f603c7fee5) else() message(FATAL "unknown tool ${VAR} -- unable to acquire.") endif() - find_program(${VAR} ${PROGNAME} PATHS ${PATHS}) + macro(do_find) + if(NOT DEFINED REQUIRED_INTERPRETER) + find_program(${VAR} ${PROGNAME} PATHS ${PATHS}) + else() + vcpkg_find_acquire_program(${REQUIRED_INTERPRETER}) + find_file(SCIRPT ${SCRIPTNAME} PATHS ${PATHS}) + set(${VAR} ${${REQUIRED_INTERPRETER}} ${SCIRPT}) + endif() + endmacro() + + do_find() if(${VAR} MATCHES "-NOTFOUND") file(DOWNLOAD ${URL} ${DOWNLOADS}/${ARCHIVE} EXPECTED_HASH SHA512=${HASH} @@ -102,7 +121,7 @@ function(vcpkg_find_acquire_program VAR) endif() endif() - find_program(${VAR} ${PROGNAME} PATHS ${PATHS}) + do_find() endif() set(${VAR} ${${VAR}} PARENT_SCOPE) diff --git a/scripts/cmake/vcpkg_install_meson.cmake b/scripts/cmake/vcpkg_install_meson.cmake new file mode 100644 index 00000000000..21737bdc9ed --- /dev/null +++ b/scripts/cmake/vcpkg_install_meson.cmake @@ -0,0 +1,23 @@ +function(vcpkg_install_meson) + + vcpkg_find_acquire_program(NINJA) + + unset(ENV{DESTDIR}) # installation directory was already specified with '--prefix' option + + message(STATUS "Package ${TARGET_TRIPLET}-rel") + vcpkg_execute_required_process( + COMMAND ${NINJA} install -v + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel + LOGNAME package-${TARGET_TRIPLET}-rel + ) + message(STATUS "Package ${TARGET_TRIPLET}-rel done") + + message(STATUS "Package ${TARGET_TRIPLET}-dbg") + vcpkg_execute_required_process( + COMMAND ${NINJA} install -v + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg + LOGNAME package-${TARGET_TRIPLET}-dbg + ) + message(STATUS "Package ${TARGET_TRIPLET}-dbg done") + +endfunction() From b65ae7c27793d2837881412f609ee08974c14f82 Mon Sep 17 00:00:00 2001 From: codicodi Date: Thu, 9 Feb 2017 18:15:57 +0100 Subject: [PATCH 029/137] tabs to spaces --- scripts/cmake/vcpkg_install_meson.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/cmake/vcpkg_install_meson.cmake b/scripts/cmake/vcpkg_install_meson.cmake index 21737bdc9ed..f6d49288ccc 100644 --- a/scripts/cmake/vcpkg_install_meson.cmake +++ b/scripts/cmake/vcpkg_install_meson.cmake @@ -1,9 +1,9 @@ function(vcpkg_install_meson) - + vcpkg_find_acquire_program(NINJA) - - unset(ENV{DESTDIR}) # installation directory was already specified with '--prefix' option - + + unset(ENV{DESTDIR}) # installation directory was already specified with '--prefix' option + message(STATUS "Package ${TARGET_TRIPLET}-rel") vcpkg_execute_required_process( COMMAND ${NINJA} install -v @@ -11,7 +11,7 @@ function(vcpkg_install_meson) LOGNAME package-${TARGET_TRIPLET}-rel ) message(STATUS "Package ${TARGET_TRIPLET}-rel done") - + message(STATUS "Package ${TARGET_TRIPLET}-dbg") vcpkg_execute_required_process( COMMAND ${NINJA} install -v From 91442a634ef429277b9d65b47ae67d4c6791fe09 Mon Sep 17 00:00:00 2001 From: codicodi Date: Thu, 9 Feb 2017 18:23:21 +0100 Subject: [PATCH 030/137] [libepoxy] ensure python is on path --- ports/libepoxy/portfile.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/libepoxy/portfile.cmake b/ports/libepoxy/portfile.cmake index add95b480fa..521f7a29269 100644 --- a/ports/libepoxy/portfile.cmake +++ b/ports/libepoxy/portfile.cmake @@ -8,6 +8,11 @@ vcpkg_download_distfile(ARCHIVE vcpkg_extract_source_archive(${ARCHIVE}) +# ensure python is on path - not for meson but some source geneation scripts +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PYTHON3_PATH ${PYTHON3} DIRECTORY) +set(ENV{PATH} "$ENV{PATH};${PYTHON3_PATH}") + vcpkg_configure_meson(SOURCE_PATH ${SOURCE_PATH}) vcpkg_install_meson() From 6c380e057890094ce1e2c36ded5481675e139078 Mon Sep 17 00:00:00 2001 From: codicodi Date: Thu, 9 Feb 2017 18:24:17 +0100 Subject: [PATCH 031/137] fix typo --- ports/libepoxy/portfile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/libepoxy/portfile.cmake b/ports/libepoxy/portfile.cmake index 521f7a29269..188cd3668cb 100644 --- a/ports/libepoxy/portfile.cmake +++ b/ports/libepoxy/portfile.cmake @@ -8,7 +8,7 @@ vcpkg_download_distfile(ARCHIVE vcpkg_extract_source_archive(${ARCHIVE}) -# ensure python is on path - not for meson but some source geneation scripts +# ensure python is on path - not for meson but some source generation scripts vcpkg_find_acquire_program(PYTHON3) get_filename_component(PYTHON3_PATH ${PYTHON3} DIRECTORY) set(ENV{PATH} "$ENV{PATH};${PYTHON3_PATH}") From cfd5adaf135ccfe2ade3bce43a00d27abd007b0a Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 9 Feb 2017 15:26:40 -0800 Subject: [PATCH 032/137] Improve WinSDK detection --- scripts/findTargetPlatformVersion.ps1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/findTargetPlatformVersion.ps1 b/scripts/findTargetPlatformVersion.ps1 index e9d676724a4..d3dba73f13b 100644 --- a/scripts/findTargetPlatformVersion.ps1 +++ b/scripts/findTargetPlatformVersion.ps1 @@ -15,15 +15,16 @@ foreach ($ProgramFiles in $CandidateProgramFiles) continue } - $win10sdkVersions = Get-ChildItem $folder | Where-Object {$_.Name -match "^10"} | Sort-Object - $win10sdkVersionCount = $win10sdkVersions.Length + $win10sdkVersions = @(Get-ChildItem $folder | Where-Object {$_.Name -match "^10"} | Sort-Object) + [array]::Reverse($win10sdkVersions) # Newest SDK first - if ($win10sdkVersionCount -eq 0) + foreach ($win10sdkV in $win10sdkVersions) { - continue + if (Test-Path "$folder\$win10sdkV\um\windows.h") + { + return $win10sdkV.ToString() + } } - - return $win10sdkVersions[$win10sdkVersionCount - 1].ToString() } # Windows 8.1 SDK From 43665857a3ad11de8135c7fd6cd9839269212d7d Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 9 Feb 2017 17:23:15 -0800 Subject: [PATCH 033/137] [fmt] Force headers in shared build to always have FMT_SHARED. Fixes #331. --- ports/fmt/CONTROL | 2 +- ports/fmt/portfile.cmake | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/fmt/CONTROL b/ports/fmt/CONTROL index 2c90cc300f5..4e980b4d54d 100644 --- a/ports/fmt/CONTROL +++ b/ports/fmt/CONTROL @@ -1,3 +1,3 @@ Source: fmt -Version: 3.0.1-3 +Version: 3.0.1-4 Description: Formatting library for C++. It can be used as a safe alternative to printf or as a fast alternative to IOStreams. diff --git a/ports/fmt/portfile.cmake b/ports/fmt/portfile.cmake index 5fbbcc12ed9..959a0ebe73e 100644 --- a/ports/fmt/portfile.cmake +++ b/ports/fmt/portfile.cmake @@ -30,6 +30,10 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) file(RENAME ${CURRENT_PACKAGES_DIR}/lib/fmt.dll ${CURRENT_PACKAGES_DIR}/bin/fmt.dll) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/fmt.dll ${CURRENT_PACKAGES_DIR}/debug/bin/fmt.dll) + # Force FMT_SHARED to 1 + file(READ ${CURRENT_PACKAGES_DIR}/include/fmt/format.h FMT_FORMAT_H) + string(REPLACE "defined(FMT_SHARED)" "1" FMT_FORMAT_H "${FMT_FORMAT_H}") + file(WRITE ${CURRENT_PACKAGES_DIR}/include/fmt/format.h "${FMT_FORMAT_H}") endif() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) #file(REMOVE ${CURRENT_PACKAGES_DIR}/include/fmt/format.cc) From a58139adf0b910fc9cc751e7162d507ac29471f4 Mon Sep 17 00:00:00 2001 From: sdcb Date: Fri, 10 Feb 2017 17:32:54 +0800 Subject: [PATCH 034/137] [asio] upgrade to 1.10.8 --- ports/asio/CONTROL | 6 +++--- ports/asio/portfile.cmake | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ports/asio/CONTROL b/ports/asio/CONTROL index 466ef6cd0ab..18d9692f538 100644 --- a/ports/asio/CONTROL +++ b/ports/asio/CONTROL @@ -1,3 +1,3 @@ -Source: asio -Version: 1.10.6 -Description: Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach. +Source: asio +Version: 1.10.8 +Description: Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach. diff --git a/ports/asio/portfile.cmake b/ports/asio/portfile.cmake index 345ddd673d7..39fefa012ef 100644 --- a/ports/asio/portfile.cmake +++ b/ports/asio/portfile.cmake @@ -1,10 +1,10 @@ #header-only library include(vcpkg_common_functions) -SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/asio-asio-1-10-6/asio/) +SET(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/asio-asio-1-10-8/asio/) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/chriskohlhoff/asio/archive/asio-1-10-6.zip" - FILENAME "asio-1-10-6.zip" - SHA512 7e3fde7e88d305d19b88482b73c8b7a41751d65e81bd23dd8ef45eb4e3ef3a10629696b4d347e5a68f08d6fb2dede15a2f38c7ee8d18ac88be769215542da4c6 + URLS "https://github.com/chriskohlhoff/asio/archive/asio-1-10-8.zip" + FILENAME "asio-1-10-8.zip" + SHA512 bc9794a20fc7844a2a9d22bfa418005f61defbcecdd612daba0d317e6f8fc5a61d3a3b2d7d557b92584294b8adfccc3c47a8f0441f3e34a47a0f715ca1ba0e5b ) vcpkg_extract_source_archive(${ARCHIVE}) From 47a4bff2d11881f95bd0eb0b659360ff1b7465c0 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 9 Feb 2017 18:26:16 -0800 Subject: [PATCH 035/137] Add vcpkg_Enums --- toolsrc/include/vcpkg_Enums.h | 11 +++++++++++ toolsrc/src/vcpkg_Enums.cpp | 21 +++++++++++++++++++++ toolsrc/vcpkglib/vcpkglib.vcxproj | 2 ++ toolsrc/vcpkglib/vcpkglib.vcxproj.filters | 6 ++++++ 4 files changed, 40 insertions(+) create mode 100644 toolsrc/include/vcpkg_Enums.h create mode 100644 toolsrc/src/vcpkg_Enums.cpp diff --git a/toolsrc/include/vcpkg_Enums.h b/toolsrc/include/vcpkg_Enums.h new file mode 100644 index 00000000000..5c4dc8b06e0 --- /dev/null +++ b/toolsrc/include/vcpkg_Enums.h @@ -0,0 +1,11 @@ +#pragma once +#include + +namespace vcpkg::Enums +{ + std::string nullvalue_toString(const std::string& enum_name); + + __declspec(noreturn) void nullvalue_used(const std::string& enum_name); + + __declspec(noreturn) void unreachable(const std::string& enum_name); +} diff --git a/toolsrc/src/vcpkg_Enums.cpp b/toolsrc/src/vcpkg_Enums.cpp new file mode 100644 index 00000000000..5e698659db1 --- /dev/null +++ b/toolsrc/src/vcpkg_Enums.cpp @@ -0,0 +1,21 @@ +#include "pch.h" +#include "vcpkg_Enums.h" +#include "vcpkg_Checks.h" + +namespace vcpkg::Enums +{ + std::string nullvalue_toString(const std::string& enum_name) + { + return Strings::format("%s_NULLVALUE", enum_name); + } + + void nullvalue_used(const std::string& enum_name) + { + Checks::exit_with_message("NULLVALUE of enum %s was used", enum_name); + } + + void unreachable(const std::string& enum_name) + { + Checks::exit_with_message("Unreachable code for enum, %s", enum_name); + } +} diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index ad15ea7ea74..537b2fb0fd5 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -165,6 +165,7 @@ + @@ -227,6 +228,7 @@ + diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 99cbf7037b3..519331b497b 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -168,6 +168,9 @@ Source Files + + Source Files + @@ -290,5 +293,8 @@ Header Files + + Header Files + \ No newline at end of file From 7a0404cb839ae49bf7e52ca54f905d182a12de5d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 9 Feb 2017 18:39:03 -0800 Subject: [PATCH 036/137] BuildInfo now holds enum instead of string --- toolsrc/include/PostBuildLint_BuildInfo.h | 5 +++-- toolsrc/src/PostBuildLint.cpp | 11 +++-------- toolsrc/src/PostBuildLint_BuildInfo.cpp | 9 +++++++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h index ff996b2b611..878b90e6f2a 100644 --- a/toolsrc/include/PostBuildLint_BuildInfo.h +++ b/toolsrc/include/PostBuildLint_BuildInfo.h @@ -4,6 +4,7 @@ #include "Paragraphs.h" #include "PostBuildLint_BuildPolicies.h" #include "opt_bool.h" +#include "PostBuildLint_LinkageType.h" namespace vcpkg::PostBuildLint { @@ -11,8 +12,8 @@ namespace vcpkg::PostBuildLint { static BuildInfo create(std::unordered_map pgh); - std::string crt_linkage; - std::string library_linkage; + LinkageType crt_linkage; + LinkageType library_linkage; std::map policies; }; diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index 21d1cef1367..d952403db51 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -660,7 +660,7 @@ namespace vcpkg::PostBuildLint error_count += check_lib_architecture(spec.target_triplet().architecture(), libs); - switch (linkage_type_value_of(build_info.library_linkage)) + switch (build_info.library_linkage) { case LinkageType::DYNAMIC: { @@ -691,16 +691,11 @@ namespace vcpkg::PostBuildLint error_count += check_bin_folders_are_not_present_in_static_build(package_dir); - error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::DEBUG, linkage_type_value_of(build_info.crt_linkage)), debug_libs, dumpbin_exe); - error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, linkage_type_value_of(build_info.crt_linkage)), release_libs, dumpbin_exe); + error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::DEBUG, build_info.crt_linkage), debug_libs, dumpbin_exe); + error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, build_info.crt_linkage), release_libs, dumpbin_exe); break; } case LinkageType::UNKNOWN: - { - error_count += 1; - System::println(System::color::warning, "Unknown library_linkage architecture: [ %s ]", build_info.library_linkage); - break; - } default: Checks::unreachable(); } diff --git a/toolsrc/src/PostBuildLint_BuildInfo.cpp b/toolsrc/src/PostBuildLint_BuildInfo.cpp index 63107acd1ca..54408500089 100644 --- a/toolsrc/src/PostBuildLint_BuildInfo.cpp +++ b/toolsrc/src/PostBuildLint_BuildInfo.cpp @@ -16,8 +16,13 @@ namespace vcpkg::PostBuildLint BuildInfo BuildInfo::create(std::unordered_map pgh) { BuildInfo build_info; - build_info.crt_linkage = details::remove_required_field(&pgh, BuildInfoRequiredField::CRT_LINKAGE); - build_info.library_linkage = details::remove_required_field(&pgh, BuildInfoRequiredField::LIBRARY_LINKAGE); + const std::string crt_linkage_as_string = details::remove_required_field(&pgh, BuildInfoRequiredField::CRT_LINKAGE); + build_info.crt_linkage = linkage_type_value_of(crt_linkage_as_string); + Checks::check_exit(build_info.crt_linkage != LinkageType::UNKNOWN, "Invalid crt linkage type: [%s]", crt_linkage_as_string); + + const std::string library_linkage_as_string = details::remove_required_field(&pgh, BuildInfoRequiredField::LIBRARY_LINKAGE); + build_info.library_linkage = linkage_type_value_of(library_linkage_as_string); + Checks::check_exit(build_info.library_linkage != LinkageType::UNKNOWN, "Invalid library linkage type: [%s]", library_linkage_as_string); // The remaining entries are policies for (const std::unordered_map::value_type& p : pgh) From 95650bdd424b9499f4676dae8f110b15b3fd024f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 9 Feb 2017 19:00:09 -0800 Subject: [PATCH 037/137] PostBuildLint enum revamp --- toolsrc/include/PostBuildLint_BuildInfo.h | 4 +- toolsrc/include/PostBuildLint_BuildPolicies.h | 13 ++-- toolsrc/include/PostBuildLint_BuildType.h | 70 ++++++++++--------- .../include/PostBuildLint_ConfigurationType.h | 25 ++++++- toolsrc/include/PostBuildLint_LinkageType.h | 30 ++++++-- toolsrc/src/PostBuildLint.cpp | 14 ++-- toolsrc/src/PostBuildLint_BuildInfo.cpp | 10 +-- toolsrc/src/PostBuildLint_BuildPolicies.cpp | 27 +++---- toolsrc/src/PostBuildLint_BuildType.cpp | 69 +++++++++++------- .../src/PostBuildLint_ConfigurationType.cpp | 27 ++++--- toolsrc/src/PostBuildLint_LinkageType.cpp | 45 +++++++----- 11 files changed, 199 insertions(+), 135 deletions(-) diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h index 878b90e6f2a..7dbadb14785 100644 --- a/toolsrc/include/PostBuildLint_BuildInfo.h +++ b/toolsrc/include/PostBuildLint_BuildInfo.h @@ -12,8 +12,8 @@ namespace vcpkg::PostBuildLint { static BuildInfo create(std::unordered_map pgh); - LinkageType crt_linkage; - LinkageType library_linkage; + LinkageType::type crt_linkage; + LinkageType::type library_linkage; std::map policies; }; diff --git a/toolsrc/include/PostBuildLint_BuildPolicies.h b/toolsrc/include/PostBuildLint_BuildPolicies.h index 187ba6d6464..082de31d00b 100644 --- a/toolsrc/include/PostBuildLint_BuildPolicies.h +++ b/toolsrc/include/PostBuildLint_BuildPolicies.h @@ -1,17 +1,19 @@ #pragma once #include +#include namespace vcpkg::PostBuildLint::BuildPolicies { enum class backing_enum_t { - UNKNOWN = 0, + NULLVALUE = 0, EMPTY_PACKAGE, DLLS_WITHOUT_LIBS }; struct type { + constexpr type() : backing_enum(backing_enum_t::NULLVALUE) {} constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } constexpr operator backing_enum_t() const { return backing_enum; } @@ -19,17 +21,16 @@ namespace vcpkg::PostBuildLint::BuildPolicies const std::string& cmake_variable() const; private: - type(); backing_enum_t backing_enum; }; - static constexpr int value_count = 3; - const std::vector& values(); + static const std::string ENUM_NAME = "vcpkg::PostBuildLint::BuildPolicies"; - - static constexpr type UNKNOWN(backing_enum_t::UNKNOWN); + static constexpr type NULLVALUE(backing_enum_t::NULLVALUE); static constexpr type EMPTY_PACKAGE(backing_enum_t::EMPTY_PACKAGE); static constexpr type DLLS_WITHOUT_LIBS(backing_enum_t::DLLS_WITHOUT_LIBS); + static constexpr std::array values = { EMPTY_PACKAGE, DLLS_WITHOUT_LIBS }; + type parse(const std::string& s); } diff --git a/toolsrc/include/PostBuildLint_BuildType.h b/toolsrc/include/PostBuildLint_BuildType.h index a5cb24f492e..31fbb11c902 100644 --- a/toolsrc/include/PostBuildLint_BuildType.h +++ b/toolsrc/include/PostBuildLint_BuildType.h @@ -1,45 +1,47 @@ #pragma once #include "PostBuildLint_ConfigurationType.h" #include "PostBuildLint_LinkageType.h" -#include +#include #include -namespace vcpkg::PostBuildLint +namespace vcpkg::PostBuildLint::BuildType { - struct BuildType + enum class backing_enum_t { - static BuildType value_of(const ConfigurationType& config, const LinkageType& linkage); - - static const BuildType DEBUG_STATIC; - static const BuildType DEBUG_DYNAMIC; - static const BuildType RELEASE_STATIC; - static const BuildType RELEASE_DYNAMIC; - - static const std::vector& values() - { - static const std::vector v = { DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC }; - return v; - } - - BuildType() = delete; - - const ConfigurationType& config() const; - const LinkageType& linkage() const; - std::regex crt_regex() const; - std::string toString() const; - - private: - BuildType(const ConfigurationType& config, const LinkageType& linkage, const std::string& crt_regex_as_string) - : m_config(config), m_linkage(linkage), m_crt_regex_as_string(crt_regex_as_string) - { - } - - ConfigurationType m_config; - LinkageType m_linkage; - std::string m_crt_regex_as_string; + DEBUG_STATIC = 1, + DEBUG_DYNAMIC, + RELEASE_STATIC, + RELEASE_DYNAMIC }; - bool operator ==(const BuildType& lhs, const BuildType& rhs); + struct type + { + type() = delete; - bool operator !=(const BuildType& lhs, const BuildType& rhs); + constexpr explicit type(const backing_enum_t backing_enum, const ConfigurationType::type config, const LinkageType::type linkage) : + backing_enum(backing_enum), m_config(config), m_linkage(linkage) { } + + constexpr operator backing_enum_t() const { return backing_enum; } + + const ConfigurationType::type& config() const; + const LinkageType::type& linkage() const; + const std::regex& crt_regex() const; + const std::string& toString() const; + + private: + backing_enum_t backing_enum; + ConfigurationType::type m_config; + LinkageType::type m_linkage; + }; + + static const std::string ENUM_NAME = "vcpkg::PostBuildLint::BuildType"; + + static constexpr type DEBUG_STATIC = type(backing_enum_t::DEBUG_STATIC, ConfigurationType::DEBUG, LinkageType::STATIC); + static constexpr type DEBUG_DYNAMIC = type(backing_enum_t::DEBUG_DYNAMIC, ConfigurationType::DEBUG, LinkageType::DYNAMIC); + static constexpr type RELEASE_STATIC = type(backing_enum_t::RELEASE_STATIC, ConfigurationType::RELEASE, LinkageType::STATIC); + static constexpr type RELEASE_DYNAMIC = type(backing_enum_t::RELEASE_DYNAMIC, ConfigurationType::RELEASE, LinkageType::DYNAMIC); + + static constexpr std::array values = { DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC }; + + type value_of(const ConfigurationType::type& config, const LinkageType::type& linkage); } diff --git a/toolsrc/include/PostBuildLint_ConfigurationType.h b/toolsrc/include/PostBuildLint_ConfigurationType.h index 55dede921f8..7245d2932aa 100644 --- a/toolsrc/include/PostBuildLint_ConfigurationType.h +++ b/toolsrc/include/PostBuildLint_ConfigurationType.h @@ -2,13 +2,32 @@ #pragma once #include -namespace vcpkg::PostBuildLint +namespace vcpkg::PostBuildLint::ConfigurationType { - enum class ConfigurationType + enum class backing_enum_t { + NULLVALUE = 0, DEBUG = 1, RELEASE = 2 }; - std::string to_string(const ConfigurationType& conf); + struct type + { + constexpr type() : backing_enum(backing_enum_t::NULLVALUE) {} + constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } + constexpr operator backing_enum_t() const { return backing_enum; } + + const std::string& toString() const; + + private: + backing_enum_t backing_enum; + }; + + static const std::string ENUM_NAME = "vcpkg::PostBuildLint::ConfigurationType"; + + static constexpr type NULLVALUE(backing_enum_t::NULLVALUE); + static constexpr type DEBUG(backing_enum_t::DEBUG); + static constexpr type RELEASE(backing_enum_t::RELEASE); + + static constexpr std::array values = { DEBUG, RELEASE }; } diff --git a/toolsrc/include/PostBuildLint_LinkageType.h b/toolsrc/include/PostBuildLint_LinkageType.h index 7cca97639cb..0cecc8c9fbf 100644 --- a/toolsrc/include/PostBuildLint_LinkageType.h +++ b/toolsrc/include/PostBuildLint_LinkageType.h @@ -1,16 +1,34 @@ #pragma once #include -namespace vcpkg::PostBuildLint +namespace vcpkg::PostBuildLint::LinkageType { - enum class LinkageType + enum class backing_enum_t { + NULLVALUE = 0, DYNAMIC, - STATIC, - UNKNOWN + STATIC }; - LinkageType linkage_type_value_of(const std::string& as_string); + struct type + { + constexpr type() : backing_enum(backing_enum_t::NULLVALUE) {} + constexpr explicit type(backing_enum_t backing_enum) : backing_enum(backing_enum) { } + constexpr operator backing_enum_t() const { return backing_enum; } - std::string to_string(const LinkageType& build_info); + const std::string& toString() const; + + private: + backing_enum_t backing_enum; + }; + + static const std::string ENUM_NAME = "vcpkg::PostBuildLint::LinkageType"; + + static constexpr type NULLVALUE(backing_enum_t::NULLVALUE); + static constexpr type DYNAMIC(backing_enum_t::DYNAMIC); + static constexpr type STATIC(backing_enum_t::STATIC); + + static constexpr std::array values = { DYNAMIC, STATIC }; + + type value_of(const std::string& as_string); } diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index d952403db51..23f1347cfab 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -500,12 +500,12 @@ namespace vcpkg::PostBuildLint struct BuildType_and_file { fs::path file; - BuildType build_type; + BuildType::type build_type; }; - static lint_status check_crt_linkage_of_libs(const BuildType& expected_build_type, const std::vector& libs, const fs::path dumpbin_exe) + static lint_status check_crt_linkage_of_libs(const BuildType::type& expected_build_type, const std::vector& libs, const fs::path dumpbin_exe) { - std::vector bad_build_types = BuildType::values(); + std::vector bad_build_types(BuildType::values.cbegin(), BuildType::values.cend()); bad_build_types.erase(std::remove(bad_build_types.begin(), bad_build_types.end(), expected_build_type), bad_build_types.end()); std::vector libs_with_invalid_crt; @@ -516,7 +516,7 @@ namespace vcpkg::PostBuildLint System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(cmd_line); Checks::check_exit(ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::utf16_to_utf8(cmd_line)); - for (const BuildType& bad_build_type : bad_build_types) + for (const BuildType::type& bad_build_type : bad_build_types) { if (std::regex_search(ec_data.output.cbegin(), ec_data.output.cend(), bad_build_type.crt_regex())) { @@ -662,7 +662,7 @@ namespace vcpkg::PostBuildLint switch (build_info.library_linkage) { - case LinkageType::DYNAMIC: + case LinkageType::backing_enum_t::DYNAMIC: { const std::vector debug_dlls = Files::recursive_find_files_with_extension_in_dir(debug_bin_dir, ".dll"); const std::vector release_dlls = Files::recursive_find_files_with_extension_in_dir(release_bin_dir, ".dll"); @@ -683,7 +683,7 @@ namespace vcpkg::PostBuildLint error_count += check_outdated_crt_linkage_of_dlls(dlls, dumpbin_exe); break; } - case LinkageType::STATIC: + case LinkageType::backing_enum_t::STATIC: { std::vector dlls; Files::recursive_find_files_with_extension_in_dir(package_dir, ".dll", &dlls); @@ -695,7 +695,7 @@ namespace vcpkg::PostBuildLint error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, build_info.crt_linkage), release_libs, dumpbin_exe); break; } - case LinkageType::UNKNOWN: + case LinkageType::backing_enum_t::NULLVALUE: default: Checks::unreachable(); } diff --git a/toolsrc/src/PostBuildLint_BuildInfo.cpp b/toolsrc/src/PostBuildLint_BuildInfo.cpp index 54408500089..7308c9bac0a 100644 --- a/toolsrc/src/PostBuildLint_BuildInfo.cpp +++ b/toolsrc/src/PostBuildLint_BuildInfo.cpp @@ -17,18 +17,18 @@ namespace vcpkg::PostBuildLint { BuildInfo build_info; const std::string crt_linkage_as_string = details::remove_required_field(&pgh, BuildInfoRequiredField::CRT_LINKAGE); - build_info.crt_linkage = linkage_type_value_of(crt_linkage_as_string); - Checks::check_exit(build_info.crt_linkage != LinkageType::UNKNOWN, "Invalid crt linkage type: [%s]", crt_linkage_as_string); + build_info.crt_linkage = LinkageType::value_of(crt_linkage_as_string); + Checks::check_exit(build_info.crt_linkage != LinkageType::NULLVALUE, "Invalid crt linkage type: [%s]", crt_linkage_as_string); const std::string library_linkage_as_string = details::remove_required_field(&pgh, BuildInfoRequiredField::LIBRARY_LINKAGE); - build_info.library_linkage = linkage_type_value_of(library_linkage_as_string); - Checks::check_exit(build_info.library_linkage != LinkageType::UNKNOWN, "Invalid library linkage type: [%s]", library_linkage_as_string); + build_info.library_linkage = LinkageType::value_of(library_linkage_as_string); + Checks::check_exit(build_info.library_linkage != LinkageType::NULLVALUE, "Invalid library linkage type: [%s]", library_linkage_as_string); // The remaining entries are policies for (const std::unordered_map::value_type& p : pgh) { const BuildPolicies::type policy = BuildPolicies::parse(p.first); - Checks::check_exit(policy != BuildPolicies::UNKNOWN, "Unknown policy found: %s", p.first); + Checks::check_exit(policy != BuildPolicies::NULLVALUE, "Unknown policy found: %s", p.first); const opt_bool_t status = opt_bool::parse(p.second); build_info.policies.emplace(policy, status); } diff --git a/toolsrc/src/PostBuildLint_BuildPolicies.cpp b/toolsrc/src/PostBuildLint_BuildPolicies.cpp index 4e5ac3ceae2..53dfcf95a3c 100644 --- a/toolsrc/src/PostBuildLint_BuildPolicies.cpp +++ b/toolsrc/src/PostBuildLint_BuildPolicies.cpp @@ -1,10 +1,11 @@ #include "pch.h" #include "PostBuildLint_BuildPolicies.h" -#include "vcpkg_Checks.h" +#include "vcpkg_Enums.h" namespace vcpkg::PostBuildLint::BuildPolicies { - static const std::string NAME_UNKNOWN = "PolicyUnknown"; + static const std::string NULLVALUE_STRING = Enums::nullvalue_toString(ENUM_NAME); + static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; @@ -16,10 +17,10 @@ namespace vcpkg::PostBuildLint::BuildPolicies return NAME_EMPTY_PACKAGE; case DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS; - case UNKNOWN: - return NAME_UNKNOWN; + case NULLVALUE: + return NULLVALUE_STRING; default: - Checks::unreachable(); + Enums::unreachable(ENUM_NAME); } } @@ -34,21 +35,13 @@ namespace vcpkg::PostBuildLint::BuildPolicies return CMAKE_VARIABLE_EMPTY_PACKAGE; case DLLS_WITHOUT_LIBS: return CMAKE_VARIABLE_DLLS_WITHOUT_LIBS; - case UNKNOWN: - Checks::exit_with_message("No CMake command corresponds to UNKNOWN"); + case NULLVALUE: + Enums::nullvalue_used(ENUM_NAME); default: - Checks::unreachable(); + Enums::unreachable(ENUM_NAME); } } - type::type(): backing_enum(backing_enum_t::UNKNOWN) {} - - const std::vector& values() - { - static const std::vector& v = {UNKNOWN, EMPTY_PACKAGE, DLLS_WITHOUT_LIBS}; - return v; - } - type parse(const std::string& s) { if (s == NAME_EMPTY_PACKAGE) @@ -61,6 +54,6 @@ namespace vcpkg::PostBuildLint::BuildPolicies return BuildPolicies::DLLS_WITHOUT_LIBS; } - return BuildPolicies::UNKNOWN; + return BuildPolicies::NULLVALUE; } } diff --git a/toolsrc/src/PostBuildLint_BuildType.cpp b/toolsrc/src/PostBuildLint_BuildType.cpp index b4e199aee4c..f2fb292d758 100644 --- a/toolsrc/src/PostBuildLint_BuildType.cpp +++ b/toolsrc/src/PostBuildLint_BuildType.cpp @@ -1,15 +1,10 @@ #include "pch.h" #include "PostBuildLint_BuildType.h" -#include "vcpkg_Checks.h" +#include "vcpkg_Enums.h" -namespace vcpkg::PostBuildLint +namespace vcpkg::PostBuildLint::BuildType { - const BuildType BuildType::DEBUG_STATIC = BuildType(ConfigurationType::DEBUG, LinkageType::STATIC, R"(/DEFAULTLIB:LIBCMTD)"); - const BuildType BuildType::DEBUG_DYNAMIC = BuildType(ConfigurationType::DEBUG, LinkageType::DYNAMIC, R"(/DEFAULTLIB:MSVCRTD)"); - const BuildType BuildType::RELEASE_STATIC = BuildType(ConfigurationType::RELEASE, LinkageType::STATIC, R"(/DEFAULTLIB:LIBCMT[^D])"); - const BuildType BuildType::RELEASE_DYNAMIC = BuildType(ConfigurationType::RELEASE, LinkageType::DYNAMIC, R"(/DEFAULTLIB:MSVCRT[^D])"); - - BuildType BuildType::value_of(const ConfigurationType& config, const LinkageType& linkage) + type value_of(const ConfigurationType::type& config, const LinkageType::type& linkage) { if (config == ConfigurationType::DEBUG && linkage == LinkageType::STATIC) { @@ -31,38 +26,60 @@ namespace vcpkg::PostBuildLint return RELEASE_DYNAMIC; } - Checks::unreachable(); + Enums::unreachable(ENUM_NAME); } - const ConfigurationType& BuildType::config() const + const ConfigurationType::type& type::config() const { return this->m_config; } - const LinkageType& BuildType::linkage() const + const LinkageType::type& type::linkage() const { return this->m_linkage; } - std::regex BuildType::crt_regex() const + const std::regex& type::crt_regex() const { - const std::regex r(this->m_crt_regex_as_string, std::regex_constants::icase); - return r; + static const std::regex REGEX_DEBUG_STATIC(R"(/DEFAULTLIB:LIBCMTD)", std::regex_constants::icase); + static const std::regex REGEX_DEBUG_DYNAMIC(R"(/DEFAULTLIB:MSVCRTD)", std::regex_constants::icase); + static const std::regex REGEX_RELEASE_STATIC(R"(/DEFAULTLIB:LIBCMT[^D])", std::regex_constants::icase); + static const std::regex REGEX_RELEASE_DYNAMIC(R"(/DEFAULTLIB:MSVCRT[^D])", std::regex_constants::icase); + + switch (backing_enum) + { + case BuildType::DEBUG_STATIC: + return REGEX_DEBUG_STATIC; + case BuildType::DEBUG_DYNAMIC: + return REGEX_DEBUG_DYNAMIC; + case BuildType::RELEASE_STATIC: + return REGEX_RELEASE_STATIC; + case BuildType::RELEASE_DYNAMIC: + return REGEX_RELEASE_DYNAMIC; + default: + Enums::unreachable(ENUM_NAME); + } } - std::string BuildType::toString() const + const std::string& type::toString() const { - const std::string s = Strings::format("[%s,%s]", to_string(this->m_config), to_string(this->m_linkage)); - return s; - } + static const std::string NAME_DEBUG_STATIC("Debug,Static"); + static const std::string NAME_DEBUG_DYNAMIC("Debug,Dynamic"); + static const std::string NAME_RELEASE_STATIC("Release,Static"); + static const std::string NAME_RELEASE_DYNAMIC("Release,Dynamic"); - bool operator==(const BuildType& lhs, const BuildType& rhs) - { - return lhs.config() == rhs.config() && lhs.linkage() == rhs.linkage(); - } - - bool operator!=(const BuildType& lhs, const BuildType& rhs) - { - return !(lhs == rhs); + switch (backing_enum) + { + case BuildType::DEBUG_STATIC: + return NAME_DEBUG_STATIC; + case BuildType::DEBUG_DYNAMIC: + return NAME_DEBUG_DYNAMIC; + case BuildType::RELEASE_STATIC: + return NAME_RELEASE_STATIC; + case BuildType::RELEASE_DYNAMIC: + return NAME_RELEASE_DYNAMIC; + default: + Enums::unreachable(ENUM_NAME); + } } } diff --git a/toolsrc/src/PostBuildLint_ConfigurationType.cpp b/toolsrc/src/PostBuildLint_ConfigurationType.cpp index 9c3499cac3c..990b10a37c2 100644 --- a/toolsrc/src/PostBuildLint_ConfigurationType.cpp +++ b/toolsrc/src/PostBuildLint_ConfigurationType.cpp @@ -1,19 +1,26 @@ #include "pch.h" #include "PostBuildLint_ConfigurationType.h" -#include "vcpkg_Checks.h" +#include "vcpkg_Enums.h" -namespace vcpkg::PostBuildLint +namespace vcpkg::PostBuildLint::ConfigurationType { - std::string to_string(const ConfigurationType& conf) + static const std::string NULLVALUE_STRING = Enums::nullvalue_toString(ENUM_NAME); + + static const std::string NAME_DEBUG = "Debug"; + static const std::string NAME_RELEASE = "Release"; + + const std::string& type::toString() const { - switch (conf) + switch (this->backing_enum) { - case ConfigurationType::DEBUG: - return "Debug"; - case ConfigurationType::RELEASE: - return "Release"; - default: - Checks::unreachable(); + case ConfigurationType::DEBUG: + return NAME_DEBUG; + case ConfigurationType::RELEASE: + return NAME_RELEASE; + case ConfigurationType::NULLVALUE: + return NULLVALUE_STRING; + default: + Enums::unreachable(ENUM_NAME); } } } diff --git a/toolsrc/src/PostBuildLint_LinkageType.cpp b/toolsrc/src/PostBuildLint_LinkageType.cpp index 8a3f35be8a4..6d2c2c93599 100644 --- a/toolsrc/src/PostBuildLint_LinkageType.cpp +++ b/toolsrc/src/PostBuildLint_LinkageType.cpp @@ -1,34 +1,41 @@ #include "pch.h" #include "PostBuildLint_LinkageType.h" -#include "vcpkg_Checks.h" +#include "vcpkg_Enums.h" -namespace vcpkg::PostBuildLint +namespace vcpkg::PostBuildLint::LinkageType { - LinkageType linkage_type_value_of(const std::string& as_string) + static const std::string NULLVALUE_STRING = Enums::nullvalue_toString(ENUM_NAME); + + static const std::string NAME_DYNAMIC = "dynamic"; + static const std::string NAME_STATIC = "static"; + + const std::string& type::toString() const { - if (as_string == "dynamic") + switch (this->backing_enum) + { + case LinkageType::DYNAMIC: + return NAME_DYNAMIC; + case LinkageType::STATIC: + return NAME_STATIC; + case LinkageType::NULLVALUE: + return NULLVALUE_STRING; + default: + Enums::unreachable(ENUM_NAME); + } + } + + type value_of(const std::string& as_string) + { + if (as_string == NAME_DYNAMIC) { return LinkageType::DYNAMIC; } - if (as_string == "static") + if (as_string == NAME_STATIC) { return LinkageType::STATIC; } - return LinkageType::UNKNOWN; - } - - std::string to_string(const LinkageType& build_info) - { - switch (build_info) - { - case LinkageType::STATIC: - return "static"; - case LinkageType::DYNAMIC: - return "dynamic"; - default: - Checks::unreachable(); - } + return LinkageType::NULLVALUE; } } From a13b2f0c92d1cd5322ed0cb839a4bba5b1ab6aa7 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 3 Feb 2017 18:10:29 -0800 Subject: [PATCH 038/137] build_package() modified to return the result of the build --- toolsrc/include/PostBuildLint.h | 2 +- toolsrc/include/vcpkg_Commands.h | 11 +++++++++- toolsrc/src/PostBuildLint.cpp | 8 ++++---- toolsrc/src/commands_build.cpp | 27 ++++++++++++++++++++----- toolsrc/src/commands_build_external.cpp | 7 ++++++- toolsrc/src/commands_install.cpp | 6 +++++- 6 files changed, 48 insertions(+), 13 deletions(-) diff --git a/toolsrc/include/PostBuildLint.h b/toolsrc/include/PostBuildLint.h index 215a237aa40..73c8ec54bd3 100644 --- a/toolsrc/include/PostBuildLint.h +++ b/toolsrc/include/PostBuildLint.h @@ -4,5 +4,5 @@ namespace vcpkg::PostBuildLint { - void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths); + size_t perform_all_checks(const package_spec& spec, const vcpkg_paths& paths); } diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 8d772b255fd..ef300ac1214 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -11,7 +11,16 @@ namespace vcpkg::Commands namespace Build { - void build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir); + enum class BuildResult + { + BUILD_NOT_STARTED = 0, + SUCCESS, + CASCADED_DUE_TO_MISSING_DEPENDENCIES, + BUILD_FAILED, + POST_BUILD_CHECKS_FAILED, + }; + + BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); } diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index 23f1347cfab..a5fd7aa52e5 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -619,6 +619,7 @@ namespace vcpkg::PostBuildLint left += static_cast(right); } + static size_t perform_all_checks_and_return_error_count(const package_spec& spec, const vcpkg_paths& paths) { const fs::path dumpbin_exe = Environment::get_dumpbin_exe(paths); @@ -710,19 +711,18 @@ namespace vcpkg::PostBuildLint return error_count; } - void perform_all_checks(const package_spec& spec, const vcpkg_paths& paths) + size_t perform_all_checks(const package_spec& spec, const vcpkg_paths& paths) { System::println("-- Performing post-build validation"); - const size_t error_count = perform_all_checks_and_return_error_count(spec, paths); + System::println("-- Performing post-build validation done"); if (error_count != 0) { const fs::path portfile = paths.ports / spec.name() / "portfile.cmake"; System::println(System::color::error, "Found %u error(s). Please correct the portfile:\n %s", error_count, portfile.string()); - exit(EXIT_FAILURE); } - System::println("-- Performing post-build validation done"); + return error_count; } } diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index c5a27845069..a9c6469d794 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -9,6 +9,7 @@ #include "vcpkg_Environment.h" #include "metrics.h" #include "vcpkg_info.h" +#include "vcpkg_Enums.h" namespace vcpkg::Commands::Build { @@ -24,7 +25,7 @@ namespace vcpkg::Commands::Build std::ofstream(binary_control_file) << bpgh; } - void build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir) + BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir) { Checks::check_exit(spec.name() == source_paragraph.name, "inconsistent arguments to build_internal()"); const triplet& target_triplet = spec.target_triplet(); @@ -58,15 +59,22 @@ namespace vcpkg::Commands::Build , spec.toString(), Info::version()); TrackProperty("error", "build failed"); TrackProperty("build_error", spec.toString()); - exit(EXIT_FAILURE); + return BuildResult::BUILD_FAILED; } - PostBuildLint::perform_all_checks(spec, paths); + const size_t error_count = PostBuildLint::perform_all_checks(spec, paths); + + if (error_count != 0) + { + return BuildResult::POST_BUILD_CHECKS_FAILED; + } create_binary_control_file(paths, source_paragraph, target_triplet); // const fs::path port_buildtrees_dir = paths.buildtrees / spec.name; // delete_directory(port_buildtrees_dir); + + return BuildResult::SUCCESS; } void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) @@ -86,7 +94,11 @@ namespace vcpkg::Commands::Build const std::unordered_set options = args.check_and_get_optional_command_arguments({OPTION_CHECKS_ONLY}); if (options.find(OPTION_CHECKS_ONLY) != options.end()) { - PostBuildLint::perform_all_checks(spec, paths); + const size_t error_count = PostBuildLint::perform_all_checks(spec, paths); + if (error_count > 0) + { + exit(EXIT_FAILURE); + } exit(EXIT_SUCCESS); } @@ -125,7 +137,12 @@ namespace vcpkg::Commands::Build } Environment::ensure_utilities_on_path(paths); - build_package(spgh, spec, paths, paths.port_dir(spec)); + const BuildResult result = build_package(spgh, spec, paths, paths.port_dir(spec)); + if (result != BuildResult::SUCCESS) + { + exit(EXIT_FAILURE); + } + exit(EXIT_SUCCESS); } } diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/commands_build_external.cpp index 5c3fa9857e9..8e9bf50fde9 100644 --- a/toolsrc/src/commands_build_external.cpp +++ b/toolsrc/src/commands_build_external.cpp @@ -21,7 +21,12 @@ namespace vcpkg::Commands::BuildExternal const expected maybe_spgh = try_load_port(port_dir); if (auto spgh = maybe_spgh.get()) { - Commands::Build::build_package(*spgh, *spec, paths, port_dir); + const Build::BuildResult result = Commands::Build::build_package(*spgh, *spec, paths, port_dir); + if (result !=Build::BuildResult::SUCCESS) + { + exit(EXIT_FAILURE); + } + exit(EXIT_SUCCESS); } } diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp index 1f5a2234d88..48da05e9c9c 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/commands_install.cpp @@ -214,7 +214,11 @@ namespace vcpkg::Commands::Install } else if (action.plan.plan_type == install_plan_type::BUILD_AND_INSTALL) { - Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec)); + const Build::BuildResult result = Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec)); + if (result != Build::BuildResult::SUCCESS) + { + exit(EXIT_FAILURE); + } const BinaryParagraph bpgh = try_load_cached_package(paths, action.spec).get_or_throw(); install_package(paths, bpgh, &status_db); System::println(System::color::success, "Package %s is installed", action.spec); From d46370aae5a3d94203b2614ea927b50d271c62b3 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Feb 2017 12:37:35 -0800 Subject: [PATCH 039/137] Fix error message --- toolsrc/src/commands_build.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index a9c6469d794..9efa114d2c1 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -27,7 +27,7 @@ namespace vcpkg::Commands::Build BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir) { - Checks::check_exit(spec.name() == source_paragraph.name, "inconsistent arguments to build_internal()"); + Checks::check_exit(spec.name() == source_paragraph.name, "inconsistent arguments to build_package()"); const triplet& target_triplet = spec.target_triplet(); const fs::path ports_cmake_script_path = paths.ports_cmake; From a0eb236eaa21d44351d0adcf7e4525f0a99e0c08 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Feb 2017 13:59:56 -0800 Subject: [PATCH 040/137] Remove unused #include --- toolsrc/src/commands_build.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index 9efa114d2c1..fa2468e1c49 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -9,7 +9,6 @@ #include "vcpkg_Environment.h" #include "metrics.h" #include "vcpkg_info.h" -#include "vcpkg_Enums.h" namespace vcpkg::Commands::Build { From 4cef21b894b5ce8507447c6c63fb0f00228b75ec Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 11 Feb 2017 09:51:02 -0800 Subject: [PATCH 041/137] [bootstrap] Specify NuGet Source to avoid impact from user config. --- scripts/findVisualStudioInstallationInstances.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1 index 951975758c2..9034ddfa8fb 100644 --- a/scripts/findVisualStudioInstallationInstances.ps1 +++ b/scripts/findVisualStudioInstallationInstances.ps1 @@ -14,7 +14,7 @@ $nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget" $nugetPackageDir = "$downloadsDir\nuget-packages" $SetupAPIVersion = "1.5.125-rc" -$nugetOutput = & $nugetexe install Microsoft.VisualStudio.Setup.Configuration.Native -Version $SetupAPIVersion -OutputDirectory $nugetPackageDir -nocache 2>&1 +$nugetOutput = & $nugetexe install Microsoft.VisualStudio.Setup.Configuration.Native -Version $SetupAPIVersion -OutputDirectory $nugetPackageDir -Source "https://api.nuget.org/v3/index.json" -nocache 2>&1 $SetupConsoleExe = "$nugetPackageDir\Microsoft.VisualStudio.Setup.Configuration.Native.$SetupAPIVersion\tools\x86\Microsoft.VisualStudio.Setup.Configuration.Console.exe" From c9bf4b613867177001176f7f8bba5c883b6e4361 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 11 Feb 2017 10:39:57 -0800 Subject: [PATCH 042/137] [sfml] Update to 2.4.2 --- ports/sfml/CONTROL | 2 +- ports/sfml/portfile.cmake | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/sfml/CONTROL b/ports/sfml/CONTROL index 175aaa0ab60..e7fb08ecd7b 100644 --- a/ports/sfml/CONTROL +++ b/ports/sfml/CONTROL @@ -1,4 +1,4 @@ Source: sfml -Version: 2.4.1 +Version: 2.4.2 Description: Simple and fast multimedia library Build-Depends: freetype, libflac, libjpeg-turbo, libogg, libvorbis, openal-soft, stb diff --git a/ports/sfml/portfile.cmake b/ports/sfml/portfile.cmake index 916b033ef31..69f114ca541 100644 --- a/ports/sfml/portfile.cmake +++ b/ports/sfml/portfile.cmake @@ -1,10 +1,10 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SFML-2.4.1) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SFML-2.4.2) vcpkg_download_distfile(ARCHIVE - URLS "http://www.sfml-dev.org/files/SFML-2.4.1-sources.zip" - FILENAME "SFML-2.4.1-sources.zip" - SHA512 e2a49927e1db6ab94fa52b88460782fa2b28ccd4a8c75793e10c7669b24736f63aab723c2e1d8befc96f6f5cf4ed185f13da2550da721d206780003f158e5507) + URLS "http://www.sfml-dev.org/files/SFML-2.4.2-sources.zip" + FILENAME "SFML-2.4.2-sources.zip" + SHA512 14f2b9f244bbff681d1992581f20012f3073456e4baed0fb2bf2cf82538e9c5ddd8ce01b0cfb3874af47091ec19654aa23c426df04fe1ffcfa209623dc362f85) vcpkg_extract_source_archive(${ARCHIVE}) From a932e5fc209db0bfae032da585de7d86d98c5d7a Mon Sep 17 00:00:00 2001 From: Iraklis Karagkiozoglou Date: Mon, 13 Feb 2017 05:35:12 +0200 Subject: [PATCH 043/137] libnice port --- ports/libnice/CMakeLists.txt | 144 +++++++++++++++++++++++++++++++++++ ports/libnice/CONTROL | 4 + ports/libnice/portfile.cmake | 32 ++++++++ 3 files changed, 180 insertions(+) create mode 100644 ports/libnice/CMakeLists.txt create mode 100644 ports/libnice/CONTROL create mode 100644 ports/libnice/portfile.cmake diff --git a/ports/libnice/CMakeLists.txt b/ports/libnice/CMakeLists.txt new file mode 100644 index 00000000000..3c8206cda05 --- /dev/null +++ b/ports/libnice/CMakeLists.txt @@ -0,0 +1,144 @@ +cmake_minimum_required(VERSION 3.0) +project(libnice C) +SET (this_target libnice) + +add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) + +configure_file(${CMAKE_SOURCE_DIR}/win32/vs9/config.h ${CMAKE_SOURCE_DIR}/config.h COPYONLY) +configure_file(${CMAKE_SOURCE_DIR}/win32/vs9/libnice.def ${CMAKE_SOURCE_DIR}/libnice.def COPYONLY) + +find_path(GLIB_INCLUDE_DIR glib.h) +find_library(GLIB_LIBRARY glib-2.0) +find_library(GOBJECT_LIBRARY gobject-2.0) +find_library(GIO_LIBRARY gio-2.0) +find_library(IPHLPAPI_LIBRARY iphlpapi) +find_library(WS2_32_LIB ws2_32) +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/agent + ${CMAKE_CURRENT_SOURCE_DIR}/random + ${CMAKE_CURRENT_SOURCE_DIR}/socket + ${CMAKE_CURRENT_SOURCE_DIR}/stun + ${GLIB_INCLUDE_DIR}) + + +## section: source files +# Add your source files here (one file per line), please SORT in alphabetical order for future maintenance +SET (SRCS + ./agent/address.c + ./agent/agent.c + ./agent/candidate.c + ./agent/component.c + ./agent/conncheck.c + ./agent/debug.c + ./agent/discovery.c + ./agent/discovery.c + ./agent/inputstream.c + ./agent/interfaces.c + ./agent/iostream.c + ./agent/outputstream.c + ./agent/pseudotcp.c + ./agent/stream.c + ./random/random.c + ./random/random-glib.c + ./socket/http.c + ./socket/pseudossl.c + ./socket/socket.c + ./socket/socks5.c + ./socket/tcp-active.c + ./socket/tcp-bsd.c + ./socket/tcp-passive.c + ./socket/udp-bsd.c + ./socket/udp-turn.c + ./socket/udp-turn-over-tcp.c + ./stun/debug.c + ./stun/md5.c + ./stun/rand.c + ./stun/sha1.c + ./stun/stun5389.c + ./stun/stunagent.c + ./stun/stuncrc32.c + ./stun/stunhmac.c + ./stun/stunmessage.c + ./stun/usages/bind.c + ./stun/usages/ice.c + ./stun/usages/timer.c + ./stun/usages/turn.c + ./stun/utils.c + ./libnice.def + ) + +## section: header files +# Add your header files here(one file per line), please SORT in alphabetical order for future maintenance! +SET(HEADERS + ./config.h + ./agent/address.h + ./agent/agent.h + ./agent/agent-priv.h + ./agent/candidate.h + ./agent/component.h + ./agent/conncheck.h + ./agent/debug.h + ./agent/discovery.h + ./agent/discovery.h + ./agent/inputstream.h + ./agent/interfaces.h + ./agent/iostream.h + ./agent/outputstream.h + ./agent/pseudotcp.h + ./agent/stream.h + ./random/random.h + ./random/random-glib.h + ./socket/http.h + ./socket/pseudossl.h + ./socket/socket.h + ./socket/socks5.h + ./socket/tcp-active.h + ./socket/tcp-bsd.h + ./socket/tcp-passive.h + ./socket/udp-bsd.h + ./socket/udp-turn.h + ./socket/udp-turn-over-tcp.h + ./stun/constants.h + ./stun/debug.h + ./stun/md5.h + ./stun/rand.h + ./stun/sha1.h + ./stun/stun5389.h + ./stun/stunagent.h + ./stun/stuncrc32.h + ./stun/stunhmac.h + ./stun/stunmessage.h + ./stun/usages/bind.h + ./stun/usages/ice.h + ./stun/usages/timer.h + ./stun/usages/turn.h + ./stun/utils.h + ./stun/win32_common.h + ) +add_library(libnice ${SRCS} ${HEADERS}) +set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/wd4244 /wd4005 /wd4391 /wd4142 /wd4267") +target_link_libraries(libnice ${IPHLPAPI_LIBRARY} ${WS2_32_LIB} ${GLIB_LIBRARY} ${GOBJECT_LIBRARY} ${GIO_LIBRARY}) +install(TARGETS libnice +RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +if (${CMAKE_BUILD_TYPE} STREQUAL "Release") +install(FILES agent/address.h DESTINATION include/nice) +install(FILES agent/agent.h DESTINATION include/nice) +install(FILES agent/candidate.h DESTINATION include/nice) +install(FILES agent/debug.h DESTINATION include/nice) +install(FILES agent/interfaces.h DESTINATION include/nice) +install(FILES nice/nice.h DESTINATION include/nice) +install(FILES agent/pseudotcp.h DESTINATION include/nice) +install(FILES stun/constants.h DESTINATION include/stun) +install(FILES stun/debug.h DESTINATION include/stun) +install(FILES stun/stunagent.h DESTINATION include/stun) +install(FILES stun/stunmessage.h DESTINATION include/stun) +install(FILES stun/usages/bind.h DESTINATION include/stun/usages) +install(FILES stun/usages/ice.h DESTINATION include/stun/usages) +install(FILES stun/usages/timer.h DESTINATION include/stun/usages) +install(FILES stun/usages/turn.h DESTINATION include/stun/usages) +install(FILES stun/win32_common.h DESTINATION include/stun) +endif() \ No newline at end of file diff --git a/ports/libnice/CONTROL b/ports/libnice/CONTROL new file mode 100644 index 00000000000..7d16f426225 --- /dev/null +++ b/ports/libnice/CONTROL @@ -0,0 +1,4 @@ +Source: libnice +Version: 0.1.13 +Description: Libnice is an implementation of the IETF's Interactive Connectivity Establishment (ICE) standard (RFC 5245) and the Session Traversal Utilities for NAT (STUN) standard (RFC 5389). +Build-Depends: glib \ No newline at end of file diff --git a/ports/libnice/portfile.cmake b/ports/libnice/portfile.cmake new file mode 100644 index 00000000000..eb829d4a4fb --- /dev/null +++ b/ports/libnice/portfile.cmake @@ -0,0 +1,32 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = +# 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/libnice-0.1.13) +vcpkg_download_distfile(ARCHIVE + URLS "https://nice.freedesktop.org/releases/libnice-0.1.13.tar.gz" + FILENAME "libnice-0.1.13.tar.gz" + SHA512 c9bb81e8cd0b4e3673dba07ce08a16dd8821831339b44f1006510cdc09f9ae4c6eb7d43230711a2509867acb8d7df71821c411830dbf71c5a5d7e802f14a32c1 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS_RELEASE -DOPTIMIZE=1 + OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +# Handle copyright +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) +file(COPY ${SOURCE_PATH}/COPYING.LGPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) +file(COPY ${SOURCE_PATH}/COPYING.MPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/libnice/COPYING ${CURRENT_PACKAGES_DIR}/share/libnice/copyright) From a82a0c01b5762470c3e15d3fd1538b2af469cca8 Mon Sep 17 00:00:00 2001 From: Iraklis Karagkiozoglou Date: Mon, 13 Feb 2017 05:45:28 +0200 Subject: [PATCH 044/137] Remove auto generated comments --- ports/libnice/CMakeLists.txt | 5 ----- ports/libnice/portfile.cmake | 13 ++++--------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/ports/libnice/CMakeLists.txt b/ports/libnice/CMakeLists.txt index 3c8206cda05..c631d331714 100644 --- a/ports/libnice/CMakeLists.txt +++ b/ports/libnice/CMakeLists.txt @@ -22,8 +22,6 @@ include_directories( ${GLIB_INCLUDE_DIR}) -## section: source files -# Add your source files here (one file per line), please SORT in alphabetical order for future maintenance SET (SRCS ./agent/address.c ./agent/agent.c @@ -67,9 +65,6 @@ SET (SRCS ./stun/utils.c ./libnice.def ) - -## section: header files -# Add your header files here(one file per line), please SORT in alphabetical order for future maintenance! SET(HEADERS ./config.h ./agent/address.h diff --git a/ports/libnice/portfile.cmake b/ports/libnice/portfile.cmake index eb829d4a4fb..4d4a97baeca 100644 --- a/ports/libnice/portfile.cmake +++ b/ports/libnice/portfile.cmake @@ -1,13 +1,7 @@ -# Common Ambient Variables: -# VCPKG_ROOT_DIR = -# 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/libnice-0.1.13) + vcpkg_download_distfile(ARCHIVE URLS "https://nice.freedesktop.org/releases/libnice-0.1.13.tar.gz" FILENAME "libnice-0.1.13.tar.gz" @@ -16,6 +10,7 @@ vcpkg_download_distfile(ARCHIVE vcpkg_extract_source_archive(${ARCHIVE}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS_RELEASE -DOPTIMIZE=1 @@ -23,9 +18,9 @@ vcpkg_configure_cmake( ) vcpkg_install_cmake() + vcpkg_copy_pdbs() -# Handle copyright file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) file(COPY ${SOURCE_PATH}/COPYING.LGPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) file(COPY ${SOURCE_PATH}/COPYING.MPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/libnice) From a59f6dda5ee6874e859276bbc3066247d705a904 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sun, 12 Feb 2017 23:54:05 -0800 Subject: [PATCH 045/137] [libepoxy] Disable static builds due to dllimport/export issues. --- ports/libepoxy/CONTROL | 2 +- ports/libepoxy/portfile.cmake | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/libepoxy/CONTROL b/ports/libepoxy/CONTROL index 8ac70cd2242..963a3e17a3d 100644 --- a/ports/libepoxy/CONTROL +++ b/ports/libepoxy/CONTROL @@ -1,3 +1,3 @@ Source: libepoxy -Version: 1.4.0-2432daf +Version: 1.4.0-2432daf-1 Description: Epoxy is a library for handling OpenGL function pointer management for you diff --git a/ports/libepoxy/portfile.cmake b/ports/libepoxy/portfile.cmake index 188cd3668cb..ef1880d16de 100644 --- a/ports/libepoxy/portfile.cmake +++ b/ports/libepoxy/portfile.cmake @@ -1,3 +1,7 @@ +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + message(STATUS "Warning: Static building not supported yet. Building dynamic.") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libepoxy-2432daf4cf58b5ff11e008ca34811588285c43b3) From 7bc68516386015730ff5062b54534226df8c7763 Mon Sep 17 00:00:00 2001 From: Guillaume Dumont Date: Mon, 13 Feb 2017 12:04:53 -0500 Subject: [PATCH 046/137] Updated patch to fix sizeof off_t differences between UNIX and Windows --- ...8275d2a410e683bae4ef44881e0f55fa3c4d.patch | 436 ++++++++++-------- 1 file changed, 231 insertions(+), 205 deletions(-) diff --git a/ports/lmdb/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch b/ports/lmdb/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch index 18fd36fd660..e6d1f108c04 100644 --- a/ports/lmdb/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch +++ b/ports/lmdb/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch @@ -252,7 +252,7 @@ index c4d05d1..30d5862 100644 /** @brief Compare two data items according to a particular database. * diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c -index d2e81e4..0110402 100644 +index d2e81e4..1d9e9fa 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -35,9 +35,42 @@ @@ -298,7 +298,26 @@ index d2e81e4..0110402 100644 /** getpid() returns int; MinGW defines pid_t but MinGW64 typedefs it * as int64 which is wrong. MSVC doesn't define it at all, so just * don't use it. -@@ -116,7 +149,9 @@ typedef SSIZE_T ssize_t; +@@ -56,6 +89,10 @@ + # define SSIZE_MAX INT_MAX + # endif + #endif ++/* Windows uses 32-bit off_t to define our own ++ 64 bit offset type ++*/ ++#define offset_t __int64 + #else + #include + #include +@@ -68,6 +105,7 @@ + #include + #endif + #include ++#define offset_t off_t + #endif + + #if defined(__mips) && defined(__linux) +@@ -116,7 +154,9 @@ typedef SSIZE_T ssize_t; #endif #if defined(__APPLE__) || defined (BSD) @@ -309,7 +328,7 @@ index d2e81e4..0110402 100644 # define MDB_FDATASYNC fsync #elif defined(ANDROID) # define MDB_FDATASYNC fsync -@@ -127,12 +162,22 @@ typedef SSIZE_T ssize_t; +@@ -127,12 +167,22 @@ typedef SSIZE_T ssize_t; #ifdef MDB_USE_POSIX_SEM # define MDB_USE_HASH 1 #include @@ -335,7 +354,7 @@ index d2e81e4..0110402 100644 + defined(MDB_USE_POSIX_MUTEX) != 1 # error "Ambiguous shared-lock implementation" #endif -@@ -183,7 +228,7 @@ typedef SSIZE_T ssize_t; +@@ -183,7 +233,7 @@ typedef SSIZE_T ssize_t; #if (BYTE_ORDER == LITTLE_ENDIAN) == (BYTE_ORDER == BIG_ENDIAN) # error "Unknown or unsupported endianness (BYTE_ORDER)" @@ -344,7 +363,7 @@ index d2e81e4..0110402 100644 # error "Two's complement, reasonably sized integer types, please" #endif -@@ -234,6 +279,8 @@ typedef SSIZE_T ssize_t; +@@ -234,6 +284,8 @@ typedef SSIZE_T ssize_t; #define MDB_NO_ROOT (MDB_LAST_ERRCODE + 10) #ifdef _WIN32 #define MDB_OWNERDEAD ((int) WAIT_ABANDONED) @@ -353,7 +372,7 @@ index d2e81e4..0110402 100644 #elif defined(MDB_USE_POSIX_MUTEX) && defined(EOWNERDEAD) #define MDB_OWNERDEAD EOWNERDEAD /**< #LOCK_MUTEX0() result if dead owner */ #endif -@@ -256,16 +303,20 @@ typedef SSIZE_T ssize_t; +@@ -256,16 +308,20 @@ typedef SSIZE_T ssize_t; # define MDB_USE_ROBUST 0 # else # define MDB_USE_ROBUST 1 @@ -378,7 +397,7 @@ index d2e81e4..0110402 100644 #define MDB_ROBUST_SUPPORTED 1 #endif -@@ -288,8 +339,10 @@ typedef HANDLE mdb_mutex_t, mdb_mutexref_t; +@@ -288,8 +344,10 @@ typedef HANDLE mdb_mutex_t, mdb_mutexref_t; #define pthread_mutex_lock(x) WaitForSingleObject(*x, INFINITE) #define pthread_cond_signal(x) SetEvent(*x) #define pthread_cond_wait(cond,mutex) do{SignalObjectAndWait(*mutex, *cond, INFINITE, FALSE); WaitForSingleObject(*mutex, INFINITE);}while(0) @@ -391,7 +410,7 @@ index d2e81e4..0110402 100644 #define LOCK_MUTEX0(mutex) WaitForSingleObject(mutex, INFINITE) #define UNLOCK_MUTEX(mutex) ReleaseMutex(mutex) #define mdb_mutex_consistent(mutex) 0 -@@ -305,12 +358,10 @@ typedef HANDLE mdb_mutex_t, mdb_mutexref_t; +@@ -305,12 +363,10 @@ typedef HANDLE mdb_mutex_t, mdb_mutexref_t; #else #define MDB_PROCESS_QUERY_LIMITED_INFORMATION 0x1000 #endif @@ -404,7 +423,7 @@ index d2e81e4..0110402 100644 /** For MDB_LOCK_FORMAT: True if readers take a pid lock in the lockfile */ #define MDB_PIDLOCK 1 -@@ -329,12 +380,46 @@ mdb_sem_wait(sem_t *sem) +@@ -329,12 +385,46 @@ mdb_sem_wait(sem_t *sem) return rc; } @@ -453,7 +472,7 @@ index d2e81e4..0110402 100644 * @{ */ typedef pthread_mutex_t mdb_mutex_t[1], *mdb_mutexref_t; -@@ -349,7 +434,7 @@ typedef pthread_mutex_t mdb_mutex_t[1], *mdb_mutexref_t; +@@ -349,7 +439,7 @@ typedef pthread_mutex_t mdb_mutex_t[1], *mdb_mutexref_t; /** Mark mutex-protected data as repaired, after death of previous owner. */ #define mdb_mutex_consistent(mutex) pthread_mutex_consistent(mutex) @@ -462,7 +481,7 @@ index d2e81e4..0110402 100644 /** Get the error code for the last failed system function. */ -@@ -374,12 +459,24 @@ typedef pthread_mutex_t mdb_mutex_t[1], *mdb_mutexref_t; +@@ -374,12 +464,24 @@ typedef pthread_mutex_t mdb_mutex_t[1], *mdb_mutexref_t; #define GET_PAGESIZE(x) ((x) = sysconf(_SC_PAGE_SIZE)) #endif @@ -487,7 +506,7 @@ index d2e81e4..0110402 100644 /** @} */ #ifdef MDB_ROBUST_SUPPORTED -@@ -521,7 +618,7 @@ static txnid_t mdb_debug_start; +@@ -521,7 +623,7 @@ static txnid_t mdb_debug_start; /** The version number for a database's datafile format. */ #define MDB_DATA_VERSION ((MDB_DEVEL) ? 999 : 1) /** The version number for a database's lockfile format. */ @@ -496,7 +515,7 @@ index d2e81e4..0110402 100644 /** @brief The max size of a key we can write, or 0 for computed max. * -@@ -712,6 +809,9 @@ typedef struct MDB_txbody { +@@ -712,6 +814,9 @@ typedef struct MDB_txbody { uint32_t mtb_format; #if defined(_WIN32) || defined(MDB_USE_POSIX_SEM) char mtb_rmname[MNAME_LEN]; @@ -506,7 +525,7 @@ index d2e81e4..0110402 100644 #else /** Mutex protecting access to this table. * This is the reader table lock used with LOCK_MUTEX(). -@@ -740,12 +840,19 @@ typedef struct MDB_txninfo { +@@ -740,12 +845,19 @@ typedef struct MDB_txninfo { #define mti_rmname mt1.mtb.mtb_rmname #define mti_txnid mt1.mtb.mtb_txnid #define mti_numreaders mt1.mtb.mtb_numreaders @@ -526,7 +545,7 @@ index d2e81e4..0110402 100644 #else mdb_mutex_t mt2_wmutex; #define mti_wmutex mt2.mt2_wmutex -@@ -760,12 +867,27 @@ typedef struct MDB_txninfo { +@@ -760,12 +872,27 @@ typedef struct MDB_txninfo { ((uint32_t) \ ((MDB_LOCK_VERSION) \ /* Flags which describe functionality */ \ @@ -557,7 +576,7 @@ index d2e81e4..0110402 100644 */ typedef struct MDB_page { #define mp_pgno mp_p.p_pgno -@@ -774,7 +896,7 @@ typedef struct MDB_page { +@@ -774,7 +901,7 @@ typedef struct MDB_page { pgno_t p_pgno; /**< page number */ struct MDB_page *p_next; /**< for in-memory list of freed pages */ } mp_p; @@ -566,7 +585,7 @@ index d2e81e4..0110402 100644 /** @defgroup mdb_page Page Flags * @ingroup internal * Flags for the page headers. -@@ -841,7 +963,9 @@ typedef struct MDB_page { +@@ -841,7 +968,9 @@ typedef struct MDB_page { /** The number of overflow pages needed to store the given size. */ #define OVPAGES(size, psize) ((PAGEHDRSZ-1 + (size)) / (psize) + 1) @@ -577,7 +596,7 @@ index d2e81e4..0110402 100644 #define NEXT_LOOSE_PAGE(p) (*(MDB_page **)((p) + 2)) /** Header for a single key/data pair within a page. -@@ -924,7 +1048,7 @@ typedef struct MDB_node { +@@ -924,7 +1053,7 @@ typedef struct MDB_node { #ifdef MISALIGNED_OK #define COPY_PGNO(dst,src) dst = src #else @@ -586,7 +605,7 @@ index d2e81e4..0110402 100644 #define COPY_PGNO(dst,src) do { \ unsigned short *s, *d; \ s = (unsigned short *)&(src); \ -@@ -965,13 +1089,13 @@ typedef struct MDB_db { +@@ -965,13 +1094,13 @@ typedef struct MDB_db { pgno_t md_branch_pages; /**< number of internal pages */ pgno_t md_leaf_pages; /**< number of leaf pages */ pgno_t md_overflow_pages; /**< number of overflow pages */ @@ -602,7 +621,7 @@ index d2e81e4..0110402 100644 #define VALID_FLAGS (MDB_REVERSEKEY|MDB_DUPSORT|MDB_INTEGERKEY|MDB_DUPFIXED|\ MDB_INTEGERDUP|MDB_REVERSEDUP|MDB_CREATE) -@@ -995,14 +1119,25 @@ typedef struct MDB_meta { +@@ -995,14 +1124,25 @@ typedef struct MDB_meta { uint32_t mm_magic; /** Version number of this file. Must be set to #MDB_DATA_VERSION. */ uint32_t mm_version; @@ -630,7 +649,7 @@ index d2e81e4..0110402 100644 volatile txnid_t mm_txnid; /**< txnid that committed this page */ } MDB_meta; -@@ -1039,6 +1174,9 @@ struct MDB_txn { +@@ -1039,6 +1179,9 @@ struct MDB_txn { /** Nested txn under this txn, set together with flag #MDB_TXN_HAS_CHILD */ MDB_txn *mt_child; pgno_t mt_next_pgno; /**< next unallocated page */ @@ -640,7 +659,7 @@ index d2e81e4..0110402 100644 /** The ID of this transaction. IDs are integers incrementing from 1. * Only committed write transactions increment the ID. If a transaction * aborts, the ID may be re-used by the next writer. -@@ -1052,7 +1190,7 @@ struct MDB_txn { +@@ -1052,7 +1195,7 @@ struct MDB_txn { * in this transaction, linked through #NEXT_LOOSE_PAGE(page). */ MDB_page *mt_loose_pgs; @@ -649,7 +668,7 @@ index d2e81e4..0110402 100644 int mt_loose_count; /** The sorted list of dirty pages we temporarily wrote to disk * because the dirty list was full. page numbers in here are -@@ -1085,6 +1223,19 @@ struct MDB_txn { +@@ -1085,6 +1228,19 @@ struct MDB_txn { MDB_cursor **mt_cursors; /** Array of flags for each DB */ unsigned char *mt_dbflags; @@ -669,7 +688,7 @@ index d2e81e4..0110402 100644 /** Number of DB records in use, or 0 when the txn is finished. * This number only ever increments until the txn finishes; we * don't decrement it when individual DB handles are closed. -@@ -1096,7 +1247,9 @@ struct MDB_txn { +@@ -1096,7 +1252,9 @@ struct MDB_txn { * @{ */ /** #mdb_txn_begin() flags */ @@ -680,7 +699,7 @@ index d2e81e4..0110402 100644 #define MDB_TXN_RDONLY MDB_RDONLY /**< read-only transaction */ /* internal txn flags */ #define MDB_TXN_WRITEMAP MDB_WRITEMAP /**< copy of #MDB_env flag in writers */ -@@ -1162,10 +1315,24 @@ struct MDB_cursor { +@@ -1162,10 +1320,24 @@ struct MDB_cursor { #define C_SUB 0x04 /**< Cursor is a sub-cursor */ #define C_DEL 0x08 /**< last op was a cursor_del */ #define C_UNTRACK 0x40 /**< Un-track cursor when closing */ @@ -705,7 +724,7 @@ index d2e81e4..0110402 100644 }; /** Context for sorted-dup records. -@@ -1195,6 +1362,9 @@ struct MDB_env { +@@ -1195,6 +1367,9 @@ struct MDB_env { HANDLE me_fd; /**< The main data file */ HANDLE me_lfd; /**< The lock file */ HANDLE me_mfd; /**< just for writing the meta pages */ @@ -715,16 +734,18 @@ index d2e81e4..0110402 100644 /** Failed to update the meta page. Probably an I/O error. */ #define MDB_FATAL_ERROR 0x80000000U /** Some fields are initialized. */ -@@ -1219,7 +1389,7 @@ struct MDB_env { +@@ -1219,8 +1394,8 @@ struct MDB_env { void *me_pbuf; /**< scratch area for DUPSORT put() */ MDB_txn *me_txn; /**< current write transaction */ MDB_txn *me_txn0; /**< prealloc'd write transaction */ - size_t me_mapsize; /**< size of the data memory map */ +- off_t me_size; /**< current file size */ + mdb_size_t me_mapsize; /**< size of the data memory map */ - off_t me_size; /**< current file size */ ++ offset_t me_size; /**< current file size */ pgno_t me_maxpg; /**< me_mapsize / me_psize */ MDB_dbx *me_dbxs; /**< array of static DB info */ -@@ -1253,6 +1423,13 @@ struct MDB_env { + uint16_t *me_dbflags; /**< array of flags from MDB_db.md_flags */ +@@ -1253,6 +1428,13 @@ struct MDB_env { mdb_mutex_t me_rmutex; mdb_mutex_t me_wmutex; #endif @@ -738,7 +759,7 @@ index d2e81e4..0110402 100644 void *me_userctx; /**< User-settable context */ MDB_assert_func *me_assert_func; /**< Callback for assertion failures */ }; -@@ -1298,7 +1475,7 @@ enum { +@@ -1298,7 +1480,7 @@ enum { #define MDB_END_SLOT MDB_NOTLS /**< release any reader slot if #MDB_NOTLS */ static void mdb_txn_end(MDB_txn *txn, unsigned mode); @@ -747,7 +768,7 @@ index d2e81e4..0110402 100644 static int mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int modify); #define MDB_PS_MODIFY 1 -@@ -1327,7 +1504,7 @@ static int mdb_node_add(MDB_cursor *mc, indx_t indx, +@@ -1327,7 +1509,7 @@ static int mdb_node_add(MDB_cursor *mc, indx_t indx, static void mdb_node_del(MDB_cursor *mc, int ksize); static void mdb_node_shrink(MDB_page *mp, indx_t indx); static int mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft); @@ -756,7 +777,7 @@ index d2e81e4..0110402 100644 static size_t mdb_leaf_size(MDB_env *env, MDB_val *key, MDB_val *data); static size_t mdb_branch_size(MDB_env *env, MDB_val *key); -@@ -1360,13 +1537,18 @@ static int mdb_reader_check0(MDB_env *env, int rlocked, int *dead); +@@ -1360,13 +1542,18 @@ static int mdb_reader_check0(MDB_env *env, int rlocked, int *dead); static MDB_cmp_func mdb_cmp_memn, mdb_cmp_memnr, mdb_cmp_int, mdb_cmp_cint, mdb_cmp_long; /** @endcond */ @@ -776,7 +797,7 @@ index d2e81e4..0110402 100644 #ifdef _WIN32 static SECURITY_DESCRIPTOR mdb_null_sd; static SECURITY_ATTRIBUTES mdb_all_sa; -@@ -1407,6 +1589,7 @@ static char *const mdb_errstr[] = { +@@ -1407,6 +1594,7 @@ static char *const mdb_errstr[] = { "MDB_BAD_TXN: Transaction must abort, has a child, or is invalid", "MDB_BAD_VALSIZE: Unsupported size of key/DB name/data, or wrong DUPFIXED size", "MDB_BAD_DBI: The specified DBI handle was closed/changed unexpectedly", @@ -784,7 +805,7 @@ index d2e81e4..0110402 100644 }; char * -@@ -1417,8 +1600,9 @@ mdb_strerror(int err) +@@ -1417,8 +1605,9 @@ mdb_strerror(int err) * This works as long as no function between the call to mdb_strerror * and the actual use of the message uses more than 4K of stack. */ @@ -796,7 +817,7 @@ index d2e81e4..0110402 100644 #endif int i; if (!err) -@@ -1450,7 +1634,7 @@ mdb_strerror(int err) +@@ -1450,7 +1639,7 @@ mdb_strerror(int err) buf[0] = 0; FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, @@ -805,7 +826,7 @@ index d2e81e4..0110402 100644 return ptr; #else return strerror(err); -@@ -1550,20 +1734,20 @@ mdb_page_list(MDB_page *mp) +@@ -1550,20 +1739,20 @@ mdb_page_list(MDB_page *mp) case P_LEAF|P_LEAF2: type = "LEAF2 page"; break; case P_LEAF|P_LEAF2|P_SUBP: type = "LEAF2 sub-page"; break; case P_OVERFLOW: @@ -830,7 +851,7 @@ index d2e81e4..0110402 100644 for (i=0; imn_data; nsize = NODESIZE + key.mv_size; if (IS_BRANCH(mp)) { @@ -839,7 +860,7 @@ index d2e81e4..0110402 100644 DKEY(&key)); total += nsize; } else { -@@ -1674,7 +1858,7 @@ static void mdb_audit(MDB_txn *txn) +@@ -1674,7 +1863,7 @@ static void mdb_audit(MDB_txn *txn) } } if (freecount + count + NUM_METAS != txn->mt_next_pgno) { @@ -848,7 +869,7 @@ index d2e81e4..0110402 100644 txn->mt_txnid, freecount, count+NUM_METAS, freecount+count+NUM_METAS, txn->mt_next_pgno); } -@@ -1691,10 +1875,8 @@ int +@@ -1691,10 +1880,8 @@ int mdb_dcmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b) { MDB_cmp_func *dcmp = txn->mt_dbxs[dbi].md_dcmp; @@ -860,7 +881,7 @@ index d2e81e4..0110402 100644 return dcmp(a, b); } -@@ -1774,6 +1956,51 @@ mdb_dlist_free(MDB_txn *txn) +@@ -1774,6 +1961,51 @@ mdb_dlist_free(MDB_txn *txn) dl[0].mid = 0; } @@ -912,7 +933,7 @@ index d2e81e4..0110402 100644 /** Loosen or free a single page. * Saves single pages to a list for future reuse * in this same txn. It has been pulled from the freeDB -@@ -1803,7 +2030,7 @@ mdb_page_loose(MDB_cursor *mc, MDB_page *mp) +@@ -1803,7 +2035,7 @@ mdb_page_loose(MDB_cursor *mc, MDB_page *mp) if (mp != dl[x].mptr) { /* bad cursor? */ mc->mc_flags &= ~(C_INITIALIZED|C_EOF); txn->mt_flags |= MDB_TXN_ERROR; @@ -921,7 +942,7 @@ index d2e81e4..0110402 100644 } /* ok, it's ours */ loose = 1; -@@ -1815,8 +2042,7 @@ mdb_page_loose(MDB_cursor *mc, MDB_page *mp) +@@ -1815,8 +2047,7 @@ mdb_page_loose(MDB_cursor *mc, MDB_page *mp) } } if (loose) { @@ -931,7 +952,7 @@ index d2e81e4..0110402 100644 NEXT_LOOSE_PAGE(mp) = txn->mt_loose_pgs; txn->mt_loose_pgs = mp; txn->mt_loose_count++; -@@ -1842,7 +2068,7 @@ mdb_pages_xkeep(MDB_cursor *mc, unsigned pflags, int all) +@@ -1842,7 +2073,7 @@ mdb_pages_xkeep(MDB_cursor *mc, unsigned pflags, int all) { enum { Mask = P_SUBP|P_DIRTY|P_LOOSE|P_KEEP }; MDB_txn *txn = mc->mc_txn; @@ -940,7 +961,7 @@ index d2e81e4..0110402 100644 MDB_xcursor *mx; MDB_page *dp, *mp; MDB_node *leaf; -@@ -1885,7 +2111,7 @@ mdb_pages_xkeep(MDB_cursor *mc, unsigned pflags, int all) +@@ -1885,7 +2116,7 @@ mdb_pages_xkeep(MDB_cursor *mc, unsigned pflags, int all) pgno_t pgno = txn->mt_dbs[i].md_root; if (pgno == P_INVALID) continue; @@ -949,7 +970,7 @@ index d2e81e4..0110402 100644 break; if ((dp->mp_flags & Mask) == pflags && level <= 1) dp->mp_flags ^= P_KEEP; -@@ -2074,6 +2300,8 @@ mdb_page_dirty(MDB_txn *txn, MDB_page *mp) +@@ -2074,6 +2305,8 @@ mdb_page_dirty(MDB_txn *txn, MDB_page *mp) * Do not modify the freedB, just merge freeDB records into me_pghead[] * and move me_pglast to say which records were consumed. Only this * function can create me_pghead and move me_pglast/mt_next_pgno. @@ -958,7 +979,7 @@ index d2e81e4..0110402 100644 * @param[in] mc cursor A cursor handle identifying the transaction and * database for which we are allocating. * @param[in] num the number of pages to allocate. -@@ -2111,8 +2339,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) +@@ -2111,8 +2344,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) np = txn->mt_loose_pgs; txn->mt_loose_pgs = NEXT_LOOSE_PAGE(np); txn->mt_loose_count--; @@ -968,7 +989,7 @@ index d2e81e4..0110402 100644 *mp = np; return MDB_SUCCESS; } -@@ -2149,6 +2376,14 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) +@@ -2149,6 +2381,14 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) last = env->me_pglast; oldest = env->me_pgoldest; mdb_cursor_init(&m2, txn, FREE_DBI, NULL); @@ -983,7 +1004,7 @@ index d2e81e4..0110402 100644 if (last) { op = MDB_SET_RANGE; key.mv_data = &last; /* will look up last+1 */ -@@ -2189,7 +2424,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) +@@ -2189,7 +2429,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) } np = m2.mc_pg[m2.mc_top]; leaf = NODEPTR(np, m2.mc_ki[m2.mc_top]); @@ -992,7 +1013,7 @@ index d2e81e4..0110402 100644 return rc; idl = (MDB_ID *) data.mv_data; -@@ -2206,10 +2441,10 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) +@@ -2206,10 +2446,10 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) } env->me_pglast = last; #if (MDB_DEBUG) > 1 @@ -1005,7 +1026,7 @@ index d2e81e4..0110402 100644 #endif /* Merge in descending sorted order */ mdb_midl_xmerge(mop, idl); -@@ -2224,6 +2459,20 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) +@@ -2224,6 +2464,20 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) rc = MDB_MAP_FULL; goto fail; } @@ -1026,7 +1047,7 @@ index d2e81e4..0110402 100644 search_done: if (env->me_flags & MDB_WRITEMAP) { -@@ -2365,7 +2614,7 @@ mdb_page_touch(MDB_cursor *mc) +@@ -2365,7 +2619,7 @@ mdb_page_touch(MDB_cursor *mc) (rc = mdb_page_alloc(mc, 1, &np))) goto fail; pgno = np->mp_pgno; @@ -1035,7 +1056,7 @@ index d2e81e4..0110402 100644 mp->mp_pgno, pgno)); mdb_cassert(mc, mp->mp_pgno != pgno); mdb_midl_xappend(txn->mt_free_pgs, mp->mp_pgno); -@@ -2389,7 +2638,7 @@ mdb_page_touch(MDB_cursor *mc) +@@ -2389,7 +2643,7 @@ mdb_page_touch(MDB_cursor *mc) if (mp != dl[x].mptr) { /* bad cursor? */ mc->mc_flags &= ~(C_INITIALIZED|C_EOF); txn->mt_flags |= MDB_TXN_ERROR; @@ -1044,7 +1065,7 @@ index d2e81e4..0110402 100644 } return 0; } -@@ -2439,6 +2688,7 @@ done: +@@ -2439,6 +2693,7 @@ done: } } } @@ -1052,7 +1073,7 @@ index d2e81e4..0110402 100644 return 0; fail: -@@ -2447,7 +2697,7 @@ fail: +@@ -2447,7 +2702,7 @@ fail: } int @@ -1061,7 +1082,7 @@ index d2e81e4..0110402 100644 { int rc = 0; if (env->me_flags & MDB_RDONLY) -@@ -2456,7 +2706,7 @@ mdb_env_sync(MDB_env *env, int force) +@@ -2456,7 +2711,7 @@ mdb_env_sync(MDB_env *env, int force) if (env->me_flags & MDB_WRITEMAP) { int flags = ((env->me_flags & MDB_MAPASYNC) && !force) ? MS_ASYNC : MS_SYNC; @@ -1070,7 +1091,7 @@ index d2e81e4..0110402 100644 rc = ErrCode(); #ifdef _WIN32 else if (flags == MS_SYNC && MDB_FDATASYNC(env->me_fd)) -@@ -2476,6 +2726,13 @@ mdb_env_sync(MDB_env *env, int force) +@@ -2476,6 +2731,13 @@ mdb_env_sync(MDB_env *env, int force) return rc; } @@ -1084,7 +1105,7 @@ index d2e81e4..0110402 100644 /** Back up parent txn's cursors, then grab the originals for tracking */ static int mdb_cursor_shadow(MDB_txn *src, MDB_txn *dst) -@@ -2720,6 +2977,9 @@ mdb_txn_renew0(MDB_txn *txn) +@@ -2720,6 +2982,9 @@ mdb_txn_renew0(MDB_txn *txn) /* Moved to here to avoid a data race in read TXNs */ txn->mt_next_pgno = meta->mm_last_pg+1; @@ -1094,7 +1115,7 @@ index d2e81e4..0110402 100644 txn->mt_flags = flags; -@@ -2755,7 +3015,7 @@ mdb_txn_renew(MDB_txn *txn) +@@ -2755,7 +3020,7 @@ mdb_txn_renew(MDB_txn *txn) rc = mdb_txn_renew0(txn); if (rc == MDB_SUCCESS) { @@ -1103,7 +1124,7 @@ index d2e81e4..0110402 100644 txn->mt_txnid, (txn->mt_flags & MDB_TXN_RDONLY) ? 'r' : 'w', (void *)txn, (void *)txn->mt_env, txn->mt_dbs[MAIN_DBI].md_root)); } -@@ -2798,6 +3058,17 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret) +@@ -2798,6 +3063,17 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret) DPRINTF(("calloc: %s", strerror(errno))); return ENOMEM; } @@ -1121,7 +1142,7 @@ index d2e81e4..0110402 100644 txn->mt_dbxs = env->me_dbxs; /* static */ txn->mt_dbs = (MDB_db *) ((char *)txn + tsize); txn->mt_dbflags = (unsigned char *)txn + size - env->me_maxdbs; -@@ -2825,6 +3096,9 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret) +@@ -2825,6 +3101,9 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret) parent->mt_child = txn; txn->mt_parent = parent; txn->mt_numdbs = parent->mt_numdbs; @@ -1131,7 +1152,7 @@ index d2e81e4..0110402 100644 memcpy(txn->mt_dbs, parent->mt_dbs, txn->mt_numdbs * sizeof(MDB_db)); /* Copy parent's mt_dbflags, but clear DB_NEW */ for (i=0; imt_numdbs; i++) -@@ -2850,12 +3124,16 @@ renew: +@@ -2850,12 +3129,16 @@ renew: rc = mdb_txn_renew0(txn); } if (rc) { @@ -1150,7 +1171,7 @@ index d2e81e4..0110402 100644 txn->mt_txnid, (flags & MDB_RDONLY) ? 'r' : 'w', (void *) txn, (void *) env, txn->mt_dbs[MAIN_DBI].md_root)); } -@@ -2870,7 +3148,7 @@ mdb_txn_env(MDB_txn *txn) +@@ -2870,7 +3153,7 @@ mdb_txn_env(MDB_txn *txn) return txn->mt_env; } @@ -1159,7 +1180,7 @@ index d2e81e4..0110402 100644 mdb_txn_id(MDB_txn *txn) { if(!txn) return 0; -@@ -2922,7 +3200,7 @@ mdb_txn_end(MDB_txn *txn, unsigned mode) +@@ -2922,7 +3205,7 @@ mdb_txn_end(MDB_txn *txn, unsigned mode) /* Export or close DBI handles opened in this txn */ mdb_dbis_update(txn, mode & MDB_END_UPDATE); @@ -1168,7 +1189,7 @@ index d2e81e4..0110402 100644 names[mode & MDB_END_OPMASK], txn->mt_txnid, (txn->mt_flags & MDB_TXN_RDONLY) ? 'r' : 'w', (void *) txn, (void *)env, txn->mt_dbs[MAIN_DBI].md_root)); -@@ -2976,7 +3254,31 @@ mdb_txn_end(MDB_txn *txn, unsigned mode) +@@ -2976,7 +3259,31 @@ mdb_txn_end(MDB_txn *txn, unsigned mode) mdb_midl_free(pghead); } @@ -1201,7 +1222,7 @@ index d2e81e4..0110402 100644 if (mode & MDB_END_FREE) free(txn); } -@@ -3008,6 +3310,9 @@ mdb_txn_abort(MDB_txn *txn) +@@ -3008,6 +3315,9 @@ mdb_txn_abort(MDB_txn *txn) /** Save the freelist as of this transaction to the freeDB. * This changes the freelist. Keep trying until it stabilizes. @@ -1211,7 +1232,7 @@ index d2e81e4..0110402 100644 */ static int mdb_freelist_save(MDB_txn *txn) -@@ -3096,10 +3401,10 @@ mdb_freelist_save(MDB_txn *txn) +@@ -3096,10 +3406,10 @@ mdb_freelist_save(MDB_txn *txn) #if (MDB_DEBUG) > 1 { unsigned int i = free_pgs[0]; @@ -1224,13 +1245,13 @@ index d2e81e4..0110402 100644 } #endif continue; -@@ -3210,15 +3515,16 @@ mdb_page_flush(MDB_txn *txn, int keep) +@@ -3210,15 +3520,16 @@ mdb_page_flush(MDB_txn *txn, int keep) MDB_ID2L dl = txn->mt_u.dirty_list; unsigned psize = env->me_psize, j; int i, pagecount = dl[0].mid, rc; - size_t size = 0, pos = 0; + size_t size = 0; -+ off_t pos = 0; ++ offset_t pos = 0; pgno_t pgno = 0; MDB_page *dp = NULL; #ifdef _WIN32 @@ -1240,11 +1261,11 @@ index d2e81e4..0110402 100644 - ssize_t wpos = 0, wsize = 0, wres; - size_t next_pos = 1; /* impossible pos, so pos != next_pos */ + ssize_t wsize = 0, wres; -+ off_t wpos = 0, next_pos = 1; /* impossible pos, so pos != next_pos */ ++ offset_t wpos = 0, next_pos = 1; /* impossible pos, so pos != next_pos */ int n = 0; #endif -@@ -3266,7 +3572,7 @@ mdb_page_flush(MDB_txn *txn, int keep) +@@ -3266,7 +3577,7 @@ mdb_page_flush(MDB_txn *txn, int keep) * the write offset, to at least save the overhead of a Seek * system call. */ @@ -1253,7 +1274,7 @@ index d2e81e4..0110402 100644 memset(&ov, 0, sizeof(ov)); ov.Offset = pos & 0xffffffff; ov.OffsetHigh = pos >> 16 >> 16; -@@ -3317,7 +3623,7 @@ retry_seek: +@@ -3317,7 +3628,7 @@ retry_seek: wpos = pos; wsize = 0; } @@ -1262,7 +1283,7 @@ index d2e81e4..0110402 100644 next_pos = pos + size; iov[n].iov_len = size; iov[n].iov_base = (char *)dp; -@@ -3325,6 +3631,10 @@ retry_seek: +@@ -3325,6 +3636,10 @@ retry_seek: n++; #endif /* _WIN32 */ } @@ -1273,7 +1294,7 @@ index d2e81e4..0110402 100644 /* MIPS has cache coherency issues, this is a no-op everywhere else * Note: for any size >= on-chip cache size, entire on-chip cache is -@@ -3526,7 +3836,7 @@ mdb_txn_commit(MDB_txn *txn) +@@ -3526,7 +3841,7 @@ mdb_txn_commit(MDB_txn *txn) !(txn->mt_flags & (MDB_TXN_DIRTY|MDB_TXN_SPILLS))) goto done; @@ -1282,7 +1303,7 @@ index d2e81e4..0110402 100644 txn->mt_txnid, (void*)txn, (void*)env, txn->mt_dbs[MAIN_DBI].md_root)); /* Update DB root pointers */ -@@ -3564,9 +3874,12 @@ mdb_txn_commit(MDB_txn *txn) +@@ -3564,9 +3879,12 @@ mdb_txn_commit(MDB_txn *txn) mdb_audit(txn); #endif @@ -1298,7 +1319,7 @@ index d2e81e4..0110402 100644 goto fail; end_mode = MDB_END_COMMITTED|MDB_END_UPDATE; -@@ -3621,7 +3934,7 @@ mdb_env_read_header(MDB_env *env, MDB_meta *meta) +@@ -3621,7 +3939,7 @@ mdb_env_read_header(MDB_env *env, MDB_meta *meta) p = (MDB_page *)&pbuf; if (!F_ISSET(p->mp_flags, P_META)) { @@ -1307,7 +1328,7 @@ index d2e81e4..0110402 100644 return MDB_INVALID; } -@@ -3691,7 +4004,6 @@ mdb_env_init_meta(MDB_env *env, MDB_meta *meta) +@@ -3691,7 +4009,6 @@ mdb_env_init_meta(MDB_env *env, MDB_meta *meta) p = calloc(NUM_METAS, psize); if (!p) return ENOMEM; @@ -1315,16 +1336,18 @@ index d2e81e4..0110402 100644 p->mp_pgno = 0; p->mp_flags = P_META; *(MDB_meta *)METADATA(p) = *meta; -@@ -3722,7 +4034,7 @@ mdb_env_write_meta(MDB_txn *txn) +@@ -3722,8 +4039,8 @@ mdb_env_write_meta(MDB_txn *txn) MDB_env *env; MDB_meta meta, metab, *mp; unsigned flags; - size_t mapsize; +- off_t off; + mdb_size_t mapsize; - off_t off; ++ offset_t off; int rc, len, toggle; char *ptr; -@@ -3734,11 +4046,11 @@ mdb_env_write_meta(MDB_txn *txn) + HANDLE mfd; +@@ -3734,11 +4051,11 @@ mdb_env_write_meta(MDB_txn *txn) #endif toggle = txn->mt_txnid & 1; @@ -1338,7 +1361,7 @@ index d2e81e4..0110402 100644 mp = env->me_metas[toggle]; mapsize = env->me_metas[toggle ^ 1]->mm_mapsize; /* Persist any increases of mapsize config */ -@@ -3867,6 +4179,9 @@ mdb_env_create(MDB_env **env) +@@ -3867,6 +4184,9 @@ mdb_env_create(MDB_env **env) #ifdef MDB_USE_POSIX_SEM e->me_rmutex = SEM_FAILED; e->me_wmutex = SEM_FAILED; @@ -1348,7 +1371,7 @@ index d2e81e4..0110402 100644 #endif e->me_pid = getpid(); GET_PAGESIZE(e->me_os_psize); -@@ -3875,6 +4190,19 @@ mdb_env_create(MDB_env **env) +@@ -3875,6 +4195,19 @@ mdb_env_create(MDB_env **env) return MDB_SUCCESS; } @@ -1368,7 +1391,7 @@ index d2e81e4..0110402 100644 static int ESECT mdb_env_map(MDB_env *env, void *addr) { -@@ -3882,42 +4210,51 @@ mdb_env_map(MDB_env *env, void *addr) +@@ -3882,42 +4215,51 @@ mdb_env_map(MDB_env *env, void *addr) unsigned int flags = env->me_flags; #ifdef _WIN32 int rc; @@ -1447,7 +1470,7 @@ index d2e81e4..0110402 100644 #else int prot = PROT_READ; if (flags & MDB_WRITEMAP) { -@@ -3951,6 +4288,7 @@ mdb_env_map(MDB_env *env, void *addr) +@@ -3951,6 +4293,7 @@ mdb_env_map(MDB_env *env, void *addr) */ if (addr && env->me_map != addr) return EBUSY; /* TODO: Make a new MDB_* error code? */ @@ -1455,7 +1478,7 @@ index d2e81e4..0110402 100644 p = (MDB_page *)env->me_map; env->me_metas[0] = METADATA(p); -@@ -3960,15 +4298,17 @@ mdb_env_map(MDB_env *env, void *addr) +@@ -3960,15 +4303,17 @@ mdb_env_map(MDB_env *env, void *addr) } int ESECT @@ -1475,7 +1498,7 @@ index d2e81e4..0110402 100644 if (env->me_txn) return EINVAL; meta = mdb_env_pick_meta(env); -@@ -3976,16 +4316,21 @@ mdb_env_set_mapsize(MDB_env *env, size_t size) +@@ -3976,16 +4321,21 @@ mdb_env_set_mapsize(MDB_env *env, size_t size) size = meta->mm_mapsize; { /* Silently round up to minimum if the size is too small */ @@ -1498,7 +1521,7 @@ index d2e81e4..0110402 100644 } env->me_mapsize = size; if (env->me_psize) -@@ -4021,7 +4366,7 @@ mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers) +@@ -4021,7 +4371,7 @@ mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers) } static int ESECT @@ -1507,7 +1530,7 @@ index d2e81e4..0110402 100644 { #ifdef _WIN32 LARGE_INTEGER fsize; -@@ -4135,7 +4480,7 @@ mdb_env_open2(MDB_env *env) +@@ -4135,7 +4485,7 @@ mdb_env_open2(MDB_env *env) /* Make sure mapsize >= committed data size. Even when using * mm_mapsize, which could be broken in old files (ITS#7789). */ @@ -1516,7 +1539,7 @@ index d2e81e4..0110402 100644 if (env->me_mapsize < minsize) env->me_mapsize = minsize; } -@@ -4154,6 +4499,18 @@ mdb_env_open2(MDB_env *env) +@@ -4154,6 +4504,18 @@ mdb_env_open2(MDB_env *env) return rc; newenv = 0; } @@ -1535,7 +1558,7 @@ index d2e81e4..0110402 100644 rc = mdb_env_map(env, (flags & MDB_FIXEDMAP) ? meta.mm_address : NULL); if (rc) -@@ -4183,13 +4540,13 @@ mdb_env_open2(MDB_env *env) +@@ -4183,13 +4545,13 @@ mdb_env_open2(MDB_env *env) DPRINTF(("opened database version %u, pagesize %u", meta->mm_version, env->me_psize)); @@ -1556,7 +1579,7 @@ index d2e81e4..0110402 100644 } #endif -@@ -4465,6 +4822,10 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) +@@ -4465,8 +4827,12 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) # define MDB_CLOEXEC 0 #endif #endif @@ -1565,9 +1588,12 @@ index d2e81e4..0110402 100644 + union semun semu; +#endif int rc; - off_t size, rsize; +- off_t size, rsize; ++ offset_t size, rsize; -@@ -4616,19 +4977,42 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) + #ifdef _WIN32 + wchar_t *wlpath; +@@ -4616,19 +4982,42 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) env->me_wmutex = sem_open(env->me_txns->mti_wmname, O_CREAT|O_EXCL, mode, 1); if (env->me_wmutex == SEM_FAILED) goto fail_errno; @@ -1617,7 +1643,7 @@ index d2e81e4..0110402 100644 env->me_txns->mti_magic = MDB_MAGIC; env->me_txns->mti_format = MDB_LOCK_FORMAT; -@@ -4636,6 +5020,9 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) +@@ -4636,6 +5025,9 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) env->me_txns->mti_numreaders = 0; } else { @@ -1627,7 +1653,7 @@ index d2e81e4..0110402 100644 if (env->me_txns->mti_magic != MDB_MAGIC) { DPUTS("lock region has invalid magic"); rc = MDB_INVALID; -@@ -4661,8 +5048,33 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) +@@ -4661,8 +5053,33 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl) if (env->me_rmutex == SEM_FAILED) goto fail_errno; env->me_wmutex = sem_open(env->me_txns->mti_wmname, 0); if (env->me_wmutex == SEM_FAILED) goto fail_errno; @@ -1661,7 +1687,7 @@ index d2e81e4..0110402 100644 return MDB_SUCCESS; fail_errno: -@@ -4701,6 +5113,17 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode +@@ -4701,6 +5118,17 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode if (env->me_fd!=INVALID_HANDLE_VALUE || (flags & ~(CHANGEABLE|CHANGELESS))) return EINVAL; @@ -1679,7 +1705,7 @@ index d2e81e4..0110402 100644 len = strlen(path); if (flags & MDB_NOSUBDIR) { rc = len + sizeof(LOCKSUFF) + len + 1; -@@ -4730,6 +5153,17 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode +@@ -4730,6 +5158,17 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode (env->me_dirty_list = calloc(MDB_IDL_UM_SIZE, sizeof(MDB_ID2))))) rc = ENOMEM; } @@ -1697,7 +1723,7 @@ index d2e81e4..0110402 100644 env->me_flags = flags |= MDB_ENV_ACTIVE; if (rc) goto leave; -@@ -4828,6 +5262,16 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode +@@ -4828,6 +5267,16 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode txn->mt_dbiseqs = (unsigned int *)(txn->mt_cursors + env->me_maxdbs); txn->mt_dbflags = (unsigned char *)(txn->mt_dbiseqs + env->me_maxdbs); txn->mt_env = env; @@ -1714,7 +1740,7 @@ index d2e81e4..0110402 100644 txn->mt_dbxs = env->me_dbxs; txn->mt_flags = MDB_TXN_FINISHED; env->me_txn0 = txn; -@@ -4866,6 +5310,15 @@ mdb_env_close0(MDB_env *env, int excl) +@@ -4866,6 +5315,15 @@ mdb_env_close0(MDB_env *env, int excl) free(env->me_dbflags); free(env->me_path); free(env->me_dirty_list); @@ -1730,7 +1756,7 @@ index d2e81e4..0110402 100644 free(env->me_txn0); mdb_midl_free(env->me_free_pgs); -@@ -4883,7 +5336,11 @@ mdb_env_close0(MDB_env *env, int excl) +@@ -4883,7 +5341,11 @@ mdb_env_close0(MDB_env *env, int excl) } if (env->me_map) { @@ -1742,7 +1768,7 @@ index d2e81e4..0110402 100644 } if (env->me_mfd != env->me_fd && env->me_mfd != INVALID_HANDLE_VALUE) (void) close(env->me_mfd); -@@ -4924,6 +5381,16 @@ mdb_env_close0(MDB_env *env, int excl) +@@ -4924,6 +5386,16 @@ mdb_env_close0(MDB_env *env, int excl) sem_unlink(env->me_txns->mti_wmname); } } @@ -1759,7 +1785,7 @@ index d2e81e4..0110402 100644 #endif munmap((void *)env->me_txns, (env->me_maxreaders-1)*sizeof(MDB_reader)+sizeof(MDB_txninfo)); } -@@ -4938,6 +5405,14 @@ mdb_env_close0(MDB_env *env, int excl) +@@ -4938,6 +5410,14 @@ mdb_env_close0(MDB_env *env, int excl) #endif (void) close(env->me_lfd); } @@ -1774,7 +1800,7 @@ index d2e81e4..0110402 100644 env->me_flags &= ~(MDB_ENV_ACTIVE|MDB_ENV_TXKEY); } -@@ -4961,18 +5436,18 @@ mdb_env_close(MDB_env *env) +@@ -4961,18 +5441,18 @@ mdb_env_close(MDB_env *env) free(env); } @@ -1797,7 +1823,7 @@ index d2e81e4..0110402 100644 */ static int mdb_cmp_int(const MDB_val *a, const MDB_val *b) -@@ -5077,7 +5552,7 @@ mdb_node_search(MDB_cursor *mc, MDB_val *key, int *exactp) +@@ -5077,7 +5557,7 @@ mdb_node_search(MDB_cursor *mc, MDB_val *key, int *exactp) nkeys = NUMKEYS(mp); @@ -1806,7 +1832,7 @@ index d2e81e4..0110402 100644 nkeys, IS_LEAF(mp) ? "leaf" : "branch", IS_SUBP(mp) ? "sub-" : "", mdb_dbg_pgno(mp))); -@@ -5089,7 +5564,7 @@ mdb_node_search(MDB_cursor *mc, MDB_val *key, int *exactp) +@@ -5089,7 +5569,7 @@ mdb_node_search(MDB_cursor *mc, MDB_val *key, int *exactp) * alignment is guaranteed. Use faster mdb_cmp_int. */ if (cmp == mdb_cmp_cint && IS_BRANCH(mp)) { @@ -1815,7 +1841,7 @@ index d2e81e4..0110402 100644 cmp = mdb_cmp_long; else cmp = mdb_cmp_int; -@@ -5125,7 +5600,7 @@ mdb_node_search(MDB_cursor *mc, MDB_val *key, int *exactp) +@@ -5125,7 +5605,7 @@ mdb_node_search(MDB_cursor *mc, MDB_val *key, int *exactp) DPRINTF(("found leaf index %u [%s], rc = %i", i, DKEY(&nodekey), rc)); else @@ -1824,7 +1850,7 @@ index d2e81e4..0110402 100644 i, DKEY(&nodekey), NODEPGNO(node), rc)); #endif if (rc == 0) -@@ -5173,7 +5648,7 @@ static void +@@ -5173,7 +5653,7 @@ static void mdb_cursor_pop(MDB_cursor *mc) { if (mc->mc_snum) { @@ -1833,7 +1859,7 @@ index d2e81e4..0110402 100644 mc->mc_pg[mc->mc_top]->mp_pgno, DDBI(mc), (void *) mc)); mc->mc_snum--; -@@ -5189,7 +5664,7 @@ mdb_cursor_pop(MDB_cursor *mc) +@@ -5189,7 +5669,7 @@ mdb_cursor_pop(MDB_cursor *mc) static int mdb_cursor_push(MDB_cursor *mc, MDB_page *mp) { @@ -1842,7 +1868,7 @@ index d2e81e4..0110402 100644 DDBI(mc), (void *) mc)); if (mc->mc_snum >= CURSOR_STACK) { -@@ -5204,21 +5679,309 @@ mdb_cursor_push(MDB_cursor *mc, MDB_page *mp) +@@ -5204,21 +5684,309 @@ mdb_cursor_push(MDB_cursor *mc, MDB_page *mp) return MDB_SUCCESS; } @@ -1920,7 +1946,7 @@ index d2e81e4..0110402 100644 + len, &off, &len, ViewUnmap, (env->me_flags & MDB_RDONLY) ? 0 : MEM_RESERVE, PAGE_READONLY); \ + if (rc) rc = mdb_nt2win32(rc) +#else -+ off_t off; ++ offset_t off; + size_t len; +#define SET_OFF(off,val) off = val +#define MAP(rc,env,addr,len,off) \ @@ -2156,7 +2182,7 @@ index d2e81e4..0110402 100644 MDB_txn *tx2 = txn; level = 1; do { -@@ -5233,8 +5996,7 @@ mdb_page_get(MDB_txn *txn, pgno_t pgno, MDB_page **ret, int *lvl) +@@ -5233,8 +6001,7 @@ mdb_page_get(MDB_txn *txn, pgno_t pgno, MDB_page **ret, int *lvl) MDB_ID pn = pgno << 1; x = mdb_midl_search(tx2->mt_spill_pgs, pn); if (x <= tx2->mt_spill_pgs[0] && tx2->mt_spill_pgs[x] == pn) { @@ -2166,7 +2192,7 @@ index d2e81e4..0110402 100644 } } if (dl[0].mid) { -@@ -5248,15 +6010,26 @@ mdb_page_get(MDB_txn *txn, pgno_t pgno, MDB_page **ret, int *lvl) +@@ -5248,15 +6015,26 @@ mdb_page_get(MDB_txn *txn, pgno_t pgno, MDB_page **ret, int *lvl) } while ((tx2 = tx2->mt_parent) != NULL); } @@ -2198,7 +2224,7 @@ index d2e81e4..0110402 100644 done: *ret = p; if (lvl) -@@ -5278,13 +6051,13 @@ mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int flags) +@@ -5278,13 +6056,13 @@ mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int flags) MDB_node *node; indx_t i; @@ -2214,7 +2240,7 @@ index d2e81e4..0110402 100644 if (flags & (MDB_PS_FIRST|MDB_PS_LAST)) { i = 0; -@@ -5308,7 +6081,7 @@ mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int flags) +@@ -5308,7 +6086,7 @@ mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int flags) mdb_cassert(mc, i < NUMKEYS(mp)); node = NODEPTR(mp, i); @@ -2223,7 +2249,7 @@ index d2e81e4..0110402 100644 return rc; mc->mc_ki[mc->mc_top] = i; -@@ -5329,7 +6102,7 @@ mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int flags) +@@ -5329,7 +6107,7 @@ mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int flags) return MDB_CORRUPTED; } @@ -2232,7 +2258,7 @@ index d2e81e4..0110402 100644 key ? DKEY(key) : "null")); mc->mc_flags |= C_INITIALIZED; mc->mc_flags &= ~C_EOF; -@@ -5350,7 +6123,7 @@ mdb_page_search_lowest(MDB_cursor *mc) +@@ -5350,7 +6128,7 @@ mdb_page_search_lowest(MDB_cursor *mc) MDB_node *node = NODEPTR(mp, 0); int rc; @@ -2241,7 +2267,7 @@ index d2e81e4..0110402 100644 return rc; mc->mc_ki[mc->mc_top] = 0; -@@ -5402,7 +6175,7 @@ mdb_page_search(MDB_cursor *mc, MDB_val *key, int flags) +@@ -5402,7 +6180,7 @@ mdb_page_search(MDB_cursor *mc, MDB_val *key, int flags) return MDB_NOTFOUND; if ((leaf->mn_flags & (F_DUPDATA|F_SUBDATA)) != F_SUBDATA) return MDB_INCOMPATIBLE; /* not a named DB */ @@ -2250,7 +2276,7 @@ index d2e81e4..0110402 100644 if (rc) return rc; memcpy(&flags, ((char *) data.mv_data + offsetof(MDB_db, md_flags)), -@@ -5425,14 +6198,26 @@ mdb_page_search(MDB_cursor *mc, MDB_val *key, int flags) +@@ -5425,14 +6203,26 @@ mdb_page_search(MDB_cursor *mc, MDB_val *key, int flags) } mdb_cassert(mc, root > 1); @@ -2280,7 +2306,7 @@ index d2e81e4..0110402 100644 DDBI(mc), root, mc->mc_pg[0]->mp_flags)); if (flags & MDB_PS_MODIFY) { -@@ -5457,7 +6242,7 @@ mdb_ovpage_free(MDB_cursor *mc, MDB_page *mp) +@@ -5457,7 +6247,7 @@ mdb_ovpage_free(MDB_cursor *mc, MDB_page *mp) MDB_ID pn = pg << 1; int rc; @@ -2289,7 +2315,7 @@ index d2e81e4..0110402 100644 /* If the page is dirty or on the spill list we just acquired it, * so we should give it back to our current free list, if any. * Otherwise put it onto the list of pages we freed in this txn. -@@ -5498,7 +6283,7 @@ mdb_ovpage_free(MDB_cursor *mc, MDB_page *mp) +@@ -5498,7 +6288,7 @@ mdb_ovpage_free(MDB_cursor *mc, MDB_page *mp) j = ++(dl[0].mid); dl[j] = ix; /* Unsorted. OK when MDB_TXN_ERROR. */ txn->mt_flags |= MDB_TXN_ERROR; @@ -2298,7 +2324,7 @@ index d2e81e4..0110402 100644 } } txn->mt_dirty_room++; -@@ -5523,18 +6308,22 @@ release: +@@ -5523,18 +6313,22 @@ release: } /** Return the data associated with a given node. @@ -2323,7 +2349,7 @@ index d2e81e4..0110402 100644 if (!F_ISSET(leaf->mn_flags, F_BIGDATA)) { data->mv_size = NODEDSZ(leaf); data->mv_data = NODEDATA(leaf); -@@ -5545,11 +6334,12 @@ mdb_node_read(MDB_txn *txn, MDB_node *leaf, MDB_val *data) +@@ -5545,11 +6339,12 @@ mdb_node_read(MDB_txn *txn, MDB_node *leaf, MDB_val *data) */ data->mv_size = NODEDSZ(leaf); memcpy(&pgno, NODEDATA(leaf), sizeof(pgno)); @@ -2338,7 +2364,7 @@ index d2e81e4..0110402 100644 return MDB_SUCCESS; } -@@ -5560,7 +6350,7 @@ mdb_get(MDB_txn *txn, MDB_dbi dbi, +@@ -5560,7 +6355,7 @@ mdb_get(MDB_txn *txn, MDB_dbi dbi, { MDB_cursor mc; MDB_xcursor mx; @@ -2347,7 +2373,7 @@ index d2e81e4..0110402 100644 DKBUF; DPRINTF(("===> get db %u key [%s]", dbi, DKEY(key))); -@@ -5572,7 +6362,12 @@ mdb_get(MDB_txn *txn, MDB_dbi dbi, +@@ -5572,7 +6367,12 @@ mdb_get(MDB_txn *txn, MDB_dbi dbi, return MDB_BAD_TXN; mdb_cursor_init(&mc, txn, dbi, &mx); @@ -2361,7 +2387,7 @@ index d2e81e4..0110402 100644 } /** Find a sibling for a page. -@@ -5589,13 +6384,19 @@ mdb_cursor_sibling(MDB_cursor *mc, int move_right) +@@ -5589,13 +6389,19 @@ mdb_cursor_sibling(MDB_cursor *mc, int move_right) int rc; MDB_node *indx; MDB_page *mp; @@ -2382,7 +2408,7 @@ index d2e81e4..0110402 100644 mc->mc_pg[mc->mc_top]->mp_pgno, mc->mc_ki[mc->mc_top])); if (move_right ? (mc->mc_ki[mc->mc_top] + 1u >= NUMKEYS(mc->mc_pg[mc->mc_top])) -@@ -5618,8 +6419,10 @@ mdb_cursor_sibling(MDB_cursor *mc, int move_right) +@@ -5618,8 +6424,10 @@ mdb_cursor_sibling(MDB_cursor *mc, int move_right) } mdb_cassert(mc, IS_BRANCH(mc->mc_pg[mc->mc_top])); @@ -2394,7 +2420,7 @@ index d2e81e4..0110402 100644 /* mc will be inconsistent if caller does mc_snum++ as above */ mc->mc_flags &= ~(C_INITIALIZED|C_EOF); return rc; -@@ -5640,11 +6443,12 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) +@@ -5640,11 +6448,12 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) MDB_node *leaf; int rc; @@ -2410,7 +2436,7 @@ index d2e81e4..0110402 100644 mp = mc->mc_pg[mc->mc_top]; -@@ -5659,6 +6463,9 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) +@@ -5659,6 +6468,9 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) return rc; } } @@ -2420,7 +2446,7 @@ index d2e81e4..0110402 100644 } else { mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); if (op == MDB_NEXT_DUP) -@@ -5666,7 +6473,7 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) +@@ -5666,7 +6478,7 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) } } @@ -2429,7 +2455,7 @@ index d2e81e4..0110402 100644 mdb_dbg_pgno(mp), (void *) mc)); if (mc->mc_flags & C_DEL) { mc->mc_flags ^= C_DEL; -@@ -5680,12 +6487,12 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) +@@ -5680,12 +6492,12 @@ mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) return rc; } mp = mc->mc_pg[mc->mc_top]; @@ -2444,7 +2470,7 @@ index d2e81e4..0110402 100644 mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top])); if (IS_LEAF2(mp)) { -@@ -5701,7 +6508,7 @@ skip: +@@ -5701,7 +6513,7 @@ skip: mdb_xcursor_init1(mc, leaf); } if (data) { @@ -2453,7 +2479,7 @@ index d2e81e4..0110402 100644 return rc; if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { -@@ -5723,7 +6530,12 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) +@@ -5723,7 +6535,12 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) MDB_node *leaf; int rc; @@ -2467,7 +2493,7 @@ index d2e81e4..0110402 100644 mp = mc->mc_pg[mc->mc_top]; -@@ -5740,6 +6552,9 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) +@@ -5740,6 +6557,9 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) return rc; } } @@ -2477,7 +2503,7 @@ index d2e81e4..0110402 100644 } else { mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); if (op == MDB_PREV_DUP) -@@ -5747,7 +6562,7 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) +@@ -5747,7 +6567,7 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) } } @@ -2486,7 +2512,7 @@ index d2e81e4..0110402 100644 mdb_dbg_pgno(mp), (void *) mc)); mc->mc_flags &= ~(C_EOF|C_DEL); -@@ -5759,11 +6574,13 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) +@@ -5759,11 +6579,13 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) } mp = mc->mc_pg[mc->mc_top]; mc->mc_ki[mc->mc_top] = NUMKEYS(mp) - 1; @@ -2502,7 +2528,7 @@ index d2e81e4..0110402 100644 mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top])); if (IS_LEAF2(mp)) { -@@ -5779,7 +6596,7 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) +@@ -5779,7 +6601,7 @@ mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) mdb_xcursor_init1(mc, leaf); } if (data) { @@ -2511,7 +2537,7 @@ index d2e81e4..0110402 100644 return rc; if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { -@@ -5806,8 +6623,10 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data, +@@ -5806,8 +6628,10 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data, if (key->mv_size == 0) return MDB_BAD_VALSIZE; @@ -2523,7 +2549,7 @@ index d2e81e4..0110402 100644 /* See if we're already on the right page */ if (mc->mc_flags & C_INITIALIZED) { -@@ -5873,6 +6692,7 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data, +@@ -5873,6 +6697,7 @@ mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data, } } rc = 0; @@ -2531,7 +2557,7 @@ index d2e81e4..0110402 100644 goto set2; } } -@@ -5961,25 +6781,23 @@ set1: +@@ -5961,25 +6786,23 @@ set1: } else if (op == MDB_GET_BOTH || op == MDB_GET_BOTH_RANGE) { MDB_val olddata; MDB_cmp_func *dcmp; @@ -2561,7 +2587,7 @@ index d2e81e4..0110402 100644 return rc; } } -@@ -5999,8 +6817,10 @@ mdb_cursor_first(MDB_cursor *mc, MDB_val *key, MDB_val *data) +@@ -5999,8 +6822,10 @@ mdb_cursor_first(MDB_cursor *mc, MDB_val *key, MDB_val *data) int rc; MDB_node *leaf; @@ -2573,7 +2599,7 @@ index d2e81e4..0110402 100644 if (!(mc->mc_flags & C_INITIALIZED) || mc->mc_top) { rc = mdb_page_search(mc, NULL, MDB_PS_FIRST); -@@ -6028,7 +6848,7 @@ mdb_cursor_first(MDB_cursor *mc, MDB_val *key, MDB_val *data) +@@ -6028,7 +6853,7 @@ mdb_cursor_first(MDB_cursor *mc, MDB_val *key, MDB_val *data) if (rc) return rc; } else { @@ -2582,7 +2608,7 @@ index d2e81e4..0110402 100644 return rc; } } -@@ -6043,8 +6863,10 @@ mdb_cursor_last(MDB_cursor *mc, MDB_val *key, MDB_val *data) +@@ -6043,8 +6868,10 @@ mdb_cursor_last(MDB_cursor *mc, MDB_val *key, MDB_val *data) int rc; MDB_node *leaf; @@ -2594,7 +2620,7 @@ index d2e81e4..0110402 100644 if (!(mc->mc_flags & C_EOF)) { -@@ -6073,7 +6895,7 @@ mdb_cursor_last(MDB_cursor *mc, MDB_val *key, MDB_val *data) +@@ -6073,7 +6900,7 @@ mdb_cursor_last(MDB_cursor *mc, MDB_val *key, MDB_val *data) if (rc) return rc; } else { @@ -2603,7 +2629,7 @@ index d2e81e4..0110402 100644 return rc; } } -@@ -6119,7 +6941,7 @@ mdb_cursor_get(MDB_cursor *mc, MDB_val *key, MDB_val *data, +@@ -6119,7 +6946,7 @@ mdb_cursor_get(MDB_cursor *mc, MDB_val *key, MDB_val *data, if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { rc = mdb_cursor_get(&mc->mc_xcursor->mx_cursor, data, NULL, MDB_GET_CURRENT); } else { @@ -2612,7 +2638,7 @@ index d2e81e4..0110402 100644 } } } -@@ -6169,10 +6991,7 @@ mdb_cursor_get(MDB_cursor *mc, MDB_val *key, MDB_val *data, +@@ -6169,10 +6996,7 @@ mdb_cursor_get(MDB_cursor *mc, MDB_val *key, MDB_val *data, rc = MDB_INCOMPATIBLE; break; } @@ -2624,7 +2650,7 @@ index d2e81e4..0110402 100644 if (rc == MDB_SUCCESS) { if (mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) { MDB_cursor *mx; -@@ -6187,24 +7006,38 @@ fetchm: +@@ -6187,24 +7011,38 @@ fetchm: } } break; @@ -2674,7 +2700,7 @@ index d2e81e4..0110402 100644 rc = mdb_cursor_prev(mc, key, data, op); break; case MDB_FIRST: -@@ -6225,7 +7058,7 @@ fetchm: +@@ -6225,7 +7063,7 @@ fetchm: MDB_node *leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) { MDB_GET_KEY(leaf, key); @@ -2683,7 +2709,7 @@ index d2e81e4..0110402 100644 break; } } -@@ -6487,10 +7320,8 @@ more: +@@ -6487,10 +7325,8 @@ more: if (flags == MDB_CURRENT) goto current; dcmp = mc->mc_dbx->md_dcmp; @@ -2695,7 +2721,7 @@ index d2e81e4..0110402 100644 /* does data match? */ if (!dcmp(data, &olddata)) { if (flags & (MDB_NODUPDATA|MDB_APPENDDUP)) -@@ -6609,7 +7440,7 @@ current: +@@ -6609,7 +7445,7 @@ current: int level, ovpages, dpages = OVPAGES(data->mv_size, env->me_psize); memcpy(&pg, olddata.mv_data, sizeof(pg)); @@ -2704,7 +2730,7 @@ index d2e81e4..0110402 100644 return rc2; ovpages = omp->mp_pages; -@@ -6641,8 +7472,13 @@ current: +@@ -6641,8 +7477,13 @@ current: /* Note - this page is already counted in parent's dirty_room */ rc2 = mdb_mid2l_insert(mc->mc_txn->mt_u.dirty_list, &id2); mdb_cassert(mc, rc2 == 0); @@ -2719,7 +2745,7 @@ index d2e81e4..0110402 100644 * compiler may copy words instead of bytes. */ off = (PAGEHDRSZ + data->mv_size) & -sizeof(size_t); -@@ -6728,7 +7564,7 @@ new_sub: +@@ -6728,7 +7569,7 @@ new_sub: */ if (do_sub) { int xflags, new_dupdata; @@ -2728,7 +2754,7 @@ index d2e81e4..0110402 100644 put_sub: xdata.mv_size = 0; xdata.mv_data = ""; -@@ -6810,7 +7646,7 @@ put_sub: +@@ -6810,7 +7651,7 @@ put_sub: return rc; bad_sub: if (rc == MDB_KEYEXIST) /* should not happen, we deleted that item */ @@ -2737,7 +2763,7 @@ index d2e81e4..0110402 100644 } mc->mc_txn->mt_flags |= MDB_TXN_ERROR; return rc; -@@ -6910,7 +7746,7 @@ mdb_cursor_del(MDB_cursor *mc, unsigned int flags) +@@ -6910,7 +7751,7 @@ mdb_cursor_del(MDB_cursor *mc, unsigned int flags) pgno_t pg; memcpy(&pg, NODEDATA(leaf), sizeof(pg)); @@ -2746,7 +2772,7 @@ index d2e81e4..0110402 100644 (rc = mdb_ovpage_free(mc, omp))) goto fail; } -@@ -6939,7 +7775,7 @@ mdb_page_new(MDB_cursor *mc, uint32_t flags, int num, MDB_page **mp) +@@ -6939,7 +7780,7 @@ mdb_page_new(MDB_cursor *mc, uint32_t flags, int num, MDB_page **mp) if ((rc = mdb_page_alloc(mc, num, &np))) return rc; @@ -2755,7 +2781,7 @@ index d2e81e4..0110402 100644 np->mp_pgno, mc->mc_txn->mt_env->me_psize)); np->mp_flags = flags | P_DIRTY; np->mp_lower = (PAGEHDRSZ-PAGEBASE); -@@ -7039,7 +7875,7 @@ mdb_node_add(MDB_cursor *mc, indx_t indx, +@@ -7039,7 +7880,7 @@ mdb_node_add(MDB_cursor *mc, indx_t indx, mdb_cassert(mc, mp->mp_upper >= mp->mp_lower); @@ -2764,7 +2790,7 @@ index d2e81e4..0110402 100644 IS_LEAF(mp) ? "leaf" : "branch", IS_SUBP(mp) ? "sub-" : "", mdb_dbg_pgno(mp), indx, data ? data->mv_size : 0, -@@ -7080,7 +7916,7 @@ mdb_node_add(MDB_cursor *mc, indx_t indx, +@@ -7080,7 +7921,7 @@ mdb_node_add(MDB_cursor *mc, indx_t indx, goto full; if ((rc = mdb_page_new(mc, P_OVERFLOW, ovpages, &ofp))) return rc; @@ -2773,7 +2799,7 @@ index d2e81e4..0110402 100644 flags |= F_BIGDATA; goto update; } else { -@@ -7137,7 +7973,7 @@ update: +@@ -7137,7 +7978,7 @@ update: return MDB_SUCCESS; full: @@ -2782,7 +2808,7 @@ index d2e81e4..0110402 100644 mdb_dbg_pgno(mp), NUMKEYS(mp))); DPRINTF(("upper-lower = %u - %u = %"Z"d", mp->mp_upper,mp->mp_lower,room)); DPRINTF(("node size = %"Z"u", node_size)); -@@ -7160,7 +7996,7 @@ mdb_node_del(MDB_cursor *mc, int ksize) +@@ -7160,7 +8001,7 @@ mdb_node_del(MDB_cursor *mc, int ksize) MDB_node *node; char *base; @@ -2791,7 +2817,7 @@ index d2e81e4..0110402 100644 IS_LEAF(mp) ? "leaf" : "branch", mdb_dbg_pgno(mp))); numkeys = NUMKEYS(mp); mdb_cassert(mc, indx < numkeys); -@@ -7269,7 +8105,8 @@ mdb_xcursor_init0(MDB_cursor *mc) +@@ -7269,7 +8110,8 @@ mdb_xcursor_init0(MDB_cursor *mc) mx->mx_cursor.mc_dbflag = &mx->mx_dbflag; mx->mx_cursor.mc_snum = 0; mx->mx_cursor.mc_top = 0; @@ -2801,7 +2827,7 @@ index d2e81e4..0110402 100644 mx->mx_dbx.md_name.mv_size = 0; mx->mx_dbx.md_name.mv_data = NULL; mx->mx_dbx.md_cmp = mc->mc_dbx->md_dcmp; -@@ -7288,12 +8125,12 @@ mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node) +@@ -7288,12 +8130,12 @@ mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node) { MDB_xcursor *mx = mc->mc_xcursor; @@ -2815,7 +2841,7 @@ index d2e81e4..0110402 100644 } else { MDB_page *fp = NODEDATA(node); mx->mx_db.md_pad = 0; -@@ -7306,7 +8143,7 @@ mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node) +@@ -7306,7 +8148,7 @@ mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node) COPY_PGNO(mx->mx_db.md_root, fp->mp_pgno); mx->mx_cursor.mc_snum = 1; mx->mx_cursor.mc_top = 0; @@ -2824,7 +2850,7 @@ index d2e81e4..0110402 100644 mx->mx_cursor.mc_pg[0] = fp; mx->mx_cursor.mc_ki[0] = 0; if (mc->mc_db->md_flags & MDB_DUPFIXED) { -@@ -7316,13 +8153,11 @@ mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node) +@@ -7316,13 +8158,11 @@ mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node) mx->mx_db.md_flags |= MDB_INTEGERKEY; } } @@ -2840,7 +2866,7 @@ index d2e81e4..0110402 100644 } -@@ -7345,7 +8180,7 @@ mdb_xcursor_init2(MDB_cursor *mc, MDB_xcursor *src_mx, int new_dupdata) +@@ -7345,7 +8185,7 @@ mdb_xcursor_init2(MDB_cursor *mc, MDB_xcursor *src_mx, int new_dupdata) mx->mx_cursor.mc_flags |= C_INITIALIZED; mx->mx_cursor.mc_ki[0] = 0; mx->mx_dbflag = DB_VALID|DB_USRVALID|DB_DIRTY; /* DB_DIRTY guides mdb_cursor_touch */ @@ -2849,7 +2875,7 @@ index d2e81e4..0110402 100644 mx->mx_dbx.md_cmp = src_mx->mx_dbx.md_cmp; #endif } else if (!(mx->mx_cursor.mc_flags & C_INITIALIZED)) { -@@ -7353,7 +8188,7 @@ mdb_xcursor_init2(MDB_cursor *mc, MDB_xcursor *src_mx, int new_dupdata) +@@ -7353,7 +8193,7 @@ mdb_xcursor_init2(MDB_cursor *mc, MDB_xcursor *src_mx, int new_dupdata) } mx->mx_db = src_mx->mx_db; mx->mx_cursor.mc_pg[0] = src_mx->mx_cursor.mc_pg[0]; @@ -2858,7 +2884,7 @@ index d2e81e4..0110402 100644 mx->mx_db.md_root)); } -@@ -7372,7 +8207,8 @@ mdb_cursor_init(MDB_cursor *mc, MDB_txn *txn, MDB_dbi dbi, MDB_xcursor *mx) +@@ -7372,7 +8212,8 @@ mdb_cursor_init(MDB_cursor *mc, MDB_txn *txn, MDB_dbi dbi, MDB_xcursor *mx) mc->mc_top = 0; mc->mc_pg[0] = 0; mc->mc_ki[0] = 0; @@ -2868,7 +2894,7 @@ index d2e81e4..0110402 100644 if (txn->mt_dbs[dbi].md_flags & MDB_DUPSORT) { mdb_tassert(txn, mx != NULL); mc->mc_xcursor = mx; -@@ -7437,7 +8273,7 @@ mdb_cursor_renew(MDB_txn *txn, MDB_cursor *mc) +@@ -7437,7 +8278,7 @@ mdb_cursor_renew(MDB_txn *txn, MDB_cursor *mc) /* Return the count of duplicate data items for the current key */ int @@ -2877,7 +2903,7 @@ index d2e81e4..0110402 100644 { MDB_node *leaf; -@@ -7471,6 +8307,9 @@ mdb_cursor_count(MDB_cursor *mc, size_t *countp) +@@ -7471,6 +8312,9 @@ mdb_cursor_count(MDB_cursor *mc, size_t *countp) void mdb_cursor_close(MDB_cursor *mc) { @@ -2887,7 +2913,7 @@ index d2e81e4..0110402 100644 if (mc && !mc->mc_backup) { /* remove from txn, if tracked */ if ((mc->mc_flags & C_UNTRACK) && mc->mc_txn->mt_cursors) { -@@ -7522,7 +8361,7 @@ mdb_update_key(MDB_cursor *mc, MDB_val *key) +@@ -7522,7 +8366,7 @@ mdb_update_key(MDB_cursor *mc, MDB_val *key) char kbuf2[DKBUF_MAXKEYSIZE*2+1]; k2.mv_data = NODEKEY(node); k2.mv_size = node->mn_ksize; @@ -2896,7 +2922,7 @@ index d2e81e4..0110402 100644 indx, ptr, mdb_dkey(&k2, kbuf2), DKEY(key), -@@ -7670,7 +8509,7 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) +@@ -7670,7 +8514,7 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) return rc; } @@ -2905,7 +2931,7 @@ index d2e81e4..0110402 100644 IS_LEAF(csrc->mc_pg[csrc->mc_top]) ? "leaf" : "branch", csrc->mc_ki[csrc->mc_top], DKEY(&key), -@@ -7764,7 +8603,7 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) +@@ -7764,7 +8608,7 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) key.mv_size = NODEKSZ(srcnode); key.mv_data = NODEKEY(srcnode); } @@ -2914,7 +2940,7 @@ index d2e81e4..0110402 100644 csrc->mc_pg[csrc->mc_top]->mp_pgno, DKEY(&key))); mdb_cursor_copy(csrc, &mn); mn.mc_snum--; -@@ -7795,7 +8634,7 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) +@@ -7795,7 +8639,7 @@ mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) key.mv_size = NODEKSZ(srcnode); key.mv_data = NODEKEY(srcnode); } @@ -2923,7 +2949,7 @@ index d2e81e4..0110402 100644 cdst->mc_pg[cdst->mc_top]->mp_pgno, DKEY(&key))); mdb_cursor_copy(cdst, &mn); mn.mc_snum--; -@@ -7841,7 +8680,7 @@ mdb_page_merge(MDB_cursor *csrc, MDB_cursor *cdst) +@@ -7841,7 +8685,7 @@ mdb_page_merge(MDB_cursor *csrc, MDB_cursor *cdst) psrc = csrc->mc_pg[csrc->mc_top]; pdst = cdst->mc_pg[cdst->mc_top]; @@ -2932,7 +2958,7 @@ index d2e81e4..0110402 100644 mdb_cassert(csrc, csrc->mc_snum > 1); /* can't merge root page */ mdb_cassert(csrc, cdst->mc_snum > 1); -@@ -7898,7 +8737,7 @@ mdb_page_merge(MDB_cursor *csrc, MDB_cursor *cdst) +@@ -7898,7 +8742,7 @@ mdb_page_merge(MDB_cursor *csrc, MDB_cursor *cdst) } } @@ -2941,7 +2967,7 @@ index d2e81e4..0110402 100644 pdst->mp_pgno, NUMKEYS(pdst), (float)PAGEFILL(cdst->mc_txn->mt_env, pdst) / 10)); -@@ -7986,6 +8825,7 @@ mdb_cursor_copy(const MDB_cursor *csrc, MDB_cursor *cdst) +@@ -7986,6 +8830,7 @@ mdb_cursor_copy(const MDB_cursor *csrc, MDB_cursor *cdst) cdst->mc_snum = csrc->mc_snum; cdst->mc_top = csrc->mc_top; cdst->mc_flags = csrc->mc_flags; @@ -2949,7 +2975,7 @@ index d2e81e4..0110402 100644 for (i=0; imc_snum; i++) { cdst->mc_pg[i] = csrc->mc_pg[i]; -@@ -8014,14 +8854,14 @@ mdb_rebalance(MDB_cursor *mc) +@@ -8014,14 +8859,14 @@ mdb_rebalance(MDB_cursor *mc) minkeys = 1; thresh = FILL_THRESHOLD; } @@ -2966,7 +2992,7 @@ index d2e81e4..0110402 100644 mdb_dbg_pgno(mc->mc_pg[mc->mc_top]))); return MDB_SUCCESS; } -@@ -8069,7 +8909,7 @@ mdb_rebalance(MDB_cursor *mc) +@@ -8069,7 +8914,7 @@ mdb_rebalance(MDB_cursor *mc) if (rc) return rc; mc->mc_db->md_root = NODEPGNO(NODEPTR(mp, 0)); @@ -2975,7 +3001,7 @@ index d2e81e4..0110402 100644 if (rc) return rc; mc->mc_db->md_depth--; -@@ -8130,7 +8970,7 @@ mdb_rebalance(MDB_cursor *mc) +@@ -8130,7 +8975,7 @@ mdb_rebalance(MDB_cursor *mc) DPUTS("reading right neighbor"); mn.mc_ki[ptop]++; node = NODEPTR(mc->mc_pg[ptop], mn.mc_ki[ptop]); @@ -2984,7 +3010,7 @@ index d2e81e4..0110402 100644 if (rc) return rc; mn.mc_ki[mn.mc_top] = 0; -@@ -8142,7 +8982,7 @@ mdb_rebalance(MDB_cursor *mc) +@@ -8142,7 +8987,7 @@ mdb_rebalance(MDB_cursor *mc) DPUTS("reading left neighbor"); mn.mc_ki[ptop]--; node = NODEPTR(mc->mc_pg[ptop], mn.mc_ki[ptop]); @@ -2993,7 +3019,7 @@ index d2e81e4..0110402 100644 if (rc) return rc; mn.mc_ki[mn.mc_top] = NUMKEYS(mn.mc_pg[mn.mc_top]) - 1; -@@ -8150,7 +8990,7 @@ mdb_rebalance(MDB_cursor *mc) +@@ -8150,7 +8995,7 @@ mdb_rebalance(MDB_cursor *mc) fromleft = 1; } @@ -3002,7 +3028,7 @@ index d2e81e4..0110402 100644 mn.mc_pg[mn.mc_top]->mp_pgno, NUMKEYS(mn.mc_pg[mn.mc_top]), (float)PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) / 10)); -@@ -8207,8 +9047,6 @@ mdb_cursor_del0(MDB_cursor *mc) +@@ -8207,8 +9052,6 @@ mdb_cursor_del0(MDB_cursor *mc) if (m3->mc_pg[mc->mc_top] == mp) { if (m3->mc_ki[mc->mc_top] == ki) { m3->mc_flags |= C_DEL; @@ -3011,7 +3037,7 @@ index d2e81e4..0110402 100644 } else if (m3->mc_ki[mc->mc_top] > ki) { m3->mc_ki[mc->mc_top]--; } -@@ -8242,11 +9080,21 @@ mdb_cursor_del0(MDB_cursor *mc) +@@ -8242,11 +9085,21 @@ mdb_cursor_del0(MDB_cursor *mc) continue; if (m3->mc_pg[mc->mc_top] == mp) { /* if m3 points past last node in page, find next sibling */ @@ -3038,7 +3064,7 @@ index d2e81e4..0110402 100644 } } } -@@ -8352,7 +9200,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno +@@ -8352,7 +9205,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno newindx = mc->mc_ki[mc->mc_top]; nkeys = NUMKEYS(mp); @@ -3047,7 +3073,7 @@ index d2e81e4..0110402 100644 IS_LEAF(mp) ? "leaf" : "branch", mp->mp_pgno, DKEY(newkey), mc->mc_ki[mc->mc_top], nkeys)); -@@ -8360,7 +9208,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno +@@ -8360,7 +9213,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno if ((rc = mdb_page_new(mc, mp->mp_flags, 1, &rp))) return rc; rp->mp_pad = mp->mp_pad; @@ -3056,7 +3082,7 @@ index d2e81e4..0110402 100644 /* Usually when splitting the root page, the cursor * height is 1. But when called from mdb_update_key, -@@ -8378,7 +9226,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno +@@ -8378,7 +9231,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno mc->mc_pg[0] = pp; mc->mc_ki[0] = 0; mc->mc_db->md_root = pp->mp_pgno; @@ -3065,7 +3091,7 @@ index d2e81e4..0110402 100644 new_root = mc->mc_db->md_depth++; /* Add left (implicit) pointer. */ -@@ -8395,7 +9243,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno +@@ -8395,7 +9248,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno ptop = 0; } else { ptop = mc->mc_top-1; @@ -3074,7 +3100,7 @@ index d2e81e4..0110402 100644 } mdb_cursor_copy(mc, &mn); -@@ -8776,11 +9624,12 @@ mdb_put(MDB_txn *txn, MDB_dbi dbi, +@@ -8776,11 +9629,12 @@ mdb_put(MDB_txn *txn, MDB_dbi dbi, #ifndef MDB_WBUF #define MDB_WBUF (1024*1024) #endif @@ -3089,7 +3115,7 @@ index d2e81e4..0110402 100644 char *mc_wbuf[2]; char *mc_over[2]; MDB_env *mc_env; -@@ -8789,10 +9638,9 @@ typedef struct mdb_copy { +@@ -8789,10 +9643,9 @@ typedef struct mdb_copy { int mc_olen[2]; pgno_t mc_next_pgno; HANDLE mc_fd; @@ -3103,7 +3129,7 @@ index d2e81e4..0110402 100644 } mdb_copy; /** Dedicated writer thread for compacting copy. */ -@@ -8811,20 +9659,16 @@ mdb_env_copythr(void *arg) +@@ -8811,20 +9664,16 @@ mdb_env_copythr(void *arg) #endif pthread_mutex_lock(&my->mc_mutex); @@ -3127,7 +3153,7 @@ index d2e81e4..0110402 100644 DO_WRITE(rc, my->mc_fd, ptr, wsize, len); if (!rc) { rc = ErrCode(); -@@ -8840,8 +9684,7 @@ again: +@@ -8840,8 +9689,7 @@ again: } } if (rc) { @@ -3137,7 +3163,7 @@ index d2e81e4..0110402 100644 } /* If there's an overflow page tail, write it too */ if (my->mc_olen[toggle]) { -@@ -8852,39 +9695,41 @@ again: +@@ -8852,39 +9700,41 @@ again: } my->mc_wlen[toggle] = 0; toggle ^= 1; @@ -3194,7 +3220,7 @@ index d2e81e4..0110402 100644 MDB_node *ni; MDB_page *mo, *mp, *leaf; char *buf, *ptr; -@@ -8896,10 +9741,10 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) +@@ -8896,10 +9746,10 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) return MDB_SUCCESS; mc.mc_snum = 1; @@ -3208,7 +3234,7 @@ index d2e81e4..0110402 100644 if (rc) return rc; rc = mdb_page_search_root(&mc, NULL, MDB_PS_FIRST); -@@ -8943,7 +9788,8 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) +@@ -8943,7 +9793,8 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) } memcpy(&pg, NODEDATA(ni), sizeof(pg)); @@ -3218,7 +3244,7 @@ index d2e81e4..0110402 100644 if (rc) goto done; if (my->mc_wlen[toggle] >= MDB_WBUF) { -@@ -8965,7 +9811,6 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) +@@ -8965,7 +9816,6 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) goto done; toggle = my->mc_toggle; } @@ -3226,7 +3252,7 @@ index d2e81e4..0110402 100644 } else if (ni->mn_flags & F_SUBDATA) { MDB_db db; -@@ -8994,7 +9839,7 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) +@@ -8994,7 +9844,7 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) again: ni = NODEPTR(mp, mc.mc_ki[mc.mc_top]); pg = NODEPGNO(ni); @@ -3235,7 +3261,7 @@ index d2e81e4..0110402 100644 if (rc) goto done; mc.mc_top++; -@@ -9043,47 +9888,56 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd) +@@ -9043,47 +9893,56 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd) { MDB_meta *mm; MDB_page *mp; @@ -3314,7 +3340,7 @@ index d2e81e4..0110402 100644 mp = (MDB_page *)my.mc_wbuf[0]; memset(mp, 0, NUM_METAS * env->me_psize); -@@ -9099,57 +9953,64 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd) +@@ -9099,57 +9958,64 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd) *(MDB_meta *)METADATA(mp) = *mm; mm = (MDB_meta *)METADATA(mp); @@ -3409,7 +3435,7 @@ index d2e81e4..0110402 100644 } /** Copy environment as-is. */ -@@ -9159,7 +10020,7 @@ mdb_env_copyfd0(MDB_env *env, HANDLE fd) +@@ -9159,7 +10025,7 @@ mdb_env_copyfd0(MDB_env *env, HANDLE fd) MDB_txn *txn = NULL; mdb_mutexref_t wmutex = NULL; int rc; @@ -3418,7 +3444,7 @@ index d2e81e4..0110402 100644 char *ptr; #ifdef _WIN32 DWORD len, w2; -@@ -9220,7 +10081,7 @@ mdb_env_copyfd0(MDB_env *env, HANDLE fd) +@@ -9220,7 +10086,7 @@ mdb_env_copyfd0(MDB_env *env, HANDLE fd) w3 = txn->mt_next_pgno * env->me_psize; { @@ -3427,7 +3453,7 @@ index d2e81e4..0110402 100644 if ((rc = mdb_fsize(env->me_fd, &fsize))) goto leave; if (w3 > fsize) -@@ -9659,11 +10520,19 @@ mdb_drop0(MDB_cursor *mc, int subs) +@@ -9659,11 +10525,19 @@ mdb_drop0(MDB_cursor *mc, int subs) /* DUPSORT sub-DBs have no ovpages/DBs. Omit scanning leaves. * This also avoids any P_LEAF2 pages, which have no nodes. @@ -3448,7 +3474,7 @@ index d2e81e4..0110402 100644 while (mc->mc_snum > 0) { MDB_page *mp = mc->mc_pg[mc->mc_top]; unsigned n = NUMKEYS(mp); -@@ -9674,7 +10543,7 @@ mdb_drop0(MDB_cursor *mc, int subs) +@@ -9674,7 +10548,7 @@ mdb_drop0(MDB_cursor *mc, int subs) MDB_page *omp; pgno_t pg; memcpy(&pg, NODEDATA(ni), sizeof(pg)); @@ -3457,7 +3483,7 @@ index d2e81e4..0110402 100644 if (rc != 0) goto done; mdb_cassert(mc, IS_OVERFLOW(omp)); -@@ -9682,6 +10551,9 @@ mdb_drop0(MDB_cursor *mc, int subs) +@@ -9682,6 +10556,9 @@ mdb_drop0(MDB_cursor *mc, int subs) pg, omp->mp_pages); if (rc) goto done; @@ -3467,7 +3493,7 @@ index d2e81e4..0110402 100644 } else if (subs && (ni->mn_flags & F_SUBDATA)) { mdb_xcursor_init1(mc, ni); rc = mdb_drop0(&mc->mc_xcursor->mx_cursor, 0); -@@ -9689,6 +10561,8 @@ mdb_drop0(MDB_cursor *mc, int subs) +@@ -9689,6 +10566,8 @@ mdb_drop0(MDB_cursor *mc, int subs) goto done; } } @@ -3476,7 +3502,7 @@ index d2e81e4..0110402 100644 } else { if ((rc = mdb_midl_need(&txn->mt_free_pgs, n)) != 0) goto done; -@@ -9710,6 +10584,7 @@ mdb_drop0(MDB_cursor *mc, int subs) +@@ -9710,6 +10589,7 @@ mdb_drop0(MDB_cursor *mc, int subs) /* no more siblings, go back to beginning * of previous level. */ @@ -3484,7 +3510,7 @@ index d2e81e4..0110402 100644 mdb_cursor_pop(mc); mc->mc_ki[0] = 0; for (i=1; imc_snum; i++) { -@@ -9723,6 +10598,8 @@ mdb_drop0(MDB_cursor *mc, int subs) +@@ -9723,6 +10603,8 @@ mdb_drop0(MDB_cursor *mc, int subs) done: if (rc) txn->mt_flags |= MDB_TXN_ERROR; @@ -3493,7 +3519,7 @@ index d2e81e4..0110402 100644 } else if (rc == MDB_NOTFOUND) { rc = MDB_SUCCESS; } -@@ -9842,7 +10719,7 @@ mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx) +@@ -9842,7 +10724,7 @@ mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx) if (mr[i].mr_pid) { txnid_t txnid = mr[i].mr_txnid; sprintf(buf, txnid == (txnid_t)-1 ? @@ -3502,7 +3528,7 @@ index d2e81e4..0110402 100644 (int)mr[i].mr_pid, (size_t)mr[i].mr_tid, txnid); if (first) { first = 0; -@@ -9947,7 +10824,7 @@ mdb_reader_check0(MDB_env *env, int rlocked, int *dead) +@@ -9947,7 +10829,7 @@ mdb_reader_check0(MDB_env *env, int rlocked, int *dead) } for (; j Date: Fri, 10 Feb 2017 14:57:02 -0800 Subject: [PATCH 047/137] Make StatusParagraph::find_installed() const --- toolsrc/include/StatusParagraphs.h | 2 +- toolsrc/src/StatusParagraphs.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/toolsrc/include/StatusParagraphs.h b/toolsrc/include/StatusParagraphs.h index 11491cf4ecb..3c5d3518312 100644 --- a/toolsrc/include/StatusParagraphs.h +++ b/toolsrc/include/StatusParagraphs.h @@ -20,7 +20,7 @@ namespace vcpkg } const_iterator find(const std::string& name, const triplet& target_triplet) const; iterator find(const std::string& name, const triplet& target_triplet); - iterator find_installed(const std::string& name, const triplet& target_triplet); + const_iterator find_installed(const std::string& name, const triplet& target_triplet) const; iterator insert(std::unique_ptr); diff --git a/toolsrc/src/StatusParagraphs.cpp b/toolsrc/src/StatusParagraphs.cpp index c2398d2b82e..48bc0b0624f 100644 --- a/toolsrc/src/StatusParagraphs.cpp +++ b/toolsrc/src/StatusParagraphs.cpp @@ -29,9 +29,9 @@ namespace vcpkg }); } - StatusParagraphs::iterator StatusParagraphs::find_installed(const std::string& name, const triplet& target_triplet) + StatusParagraphs::const_iterator StatusParagraphs::find_installed(const std::string& name, const triplet& target_triplet) const { - auto it = find(name, target_triplet); + const const_iterator it = find(name, target_triplet); if (it != end() && (*it)->want == want_t::install) { return it; From af583825a7068614b080536870b15cbaa6bcf10a Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Feb 2017 16:51:36 -0800 Subject: [PATCH 048/137] [Checks] Add check_exit() overload with no message --- toolsrc/include/vcpkg_Checks.h | 2 ++ toolsrc/src/vcpkg_Checks.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg_Checks.h index a58b38ac0d6..23869f35f27 100644 --- a/toolsrc/include/vcpkg_Checks.h +++ b/toolsrc/include/vcpkg_Checks.h @@ -35,6 +35,8 @@ namespace vcpkg::Checks } } + void check_exit(bool expression); + void check_exit(bool expression, const char* errorMessage); template diff --git a/toolsrc/src/vcpkg_Checks.cpp b/toolsrc/src/vcpkg_Checks.cpp index 5c3fef27a8e..f02addc081a 100644 --- a/toolsrc/src/vcpkg_Checks.cpp +++ b/toolsrc/src/vcpkg_Checks.cpp @@ -33,6 +33,14 @@ namespace vcpkg::Checks } } + void check_exit(bool expression) + { + if (!expression) + { + exit(EXIT_FAILURE); + } + } + void check_exit(bool expression, const char* errorMessage) { if (!expression) From 0c03dc563191b5bb8a843e7517a0a24427f0ddde Mon Sep 17 00:00:00 2001 From: codicodi Date: Mon, 13 Feb 2017 23:48:48 +0100 Subject: [PATCH 049/137] add-gdk-pixbuf --- ports/gdk-pixbuf/CMakeLists.txt | 128 ++++++++++++++++++++++++++++++++ ports/gdk-pixbuf/CONTROL | 4 + ports/gdk-pixbuf/portfile.cmake | 24 ++++++ 3 files changed, 156 insertions(+) create mode 100644 ports/gdk-pixbuf/CMakeLists.txt create mode 100644 ports/gdk-pixbuf/CONTROL create mode 100644 ports/gdk-pixbuf/portfile.cmake diff --git a/ports/gdk-pixbuf/CMakeLists.txt b/ports/gdk-pixbuf/CMakeLists.txt new file mode 100644 index 00000000000..a26e59fb484 --- /dev/null +++ b/ports/gdk-pixbuf/CMakeLists.txt @@ -0,0 +1,128 @@ +cmake_minimum_required(VERSION 3.0) +project(gdk-pixbuf) + +set(GDK_PIXBUF_LIB_SUFFIX 2.0) +set(GDK_PIXBUF_DLL_SUFFIX 2) +set(GDK_PIXBUF_BINARY_VERSION 2.10.0) +set(GLIB_LIB_VERSION 2.0) + +find_package(ZLIB REQUIRED) +find_package(PNG REQUIRED) + +find_path(GLIB_INCLUDE_DIR glib.h) +find_library(GLIB_GLIB_LIBRARY glib-${GLIB_LIB_VERSION}) +find_library(GLIB_GIO_LIBRARY gio-${GLIB_LIB_VERSION}) +find_library(GLIB_GOBJECT_LIBRARY gobject-${GLIB_LIB_VERSION}) +find_library(GLIB_GMODULE_LIBRARY gmodule-${GLIB_LIB_VERSION}) +set(GLIB_LIBRARIES ${GLIB_GLIB_LIBRARY} ${GLIB_GOBJECT_LIBRARY} ${GLIB_GMODULE_LIBRARY} ${GLIB_GIO_LIBRARY}) + +find_path(LIBINTL_INCLUDE_DIR libintl.h) +find_library(LIBINTL_LIBRARY NAMES libintl intl) + +configure_file(./config.h.win32 ${CMAKE_SOURCE_DIR}/config.h COPYONLY) +include_directories(. ./gdk-pixbuf) + +add_library(gdk-pixbuf + gdk-pixbuf/gdk-pixbuf.c + gdk-pixbuf/gdk-pixbuf-animation.c + gdk-pixbuf/gdk-pixbuf-data.c + gdk-pixbuf/gdk-pixbuf-io.c + gdk-pixbuf/gdk-pixbuf-loader.c + gdk-pixbuf/gdk-pixbuf-scale.c + gdk-pixbuf/gdk-pixbuf-simple-anim.c + gdk-pixbuf/gdk-pixbuf-scaled-anim.c + gdk-pixbuf/gdk-pixbuf-util.c + gdk-pixbuf/gdk-pixdata.c + gdk-pixbuf/gdk-pixbuf-enum-types.c + gdk-pixbuf/io-ani.c + gdk-pixbuf/io-ani-animation.c + gdk-pixbuf/io-icns.c + gdk-pixbuf/io-pnm.c + gdk-pixbuf/io-png.c + gdk-pixbuf/io-qtif.c + gdk-pixbuf/io-tga.c + gdk-pixbuf/gdk-pixbuf-buffer-queue.c + gdk-pixbuf/io-xpm.c + gdk-pixbuf/io-xbm.c + gdk-pixbuf/pixops/pixops.c + gdk-pixbuf/io-gdip-animation.c + gdk-pixbuf/io-gdip-bmp.c + gdk-pixbuf/io-gdip-emf.c + gdk-pixbuf/io-gdip-gif.c + gdk-pixbuf/io-gdip-ico.c + gdk-pixbuf/io-gdip-jpeg.c + gdk-pixbuf/io-gdip-tiff.c + gdk-pixbuf/io-gdip-utils.c + gdk-pixbuf/io-gdip-wmf.c) + +target_include_directories(gdk-pixbuf PRIVATE + ${GLIB_INCLUDE_DIR} + ${PNG_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIRS} + ${LIBINTL_INCLUDE_DIR}) + +target_link_libraries(gdk-pixbuf + ${GLIB_LIBRARIES} + ${ZLIB_LIBRARIES} + ${PNG_LIBRARIES} + ${LIBINTL_LIBRARY} + Gdiplus) + +target_compile_definitions(gdk-pixbuf PRIVATE + HAVE_CONFIG_H + GDK_PIXBUF_COMPILATION + GDK_PIXBUF_ENABLE_BACKEND + DLL_EXPORT + GDK_PIXBUF_RELOCATABLE + GDK_PIXBUF_PREFIX="/dummy" + GDK_PIXBUF_BINARY_VERSION="${GDK_PIXBUF_BINARY_VERSION}" + INCLUDE_ani + INCLUDE_tga + INCLUDE_xbm + INCLUDE_png + INCLUDE_qtif + INCLUDE_pnm + INCLUDE_icns + INCLUDE_xpm + INCLUDE_gdiplus + G_DISABLE_SINGLE_INCLUDES + GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) + +set_target_properties(gdk-pixbuf PROPERTIES + OUTPUT_NAME gdk_pixbuf-${GDK_PIXBUF_DLL_SUFFIX} + ARCHIVE_OUTPUT_NAME gdk_pixbuf-${GDK_PIXBUF_LIB_SUFFIX}) + +install(TARGETS gdk-pixbuf + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +macro(gdk_add_tool TOOL_NAME) + add_executable(${TOOL_NAME} ${ARGN}) + target_include_directories(${TOOL_NAME} PRIVATE ${GLIB_INCLUDE_DIR}) + target_link_libraries(${TOOL_NAME} gdk-pixbuf ${GLIB_LIBRARIES}) + install(TARGETS ${TOOL_NAME} RUNTIME DESTINATION tools/gdk-pixbuf) +endmacro() + +if(NOT GDK_SKIP_TOOLS) + gdk_add_tool(gdk-pixbuf-csource gdk-pixbuf/gdk-pixbuf-csource.c) + gdk_add_tool(gdk-pixbuf-pixdata gdk-pixbuf/gdk-pixbuf-pixdata.c) +endif() + +if(NOT GDK_SKIP_HEADERS) + INSTALL(FILES + gdk-pixbuf/gdk-pixbuf.h + gdk-pixbuf/gdk-pixbuf-autocleanups.h + gdk-pixbuf/gdk-pixbuf-core.h + gdk-pixbuf/gdk-pixbuf-transform.h + gdk-pixbuf/gdk-pixbuf-io.h + gdk-pixbuf/gdk-pixbuf-animation.h + gdk-pixbuf/gdk-pixbuf-simple-anim.h + gdk-pixbuf/gdk-pixbuf-loader.h + gdk-pixbuf/gdk-pixbuf-enum-types.h + gdk-pixbuf/gdk-pixbuf-marshal.h + gdk-pixbuf/gdk-pixbuf-features.h + gdk-pixbuf/gdk-pixdata.h + gdk-pixbuf/gdk-pixbuf-macros.h + DESTINATION include/gdk-pixbuf) +endif() diff --git a/ports/gdk-pixbuf/CONTROL b/ports/gdk-pixbuf/CONTROL new file mode 100644 index 00000000000..1a8a208dbc1 --- /dev/null +++ b/ports/gdk-pixbuf/CONTROL @@ -0,0 +1,4 @@ +Source: gdk-pixbuf +Version: 2.36.3 +Description: Image loading library. +Build-Depends: gettext, zlib, libpng, glib diff --git a/ports/gdk-pixbuf/portfile.cmake b/ports/gdk-pixbuf/portfile.cmake new file mode 100644 index 00000000000..d10338d4c8e --- /dev/null +++ b/ports/gdk-pixbuf/portfile.cmake @@ -0,0 +1,24 @@ + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gdk-pixbuf-2.36.3) +vcpkg_download_distfile(ARCHIVE + URLS "http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.36/gdk-pixbuf-2.36.3.tar.xz" + FILENAME "gdk-pixbuf-2.36.3.tar.xz" + SHA512 b9c9fdf45445ceeb7f5039e73cfc803756c5b34574eae4958cdfb525036e1722ab996c1b439fdaa85e73b11069762aeec43e11cadce514d1701d0e43626f20de) + +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_DEBUG + -DGDK_SKIP_HEADERS=ON + -DGDK_SKIP_TOOLS=ON) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() +vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/gdk-pixbuf) + +file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/gdk-pixbuf) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/gdk-pixbuf/COPYING ${CURRENT_PACKAGES_DIR}/share/gdk-pixbuf/copyright) From 9406f333aaa290c4386fe06b2845b5b439592ed9 Mon Sep 17 00:00:00 2001 From: codicodi Date: Mon, 13 Feb 2017 23:58:50 +0100 Subject: [PATCH 050/137] [gdk-pixbuf] use latest version --- ports/gdk-pixbuf/CONTROL | 2 +- ports/gdk-pixbuf/portfile.cmake | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/gdk-pixbuf/CONTROL b/ports/gdk-pixbuf/CONTROL index 1a8a208dbc1..8c32ddeff66 100644 --- a/ports/gdk-pixbuf/CONTROL +++ b/ports/gdk-pixbuf/CONTROL @@ -1,4 +1,4 @@ Source: gdk-pixbuf -Version: 2.36.3 +Version: 2.36.5 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 d10338d4c8e..e31690d6410 100644 --- a/ports/gdk-pixbuf/portfile.cmake +++ b/ports/gdk-pixbuf/portfile.cmake @@ -1,10 +1,10 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gdk-pixbuf-2.36.3) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gdk-pixbuf-2.36.5) vcpkg_download_distfile(ARCHIVE - URLS "http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.36/gdk-pixbuf-2.36.3.tar.xz" - FILENAME "gdk-pixbuf-2.36.3.tar.xz" - SHA512 b9c9fdf45445ceeb7f5039e73cfc803756c5b34574eae4958cdfb525036e1722ab996c1b439fdaa85e73b11069762aeec43e11cadce514d1701d0e43626f20de) + URLS "http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.36/gdk-pixbuf-2.36.5.tar.xz" + FILENAME "gdk-pixbuf-2.36.5.tar.xz" + SHA512 27c39bace7bc6cf713915dcb1f35eebfb80ae599d1c9106f48af4cd447050c41e37adee76d29d6b42fbe3d0123b054c8701f2d1b4b99060b4869aa7871523b70) vcpkg_extract_source_archive(${ARCHIVE}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) From 18abe2944da14e741ece014205510643eeb6577d Mon Sep 17 00:00:00 2001 From: codicodi Date: Tue, 14 Feb 2017 00:27:59 +0100 Subject: [PATCH 051/137] [gdk-pixbuf] disable static builds --- ports/gdk-pixbuf/portfile.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/gdk-pixbuf/portfile.cmake b/ports/gdk-pixbuf/portfile.cmake index e31690d6410..7d104a9fe8f 100644 --- a/ports/gdk-pixbuf/portfile.cmake +++ b/ports/gdk-pixbuf/portfile.cmake @@ -1,3 +1,7 @@ +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + message(STATUS "Warning: Static building not supported. Building dynamic.") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gdk-pixbuf-2.36.5) From 7c5f8e2f70297f724b8548805d00eceb7f9f6dad Mon Sep 17 00:00:00 2001 From: sdcb Date: Tue, 14 Feb 2017 15:30:30 +0800 Subject: [PATCH 052/137] [chakracore] upgrade to latest 1.4.1 and fix #665 1. upgrade to latest 1.4.1(https://github.com/Microsoft/ChakraCore/releases) 2. fix https://github.com/Microsoft/vcpkg/issues/665 by disable /WX 3. add ch.exe, GCStres.exe, rl.exe into tools directory(which I think maybe useful). --- .../chakracore/disable_warning_as_error.patch | 20 +++++++++++++++++ ports/chakracore/portfile.cmake | 22 +++++++++++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 ports/chakracore/disable_warning_as_error.patch diff --git a/ports/chakracore/disable_warning_as_error.patch b/ports/chakracore/disable_warning_as_error.patch new file mode 100644 index 00000000000..da7b5da77f2 --- /dev/null +++ b/ports/chakracore/disable_warning_as_error.patch @@ -0,0 +1,20 @@ +diff --git a/bin/NativeTests/NativeTests.vcxproj b/bin/NativeTests/NativeTests.vcxproj +index d020992..ac70a65 100644 +--- a/bin/NativeTests/NativeTests.vcxproj ++++ b/bin/NativeTests/NativeTests.vcxproj +@@ -30,6 +30,15 @@ + true + false + false ++ false ++ false ++ false ++ false ++ false ++ false ++ false ++ false ++ false + + + diff --git a/ports/chakracore/portfile.cmake b/ports/chakracore/portfile.cmake index d4bec63d20e..b6aa94b4a01 100644 --- a/ports/chakracore/portfile.cmake +++ b/ports/chakracore/portfile.cmake @@ -4,14 +4,20 @@ endif() include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ChakraCore-1.4.0) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ChakraCore-1.4.1) vcpkg_download_distfile(ARCHIVE_FILE - URLS "https://github.com/Microsoft/ChakraCore/archive/v1.4.0.tar.gz" - FILENAME "ChakraCore-1.4.0.tar.gz" - SHA512 d515d56ff1c5776ca4663e27daa4d1c7ca58c57f097799de756980771b5701e35639eefa4db5921d7327e6607b8920df3b30677eb467123e04536df0d971cebc + URLS "https://github.com/Microsoft/ChakraCore/archive/v1.4.1.tar.gz" + FILENAME "ChakraCore-1.4.1.tar.gz" + SHA512 9ca89de88a4d6102826ce4e301ea81b70296cca72131043f9942de715dee2862791c6f33ebce1f12fcafc1554a872a2cf9317313d56c57abff0a6d814a77f2d5 ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/disable_warning_as_error.patch +) + vcpkg_build_msbuild( PROJECT_PATH ${SOURCE_PATH}/Build/Chakra.Core.sln ) @@ -19,6 +25,8 @@ vcpkg_build_msbuild( file(INSTALL ${SOURCE_PATH}/lib/jsrt/ChakraCore.h ${SOURCE_PATH}/lib/jsrt/ChakraCommon.h + ${SOURCE_PATH}/lib/jsrt/ChakraCommonWindows.h + ${SOURCE_PATH}/lib/jsrt/ChakraDebug.h DESTINATION ${CURRENT_PACKAGES_DIR}/include ) file(INSTALL @@ -39,6 +47,12 @@ file(INSTALL ${SOURCE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/Chakracore.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib ) +file(INSTALL + ${SOURCE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/ch.exe + ${SOURCE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/GCStress.exe + ${SOURCE_PATH}/Build/VcBuild/bin/${TRIPLET_SYSTEM_ARCH}_release/rl.exe + DESTINATION ${CURRENT_PACKAGES_DIR}/tools/chakracore) +vcpkg_copy_pdbs() file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/ChakraCore RENAME copyright) From e03ca8215f4d9859185684a2e3c206e0e303be23 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 11:35:21 -0800 Subject: [PATCH 053/137] Update CHANGELOG and bump version to v0.0.72 --- CHANGELOG.md | 37 +++++++++++++++++++++++++++++++++++++ toolsrc/VERSION.txt | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b631be48b2f..7fa8739dba7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,40 @@ +vcpkg (0.0.72) +-------------- + * Add ports: + - cuda 8.0 + - hdf5 1.8.18 + - lcms 2.8 + - libepoxy 1.4.0-2432daf-1 + - libnice 0.1.13 + - msmpi 8.0 + - parmetis 4.0.3 + - sqlite-modern-cpp 2.4 + - websocketpp 0.7.0 + * Update ports: + - asio 1.10.6 -> 1.10.8 + - aws-sdk-cpp 1.0.47 -> 1.0.61 + - bond 5.0.0-4-g53ea136 -> 5.2.0 + - cpprestsdk 2.9.0-1 -> 2.9.0-2 + - fmt 3.0.1-1 -> 3.0.1-4 + - grpc 1.1.0-dev-1674f65-1 -> 1.1.0-dev-1674f65-2 + - libraw 0.17.2-2 -> 0.18.0-1 + - libvorbis 1.3.5-143caf4023a90c09a5eb685fdd46fb9b9c36b1ee -> 1.3.5-1-143caf4023a90c09a5eb685fdd46fb9b9c36b1ee + - poco 1.7.6-2 -> 1.7.6-3 + - rapidjson 1.0.2-1 -> 1.1.0 + - sfml 2.4.1 -> 2.4.2 + - wt 3.3.6-2 -> 3.3.6-3 + * Introduce Build Policies: + - Packages with special characteristics (e.g. CUDA) can now use Build Policies to control which post-build checks apply to them. + * Improve support for Visual Studio 2017 + - Add auto-detection for Windows SDK + - Fixed various issues with `bootstrap.ps1` and VS2017 support + * Automatic acquisition of perl now uses the 32-bit version isntead of the 64-bit version + * Fix `vcpkg remove --purge` not applying to non-installed packages + * Fixes and improvements in existing portfiles and the `vcpkg` tool itself + +-- vcpkg team TUE, 14 Feb 2017 11:30:00 -0800 + + vcpkg (0.0.71) -------------- * Add ports: diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index fcedfa2359a..204dee5e59c 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"0.0.71" \ No newline at end of file +"0.0.72" \ No newline at end of file From 8aa82bb8957cb5b76ad1d1209cf675b2eba7401d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 13:03:51 -0800 Subject: [PATCH 054/137] [msmpi] Find the correct Program Files. Resolves #669 --- ports/msmpi/portfile.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index b59a2f590bd..4a142f20b04 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -7,8 +7,16 @@ vcpkg_download_distfile(SDK_ARCHIVE SHA512 49c762873ba777ccb3c959a1d2ca1392e4c3c8d366e604ad707184ea432302e6649894ec6599162d0d40f3e6ebc0dada1eb9ca0da1cde0f6ba7a9b1847dac8c0 ) -# Check for correct version of installed redistributable package -set(SYSTEM_MPIEXEC_FILEPATH "$ENV{PROGRAMFILES}/Microsoft MPI/Bin/mpiexec.exe") +### Check for correct version of installed redistributable package + +# We always want the ProgramFiles folder even on a 64-bit machine (not the ProgramFilesx86 folder) +# The following makes sure both 32-bit and 64-bit processes get the correct ProgramFiles +if(DEFINED ENV{ProgramW6432}) + set(PROGRAM_FILES_FOLDER $ENV{ProgramW6432}) +else() + set(PROGRAM_FILES_FOLDER $ENV{PROGRAMFILES}) +endif() +set(SYSTEM_MPIEXEC_FILEPATH "${PROGRAM_FILES_FOLDER}/Microsoft MPI/Bin/mpiexec.exe") set(MSMPI_EXPECTED_FULL_VERSION "8.0.12438.0") if(EXISTS ${SYSTEM_MPIEXEC_FILEPATH}) From c11b2c790e0260434d057cd5fbeccd59f36732c7 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 13:21:30 -0800 Subject: [PATCH 055/137] Rename wdupenv_str to get_environmental_variable() --- toolsrc/include/vcpkg_System.h | 2 +- toolsrc/src/commands_edit.cpp | 2 +- toolsrc/src/commands_integrate.cpp | 2 +- toolsrc/src/vcpkg.cpp | 4 ++-- toolsrc/src/vcpkg_Environment.cpp | 8 ++++---- toolsrc/src/vcpkg_System.cpp | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index c9195163c54..92ceacc88bf 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -92,5 +92,5 @@ namespace vcpkg::System double microseconds() const; }; - std::wstring wdupenv_str(const wchar_t* varname) noexcept; + std::wstring get_environmental_variable(const wchar_t* varname) noexcept; } diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index dff30f7add4..a25a9e4dc65 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -15,7 +15,7 @@ namespace vcpkg::Commands::Edit Checks::check_exit(fs::is_directory(portpath), R"(Could not find port named "%s")", port_name); // Find editor - std::wstring env_EDITOR = System::wdupenv_str(L"EDITOR"); + std::wstring env_EDITOR = System::get_environmental_variable(L"EDITOR"); if (env_EDITOR.empty()) { static const std::wstring CODE_EXE_PATH = LR"(C:\Program Files (x86)\Microsoft VS Code\Code.exe)"; diff --git a/toolsrc/src/commands_integrate.cpp b/toolsrc/src/commands_integrate.cpp index 03c51b5a75c..93fb2948701 100644 --- a/toolsrc/src/commands_integrate.cpp +++ b/toolsrc/src/commands_integrate.cpp @@ -136,7 +136,7 @@ namespace vcpkg::Commands::Integrate static fs::path get_appdata_targets_path() { - return fs::path(System::wdupenv_str(L"LOCALAPPDATA")) / "vcpkg" / "vcpkg.user.targets"; + return fs::path(System::get_environmental_variable(L"LOCALAPPDATA")) / "vcpkg" / "vcpkg.user.targets"; } static void integrate_install(const vcpkg_paths& paths) diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 3e313c70222..27a34b80d40 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -47,7 +47,7 @@ static void inner(const vcpkg_cmd_arguments& args) } else { - auto vcpkg_root_dir_env = System::wdupenv_str(L"VCPKG_ROOT"); + auto vcpkg_root_dir_env = System::get_environmental_variable(L"VCPKG_ROOT"); if (!vcpkg_root_dir_env.empty()) { @@ -79,7 +79,7 @@ static void inner(const vcpkg_cmd_arguments& args) } else { - const auto vcpkg_default_triplet_env = System::wdupenv_str(L"VCPKG_DEFAULT_TRIPLET"); + const auto vcpkg_default_triplet_env = System::get_environmental_variable(L"VCPKG_DEFAULT_TRIPLET"); if (!vcpkg_default_triplet_env.empty()) { default_target_triplet = triplet::from_canonical_name(Strings::utf16_to_utf8(vcpkg_default_triplet_env)); diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 1babdc5470e..abde735cb52 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -57,7 +57,7 @@ namespace vcpkg::Environment const fs::path downloaded_git = paths.downloads / "PortableGit" / "cmd"; const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", downloaded_git.native(), - System::wdupenv_str(L"PATH"), + System::get_environmental_variable(L"PATH"), default_git_installation_dir.native(), default_git_installation_dir_x86.native()); _wputenv_s(L"PATH", path_buf.c_str()); @@ -73,7 +73,7 @@ namespace vcpkg::Environment const fs::path downloaded_cmake = paths.downloads / "cmake-3.7.2-win32-x86" / "bin"; const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", downloaded_cmake.native(), - System::wdupenv_str(L"PATH"), + System::get_environmental_variable(L"PATH"), default_cmake_installation_dir.native(), default_cmake_installation_dir_x86.native()); _wputenv_s(L"PATH", path_buf.c_str()); @@ -87,7 +87,7 @@ namespace vcpkg::Environment void ensure_nuget_on_path(const vcpkg_paths& paths) { const fs::path downloaded_nuget = paths.downloads / "nuget-3.5.0"; - const std::wstring path_buf = Strings::wformat(L"%s;%s", downloaded_nuget.native(), System::wdupenv_str(L"PATH")); + const std::wstring path_buf = Strings::wformat(L"%s;%s", downloaded_nuget.native(), System::get_environmental_variable(L"PATH")); _wputenv_s(L"PATH", path_buf.c_str()); static constexpr std::array nuget_version = {3,3,0}; @@ -107,7 +107,7 @@ namespace vcpkg::Environment static const fs::path& get_VS2015_installation_instance() { - static const fs::path vs2015_cmntools = fs::path(System::wdupenv_str(L"VS140COMNTOOLS")).parent_path(); // The call to parent_path() is needed because the env variable has a trailing backslash + static const fs::path vs2015_cmntools = fs::path(System::get_environmental_variable(L"VS140COMNTOOLS")).parent_path(); // The call to parent_path() is needed because the env variable has a trailing backslash static const fs::path vs2015_path = vs2015_cmntools.parent_path().parent_path(); return vs2015_path; } diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index 754a26741ff..1d9f8e69664 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -73,7 +73,7 @@ namespace vcpkg::System std::cout << "\n"; } - std::wstring wdupenv_str(const wchar_t* varname) noexcept + std::wstring get_environmental_variable(const wchar_t* varname) noexcept { std::wstring ret; wchar_t* buffer; From 0d47ce63ed1cc5159a038de0a8446e3828b8aeeb Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 13:26:21 -0800 Subject: [PATCH 056/137] Add System::set_environmental_variable() --- toolsrc/include/vcpkg_System.h | 2 ++ toolsrc/src/vcpkg_Environment.cpp | 6 +++--- toolsrc/src/vcpkg_System.cpp | 11 ++++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index 92ceacc88bf..777f64bf4fb 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -93,4 +93,6 @@ namespace vcpkg::System }; std::wstring get_environmental_variable(const wchar_t* varname) noexcept; + + void set_environmental_variable(const wchar_t* varname, const wchar_t* varvalue) noexcept; } diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index abde735cb52..77221369528 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -60,7 +60,7 @@ namespace vcpkg::Environment System::get_environmental_variable(L"PATH"), default_git_installation_dir.native(), default_git_installation_dir_x86.native()); - _wputenv_s(L"PATH", path_buf.c_str()); + System::set_environmental_variable(L"PATH", path_buf.c_str()); static constexpr std::array git_version = {2,0,0}; static const std::wstring version_check_cmd = L"git --version 2>&1"; @@ -76,7 +76,7 @@ namespace vcpkg::Environment System::get_environmental_variable(L"PATH"), default_cmake_installation_dir.native(), default_cmake_installation_dir_x86.native()); - _wputenv_s(L"PATH", path_buf.c_str()); + System::set_environmental_variable(L"PATH", path_buf.c_str()); static constexpr std::array cmake_version = {3,7,2}; static const std::wstring version_check_cmd = L"cmake --version 2>&1"; @@ -88,7 +88,7 @@ namespace vcpkg::Environment { const fs::path downloaded_nuget = paths.downloads / "nuget-3.5.0"; const std::wstring path_buf = Strings::wformat(L"%s;%s", downloaded_nuget.native(), System::get_environmental_variable(L"PATH")); - _wputenv_s(L"PATH", path_buf.c_str()); + System::set_environmental_variable(L"PATH", path_buf.c_str()); static constexpr std::array nuget_version = {3,3,0}; static const std::wstring version_check_cmd = L"nuget 2>&1"; diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index 1d9f8e69664..e7349df6923 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -29,7 +29,7 @@ namespace vcpkg::System auto pipe = _wpopen(actual_cmd_line.c_str(), L"r"); if (pipe == nullptr) { - return {1, output}; + return { 1, output }; } while (fgets(buf, 1024, pipe)) { @@ -37,10 +37,10 @@ namespace vcpkg::System } if (!feof(pipe)) { - return {1, output}; + return { 1, output }; } auto ec = _pclose(pipe); - return {ec, output}; + return { ec, output }; } void print(const char* message) @@ -86,6 +86,11 @@ namespace vcpkg::System return ret; } + void set_environmental_variable(const wchar_t* varname, const wchar_t* varvalue) noexcept + { + _wputenv_s(varname, varvalue); + } + void Stopwatch2::start() { static_assert(sizeof(start_time) == sizeof(LARGE_INTEGER), ""); From a5181331653592afcd6223140722ecbcfa58c94d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 15:27:37 -0800 Subject: [PATCH 057/137] Fix typo --- toolsrc/src/vcpkg_Environment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 77221369528..c9d844033ac 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -191,7 +191,7 @@ namespace vcpkg::Environment return { vs2015_vcvarsall_bat, L"v140" }; } - System::println(System::color::error, "Could not detect vccarsall.bat."); + System::println(System::color::error, "Could not detect vcvarsall.bat."); System::println("The following paths were examined:"); for (const fs::path& path : paths_examined) { From b882f365e9aebf95c07c8667e38ae2730931f74e Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 15:35:34 -0800 Subject: [PATCH 058/137] System::get_environmental_variable() now returns optional<> --- toolsrc/include/vcpkg_System.h | 3 +- toolsrc/src/commands_edit.cpp | 10 ++++-- toolsrc/src/commands_integrate.cpp | 2 +- toolsrc/src/vcpkg.cpp | 13 ++++--- toolsrc/src/vcpkg_Environment.cpp | 57 ++++++++++++++++++++---------- toolsrc/src/vcpkg_System.cpp | 13 ++++--- 6 files changed, 64 insertions(+), 34 deletions(-) diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index 777f64bf4fb..7634034ab9e 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -2,6 +2,7 @@ #include "vcpkg_Strings.h" #include "filesystem_fs.h" +#include "vcpkg_optional.h" namespace vcpkg::System { @@ -92,7 +93,7 @@ namespace vcpkg::System double microseconds() const; }; - std::wstring get_environmental_variable(const wchar_t* varname) noexcept; + optional get_environmental_variable(const wchar_t* varname) noexcept; void set_environmental_variable(const wchar_t* varname, const wchar_t* varvalue) noexcept; } diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index a25a9e4dc65..1487c759daa 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -15,8 +15,14 @@ namespace vcpkg::Commands::Edit Checks::check_exit(fs::is_directory(portpath), R"(Could not find port named "%s")", port_name); // Find editor - std::wstring env_EDITOR = System::get_environmental_variable(L"EDITOR"); - if (env_EDITOR.empty()) + const optional env_EDITOR_optional = System::get_environmental_variable(L"EDITOR"); + std::wstring env_EDITOR; + + if (env_EDITOR_optional) + { + env_EDITOR = *env_EDITOR_optional; + } + else { static const std::wstring CODE_EXE_PATH = LR"(C:\Program Files (x86)\Microsoft VS Code\Code.exe)"; if (fs::exists(CODE_EXE_PATH)) diff --git a/toolsrc/src/commands_integrate.cpp b/toolsrc/src/commands_integrate.cpp index 93fb2948701..ed3ab2c7e73 100644 --- a/toolsrc/src/commands_integrate.cpp +++ b/toolsrc/src/commands_integrate.cpp @@ -136,7 +136,7 @@ namespace vcpkg::Commands::Integrate static fs::path get_appdata_targets_path() { - return fs::path(System::get_environmental_variable(L"LOCALAPPDATA")) / "vcpkg" / "vcpkg.user.targets"; + return fs::path(*System::get_environmental_variable(L"LOCALAPPDATA")) / "vcpkg" / "vcpkg.user.targets"; } static void integrate_install(const vcpkg_paths& paths) diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 27a34b80d40..15310905367 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -47,11 +47,10 @@ static void inner(const vcpkg_cmd_arguments& args) } else { - auto vcpkg_root_dir_env = System::get_environmental_variable(L"VCPKG_ROOT"); - - if (!vcpkg_root_dir_env.empty()) + const optional vcpkg_root_dir_env = System::get_environmental_variable(L"VCPKG_ROOT"); + if (vcpkg_root_dir_env) { - vcpkg_root_dir = fs::absolute(vcpkg_root_dir_env); + vcpkg_root_dir = fs::absolute(*vcpkg_root_dir_env); } else { @@ -79,10 +78,10 @@ static void inner(const vcpkg_cmd_arguments& args) } else { - const auto vcpkg_default_triplet_env = System::get_environmental_variable(L"VCPKG_DEFAULT_TRIPLET"); - if (!vcpkg_default_triplet_env.empty()) + const optional vcpkg_default_triplet_env = System::get_environmental_variable(L"VCPKG_DEFAULT_TRIPLET"); + if (vcpkg_default_triplet_env) { - default_target_triplet = triplet::from_canonical_name(Strings::utf16_to_utf8(vcpkg_default_triplet_env)); + default_target_triplet = triplet::from_canonical_name(Strings::utf16_to_utf8(*vcpkg_default_triplet_env)); } else { diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index c9d844033ac..366c198c2fe 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -57,12 +57,12 @@ namespace vcpkg::Environment const fs::path downloaded_git = paths.downloads / "PortableGit" / "cmd"; const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", downloaded_git.native(), - System::get_environmental_variable(L"PATH"), + *System::get_environmental_variable(L"PATH"), default_git_installation_dir.native(), default_git_installation_dir_x86.native()); System::set_environmental_variable(L"PATH", path_buf.c_str()); - static constexpr std::array git_version = {2,0,0}; + static constexpr std::array git_version = { 2,0,0 }; static const std::wstring version_check_cmd = L"git --version 2>&1"; const std::wstring install_cmd = create_default_install_cmd(paths, L"git"); ensure_on_path(git_version, version_check_cmd, install_cmd); @@ -73,12 +73,12 @@ namespace vcpkg::Environment const fs::path downloaded_cmake = paths.downloads / "cmake-3.7.2-win32-x86" / "bin"; const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", downloaded_cmake.native(), - System::get_environmental_variable(L"PATH"), + *System::get_environmental_variable(L"PATH"), default_cmake_installation_dir.native(), default_cmake_installation_dir_x86.native()); System::set_environmental_variable(L"PATH", path_buf.c_str()); - static constexpr std::array cmake_version = {3,7,2}; + static constexpr std::array cmake_version = { 3,7,2 }; static const std::wstring version_check_cmd = L"cmake --version 2>&1"; const std::wstring install_cmd = create_default_install_cmd(paths, L"cmake"); ensure_on_path(cmake_version, version_check_cmd, install_cmd); @@ -87,10 +87,10 @@ namespace vcpkg::Environment void ensure_nuget_on_path(const vcpkg_paths& paths) { const fs::path downloaded_nuget = paths.downloads / "nuget-3.5.0"; - const std::wstring path_buf = Strings::wformat(L"%s;%s", downloaded_nuget.native(), System::get_environmental_variable(L"PATH")); + const std::wstring path_buf = Strings::wformat(L"%s;%s", downloaded_nuget.native(), *System::get_environmental_variable(L"PATH")); System::set_environmental_variable(L"PATH", path_buf.c_str()); - static constexpr std::array nuget_version = {3,3,0}; + static constexpr std::array nuget_version = { 3,3,0 }; static const std::wstring version_check_cmd = L"nuget 2>&1"; const std::wstring install_cmd = create_default_install_cmd(paths, L"nuget"); ensure_on_path(nuget_version, version_check_cmd, install_cmd); @@ -105,10 +105,22 @@ namespace vcpkg::Environment return Strings::split(ec_data.output, "\n"); } - static const fs::path& get_VS2015_installation_instance() + static optional find_vs2015_installation_instance() { - static const fs::path vs2015_cmntools = fs::path(System::get_environmental_variable(L"VS140COMNTOOLS")).parent_path(); // The call to parent_path() is needed because the env variable has a trailing backslash + const optional vs2015_cmntools_optional = System::get_environmental_variable(L"VS140COMNTOOLS"); + if (!vs2015_cmntools_optional) + { + return nullptr; + } + + static const fs::path vs2015_cmntools = fs::path(*vs2015_cmntools_optional).parent_path(); // The call to parent_path() is needed because the env variable has a trailing backslash static const fs::path vs2015_path = vs2015_cmntools.parent_path().parent_path(); + return std::make_unique(vs2015_path); + } + + static const optional& get_VS2015_installation_instance() + { + static const optional vs2015_path = find_vs2015_installation_instance(); return vs2015_path; } @@ -145,11 +157,15 @@ namespace vcpkg::Environment } // VS2015 - const fs::path vs2015_dumpbin_exe = get_VS2015_installation_instance() / "VC" / "bin" / "dumpbin.exe"; - paths_examined.push_back(vs2015_dumpbin_exe); - if (fs::exists(vs2015_dumpbin_exe)) + const optional& vs_2015_installation_instance = get_VS2015_installation_instance(); + if (vs_2015_installation_instance) { - return vs2015_dumpbin_exe; + const fs::path vs2015_dumpbin_exe = *vs_2015_installation_instance / "VC" / "bin" / "dumpbin.exe"; + paths_examined.push_back(vs2015_dumpbin_exe); + if (fs::exists(vs2015_dumpbin_exe)) + { + return vs2015_dumpbin_exe; + } } System::println(System::color::error, "Could not detect dumpbin.exe."); @@ -179,23 +195,28 @@ namespace vcpkg::Environment paths_examined.push_back(vcvarsall_bat); if (fs::exists(vcvarsall_bat)) { - return { vcvarsall_bat , L"v141"}; + return { vcvarsall_bat , L"v141" }; } } // VS2015 - const fs::path vs2015_vcvarsall_bat = get_VS2015_installation_instance() / "VC" / "vcvarsall.bat"; - paths_examined.push_back(vs2015_vcvarsall_bat); - if (fs::exists(vs2015_vcvarsall_bat)) + const optional& vs_2015_installation_instance = get_VS2015_installation_instance(); + if (vs_2015_installation_instance) { - return { vs2015_vcvarsall_bat, L"v140" }; + const fs::path vs2015_vcvarsall_bat = *vs_2015_installation_instance / "VC" / "vcvarsall.bat"; + + paths_examined.push_back(vs2015_vcvarsall_bat); + if (fs::exists(vs2015_vcvarsall_bat)) + { + return { vs2015_vcvarsall_bat, L"v140" }; + } } System::println(System::color::error, "Could not detect vcvarsall.bat."); System::println("The following paths were examined:"); for (const fs::path& path : paths_examined) { - System::println(" %s",path.generic_string()); + System::println(" %s", path.generic_string()); } exit(EXIT_FAILURE); } diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index e7349df6923..3b056a675be 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -73,17 +73,20 @@ namespace vcpkg::System std::cout << "\n"; } - std::wstring get_environmental_variable(const wchar_t* varname) noexcept + optional get_environmental_variable(const wchar_t* varname) noexcept { std::wstring ret; wchar_t* buffer; _wdupenv_s(&buffer, nullptr, varname); - if (buffer != nullptr) + + if (buffer == nullptr) { - ret = buffer; - free(buffer); + return nullptr; } - return ret; + + ret = buffer; + free(buffer); + return std::make_unique(ret); } void set_environmental_variable(const wchar_t* varname, const wchar_t* varvalue) noexcept From a7c5063d4d08c44c100eb62726ef31a95c1e5121 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 16:23:02 -0800 Subject: [PATCH 059/137] Add functions to find the Program Files folders on the C++ side. Resolves #606 --- toolsrc/include/vcpkg_Environment.h | 4 +++ toolsrc/src/commands_edit.cpp | 3 +- toolsrc/src/commands_integrate.cpp | 8 ++--- toolsrc/src/vcpkg_Environment.cpp | 49 ++++++++++++++++++++++++----- 4 files changed, 52 insertions(+), 12 deletions(-) diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index e4dd47472c0..c27ce54c215 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -24,4 +24,8 @@ namespace vcpkg::Environment }; const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths); + + const fs::path& get_ProgramFiles_32_bit(); + + const fs::path& get_ProgramFiles_Platform_bitness(); } diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index 1487c759daa..50308cec916 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -2,6 +2,7 @@ #include "vcpkg_Commands.h" #include "vcpkg_System.h" #include "vcpkg_Input.h" +#include "vcpkg_Environment.h" namespace vcpkg::Commands::Edit { @@ -24,7 +25,7 @@ namespace vcpkg::Commands::Edit } else { - static const std::wstring CODE_EXE_PATH = LR"(C:\Program Files (x86)\Microsoft VS Code\Code.exe)"; + static const fs::path CODE_EXE_PATH = Environment::get_ProgramFiles_32_bit() / "Microsoft VS Code/Code.exe"; if (fs::exists(CODE_EXE_PATH)) { env_EDITOR = CODE_EXE_PATH; diff --git a/toolsrc/src/commands_integrate.cpp b/toolsrc/src/commands_integrate.cpp index ed3ab2c7e73..aa5edeb8a89 100644 --- a/toolsrc/src/commands_integrate.cpp +++ b/toolsrc/src/commands_integrate.cpp @@ -8,10 +8,10 @@ namespace vcpkg::Commands::Integrate { static const std::array old_system_target_files = { - "C:/Program Files (x86)/MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.nuget.targets", - "C:/Program Files (x86)/MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.system.targets" + Environment::get_ProgramFiles_32_bit() / "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.nuget.targets", + Environment::get_ProgramFiles_32_bit() / "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.system.targets" }; - static const fs::path system_wide_targets_file = "C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/V140/ImportBefore/Default/vcpkg.system.props"; + static const fs::path system_wide_targets_file = Environment::get_ProgramFiles_32_bit() / "MSBuild/Microsoft.Cpp/v4.0/V140/ImportBefore/Default/vcpkg.system.props"; static std::string create_appdata_targets_shortcut(const std::string& target_path) noexcept { @@ -109,7 +109,7 @@ namespace vcpkg::Commands::Integrate static elevation_prompt_user_choice elevated_cmd_execute(const std::string& param) { - SHELLEXECUTEINFO shExInfo = {0}; + SHELLEXECUTEINFO shExInfo = { 0 }; shExInfo.cbSize = sizeof(shExInfo); shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS; shExInfo.hwnd = nullptr; diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 366c198c2fe..3528623b435 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -8,11 +8,6 @@ namespace vcpkg::Environment { - static const fs::path default_cmake_installation_dir = "C:/Program Files/CMake/bin"; - static const fs::path default_cmake_installation_dir_x86 = "C:/Program Files (x86)/CMake/bin"; - static const fs::path default_git_installation_dir = "C:/Program Files/git/cmd"; - static const fs::path default_git_installation_dir_x86 = "C:/Program Files (x86)/git/cmd"; - static void ensure_on_path(const std::array& version, const std::wstring& version_check_cmd, const std::wstring& install_cmd) { System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(version_check_cmd); @@ -54,12 +49,15 @@ namespace vcpkg::Environment void ensure_git_on_path(const vcpkg_paths& paths) { + static const fs::path default_git_installation_dir = Environment::get_ProgramFiles_Platform_bitness() / "git/cmd"; + static const fs::path default_git_installation_dir_32 = Environment::get_ProgramFiles_32_bit() / "git/cmd"; + const fs::path downloaded_git = paths.downloads / "PortableGit" / "cmd"; const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", downloaded_git.native(), *System::get_environmental_variable(L"PATH"), default_git_installation_dir.native(), - default_git_installation_dir_x86.native()); + default_git_installation_dir_32.native()); System::set_environmental_variable(L"PATH", path_buf.c_str()); static constexpr std::array git_version = { 2,0,0 }; @@ -70,12 +68,15 @@ namespace vcpkg::Environment void ensure_cmake_on_path(const vcpkg_paths& paths) { + static const fs::path default_cmake_installation_dir = Environment::get_ProgramFiles_Platform_bitness() / "CMake/bin"; + static const fs::path default_cmake_installation_dir_32 = Environment::get_ProgramFiles_32_bit() / "CMake/bin"; + const fs::path downloaded_cmake = paths.downloads / "cmake-3.7.2-win32-x86" / "bin"; const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", downloaded_cmake.native(), *System::get_environmental_variable(L"PATH"), default_cmake_installation_dir.native(), - default_cmake_installation_dir_x86.native()); + default_cmake_installation_dir_32.native()); System::set_environmental_variable(L"PATH", path_buf.c_str()); static constexpr std::array cmake_version = { 3,7,2 }; @@ -226,4 +227,38 @@ namespace vcpkg::Environment static const vcvarsall_and_platform_toolset vcvarsall_bat = find_vcvarsall_bat(paths); return vcvarsall_bat; } + + static fs::path find_ProgramFiles_32_bit() + { + const optional program_files_X86 = System::get_environmental_variable(L"ProgramFiles(x86)"); + if (program_files_X86) + { + return *program_files_X86; + } + + return *System::get_environmental_variable(L"PROGRAMFILES"); + } + + const fs::path& get_ProgramFiles_32_bit() + { + static const fs::path p = find_ProgramFiles_32_bit(); + return p; + } + + static fs::path find_ProgramFiles_Platform_bitness() + { + const optional program_files_W6432 = System::get_environmental_variable(L"ProgramW6432"); + if (program_files_W6432) + { + return *program_files_W6432; + } + + return *System::get_environmental_variable(L"PROGRAMFILES"); + } + + const fs::path& get_ProgramFiles_Platform_bitness() + { + static const fs::path p = find_ProgramFiles_Platform_bitness(); + return p; + } } From 444f28dd24f4bffa3e0ee450e8fbbe30340086b4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 16:53:29 -0800 Subject: [PATCH 060/137] Add functions to find Program Files folders on the powershell side --- scripts/findAnyMSBuildWithCppPlatformToolset.ps1 | 4 +++- scripts/findTargetPlatformVersion.ps1 | 4 +++- scripts/getProgramFiles32bit.ps1 | 11 +++++++++++ scripts/getProgramFilesPlatformBitness.ps1 | 11 +++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 scripts/getProgramFiles32bit.ps1 create mode 100644 scripts/getProgramFilesPlatformBitness.ps1 diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 index 1be4a4e6d2a..d160aea1251 100644 --- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -18,7 +18,9 @@ foreach ($instance in $VisualStudio2017InstallationInstances) } # VS2015 -$CandidateProgramFiles = "${env:PROGRAMFILES(X86)}", "${env:PROGRAMFILES}" +$programFiles32 = & $scriptsDir\getProgramFiles32bit.ps1 +$programFilesP = & $scriptsDir\getProgramFilesPlatformBitness.ps1 +$CandidateProgramFiles = $programFiles32, $programFilesP foreach ($ProgramFiles in $CandidateProgramFiles) { $clExe= "$ProgramFiles\Microsoft Visual Studio 14.0\\VC\bin\cl.exe" diff --git a/scripts/findTargetPlatformVersion.ps1 b/scripts/findTargetPlatformVersion.ps1 index d3dba73f13b..650e0b4edc7 100644 --- a/scripts/findTargetPlatformVersion.ps1 +++ b/scripts/findTargetPlatformVersion.ps1 @@ -4,7 +4,9 @@ param( ) $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition -$CandidateProgramFiles = "${env:PROGRAMFILES(X86)}", "${env:PROGRAMFILES}" +$programFiles32 = & $scriptsDir\getProgramFiles32bit.ps1 +$programFilesP = & $scriptsDir\getProgramFilesPlatformBitness.ps1 +$CandidateProgramFiles = $programFiles32, $programFilesP # Windows 10 SDK foreach ($ProgramFiles in $CandidateProgramFiles) diff --git a/scripts/getProgramFiles32bit.ps1 b/scripts/getProgramFiles32bit.ps1 new file mode 100644 index 00000000000..fd71671914e --- /dev/null +++ b/scripts/getProgramFiles32bit.ps1 @@ -0,0 +1,11 @@ +[CmdletBinding()] +param( + +) + +if (Test-Path env:PROGRAMFILES`(X86`)) +{ + return ${env:PROGRAMFILES(X86)} +} + +return ${env:PROGRAMFILES} \ No newline at end of file diff --git a/scripts/getProgramFilesPlatformBitness.ps1 b/scripts/getProgramFilesPlatformBitness.ps1 new file mode 100644 index 00000000000..6d0a513ca2c --- /dev/null +++ b/scripts/getProgramFilesPlatformBitness.ps1 @@ -0,0 +1,11 @@ +[CmdletBinding()] +param( + +) + +if (Test-Path env:ProgramW6432) +{ + return ${env:ProgramW6432} +} + +return ${env:PROGRAMFILES} \ No newline at end of file From a9a63192dd77837fd3cf9fb4d04469a54f793317 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 16:57:34 -0800 Subject: [PATCH 061/137] Function rename --- toolsrc/include/vcpkg_Environment.h | 2 +- toolsrc/src/vcpkg_Environment.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h index c27ce54c215..c2d2ed7ae69 100644 --- a/toolsrc/include/vcpkg_Environment.h +++ b/toolsrc/include/vcpkg_Environment.h @@ -27,5 +27,5 @@ namespace vcpkg::Environment const fs::path& get_ProgramFiles_32_bit(); - const fs::path& get_ProgramFiles_Platform_bitness(); + const fs::path& get_ProgramFiles_platform_bitness(); } diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 3528623b435..c9fadc8ac2e 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -49,7 +49,7 @@ namespace vcpkg::Environment void ensure_git_on_path(const vcpkg_paths& paths) { - static const fs::path default_git_installation_dir = Environment::get_ProgramFiles_Platform_bitness() / "git/cmd"; + static const fs::path default_git_installation_dir = Environment::get_ProgramFiles_platform_bitness() / "git/cmd"; static const fs::path default_git_installation_dir_32 = Environment::get_ProgramFiles_32_bit() / "git/cmd"; const fs::path downloaded_git = paths.downloads / "PortableGit" / "cmd"; @@ -68,7 +68,7 @@ namespace vcpkg::Environment void ensure_cmake_on_path(const vcpkg_paths& paths) { - static const fs::path default_cmake_installation_dir = Environment::get_ProgramFiles_Platform_bitness() / "CMake/bin"; + static const fs::path default_cmake_installation_dir = Environment::get_ProgramFiles_platform_bitness() / "CMake/bin"; static const fs::path default_cmake_installation_dir_32 = Environment::get_ProgramFiles_32_bit() / "CMake/bin"; const fs::path downloaded_cmake = paths.downloads / "cmake-3.7.2-win32-x86" / "bin"; @@ -245,7 +245,7 @@ namespace vcpkg::Environment return p; } - static fs::path find_ProgramFiles_Platform_bitness() + static fs::path find_ProgramFiles_platform_bitness() { const optional program_files_W6432 = System::get_environmental_variable(L"ProgramW6432"); if (program_files_W6432) @@ -256,9 +256,9 @@ namespace vcpkg::Environment return *System::get_environmental_variable(L"PROGRAMFILES"); } - const fs::path& get_ProgramFiles_Platform_bitness() + const fs::path& get_ProgramFiles_platform_bitness() { - static const fs::path p = find_ProgramFiles_Platform_bitness(); + static const fs::path p = find_ProgramFiles_platform_bitness(); return p; } } From da26d097165b5d06b77e7dcb13bf1b8a8c9c079e Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 17:29:47 -0800 Subject: [PATCH 062/137] Add functions to find Program Files folders on the CMake side --- ports/msmpi/portfile.cmake | 9 ++------- scripts/cmake/vcpkg_common_functions.cmake | 2 ++ scripts/cmake/vcpkg_find_acquire_program.cmake | 5 ++++- scripts/cmake/vcpkg_get_program_files_32_bit.cmake | 7 +++++++ .../cmake/vcpkg_get_program_files_platform_bitness.cmake | 7 +++++++ 5 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 scripts/cmake/vcpkg_get_program_files_32_bit.cmake create mode 100644 scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index 4a142f20b04..faf01239639 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -10,13 +10,8 @@ vcpkg_download_distfile(SDK_ARCHIVE ### Check for correct version of installed redistributable package # We always want the ProgramFiles folder even on a 64-bit machine (not the ProgramFilesx86 folder) -# The following makes sure both 32-bit and 64-bit processes get the correct ProgramFiles -if(DEFINED ENV{ProgramW6432}) - set(PROGRAM_FILES_FOLDER $ENV{ProgramW6432}) -else() - set(PROGRAM_FILES_FOLDER $ENV{PROGRAMFILES}) -endif() -set(SYSTEM_MPIEXEC_FILEPATH "${PROGRAM_FILES_FOLDER}/Microsoft MPI/Bin/mpiexec.exe") +vcpkg_get_program_files_platform_bitness(PROGRAM_FILES_PLATFORM_BITNESS) +set(SYSTEM_MPIEXEC_FILEPATH "${PROGRAM_FILES_PLATFORM_BITNESS}/Microsoft MPI/Bin/mpiexec.exe") set(MSMPI_EXPECTED_FULL_VERSION "8.0.12438.0") if(EXISTS ${SYSTEM_MPIEXEC_FILEPATH}) diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index fb626efe8ae..50c4ed2dcb1 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -14,3 +14,5 @@ include(vcpkg_configure_qmake) include(vcpkg_apply_patches) include(vcpkg_copy_pdbs) include(vcpkg_copy_tool_dependencies) +include(vcpkg_get_program_files_32_bit) +include(vcpkg_get_program_files_platform_bitness) diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index b9a397fcc87..44e347e0483 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -7,6 +7,9 @@ function(vcpkg_find_acquire_program VAR) unset(SUBDIR) unset(REQUIRED_INTERPRETER) + vcpkg_get_program_files_platform_bitness(PROGRAM_FILES_PLATFORM_BITNESS) + vcpkg_get_program_files_32_bit(PROGRAM_FILES_32_BIT) + if(VAR MATCHES "PERL") set(PROGNAME perl) set(PATHS ${DOWNLOADS}/tools/perl/perl/bin) @@ -61,7 +64,7 @@ function(vcpkg_find_acquire_program VAR) set(HASH 23a26dc7e29979bec5dcd3bfcabf76397b93ace64f5d46f2254d6420158bac5eff1c1a8454e3427e7a2fe2c233c5f2cffc87b376772399e12e40b51be2c065f4) elseif(VAR MATCHES "7Z") set(PROGNAME 7z) - set(PATHS "C:/Program Files/7-Zip" ${DOWNLOADS}/tools/7z/Files/7-Zip) + set(PATHS "${PROGRAM_FILES_PLATFORM_BITNESS}/7-Zip" "${PROGRAM_FILES_32_BIT}/7-Zip" ${DOWNLOADS}/tools/7z/Files/7-Zip) set(URL "http://7-zip.org/a/7z1604.msi") set(ARCHIVE "7z1604.msi") set(HASH 556f95f7566fe23704d136239e4cf5e2a26f939ab43b44145c91b70d031a088d553e5c21301f1242a2295dcde3143b356211f0108c68e65eef8572407618326d) diff --git a/scripts/cmake/vcpkg_get_program_files_32_bit.cmake b/scripts/cmake/vcpkg_get_program_files_32_bit.cmake new file mode 100644 index 00000000000..386e59c7599 --- /dev/null +++ b/scripts/cmake/vcpkg_get_program_files_32_bit.cmake @@ -0,0 +1,7 @@ +function(vcpkg_get_program_files_32_bit ret) + if(DEFINED ENV{ProgramFiles\(X86\)}) + set(${ret} $ENV{ProgramFiles\(X86\)} PARENT_SCOPE) + else() + set(${ret} $ENV{PROGRAMFILES} PARENT_SCOPE) + endif() +endfunction() \ No newline at end of file diff --git a/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake b/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake new file mode 100644 index 00000000000..44fba4d6280 --- /dev/null +++ b/scripts/cmake/vcpkg_get_program_files_platform_bitness.cmake @@ -0,0 +1,7 @@ +function(vcpkg_get_program_files_platform_bitness ret) + if(DEFINED ENV{ProgramW6432}) + set(${ret} $ENV{ProgramW6432} PARENT_SCOPE) + else() + set(${ret} $ENV{PROGRAMFILES} PARENT_SCOPE) + endif() +endfunction() \ No newline at end of file From ff3b3ecb55e95038ddf22b60650795862bc3e7ba Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 18:28:41 -0800 Subject: [PATCH 063/137] Improve impl of get_environmental_variable() --- toolsrc/src/vcpkg_System.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index 3b056a675be..e1a4c9d5162 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -75,7 +75,6 @@ namespace vcpkg::System optional get_environmental_variable(const wchar_t* varname) noexcept { - std::wstring ret; wchar_t* buffer; _wdupenv_s(&buffer, nullptr, varname); @@ -83,10 +82,8 @@ namespace vcpkg::System { return nullptr; } - - ret = buffer; - free(buffer); - return std::make_unique(ret); + std::unique_ptr bufptr(buffer, free); + return std::make_unique(buffer); } void set_environmental_variable(const wchar_t* varname, const wchar_t* varvalue) noexcept From 3e0e9e3449d0da506fe70d58cee7715c64708b2b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 18:34:59 -0800 Subject: [PATCH 064/137] [antlr4] Fix downloading of LICENSE file --- ports/antlr4/portfile.cmake | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ports/antlr4/portfile.cmake b/ports/antlr4/portfile.cmake index 8b11c95b07d..41bb5559e1a 100644 --- a/ports/antlr4/portfile.cmake +++ b/ports/antlr4/portfile.cmake @@ -6,6 +6,14 @@ vcpkg_download_distfile(ARCHIVE FILENAME "antlr4-cpp-runtime-4.6-source.zip" SHA512 e123c2227e41ce80da5a3758725a018690ed70a4e10c23da26c966259e6bdafa192f4363f5a7e1181ef9a47bf3cc50d6b0ca7b26c8dd2b19222a7edf54de8de2 ) + +# license not exist in antlr folder. +vcpkg_download_distfile(LICENSE + URLS https://raw.githubusercontent.com/antlr/antlr4/4.6/LICENSE.txt + FILENAME "antlr4-copyright" + SHA512 c72ae3d5c9f3f07160405b5ca44f01116a9602d82291d6cd218fcc5ec6e8baf985e4baa2acf3d621079585385708bd171c96ef44dd808e60c40a48bc1f56c9ae +) + vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_apply_patches( @@ -62,13 +70,6 @@ else() DESTINATION ${CURRENT_PACKAGES_DIR}/bin) endif() - -# license not exist in antlr folder. -vcpkg_download_distfile(LICENSE - URLS https://raw.githubusercontent.com/antlr/antlr4/master/LICENSE.txt - FILENAME "antlr4-copyright" - SHA512 c72ae3d5c9f3f07160405b5ca44f01116a9602d82291d6cd218fcc5ec6e8baf985e4baa2acf3d621079585385708bd171c96ef44dd808e60c40a48bc1f56c9ae -) file(INSTALL ${LICENSE} DESTINATION ${CURRENT_PACKAGES_DIR}/share/antlr4 RENAME copyright) message(STATUS "Installing done") \ No newline at end of file From 9dac4b073ae58e3af0a22f53275f6f36f66f2865 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 18:35:40 -0800 Subject: [PATCH 065/137] [antlr4] Make identation consistent --- ports/antlr4/portfile.cmake | 78 ++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/ports/antlr4/portfile.cmake b/ports/antlr4/portfile.cmake index 41bb5559e1a..d10513064af 100644 --- a/ports/antlr4/portfile.cmake +++ b/ports/antlr4/portfile.cmake @@ -9,65 +9,65 @@ vcpkg_download_distfile(ARCHIVE # license not exist in antlr folder. vcpkg_download_distfile(LICENSE - URLS https://raw.githubusercontent.com/antlr/antlr4/4.6/LICENSE.txt - FILENAME "antlr4-copyright" - SHA512 c72ae3d5c9f3f07160405b5ca44f01116a9602d82291d6cd218fcc5ec6e8baf985e4baa2acf3d621079585385708bd171c96ef44dd808e60c40a48bc1f56c9ae + URLS https://raw.githubusercontent.com/antlr/antlr4/4.6/LICENSE.txt + FILENAME "antlr4-copyright" + SHA512 c72ae3d5c9f3f07160405b5ca44f01116a9602d82291d6cd218fcc5ec6e8baf985e4baa2acf3d621079585385708bd171c96ef44dd808e60c40a48bc1f56c9ae ) vcpkg_extract_source_archive(${ARCHIVE}) -vcpkg_apply_patches( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src - PATCHES ${CMAKE_CURRENT_LIST_DIR}/crt_mt.patch +vcpkg_apply_patches( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src + PATCHES ${CMAKE_CURRENT_LIST_DIR}/crt_mt.patch ) if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static) - set(DEBUG_CONFIG "Debug Static") - set(RELEASE_CONFIG "Release Static") + set(DEBUG_CONFIG "Debug Static") + set(RELEASE_CONFIG "Release Static") else() - set(DEBUG_CONFIG "Debug DLL") - set(RELEASE_CONFIG "Release DLL") + set(DEBUG_CONFIG "Debug DLL") + set(RELEASE_CONFIG "Release DLL") endif() -vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/antlr4cpp-vs2015.vcxproj - DEBUG_CONFIGURATION ${DEBUG_CONFIG} - RELEASE_CONFIGURATION ${RELEASE_CONFIG} +vcpkg_build_msbuild( + PROJECT_PATH ${SOURCE_PATH}/antlr4cpp-vs2015.vcxproj + DEBUG_CONFIGURATION ${DEBUG_CONFIG} + RELEASE_CONFIGURATION ${RELEASE_CONFIG} ) -file (MAKE_DIRECTORY - ${CURRENT_PACKAGES_DIR}/include) -FILE(COPY ${SOURCE_PATH}/src/ - DESTINATION ${CURRENT_PACKAGES_DIR}/include +file (MAKE_DIRECTORY + ${CURRENT_PACKAGES_DIR}/include) +FILE(COPY ${SOURCE_PATH}/src/ + DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN "*.h") -file (MAKE_DIRECTORY - ${CURRENT_PACKAGES_DIR}/lib - ${CURRENT_PACKAGES_DIR}/debug/lib) +file (MAKE_DIRECTORY + ${CURRENT_PACKAGES_DIR}/lib + ${CURRENT_PACKAGES_DIR}/debug/lib) file(COPY ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) file(COPY ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.lib - DESTINATION ${CURRENT_PACKAGES_DIR}/lib) + DESTINATION ${CURRENT_PACKAGES_DIR}/lib) if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static) - vcpkg_apply_patches( - SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include - PATCHES ${CMAKE_CURRENT_LIST_DIR}/static.patch - ) + vcpkg_apply_patches( + SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include + PATCHES ${CMAKE_CURRENT_LIST_DIR}/static.patch + ) else() - file (MAKE_DIRECTORY - ${CURRENT_PACKAGES_DIR}/bin - ${CURRENT_PACKAGES_DIR}/debug/bin) - - file(COPY - ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.dll - ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.pdb - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) - file(COPY - ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.dll - ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.pdb - DESTINATION ${CURRENT_PACKAGES_DIR}/bin) + file (MAKE_DIRECTORY + ${CURRENT_PACKAGES_DIR}/bin + ${CURRENT_PACKAGES_DIR}/debug/bin) + + file(COPY + ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.dll + ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG}/antlr4-runtime.pdb + DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) + file(COPY + ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.dll + ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.pdb + DESTINATION ${CURRENT_PACKAGES_DIR}/bin) endif() file(INSTALL ${LICENSE} DESTINATION ${CURRENT_PACKAGES_DIR}/share/antlr4 RENAME copyright) From 4d29741fcbf8627579f0dde0f0f42bc87d9cb893 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 19:09:09 -0800 Subject: [PATCH 066/137] Flush std::cout before launching external process --- toolsrc/src/vcpkg_System.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index e1a4c9d5162..0be026b79ed 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -14,6 +14,9 @@ namespace vcpkg::System int cmd_execute(const wchar_t* cmd_line) { + // Flush cout before launching external process + std::cout << std::flush; + // Basically we are wrapping it in quotes const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s")###", cmd_line); int exit_code = _wsystem(actual_cmd_line.c_str()); @@ -22,6 +25,9 @@ namespace vcpkg::System exit_code_and_output cmd_execute_and_capture_output(const wchar_t* cmd_line) { + // Flush cout before launching external process + std::cout << std::flush; + const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s")###", cmd_line); std::string output; From edec017ecec2e2a8ad57a0b5ee660b59a9479aac Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 19:20:13 -0800 Subject: [PATCH 067/137] Fix download of nasm. Resolves libjpeg-turbo build error --- scripts/cmake/vcpkg_find_acquire_program.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 44e347e0483..7e4f1ba9c1c 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -18,10 +18,10 @@ function(vcpkg_find_acquire_program VAR) set(HASH a6e685ea24376f50db5f06c5b46075f1d3be25168fa1f27fa9b02e2ac017826cee62a2b43562f9b6c989337a231ba914416c110075457764de2d11f99d5e0f26) elseif(VAR MATCHES "NASM") set(PROGNAME nasm) - set(PATHS ${DOWNLOADS}/tools/nasm/nasm-2.11.08) - set(URL "http://www.nasm.us/pub/nasm/releasebuilds/2.11.08/win32/nasm-2.11.08-win32.zip") - set(ARCHIVE "nasm-2.11.08-win32.zip") - set(HASH cd80b540530d3995d15dc636e97673f1d34f471baadf1dac993165232c61efefe7f8ec10625f8f718fc89f0dd3dcb6a4595e0cf40c5fd7cbac1b71672b644d2d) + set(PATHS ${DOWNLOADS}/tools/nasm/nasm-2.12.02) + set(URL "http://www.nasm.us/pub/nasm/releasebuilds/2.12.02/win32/nasm-2.12.02-win32.zip") + set(ARCHIVE "nasm-2.12.02-win32.zip") + set(HASH df7aaba094e17832688c88993997612a2e2c96cc3dc14ca3e8347b44c7762115f5a7fc6d7f20be402553aaa4c9e43ddfcf6228f581cfe89289bae550de151b36) elseif(VAR MATCHES "YASM") set(PROGNAME yasm) set(PATHS ${DOWNLOADS}/tools/yasm) From 0541bc2807af3f704c3eaf3c9c1caf8dbebeb170 Mon Sep 17 00:00:00 2001 From: Olaf van der Spek Date: Wed, 15 Feb 2017 12:14:01 +0100 Subject: [PATCH 068/137] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1026e21294b..ee0d65eda43 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Install any packages with ``` C:\src\vcpkg> .\vcpkg install sdl2 curl ``` -Finally, create a New Project (or open an existing one) in Visual Studio 2015 or Visual Studio "15" Preview. You can now `#include` and use any of the installed libraries. +Finally, create a New Project (or open an existing one) in Visual Studio 2015 or Visual Studio 2017. You can now `#include` and use any of the installed libraries. ## Examples See the [`docs\EXAMPLES.md`](docs/EXAMPLES.md) document for specific walkthroughs, including using a package and adding a new package. From cad7e2a30c3a3e8627a71cf09dca22e60ee11244 Mon Sep 17 00:00:00 2001 From: flysha Date: Wed, 15 Feb 2017 20:14:37 +0800 Subject: [PATCH 069/137] [sqlite3] upgrade to 3.17.0 --- ports/sqlite3/CONTROL | 4 +-- ports/sqlite3/portfile.cmake | 54 ++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/ports/sqlite3/CONTROL b/ports/sqlite3/CONTROL index e382a6f85b9..bc5b4af98c1 100644 --- a/ports/sqlite3/CONTROL +++ b/ports/sqlite3/CONTROL @@ -1,3 +1,3 @@ -Source: sqlite3 -Version: 3.15.0 +Source: sqlite3 +Version: 3.17.0 Description: SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. \ No newline at end of file diff --git a/ports/sqlite3/portfile.cmake b/ports/sqlite3/portfile.cmake index 8302e9d3e78..fdf4ec1591e 100644 --- a/ports/sqlite3/portfile.cmake +++ b/ports/sqlite3/portfile.cmake @@ -1,27 +1,27 @@ -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/sqlite-amalgamation-3150000) -vcpkg_download_distfile(ARCHIVE - URLS "https://sqlite.org/2016/sqlite-amalgamation-3150000.zip" - FILENAME "sqlite-amalgamation-3150000.zip" - SHA512 82fea23b2158c448cbe2b80121eb32652df49eb85357edbaeef0c343ef478433706ebc4cd8add1985763db223d9268d0f7e74fc8db59353c15267cbc3d2078a8 -) -vcpkg_extract_source_archive(${ARCHIVE}) - -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) - -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS - -DSOURCE=${SOURCE_PATH} -) -vcpkg_build_cmake() -vcpkg_install_cmake() - -file(READ ${CURRENT_PACKAGES_DIR}/debug/share/sqlite3/sqlite3Config-debug.cmake SQLITE3_DEBUG_CONFIG) -string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" SQLITE3_DEBUG_CONFIG "${SQLITE3_DEBUG_CONFIG}") -file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/sqlite3Config-debug.cmake "${SQLITE3_DEBUG_CONFIG}") - -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) - -file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/copyright "SQLite is in the Public Domain.\nhttp://www.sqlite.org/copyright.html\n") -vcpkg_copy_pdbs() +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/sqlite-amalgamation-3170000) +vcpkg_download_distfile(ARCHIVE + URLS "https://sqlite.org/2017/sqlite-amalgamation-3170000.zip" + FILENAME "sqlite-amalgamation-3170000.zip" + SHA512 36dc05dbb21428237332e813181d4dd0c2ffaedb92a53934630c25421617afd9c1a65784665d222501f1b4b5c6445f425f8c512572a97e42603510dcc0796344 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DSOURCE=${SOURCE_PATH} +) +vcpkg_build_cmake() +vcpkg_install_cmake() + +file(READ ${CURRENT_PACKAGES_DIR}/debug/share/sqlite3/sqlite3Config-debug.cmake SQLITE3_DEBUG_CONFIG) +string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" SQLITE3_DEBUG_CONFIG "${SQLITE3_DEBUG_CONFIG}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/sqlite3Config-debug.cmake "${SQLITE3_DEBUG_CONFIG}") + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/copyright "SQLite is in the Public Domain.\nhttp://www.sqlite.org/copyright.html\n") +vcpkg_copy_pdbs() From 500fe7957a04e4e9a5dc320580f9e2151f050a65 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 16:12:29 -0800 Subject: [PATCH 070/137] [glbinding] Delete exes that appear in the presence of glfw3. Resolves #537 --- ports/glbinding/portfile.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ports/glbinding/portfile.cmake b/ports/glbinding/portfile.cmake index 165c8d889ea..6f6dfcc6869 100644 --- a/ports/glbinding/portfile.cmake +++ b/ports/glbinding/portfile.cmake @@ -53,6 +53,19 @@ file(REMOVE ${CURRENT_PACKAGES_DIR}/AUTHORS ${CURRENT_PACKAGES_DIR}/debug/VERSION ) +# There are some executables that are only built if glfw is found by CMake (see source/tools/*/CMakeLists.txt). +# glfw is not listed as a dependency for glbinding, so this only happen on systems where package glfw3 is present. +# glbinding's CMake doesn't offer the choice to exlude those tools from the build process, so deleting them here: +file(REMOVE ${CURRENT_PACKAGES_DIR}/glcontexts.exe + ${CURRENT_PACKAGES_DIR}/glfunctions.exe + ${CURRENT_PACKAGES_DIR}/glmeta.exe + ${CURRENT_PACKAGES_DIR}/glqueries.exe + ${CURRENT_PACKAGES_DIR}/debug/glcontextsd.exe + ${CURRENT_PACKAGES_DIR}/debug/glfunctionsd.exe + ${CURRENT_PACKAGES_DIR}/debug/glmetad.exe + ${CURRENT_PACKAGES_DIR}/debug/glqueriesd.exe +) + # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/glbinding) file(RENAME ${CURRENT_PACKAGES_DIR}/share/glbinding/LICENSE ${CURRENT_PACKAGES_DIR}/share/glbinding/copyright) From 03b65486536fc36889a9225fb8dc9de10f823ac6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 16:35:51 -0800 Subject: [PATCH 071/137] Use MinGit instead of PortableGit. Resolves #662 --- scripts/fetchDependency.ps1 | 27 ++++++++++++++++----------- toolsrc/src/vcpkg_Environment.cpp | 9 ++++++--- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 8d31b0edbdc..1faf5b165df 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -113,8 +113,11 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) function Expand-ZIPFile($file, $destination) { - Write-Host($file) - Write-Host($destination) + if (!(Test-Path $destination)) + { + New-Item -ItemType Directory -Path $destination | Out-Null + } + $shell = new-object -com shell.application $zip = $shell.NameSpace($file) foreach($item in $zip.items()) @@ -133,6 +136,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $expectedDownloadedFileHash = "ec5e299d412e0272e01d4de5bf07718f42c96361f83d51cc39f91bf49cc3e5c3" $executableFromDownload = "$downloadsDir\cmake-3.7.2-win32-x86\bin\cmake.exe" $extractionType = $ExtractionType_ZIP + $extractionFolder = $downloadsDir } elseif($Dependency -eq "nuget") { @@ -147,14 +151,15 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) elseif($Dependency -eq "git") { $requiredVersion = "2.0.0" - $downloadVersion = "2.11.0" - $url = "https://github.com/git-for-windows/git/releases/download/v2.11.0.windows.3/PortableGit-2.11.0.3-32-bit.7z.exe" # We choose the 32-bit version - $downloadPath = "$downloadsDir\PortableGit-2.11.0.3-32-bit.7z.exe" - $expectedDownloadedFileHash = "8bf3769c37945e991903dd1b988c6b1d97bbf0f3afc9851508974f38bf94dc01" - # There is another copy of git.exe in PortableGit\bin. However, an installed version of git add the cmd dir to the PATH. + $downloadVersion = "2.11.1" + $url = "https://github.com/git-for-windows/git/releases/download/v2.11.1.windows.1/MinGit-2.11.1-32-bit.zip" # We choose the 32-bit version + $downloadPath = "$downloadsDir\MinGit-2.11.1-32-bit.zip" + $expectedDownloadedFileHash = "6ca79af09015625f350ef4ad74a75cfb001b340aec095b6963be9d45becb3bba" + # There is another copy of git.exe in MinGit\bin. However, an installed version of git add the cmd dir to the PATH. # Therefore, choosing the cmd dir here as well. - $executableFromDownload = "$downloadsDir\PortableGit\cmd\git.exe" - $extractionType = $ExtractionType_SELF_EXTRACTING_7Z + $executableFromDownload = "$downloadsDir\MinGit-2.11.1-32-bit\cmd\git.exe" + $extractionType = $ExtractionType_ZIP + $extractionFolder = "$downloadsDir\MinGit-2.11.1-32-bit" } else { @@ -188,8 +193,8 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { if (-not (Test-Path $executableFromDownload)) # consider renaming the extraction folder to make sure the extraction finished { - # Expand-Archive $downloadPath -dest "$downloadsDir" -Force # Requires powershell 5+ - Expand-ZIPFile -File $downloadPath -Destination $downloadsDir + # Expand-Archive $downloadPath -dest "$extractionFolder" -Force # Requires powershell 5+ + Expand-ZIPFile -File $downloadPath -Destination $extractionFolder } } elseif($extractionType -eq $ExtractionType_SELF_EXTRACTING_7Z) diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index c9fadc8ac2e..cc3dba10027 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -52,12 +52,15 @@ namespace vcpkg::Environment static const fs::path default_git_installation_dir = Environment::get_ProgramFiles_platform_bitness() / "git/cmd"; static const fs::path default_git_installation_dir_32 = Environment::get_ProgramFiles_32_bit() / "git/cmd"; - const fs::path downloaded_git = paths.downloads / "PortableGit" / "cmd"; - const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", - downloaded_git.native(), + const fs::path portable_git = paths.downloads / "PortableGit" / "cmd"; // TODO: Remove next time we bump the version + const fs::path min_git = paths.downloads / "MinGit-2.11.1-32-bit" / "cmd"; + const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s;%s", + min_git.native(), + portable_git.native(), *System::get_environmental_variable(L"PATH"), default_git_installation_dir.native(), default_git_installation_dir_32.native()); + System::set_environmental_variable(L"PATH", path_buf.c_str()); static constexpr std::array git_version = { 2,0,0 }; From db4b7dfa655a01964aac052df5fb00c2311a7845 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 16:53:20 -0800 Subject: [PATCH 072/137] [lmdb] Bump version --- ports/lmdb/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/lmdb/CONTROL b/ports/lmdb/CONTROL index bda09ee7105..13c648fa649 100644 --- a/ports/lmdb/CONTROL +++ b/ports/lmdb/CONTROL @@ -1,3 +1,3 @@ Source: lmdb -Version: 0.9.18-1 +Version: 0.9.18-2 Description: LMDB is an extraordinarily fast, memory-efficient database \ No newline at end of file From 1ecf03e2b08c0ec3be62da4989730108c7c8de23 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 17:45:02 -0800 Subject: [PATCH 073/137] [clockutils] Remove stray LICENSE file Fixes post-build checks --- ports/clockutils/portfile.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/clockutils/portfile.cmake b/ports/clockutils/portfile.cmake index c078673a688..2c75495d9d5 100644 --- a/ports/clockutils/portfile.cmake +++ b/ports/clockutils/portfile.cmake @@ -33,5 +33,6 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/clockUtils) file(RENAME ${CURRENT_PACKAGES_DIR}/share/clockUtils/LICENSE ${CURRENT_PACKAGES_DIR}/share/clockUtils/copyright) file(REMOVE ${CURRENT_PACKAGES_DIR}/LICENSE) +file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/LICENSE) vcpkg_copy_pdbs() \ No newline at end of file From 2b9035063234f04fb68c3b4fefe8d3da7a5175a6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Feb 2017 17:00:46 -0800 Subject: [PATCH 074/137] Separate dependency check from build_package() --- toolsrc/include/vcpkg_Commands.h | 11 ++++- toolsrc/src/commands_build.cpp | 53 +++++++++++++++---------- toolsrc/src/commands_build_external.cpp | 8 +++- toolsrc/src/commands_install.cpp | 4 +- 4 files changed, 50 insertions(+), 26 deletions(-) diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index ef300ac1214..86c77a8bf17 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -2,6 +2,7 @@ #include "vcpkg_cmd_arguments.h" #include "vcpkg_paths.h" +#include "StatusParagraphs.h" namespace vcpkg::Commands { @@ -11,16 +12,22 @@ namespace vcpkg::Commands namespace Build { + enum class DependencyStatus + { + ALL_DEPENDENCIES_INSTALLED, + MISSING_DEPENDENCIES + }; + enum class BuildResult { BUILD_NOT_STARTED = 0, SUCCESS, - CASCADED_DUE_TO_MISSING_DEPENDENCIES, BUILD_FAILED, POST_BUILD_CHECKS_FAILED, }; - BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir); + DependencyStatus check_dependencies(const SourceParagraph& source_paragraph, const package_spec& spec, const StatusParagraphs& status_db); + BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const DependencyStatus& dependency_status); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); } diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index fa2468e1c49..c9292aae9bd 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -24,11 +24,12 @@ namespace vcpkg::Commands::Build std::ofstream(binary_control_file) << bpgh; } - BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir) + BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const DependencyStatus& dependency_status) { Checks::check_exit(spec.name() == source_paragraph.name, "inconsistent arguments to build_package()"); - const triplet& target_triplet = spec.target_triplet(); + Checks::check_exit(dependency_status == DependencyStatus::ALL_DEPENDENCIES_INSTALLED, "Dependencies must be satisfied before attempting to build a package"); + const triplet& target_triplet = spec.target_triplet(); const fs::path ports_cmake_script_path = paths.ports_cmake; const Environment::vcvarsall_and_platform_toolset vcvarsall_bat = Environment::get_vcvarsall_bat(paths); const std::wstring command = Strings::wformat(LR"("%s" %s >nul 2>&1 && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s -DVCPKG_PLATFORM_TOOLSET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")", @@ -76,6 +77,22 @@ namespace vcpkg::Commands::Build return BuildResult::SUCCESS; } + DependencyStatus check_dependencies(const SourceParagraph& source_paragraph, const package_spec& spec, const StatusParagraphs& status_db) + { + Checks::check_exit(spec.name() == source_paragraph.name, "inconsistent arguments to check_dependencies()"); + const triplet& target_triplet = spec.target_triplet(); + + for (auto&& dep : source_paragraph.depends) + { + if (status_db.find_installed(dep.name, target_triplet) == status_db.end()) + { + return DependencyStatus::MISSING_DEPENDENCIES; + } + } + + return DependencyStatus::ALL_DEPENDENCIES_INSTALLED; + } + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { static const std::string example = Commands::Help::create_example_string("build zlib:x64-windows"); @@ -90,7 +107,7 @@ namespace vcpkg::Commands::Build const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example); Input::check_triplet(spec.target_triplet(), paths); - const std::unordered_set options = args.check_and_get_optional_command_arguments({OPTION_CHECKS_ONLY}); + const std::unordered_set options = args.check_and_get_optional_command_arguments({ OPTION_CHECKS_ONLY }); if (options.find(OPTION_CHECKS_ONLY) != options.end()) { const size_t error_count = PostBuildLint::perform_all_checks(spec, paths); @@ -106,24 +123,19 @@ namespace vcpkg::Commands::Build Checks::check_exit(!maybe_spgh.error_code(), "Could not find package named %s: %s", spec, maybe_spgh.error_code().message()); const SourceParagraph& spgh = *maybe_spgh.get(); - const std::vector first_level_deps = filter_dependencies(spgh.depends, spec.target_triplet()); - - std::vector first_level_deps_specs; - for (const std::string& dep : first_level_deps) + Environment::ensure_utilities_on_path(paths); + const DependencyStatus dependency_status = check_dependencies(spgh, spec, status_db); + if (dependency_status == DependencyStatus::MISSING_DEPENDENCIES) { - first_level_deps_specs.push_back(package_spec::from_name_and_triplet(dep, spec.target_triplet()).get_or_throw()); - } + std::vector unmet_dependencies = Dependencies::create_install_plan(paths, { spec }, status_db); + unmet_dependencies.erase( + std::remove_if(unmet_dependencies.begin(), unmet_dependencies.end(), [&spec](const package_spec_with_install_plan& p) + { + return (p.spec == spec) || (p.plan.plan_type == install_plan_type::ALREADY_INSTALLED); + }), + unmet_dependencies.end()); - std::vector unmet_dependencies = Dependencies::create_install_plan(paths, first_level_deps_specs, status_db); - unmet_dependencies.erase( - std::remove_if(unmet_dependencies.begin(), unmet_dependencies.end(), [](const package_spec_with_install_plan& p) - { - return p.plan.plan_type == install_plan_type::ALREADY_INSTALLED; - }), - unmet_dependencies.end()); - - if (!unmet_dependencies.empty()) - { + Checks::check_exit(unmet_dependencies.empty()); System::println(System::color::error, "The build command requires all dependencies to be already installed."); System::println("The following dependencies are missing:"); System::println(""); @@ -135,8 +147,7 @@ namespace vcpkg::Commands::Build exit(EXIT_FAILURE); } - Environment::ensure_utilities_on_path(paths); - const BuildResult result = build_package(spgh, spec, paths, paths.port_dir(spec)); + const BuildResult result = build_package(spgh, spec, paths, paths.port_dir(spec), dependency_status); if (result != BuildResult::SUCCESS) { exit(EXIT_FAILURE); diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/commands_build_external.cpp index 8e9bf50fde9..319e3c3d80d 100644 --- a/toolsrc/src/commands_build_external.cpp +++ b/toolsrc/src/commands_build_external.cpp @@ -12,6 +12,8 @@ namespace vcpkg::Commands::BuildExternal static const std::string example = Commands::Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)"); args.check_exact_arg_count(2, example); + StatusParagraphs status_db = database_load_check(paths); + expected maybe_current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet); if (auto spec = maybe_current_spec.get()) { @@ -21,8 +23,10 @@ namespace vcpkg::Commands::BuildExternal const expected maybe_spgh = try_load_port(port_dir); if (auto spgh = maybe_spgh.get()) { - const Build::BuildResult result = Commands::Build::build_package(*spgh, *spec, paths, port_dir); - if (result !=Build::BuildResult::SUCCESS) + const Build::DependencyStatus dependency_status = Build::check_dependencies(*spgh, *spec, status_db); + Checks::check_exit(dependency_status == Build::DependencyStatus::ALL_DEPENDENCIES_INSTALLED); + const Build::BuildResult result = Commands::Build::build_package(*spgh, *spec, paths, port_dir, dependency_status); + if (result != Build::BuildResult::SUCCESS) { exit(EXIT_FAILURE); } diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp index 48da05e9c9c..a57d2cc6d28 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/commands_install.cpp @@ -214,7 +214,9 @@ namespace vcpkg::Commands::Install } else if (action.plan.plan_type == install_plan_type::BUILD_AND_INSTALL) { - const Build::BuildResult result = Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec)); + const Build::DependencyStatus dependency_status = Build::check_dependencies(*action.plan.source_pgh, action.spec, status_db); + Checks::check_exit(dependency_status == Build::DependencyStatus::ALL_DEPENDENCIES_INSTALLED); + const Build::BuildResult result = Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec), dependency_status); if (result != Build::BuildResult::SUCCESS) { exit(EXIT_FAILURE); From cc1692f304ed5c2514e69a12c4ed974b0d7b679e Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Feb 2017 17:14:54 -0800 Subject: [PATCH 075/137] Don't capture anything in lambdas, if they don't need it --- toolsrc/src/vcpkg_Files.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolsrc/src/vcpkg_Files.cpp b/toolsrc/src/vcpkg_Files.cpp index 87700238d58..57d4c665cf1 100644 --- a/toolsrc/src/vcpkg_Files.cpp +++ b/toolsrc/src/vcpkg_Files.cpp @@ -102,7 +102,7 @@ namespace vcpkg::Files void recursive_find_all_files_in_dir(const fs::path& dir, std::vector* output) { - recursive_find_matching_paths_in_dir(dir, [&](const fs::path& current) + recursive_find_matching_paths_in_dir(dir, [](const fs::path& current) { return !fs::is_directory(current); }, output); @@ -117,7 +117,7 @@ namespace vcpkg::Files void non_recursive_find_all_files_in_dir(const fs::path& dir, std::vector* output) { - non_recursive_find_matching_paths_in_dir(dir, [&](const fs::path& current) + non_recursive_find_matching_paths_in_dir(dir, [](const fs::path& current) { return !fs::is_directory(current); }, output); From c60c9de6e2371b31a79c58719df1d344b564111c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 13 Feb 2017 14:01:27 -0800 Subject: [PATCH 076/137] Restore dependency check in build_package() --- toolsrc/include/vcpkg_Commands.h | 15 ++++---- toolsrc/src/commands_build.cpp | 47 ++++++++++++++++--------- toolsrc/src/commands_build_external.cpp | 7 ++-- toolsrc/src/commands_install.cpp | 7 ++-- 4 files changed, 43 insertions(+), 33 deletions(-) diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 86c77a8bf17..c3cda3d87da 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -12,22 +12,19 @@ namespace vcpkg::Commands namespace Build { - enum class DependencyStatus - { - ALL_DEPENDENCIES_INSTALLED, - MISSING_DEPENDENCIES - }; - enum class BuildResult { BUILD_NOT_STARTED = 0, - SUCCESS, + SUCCEEDED, BUILD_FAILED, POST_BUILD_CHECKS_FAILED, + CASCADED_DUE_TO_MISSING_DEPENDENCIES }; - DependencyStatus check_dependencies(const SourceParagraph& source_paragraph, const package_spec& spec, const StatusParagraphs& status_db); - BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const DependencyStatus& dependency_status); + const std::string& to_string(const BuildResult build_result); + std::string create_error_message(const std::string& package_id, const BuildResult build_result); + + BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); } diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index c9292aae9bd..8dc4a455d81 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -24,12 +24,19 @@ namespace vcpkg::Commands::Build std::ofstream(binary_control_file) << bpgh; } - BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const DependencyStatus& dependency_status) + BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db) { Checks::check_exit(spec.name() == source_paragraph.name, "inconsistent arguments to build_package()"); - Checks::check_exit(dependency_status == DependencyStatus::ALL_DEPENDENCIES_INSTALLED, "Dependencies must be satisfied before attempting to build a package"); const triplet& target_triplet = spec.target_triplet(); + for (auto&& dep : source_paragraph.depends) + { + if (status_db.find_installed(dep.name, target_triplet) == status_db.end()) + { + return BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES; + } + } + const fs::path ports_cmake_script_path = paths.ports_cmake; const Environment::vcvarsall_and_platform_toolset vcvarsall_bat = Environment::get_vcvarsall_bat(paths); const std::wstring command = Strings::wformat(LR"("%s" %s >nul 2>&1 && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s -DVCPKG_PLATFORM_TOOLSET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")", @@ -74,23 +81,31 @@ namespace vcpkg::Commands::Build // const fs::path port_buildtrees_dir = paths.buildtrees / spec.name; // delete_directory(port_buildtrees_dir); - return BuildResult::SUCCESS; + return BuildResult::SUCCEEDED; } - DependencyStatus check_dependencies(const SourceParagraph& source_paragraph, const package_spec& spec, const StatusParagraphs& status_db) + const std::string& to_string(const BuildResult build_result) { - Checks::check_exit(spec.name() == source_paragraph.name, "inconsistent arguments to check_dependencies()"); - const triplet& target_triplet = spec.target_triplet(); + static const std::string BUILD_NOT_STARTED_STRING = "BUILD_NOT_STARTED"; + static const std::string SUCCEEDED_STRING = "SUCCEEDED"; + static const std::string BUILD_FAILED_STRING = "BUILD_FAILED"; + 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"; - for (auto&& dep : source_paragraph.depends) + switch (build_result) { - if (status_db.find_installed(dep.name, target_triplet) == status_db.end()) - { - return DependencyStatus::MISSING_DEPENDENCIES; - } + case BuildResult::BUILD_NOT_STARTED: return BUILD_NOT_STARTED_STRING; + case BuildResult::SUCCEEDED: return SUCCEEDED_STRING; + 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; + default: Checks::unreachable(); } + } - return DependencyStatus::ALL_DEPENDENCIES_INSTALLED; + std::string create_error_message(const std::string& package_id, const BuildResult build_result) + { + return Strings::format("Error: Building package %s failed with: %s", package_id, Build::to_string(build_result)); } void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) @@ -124,8 +139,8 @@ namespace vcpkg::Commands::Build const SourceParagraph& spgh = *maybe_spgh.get(); Environment::ensure_utilities_on_path(paths); - const DependencyStatus dependency_status = check_dependencies(spgh, spec, status_db); - if (dependency_status == DependencyStatus::MISSING_DEPENDENCIES) + const BuildResult result = build_package(spgh, spec, paths, paths.port_dir(spec), status_db); + if (result == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES) { std::vector unmet_dependencies = Dependencies::create_install_plan(paths, { spec }, status_db); unmet_dependencies.erase( @@ -147,9 +162,9 @@ namespace vcpkg::Commands::Build exit(EXIT_FAILURE); } - const BuildResult result = build_package(spgh, spec, paths, paths.port_dir(spec), dependency_status); - if (result != BuildResult::SUCCESS) + if (result != BuildResult::SUCCEEDED) { + System::println(System::color::error, Build::create_error_message(spec.toString(), result)); exit(EXIT_FAILURE); } diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/commands_build_external.cpp index 319e3c3d80d..0b2fdc7661b 100644 --- a/toolsrc/src/commands_build_external.cpp +++ b/toolsrc/src/commands_build_external.cpp @@ -23,11 +23,10 @@ namespace vcpkg::Commands::BuildExternal const expected maybe_spgh = try_load_port(port_dir); if (auto spgh = maybe_spgh.get()) { - const Build::DependencyStatus dependency_status = Build::check_dependencies(*spgh, *spec, status_db); - Checks::check_exit(dependency_status == Build::DependencyStatus::ALL_DEPENDENCIES_INSTALLED); - const Build::BuildResult result = Commands::Build::build_package(*spgh, *spec, paths, port_dir, dependency_status); - if (result != Build::BuildResult::SUCCESS) + const Build::BuildResult result = Commands::Build::build_package(*spgh, *spec, paths, port_dir, status_db); + if (result != Build::BuildResult::SUCCEEDED) { + System::println(System::color::error, Build::create_error_message(spec->toString(), result)); exit(EXIT_FAILURE); } diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp index a57d2cc6d28..b1a0108b7d7 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/commands_install.cpp @@ -214,11 +214,10 @@ namespace vcpkg::Commands::Install } else if (action.plan.plan_type == install_plan_type::BUILD_AND_INSTALL) { - const Build::DependencyStatus dependency_status = Build::check_dependencies(*action.plan.source_pgh, action.spec, status_db); - Checks::check_exit(dependency_status == Build::DependencyStatus::ALL_DEPENDENCIES_INSTALLED); - const Build::BuildResult result = Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec), dependency_status); - if (result != Build::BuildResult::SUCCESS) + const Build::BuildResult result = Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec), status_db); + if (result != Build::BuildResult::SUCCEEDED) { + System::println(System::color::error, Build::create_error_message(action.spec.toString(), result)); exit(EXIT_FAILURE); } const BinaryParagraph bpgh = try_load_cached_package(paths, action.spec).get_or_throw(); From c432b66034a4efe304d79926bf81f92cb6e96ad6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 13 Feb 2017 14:01:56 -0800 Subject: [PATCH 077/137] Introduce ci command: builds all packages of a triplet --- toolsrc/include/vcpkg_Commands.h | 6 ++ toolsrc/src/commands_available_commands.cpp | 1 + toolsrc/src/commands_ci.cpp | 92 +++++++++++++++++++++ toolsrc/vcpkglib/vcpkglib.vcxproj | 1 + toolsrc/vcpkglib/vcpkglib.vcxproj.filters | 3 + 5 files changed, 103 insertions(+) create mode 100644 toolsrc/src/commands_ci.cpp diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index c3cda3d87da..976e66c1815 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -34,6 +34,12 @@ namespace vcpkg::Commands } namespace Install + { + void install_package(const vcpkg_paths& paths, const BinaryParagraph& binary_paragraph, StatusParagraphs* status_db); + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); + } + + namespace CI { void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); } diff --git a/toolsrc/src/commands_available_commands.cpp b/toolsrc/src/commands_available_commands.cpp index 56056218b9c..4c7e0df2c6f 100644 --- a/toolsrc/src/commands_available_commands.cpp +++ b/toolsrc/src/commands_available_commands.cpp @@ -7,6 +7,7 @@ namespace vcpkg::Commands { static std::vector> t = { {"install", &Install::perform_and_exit}, + { "ci", &CI::perform_and_exit }, {"remove", &Remove::perform_and_exit}, {"build", &Build::perform_and_exit}, {"build_external", &BuildExternal::perform_and_exit} diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/commands_ci.cpp new file mode 100644 index 00000000000..189a801da83 --- /dev/null +++ b/toolsrc/src/commands_ci.cpp @@ -0,0 +1,92 @@ +#include "pch.h" +#include "vcpkg_Commands.h" +#include "vcpkglib.h" +#include "vcpkg_Environment.h" +#include "vcpkg_Files.h" +#include "vcpkg_System.h" +#include "vcpkg_Dependencies.h" +#include "vcpkg_Input.h" +#include "Stopwatch.h" + +namespace vcpkg::Commands::CI +{ + using Dependencies::package_spec_with_install_plan; + using Dependencies::install_plan_type; + + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + { + static const std::string example = Commands::Help::create_example_string("ci x64-windows"); + args.check_max_arg_count(1, example); + const triplet target_triplet = args.command_arguments.size() == 1 ? triplet::from_canonical_name(args.command_arguments.at(0)) : default_target_triplet; + Input::check_triplet(target_triplet, paths); + + StatusParagraphs status_db = database_load_check(paths); + + std::vector port_folders; + Files::non_recursive_find_matching_paths_in_dir(paths.ports, [](const fs::path& current) + { + return fs::is_directory(current); + }, &port_folders); + + std::vector specs; + for (const fs::path& p : port_folders) + { + specs.push_back(package_spec::from_name_and_triplet(p.filename().generic_string(), target_triplet).get_or_throw()); + } + + std::vector install_plan = Dependencies::create_install_plan(paths, specs, status_db); + Checks::check_exit(!install_plan.empty(), "Install plan cannot be empty"); + + std::vector results; + + Environment::ensure_utilities_on_path(paths); + + Stopwatch stopwatch = Stopwatch::createStarted(); + for (const package_spec_with_install_plan& action : install_plan) + { + System::println(stopwatch.toString()); + try + { + if (action.plan.plan_type == install_plan_type::ALREADY_INSTALLED) + { + results.push_back(Build::BuildResult::SUCCEEDED); + System::println(System::color::success, "Package %s is already installed", action.spec); + } + else if (action.plan.plan_type == install_plan_type::BUILD_AND_INSTALL) + { + const Build::BuildResult result = Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec), status_db); + results.push_back(result); + if (result != Build::BuildResult::SUCCEEDED) + { + System::println(System::color::error, Build::create_error_message(action.spec.toString(), result)); + continue; + } + const BinaryParagraph bpgh = try_load_cached_package(paths, action.spec).get_or_throw(); + Install::install_package(paths, bpgh, &status_db); + System::println(System::color::success, "Package %s is installed", action.spec); + } + else if (action.plan.plan_type == install_plan_type::INSTALL) + { + results.push_back(Build::BuildResult::SUCCEEDED); + Install::install_package(paths, *action.plan.binary_pgh, &status_db); + System::println(System::color::success, "Package %s is installed", action.spec); + } + else + Checks::unreachable(); + } + catch (const std::exception& e) + { + System::println(System::color::error, "Error: Could not install package %s: %s", action.spec, e.what()); + exit(EXIT_FAILURE); + } + } + + for (int i = 0; i < results.size(); i++) + { + System::println("%s: %s", install_plan[i].spec.toString(), Build::to_string(results[i])); + } + + System::println(stopwatch.toString()); + exit(EXIT_SUCCESS); + } +} diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 537b2fb0fd5..7ca8158dd02 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -180,6 +180,7 @@ + diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 519331b497b..622544e3d4f 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -171,6 +171,9 @@ Source Files + + Source Files + From 6e25bcf7cb1efd6de55f97aa978acd24d90af476 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 13 Feb 2017 14:07:27 -0800 Subject: [PATCH 078/137] Swap parameters of Build::create_error_message() --- toolsrc/include/vcpkg_Commands.h | 2 +- toolsrc/src/commands_build.cpp | 4 ++-- toolsrc/src/commands_build_external.cpp | 2 +- toolsrc/src/commands_ci.cpp | 2 +- toolsrc/src/commands_install.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 976e66c1815..1dbc9c37541 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -22,7 +22,7 @@ namespace vcpkg::Commands }; const std::string& to_string(const BuildResult build_result); - std::string create_error_message(const std::string& package_id, const BuildResult build_result); + std::string create_error_message(const BuildResult build_result, const std::string& package_id); BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index 8dc4a455d81..afc814451f0 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -103,7 +103,7 @@ namespace vcpkg::Commands::Build } } - std::string create_error_message(const std::string& package_id, const BuildResult build_result) + std::string create_error_message(const BuildResult build_result, const std::string& package_id) { return Strings::format("Error: Building package %s failed with: %s", package_id, Build::to_string(build_result)); } @@ -164,7 +164,7 @@ namespace vcpkg::Commands::Build if (result != BuildResult::SUCCEEDED) { - System::println(System::color::error, Build::create_error_message(spec.toString(), result)); + System::println(System::color::error, Build::create_error_message(result, spec.toString())); exit(EXIT_FAILURE); } diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/commands_build_external.cpp index 0b2fdc7661b..42b649dc320 100644 --- a/toolsrc/src/commands_build_external.cpp +++ b/toolsrc/src/commands_build_external.cpp @@ -26,7 +26,7 @@ namespace vcpkg::Commands::BuildExternal const Build::BuildResult result = Commands::Build::build_package(*spgh, *spec, paths, port_dir, status_db); if (result != Build::BuildResult::SUCCEEDED) { - System::println(System::color::error, Build::create_error_message(spec->toString(), result)); + System::println(System::color::error, Build::create_error_message(result, spec->toString())); exit(EXIT_FAILURE); } diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/commands_ci.cpp index 189a801da83..d6239b08017 100644 --- a/toolsrc/src/commands_ci.cpp +++ b/toolsrc/src/commands_ci.cpp @@ -58,7 +58,7 @@ namespace vcpkg::Commands::CI results.push_back(result); if (result != Build::BuildResult::SUCCEEDED) { - System::println(System::color::error, Build::create_error_message(action.spec.toString(), result)); + System::println(System::color::error, Build::create_error_message(result, action.spec.toString())); continue; } const BinaryParagraph bpgh = try_load_cached_package(paths, action.spec).get_or_throw(); diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp index b1a0108b7d7..76b9e36e4d8 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/commands_install.cpp @@ -217,7 +217,7 @@ namespace vcpkg::Commands::Install const Build::BuildResult result = Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec), status_db); if (result != Build::BuildResult::SUCCEEDED) { - System::println(System::color::error, Build::create_error_message(action.spec.toString(), result)); + System::println(System::color::error, Build::create_error_message(result, action.spec.toString())); exit(EXIT_FAILURE); } const BinaryParagraph bpgh = try_load_cached_package(paths, action.spec).get_or_throw(); From 6824cc9264d245ebd1302c27eb714250c5f7ec13 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 13 Feb 2017 16:22:02 -0800 Subject: [PATCH 079/137] Extract create_user_troubleshooting_message(). CI doesn't call it, interactive commands do --- toolsrc/include/vcpkg_Commands.h | 1 + toolsrc/src/commands_build.cpp | 20 ++++++++++++-------- toolsrc/src/commands_build_external.cpp | 1 + toolsrc/src/commands_install.cpp | 1 + 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 1dbc9c37541..1e8b3b9df7b 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -23,6 +23,7 @@ namespace vcpkg::Commands const std::string& to_string(const BuildResult build_result); std::string create_error_message(const BuildResult build_result, const std::string& package_id); + std::string create_user_troubleshooting_message(const package_spec& spec); BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index afc814451f0..750350a4a80 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -56,14 +56,6 @@ namespace vcpkg::Commands::Build if (return_code != 0) { - System::println(System::color::error, "Error: building package %s failed", spec.toString()); - System::println("Please ensure sure you're using the latest portfiles with `vcpkg update`, then\n" - "submit an issue at https://github.com/Microsoft/vcpkg/issues including:\n" - " Package: %s\n" - " Vcpkg version: %s\n" - "\n" - "Additionally, attach any relevant sections from the log files above." - , spec.toString(), Info::version()); TrackProperty("error", "build failed"); TrackProperty("build_error", spec.toString()); return BuildResult::BUILD_FAILED; @@ -108,6 +100,17 @@ namespace vcpkg::Commands::Build return Strings::format("Error: Building package %s failed with: %s", package_id, Build::to_string(build_result)); } + std::string create_user_troubleshooting_message(const package_spec& spec) + { + return Strings::format("Please ensure sure you're using the latest portfiles with `vcpkg update`, then\n" + "submit an issue at https://github.com/Microsoft/vcpkg/issues including:\n" + " Package: %s\n" + " Vcpkg version: %s\n" + "\n" + "Additionally, attach any relevant sections from the log files above." + , spec.toString(), Info::version()); + } + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { static const std::string example = Commands::Help::create_example_string("build zlib:x64-windows"); @@ -165,6 +168,7 @@ namespace vcpkg::Commands::Build if (result != BuildResult::SUCCEEDED) { System::println(System::color::error, Build::create_error_message(result, spec.toString())); + System::println(Build::create_user_troubleshooting_message(spec)); exit(EXIT_FAILURE); } diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/commands_build_external.cpp index 42b649dc320..fbda74f3f95 100644 --- a/toolsrc/src/commands_build_external.cpp +++ b/toolsrc/src/commands_build_external.cpp @@ -27,6 +27,7 @@ namespace vcpkg::Commands::BuildExternal if (result != Build::BuildResult::SUCCEEDED) { System::println(System::color::error, Build::create_error_message(result, spec->toString())); + System::println(Build::create_user_troubleshooting_message(*spec)); exit(EXIT_FAILURE); } diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp index 76b9e36e4d8..af068a4fb3e 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/commands_install.cpp @@ -218,6 +218,7 @@ namespace vcpkg::Commands::Install if (result != Build::BuildResult::SUCCEEDED) { System::println(System::color::error, Build::create_error_message(result, action.spec.toString())); + System::println(Build::create_user_troubleshooting_message(action.spec)); exit(EXIT_FAILURE); } const BinaryParagraph bpgh = try_load_cached_package(paths, action.spec).get_or_throw(); From 430739c468f7ea3cc513b85339ac51c16073325c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 13 Feb 2017 16:23:21 -0800 Subject: [PATCH 080/137] Change parameter from std::string to package_spec --- toolsrc/include/vcpkg_Commands.h | 2 +- toolsrc/src/commands_build.cpp | 6 +++--- toolsrc/src/commands_build_external.cpp | 2 +- toolsrc/src/commands_ci.cpp | 2 +- toolsrc/src/commands_install.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 1e8b3b9df7b..471485e3113 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -22,7 +22,7 @@ namespace vcpkg::Commands }; const std::string& to_string(const BuildResult build_result); - std::string create_error_message(const BuildResult build_result, const std::string& package_id); + std::string create_error_message(const BuildResult build_result, const package_spec& spec); std::string create_user_troubleshooting_message(const package_spec& spec); BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index 750350a4a80..264f9c06ec4 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -95,9 +95,9 @@ namespace vcpkg::Commands::Build } } - std::string create_error_message(const BuildResult build_result, const std::string& package_id) + std::string create_error_message(const BuildResult build_result, const package_spec& spec) { - return Strings::format("Error: Building package %s failed with: %s", package_id, Build::to_string(build_result)); + return Strings::format("Error: Building package %s failed with: %s", spec.toString(), Build::to_string(build_result)); } std::string create_user_troubleshooting_message(const package_spec& spec) @@ -167,7 +167,7 @@ namespace vcpkg::Commands::Build if (result != BuildResult::SUCCEEDED) { - System::println(System::color::error, Build::create_error_message(result, spec.toString())); + System::println(System::color::error, Build::create_error_message(result, spec)); System::println(Build::create_user_troubleshooting_message(spec)); exit(EXIT_FAILURE); } diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/commands_build_external.cpp index fbda74f3f95..0b401031040 100644 --- a/toolsrc/src/commands_build_external.cpp +++ b/toolsrc/src/commands_build_external.cpp @@ -26,7 +26,7 @@ namespace vcpkg::Commands::BuildExternal const Build::BuildResult result = Commands::Build::build_package(*spgh, *spec, paths, port_dir, status_db); if (result != Build::BuildResult::SUCCEEDED) { - System::println(System::color::error, Build::create_error_message(result, spec->toString())); + System::println(System::color::error, Build::create_error_message(result, *spec)); System::println(Build::create_user_troubleshooting_message(*spec)); exit(EXIT_FAILURE); } diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/commands_ci.cpp index d6239b08017..dd42335dfd4 100644 --- a/toolsrc/src/commands_ci.cpp +++ b/toolsrc/src/commands_ci.cpp @@ -58,7 +58,7 @@ namespace vcpkg::Commands::CI results.push_back(result); if (result != Build::BuildResult::SUCCEEDED) { - System::println(System::color::error, Build::create_error_message(result, action.spec.toString())); + System::println(System::color::error, Build::create_error_message(result, action.spec)); continue; } const BinaryParagraph bpgh = try_load_cached_package(paths, action.spec).get_or_throw(); diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp index af068a4fb3e..d4ec64e09fd 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/commands_install.cpp @@ -217,7 +217,7 @@ namespace vcpkg::Commands::Install const Build::BuildResult result = Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec), status_db); if (result != Build::BuildResult::SUCCEEDED) { - System::println(System::color::error, Build::create_error_message(result, action.spec.toString())); + System::println(System::color::error, Build::create_error_message(result, action.spec)); System::println(Build::create_user_troubleshooting_message(action.spec)); exit(EXIT_FAILURE); } From ab2cca3dad9d7efdc87e40554ccb6dc582d22360 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 14:34:03 -0800 Subject: [PATCH 081/137] Add BuildResul_Values and rename NULLVALUE const --- toolsrc/include/vcpkg_Commands.h | 5 ++++- toolsrc/src/commands_build.cpp | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 471485e3113..5c643d017ea 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -3,6 +3,7 @@ #include "vcpkg_cmd_arguments.h" #include "vcpkg_paths.h" #include "StatusParagraphs.h" +#include namespace vcpkg::Commands { @@ -14,13 +15,15 @@ namespace vcpkg::Commands { enum class BuildResult { - BUILD_NOT_STARTED = 0, + NULLVALUE = 0, SUCCEEDED, BUILD_FAILED, POST_BUILD_CHECKS_FAILED, CASCADED_DUE_TO_MISSING_DEPENDENCIES }; + static constexpr std::array BuildResult_values = { BuildResult::SUCCEEDED, BuildResult::BUILD_FAILED, BuildResult::POST_BUILD_CHECKS_FAILED, BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES }; + const std::string& to_string(const BuildResult build_result); std::string create_error_message(const BuildResult build_result, const package_spec& spec); std::string create_user_troubleshooting_message(const package_spec& spec); diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index 264f9c06ec4..03a4b944bc8 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -9,6 +9,7 @@ #include "vcpkg_Environment.h" #include "metrics.h" #include "vcpkg_info.h" +#include "vcpkg_Enums.h" namespace vcpkg::Commands::Build { @@ -78,7 +79,7 @@ namespace vcpkg::Commands::Build const std::string& to_string(const BuildResult build_result) { - static const std::string BUILD_NOT_STARTED_STRING = "BUILD_NOT_STARTED"; + static const std::string NULLVALUE_STRING = Enums::nullvalue_toString("vcpkg::Commands::Build::BuildResult"); static const std::string SUCCEEDED_STRING = "SUCCEEDED"; static const std::string BUILD_FAILED_STRING = "BUILD_FAILED"; static const std::string POST_BUILD_CHECKS_FAILED_STRING = "POST_BUILD_CHECKS_FAILED"; @@ -86,7 +87,7 @@ namespace vcpkg::Commands::Build switch (build_result) { - case BuildResult::BUILD_NOT_STARTED: return BUILD_NOT_STARTED_STRING; + case BuildResult::NULLVALUE: return NULLVALUE_STRING; case BuildResult::SUCCEEDED: return SUCCEEDED_STRING; case BuildResult::BUILD_FAILED: return BUILD_FAILED_STRING; case BuildResult::POST_BUILD_CHECKS_FAILED: return POST_BUILD_CHECKS_FAILED_STRING; From dbd8e5c56de12beb7626a7782f54b591b6154aa4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 14:34:39 -0800 Subject: [PATCH 082/137] Print only non-SUCCEEDED packages and also show summary --- toolsrc/src/commands_ci.cpp | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/commands_ci.cpp index dd42335dfd4..496ae6146a6 100644 --- a/toolsrc/src/commands_ci.cpp +++ b/toolsrc/src/commands_ci.cpp @@ -12,6 +12,7 @@ namespace vcpkg::Commands::CI { using Dependencies::package_spec_with_install_plan; using Dependencies::install_plan_type; + using Build::BuildResult; void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { @@ -37,10 +38,9 @@ namespace vcpkg::Commands::CI std::vector install_plan = Dependencies::create_install_plan(paths, specs, status_db); Checks::check_exit(!install_plan.empty(), "Install plan cannot be empty"); - std::vector results; - Environment::ensure_utilities_on_path(paths); + std::vector results; Stopwatch stopwatch = Stopwatch::createStarted(); for (const package_spec_with_install_plan& action : install_plan) { @@ -49,14 +49,14 @@ namespace vcpkg::Commands::CI { if (action.plan.plan_type == install_plan_type::ALREADY_INSTALLED) { - results.push_back(Build::BuildResult::SUCCEEDED); + results.push_back(BuildResult::SUCCEEDED); System::println(System::color::success, "Package %s is already installed", action.spec); } else if (action.plan.plan_type == install_plan_type::BUILD_AND_INSTALL) { - const Build::BuildResult result = Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec), status_db); + const BuildResult result = Commands::Build::build_package(*action.plan.source_pgh, action.spec, paths, paths.port_dir(action.spec), status_db); results.push_back(result); - if (result != Build::BuildResult::SUCCEEDED) + if (result != BuildResult::SUCCEEDED) { System::println(System::color::error, Build::create_error_message(result, action.spec)); continue; @@ -67,7 +67,7 @@ namespace vcpkg::Commands::CI } else if (action.plan.plan_type == install_plan_type::INSTALL) { - results.push_back(Build::BuildResult::SUCCEEDED); + results.push_back(BuildResult::SUCCEEDED); Install::install_package(paths, *action.plan.binary_pgh, &status_db); System::println(System::color::success, "Package %s is installed", action.spec); } @@ -81,12 +81,35 @@ namespace vcpkg::Commands::CI } } + System::println(stopwatch.toString()); + for (int i = 0; i < results.size(); i++) { + if (results[i] == BuildResult::SUCCEEDED) + { + continue; + } + System::println("%s: %s", install_plan[i].spec.toString(), Build::to_string(results[i])); } - System::println(stopwatch.toString()); + std::map summary; + for (const BuildResult& v : Build::BuildResult_values) + { + summary[v] = 0; + } + + for (const BuildResult& r : results) + { + summary[r]++; + } + + System::println("\n\nSUMMARY"); + for (const std::pair& entry : summary) + { + System::println(" %s: %d", Build::to_string(entry.first), entry.second); + } + exit(EXIT_SUCCESS); } } From fcafe9acea90db01ad059d96aeca82c1880e7da6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 15:22:40 -0800 Subject: [PATCH 083/137] Improve info displayed during the CI command --- toolsrc/src/commands_ci.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/commands_ci.cpp index 496ae6146a6..b20c204f45e 100644 --- a/toolsrc/src/commands_ci.cpp +++ b/toolsrc/src/commands_ci.cpp @@ -35,16 +35,19 @@ namespace vcpkg::Commands::CI specs.push_back(package_spec::from_name_and_triplet(p.filename().generic_string(), target_triplet).get_or_throw()); } - std::vector install_plan = Dependencies::create_install_plan(paths, specs, status_db); + const std::vector install_plan = Dependencies::create_install_plan(paths, specs, status_db); Checks::check_exit(!install_plan.empty(), "Install plan cannot be empty"); Environment::ensure_utilities_on_path(paths); std::vector results; Stopwatch stopwatch = Stopwatch::createStarted(); + size_t counter = 0; + const size_t package_count = install_plan.size(); for (const package_spec_with_install_plan& action : install_plan) { - System::println(stopwatch.toString()); + counter++; + System::println("Starting package %d/%d: %s. Time Elapsed: %s", counter, package_count, action.spec.toString(), stopwatch.toString()); try { if (action.plan.plan_type == install_plan_type::ALREADY_INSTALLED) From b39b2d298d0a1c9e05d0fcaf3e801a0a5bd9cb41 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 18:38:40 -0800 Subject: [PATCH 084/137] Remove unused variable from create_remove_plan() --- toolsrc/include/vcpkg_Dependencies.h | 2 +- toolsrc/src/commands_remove.cpp | 2 +- toolsrc/src/vcpkg_Dependencies.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg_Dependencies.h index b638160891a..dca824ee957 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg_Dependencies.h @@ -75,5 +75,5 @@ namespace vcpkg::Dependencies std::vector create_install_plan(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db); - std::vector create_remove_plan(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db); + std::vector create_remove_plan(const std::vector& specs, const StatusParagraphs& status_db); } diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp index f49104d1ec4..92ab56a282e 100644 --- a/toolsrc/src/commands_remove.cpp +++ b/toolsrc/src/commands_remove.cpp @@ -176,7 +176,7 @@ namespace vcpkg::Commands::Remove const bool alsoRemoveFolderFromPackages = options.find(OPTION_PURGE) != options.end(); const bool isRecursive = options.find(OPTION_RECURSE) != options.end(); - const std::vector remove_plan = Dependencies::create_remove_plan(paths, specs, status_db); + const std::vector remove_plan = Dependencies::create_remove_plan(specs, status_db); Checks::check_exit(!remove_plan.empty(), "Remove plan cannot be empty"); print_plan(remove_plan); diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg_Dependencies.cpp index 5bd6c3eb9d1..957814e6e64 100644 --- a/toolsrc/src/vcpkg_Dependencies.cpp +++ b/toolsrc/src/vcpkg_Dependencies.cpp @@ -97,7 +97,7 @@ namespace vcpkg::Dependencies return ret; } - std::vector create_remove_plan(const vcpkg_paths& paths, const std::vector& specs, const StatusParagraphs& status_db) + std::vector create_remove_plan(const std::vector& specs, const StatusParagraphs& status_db) { std::unordered_set specs_as_set(specs.cbegin(), specs.cend()); From 1f673572ae0df09bf9fe72e5a5e530f99b084114 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 18:40:39 -0800 Subject: [PATCH 085/137] Fix cast to WORD --- toolsrc/src/vcpkg_System.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index 0be026b79ed..90ec9c99ca2 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -68,7 +68,7 @@ namespace vcpkg::System GetConsoleScreenBufferInfo(hConsole, &consoleScreenBufferInfo); auto original_color = consoleScreenBufferInfo.wAttributes; - SetConsoleTextAttribute(hConsole, static_cast(c) | (original_color & 0xF0)); + SetConsoleTextAttribute(hConsole, static_cast(c) | (original_color & 0xF0)); std::cout << message; SetConsoleTextAttribute(hConsole, original_color); } From 809d66c53db89666519a23372c3c26821bc8e4e4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 18:45:26 -0800 Subject: [PATCH 086/137] Remove parameter names to avoid C4100 --- toolsrc/src/vcpkg_metrics_uploader.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/toolsrc/src/vcpkg_metrics_uploader.cpp b/toolsrc/src/vcpkg_metrics_uploader.cpp index 14fc9ae48bd..82dcd4b03a0 100644 --- a/toolsrc/src/vcpkg_metrics_uploader.cpp +++ b/toolsrc/src/vcpkg_metrics_uploader.cpp @@ -5,13 +5,7 @@ using namespace vcpkg; -int WINAPI -WinMain( - _In_ HINSTANCE hInstance, - _In_opt_ HINSTANCE hPrevInstance, - _In_ LPSTR lpCmdLine, - _In_ int nShowCmd -) +int WINAPI WinMain(_In_ HINSTANCE, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ int) { LPWSTR* szArgList; int argCount; From 50187c07a73216ae30c26c70bd821e8455c221de Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 18:46:27 -0800 Subject: [PATCH 087/137] Remove disabled post-build check --- toolsrc/src/PostBuildLint.cpp | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index a5fd7aa52e5..c4ddbc62ee2 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -425,24 +425,6 @@ namespace vcpkg::PostBuildLint return lint_status::SUCCESS; } - static lint_status check_no_subdirectories(const fs::path& dir) - { - const std::vector subdirectories = Files::recursive_find_matching_paths_in_dir(dir, [&](const fs::path& current) - { - return fs::is_directory(current); - }); - - if (!subdirectories.empty()) - { - System::println(System::color::warning, "Directory %s should have no subdirectories", dir.generic_string()); - System::println("The following subdirectories were found: "); - Files::print_paths(subdirectories); - return lint_status::ERROR_DETECTED; - } - - return lint_status::SUCCESS; - } - static lint_status check_bin_folders_are_not_present_in_static_build(const fs::path& package_dir) { const fs::path bin = package_dir / "bin"; @@ -700,10 +682,6 @@ namespace vcpkg::PostBuildLint default: Checks::unreachable(); } -#if 0 - error_count += check_no_subdirectories(package_dir / "lib"); - error_count += check_no_subdirectories(package_dir / "debug" / "lib"); -#endif error_count += check_no_empty_folders(package_dir); error_count += check_no_files_in_package_dir_and_debug_dir(package_dir); From e11db4d5da2e471d6066c635cc370f8f9e88670a Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 18:48:06 -0800 Subject: [PATCH 088/137] Remove unused function --- toolsrc/src/BinaryParagraph.cpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/toolsrc/src/BinaryParagraph.cpp b/toolsrc/src/BinaryParagraph.cpp index f949677a381..8605cd27659 100644 --- a/toolsrc/src/BinaryParagraph.cpp +++ b/toolsrc/src/BinaryParagraph.cpp @@ -23,22 +23,6 @@ namespace vcpkg static const std::string DEPENDS = "Depends"; } - static const std::vector& get_list_of_valid_fields() - { - static const std::vector valid_fields = - { - BinaryParagraphRequiredField::PACKAGE, - BinaryParagraphRequiredField::VERSION, - BinaryParagraphRequiredField::ARCHITECTURE, - - BinaryParagraphOptionalField::DESCRIPTION, - BinaryParagraphOptionalField::MAINTAINER, - BinaryParagraphOptionalField::DEPENDS - }; - - return valid_fields; - } - BinaryParagraph::BinaryParagraph() = default; BinaryParagraph::BinaryParagraph(std::unordered_map fields) From c031bda3bd17a465109bdfa3c79146f32382a70b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 18:58:37 -0800 Subject: [PATCH 089/137] Test result of assignment. Avoids C4706 --- toolsrc/src/metrics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/metrics.cpp b/toolsrc/src/metrics.cpp index 263d6eb74ca..5ef54f15d1c 100644 --- a/toolsrc/src/metrics.cpp +++ b/toolsrc/src/metrics.cpp @@ -357,7 +357,7 @@ true { DWORD availableData = 0, readData = 0, totalData = 0; - while ((bResults = WinHttpQueryDataAvailable(hRequest, &availableData)) && availableData > 0) + while ((bResults = WinHttpQueryDataAvailable(hRequest, &availableData)) == TRUE && availableData > 0) { responseBuffer.resize(responseBuffer.size() + availableData); From ad197b4a742920e42eb7a1a649c07de417a517ad Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 18:58:44 -0800 Subject: [PATCH 090/137] Formatting --- toolsrc/src/metrics.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/toolsrc/src/metrics.cpp b/toolsrc/src/metrics.cpp index 5ef54f15d1c..4ac43c5c6f6 100644 --- a/toolsrc/src/metrics.cpp +++ b/toolsrc/src/metrics.cpp @@ -32,7 +32,7 @@ namespace vcpkg static std::string GenerateRandomUUID() { - int partSizes[] = {8, 4, 4, 4, 12}; + int partSizes[] = { 8, 4, 4, 4, 12 }; char uuid[37]; memset(uuid, 0, sizeof(uuid)); int num; @@ -101,7 +101,7 @@ namespace vcpkg // Note: this treats incoming Strings as Latin-1 static constexpr const char hex[16] = { '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; encoded.append("\\u00"); encoded.push_back(hex[ch / 16]); encoded.push_back(hex[ch % 16]); @@ -229,8 +229,10 @@ true { LONG err; - struct RAII_HKEY { + struct RAII_HKEY + { HKEY hkey = nullptr; + ~RAII_HKEY() { if (hkey != nullptr) @@ -244,7 +246,7 @@ true return L"{}"; } - std::array buffer; + std::array buffer; DWORD lType = 0; DWORD dwBufferSize = static_cast(buffer.size() * sizeof(wchar_t)); err = RegQueryValueExW(HKCU_SQMClient.hkey, L"UserId", nullptr, &lType, reinterpret_cast(buffer.data()), &dwBufferSize); @@ -356,7 +358,6 @@ true if (bResults) { DWORD availableData = 0, readData = 0, totalData = 0; - while ((bResults = WinHttpQueryDataAvailable(hRequest, &availableData)) == TRUE && availableData > 0) { responseBuffer.resize(responseBuffer.size() + availableData); From 293fcbec59a147f182a2d7b46a67797dcbf4a258 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 19:19:19 -0800 Subject: [PATCH 091/137] [!] Change the format of the listfile --- toolsrc/src/commands_install.cpp | 6 ++++-- toolsrc/src/vcpkglib.cpp | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp index d4ec64e09fd..9757e171d03 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/commands_install.cpp @@ -24,7 +24,7 @@ namespace vcpkg::Commands::Install const std::string& target_triplet_as_string = target_triplet.canonical_name(); std::error_code ec; fs::create_directory(paths.installed / target_triplet_as_string, ec); - output.push_back(Strings::format(R"(%s)", target_triplet_as_string)); + output.push_back(Strings::format(R"(%s/)", target_triplet_as_string)); for (auto it = fs::recursive_directory_iterator(package_prefix_path); it != fs::recursive_directory_iterator(); ++it) { @@ -54,7 +54,7 @@ namespace vcpkg::Commands::Install } // Trailing backslash for directories - output.push_back(Strings::format(R"(%s/%s)", target_triplet_as_string, suffix)); + output.push_back(Strings::format(R"(%s/%s/)", target_triplet_as_string, suffix)); continue; } @@ -82,6 +82,8 @@ namespace vcpkg::Commands::Install System::println(System::color::error, "failed: %s: cannot handle file type", it->path().u8string()); } + std::sort(output.begin(), output.end()); + Files::write_all_lines(paths.listfile_path(bpgh), output); } diff --git a/toolsrc/src/vcpkglib.cpp b/toolsrc/src/vcpkglib.cpp index 06487684c5b..78918e62cc5 100644 --- a/toolsrc/src/vcpkglib.cpp +++ b/toolsrc/src/vcpkglib.cpp @@ -164,12 +164,10 @@ static void upgrade_to_slash_terminated_sorted_format(std::vector* // The new format is lexicographically sorted std::sort(lines->begin(), lines->end()); -#if 0 // Replace the listfile on disk const fs::path updated_listfile_path = listfile_path.generic_string() + "_updated"; Files::write_all_lines(updated_listfile_path, *lines); fs::rename(updated_listfile_path, listfile_path); -#endif } std::vector vcpkg::get_installed_files(const vcpkg_paths& paths, const StatusParagraphs& status_db) From 0563b293891f5ba475460b6923ec69b886c21b9b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 19:22:53 -0800 Subject: [PATCH 092/137] Raise Warning level for the vcpkg tool to W4 --- toolsrc/vcpkglib/vcpkglib.vcxproj | 2 +- toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj | 2 +- toolsrc/vcpkgtest/vcpkgtest.vcxproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 7ca8158dd02..e01ba925c6b 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -85,7 +85,7 @@ - Level3 + Level4 Disabled true ..\include diff --git a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj index cce816ab046..472d74e3097 100644 --- a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj +++ b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj @@ -82,7 +82,7 @@ - Level3 + Level4 Disabled true ..\include diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj b/toolsrc/vcpkgtest/vcpkgtest.vcxproj index c0a91ce50be..c12c2dd3184 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj @@ -108,7 +108,7 @@ NotUsing - Level3 + Level4 Disabled ..\include;$(VCInstallDir)UnitTest\include;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\UnitTest\include;%(AdditionalIncludeDirectories) _DEBUG;%(PreprocessorDefinitions) From 377f93f3e3ac4e3025837bcfd8cce6c4e6f34b04 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 19:33:18 -0800 Subject: [PATCH 093/137] Update CHANGELOG and bump version to v0.0.73 --- CHANGELOG.md | 19 +++++++++++++++++++ toolsrc/VERSION.txt | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fa8739dba7..ef5995480eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ +vcpkg (0.0.73) +-------------- + * Add ports: + - gdk-pixbuf 2.36.5 + - openvr 1.0.5 + * Update ports: + - lmdb 0.9.18-1 -> 0.9.18-2 + - opencv 3.1.0-1 -> 3.2.0 + - sqlite3 3.15.0 -> 3.17.0 + * Add functions to correctly find the "Program Files" folders in all parts of `vcpkg` (C++, CMake, powershell) + * Flush std::cout before launching an external process. Fixes issues when redirecting std::cout to a file + * Update version of the automatically acquired nasm. Resolves build failure with libjpeg-turbo + * Change the format of the listfile. The file is now sorted and directories now have a trailing slash so they can easily be identified. + - Old listfiles will be automatically updated on first access. This will happen to all old listfiles when a new package is installed (`vcpkg install`) or after a call to `vcpkg owns`. + * Fixes and improvements in existing portfiles and the `vcpkg` tool itself + +-- vcpkg team WED, 15 Feb 2017 19:30:00 -0800 + + vcpkg (0.0.72) -------------- * Add ports: diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index 204dee5e59c..cab1f08efcf 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"0.0.72" \ No newline at end of file +"0.0.73" \ No newline at end of file From b80cdd1118cec9ad9befdbbdded93a963877b994 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 20:18:39 -0800 Subject: [PATCH 094/137] Fix C4018 warning --- toolsrc/src/commands_ci.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/commands_ci.cpp index b20c204f45e..f207eeaaac0 100644 --- a/toolsrc/src/commands_ci.cpp +++ b/toolsrc/src/commands_ci.cpp @@ -86,7 +86,7 @@ namespace vcpkg::Commands::CI System::println(stopwatch.toString()); - for (int i = 0; i < results.size(); i++) + for (size_t i = 0; i < results.size(); i++) { if (results[i] == BuildResult::SUCCEEDED) { From d86c1ddd6cc2b71d90f5474a9e3e583d9eecae2f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 20:39:49 -0800 Subject: [PATCH 095/137] Use Strings::ascii_to_lowercase() --- toolsrc/src/triplet.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/toolsrc/src/triplet.cpp b/toolsrc/src/triplet.cpp index e1302d9edf8..d91e0e68f85 100644 --- a/toolsrc/src/triplet.cpp +++ b/toolsrc/src/triplet.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include "triplet.h" #include "vcpkg_Checks.h" +#include "vcpkg_Strings.h" namespace vcpkg { @@ -37,9 +38,7 @@ namespace vcpkg triplet triplet::from_canonical_name(const std::string& triplet_as_string) { - std::string s(triplet_as_string); - std::transform(s.begin(), s.end(), s.begin(), ::tolower); - + const std::string s(Strings::ascii_to_lowercase(triplet_as_string)); auto it = std::find(s.cbegin(), s.cend(), '-'); Checks::check_exit(it != s.cend(), "Invalid triplet: %s", triplet_as_string); From 83fa6a09fb0afdde99ac0b035111777de5813211 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 20:41:03 -0800 Subject: [PATCH 096/137] Add tolower_char(char)->char. Avoids C4244 for char<->int conversion --- toolsrc/src/vcpkg_Strings.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index 3b9d6a8598d..9cad336105f 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -9,6 +9,11 @@ namespace vcpkg::Strings::details return std::isspace(c); }; + static char tolower_char(const char c) + { + return static_cast(std::tolower(c)); + } + std::string format_internal(const char* fmtstr, ...) { va_list lst; @@ -53,17 +58,17 @@ namespace vcpkg::Strings std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern) { std::string pattern_as_lower_case; - std::transform(pattern.begin(), pattern.end(), back_inserter(pattern_as_lower_case), tolower); + std::transform(pattern.begin(), pattern.end(), back_inserter(pattern_as_lower_case), &details::tolower_char); return search(s.begin(), s.end(), pattern_as_lower_case.begin(), pattern_as_lower_case.end(), [](const char a, const char b) { - return tolower(a) == b; + return details::tolower_char(a) == b; }); } std::string ascii_to_lowercase(const std::string& input) { - std::string output = input; - std::transform(output.begin(), output.end(), output.begin(), ::tolower); + std::string output(input); + std::transform(output.begin(), output.end(), output.begin(), &details::tolower_char); return output; } From 31cda2b3de436109b271c9a9ace42c3eb4d80dc3 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Wed, 15 Feb 2017 20:44:19 -0800 Subject: [PATCH 097/137] Add comment for tolower_char() --- toolsrc/src/vcpkg_Strings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index 9cad336105f..b19d5def094 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -9,6 +9,7 @@ namespace vcpkg::Strings::details return std::isspace(c); }; + // Avoids C4244 warnings because of char<->int conversion that occur when using std::tolower() static char tolower_char(const char c) { return static_cast(std::tolower(c)); From 053608f47b61a972ea35b26dfb4bd858edd2e709 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 00:27:02 -0800 Subject: [PATCH 098/137] Fix build command not printing out the missing dependencies on fail --- toolsrc/src/commands_build.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index 03a4b944bc8..10e1c75665d 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -154,7 +154,7 @@ namespace vcpkg::Commands::Build }), unmet_dependencies.end()); - Checks::check_exit(unmet_dependencies.empty()); + Checks::check_exit(!unmet_dependencies.empty()); System::println(System::color::error, "The build command requires all dependencies to be already installed."); System::println("The following dependencies are missing:"); System::println(""); From 99e369e4a72ab42d78b7d5cb977f2a0d4f8b1724 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 13:02:30 -0800 Subject: [PATCH 099/137] Use ascii_to_lowercase() --- toolsrc/src/vcpkg_Strings.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index b19d5def094..d021aa18c3b 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -58,8 +58,7 @@ namespace vcpkg::Strings std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern) { - std::string pattern_as_lower_case; - std::transform(pattern.begin(), pattern.end(), back_inserter(pattern_as_lower_case), &details::tolower_char); + const std::string pattern_as_lower_case(ascii_to_lowercase(pattern)); return search(s.begin(), s.end(), pattern_as_lower_case.begin(), pattern_as_lower_case.end(), [](const char a, const char b) { return details::tolower_char(a) == b; From 8a37cd9b1d881905e34b281dcab51bc2a94ecf2c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 13:19:43 -0800 Subject: [PATCH 100/137] Specify type explicitly --- toolsrc/src/vcpkg_Strings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg_Strings.cpp index d021aa18c3b..35ebcc90f36 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg_Strings.cpp @@ -20,7 +20,7 @@ namespace vcpkg::Strings::details va_list lst; va_start(lst, fmtstr); - auto sz = _vscprintf(fmtstr, lst); + const int sz = _vscprintf(fmtstr, lst); std::string output(sz, '\0'); _vsnprintf_s(&output[0], output.size() + 1, output.size() + 1, fmtstr, lst); va_end(lst); @@ -33,7 +33,7 @@ namespace vcpkg::Strings::details va_list lst; va_start(lst, fmtstr); - auto sz = _vscwprintf(fmtstr, lst); + const int sz = _vscwprintf(fmtstr, lst); std::wstring output(sz, '\0'); _vsnwprintf_s(&output[0], output.size() + 1, output.size() + 1, fmtstr, lst); va_end(lst); From a62558fb793a0c8e31c189f8f5eebe3fc5c83f58 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 16:29:52 -0800 Subject: [PATCH 101/137] Introduce ElapsedTime class --- toolsrc/include/Stopwatch.h | 19 +++++++ toolsrc/src/Stopwatch.cpp | 104 ++++++++++++++++++++---------------- 2 files changed, 78 insertions(+), 45 deletions(-) diff --git a/toolsrc/include/Stopwatch.h b/toolsrc/include/Stopwatch.h index 105a4b1ee45..e4ae121b368 100644 --- a/toolsrc/include/Stopwatch.h +++ b/toolsrc/include/Stopwatch.h @@ -5,6 +5,25 @@ namespace vcpkg { + class ElapsedTime + { + public: + static ElapsedTime createStarted(); + + constexpr ElapsedTime() :m_startTick() {} + + template + TimeUnit elapsed() const + { + return std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - this->m_startTick); + } + + std::string toString() const; + + private: + std::chrono::steady_clock::time_point m_startTick; + }; + class Stopwatch { public: diff --git a/toolsrc/src/Stopwatch.cpp b/toolsrc/src/Stopwatch.cpp index ec7af60b68e..4f227bb7c29 100644 --- a/toolsrc/src/Stopwatch.cpp +++ b/toolsrc/src/Stopwatch.cpp @@ -4,6 +4,63 @@ namespace vcpkg { + static std::string format_time_userfriendly(const std::chrono::nanoseconds& nanos) + { + using std::chrono::hours; + using std::chrono::minutes; + using std::chrono::seconds; + using std::chrono::milliseconds; + using std::chrono::microseconds; + using std::chrono::nanoseconds; + using std::chrono::duration_cast; + + const double nanos_as_double = static_cast(nanos.count()); + + if (duration_cast(nanos) > hours()) + { + auto t = nanos_as_double / duration_cast(hours(1)).count(); + return Strings::format("%.4g h", t); + } + + if (duration_cast(nanos) > minutes()) + { + auto t = nanos_as_double / duration_cast(minutes(1)).count(); + return Strings::format("%.4g min", t); + } + + if (duration_cast(nanos) > seconds()) + { + auto t = nanos_as_double / duration_cast(seconds(1)).count(); + return Strings::format("%.4g s", t); + } + + if (duration_cast(nanos) > milliseconds()) + { + auto t = nanos_as_double / duration_cast(milliseconds(1)).count(); + return Strings::format("%.4g ms", t); + } + + if (duration_cast(nanos) > microseconds()) + { + auto t = nanos_as_double / duration_cast(microseconds(1)).count(); + return Strings::format("%.4g us", t); + } + + return Strings::format("%.4g ns", nanos_as_double); + } + + ElapsedTime ElapsedTime::createStarted() + { + ElapsedTime t; + t.m_startTick = std::chrono::high_resolution_clock::now(); + return t; + } + + std::string ElapsedTime::toString() const + { + return format_time_userfriendly(elapsed()); + } + Stopwatch Stopwatch::createUnstarted() { return Stopwatch(); @@ -45,53 +102,10 @@ namespace vcpkg std::string Stopwatch::toString() const { - using std::chrono::hours; - using std::chrono::minutes; - using std::chrono::seconds; - using std::chrono::milliseconds; - using std::chrono::microseconds; - using std::chrono::nanoseconds; - using std::chrono::duration_cast; - - auto nanos = elapsedNanos(); - auto nanos_as_double = static_cast(nanos.count()); - - if (duration_cast(nanos) > hours()) - { - auto t = nanos_as_double / duration_cast(hours(1)).count(); - return Strings::format("%.4g h", t); - } - - if (duration_cast(nanos) > minutes()) - { - auto t = nanos_as_double / duration_cast(minutes(1)).count(); - return Strings::format("%.4g min", t); - } - - if (duration_cast(nanos) > seconds()) - { - auto t = nanos_as_double / duration_cast(seconds(1)).count(); - return Strings::format("%.4g s", t); - } - - if (duration_cast(nanos) > milliseconds()) - { - auto t = nanos_as_double / duration_cast(milliseconds(1)).count(); - return Strings::format("%.4g ms", t); - } - - if (duration_cast(nanos) > microseconds()) - { - auto t = nanos_as_double / duration_cast(microseconds(1)).count(); - return Strings::format("%.4g us", t); - } - - return Strings::format("%.4g ns", nanos_as_double); + return format_time_userfriendly(this->elapsedNanos()); } - Stopwatch::Stopwatch() : m_isRunning(false), m_elapsedNanos(0), m_startTick() - { - } + Stopwatch::Stopwatch() : m_isRunning(false), m_elapsedNanos(0), m_startTick() { } std::chrono::nanoseconds Stopwatch::elapsedNanos() const { From e16084cc8d15b0c042871b0d1cffa6320a1681d4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 16:32:14 -0800 Subject: [PATCH 102/137] Rename Stopwatch.h/cpp to vcpkg_Chrono.h/cpp --- toolsrc/include/{Stopwatch.h => vcpkg_Chrono.h} | 0 toolsrc/src/commands_ci.cpp | 2 +- toolsrc/src/{Stopwatch.cpp => vcpkg_Chrono.cpp} | 2 +- toolsrc/vcpkglib/vcpkglib.vcxproj | 4 ++-- toolsrc/vcpkglib/vcpkglib.vcxproj.filters | 12 ++++++------ 5 files changed, 10 insertions(+), 10 deletions(-) rename toolsrc/include/{Stopwatch.h => vcpkg_Chrono.h} (100%) rename toolsrc/src/{Stopwatch.cpp => vcpkg_Chrono.cpp} (99%) diff --git a/toolsrc/include/Stopwatch.h b/toolsrc/include/vcpkg_Chrono.h similarity index 100% rename from toolsrc/include/Stopwatch.h rename to toolsrc/include/vcpkg_Chrono.h diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/commands_ci.cpp index f207eeaaac0..ea2c707c787 100644 --- a/toolsrc/src/commands_ci.cpp +++ b/toolsrc/src/commands_ci.cpp @@ -6,7 +6,7 @@ #include "vcpkg_System.h" #include "vcpkg_Dependencies.h" #include "vcpkg_Input.h" -#include "Stopwatch.h" +#include "vcpkg_Chrono.h" namespace vcpkg::Commands::CI { diff --git a/toolsrc/src/Stopwatch.cpp b/toolsrc/src/vcpkg_Chrono.cpp similarity index 99% rename from toolsrc/src/Stopwatch.cpp rename to toolsrc/src/vcpkg_Chrono.cpp index 4f227bb7c29..1bcb439bef6 100644 --- a/toolsrc/src/Stopwatch.cpp +++ b/toolsrc/src/vcpkg_Chrono.cpp @@ -1,5 +1,5 @@ #include "pch.h" -#include "Stopwatch.h" +#include "vcpkg_Chrono.h" #include "vcpkg_Checks.h" namespace vcpkg diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index e01ba925c6b..4c98380fa17 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -157,7 +157,7 @@ - + @@ -216,7 +216,7 @@ - + diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 622544e3d4f..70d1b58ace6 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -132,9 +132,6 @@ Source Files - - Source Files - Source Files @@ -174,6 +171,9 @@ Source Files + + Source Files + @@ -248,9 +248,6 @@ Header Files - - Header Files - Header Files @@ -299,5 +296,8 @@ Header Files + + Header Files + \ No newline at end of file From 1a6496b49403cb0df959f06fd075f9940089a1f6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 16:37:11 -0800 Subject: [PATCH 103/137] Use ElapsedTime instead of Stopwatch --- toolsrc/src/commands_ci.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/commands_ci.cpp index ea2c707c787..178d8ae1b7e 100644 --- a/toolsrc/src/commands_ci.cpp +++ b/toolsrc/src/commands_ci.cpp @@ -41,13 +41,13 @@ namespace vcpkg::Commands::CI Environment::ensure_utilities_on_path(paths); std::vector results; - Stopwatch stopwatch = Stopwatch::createStarted(); + const ElapsedTime timer = ElapsedTime::createStarted(); size_t counter = 0; const size_t package_count = install_plan.size(); for (const package_spec_with_install_plan& action : install_plan) { counter++; - System::println("Starting package %d/%d: %s. Time Elapsed: %s", counter, package_count, action.spec.toString(), stopwatch.toString()); + System::println("Starting package %d/%d: %s. Time Elapsed: %s", counter, package_count, action.spec.toString(), timer.toString()); try { if (action.plan.plan_type == install_plan_type::ALREADY_INSTALLED) @@ -84,7 +84,7 @@ namespace vcpkg::Commands::CI } } - System::println(stopwatch.toString()); + System::println(timer.toString()); for (size_t i = 0; i < results.size(); i++) { From 66cc4eed685f586cea4c36c1088632d6bf5feb9c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 18:02:16 -0800 Subject: [PATCH 104/137] CMake: Bump version to 3.8.0 to resolve VS2017 UWP build issues --- scripts/fetchDependency.ps1 | 12 ++++++------ toolsrc/src/vcpkg_Environment.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 1faf5b165df..71f9e108983 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -129,12 +129,12 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) if($Dependency -eq "cmake") { - $requiredVersion = "3.7.2" - $downloadVersion = "3.7.2" - $url = "https://cmake.org/files/v3.7/cmake-3.7.2-win32-x86.zip" - $downloadPath = "$downloadsDir\cmake-3.7.2-win32-x86.zip" - $expectedDownloadedFileHash = "ec5e299d412e0272e01d4de5bf07718f42c96361f83d51cc39f91bf49cc3e5c3" - $executableFromDownload = "$downloadsDir\cmake-3.7.2-win32-x86\bin\cmake.exe" + $requiredVersion = "3.8.0" + $downloadVersion = "3.8.0" + $url = "https://cmake.org/files/v3.8/cmake-3.8.0-rc1-win32-x86.zip" + $downloadPath = "$downloadsDir\cmake-3.8.0-rc1-win32-x86.zip" + $expectedDownloadedFileHash = "ccdbd92fbfb548aa35a545e4e45ff19fd6d13c88c90370acdf940c3cf464e9c9" + $executableFromDownload = "$downloadsDir\cmake-3.8.0-rc1-win32-x86\bin\cmake.exe" $extractionType = $ExtractionType_ZIP $extractionFolder = $downloadsDir } diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index cc3dba10027..527d8de895e 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -74,7 +74,7 @@ namespace vcpkg::Environment static const fs::path default_cmake_installation_dir = Environment::get_ProgramFiles_platform_bitness() / "CMake/bin"; static const fs::path default_cmake_installation_dir_32 = Environment::get_ProgramFiles_32_bit() / "CMake/bin"; - const fs::path downloaded_cmake = paths.downloads / "cmake-3.7.2-win32-x86" / "bin"; + const fs::path downloaded_cmake = paths.downloads / "cmake-3.8.0-rc1-win32-x86" / "bin"; const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", downloaded_cmake.native(), *System::get_environmental_variable(L"PATH"), @@ -82,7 +82,7 @@ namespace vcpkg::Environment default_cmake_installation_dir_32.native()); System::set_environmental_variable(L"PATH", path_buf.c_str()); - static constexpr std::array cmake_version = { 3,7,2 }; + static constexpr std::array cmake_version = { 3,8,0 }; static const std::wstring version_check_cmd = L"cmake --version 2>&1"; const std::wstring install_cmd = create_default_install_cmd(paths, L"cmake"); ensure_on_path(cmake_version, version_check_cmd, install_cmd); From 82585b25abbad56b53c691dadf04b4cc9677dfd4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 18:11:47 -0800 Subject: [PATCH 105/137] Update CHANGELOG and bump version to v0.0.74 --- CHANGELOG.md | 9 +++++++++ toolsrc/VERSION.txt | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef5995480eb..41253f7811d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +vcpkg (0.0.74) +-------------- + * Bump required version & auto-downloaded version of `cmake` to 3.8.0 (was 3.7.x). This fixes UWP builds with Visual Studio 2017 + * Fix `vcpkg build` not printing out the missing dependencies on fail + * Fixes and improvements in the `vcpkg` tool itself + +-- vcpkg team THU, 16 Feb 2017 18:15:00 -0800 + + vcpkg (0.0.73) -------------- * Add ports: diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index cab1f08efcf..723643136ea 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"0.0.73" \ No newline at end of file +"0.0.74" \ No newline at end of file From 7b4cae57be4e42113b70fd755988623236a95bd7 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 18:48:14 -0800 Subject: [PATCH 106/137] fetchDependency.ps1: add option to override prompting for download --- scripts/fetchDependency.ps1 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 71f9e108983..6a40c975886 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -1,8 +1,14 @@ [CmdletBinding()] param( - [string]$Dependency + [string]$Dependency, + [ValidateNotNullOrEmpty()] + [string]$downloadPromptOverride = "0" ) +$downloadPromptOverride_NO_OVERRIDE= 0 +$downloadPromptOverride_DO_NOT_PROMPT = 1 +$downloadPromptOverride_ALWAYS_PROMPT = 2 + Import-Module BitsTransfer $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition @@ -12,9 +18,13 @@ $downloadsDir = "$vcpkgRootDir\downloads" function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) { - function promptForDownload([string]$title, [string]$message, [string]$yesDescription, [string]$noDescription) + function promptForDownload([string]$title, [string]$message, [string]$yesDescription, [string]$noDescription, [string]$downloadPromptOverride) { - if ((Test-Path "$downloadsDir\AlwaysAllowEverything") -Or (Test-Path "$downloadsDir\AlwaysAllowDownloads")) + $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 } @@ -57,7 +67,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $yesDescription = "Downloads " + $Dependency + " v" + $downloadVersion +" app-locally." $noDescription = "Does not download " + $Dependency + "." - $userAllowedDownload = promptForDownload $title $message $yesDescription $noDescription + $userAllowedDownload = promptForDownload $title $message $yesDescription $noDescription $downloadPromptOverride if (!$userAllowedDownload) { throw [System.IO.FileNotFoundException] ("Could not detect suitable version of " + $Dependency + " and download not allowed") From d36b292ae2b7bfb92d7c03d6aa44bb2a74311c36 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 19:13:10 -0800 Subject: [PATCH 107/137] Don't prompt for downloading nuget when finding VS instances This means bootstrap no longer prompts --- scripts/findVisualStudioInstallationInstances.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1 index 9034ddfa8fb..8937c6fed14 100644 --- a/scripts/findVisualStudioInstallationInstances.ps1 +++ b/scripts/findVisualStudioInstallationInstances.ps1 @@ -10,7 +10,7 @@ $vcpkgRootDir = & $scriptsDir\findFileRecursivelyUp.ps1 $scriptsDir .vcpkg-root $downloadsDir = "$vcpkgRootDir\downloads" -$nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget" +$nugetexe = & $scriptsDir\fetchDependency.ps1 "nuget" 1 $nugetPackageDir = "$downloadsDir\nuget-packages" $SetupAPIVersion = "1.5.125-rc" From cf537a2623efa6c892afce3301ffb98ad46a6b1e Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sun, 12 Feb 2017 22:18:09 -0800 Subject: [PATCH 108/137] [vcpkg] Use the Registry to find VS2015 --- .../findAnyMSBuildWithCppPlatformToolset.ps1 | 60 +++++++++++++------ 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 index d160aea1251..15234a2f831 100644 --- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -1,34 +1,60 @@ [CmdletBinding()] param( + [Parameter(Mandatory=$False)] + [switch]$DisableVS2017 = $False, + [Parameter(Mandatory=$False)] + [switch]$DisableVS2015 = $False ) $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition -# VS2017 -$VisualStudio2017InstallationInstances = & $scriptsDir\findVisualStudioInstallationInstances.ps1 -foreach ($instance in $VisualStudio2017InstallationInstances) +if (-not $DisableVS2017) { - $VCFolder= "$instance\VC\Tools\MSVC\" - - if (Test-Path $VCFolder) + # VS2017 + $VisualStudio2017InstallationInstances = & $scriptsDir\findVisualStudioInstallationInstances.ps1 + foreach ($instance in $VisualStudio2017InstallationInstances) { - return "$instance\MSBuild\15.0\Bin\MSBuild.exe","v141" + $VCFolder= "$instance\VC\Tools\MSVC\" + + if (Test-Path $VCFolder) + { + return "$instance\MSBuild\15.0\Bin\MSBuild.exe","v141" + } } } -# VS2015 -$programFiles32 = & $scriptsDir\getProgramFiles32bit.ps1 -$programFilesP = & $scriptsDir\getProgramFilesPlatformBitness.ps1 -$CandidateProgramFiles = $programFiles32, $programFilesP -foreach ($ProgramFiles in $CandidateProgramFiles) +if (-not $DisableVS2015) { - $clExe= "$ProgramFiles\Microsoft Visual Studio 14.0\\VC\bin\cl.exe" - - if (Test-Path $clExe) + # Try to locate VS2015 through the Registry + try { - return "$ProgramFiles\MSBuild\14.0\Bin\MSBuild.exe","v140" + # First ensure the compiler was installed (optional in 2015) + # In 64-bit systems, this is under the Wow6432Node. + try + { + $VS14InstallDir = $(gp Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\visualstudio\14.0 InstallDir -erroraction Stop | % InstallDir) + Write-Verbose "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\visualstudio\14.0 - Found" + } + catch + { + $VS14InstallDir = $(gp Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\visualstudio\14.0 InstallDir -erroraction Stop | % InstallDir) + Write-Verbose "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\visualstudio\14.0 - Found" + } + if (!(Test-Path "${VS14InstallDir}..\..\VC\bin\cl.exe")) { throw } + Write-Verbose "${VS14InstallDir}..\..\VC\bin\cl.exe - Found" + + $MSBuild14 = $(gp Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\msbuild\toolsversions\14.0 MSBuildToolsPath -erroraction Stop | % MSBuildToolsPath) + Write-Verbose "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\msbuild\toolsversions\14.0 - Found" + if (!(Test-Path "${MSBuild14}MSBuild.exe")) { throw } + Write-Verbose "${MSBuild14}MSBuild.exe - Found" + + return "${MSBuild14}MSBuild.exe","v140" + } + catch + { + Write-Verbose "Unable to locate a VS2015 installation with C++ support" } } -throw "Could not find MSBuild with C++ support. VS2015 or above with C++ support need to be installed." \ No newline at end of file +throw "Could not find MSBuild version with C++ support. VS2015 or VS2017 (with C++) needs to be installed." \ No newline at end of file From 0dbc59da7a582612171fbc7985f71470265062b9 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 20:00:00 -0800 Subject: [PATCH 109/137] Fix script for powershell in Win7 --- .../findAnyMSBuildWithCppPlatformToolset.ps1 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 index 15234a2f831..72155b4f5d1 100644 --- a/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 +++ b/scripts/findAnyMSBuildWithCppPlatformToolset.ps1 @@ -33,19 +33,28 @@ if (-not $DisableVS2015) # In 64-bit systems, this is under the Wow6432Node. try { - $VS14InstallDir = $(gp Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\visualstudio\14.0 InstallDir -erroraction Stop | % InstallDir) + $VS14InstallDir = $(gp Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\visualstudio\14.0 InstallDir -erroraction Stop | % { $_.InstallDir }) Write-Verbose "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\visualstudio\14.0 - Found" } catch { - $VS14InstallDir = $(gp Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\visualstudio\14.0 InstallDir -erroraction Stop | % InstallDir) + $VS14InstallDir = $(gp Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\visualstudio\14.0 InstallDir -erroraction Stop | % { $_.InstallDir }) Write-Verbose "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\visualstudio\14.0 - Found" } if (!(Test-Path "${VS14InstallDir}..\..\VC\bin\cl.exe")) { throw } Write-Verbose "${VS14InstallDir}..\..\VC\bin\cl.exe - Found" - $MSBuild14 = $(gp Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\msbuild\toolsversions\14.0 MSBuildToolsPath -erroraction Stop | % MSBuildToolsPath) - Write-Verbose "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\msbuild\toolsversions\14.0 - Found" + + try + { + $MSBuild14 = $(gp Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\msbuild\toolsversions\14.0 MSBuildToolsPath -erroraction Stop | % { $_.MSBuildToolsPath }) + Write-Verbose "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\msbuild\toolsversions\14.0 - Found" + } + catch + { + $MSBuild14 = $(gp Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\msbuild\toolsversions\14.0 MSBuildToolsPath -erroraction Stop | % { $_.MSBuildToolsPath }) + Write-Verbose "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\msbuild\toolsversions\14.0 - Found" + } if (!(Test-Path "${MSBuild14}MSBuild.exe")) { throw } Write-Verbose "${MSBuild14}MSBuild.exe - Found" From 357591471820647436f2d37fc8b53912bc3f8228 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 20:38:59 -0800 Subject: [PATCH 110/137] Improve message of `vcpkg integrate install` --- toolsrc/src/commands_integrate.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/toolsrc/src/commands_integrate.cpp b/toolsrc/src/commands_integrate.cpp index aa5edeb8a89..12a45c238e6 100644 --- a/toolsrc/src/commands_integrate.cpp +++ b/toolsrc/src/commands_integrate.cpp @@ -214,10 +214,13 @@ namespace vcpkg::Commands::Integrate exit(EXIT_FAILURE); } System::println(System::color::success, "Applied user-wide integration for this vcpkg root."); + const fs::path cmake_toolchain = paths.buildsystems / "vcpkg.cmake"; System::println("\n" - "All C++ projects can now #include any installed libraries.\n" + "All MSBuild C++ projects can now #include any installed libraries.\n" "Linking will be handled automatically.\n" - "Installing new libraries will make them instantly available."); + "Installing new libraries will make them instantly available.\n" + "\n" + "CMake projects should use -DCMAKE_TOOLCHAIN_FILE=%s", cmake_toolchain.generic_string()); exit(EXIT_SUCCESS); } From 5d873f0520092cbc5c2161e4cd093eef24a7f1cf Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 16 Feb 2017 22:53:28 -0800 Subject: [PATCH 111/137] [hdf5] Fix #673 by explicitly specifying the szip libraries --- ports/hdf5/portfile.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/hdf5/portfile.cmake b/ports/hdf5/portfile.cmake index 5c421f0c619..f5454341817 100644 --- a/ports/hdf5/portfile.cmake +++ b/ports/hdf5/portfile.cmake @@ -30,6 +30,9 @@ vcpkg_configure_cmake( -DHDF5_ENABLE_SZIP_ENCODING=ON -DHDF5_INSTALL_DATA_DIR=share/hdf5/data -DHDF5_INSTALL_CMAKE_DIR=share/hdf5 + "-DSZIP_LIBRARY_DEBUG=${CURRENT_INSTALLED_DIR}\\debug\\lib\\szip_D.lib" + "-DSZIP_LIBRARY_RELEASE=${CURRENT_INSTALLED_DIR}\\lib\\szip.lib" + "-DSZIP_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}\\include" ) vcpkg_install_cmake() From 6d2b407b28417009fec0964b7339280d337dae6c Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 16 Feb 2017 23:34:22 -0800 Subject: [PATCH 112/137] [mongo-cxx-driver] Don't delete mongocxx/options/ dir --- ports/mongo-cxx-driver/CONTROL | 2 +- ports/mongo-cxx-driver/portfile.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/mongo-cxx-driver/CONTROL b/ports/mongo-cxx-driver/CONTROL index 41c95840075..57c400bed83 100644 --- a/ports/mongo-cxx-driver/CONTROL +++ b/ports/mongo-cxx-driver/CONTROL @@ -1,4 +1,4 @@ Source: mongo-cxx-driver -Version: 3.0.3 +Version: 3.0.3-1 Build-Depends: boost,libbson,mongo-c-driver Description: MongoDB C++ Driver. \ No newline at end of file diff --git a/ports/mongo-cxx-driver/portfile.cmake b/ports/mongo-cxx-driver/portfile.cmake index 13708810922..4b04af05458 100644 --- a/ports/mongo-cxx-driver/portfile.cmake +++ b/ports/mongo-cxx-driver/portfile.cmake @@ -53,7 +53,7 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/mongocxx/test_util ${CURRENT_PACKAGES_DIR}/include/mongocxx/private ${CURRENT_PACKAGES_DIR}/include/mongocxx/exception/private - ${CURRENT_PACKAGES_DIR}/include/mongocxx/options + ${CURRENT_PACKAGES_DIR}/include/mongocxx/options/private ${CURRENT_PACKAGES_DIR}/debug/include) From c1a2c79b6b59bc05df1ce06a7c18f8f14f9a5424 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 00:01:14 -0800 Subject: [PATCH 113/137] [remove-command] Reorder input processing --- toolsrc/src/commands_remove.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/commands_remove.cpp index 92ab56a282e..1daacb9445c 100644 --- a/toolsrc/src/commands_remove.cpp +++ b/toolsrc/src/commands_remove.cpp @@ -167,15 +167,13 @@ namespace vcpkg::Commands::Remove { static const std::string example = Commands::Help::create_example_string("remove zlib zlib:x64-windows curl boost"); args.check_min_arg_count(1, example); - - const std::unordered_set options = args.check_and_get_optional_command_arguments({OPTION_PURGE, OPTION_RECURSE}); - auto status_db = database_load_check(paths); - std::vector specs = Input::check_and_get_package_specs(args.command_arguments, default_target_triplet, example); Input::check_triplets(specs, paths); + const std::unordered_set options = args.check_and_get_optional_command_arguments({ OPTION_PURGE, OPTION_RECURSE }); const bool alsoRemoveFolderFromPackages = options.find(OPTION_PURGE) != options.end(); const bool isRecursive = options.find(OPTION_RECURSE) != options.end(); + auto status_db = database_load_check(paths); const std::vector remove_plan = Dependencies::create_remove_plan(specs, status_db); Checks::check_exit(!remove_plan.empty(), "Remove plan cannot be empty"); From 4a20c47bec65fc5f4e927b1b8ce513d1d49a912d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 00:05:45 -0800 Subject: [PATCH 114/137] [build-command] Reorder input processing --- toolsrc/src/commands_build.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index 10e1c75665d..38dd4cfe66f 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -115,17 +115,9 @@ namespace vcpkg::Commands::Build void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) { static const std::string example = Commands::Help::create_example_string("build zlib:x64-windows"); - - // Installing multiple packages leads to unintuitive behavior if one of them depends on another. - // Allowing only 1 package for now. - - args.check_exact_arg_count(1, example); - - StatusParagraphs status_db = database_load_check(paths); - + args.check_exact_arg_count(1, example); // Build only takes a single package and all dependencies must already be installed const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example); Input::check_triplet(spec.target_triplet(), paths); - const std::unordered_set options = args.check_and_get_optional_command_arguments({ OPTION_CHECKS_ONLY }); if (options.find(OPTION_CHECKS_ONLY) != options.end()) { @@ -143,6 +135,7 @@ namespace vcpkg::Commands::Build const SourceParagraph& spgh = *maybe_spgh.get(); Environment::ensure_utilities_on_path(paths); + StatusParagraphs status_db = database_load_check(paths); const BuildResult result = build_package(spgh, spec, paths, paths.port_dir(spec), status_db); if (result == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES) { From 532c4f6a536ae0952844b39aceef7542204938a9 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 00:16:52 -0800 Subject: [PATCH 115/137] Add vcpkg_cmd_arguments::check_no_optional_arguments() --- toolsrc/include/vcpkg_cmd_arguments.h | 1 + toolsrc/src/vcpkg_cmd_arguments.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/toolsrc/include/vcpkg_cmd_arguments.h b/toolsrc/include/vcpkg_cmd_arguments.h index 91f7de8ac1b..58bc4609847 100644 --- a/toolsrc/include/vcpkg_cmd_arguments.h +++ b/toolsrc/include/vcpkg_cmd_arguments.h @@ -20,6 +20,7 @@ namespace vcpkg std::string command; std::vector command_arguments; + void vcpkg_cmd_arguments::check_no_optional_command_arguments() const; std::unordered_set check_and_get_optional_command_arguments(const std::vector& valid_options) const; void check_max_arg_count(const size_t expected_arg_count) const; diff --git a/toolsrc/src/vcpkg_cmd_arguments.cpp b/toolsrc/src/vcpkg_cmd_arguments.cpp index fdeb6e877a5..04c381c9215 100644 --- a/toolsrc/src/vcpkg_cmd_arguments.cpp +++ b/toolsrc/src/vcpkg_cmd_arguments.cpp @@ -135,6 +135,11 @@ namespace vcpkg return args; } + void vcpkg_cmd_arguments::check_no_optional_command_arguments() const + { + this->check_and_get_optional_command_arguments({}); + } + std::unordered_set vcpkg_cmd_arguments::check_and_get_optional_command_arguments(const std::vector& valid_options) const { std::unordered_set output; From 1c3335ed66597e90a1f0b2c393522a28bff1f400 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 17 Feb 2017 01:18:32 -0800 Subject: [PATCH 116/137] [grpc+protobuf] Update to 1.1.2 and 3.2.0 respectively. --- ports/grpc/CONTROL | 2 +- ports/grpc/grpc-fix-cmake-build.patch | 13 ++++++++ ports/grpc/portfile.cmake | 45 ++++++++++----------------- ports/protobuf/CONTROL | 2 +- ports/protobuf/portfile.cmake | 20 ++++++------ 5 files changed, 42 insertions(+), 40 deletions(-) create mode 100644 ports/grpc/grpc-fix-cmake-build.patch diff --git a/ports/grpc/CONTROL b/ports/grpc/CONTROL index 3de78c477d3..3a248b44872 100644 --- a/ports/grpc/CONTROL +++ b/ports/grpc/CONTROL @@ -1,4 +1,4 @@ Source: grpc -Version: 1.1.0-dev-1674f65-2 +Version: 1.1.2-1 Build-Depends: zlib, openssl, protobuf Description: An RPC library and framework \ No newline at end of file diff --git a/ports/grpc/grpc-fix-cmake-build.patch b/ports/grpc/grpc-fix-cmake-build.patch new file mode 100644 index 00000000000..95e3450369a --- /dev/null +++ b/ports/grpc/grpc-fix-cmake-build.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d52e199..30ed816 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2072,6 +2072,8 @@ foreach(_hdr + include/grpc/impl/codegen/sync_generic.h + include/grpc/impl/codegen/sync_posix.h + include/grpc/impl/codegen/sync_windows.h ++ include/grpc++/impl/codegen/proto_utils.h ++ include/grpc++/impl/codegen/config_protobuf.h + ) + string(REPLACE "include/" "" _path ${_hdr}) + get_filename_component(_path ${_path} PATH) diff --git a/ports/grpc/portfile.cmake b/ports/grpc/portfile.cmake index ba511a0043c..c6239d8c36c 100644 --- a/ports/grpc/portfile.cmake +++ b/ports/grpc/portfile.cmake @@ -3,39 +3,28 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) set(VCPKG_LIBRARY_LINKAGE static) endif() include(vcpkg_common_functions) -find_program(GIT git) -set(GIT_URL "https://github.com/grpc/grpc.git") -set(GIT_REV "1674f650ad9411448a35b7c19c5dbdaf0ebd8916") +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/grpc-1.1.2) -if(NOT EXISTS "${DOWNLOADS}/grpc.git") - message(STATUS "Cloning") - vcpkg_execute_required_process( - COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/grpc.git - WORKING_DIRECTORY ${DOWNLOADS} - LOGNAME clone - ) +if(EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git") + file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src) endif() -message(STATUS "Cloning done") -if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git") - message(STATUS "Adding worktree") - vcpkg_execute_required_process( - COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_REV} - WORKING_DIRECTORY ${DOWNLOADS}/grpc.git - LOGNAME worktree - ) - message(STATUS "Updating sumbodules") - vcpkg_execute_required_process( - COMMAND ${GIT} submodule update --init third_party/nanopb - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src - LOGNAME submodule - ) -endif() -message(STATUS "Adding worktree and updating sumbodules done") +vcpkg_download_distfile(ARCHIVE_FILE + URLS "https://github.com/grpc/grpc/archive/v1.1.2.zip" + FILENAME "grpc-v1.1.2.tar.gz" + SHA512 6e0666ecb72f0a78148fadf627e05b5ba0f1c893919f1e691775d09374e7c4b9b05ff1d276e716ac2a81eb2a3fb88c4a095928589286d2f083bd60539050f5d9 +) +vcpkg_extract_source_archive(${ARCHIVE_FILE}) + +# patch is from https://github.com/grpc/grpc/commit/a5fac1f8a00b0ba6ca784baa4783ab947579693b +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/grpc-fix-cmake-build.patch +) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src + SOURCE_PATH ${SOURCE_PATH} OPTIONS -DgRPC_INSTALL=ON -DgRPC_ZLIB_PROVIDER=package @@ -66,7 +55,7 @@ string(REPLACE "\${_IMPORT_PREFIX}/bin/" "\${_IMPORT_PREFIX}/tools/" _contents " string(REPLACE "\${_IMPORT_PREFIX}/lib/" "\${_IMPORT_PREFIX}/debug/lib/" _contents "${_contents}") file(WRITE ${CURRENT_PACKAGES_DIR}/share/grpc/gRPCTargets-debug.cmake "${_contents}") -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/grpc RENAME copyright) +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/grpc RENAME copyright) file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools) file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/grpc_cpp_plugin.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools) diff --git a/ports/protobuf/CONTROL b/ports/protobuf/CONTROL index 795213a3304..95e7e367c48 100644 --- a/ports/protobuf/CONTROL +++ b/ports/protobuf/CONTROL @@ -1,4 +1,4 @@ Source: protobuf -Version: 3.0.2 +Version: 3.2.0 Build-Depends: zlib Description: Protocol Buffers - Google's data interchange format \ No newline at end of file diff --git a/ports/protobuf/portfile.cmake b/ports/protobuf/portfile.cmake index 5853c1e4ac2..2d7cecf657e 100644 --- a/ports/protobuf/portfile.cmake +++ b/ports/protobuf/portfile.cmake @@ -1,20 +1,20 @@ #tool include(vcpkg_common_functions) vcpkg_download_distfile(ARCHIVE_FILE - URLS "https://github.com/google/protobuf/releases/download/v3.0.2/protobuf-cpp-3.0.2.tar.gz" - FILENAME "protobuf-cpp-3.0.2.tar.gz" - SHA512 5c99fa5d20815f9333a1e30d4da7621375e179abab6e4369ef0827b6ea6a679afbfec445dda21a72b4ab11e1bdd72c0f17a4e86b153ea8e2d3298dc3bcfcd643 + URLS "https://github.com/google/protobuf/releases/download/v3.2.0/protobuf-cpp-3.2.0.tar.gz" + FILENAME "protobuf-cpp-3.2.0.tar.gz" + SHA512 dd005f5e862ff24bb233b9eaed1d7f44c42f1cc8c647c0839fe2ecc2d91178845195d79776cfa2e31d224c16eed11b05ad824b66b743e685334057d8180f17aa ) vcpkg_download_distfile(TOOL_ARCHIVE_FILE - URLS "https://github.com/google/protobuf/releases/download/v3.0.2/protoc-3.0.2-win32.zip" - FILENAME "protoc-3.0.2-win32.zip" - SHA512 51c67bd8bdc35810da70786d873935814679c58b74e653923671bdf06b8b69a1c9a0793d090b17d25e91ddafff1726bcfcdd243373dd47c4aeb9ea83fbabaeb0 + URLS "https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-win32.zip" + FILENAME "protoc-3.2.0-win32.zip" + SHA512 985c86a04cebacfba96f3985d1b3d6ef341470171b809c6f6362bc13a07a3df9c8962d912857bb764bf8634cf676c5f8453c43b4e0a6398f2ff314708975d1e4 ) vcpkg_extract_source_archive(${ARCHIVE_FILE}) -vcpkg_extract_source_archive(${TOOL_ARCHIVE_FILE} ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.0.2-win32) +vcpkg_extract_source_archive(${TOOL_ARCHIVE_FILE} ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.2.0-win32) vcpkg_configure_cmake( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.0.2/cmake + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.2.0/cmake OPTIONS -Dprotobuf_BUILD_SHARED_LIBS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF @@ -52,6 +52,6 @@ protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/share) protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/bin) protobuf_try_remove_recurse_wait(${CURRENT_PACKAGES_DIR}/debug/bin) -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.0.2/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/protobuf RENAME copyright) -file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.0.2-win32/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.2.0/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/protobuf RENAME copyright) +file(INSTALL ${CURRENT_BUILDTREES_DIR}/src/protobuf-3.2.0-win32/bin/protoc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools) vcpkg_copy_pdbs() From ff222fac454449b2fc108bf5271e1823db54d3da Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 14:55:37 -0800 Subject: [PATCH 117/137] [build_command] Extract function for calculations after Input processing --- toolsrc/include/vcpkg_Commands.h | 1 + toolsrc/src/commands_build.cpp | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 5c643d017ea..7956cdab8da 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -29,6 +29,7 @@ namespace vcpkg::Commands std::string create_user_troubleshooting_message(const package_spec& spec); BuildResult build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir, const StatusParagraphs& status_db); + void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set& options, const vcpkg_paths& paths); void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); } diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index 38dd4cfe66f..eaba531cb84 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -112,13 +112,8 @@ namespace vcpkg::Commands::Build , spec.toString(), Info::version()); } - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set& options, const vcpkg_paths& paths) { - 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 - const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example); - Input::check_triplet(spec.target_triplet(), paths); - const std::unordered_set options = args.check_and_get_optional_command_arguments({ OPTION_CHECKS_ONLY }); if (options.find(OPTION_CHECKS_ONLY) != options.end()) { const size_t error_count = PostBuildLint::perform_all_checks(spec, paths); @@ -129,8 +124,7 @@ namespace vcpkg::Commands::Build exit(EXIT_SUCCESS); } - // Explicitly load and use the portfile's build dependencies when resolving the build command (instead of a cached package's dependencies). - const expected maybe_spgh = try_load_port(paths, spec.name()); + const expected maybe_spgh = try_load_port(port_dir); Checks::check_exit(!maybe_spgh.error_code(), "Could not find package named %s: %s", spec, maybe_spgh.error_code().message()); const SourceParagraph& spgh = *maybe_spgh.get(); @@ -168,4 +162,14 @@ namespace vcpkg::Commands::Build exit(EXIT_SUCCESS); } + + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + { + 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 + const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example); + Input::check_triplet(spec.target_triplet(), paths); + const std::unordered_set options = args.check_and_get_optional_command_arguments({ OPTION_CHECKS_ONLY }); + perform_and_exit(spec, paths.port_dir(spec), options, paths); + } } From b4304c9c995d7984566ed28294836bccbdfc24b2 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:09:15 -0800 Subject: [PATCH 118/137] `build-external` now calls code from `build` after input processing --- toolsrc/src/commands_build_external.cpp | 32 ++++--------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/commands_build_external.cpp index 0b401031040..06bd1374c5a 100644 --- a/toolsrc/src/commands_build_external.cpp +++ b/toolsrc/src/commands_build_external.cpp @@ -3,7 +3,6 @@ #include "vcpkg_System.h" #include "vcpkg_Environment.h" #include "vcpkg_Input.h" -#include "vcpkglib.h" namespace vcpkg::Commands::BuildExternal { @@ -11,32 +10,11 @@ namespace vcpkg::Commands::BuildExternal { static const std::string example = Commands::Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)"); args.check_exact_arg_count(2, example); + const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example); + Input::check_triplet(spec.target_triplet(), paths); + const std::unordered_set options = args.check_and_get_optional_command_arguments({}); - StatusParagraphs status_db = database_load_check(paths); - - expected maybe_current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet); - if (auto spec = maybe_current_spec.get()) - { - Input::check_triplet(spec->target_triplet(), paths); - Environment::ensure_utilities_on_path(paths); - const fs::path port_dir = args.command_arguments.at(1); - const expected maybe_spgh = try_load_port(port_dir); - if (auto spgh = maybe_spgh.get()) - { - const Build::BuildResult result = Commands::Build::build_package(*spgh, *spec, paths, port_dir, status_db); - if (result != Build::BuildResult::SUCCEEDED) - { - System::println(System::color::error, Build::create_error_message(result, *spec)); - System::println(Build::create_user_troubleshooting_message(*spec)); - exit(EXIT_FAILURE); - } - - exit(EXIT_SUCCESS); - } - } - - System::println(System::color::error, "Error: %s: %s", maybe_current_spec.error_code().message(), args.command_arguments[0]); - Commands::Help::print_example(Strings::format("%s zlib:x64-windows", args.command)); - exit(EXIT_FAILURE); + const fs::path port_dir = args.command_arguments.at(1); + Build::perform_and_exit(spec, port_dir, options, paths); } } From 71b985dd032c37fd88010b70fd03dc4a5cfa9cf9 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:10:43 -0800 Subject: [PATCH 119/137] Remove try_load_port() overload --- toolsrc/include/vcpkglib.h | 5 ----- toolsrc/src/vcpkg_Dependencies.cpp | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkglib.h index b1653d19779..50635589a29 100644 --- a/toolsrc/include/vcpkglib.h +++ b/toolsrc/include/vcpkglib.h @@ -22,10 +22,5 @@ namespace vcpkg expected try_load_port(const fs::path& control_path); - inline expected try_load_port(const vcpkg_paths& paths, const std::string& name) - { - return try_load_port(paths.ports / name); - } - expected try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec); } // namespace vcpkg diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg_Dependencies.cpp index 957814e6e64..b255cc77b6d 100644 --- a/toolsrc/src/vcpkg_Dependencies.cpp +++ b/toolsrc/src/vcpkg_Dependencies.cpp @@ -80,7 +80,7 @@ namespace vcpkg::Dependencies continue; } - expected maybe_spgh = try_load_port(paths, spec.name()); + expected maybe_spgh = try_load_port(paths.port_dir(spec)); SourceParagraph* spgh = maybe_spgh.get(); Checks::check_exit(spgh != nullptr, "Cannot find package %s", spec.name()); process_dependencies(filter_dependencies(spgh->depends, spec.target_triplet())); From e99e577dc937bfca09ccb2afff92c1bb1be457bf Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:22:49 -0800 Subject: [PATCH 120/137] `install`: check for --options and delay loading of status_db --- toolsrc/src/commands_install.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/commands_install.cpp index 9757e171d03..4ae311f8368 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/commands_install.cpp @@ -187,10 +187,11 @@ namespace vcpkg::Commands::Install { static const std::string example = Commands::Help::create_example_string("install zlib zlib:x64-windows curl boost"); args.check_min_arg_count(1, example); - StatusParagraphs status_db = database_load_check(paths); - std::vector specs = Input::check_and_get_package_specs(args.command_arguments, default_target_triplet, example); Input::check_triplets(specs, paths); + args.check_and_get_optional_command_arguments({}); + + StatusParagraphs status_db = database_load_check(paths); std::vector install_plan = Dependencies::create_install_plan(paths, specs, status_db); Checks::check_exit(!install_plan.empty(), "Install plan cannot be empty"); From 4cbd4e0cc8e315b65641a2a796b45f6af14c9c0b Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:29:32 -0800 Subject: [PATCH 121/137] `ci`: Check for --options, delay loading status_db, refactor --- toolsrc/src/commands_ci.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/commands_ci.cpp index 178d8ae1b7e..db37db1236e 100644 --- a/toolsrc/src/commands_ci.cpp +++ b/toolsrc/src/commands_ci.cpp @@ -14,17 +14,10 @@ namespace vcpkg::Commands::CI using Dependencies::install_plan_type; using Build::BuildResult; - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + static std::vector load_all_package_specs(const fs::path& directory, const triplet& target_triplet) { - static const std::string example = Commands::Help::create_example_string("ci x64-windows"); - args.check_max_arg_count(1, example); - const triplet target_triplet = args.command_arguments.size() == 1 ? triplet::from_canonical_name(args.command_arguments.at(0)) : default_target_triplet; - Input::check_triplet(target_triplet, paths); - - StatusParagraphs status_db = database_load_check(paths); - std::vector port_folders; - Files::non_recursive_find_matching_paths_in_dir(paths.ports, [](const fs::path& current) + Files::non_recursive_find_matching_paths_in_dir(directory, [](const fs::path& current) { return fs::is_directory(current); }, &port_folders); @@ -35,6 +28,19 @@ namespace vcpkg::Commands::CI specs.push_back(package_spec::from_name_and_triplet(p.filename().generic_string(), target_triplet).get_or_throw()); } + return specs; + } + + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) + { + static const std::string example = Commands::Help::create_example_string("ci x64-windows"); + args.check_max_arg_count(1, example); + const triplet target_triplet = args.command_arguments.size() == 1 ? triplet::from_canonical_name(args.command_arguments.at(0)) : default_target_triplet; + Input::check_triplet(target_triplet, paths); + args.check_and_get_optional_command_arguments({}); + const std::vector specs = load_all_package_specs(paths.ports, target_triplet); + + StatusParagraphs status_db = database_load_check(paths); const std::vector install_plan = Dependencies::create_install_plan(paths, specs, status_db); Checks::check_exit(!install_plan.empty(), "Install plan cannot be empty"); From e47f62aceae3a2478cb852d22fa8d7eb7412f117 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:32:10 -0800 Subject: [PATCH 122/137] `update`: check for --options --- toolsrc/src/commands_update.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/toolsrc/src/commands_update.cpp b/toolsrc/src/commands_update.cpp index a42ae5341dc..3aa7a499fa6 100644 --- a/toolsrc/src/commands_update.cpp +++ b/toolsrc/src/commands_update.cpp @@ -11,6 +11,7 @@ namespace vcpkg::Commands::Update void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { args.check_exact_arg_count(0); + args.check_and_get_optional_command_arguments({}); System::println("Using local portfile versions. To update the local portfiles, use `git pull`."); auto status_db = database_load_check(paths); From 21729d3d43a1369014b60e2af368a3e48ae5c82f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:33:14 -0800 Subject: [PATCH 123/137] `create`/`edit`: check for --options --- toolsrc/src/commands_create.cpp | 3 ++- toolsrc/src/commands_edit.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp index 5042ab97b6f..494c2aa08d1 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/commands_create.cpp @@ -12,8 +12,9 @@ namespace vcpkg::Commands::Create static const std::string example = Commands::Help::create_example_string(R"###(create zlib2 http://zlib.net/zlib128.zip "zlib128-2.zip")###"); args.check_max_arg_count(3, example); args.check_min_arg_count(2, example); - + args.check_and_get_optional_command_arguments({}); const std::string port_name = args.command_arguments.at(0); + Environment::ensure_utilities_on_path(paths); // Space OR define the FILENAME with proper spacing diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index 50308cec916..5a2433e5acb 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -10,6 +10,7 @@ namespace vcpkg::Commands::Edit { 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({}); const std::string port_name = args.command_arguments.at(0); const fs::path portpath = paths.ports / port_name; From 02eeb834b1b62957191f3ff8b318af0837e3fd96 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:38:02 -0800 Subject: [PATCH 124/137] `cache`/`list`/`own`/`search`: check for --options --- toolsrc/src/commands_cache.cpp | 1 + toolsrc/src/commands_list.cpp | 1 + toolsrc/src/commands_owns.cpp | 1 + toolsrc/src/commands_search.cpp | 1 + 4 files changed, 4 insertions(+) diff --git a/toolsrc/src/commands_cache.cpp b/toolsrc/src/commands_cache.cpp index fa49a647ffe..e255b5dff73 100644 --- a/toolsrc/src/commands_cache.cpp +++ b/toolsrc/src/commands_cache.cpp @@ -40,6 +40,7 @@ namespace vcpkg::Commands::Cache static const std::string example = Strings::format( "The argument should be a substring to search for, or no argument to display all cached libraries.\n%s", Commands::Help::create_example_string("cache png")); args.check_max_arg_count(1, example); + args.check_and_get_optional_command_arguments({}); const std::vector binary_paragraphs = read_all_binary_paragraphs(paths); if (binary_paragraphs.empty()) diff --git a/toolsrc/src/commands_list.cpp b/toolsrc/src/commands_list.cpp index 34a9c2fc830..7bfc11f1b0b 100644 --- a/toolsrc/src/commands_list.cpp +++ b/toolsrc/src/commands_list.cpp @@ -19,6 +19,7 @@ namespace vcpkg::Commands::List static const std::string example = Strings::format( "The argument should be a substring to search for, or no argument to display all installed libraries.\n%s", Commands::Help::create_example_string("list png")); args.check_max_arg_count(1, example); + args.check_and_get_optional_command_arguments({}); const StatusParagraphs status_paragraphs = database_load_check(paths); std::vector installed_packages; diff --git a/toolsrc/src/commands_owns.cpp b/toolsrc/src/commands_owns.cpp index 6c4c20c4458..16bb986e2f1 100644 --- a/toolsrc/src/commands_owns.cpp +++ b/toolsrc/src/commands_owns.cpp @@ -26,6 +26,7 @@ namespace vcpkg::Commands::Owns { static const std::string example = Strings::format("The argument should be a pattern to search for. %s", Commands::Help::create_example_string("owns zlib.dll")); args.check_exact_arg_count(1, example); + args.check_and_get_optional_command_arguments({}); StatusParagraphs status_db = database_load_check(paths); search_file(paths, args.command_arguments[0], status_db); diff --git a/toolsrc/src/commands_search.cpp b/toolsrc/src/commands_search.cpp index 3a3226e4b2a..5dba711492f 100644 --- a/toolsrc/src/commands_search.cpp +++ b/toolsrc/src/commands_search.cpp @@ -46,6 +46,7 @@ namespace vcpkg::Commands::Search static const std::string example = Strings::format("The argument should be a substring to search for, or no argument to display all libraries.\n%s", Commands::Help::create_example_string("search png")); args.check_max_arg_count(1, example); + args.check_and_get_optional_command_arguments({}); const std::vector source_paragraphs = read_all_source_paragraphs(paths); From 4313d8f398e12093b866fa8029b712c86f1bc127 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:38:39 -0800 Subject: [PATCH 125/137] `owns`: check for --options --- toolsrc/include/vcpkg_Commands.h | 10 +++++----- toolsrc/src/commands_import.cpp | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 7956cdab8da..907190bfce6 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -79,11 +79,6 @@ namespace vcpkg::Commands void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); } - namespace Import - { - void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); - } - namespace Owns { void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); @@ -94,6 +89,11 @@ namespace vcpkg::Commands void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); } + namespace Import + { + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); + } + namespace Integrate { extern const char*const INTEGRATE_COMMAND_HELPSTRING; diff --git a/toolsrc/src/commands_import.cpp b/toolsrc/src/commands_import.cpp index 7af2c7185d0..4b71fc29014 100644 --- a/toolsrc/src/commands_import.cpp +++ b/toolsrc/src/commands_import.cpp @@ -79,6 +79,7 @@ namespace vcpkg::Commands::Import { static const std::string example = Commands::Help::create_example_string(R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)"); args.check_exact_arg_count(3, example); + args.check_and_get_optional_command_arguments({}); const fs::path control_file_path(args.command_arguments[0]); const fs::path include_directory(args.command_arguments[1]); From 6b9222f166aed28b6ee7bfba1de6f400c1643857 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:45:38 -0800 Subject: [PATCH 126/137] `integrate`: checks for --options --- toolsrc/src/commands_integrate.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/toolsrc/src/commands_integrate.cpp b/toolsrc/src/commands_integrate.cpp index 12a45c238e6..94af19e9635 100644 --- a/toolsrc/src/commands_integrate.cpp +++ b/toolsrc/src/commands_integrate.cpp @@ -296,6 +296,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console static const std::string example = Strings::format("Commands:\n" "%s", INTEGRATE_COMMAND_HELPSTRING); args.check_exact_arg_count(1, example); + args.check_and_get_optional_command_arguments({}); if (args.command_arguments[0] == "install") { From 4e44b8533d1df94dd2405674086377d06b3690a7 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:46:35 -0800 Subject: [PATCH 127/137] `portsdiff`: Check for --options --- toolsrc/src/commands_portsdiff.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/toolsrc/src/commands_portsdiff.cpp b/toolsrc/src/commands_portsdiff.cpp index e75633b3cbf..119997485ca 100644 --- a/toolsrc/src/commands_portsdiff.cpp +++ b/toolsrc/src/commands_portsdiff.cpp @@ -98,6 +98,7 @@ namespace vcpkg::Commands::PortsDiff static const std::string example = Strings::format("The argument should be a branch/tag/hash to checkout.\n%s", Commands::Help::create_example_string("portsdiff mybranchname")); args.check_min_arg_count(1, example); args.check_max_arg_count(2, example); + args.check_and_get_optional_command_arguments({}); Environment::ensure_git_on_path(paths); const std::wstring git_commit_id_for_previous_snapshot = Strings::utf8_to_utf16(args.command_arguments.at(0)); From b890a9033cde8844566c0f4b8f986f8c44008ebb Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:52:45 -0800 Subject: [PATCH 128/137] `contact`/`help`/`version`: Check for --options --- toolsrc/src/commands_contact.cpp | 2 ++ toolsrc/src/commands_help.cpp | 2 ++ toolsrc/src/commands_version.cpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/toolsrc/src/commands_contact.cpp b/toolsrc/src/commands_contact.cpp index 2be468fb8cb..c5b8cab7e84 100644 --- a/toolsrc/src/commands_contact.cpp +++ b/toolsrc/src/commands_contact.cpp @@ -8,6 +8,8 @@ namespace vcpkg::Commands::Contact void perform_and_exit(const vcpkg_cmd_arguments& args) { args.check_exact_arg_count(0); + args.check_and_get_optional_command_arguments({}); + System::println("Send an email to %s with any feedback.", Info::email()); exit(EXIT_SUCCESS); } diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/commands_help.cpp index 6068c22fb5d..49b5697c322 100644 --- a/toolsrc/src/commands_help.cpp +++ b/toolsrc/src/commands_help.cpp @@ -67,6 +67,8 @@ namespace vcpkg::Commands::Help void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { args.check_max_arg_count(1); + args.check_and_get_optional_command_arguments({}); + if (args.command_arguments.empty()) { print_usage(); diff --git a/toolsrc/src/commands_version.cpp b/toolsrc/src/commands_version.cpp index a521b2567c0..3dd90e63008 100644 --- a/toolsrc/src/commands_version.cpp +++ b/toolsrc/src/commands_version.cpp @@ -8,6 +8,8 @@ namespace vcpkg::Commands::Version void perform_and_exit(const vcpkg_cmd_arguments& args) { args.check_exact_arg_count(0); + args.check_and_get_optional_command_arguments({}); + System::println("Vcpkg package management program version %s\n" "\n" "See LICENSE.txt for license information.", Info::version() From 573fc23f64fa5d3193d8331484d88864c2a0f237 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:53:05 -0800 Subject: [PATCH 129/137] `hash` check for --options --- toolsrc/src/commands_hash.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/toolsrc/src/commands_hash.cpp b/toolsrc/src/commands_hash.cpp index 4c0028f53db..805da4153a6 100644 --- a/toolsrc/src/commands_hash.cpp +++ b/toolsrc/src/commands_hash.cpp @@ -30,6 +30,7 @@ namespace vcpkg::Commands::Hash "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_and_get_optional_command_arguments({}); if (args.command_arguments.size() == 1) { From 39772adbfe37b03f7302b3a0d974404519c643ce Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:53:18 -0800 Subject: [PATCH 130/137] Remove unused function --- toolsrc/include/vcpkg_cmd_arguments.h | 1 - toolsrc/src/vcpkg_cmd_arguments.cpp | 5 ----- 2 files changed, 6 deletions(-) diff --git a/toolsrc/include/vcpkg_cmd_arguments.h b/toolsrc/include/vcpkg_cmd_arguments.h index 58bc4609847..91f7de8ac1b 100644 --- a/toolsrc/include/vcpkg_cmd_arguments.h +++ b/toolsrc/include/vcpkg_cmd_arguments.h @@ -20,7 +20,6 @@ namespace vcpkg std::string command; std::vector command_arguments; - void vcpkg_cmd_arguments::check_no_optional_command_arguments() const; std::unordered_set check_and_get_optional_command_arguments(const std::vector& valid_options) const; void check_max_arg_count(const size_t expected_arg_count) const; diff --git a/toolsrc/src/vcpkg_cmd_arguments.cpp b/toolsrc/src/vcpkg_cmd_arguments.cpp index 04c381c9215..fdeb6e877a5 100644 --- a/toolsrc/src/vcpkg_cmd_arguments.cpp +++ b/toolsrc/src/vcpkg_cmd_arguments.cpp @@ -135,11 +135,6 @@ namespace vcpkg return args; } - void vcpkg_cmd_arguments::check_no_optional_command_arguments() const - { - this->check_and_get_optional_command_arguments({}); - } - std::unordered_set vcpkg_cmd_arguments::check_and_get_optional_command_arguments(const std::vector& valid_options) const { std::unordered_set output; From 536e18c7cffe7394099ab48160a0dc2619a5e24f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 16:54:29 -0800 Subject: [PATCH 131/137] [libmysql] Disable installer project Fixes build failure when you have WiX installed in your system and you are using the VS2017 toolset --- ports/libmysql/CONTROL | 2 +- ports/libmysql/portfile.cmake | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/libmysql/CONTROL b/ports/libmysql/CONTROL index 4e5564972d9..90624993661 100644 --- a/ports/libmysql/CONTROL +++ b/ports/libmysql/CONTROL @@ -1,3 +1,3 @@ Source: libmysql -Version: 5.7.17 +Version: 5.7.17-1 Description: A MySQL client library for C development. \ No newline at end of file diff --git a/ports/libmysql/portfile.cmake b/ports/libmysql/portfile.cmake index 4d711fef57a..530732b71ab 100644 --- a/ports/libmysql/portfile.cmake +++ b/ports/libmysql/portfile.cmake @@ -24,6 +24,7 @@ vcpkg_configure_cmake( -DWITHOUT_SERVER=ON -DWITH_UNIT_TESTS=OFF -DENABLED_PROFILING=OFF + -DWIX_DIR=OFF ) vcpkg_install_cmake() From 7ae6c2152686467ab81663e6d7d259f475c0229d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 17:46:34 -0800 Subject: [PATCH 132/137] [clockutils] Update to fix build issue. Resolves #677 --- ports/clockutils/CONTROL | 2 +- ports/clockutils/portfile.cmake | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ports/clockutils/CONTROL b/ports/clockutils/CONTROL index 4ade8d5f0cb..8f88e71ec8f 100644 --- a/ports/clockutils/CONTROL +++ b/ports/clockutils/CONTROL @@ -1,3 +1,3 @@ Source: clockutils -Version: 1.1.1 +Version: 1.1.1-3651f232c27074c4ceead169e223edf5f00247c5 Description: A lightweight c++ library for commonly needed tasks. Optimized for simplicity and speed. diff --git a/ports/clockutils/portfile.cmake b/ports/clockutils/portfile.cmake index 2c75495d9d5..33f0b1f834d 100644 --- a/ports/clockutils/portfile.cmake +++ b/ports/clockutils/portfile.cmake @@ -1,9 +1,10 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/clockUtils-1.1.1) +set(VERSION 3651f232c27074c4ceead169e223edf5f00247c5) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/clockUtils-${VERSION}) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/ClockworkOrigins/clockUtils/archive/1.1.1.tar.gz" - FILENAME "clockUtils-1.1.1.tar.gz" - SHA512 6b0c57862baf04c0c5529549ba13983e53445172d9a272571aa20968ba6dba15f1cf480096ca100d450218fef090805366d0564c77a4aa4721a4fe694a0481c9 + URLS "https://github.com/ClockworkOrigins/clockUtils/archive/${VERSION}.tar.gz" + FILENAME "clockUtils-${VERSION}.tar.gz" + SHA512 ddb70cae9ced25de77a2df1854dac15e58a77347042ba3ee9c691f85f49edbc6539c84929a7477d429fb9161ba24c57d24d767793b8b1180216d5ddfc5d3ed6a ) vcpkg_extract_source_archive(${ARCHIVE}) From ac2ec94129ae0bdbcb16c0c2333fbfc52844d6c6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 20:08:29 -0800 Subject: [PATCH 133/137] Change Info::version() to Version::version() --- toolsrc/include/vcpkg_Commands.h | 1 + toolsrc/include/vcpkg_info.h | 2 -- toolsrc/src/commands_build.cpp | 2 +- toolsrc/src/commands_update.cpp | 2 +- toolsrc/src/commands_version.cpp | 27 +++++++++++++++++++++++++-- toolsrc/src/vcpkg.cpp | 4 ++-- toolsrc/src/vcpkg_info.cpp | 24 ------------------------ 7 files changed, 30 insertions(+), 32 deletions(-) diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 907190bfce6..3c3ae03c6a5 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -121,6 +121,7 @@ namespace vcpkg::Commands namespace Version { + const std::string& version(); void perform_and_exit(const vcpkg_cmd_arguments& args); } diff --git a/toolsrc/include/vcpkg_info.h b/toolsrc/include/vcpkg_info.h index 5380e015888..ebd87fd86ed 100644 --- a/toolsrc/include/vcpkg_info.h +++ b/toolsrc/include/vcpkg_info.h @@ -4,7 +4,5 @@ namespace vcpkg::Info { - const std::string& version(); - const std::string& email(); } diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index eaba531cb84..d01d40ef44c 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -109,7 +109,7 @@ namespace vcpkg::Commands::Build " Vcpkg version: %s\n" "\n" "Additionally, attach any relevant sections from the log files above." - , spec.toString(), Info::version()); + , spec.toString(), Version::version()); } void perform_and_exit(const package_spec& spec, const fs::path& port_dir, const std::unordered_set& options, const vcpkg_paths& paths) diff --git a/toolsrc/src/commands_update.cpp b/toolsrc/src/commands_update.cpp index 3aa7a499fa6..3ac6694b948 100644 --- a/toolsrc/src/commands_update.cpp +++ b/toolsrc/src/commands_update.cpp @@ -80,7 +80,7 @@ namespace vcpkg::Commands::Update auto num1 = sscanf_s(version_contents->c_str(), "\"%d.%d.%d\"", &maj1, &min1, &rev1); int maj2, min2, rev2; - auto num2 = sscanf_s(Info::version().c_str(), "%d.%d.%d-", &maj2, &min2, &rev2); + auto num2 = sscanf_s(Version::version().c_str(), "%d.%d.%d-", &maj2, &min2, &rev2); if (num1 == 3 && num2 == 3) { diff --git a/toolsrc/src/commands_version.cpp b/toolsrc/src/commands_version.cpp index 3dd90e63008..462c31c904b 100644 --- a/toolsrc/src/commands_version.cpp +++ b/toolsrc/src/commands_version.cpp @@ -1,10 +1,33 @@ #include "pch.h" #include "vcpkg_Commands.h" #include "vcpkg_System.h" -#include "vcpkg_info.h" +#include "metrics.h" + +#define STRINGIFY(X) #X +#define MACRO_TO_STRING(X) STRINGIFY(X) + +#define VCPKG_VERSION_AS_STRING MACRO_TO_STRING(VCPKG_VERSION)"" // Double quotes needed at the end to prevent blank token namespace vcpkg::Commands::Version { + const std::string& version() + { + static const std::string s_version = +#include "../VERSION.txt" + + +#pragma warning( push ) +#pragma warning( disable : 4003) + // VCPKG_VERSION can be defined but have no value, which yields C4003. + + std::string(VCPKG_VERSION_AS_STRING) +#pragma warning( pop ) +#ifndef NDEBUG + + std::string("-debug") +#endif + + std::string(GetCompiledMetricsEnabled() ? "" : "-external"); + return s_version; + } + void perform_and_exit(const vcpkg_cmd_arguments& args) { args.check_exact_arg_count(0); @@ -12,7 +35,7 @@ namespace vcpkg::Commands::Version System::println("Vcpkg package management program version %s\n" "\n" - "See LICENSE.txt for license information.", Info::version() + "See LICENSE.txt for license information.", version() ); exit(EXIT_SUCCESS); } diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 15310905367..16c9cb07733 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -192,7 +192,7 @@ int wmain(const int argc, const wchar_t* const* const argv) Flush(); }); - TrackProperty("version", Info::version()); + TrackProperty("version", Commands::Version::version()); const std::string trimmed_command_line = trim_path_from_command_line(Strings::utf16_to_utf8(GetCommandLineW())); TrackProperty("cmdline", trimmed_command_line); @@ -238,7 +238,7 @@ int wmain(const int argc, const wchar_t* const* const argv) << " " << Info::email() << "\n" << "containing a brief summary of what you were trying to do and the following data blob:\n" << "\n" - << "Version=" << Info::version() << "\n" + << "Version=" << Commands::Version::version() << "\n" << "EXCEPTION='" << exc_msg << "'\n" << "CMD=\n"; for (int x = 0; x < argc; ++x) diff --git a/toolsrc/src/vcpkg_info.cpp b/toolsrc/src/vcpkg_info.cpp index f8e214998bc..fa2077177a4 100644 --- a/toolsrc/src/vcpkg_info.cpp +++ b/toolsrc/src/vcpkg_info.cpp @@ -1,32 +1,8 @@ #include "pch.h" #include "vcpkg_info.h" -#include "metrics.h" - -#define STRINGIFY(X) #X -#define MACRO_TO_STRING(X) STRINGIFY(X) - -#define VCPKG_VERSION_AS_STRING MACRO_TO_STRING(VCPKG_VERSION)"" // Double quotes needed at the end to prevent blank token namespace vcpkg::Info { - const std::string& version() - { - static const std::string s_version = -#include "../VERSION.txt" - - -#pragma warning( push ) -#pragma warning( disable : 4003) - // VCPKG_VERSION can be defined but have no value, which yields C4003. - + std::string(VCPKG_VERSION_AS_STRING) -#pragma warning( pop ) -#ifndef NDEBUG - + std::string("-debug") -#endif - + std::string(GetCompiledMetricsEnabled() ? "" : "-external"); - return s_version; - } - const std::string& email() { static const std::string s_email = R"(vcpkg@microsoft.com)"; From 43eb772d9475b4e9ec06eb54dca078a4793ab9e4 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 20:13:36 -0800 Subject: [PATCH 134/137] Change Info::email() to Contact::email(). Remove vcpkg_info.h/cpp --- toolsrc/include/vcpkg_Commands.h | 1 + toolsrc/include/vcpkg_info.h | 8 -------- toolsrc/src/commands_build.cpp | 1 - toolsrc/src/commands_contact.cpp | 11 ++++++++--- toolsrc/src/commands_update.cpp | 1 - toolsrc/src/vcpkg.cpp | 3 +-- toolsrc/src/vcpkg_info.cpp | 11 ----------- toolsrc/vcpkglib/vcpkglib.vcxproj | 2 -- toolsrc/vcpkglib/vcpkglib.vcxproj.filters | 6 ------ 9 files changed, 10 insertions(+), 34 deletions(-) delete mode 100644 toolsrc/include/vcpkg_info.h delete mode 100644 toolsrc/src/vcpkg_info.cpp diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h index 3c3ae03c6a5..544dffe721a 100644 --- a/toolsrc/include/vcpkg_Commands.h +++ b/toolsrc/include/vcpkg_Commands.h @@ -127,6 +127,7 @@ namespace vcpkg::Commands namespace Contact { + const std::string& email(); void perform_and_exit(const vcpkg_cmd_arguments& args); } diff --git a/toolsrc/include/vcpkg_info.h b/toolsrc/include/vcpkg_info.h deleted file mode 100644 index ebd87fd86ed..00000000000 --- a/toolsrc/include/vcpkg_info.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include - -namespace vcpkg::Info -{ - const std::string& email(); -} diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp index d01d40ef44c..aae30efd151 100644 --- a/toolsrc/src/commands_build.cpp +++ b/toolsrc/src/commands_build.cpp @@ -8,7 +8,6 @@ #include "vcpkg_System.h" #include "vcpkg_Environment.h" #include "metrics.h" -#include "vcpkg_info.h" #include "vcpkg_Enums.h" namespace vcpkg::Commands::Build diff --git a/toolsrc/src/commands_contact.cpp b/toolsrc/src/commands_contact.cpp index c5b8cab7e84..29f0d4d274c 100644 --- a/toolsrc/src/commands_contact.cpp +++ b/toolsrc/src/commands_contact.cpp @@ -1,16 +1,21 @@ #include "pch.h" #include "vcpkg_Commands.h" #include "vcpkg_System.h" -#include "vcpkg_info.h" namespace vcpkg::Commands::Contact { - void perform_and_exit(const vcpkg_cmd_arguments& args) + const std::string& email() + { + static const std::string s_email = R"(vcpkg@microsoft.com)"; + return s_email; + } + + void perform_and_exit(const vcpkg_cmd_arguments& args) { args.check_exact_arg_count(0); args.check_and_get_optional_command_arguments({}); - System::println("Send an email to %s with any feedback.", Info::email()); + System::println("Send an email to %s with any feedback.", email()); exit(EXIT_SUCCESS); } } diff --git a/toolsrc/src/commands_update.cpp b/toolsrc/src/commands_update.cpp index 3ac6694b948..d4519ca141c 100644 --- a/toolsrc/src/commands_update.cpp +++ b/toolsrc/src/commands_update.cpp @@ -4,7 +4,6 @@ #include "vcpkg_System.h" #include "vcpkg_Files.h" #include "Paragraphs.h" -#include "vcpkg_info.h" namespace vcpkg::Commands::Update { diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 16c9cb07733..f40126ecfe9 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -12,7 +12,6 @@ #include "vcpkg_System.h" #include "vcpkg_Input.h" #include "Paragraphs.h" -#include "vcpkg_info.h" #include "vcpkg_Strings.h" using namespace vcpkg; @@ -235,7 +234,7 @@ int wmain(const int argc, const wchar_t* const* const argv) std::cerr << "vcpkg.exe has crashed.\n" << "Please send an email to:\n" - << " " << Info::email() << "\n" + << " " << Commands::Contact::email() << "\n" << "containing a brief summary of what you were trying to do and the following data blob:\n" << "\n" << "Version=" << Commands::Version::version() << "\n" diff --git a/toolsrc/src/vcpkg_info.cpp b/toolsrc/src/vcpkg_info.cpp deleted file mode 100644 index fa2077177a4..00000000000 --- a/toolsrc/src/vcpkg_info.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "pch.h" -#include "vcpkg_info.h" - -namespace vcpkg::Info -{ - const std::string& email() - { - static const std::string s_email = R"(vcpkg@microsoft.com)"; - return s_email; - } -} diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 4c98380fa17..b96dd105003 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -173,7 +173,6 @@ - @@ -234,7 +233,6 @@ - diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 70d1b58ace6..aefba7a4901 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -45,9 +45,6 @@ Source Files - - Source Files - Source Files @@ -206,9 +203,6 @@ Header Files - - Header Files - Header Files From 128ba92feeba2f474d19a5fc738fb60338b5e70a Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 21:53:14 -0800 Subject: [PATCH 135/137] STRINGIFY: use __VA_ARGS__ to avoid C4003 and double quote hack --- toolsrc/src/commands_version.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/toolsrc/src/commands_version.cpp b/toolsrc/src/commands_version.cpp index 462c31c904b..4789e2409c6 100644 --- a/toolsrc/src/commands_version.cpp +++ b/toolsrc/src/commands_version.cpp @@ -3,10 +3,10 @@ #include "vcpkg_System.h" #include "metrics.h" -#define STRINGIFY(X) #X +#define STRINGIFY(...) #__VA_ARGS__ #define MACRO_TO_STRING(X) STRINGIFY(X) -#define VCPKG_VERSION_AS_STRING MACRO_TO_STRING(VCPKG_VERSION)"" // Double quotes needed at the end to prevent blank token +#define VCPKG_VERSION_AS_STRING MACRO_TO_STRING(VCPKG_VERSION) namespace vcpkg::Commands::Version { @@ -15,12 +15,7 @@ namespace vcpkg::Commands::Version static const std::string s_version = #include "../VERSION.txt" - -#pragma warning( push ) -#pragma warning( disable : 4003) - // VCPKG_VERSION can be defined but have no value, which yields C4003. + std::string(VCPKG_VERSION_AS_STRING) -#pragma warning( pop ) #ifndef NDEBUG + std::string("-debug") #endif From 2ab8eb3ef05eaf840389e0ea1a78489490e37983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Herrmann?= Date: Sat, 18 Feb 2017 13:11:48 +0100 Subject: [PATCH 136/137] dlib port Initial commit for dlib port --- ports/dlib/CONTROL | 3 +++ ports/dlib/portfile.cmake | 45 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 ports/dlib/CONTROL create mode 100644 ports/dlib/portfile.cmake diff --git a/ports/dlib/CONTROL b/ports/dlib/CONTROL new file mode 100644 index 00000000000..91ce3eb5750 --- /dev/null +++ b/ports/dlib/CONTROL @@ -0,0 +1,3 @@ +Source: dlib +Version: 19.2 +Description: Modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++ diff --git a/ports/dlib/portfile.cmake b/ports/dlib/portfile.cmake new file mode 100644 index 00000000000..3ef3f840ef4 --- /dev/null +++ b/ports/dlib/portfile.cmake @@ -0,0 +1,45 @@ +# Common Ambient Variables: +# VCPKG_ROOT_DIR = +# 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/dlib-19.2) +vcpkg_download_distfile(ARCHIVE + URLS "http://dlib.net/files/dlib-19.2.tar.bz2" + FILENAME "dlib-19.2.tar.bz2" + SHA512 dcef5c8be52fe2650c1eccac6c7ac4050075dc07ee504a8bf3df6c9a597da5fdc09506e631abfa979d71c74940ce39ec5267be4c3a676a01ac66fcb14cbfe854 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +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() + +# There is no way to suppress installation of the headers and resource files in debug build. +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/test) + +# Remove other files not required in package +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/all) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/cmake_utils) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/dlib/external/libpng/arm) + +# Handle copyright +#file(COPY ${SOURCE_PATH}/docs/license.html DESTINATION ${CURRENT_PACKAGES_DIR}/share/dlib) +file(COPY ${CURRENT_PACKAGES_DIR}/share/doc/dlib/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/dlib) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/dlib/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/dlib/COPYRIGHT) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc) \ No newline at end of file From 9aa7c944f21b8adec37b1da04145708ff621dcd7 Mon Sep 17 00:00:00 2001 From: pravic Date: Tue, 21 Feb 2017 08:24:14 +0300 Subject: [PATCH 137/137] Allow to use git.cmd in addition to git.exe In respect of #682 and https://cmake.org/Bug/bug_relationship_graph.php?bug_id=9879. --- scripts/cmake/vcpkg_apply_patches.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cmake/vcpkg_apply_patches.cmake b/scripts/cmake/vcpkg_apply_patches.cmake index e17d53b0870..1ef138a1e77 100644 --- a/scripts/cmake/vcpkg_apply_patches.cmake +++ b/scripts/cmake/vcpkg_apply_patches.cmake @@ -22,7 +22,7 @@ function(vcpkg_apply_patches) cmake_parse_arguments(_ap "QUIET" "SOURCE_PATH" "PATCHES" ${ARGN}) - find_program(GIT git) + find_program(GIT NAMES git git.cmd) set(PATCHNUM 0) foreach(PATCH ${_ap_PATCHES}) message(STATUS "Applying patch ${PATCH}")