diff --git a/ports/gmp/portfile.cmake b/ports/gmp/portfile.cmake index b8a289628dfc9f..e566c45a6711cb 100644 --- a/ports/gmp/portfile.cmake +++ b/ports/gmp/portfile.cmake @@ -9,14 +9,15 @@ if(VCPKG_TARGET_IS_WINDOWS) REF e140dfc8668e96d7e56cbd46467945adcc6b3cc4 #v6.2.0 SHA512 3b646c142447946bb4556db01214ff130da917bc149946b8cf086f3b01e1cc3d664b941a30a42608799c14461b2f29e4b894b72915d723bd736513c8914729b7 HEAD_REF master - PATCHES + PATCHES vs.build.patch runtime.patch prefix.patch ) - vcpkg_find_acquire_program(YASM) - get_filename_component(YASM_DIR "${YASM}" DIRECTORY) - vcpkg_add_to_path("${YASM_DIR}") + + include(${CURRENT_INSTALLED_DIR}/share/yasm-tool-helper/yasm-tool-helper.cmake) + yasm_tool_helper(OUT_VAR YASM) + file(TO_NATIVE_PATH "${YASM}" YASM) if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") set(CONFIGURATION_RELEASE ReleaseDLL) @@ -49,7 +50,7 @@ if(VCPKG_TARGET_IS_WINDOWS) STRING(REPLACE ">MultiThreaded<" ">MultiThreadedDLL<" _contents "${_contents}") endif() file(WRITE "${_file}" "${_contents}") - + vcpkg_install_msbuild( USE_VCPKG_INTEGRATION SOURCE_PATH ${SOURCE_PATH} @@ -60,7 +61,7 @@ if(VCPKG_TARGET_IS_WINDOWS) RELEASE_CONFIGURATION ${CONFIGURATION_RELEASE} DEBUG_CONFIGURATION ${CONFIGURATION_DEBUG} SKIP_CLEAN - OPTIONS /p:UseEnv=True + OPTIONS "/p:YasmPath=${YASM}" ) get_filename_component(SOURCE_PATH_SUFFIX "${SOURCE_PATH}" NAME) file(RENAME "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/${SOURCE_PATH_SUFFIX}/msvc/include" "${CURRENT_PACKAGES_DIR}/include") @@ -84,7 +85,7 @@ if(VCPKG_TARGET_IS_WINDOWS) else() vcpkg_download_distfile( ARCHIVE - URLS https://gmplib.org/download/gmp/gmp-6.2.0.tar.xz + URLS https://gmplib.org/download/gmp/gmp-6.2.0.tar.xz FILENAME gmp-6.2.0.tar.xz SHA512 a066f0456f0314a1359f553c49fc2587e484ff8ac390ff88537266a146ea373f97a1c0ba24608bf6756f4eab11c9056f103c8deb99e5b57741b4f7f0ec44b90c) @@ -107,4 +108,4 @@ else() # # Handle copyright file(INSTALL "${SOURCE_PATH}/COPYINGv3" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) -endif() \ No newline at end of file +endif() diff --git a/ports/gmp/vcpkg.json b/ports/gmp/vcpkg.json index 77b237197aa826..a0c93f2ab16d64 100644 --- a/ports/gmp/vcpkg.json +++ b/ports/gmp/vcpkg.json @@ -1,13 +1,17 @@ { "name": "gmp", "version-string": "6.2.0", - "port-version": 3, + "port-version": 5, "description": "The GNU Multiple Precision Arithmetic Library", "homepage": "https://gmplib.org", "dependencies": [ { "name": "vs-yasm", "platform": "windows" + }, + { + "name": "yasm-tool-helper", + "platform": "windows" } ] } diff --git a/ports/libvpx/CONTROL b/ports/libvpx/CONTROL index 8cdbaa470d3995..963047270f6ea3 100644 --- a/ports/libvpx/CONTROL +++ b/ports/libvpx/CONTROL @@ -1,6 +1,7 @@ Source: libvpx Version: 1.9.0 -Port-Version: 2 +Port-Version: 3 Homepage: https://github.com/webmproject/libvpx Description: The reference software implementation for the video coding formats VP8 and VP9. Supports: !(uwp&arm) +Build-Depends: yasm-tool-helper diff --git a/ports/libvpx/portfile.cmake b/ports/libvpx/portfile.cmake index 5e36511eba750a..1ff1d5c4198f35 100644 --- a/ports/libvpx/portfile.cmake +++ b/ports/libvpx/portfile.cmake @@ -10,21 +10,22 @@ vcpkg_from_github( HEAD_REF master ) -vcpkg_find_acquire_program(YASM) vcpkg_find_acquire_program(PERL) -get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) if(CMAKE_HOST_WIN32) vcpkg_acquire_msys(MSYS_ROOT PACKAGES make) set(BASH ${MSYS_ROOT}/usr/bin/bash.exe) - set(ENV{PATH} "${YASM_EXE_PATH};${MSYS_ROOT}/usr/bin;$ENV{PATH};${PERL_EXE_PATH}") + set(ENV{PATH} "${MSYS_ROOT}/usr/bin;$ENV{PATH};${PERL_EXE_PATH}") else() set(BASH /bin/bash) - set(ENV{PATH} "${YASM_EXE_PATH}:${MSYS_ROOT}/usr/bin:$ENV{PATH}:${PERL_EXE_PATH}") + set(ENV{PATH} "${MSYS_ROOT}/usr/bin:$ENV{PATH}:${PERL_EXE_PATH}") endif() +include(${CURRENT_INSTALLED_DIR}/share/yasm-tool-helper/yasm-tool-helper.cmake) +yasm_tool_helper(PREPEND_TO_PATH) + if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}) diff --git a/ports/mpg123/CONTROL b/ports/mpg123/CONTROL index 3e7705ab08f280..be249c232c5677 100644 --- a/ports/mpg123/CONTROL +++ b/ports/mpg123/CONTROL @@ -1,5 +1,6 @@ Source: mpg123 Version: 1.25.8 -Port-Version: 13 +Port-Version: 14 Homepage: https://sourceforge.net/projects/mpg123/ Description: mpg123 is a real time MPEG 1.0/2.0/2.5 audio player/decoder for layers 1, 2 and 3 (MPEG 1.0 layer 3 also known as MP3). +Build-Depends: yasm-tool-helper diff --git a/ports/mpg123/portfile.cmake b/ports/mpg123/portfile.cmake index 9438c58115e5fa..2a852b1322477d 100644 --- a/ports/mpg123/portfile.cmake +++ b/ports/mpg123/portfile.cmake @@ -36,9 +36,9 @@ vcpkg_from_sourceforge( 0004-add-arm64-uwp-config.patch ) -vcpkg_find_acquire_program(YASM) -get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) -set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH}") + +include(${CURRENT_INSTALLED_DIR}/share/yasm-tool-helper/yasm-tool-helper.cmake) +yasm_tool_helper(APPEND_TO_PATH) if(VCPKG_TARGET_IS_UWP) vcpkg_build_msbuild( diff --git a/ports/nettle/CONTROL b/ports/nettle/CONTROL index f76d214121d0c0..49308ce9580128 100644 --- a/ports/nettle/CONTROL +++ b/ports/nettle/CONTROL @@ -3,4 +3,4 @@ Version: 3.5.1 Port-Version: 4 Homepage: https://git.lysator.liu.se/nettle/nettle Description: Nettle is a low-level cryptographic library that is designed to fit easily in more or less any context: In crypto toolkits for object-oriented languages (C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in kernel space. -Build-Depends: gmp, vs-yasm (windows) \ No newline at end of file +Build-Depends: gmp, vs-yasm (windows), yasm-tool-helper (windows) diff --git a/ports/nettle/portfile.cmake b/ports/nettle/portfile.cmake index 0d7a45eafb23c5..2d3fc952abfc54 100644 --- a/ports/nettle/portfile.cmake +++ b/ports/nettle/portfile.cmake @@ -2,7 +2,7 @@ if(VCPKG_TARGET_IS_WINDOWS) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO ShiftMediaProject/nettle - REF 1d0a6e64e01458fdf37eaf5d90975deb52c3da41 #v3.5.1 + REF 1d0a6e64e01458fdf37eaf5d90975deb52c3da41 #v3.5.1 SHA512 6124fbd223e6519d88290c3f4e3b8cc399e038c9c77cfec38e6ab17b075846e662fd0360d62c132c882536489c8a865795f64059e2d2b21467f65d90320e5c39 HEAD_REF master PATCHES gmp.patch @@ -10,9 +10,10 @@ if(VCPKG_TARGET_IS_WINDOWS) runtime.nettle.patch runtime.hogweed.patch ) - vcpkg_find_acquire_program(YASM) - get_filename_component(YASM_DIR "${YASM}" DIRECTORY) - vcpkg_add_to_path("${YASM_DIR}") + + include(${CURRENT_INSTALLED_DIR}/share/yasm-tool-helper/yasm-tool-helper.cmake) + yasm_tool_helper(OUT_VAR YASM) + file(TO_NATIVE_PATH "${YASM}" YASM) if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") set(CONFIGURATION_RELEASE ReleaseDLL) @@ -27,7 +28,7 @@ if(VCPKG_TARGET_IS_WINDOWS) string(APPEND CONFIGURATION_DEBUG WinRT) endif() - #Setup YASM integration + #Setup YASM integration set(_file "${SOURCE_PATH}/SMP/libnettle.vcxproj") file(READ "${_file}" _contents) string(REPLACE [[]] @@ -62,7 +63,7 @@ if(VCPKG_TARGET_IS_WINDOWS) STRING(REPLACE ">MultiThreaded<" ">MultiThreadedDLL<" _contents "${_contents}") endif() file(WRITE "${_file}" "${_contents}") - + vcpkg_install_msbuild( USE_VCPKG_INTEGRATION SOURCE_PATH ${SOURCE_PATH} @@ -73,7 +74,7 @@ if(VCPKG_TARGET_IS_WINDOWS) RELEASE_CONFIGURATION ${CONFIGURATION_RELEASE} DEBUG_CONFIGURATION ${CONFIGURATION_DEBUG} SKIP_CLEAN - OPTIONS /p:UseEnv=True + OPTIONS "/p:YasmPath=${YASM}" ) get_filename_component(SOURCE_PATH_SUFFIX "${SOURCE_PATH}" NAME) @@ -103,12 +104,12 @@ else() GITLAB_URL https://git.lysator.liu.se/ OUT_SOURCE_PATH SOURCE_PATH REPO nettle/nettle - REF ee5d62898cf070f08beedc410a8d7c418588bd95 #v3.5.1 + REF ee5d62898cf070f08beedc410a8d7c418588bd95 #v3.5.1 SHA512 881912548f4abb21460f44334de11439749c8a055830849a8beb4332071d11d9196d9eecaeba5bf822819d242356083fba91eb8719a64f90e41766826e6d75e1 HEAD_REF master # branch name PATCHES fix-InstallLibPath.patch ) - + if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) set(OPTIONS --disable-static) else() diff --git a/ports/vs-yasm/CONTROL b/ports/vs-yasm/CONTROL deleted file mode 100644 index 68f7328a9c02e4..00000000000000 --- a/ports/vs-yasm/CONTROL +++ /dev/null @@ -1,5 +0,0 @@ -Source: vs-yasm -Version: 0.5.0 -Homepage: https://github.com/ShiftMediaProject/VSYASM -Description: Provides Visual Studio integration for the YASM assembler. -Supports: windows & !arm \ No newline at end of file diff --git a/ports/vs-yasm/fix_paths.patch b/ports/vs-yasm/fix_paths.patch new file mode 100644 index 00000000000000..8b74a3aa179b06 --- /dev/null +++ b/ports/vs-yasm/fix_paths.patch @@ -0,0 +1,23 @@ +diff --git a/yasm.props b/yasm.props +index 06efe7a..10f6309 100644 +--- a/yasm.props ++++ b/yasm.props +@@ -6,15 +6,15 @@ + CustomBuild + + +- $(VCInstallDir) ++ $(VCInstallDir) + + + + 0 + 0 + $(IntDir)%(FileName).obj +- "$(YasmPath)"yasm.exe -Xvc -f win32 [AllOptions] [AdditionalOptions] "%(FullPath)" +- "$(YasmPath)"yasm.exe -Xvc -f win64 [AllOptions] [AdditionalOptions] "%(FullPath)" ++ "$(YasmPath)" -Xvc -f win32 [AllOptions] [AdditionalOptions] "%(FullPath)" ++ "$(YasmPath)" -Xvc -f win64 [AllOptions] [AdditionalOptions] "%(FullPath)" + echo YASM not supported on this platform + exit 1 + %(Identity) diff --git a/ports/vs-yasm/portfile.cmake b/ports/vs-yasm/portfile.cmake index 341f66ca510990..fc291c259001e5 100644 --- a/ports/vs-yasm/portfile.cmake +++ b/ports/vs-yasm/portfile.cmake @@ -5,15 +5,13 @@ vcpkg_from_github( REF deb50d9f18e8461538468339d508cdf240e64897 #v0.5 SHA512 04627546020d33e5ea91f74b09c5ce3b817dce5f6ae4548c3b4148daa82fbd837c81675ac8730d3ca1cdf91fefa8bb23eec76d1bcd02c03dda1203d0c261178d HEAD_REF master + PATCHES + fix_paths.patch ) set(_files yasm.props yasm.targets yasm.xml) foreach(_file ${_files}) - file(INSTALL "${SOURCE_PATH}/${_file}" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/") + file(INSTALL "${SOURCE_PATH}/${_file}" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") endforeach() -set(_file "${CURRENT_PACKAGES_DIR}/share/${PORT}/yasm.props") -file(READ "${_file}" _contents) -string(REPLACE "$(VCInstallDir)" "" _contents "${_contents}") -file(WRITE "${_file}" "${_contents}") -configure_file("${SOURCE_PATH}/COPYING" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY) \ No newline at end of file +configure_file("${SOURCE_PATH}/COPYING" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY) diff --git a/ports/vs-yasm/vcpkg.json b/ports/vs-yasm/vcpkg.json new file mode 100644 index 00000000000000..830838cc7bde85 --- /dev/null +++ b/ports/vs-yasm/vcpkg.json @@ -0,0 +1,8 @@ +{ + "name": "vs-yasm", + "version-string": "0.5.0", + "port-version": 1, + "description": "Provides Visual Studio integration for the YASM assembler.", + "homepage": "https://github.com/ShiftMediaProject/VSYASM", + "supports": "windows & !arm" +} diff --git a/ports/yasm-tool-helper/portfile.cmake b/ports/yasm-tool-helper/portfile.cmake new file mode 100644 index 00000000000000..072b7894fa336d --- /dev/null +++ b/ports/yasm-tool-helper/portfile.cmake @@ -0,0 +1,2 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) +configure_file(${CMAKE_CURRENT_LIST_DIR}/yasm-tool-helper.cmake ${CURRENT_PACKAGES_DIR}/share/yasm-tool-helper/yasm-tool-helper.cmake COPYONLY) diff --git a/ports/yasm-tool-helper/vcpkg.json b/ports/yasm-tool-helper/vcpkg.json new file mode 100644 index 00000000000000..b37b33c222c10d --- /dev/null +++ b/ports/yasm-tool-helper/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "yasm-tool-helper", + "version-string": "2020-10-12", + "description": "This port provides helper functions for ports needing to consume YASM", + "homepage": "https://github.com/Microsoft/vcpkg", + "dependencies": [ + { + "name": "yasm-tool", + "platform": "x86 & windows" + } + ] +} diff --git a/ports/yasm-tool-helper/yasm-tool-helper.cmake b/ports/yasm-tool-helper/yasm-tool-helper.cmake new file mode 100644 index 00000000000000..24c44c9d08b7fc --- /dev/null +++ b/ports/yasm-tool-helper/yasm-tool-helper.cmake @@ -0,0 +1,34 @@ +function(yasm_tool_helper) + cmake_parse_arguments(PARSE_ARGV 0 a + "APPEND_TO_PATH;PREPEND_TO_PATH" + "OUT_VAR" + "" + ) + + if(CMAKE_HOST_WIN32) + if(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_UWP) + # Native compilation + set(YASM "${CURRENT_INSTALLED_DIR}/tools/yasm-tool/yasm.exe") + else() + # Cross compilation + get_filename_component(YASM "${CURRENT_INSTALLED_DIR}/../x86-windows/tools/yasm-tool/yasm.exe" ABSOLUTE) + if(NOT EXISTS "${YASM}") + message(FATAL_ERROR "Cross-targetting and x64 ports requiring yasm require the x86-windows yasm-tool to be available. Please install yasm-tool:x86-windows first.") + endif() + endif() + else() + vcpkg_find_acquire_program(YASM) + endif() + + if(a_APPEND_TO_PATH) + get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) + vcpkg_add_to_path("${YASM_EXE_PATH}") + endif() + if(a_PREPEND_TO_PATH) + get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) + vcpkg_add_to_path(PREPEND "${YASM_EXE_PATH}") + endif() + if(a_OUT_VAR) + set(${a_OUT_VAR} "${YASM}" PARENT_SCOPE) + endif() +endfunction() diff --git a/ports/yasm-tool/portfile.cmake b/ports/yasm-tool/portfile.cmake new file mode 100644 index 00000000000000..a417f105c943c0 --- /dev/null +++ b/ports/yasm-tool/portfile.cmake @@ -0,0 +1,37 @@ +vcpkg_fail_port_install(MESSAGE "The yasm-tool port is only intended to be built for x86 Windows" ON_TARGET "Linux" "OSX" ON_ARCH "x64" "arm") + +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +set(VCPKG_LIBRARY_LINKAGE static) + +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY) +vcpkg_add_to_path("${PYTHON3_DIR}") + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO yasm/yasm + REF 009450c7ad4d425fa5a10ac4bd6efbd25248d823 # 7.0.3 plus bugfixes for https://github.com/yasm/yasm/issues/153 + SHA512 a542577558676d11b52981925ea6219bffe699faa1682c033b33b7534f5a0dfe9f29c56b32076b68c48f65e0aef7c451be3a3af804c52caa4d4357de4caad83c +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DENABLE_NLS=OFF + -DYASM_BUILD_TESTS=OFF +) + +vcpkg_install_cmake() + +vcpkg_copy_tools(TOOL_NAMES yasm) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include") + +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +foreach(LICENSE Artistic.txt BSD.txt GNU_GPL-2.0 GNU_LGPL-2.0) + file(COPY "${SOURCE_PATH}/${LICENSE}" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +endforeach() diff --git a/ports/yasm-tool/vcpkg.json b/ports/yasm-tool/vcpkg.json new file mode 100644 index 00000000000000..20e37b57070bc3 --- /dev/null +++ b/ports/yasm-tool/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "yasm-tool", + "version-string": "2020-10-12", + "description": "A modular assembler. This port is intended to build other ports and should not be used directly.", + "homepage": "http://yasm.tortall.net/", + "supports": "windows & x86" +} diff --git a/scripts/azure-pipelines/test-modified-ports.ps1 b/scripts/azure-pipelines/test-modified-ports.ps1 index 15cb8131f5da01..85d0c7029ad6b9 100755 --- a/scripts/azure-pipelines/test-modified-ports.ps1 +++ b/scripts/azure-pipelines/test-modified-ports.ps1 @@ -108,7 +108,9 @@ $skipList = . "$PSScriptRoot/generate-skip-list.ps1" ` # WORKAROUND: the x86-windows flavors of these are needed for all cross-compilation, but they are not auto-installed. # Install them so the CI succeeds: if ($Triplet -in @('x64-uwp', 'arm64-windows', 'arm-uwp')) { - .\vcpkg.exe install protobuf:x86-windows boost-build:x86-windows sqlite3:x86-windows @commonArgs + .\vcpkg.exe install protobuf:x86-windows boost-build:x86-windows sqlite3:x86-windows yasm-tool:x86-windows @commonArgs +} elseif ($Triplet -in @('x64-windows', 'x64-windows-static')) { + .\vcpkg.exe install yasm-tool:x86-windows @commonArgs } & "./vcpkg$executableExtension" ci $Triplet --x-xunit=$xmlFile --exclude=$skipList --failure-logs=$failureLogs @commonArgs diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index 607a75c8eed79d..1c5e8393f31a40 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -18,6 +18,13 @@ namespace fs { + struct IsSlash + { + bool operator()(const wchar_t c) const noexcept { return c == L'/' || c == L'\\'; } + }; + + constexpr IsSlash is_slash; + #if VCPKG_USE_STD_FILESYSTEM namespace stdfs = std::filesystem; #else diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index d00b9b7a60b097..ee3a339e016198 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -23,16 +23,6 @@ #include #include -namespace -{ - struct IsSlash - { - bool operator()(const wchar_t c) const noexcept { return c == L'/' || c == L'\\'; } - }; - - constexpr IsSlash is_slash; -} // unnamed namespace - #if defined(_WIN32) namespace { @@ -1277,6 +1267,7 @@ namespace vcpkg::Files #ifdef _WIN32 fs::path win32_fix_path_case(const fs::path& source) { + using fs::is_slash; const std::wstring& native = source.native(); if (native.empty()) { @@ -1381,7 +1372,7 @@ namespace vcpkg::Files std::string result; const auto base_size = base.size(); const auto file_size = file.size(); - if (base_size != 0 && !is_slash(base.data()[base_size - 1])) + if (base_size != 0 && !fs::is_slash(base.data()[base_size - 1])) { result.reserve(base_size + file_size + 1); result.append(base.data(), base_size); diff --git a/toolsrc/src/vcpkg/commands.create.cpp b/toolsrc/src/vcpkg/commands.create.cpp index b14b47a8f5e328..c3268bd5eb4d03 100644 --- a/toolsrc/src/vcpkg/commands.create.cpp +++ b/toolsrc/src/vcpkg/commands.create.cpp @@ -8,6 +8,16 @@ #include #include +namespace +{ + std::string remove_trailing_slashes(std::string argument) + { + using fs::is_slash; + argument.erase(std::find_if_not(argument.rbegin(), argument.rend(), is_slash).base(), argument.end()); + return argument; + } +} + namespace vcpkg::Commands::Create { const CommandStructure COMMAND_STRUCTURE = { @@ -22,7 +32,7 @@ namespace vcpkg::Commands::Create { (void)args.parse_arguments(COMMAND_STRUCTURE); const std::string port_name = args.command_arguments.at(0); - const std::string url = args.command_arguments.at(1); + const std::string url = remove_trailing_slashes(args.command_arguments.at(1)); std::vector cmake_args{{"CMD", "CREATE"}, {"PORT", port_name}, {"URL", url}};