diff --git a/docs/maintainers/portfile-functions.md b/docs/maintainers/portfile-functions.md index 56e42bbd80887f..e94d47e190c83d 100644 --- a/docs/maintainers/portfile-functions.md +++ b/docs/maintainers/portfile-functions.md @@ -1,57 +1,57 @@ -# Portfile helper functions -- [execute\_process](execute_process.md) -- [vcpkg\_acquire\_msys](vcpkg_acquire_msys.md) -- [vcpkg\_add\_to\_path](vcpkg_add_to_path.md) -- [vcpkg\_apply\_patches](vcpkg_apply_patches.md) -- [vcpkg\_build\_cmake](vcpkg_build_cmake.md) -- [vcpkg\_build\_gn](vcpkg_build_gn.md) -- [vcpkg\_build\_make](vcpkg_build_make.md) -- [vcpkg\_build\_msbuild](vcpkg_build_msbuild.md) -- [vcpkg\_build\_ninja](vcpkg_build_ninja.md) -- [vcpkg\_build\_nmake](vcpkg_build_nmake.md) -- [vcpkg\_build\_qmake](vcpkg_build_qmake.md) -- [vcpkg\_buildpath\_length\_warning](vcpkg_buildpath_length_warning.md) -- [vcpkg\_check\_features](vcpkg_check_features.md) -- [vcpkg\_check\_linkage](vcpkg_check_linkage.md) -- [vcpkg\_clean\_executables\_in\_bin](vcpkg_clean_executables_in_bin.md) -- [vcpkg\_clean\_msbuild](vcpkg_clean_msbuild.md) -- [vcpkg\_common\_definitions](vcpkg_common_definitions.md) -- [vcpkg\_configure\_cmake](vcpkg_configure_cmake.md) -- [vcpkg\_configure\_gn](vcpkg_configure_gn.md) -- [vcpkg\_configure\_make](vcpkg_configure_make.md) -- [vcpkg\_configure\_meson](vcpkg_configure_meson.md) -- [vcpkg\_configure\_qmake](vcpkg_configure_qmake.md) -- [vcpkg\_copy\_pdbs](vcpkg_copy_pdbs.md) -- [vcpkg\_copy\_tool\_dependencies](vcpkg_copy_tool_dependencies.md) -- [vcpkg\_copy\_tools](vcpkg_copy_tools.md) -- [vcpkg\_download\_distfile](vcpkg_download_distfile.md) -- [vcpkg\_execute\_build\_process](vcpkg_execute_build_process.md) -- [vcpkg\_execute\_in\_download\_mode](vcpkg_execute_in_download_mode.md) -- [vcpkg\_execute\_required\_process](vcpkg_execute_required_process.md) -- [vcpkg\_execute\_required\_process\_repeat](vcpkg_execute_required_process_repeat.md) -- [vcpkg\_extract\_source\_archive](vcpkg_extract_source_archive.md) -- [vcpkg\_extract\_source\_archive\_ex](vcpkg_extract_source_archive_ex.md) -- [vcpkg\_fail\_port\_install](vcpkg_fail_port_install.md) -- [vcpkg\_find\_acquire\_program](vcpkg_find_acquire_program.md) -- [vcpkg\_find\_fortran](vcpkg_find_fortran.md) -- [vcpkg\_fixup\_cmake\_targets](vcpkg_fixup_cmake_targets.md) -- [vcpkg\_fixup\_pkgconfig](vcpkg_fixup_pkgconfig.md) -- [vcpkg\_from\_bitbucket](vcpkg_from_bitbucket.md) -- [vcpkg\_from\_git](vcpkg_from_git.md) -- [vcpkg\_from\_github](vcpkg_from_github.md) -- [vcpkg\_from\_gitlab](vcpkg_from_gitlab.md) -- [vcpkg\_from\_sourceforge](vcpkg_from_sourceforge.md) -- [vcpkg\_get\_program\_files\_platform\_bitness](vcpkg_get_program_files_platform_bitness.md) -- [vcpkg\_get\_windows\_sdk](vcpkg_get_windows_sdk.md) -- [vcpkg\_install\_cmake](vcpkg_install_cmake.md) -- [vcpkg\_install\_gn](vcpkg_install_gn.md) -- [vcpkg\_install\_make](vcpkg_install_make.md) -- [vcpkg\_install\_meson](vcpkg_install_meson.md) -- [vcpkg\_install\_msbuild](vcpkg_install_msbuild.md) -- [vcpkg\_install\_nmake](vcpkg_install_nmake.md) -- [vcpkg\_install\_qmake](vcpkg_install_qmake.md) -- [vcpkg\_internal\_get\_cmake\_vars](vcpkg_internal_get_cmake_vars.md) -- [vcpkg\_prettify\_command](vcpkg_prettify_command.md) +# Portfile helper functions +- [execute\_process](execute_process.md) +- [vcpkg\_acquire\_msys](vcpkg_acquire_msys.md) +- [vcpkg\_add\_to\_path](vcpkg_add_to_path.md) +- [vcpkg\_apply\_patches](vcpkg_apply_patches.md) +- [vcpkg\_build\_cmake](vcpkg_build_cmake.md) +- [vcpkg\_build\_gn](vcpkg_build_gn.md) +- [vcpkg\_build\_make](vcpkg_build_make.md) +- [vcpkg\_build\_msbuild](vcpkg_build_msbuild.md) +- [vcpkg\_build\_ninja](vcpkg_build_ninja.md) +- [vcpkg\_build\_nmake](vcpkg_build_nmake.md) +- [vcpkg\_build\_qmake](vcpkg_build_qmake.md) +- [vcpkg\_buildpath\_length\_warning](vcpkg_buildpath_length_warning.md) +- [vcpkg\_check\_features](vcpkg_check_features.md) +- [vcpkg\_check\_linkage](vcpkg_check_linkage.md) +- [vcpkg\_clean\_executables\_in\_bin](vcpkg_clean_executables_in_bin.md) +- [vcpkg\_clean\_msbuild](vcpkg_clean_msbuild.md) +- [vcpkg\_common\_definitions](vcpkg_common_definitions.md) +- [vcpkg\_configure\_cmake](vcpkg_configure_cmake.md) +- [vcpkg\_configure\_gn](vcpkg_configure_gn.md) +- [vcpkg\_configure\_make](vcpkg_configure_make.md) +- [vcpkg\_configure\_meson](vcpkg_configure_meson.md) +- [vcpkg\_configure\_qmake](vcpkg_configure_qmake.md) +- [vcpkg\_copy\_pdbs](vcpkg_copy_pdbs.md) +- [vcpkg\_copy\_tool\_dependencies](vcpkg_copy_tool_dependencies.md) +- [vcpkg\_copy\_tools](vcpkg_copy_tools.md) +- [vcpkg\_download\_distfile](vcpkg_download_distfile.md) +- [vcpkg\_execute\_build\_process](vcpkg_execute_build_process.md) +- [vcpkg\_execute\_in\_download\_mode](vcpkg_execute_in_download_mode.md) +- [vcpkg\_execute\_required\_process](vcpkg_execute_required_process.md) +- [vcpkg\_execute\_required\_process\_repeat](vcpkg_execute_required_process_repeat.md) +- [vcpkg\_extract\_source\_archive](vcpkg_extract_source_archive.md) +- [vcpkg\_extract\_source\_archive\_ex](vcpkg_extract_source_archive_ex.md) +- [vcpkg\_fail\_port\_install](vcpkg_fail_port_install.md) +- [vcpkg\_find\_acquire\_program](vcpkg_find_acquire_program.md) +- [vcpkg\_find\_fortran](vcpkg_find_fortran.md) +- [vcpkg\_fixup\_cmake\_targets](vcpkg_fixup_cmake_targets.md) +- [vcpkg\_fixup\_pkgconfig](vcpkg_fixup_pkgconfig.md) +- [vcpkg\_from\_bitbucket](vcpkg_from_bitbucket.md) +- [vcpkg\_from\_git](vcpkg_from_git.md) +- [vcpkg\_from\_github](vcpkg_from_github.md) +- [vcpkg\_from\_gitlab](vcpkg_from_gitlab.md) +- [vcpkg\_from\_sourceforge](vcpkg_from_sourceforge.md) +- [vcpkg\_get\_program\_files\_platform\_bitness](vcpkg_get_program_files_platform_bitness.md) +- [vcpkg\_get\_windows\_sdk](vcpkg_get_windows_sdk.md) +- [vcpkg\_install\_cmake](vcpkg_install_cmake.md) +- [vcpkg\_install\_gn](vcpkg_install_gn.md) +- [vcpkg\_install\_make](vcpkg_install_make.md) +- [vcpkg\_install\_meson](vcpkg_install_meson.md) +- [vcpkg\_install\_msbuild](vcpkg_install_msbuild.md) +- [vcpkg\_install\_nmake](vcpkg_install_nmake.md) +- [vcpkg\_install\_qmake](vcpkg_install_qmake.md) +- [vcpkg\_internal\_get\_cmake\_vars](vcpkg_internal_get_cmake_vars.md) +- [vcpkg\_prettify\_command](vcpkg_prettify_command.md) - [vcpkg\_replace\_string](vcpkg_replace_string.md) diff --git a/docs/maintainers/vcpkg_fixup_pkgconfig.md b/docs/maintainers/vcpkg_fixup_pkgconfig.md index 48870e972eeced..70b4fb124aa0e6 100644 --- a/docs/maintainers/vcpkg_fixup_pkgconfig.md +++ b/docs/maintainers/vcpkg_fixup_pkgconfig.md @@ -7,8 +7,6 @@ Fix common paths in *.pc files and make everything relativ to $(prefix) vcpkg_fixup_pkgconfig( [RELEASE_FILES ...] [DEBUG_FILES ...] - [SYSTEM_LIBRARIES ...] - [IGNORE_FLAGS ] [SKIP_CHECK] ) ``` @@ -22,21 +20,24 @@ Defaults to every *.pc file in the folder ${CURRENT_PACKAGES_DIR} without ${CURR Specifies a list of files to apply the fixes for debug paths. Defaults to every *.pc file in the folder ${CURRENT_PACKAGES_DIR}/debug/ -### SYSTEM_LIBRARIES -If the *.pc file contains system libraries outside vcpkg these need to be listed here. -VCPKG checks every -l flag for the existence of the required library within vcpkg. +### SKIP_CHECK +Skips the library checks in vcpkg_fixup_pkgconfig. Only use if the script itself has unhandled cases. -### IGNORE_FLAGS -If the *.pc file contains flags in the lib field which are not libraries. These can be listed here +### SYSTEM_PACKAGES (deprecated) +This argument has been deprecated and has no effect. -### SKIP_CHECK -Skips the library checks in vcpkg_fixup_pkgconfig. Only use if the script itself has unhandled cases. +### SYSTEM_LIBRARIES (deprecated) +This argument has been deprecated and has no effect. + +### IGNORE_FLAGS (deprecated) +This argument has been deprecated and has no effect. ## Notes Still work in progress. If there are more cases which can be handled here feel free to add them ## Examples -Just call `vcpkg_fixup_pkgconfig()` after any install step which installs *.pc files. + +* [brotli](https://github.com/Microsoft/vcpkg/blob/master/ports/brotli/portfile.cmake) ## Source [scripts/cmake/vcpkg_fixup_pkgconfig.cmake](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/vcpkg_fixup_pkgconfig.cmake) diff --git a/docs/maintainers/vcpkg_from_github.md b/docs/maintainers/vcpkg_from_github.md index 64ff2b1955a2ed..ded5dfb0dbea0a 100644 --- a/docs/maintainers/vcpkg_from_github.md +++ b/docs/maintainers/vcpkg_from_github.md @@ -13,6 +13,7 @@ vcpkg_from_github( [PATCHES ...] [GITHUB_HOST ] [AUTHORIZATION_TOKEN <${SECRET_FROM_FILE}>] + [FILE_DISAMBIGUATOR ] ) ``` diff --git a/docs/maintainers/vcpkg_from_gitlab.md b/docs/maintainers/vcpkg_from_gitlab.md index ceef6f2d44c78a..aa5cc800d7058a 100644 --- a/docs/maintainers/vcpkg_from_gitlab.md +++ b/docs/maintainers/vcpkg_from_gitlab.md @@ -12,6 +12,7 @@ vcpkg_from_gitlab( [SHA512 <45d0d7f8cc350...>] [HEAD_REF ] [PATCHES ...] + [FILE_DISAMBIGUATOR ] ) ``` @@ -51,6 +52,9 @@ A list of patches to be applied to the extracted sources. Relative paths are based on the port directory. +### FILE_DISAMBIGUATOR +A token to uniquely identify the resulting filename if the SHA512 changes even though a git ref does not, to avoid stepping on the same file name. + ## Notes: At least one of `REF` and `HEAD_REF` must be specified, however it is preferable for both to be present. diff --git a/docs/regenerate.ps1 b/docs/regenerate.ps1 index c984ad77b43541..3593746adb71f6 100644 --- a/docs/regenerate.ps1 +++ b/docs/regenerate.ps1 @@ -13,9 +13,7 @@ if (-not (Test-Path "$VcpkgRoot/.vcpkg-root")) { throw "Invalid vcpkg instance, did you forget -VcpkgRoot?" } -Set-Content ` - -Path "$PSScriptRoot/maintainers/portfile-functions.md" ` - -Value "`n`n# Portfile helper functions" +$tableOfContents = @() Get-ChildItem "$VcpkgRoot/scripts/cmake" -Filter '*.cmake' | ForEach-Object { $filename = $_ @@ -72,10 +70,23 @@ Get-ChildItem "$VcpkgRoot/scripts/cmake" -Filter '*.cmake' | ForEach-Object { if ($contents) { Set-Content -Path "$PSScriptRoot/maintainers/$($filename.BaseName).md" -Value "$($contents -join "`n")`n`n## Source`n[scripts/cmake/$($filename.Name)](https://github.com/Microsoft/vcpkg/blob/master/scripts/cmake/$($filename.Name))" - "- [$($filename.BaseName -replace "_","\_")]($($filename.BaseName).md)" ` - | Out-File -Enc Ascii -Append -FilePath "$PSScriptRoot/maintainers/portfile-functions.md" + + $tableOfContents += $filename.BaseName } elseif (-not $filename.Name.StartsWith("vcpkg_internal")) { # don't worry about undocumented internal functions Write-Warning "The cmake function in file $filename doesn't seem to have any documentation. Make sure the documentation comments are correctly written." } } + +$portfileFunctionsContent = @( + '', + '', + '# Portfile helper functions') + +$tableOfContents | Sort-Object -Culture '' | ForEach-Object { + $portfileFunctionsContent += "- [$($_ -replace '_','\_')]($_.md)" +} + +Set-Content ` + -Path "$PSScriptRoot/maintainers/portfile-functions.md" ` + -Value ($portfileFunctionsContent -join "`n") diff --git a/docs/users/binarycaching.md b/docs/users/binarycaching.md index c3fb98a4ff731e..9df885f4c3bdb1 100644 --- a/docs/users/binarycaching.md +++ b/docs/users/binarycaching.md @@ -86,7 +86,7 @@ More information about Azure DevOps Artifacts' NuGet support is available in the ## Configuration -Binary caching is configured via a combination of defaults, the environment variable `VCPKG_BINARY_SOURCES` (set to `;;...`), and the command line option `--binarysource=`. Source options are evaluated in order of defaults, then environment, then command line. +Binary caching is configured via a combination of defaults, the environment variable `VCPKG_BINARY_SOURCES` (set to `;;...`), and the command line option `--binarysource=`. Source options are evaluated in order of defaults, then environment, then command line. Binary caching can be completely disabled by passing `--binarysource=clear` as the last command line option. By default, zip-based archives will be cached at the first valid location of: @@ -115,6 +115,47 @@ By default, zip-based archives will be cached at the first valid location of: The `` optional parameter for certain sources controls whether they will be consulted for downloading binaries (`read`), whether on-demand builds will be uploaded to that remote (`write`), or both (`readwrite`). +### Nuget Provider Configuration + +#### Credentials + +Many NuGet servers require additional credentials to access. The most flexible way to supply credentials is via the `nugetconfig` provider with a custom `nuget.config` file. See https://docs.microsoft.com/en-us/nuget/consume-packages/consuming-packages-authenticated-feeds for more information on authenticating via `nuget.config`. + +However, it is still possible to authenticate against many servers using NuGet's built-in credential providers or via customizing your environment's default `nuget.config`. The default config can be extended via nuget client calls such as +``` +nuget sources add -Name MyRemote -Source https://... -Username $user -Password $pass +``` +and then passed to vcpkg via `--binarysource=nuget,MyRemote,readwrite`. You can get a path to the precise copy of NuGet used by vcpkg by running `vcpkg fetch nuget`, which will report something like: +``` +$ vcpkg fetch nuget +/vcpkg/downloads/tools/nuget-5.5.1-linux/nuget.exe +``` +Non-Windows users will need to call this through mono via `mono /path/to/nuget.exe sources add ...`. + +##### Credential Example for Azure Dev Ops +```bash +# On Linux or OSX +$ mono `vcpkg fetch nuget | tail -n1` sources add \ + -name ADO \ + -Source https://pkgs.dev.azure.com/$ORG/_packaging/$FEEDNAME/nuget/v3/index.json \ + -Username $USERNAME \ + -Password $PAT +$ export VCPKG_BINARY_SOURCES="nuget,ADO,readwrite" +``` +```powershell +# On Windows Powershell +PS> & $(vcpkg fetch nuget | select -last 1) sources add ` + -name ADO ` + -Source https://pkgs.dev.azure.com/$ORG/_packaging/$FEEDNAME/nuget/v3/index.json ` + -Username $USERNAME ` + -Password $PAT +PS> $env:VCPKG_BINARY_SOURCES="nuget,ADO,readwrite" +``` + +We recommend using a Personal Access Token (PAT) as the password for maximum security. You can generate a PAT in User Settings -> Personal Access Tokens or `https://dev.azure.com/$ORG/_usersSettings/tokens`. + +#### `metadata.repository` + The `nuget` and `nugetconfig` source providers additionally respect certain environment variables while generating nuget packages. The `metadata.repository` field of any packages will be generated as: ``` @@ -128,8 +169,6 @@ or ``` if the appropriate environment variables are defined and non-empty. This is specifically used to associate packages in GitHub Packages with the _building_ project and not intended to associate with the original package sources. -Finally, binary caching can be completely disabled by passing `--no-binarycaching` on the command line. - ## Implementation Notes (internal details subject to change without notice) Binary caching relies on hashing everything that contributes to a particular package build. This includes: diff --git a/ports/arrayfire/build.patch b/ports/arrayfire/build.patch index c952f5f6213793..b2a4f279f2997e 100644 --- a/ports/arrayfire/build.patch +++ b/ports/arrayfire/build.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index e1108c60..670f271b 100644 +index 1f30a5b3..f93e4ed9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,18 +104,11 @@ mark_as_advanced( @@ -62,13 +62,6 @@ index 2c7b96ea..b5006ee0 100644 endif() # Libraries -diff --git a/assets b/assets -index cd08d749..c53bfab9 160000 ---- a/assets -+++ b/assets -@@ -1 +1 @@ --Subproject commit cd08d749611b324012555ad6f23fd76c5465bd6c -+Subproject commit c53bfab909adfeed626f91ed419555711e20bca5 diff --git a/src/api/unified/CMakeLists.txt b/src/api/unified/CMakeLists.txt index 967eaa63..ff04392c 100644 --- a/src/api/unified/CMakeLists.txt @@ -131,7 +124,7 @@ index 170bb0f3..c6e20177 100644 arrayfire_set_default_cxx_flags(afcpu) diff --git a/src/backend/cuda/CMakeLists.txt b/src/backend/cuda/CMakeLists.txt -index 7e3e4089..bbd8d838 100644 +index 7e3e4089..a3a53087 100644 --- a/src/backend/cuda/CMakeLists.txt +++ b/src/backend/cuda/CMakeLists.txt @@ -110,7 +110,11 @@ cuda_include_directories( @@ -147,6 +140,31 @@ index 7e3e4089..bbd8d838 100644 endif() file(GLOB jit_src "kernel/jit.cuh") +@@ -240,9 +244,14 @@ if(AF_WITH_NONFREE) + set(cxx_definitions -DAF_WITH_NONFREE_SIFT) + endif() + ++# New API of cuSparse was introduced in 10.1.168 for Linux and the older ++# 10.1.105 fix version doesn't it. Unfortunately, the new API was introduced in ++# in a fix release of CUDA - unconventionally. As CMake's FindCUDA module ++# doesn't provide patch/fix version number, we use 10.2 as the minimum ++# CUDA version to enable this new cuSparse API. + if(CUDA_VERSION_MAJOR VERSION_GREATER 10 OR + (UNIX AND +- CUDA_VERSION_MAJOR VERSION_EQUAL 10 AND CUDA_VERSION_MINOR VERSION_GREATER 0)) ++ CUDA_VERSION_MAJOR VERSION_EQUAL 10 AND CUDA_VERSION_MINOR VERSION_GREATER 1)) + list(APPEND cxx_definitions -DAF_USE_NEW_CUSPARSE_API) + endif() + +@@ -301,7 +310,7 @@ set_target_properties(af_cuda_static_cuda_library + + if(CUDA_VERSION_MAJOR VERSION_GREATER 10 OR + (UNIX AND +- CUDA_VERSION_MAJOR VERSION_EQUAL 10 AND CUDA_VERSION_MINOR VERSION_GREATER 0)) ++ CUDA_VERSION_MAJOR VERSION_EQUAL 10 AND CUDA_VERSION_MINOR VERSION_GREATER 1)) + target_compile_definitions(af_cuda_static_cuda_library PRIVATE AF_USE_NEW_CUSPARSE_API) + endif() + diff --git a/src/backend/opencl/kernel/scan_by_key/CMakeLists.txt b/src/backend/opencl/kernel/scan_by_key/CMakeLists.txt index 9a796c9e..d9864b00 100644 --- a/src/backend/opencl/kernel/scan_by_key/CMakeLists.txt @@ -191,10 +209,3 @@ index d618ff2f..9f517398 100644 ) set_target_properties(opencl_sort_by_key_${SBK_TYPE} -diff --git a/test/data b/test/data -index 408f4405..6a48c886 160000 ---- a/test/data -+++ b/test/data -@@ -1 +1 @@ --Subproject commit 408f44059015c57a66e13b4c98df86ebcb427950 -+Subproject commit 6a48c88658bcd68392e99344714cb0dccd4ec285 diff --git a/ports/arrayfire/vcpkg.json b/ports/arrayfire/vcpkg.json index ee80e879d8d0c2..d2dd8b3081949a 100644 --- a/ports/arrayfire/vcpkg.json +++ b/ports/arrayfire/vcpkg.json @@ -1,6 +1,7 @@ { "name": "arrayfire", "version-string": "3.7.3", + "port-version": 2, "description": "ArrayFire is a general-purpose library that simplifies the process of developing software that targets parallel and massively-parallel architectures including CPUs, GPUs, and other hardware acceleration devices.", "supports": "x64", "dependencies": [ diff --git a/ports/atk/CMakeLists.txt b/ports/atk/CMakeLists.txt.in similarity index 87% rename from ports/atk/CMakeLists.txt rename to ports/atk/CMakeLists.txt.in index e26d8649e41a1c..d8b84882369d99 100644 --- a/ports/atk/CMakeLists.txt +++ b/ports/atk/CMakeLists.txt.in @@ -1,9 +1,9 @@ cmake_minimum_required(VERSION 3.0) project(atk C) -set(ATK_LIB_SUFFIX 1.0) -set(ATK_DLL_SUFFIX 1) -set(GLIB_LIB_VERSION 2.0) +set(ATK_LIB_SUFFIX @ATK_LIB_SUFFIX@) +set(ATK_DLL_SUFFIX @ATK_DLL_SUFFIX@) +set(GLIB_LIB_VERSION @GLIB_LIB_VERSION@) if(BUILD_SHARED_LIBS) set(ATK_EXPORT_MACRO DLL_EXPORT) @@ -142,3 +142,14 @@ message(STATUS " " ${LIBINTL_LIBRARY}) foreach(GL ${GLIB_LIBRARIES}) message(STATUS " " ${GL}) endforeach() + +set(prefix ${CMAKE_INSTALL_PREFIX}) +set(exec_prefix ${CMAKE_INSTALL_PREFIX}) +set(libdir ${CMAKE_INSTALL_PREFIX}/lib) +set(includedir ${CMAKE_INSTALL_PREFIX}/include) +set(ATK_API_VERSION @ATK_API_VERSION@) +set(VERSION @ATK_VERSION@) +set(GLIB_PACKAGES "glib-${GLIB_LIB_VERSION} gobject-${GLIB_LIB_VERSION} gmodule-${GLIB_LIB_VERSION}") + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/atk.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/atk.pc" @ONLY) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/atk.pc" DESTINATION lib/pkgconfig) \ No newline at end of file diff --git a/ports/atk/CONTROL b/ports/atk/CONTROL index bcfc01d1655faa..686e7fe6e5afcd 100644 --- a/ports/atk/CONTROL +++ b/ports/atk/CONTROL @@ -1,5 +1,6 @@ Source: atk Version: 2.24.0-5 +Port-Version: 1 Homepage: https://developer.gnome.org/atk/ Description: GNOME Accessibility Toolkit Build-Depends: glib, gettext diff --git a/ports/atk/portfile.cmake b/ports/atk/portfile.cmake index a0d01285969697..916b5095bca53d 100644 --- a/ports/atk/portfile.cmake +++ b/ports/atk/portfile.cmake @@ -15,7 +15,17 @@ vcpkg_extract_source_archive_ex( fix-linux-config.patch ) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +# Here are used API version of library, not the version of library itself +set(ATK_LIB_SUFFIX 1.0) +set(ATK_DLL_SUFFIX 1) + +set(GLIB_LIB_VERSION 2.0) +if (WIN32) + set(ATK_API_VERSION ${ATK_LIB_SUFFIX}) +else() + set(ATK_API_VERSION ${ATK_DLL_SUFFIX}) +endif() +configure_file("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in" "${SOURCE_PATH}/CMakeLists.txt" @ONLY) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} @@ -30,4 +40,6 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() + file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/aws-sdk-cpp/CONTROL b/ports/aws-sdk-cpp/CONTROL index 3be9be28561c93..1b46d7d3664fb3 100644 --- a/ports/aws-sdk-cpp/CONTROL +++ b/ports/aws-sdk-cpp/CONTROL @@ -1,9 +1,9 @@ Source: aws-sdk-cpp Version: 1.8.83 -Port-Version: 2 +Port-Version: 4 Homepage: https://github.com/aws/aws-sdk-cpp Description: AWS SDK for C++ -Build-Depends: openssl (!uwp&!windows), curl (!uwp&!windows), aws-c-event-stream +Build-Depends: openssl (!uwp&!windows), curl (!uwp&!windows), aws-c-event-stream, zlib Default-Features: dynamodb, s3, kinesis # Automatically generated by generateFeatures.ps1 diff --git a/ports/aws-sdk-cpp/fix-AWSSDKCONFIG.patch b/ports/aws-sdk-cpp/fix-AWSSDKCONFIG.patch new file mode 100644 index 00000000000000..f35d1be1c45936 --- /dev/null +++ b/ports/aws-sdk-cpp/fix-AWSSDKCONFIG.patch @@ -0,0 +1,31 @@ +diff --git a/cmake/AWSSDKConfig.cmake b/cmake/AWSSDKConfig.cmake +index c2f643e..4fb4a2f 100644 +--- a/cmake/AWSSDKConfig.cmake ++++ b/cmake/AWSSDKConfig.cmake +@@ -24,6 +24,10 @@ if(AWSSDK_FOUND) + return() + endif() + ++include(CMakeFindDependencyMacro) ++find_dependency(OpenSSL) ++find_dependency(ZLIB) ++ + include(${CMAKE_CURRENT_LIST_DIR}/AWSSDKConfigVersion.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/sdksCommon.cmake) + include(${CMAKE_CURRENT_LIST_DIR}/platformDeps.cmake) +@@ -43,7 +47,6 @@ endif() + + # On Windows, dlls are treated as runtime target and installed in bindir + if (WIN32 AND AWSSDK_INSTALL_AS_SHARED_LIBS) +- set(AWSSDK_INSTALL_LIBDIR "${AWSSDK_INSTALL_BINDIR}") + # If installed CMake scripts are associated with dll library, define USE_IMPORT_EXPORT for customers + add_definitions(-DUSE_IMPORT_EXPORT) + endif() +@@ -54,7 +57,6 @@ endif() + get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${AWSSDK_DEFAULT_ROOT_DIR}" PATH) + get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${AWSSDK_DEFAULT_ROOT_DIR}" PATH) +-get_filename_component(AWSSDK_DEFAULT_ROOT_DIR "${AWSSDK_DEFAULT_ROOT_DIR}" PATH) + get_filename_component(AWS_NATIVE_SDK_ROOT "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE) + + set(CPP_STANDARD "11" CACHE STRING "Flag to upgrade the C++ standard used. The default is 11. The minimum is 11.") diff --git a/ports/aws-sdk-cpp/portfile.cmake b/ports/aws-sdk-cpp/portfile.cmake index 03a8929eed82d0..26f7bb8afb4f6a 100644 --- a/ports/aws-sdk-cpp/portfile.cmake +++ b/ports/aws-sdk-cpp/portfile.cmake @@ -6,7 +6,9 @@ vcpkg_from_github( REF e98e5732ec7319051f162f7314ae361c85d0a8c9 # 1.8.83 SHA512 da540db60551be833ea0315dd93241f9740ab953ed5657c1c7a8c401ae52a4e75b116758420b0a8a4ebb79358dff8377f5e052b180b36f0af27a36003f28bd56 HEAD_REF master - PATCHES patch-relocatable-rpath.patch + PATCHES + patch-relocatable-rpath.patch + fix-AWSSDKCONFIG.patch ) string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" FORCE_SHARED_CRT) @@ -60,7 +62,6 @@ endforeach() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share - ${CURRENT_PACKAGES_DIR}/share/AWSSDK ${CURRENT_PACKAGES_DIR}/lib/pkgconfig ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig ${CURRENT_PACKAGES_DIR}/nuget @@ -82,5 +83,7 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) file(APPEND ${CURRENT_PACKAGES_DIR}/include/aws/core/SDKConfig.h "#ifndef USE_IMPORT_EXPORT\n#define USE_IMPORT_EXPORT\n#endif") endif() +configure_file(${CURRENT_PORT_DIR}/usage ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage @ONLY) + # Handle copyright file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/aws-sdk-cpp/usage b/ports/aws-sdk-cpp/usage new file mode 100644 index 00000000000000..7f3176483522cf --- /dev/null +++ b/ports/aws-sdk-cpp/usage @@ -0,0 +1,5 @@ +The package @PORT@:@TARGET_TRIPLET@ provides CMake targets: + + find_package(AWSSDK CONFIG COMPONENTS core dynamodb kinesis s3 REQUIRED) + target_include_directories(main PRVATE ${AWSSDK_INCLUDE_DIRS}) + target_link_libraries(main PRIVATE ${AWSSDK_LIBRARIES}) diff --git a/ports/ceres/CONTROL b/ports/ceres/CONTROL deleted file mode 100644 index 2ad6f31be325fb..00000000000000 --- a/ports/ceres/CONTROL +++ /dev/null @@ -1,24 +0,0 @@ -Source: ceres -Version: 2.0.0 -Build-Depends: glog, eigen3 -Homepage: https://github.com/ceres-solver/ceres-solver -Description: non-linear optimization package - -Feature: lapack -Build-Depends: lapack -Description: Use Lapack in Ceres - -Feature: suitesparse -Build-Depends: ceres[lapack], suitesparse[core] -Description: SuiteSparse support for Ceres - -Feature: cxsparse -Build-Depends: suitesparse[core] -Description: CXSparse support for Ceres - -Feature: eigensparse -Description: Use of Eigen as a sparse linear algebra library in Ceres - -Feature: tools -Build-Depends: gflags -Description: Ceres tools diff --git a/ports/ceres/portfile.cmake b/ports/ceres/portfile.cmake index c1dca74a95e966..fd8d0ec40d6b3d 100644 --- a/ports/ceres/portfile.cmake +++ b/ports/ceres/portfile.cmake @@ -38,8 +38,11 @@ vcpkg_configure_cmake( OPTIONS ${FEATURE_OPTIONS} -DEXPORT_BUILD_DIR=ON + -DBUILD_BENCHMARKS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF + -DBUILD_BENCHMARKS=OFF + -DPROVIDE_UNINSTALL_TARGET=OFF -DMSVC_USE_STATIC_CRT=${MSVC_USE_STATIC_CRT_VALUE} -DLIB_SUFFIX=${LIB_SUFFIX} ) diff --git a/ports/ceres/vcpkg.json b/ports/ceres/vcpkg.json new file mode 100644 index 00000000000000..7a717783396a54 --- /dev/null +++ b/ports/ceres/vcpkg.json @@ -0,0 +1,52 @@ +{ + "name": "ceres", + "version-string": "2.0.0", + "port-version": 1, + "description": "non-linear optimization package", + "homepage": "https://github.com/ceres-solver/ceres-solver", + "dependencies": [ + "eigen3", + "glog" + ], + "features": { + "cxsparse": { + "description": "CXSparse support for Ceres", + "dependencies": [ + { + "name": "suitesparse", + "default-features": false + } + ] + }, + "eigensparse": { + "description": "Use of Eigen as a sparse linear algebra library in Ceres" + }, + "lapack": { + "description": "Use Lapack in Ceres", + "dependencies": [ + "lapack" + ] + }, + "suitesparse": { + "description": "SuiteSparse support for Ceres", + "dependencies": [ + { + "name": "ceres", + "features": [ + "lapack" + ] + }, + { + "name": "suitesparse", + "default-features": false + } + ] + }, + "tools": { + "description": "Ceres tools", + "dependencies": [ + "gflags" + ] + } + } +} diff --git a/ports/chipmunk/CONTROL b/ports/chipmunk/CONTROL index 7437c78d8e4986..d5948caf797d34 100644 --- a/ports/chipmunk/CONTROL +++ b/ports/chipmunk/CONTROL @@ -1,4 +1,5 @@ Source: chipmunk Version: 7.0.3 +Port-Version: 1 Homepage: https://github.com/slembcke/Chipmunk2D Description: A fast and lightweight 2D game physics library. \ No newline at end of file diff --git a/ports/chipmunk/portfile.cmake b/ports/chipmunk/portfile.cmake index 5b148640fa2b41..f0f72cd6cb1425 100644 --- a/ports/chipmunk/portfile.cmake +++ b/ports/chipmunk/portfile.cmake @@ -1,23 +1,3 @@ -#architecture detection -if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") - set(CHIPMUNK_ARCH Win32) -elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") - set(CHIPMUNK_ARCH x64) -else() - message(FATAL_ERROR "unsupported architecture") -endif() - -#linking -if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - set(CHIPMUNK_CONFIGURATION_SUFFIX " DLL") -else() - if (VCPKG_CRT_LINKAGE STREQUAL dynamic) - set(CHIPMUNK_CONFIGURATION_SUFFIX "") - else() - set(CHIPMUNK_CONFIGURATION_SUFFIX " SCRT") - endif() -endif() - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO slembcke/Chipmunk2D @@ -26,48 +6,34 @@ vcpkg_from_github( HEAD_REF master ) -vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/msvc/VS2015/chipmunk/chipmunk.vcxproj - RELEASE_CONFIGURATION "Release${CHIPMUNK_CONFIGURATION_SUFFIX}" - DEBUG_CONFIGURATION "Debug${CHIPMUNK_CONFIGURATION_SUFFIX}" +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" KEYSTONE_BUILD_STATIC) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" KEYSTONE_BUILD_SHARED) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_DEMOS=OFF + -DBUILD_SHARED=${KEYSTONE_BUILD_SHARED} + -DBUILD_STATIC=${KEYSTONE_BUILD_STATIC} + -DINSTALL_STATIC=${KEYSTONE_BUILD_STATIC} ) -message(STATUS "Installing") -if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") - file(INSTALL - "${SOURCE_PATH}/msvc/VS2015/chipmunk/${CHIPMUNK_ARCH}/Debug${CHIPMUNK_CONFIGURATION_SUFFIX}/chipmunk.dll" - "${SOURCE_PATH}/msvc/VS2015/chipmunk/${CHIPMUNK_ARCH}/Debug${CHIPMUNK_CONFIGURATION_SUFFIX}/chipmunk.pdb" - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin - ) - file(INSTALL - "${SOURCE_PATH}/msvc/VS2015/chipmunk/${CHIPMUNK_ARCH}/Release${CHIPMUNK_CONFIGURATION_SUFFIX}/chipmunk.dll" - "${SOURCE_PATH}/msvc/VS2015/chipmunk/${CHIPMUNK_ARCH}/Release${CHIPMUNK_CONFIGURATION_SUFFIX}/chipmunk.pdb" - DESTINATION ${CURRENT_PACKAGES_DIR}/bin - ) -else() - file(INSTALL - "${SOURCE_PATH}/msvc/VS2015/chipmunk/${CHIPMUNK_ARCH}/Release${CHIPMUNK_CONFIGURATION_SUFFIX}/chipmunk.pdb" - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib - ) - file(INSTALL - "${SOURCE_PATH}/msvc/VS2015/chipmunk/${CHIPMUNK_ARCH}/Release${CHIPMUNK_CONFIGURATION_SUFFIX}/chipmunk.pdb" - DESTINATION ${CURRENT_PACKAGES_DIR}/lib - ) +vcpkg_install_cmake() + +if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +endif() + +file(GLOB DLLS ${CURRENT_PACKAGES_DIR}/lib/*.dll) +if(DLLS) + file(COPY ${DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin) + file(REMOVE ${DLLS}) endif() -file(INSTALL - "${SOURCE_PATH}/msvc/VS2015/chipmunk/${CHIPMUNK_ARCH}/Debug${CHIPMUNK_CONFIGURATION_SUFFIX}/chipmunk.lib" - DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib -) -file(INSTALL - "${SOURCE_PATH}/msvc/VS2015/chipmunk/${CHIPMUNK_ARCH}/Release${CHIPMUNK_CONFIGURATION_SUFFIX}/chipmunk.lib" - DESTINATION ${CURRENT_PACKAGES_DIR}/lib -) file(INSTALL ${SOURCE_PATH}/include/chipmunk DESTINATION ${CURRENT_PACKAGES_DIR}/include ) -file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/chipmunk RENAME copyright) - -message(STATUS "Installing done") +file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/cimg/CONTROL b/ports/cimg/CONTROL index 93a2e4ee708f60..6d7389d54f71ac 100644 --- a/ports/cimg/CONTROL +++ b/ports/cimg/CONTROL @@ -1,4 +1,4 @@ Source: cimg -Version: 2.6.2 +Version: 2.9.4 Homepage: https://github.com/dtschump/CImg Description: The CImg Library is a small, open-source, and modern C++ toolkit for image processing diff --git a/ports/cimg/portfile.cmake b/ports/cimg/portfile.cmake index 0550ca028f8309..98b9c25d6b0d58 100644 --- a/ports/cimg/portfile.cmake +++ b/ports/cimg/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH REPO "dtschump/CImg" - REF v.2.6.2 + REF a0e7ecb55130bdf90756033c1e1470eae4b88c1a #v2.9.4 HEAD_REF master - SHA512 6571c646c2d1c007212b3c8cd6794ff1722a0ffc4fcbbe26499cf1e74d3490e893cac5868c5b513602b336b5609316cd7f67c2e1f89b04fe79df5f93b9c6be7a) + SHA512 0fc814b67ce9f035a68308850117b40cb54d731cb559bf1b6f46e1ec1e29d473e805818018ac411529b51510468cfbe4427aa52a354f919d7f1ce84bd285a47d) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) @@ -14,8 +14,8 @@ vcpkg_configure_cmake( vcpkg_install_cmake() # Move cmake files, ensuring they will be 3 directories up the import prefix -file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/cimg) +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/${PORT}) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) -file(INSTALL ${SOURCE_PATH}/Licence_CeCILL-C_V1-en.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cimg RENAME copyright) -file(INSTALL ${SOURCE_PATH}/Licence_CeCILL_V2-en.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cimg RENAME copyright2) +file(INSTALL ${SOURCE_PATH}/Licence_CeCILL-C_V1-en.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +file(INSTALL ${SOURCE_PATH}/Licence_CeCILL_V2-en.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright2) diff --git a/ports/cppgraphqlgen/CONTROL b/ports/cppgraphqlgen/CONTROL index 3eff11f55c8dd4..30694fac4a9e37 100644 --- a/ports/cppgraphqlgen/CONTROL +++ b/ports/cppgraphqlgen/CONTROL @@ -1,5 +1,5 @@ Source: cppgraphqlgen -Version: 3.2.4 -Build-Depends: boost-filesystem (!uwp&!windows), boost-program-options, pegtl, rapidjson +Version: 2020-12-07 +Build-Depends: boost-program-options, pegtl, rapidjson Description: C++ GraphQL schema service generator Homepage: https://github.com/microsoft/cppgraphqlgen diff --git a/ports/cppgraphqlgen/portfile.cmake b/ports/cppgraphqlgen/portfile.cmake index 4deb05aee68f78..662a38db91e3fb 100644 --- a/ports/cppgraphqlgen/portfile.cmake +++ b/ports/cppgraphqlgen/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO microsoft/cppgraphqlgen - REF v3.2.4 - SHA512 8a73124604f40fdb2d422da4ad8e9c190be5bd2d9dbda92c856f7bb0a716a5a79c1f607526196758a72d1ad4c02795e86eb17c726ad371fe03ceb590e15905e0 + REF fb4a589c84c102d867e7bfb03884d40f7776315b + SHA512 88fedd83b49ae25f2165cff8e3a5e3e46ed853312658924f08b3192c790e92583dc8b8f7a88f39ec17798bd7d986143a78633a89d3867400539c4d315015e29b HEAD_REF master ) diff --git a/ports/cuda/CONTROL b/ports/cuda/CONTROL index 21221160867b73..8b0c0a671c087f 100644 --- a/ports/cuda/CONTROL +++ b/ports/cuda/CONTROL @@ -1,5 +1,5 @@ Source: cuda Version: 10.1 -Port-Version: 4 +Port-Version: 5 Description: A parallel computing platform and programming model Homepage: https://developer.nvidia.com/cuda-toolkit diff --git a/ports/cuda/vcpkg_find_cuda.cmake b/ports/cuda/vcpkg_find_cuda.cmake index 28796008401d93..f04d5098360452 100644 --- a/ports/cuda/vcpkg_find_cuda.cmake +++ b/ports/cuda/vcpkg_find_cuda.cmake @@ -9,6 +9,7 @@ function(vcpkg_find_cuda) set(CUDA_PATHS ENV CUDA_PATH + ENV CUDA_HOME ENV CUDA_BIN_PATH ENV CUDA_PATH_V11_0 ENV CUDA_PATH_V10_2 diff --git a/ports/eastl/CONTROL b/ports/eastl/CONTROL index 4c2814f2e55826..da3a4b734c0c99 100644 --- a/ports/eastl/CONTROL +++ b/ports/eastl/CONTROL @@ -1,5 +1,5 @@ Source: eastl -Version: 3.16.07 +Version: 3.17.03 Homepage: https://github.com/electronicarts/EASTL Description: Electronic Arts Standard Template Library. It is a C++ template library of containers, algorithms, and iterators useful for runtime and tool development across multiple platforms. It is a fairly extensive and robust implementation of such a library and has an emphasis on high performance above all other considerations. Build-Depends: eabase diff --git a/ports/eastl/fix_cmake_install.patch b/ports/eastl/fix_cmake_install.patch index bc8433c075429b..a2dbfd8215744d 100644 --- a/ports/eastl/fix_cmake_install.patch +++ b/ports/eastl/fix_cmake_install.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index b8171cd..44120cc 100644 +index e8700dc..6d3e2f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,12 +4,17 @@ @@ -20,7 +20,7 @@ index b8171cd..44120cc 100644 #------------------------------------------------------------------------------------------- # Compiler Flags #------------------------------------------------------------------------------------------- -@@ -41,10 +46,46 @@ add_definitions(-DEASTL_OPENSOURCE=1) +@@ -41,7 +46,10 @@ add_definitions(-DEASTL_OPENSOURCE=1) #------------------------------------------------------------------------------------------- # Include dirs #------------------------------------------------------------------------------------------- @@ -32,7 +32,10 @@ index b8171cd..44120cc 100644 #------------------------------------------------------------------------------------------- # Dependencies - #------------------------------------------------------------------------------------------- +@@ -50,5 +58,39 @@ if (NOT TARGET EABase) + add_subdirectory(test/packages/EABase) + endif() + -target_link_libraries(EASTL EABase) +target_link_libraries(EASTL PUBLIC EABase) + @@ -62,10 +65,11 @@ index b8171cd..44120cc 100644 + +install(TARGETS EASTL LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") +install(DIRECTORY "include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") - ++ +install( + FILES + "${CMAKE_CURRENT_BINARY_DIR}/EASTLConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/EASTLConfigVersion.cmake" + DESTINATION ${EASTL_CMAKE_CONFIG_DESTINATION} +) + diff --git a/ports/eastl/portfile.cmake b/ports/eastl/portfile.cmake index a446670a546947..1bef06c771a740 100644 --- a/ports/eastl/portfile.cmake +++ b/ports/eastl/portfile.cmake @@ -3,8 +3,8 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO electronicarts/EASTL - REF 1cf6182218bec79ece0b91e762f507e8c027807c # 3.16.07 - SHA512 a0d140a6ff202eb9360a7cbb4ae59881458b628a7bc5ffb19864aba585fd0b02c7f7a2692df2e1c52aa58bc3c3471f27b365fa7770b7d84c038d24884db10b9b + REF 41bd2e4466e33b979d2afc37f9b98dacf1eab50b #v 3.17.03 + SHA512 3011a0a08701b683e22cc624167b4f65fce8b16d0f7a03675f6a1d5b02313c5b763bcc6c8091f65728ed60ceee8d585cbdb1968a35fb24954f4f66afabb23865 HEAD_REF master PATCHES fix_cmake_install.patch diff --git a/ports/flashlight-cuda/portfile.cmake b/ports/flashlight-cuda/portfile.cmake index de9d33b7efb06b..080e7f5e318952 100644 --- a/ports/flashlight-cuda/portfile.cmake +++ b/ports/flashlight-cuda/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO facebookresearch/flashlight - REF cd0aa18b94340afc7cfa9a14281d1c90c0ed42e1 - SHA512 a11392af82054b63c557214c04e59b362aa1eb5897b30a595b26fd22c37c29571e504346947c6b9cebc4499c3af68d2075fd3144dcc0535a27886e34036ac5ff + REF 94486a1108fd0511a05523bfa1cf734bc14022f7 + SHA512 73a7547a26020be21d26393c2758cc235b452a0fb5d8537777bdbcc556f71846e07eca649167902dd7d0743cb7d10738b4e38cd7fe69b51b6122f3241e2edd84 HEAD_REF master ) diff --git a/ports/flashlight-cuda/vcpkg.json b/ports/flashlight-cuda/vcpkg.json index f962304c6227a0..2526e88bdbc02e 100644 --- a/ports/flashlight-cuda/vcpkg.json +++ b/ports/flashlight-cuda/vcpkg.json @@ -1,7 +1,6 @@ { "name": "flashlight-cuda", - "version-string": "20201120", - "port-version": 1, + "version-string": "20201201", "description": "A C++ standalone library for machine learning. CUDA backend.", "supports": "!(windows | osx)", "default-features": [ @@ -43,7 +42,8 @@ ] }, "nccl", - "openmpi" + "openmpi", + "stb" ] }, "imgclass": { diff --git a/ports/fontconfig/CONTROL b/ports/fontconfig/CONTROL index 636b7499a3f145..fcdf2f768db268 100644 --- a/ports/fontconfig/CONTROL +++ b/ports/fontconfig/CONTROL @@ -1,5 +1,6 @@ Source: fontconfig Version: 2.13.1 +Port-Version: 1 Homepage: https://www.freedesktop.org/software/fontconfig/front.html Description: Library for configuring and customizing font access. Build-Depends: freetype, expat, libiconv, dirent, pthread, json-c, dirent, libuuid (!windows&!osx), gettext \ No newline at end of file diff --git a/ports/fontconfig/fix_def_dll_name.patch b/ports/fontconfig/fix_def_dll_name.patch new file mode 100644 index 00000000000000..cae76fc93a14e0 --- /dev/null +++ b/ports/fontconfig/fix_def_dll_name.patch @@ -0,0 +1,13 @@ +diff --git a/src/Makefile.am b/src/Makefile.am +index 3cf93a7f8..c80f4dd83 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -218,7 +218,7 @@ fontconfig.def: $(PUBLIC_FILES) $(PUBLIC_FT_FILES) + (cat $(PUBLIC_FILES) $(PUBLIC_FT_FILES) || echo 'FcERROR ()' ) | \ + $(GREP) '^Fc[^ ]* *(' | $(SED) -e 's/ *(.*$$//' -e 's/^/ /' | \ + sort; \ +- echo LIBRARY libfontconfig-@LIBT_CURRENT_MINUS_AGE@.dll; \ ++ echo LIBRARY fontconfig-@LIBT_CURRENT_MINUS_AGE@.dll; \ + echo VERSION @LIBT_CURRENT@.@LIBT_REVISION@) >$@ + @ ! $(GREP) -q FcERROR $@ || ($(RM) $@; false) + diff --git a/ports/fontconfig/portfile.cmake b/ports/fontconfig/portfile.cmake index b4641e3525eada..150bca5e9554bd 100644 --- a/ports/fontconfig/portfile.cmake +++ b/ports/fontconfig/portfile.cmake @@ -1,5 +1,9 @@ set(FONTCONFIG_VERSION 2.13.1) +if(NOT VCPKG_TARGET_IS_MINGW AND VCPKG_TARGET_IS_WINDOWS) + set(PATCHES fix_def_dll_name.patch) +endif() + vcpkg_from_gitlab( GITLAB_URL https://gitlab.freedesktop.org OUT_SOURCE_PATH SOURCE_PATH @@ -10,6 +14,7 @@ vcpkg_from_gitlab( PATCHES remove_tests.patch build.patch build2.patch + ${PATCHES} ) vcpkg_find_acquire_program(GPERF) diff --git a/ports/freetds/portfile.cmake b/ports/freetds/portfile.cmake index 8cc487770cd698..c3f0b5f948e05a 100644 --- a/ports/freetds/portfile.cmake +++ b/ports/freetds/portfile.cmake @@ -30,6 +30,7 @@ endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA + DISABLE_PARALLEL_CONFIGURE OPTIONS ${FEATURE_OPTIONS} ) diff --git a/ports/freetds/vcpkg.json b/ports/freetds/vcpkg.json index d24a72769eda7a..b653876fcb2600 100644 --- a/ports/freetds/vcpkg.json +++ b/ports/freetds/vcpkg.json @@ -1,6 +1,7 @@ { "name": "freetds", "version-string": "1.2.11", + "port-version": 1, "description": "Implementation of the Tabular Data Stream protocol", "homepage": "https://www.freetds.org", "supports": "windows & !uwp", diff --git a/ports/google-cloud-cpp/CONTROL b/ports/google-cloud-cpp/CONTROL index 43818b2298b13c..bc8df7224988dc 100644 --- a/ports/google-cloud-cpp/CONTROL +++ b/ports/google-cloud-cpp/CONTROL @@ -1,5 +1,5 @@ Source: google-cloud-cpp -Version: 1.20.0 +Version: 1.21.0 Build-Depends: abseil, grpc, curl[ssl], crc32c, nlohmann-json Description: C++ Client Libraries for Google Cloud Platform APIs. Homepage: https://github.com/googleapis/google-cloud-cpp diff --git a/ports/google-cloud-cpp/portfile.cmake b/ports/google-cloud-cpp/portfile.cmake index cdab0a1a75905f..5dbf51f5ce2564 100644 --- a/ports/google-cloud-cpp/portfile.cmake +++ b/ports/google-cloud-cpp/portfile.cmake @@ -5,8 +5,8 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO googleapis/google-cloud-cpp - REF v1.20.0 - SHA512 47af82c1d34a6e2981f627c89994fd832d2cea33d196439db0605c40efaf8db4ba074d556ece3a80a7404cceab09a0f216cc2dc0a8fac7eb2ff9674545f47fa9 + REF v1.21.0 + SHA512 a7988156cef199934ad471eb79724c59eb5a2ff941d71887257c5e95a39d1c78ee9e4295a6e42585a3ce11a4cd9d10af64fbf423560936b8546b26c772e6fa2c HEAD_REF master ) diff --git a/ports/kuku/CMakeLists-windows.patch b/ports/kuku/CMakeLists-windows.patch new file mode 100644 index 00000000000000..88ce013e20cb77 --- /dev/null +++ b/ports/kuku/CMakeLists-windows.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c4a87db..10d3eb2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -13,10 +13,6 @@ cmake_minimum_required(VERSION 3.12) + + project(Kuku VERSION 2.0.0 LANGUAGES CXX C) + +-if(${MSVC}) +- message(FATAL_ERROR "Please build using the attached Visual Studio solution/project files.") +-endif() +- + ######################## + # Global configuration # + ######################## diff --git a/ports/kuku/CONTROL b/ports/kuku/CONTROL new file mode 100644 index 00000000000000..2e377be56c718b --- /dev/null +++ b/ports/kuku/CONTROL @@ -0,0 +1,4 @@ +Source: kuku +Version: 2.0 +Homepage: https://github.com/microsoft/Kuku +Description: Kuku is a simple open-source (MIT licensed) cuckoo hashing library developed by the Cryptography and Privacy Research group at Microsoft. diff --git a/ports/kuku/portfile.cmake b/ports/kuku/portfile.cmake new file mode 100644 index 00000000000000..975dda6d8d69ac --- /dev/null +++ b/ports/kuku/portfile.cmake @@ -0,0 +1,24 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO microsoft/Kuku + REF e7cd2d6ad7f8886061c8e4b85890ede69cec3929 + SHA512 8220a8e839bd247d6a8d1049562028c620353d0cabee0681383d1457bda544ff1394709eeaa82a92a8c0d3491cc9f15de1a14b78a86e8f97ee1da68eb50c982e + HEAD_REF master + PATCHES CMakeLists-windows.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + DISABLE_PARALLEL_CONFIGURE +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/Kuku-2.0) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/libbson/CONTROL b/ports/libbson/CONTROL index 6c929c8830e620..c74336ee5b3d2b 100644 --- a/ports/libbson/CONTROL +++ b/ports/libbson/CONTROL @@ -1,5 +1,5 @@ Source: libbson Version: 1.16.1 -Port-Version: 1 +Port-Version: 2 Description: libbson is a library providing useful routines related to building, parsing, and iterating BSON documents. Homepage: https://github.com/mongodb/libbson diff --git a/ports/libbson/portfile.cmake b/ports/libbson/portfile.cmake index 8430b3ef62c959..477f2eb671cdf1 100644 --- a/ports/libbson/portfile.cmake +++ b/ports/libbson/portfile.cmake @@ -20,6 +20,8 @@ file(READ ${CMAKE_CURRENT_LIST_DIR}/CONTROL _contents) string(REGEX MATCH "\nVersion:[ ]*[^ \n]+" _contents "${_contents}") string(REGEX REPLACE ".+Version:[ ]*([\\.0-9]+).*" "\\1" BUILD_VERSION "${_contents}") +file(WRITE "${BUILD_VERSION}" ${SOURCE_PATH}/VERSION_CURRENT) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -31,6 +33,7 @@ vcpkg_configure_cmake( -DENABLE_EXAMPLES=OFF -DENABLE_STATIC=${ENABLE_STATIC} -DBUILD_VERSION=${BUILD_VERSION} + -DCMAKE_DISABLE_FIND_PACKAGE_PythonInterp=ON ) vcpkg_install_cmake() @@ -44,6 +47,7 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static) else() vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libbson-${PORT_POSTFIX} TARGET_PATH share/bson-${PORT_POSTFIX}) endif() + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver) diff --git a/ports/libcopp/CONTROL b/ports/libcopp/CONTROL index 568bf6ea9171ef..dcb8a8db935851 100644 --- a/ports/libcopp/CONTROL +++ b/ports/libcopp/CONTROL @@ -1,5 +1,5 @@ Source: libcopp -Version: 1.3.2 +Version: 1.3.4 Description: A cross-platfrom coroutine library for C++ Maintainer: owent Homepage: https://libcopp.atframe.work/ diff --git a/ports/libcopp/portfile.cmake b/ports/libcopp/portfile.cmake index fbf0e8791be2d3..0b74e7b923d57b 100644 --- a/ports/libcopp/portfile.cmake +++ b/ports/libcopp/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO owt5008137/libcopp - REF c61ac3bd5f9d2a74e58a800caa7230bbe8170d8b # 1.3.2 - SHA512 e1a3e6bbff2dbe1530447300a0a65a2f142cca32e79cb43b0d7b0b4bc5a2444fe49bfdfd7017e8de5ef6f31f32d88a9d94fddb07608ed4982be929155d47183b + REF d7ee2550fdcaf3961e4284bb5218e3ed05be437c # 1.3.4 + SHA512 0fa7a83c17046e187183d0244828e82adeb5e39e75b27757d1b540fd8948c48b02de40edea706d588ba553a276c4f2f8e9e3dad78065e515a1652abe4fbea8b0 HEAD_REF v2 ) diff --git a/ports/libjpeg-turbo/CONTROL b/ports/libjpeg-turbo/CONTROL index 3ee860999a74b5..f8a66e50cc6206 100644 --- a/ports/libjpeg-turbo/CONTROL +++ b/ports/libjpeg-turbo/CONTROL @@ -1,4 +1,11 @@ Source: libjpeg-turbo Version: 2.0.5 +Port-Version: 1 Homepage: https://github.com/libjpeg-turbo/libjpeg-turbo Description: libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, NEON, AltiVec) to accelerate baseline JPEG compression and decompression on x86, x86-64, ARM, and PowerPC systems. + +Feature: jpeg7 +Description: Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward-incompatible with libjpeg v6b!) + +Feature: jpeg8 +Description: Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward-incompatible with libjpeg v6b!) diff --git a/ports/libjpeg-turbo/portfile.cmake b/ports/libjpeg-turbo/portfile.cmake index 95fae01c2b3afc..f4a55e0783c018 100644 --- a/ports/libjpeg-turbo/portfile.cmake +++ b/ports/libjpeg-turbo/portfile.cmake @@ -28,6 +28,11 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ENABLE_SHARED) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ENABLE_STATIC) string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" WITH_CRT_DLL) +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + jpeg7 WITH_JPEG7 + jpeg8 WITH_JPEG8 +) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -37,6 +42,7 @@ vcpkg_configure_cmake( -DENABLE_EXECUTABLES=OFF -DINSTALL_DOCS=OFF -DWITH_CRT_DLL=${WITH_CRT_DLL} + ${FEATURE_OPTIONS} ${LIBJPEGTURBO_SIMD} OPTIONS_DEBUG -DINSTALL_HEADERS=OFF ) @@ -62,24 +68,17 @@ else(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") endif() endif() -file(COPY +file(INSTALL ${SOURCE_PATH}/LICENSE.md - DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} + DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright ) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/man) -file(GLOB EXE ${CURRENT_PACKAGES_DIR}/bin/*.exe) -file(GLOB DEBUG_EXE ${CURRENT_PACKAGES_DIR}/debug/bin/*.exe) -if(EXE OR DEBUG_EXE) - file(REMOVE ${EXE} ${DEBUG_EXE}) -endif() - file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/jpeg) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/libjpeg-turbo/LICENSE.md ${CURRENT_PACKAGES_DIR}/share/libjpeg-turbo/copyright) vcpkg_copy_pdbs() diff --git a/ports/libpqxx/CONTROL b/ports/libpqxx/CONTROL index 8692e13dd15b91..b32a7c39b2269b 100644 --- a/ports/libpqxx/CONTROL +++ b/ports/libpqxx/CONTROL @@ -1,5 +1,5 @@ Source: libpqxx -Version: 7.2.0 +Version: 7.2.1 Homepage: https://github.com/jtv/libpqxx Description: The official C++ client API for PostgreSQL Build-Depends: libpq[core] diff --git a/ports/libpqxx/portfile.cmake b/ports/libpqxx/portfile.cmake index 6c234bb318a392..8f18f039f7d4e3 100644 --- a/ports/libpqxx/portfile.cmake +++ b/ports/libpqxx/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO jtv/libpqxx - REF 5015f8aa620ed8103840549b57fb46a5524f41ce # 7.2.0 - SHA512 54f8886dd5189785c13f6d5c6a7f9d417474a2250d00bd0eff346d3e307ca6cc0fca11136c924b5c231833b0d6ec7e6680114682022e2b065921a4fe8eecdef5 + REF e63674fec320624e0bea32e5e5b7b5ff2c6c269d # 7.2.1 + SHA512 681ae839f6c6d4706ec59eab60516ce7c43abbfa0115a50ce2dc4c09b5107762ae71f00aa56a8b6019965c3138deaf3c42cb761e7fddd4d522169d92a11c0867 HEAD_REF master ) diff --git a/ports/libtorrent/CONTROL b/ports/libtorrent/CONTROL index 707cf8a4389129..566948d4b41c28 100644 --- a/ports/libtorrent/CONTROL +++ b/ports/libtorrent/CONTROL @@ -1,6 +1,5 @@ Source: libtorrent -Version: 1.2.10 -Port-Version: 2 +Version: 1.2.11 Homepage: https://github.com/arvidn/libtorrent Description: An efficient feature complete C++ BitTorrent implementation Build-Depends: openssl, boost-system, boost-date-time, boost-chrono, boost-random, boost-asio, boost-crc, boost-config, boost-iterator, boost-scope-exit, boost-multiprecision, boost-pool, boost-variant @@ -17,11 +16,10 @@ Build-Depends: libiconv (windows) Description: build with libiconv on Windows Feature: python -Build-Depends: boost-python, libtorrent[deprfun] +Build-Depends: boost-python Description: build the python bindings in bindings/python directory Feature: test -Build-Depends: libtorrent[deprfun] Description: build the libtorrent tests Feature: tools diff --git a/ports/libtorrent/add-datetime-to-boost-libs.patch b/ports/libtorrent/add-datetime-to-boost-libs.patch deleted file mode 100644 index e9eeae91921ae1..00000000000000 --- a/ports/libtorrent/add-datetime-to-boost-libs.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9efd451fb..7ff587631 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -719,9 +719,9 @@ else() - endif() - - # Boost --find_public_dependency(Boost REQUIRED COMPONENTS system) -+find_public_dependency(Boost REQUIRED COMPONENTS system date_time) - target_include_directories(torrent-rasterbar PUBLIC ${Boost_INCLUDE_DIRS}) --target_link_libraries(torrent-rasterbar PUBLIC ${Boost_SYSTEM_LIBRARY}) -+target_link_libraries(torrent-rasterbar PUBLIC ${Boost_LIBRARIES}) - - if (exceptions) - if (MSVC) diff --git a/ports/libtorrent/fix_python_cmake.patch b/ports/libtorrent/fix_python_cmake.patch deleted file mode 100644 index f114b8621a351e..00000000000000 --- a/ports/libtorrent/fix_python_cmake.patch +++ /dev/null @@ -1,130 +0,0 @@ -diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt -index 53e09439f..de027f965 100644 ---- a/bindings/python/CMakeLists.txt -+++ b/bindings/python/CMakeLists.txt -@@ -1,7 +1,6 @@ - # To build python bindings we need a python executable and boost python module. Unfortunately, - # their names might not be interlinked and we can not implement a general solution. --# The code below assumes default boost installation, when the module for python 2 is named --# 'python' and the module for python 3 is named 'python3'. -+# The code below assumes default boost installation, when the module for python 3 is named 'python3'. - # To customize that one can provide a name for the Boost::python module via - # 'boost-python-module-name' variable when invoking cmake. - # E.g. on Gentoo with python 3.6 and Boost::python library name 'libboost_python-3.6.so' -@@ -15,12 +14,9 @@ - # Sets _ret to a list of python versions (major.minor) that use the same MSVC runtime as this build does - # assumes MSVC was detected already - # See https://en.wikipedia.org/wiki/Microsoft_Visual_C++#Internal_version_numbering -+# See https://devguide.python.org/#status-of-python-branches for supported python versions - function(_get_compatible_python_versions _ret) -- if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) -- list(APPEND _tmp 2.6 2.7 3.0 3.1 3.2) -- elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) -- list(APPEND _tmp 3.3 3.4) -- elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 20) -+ if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 20) - list(APPEND _tmp 3.5 3.6 3.7 3.8) - endif() - set(${_ret} ${_tmp} PARENT_SCOPE) -@@ -31,23 +27,22 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND NOT skip-python-runtime-test) - _get_compatible_python_versions(Python_ADDITIONAL_VERSIONS) - endif() - --find_package(PythonInterp REQUIRED) -+find_package(Python3 COMPONENTS Interpreter Development REQUIRED) - if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND NOT skip-python-runtime-test) -- message(STATUS "Testing found python version. Requested: ${Python_ADDITIONAL_VERSIONS}, found: ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") -- if (NOT "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" IN_LIST Python_ADDITIONAL_VERSIONS) -- message(FATAL_ERROR "Incompatible Python and C runtime: MSVC ${CMAKE_CXX_COMPILER_VERSION} and Python ${PYTHON_VERSION_STRING}") -+ message(STATUS "Testing found python version. Requested: ${Python_ADDITIONAL_VERSIONS}, found: ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") -+ if (NOT "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}" IN_LIST Python_ADDITIONAL_VERSIONS) -+ message(FATAL_ERROR "Incompatible Python and C runtime: MSVC ${CMAKE_CXX_COMPILER_VERSION} and Python ${Python3_VERSION}") - endif() - endif() - --set(Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") --find_package(PythonLibs REQUIRED) -+set(Python_ADDITIONAL_VERSIONS "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") - - if (NOT boost-python-module-name) - # use active python - # if (PYTHON_VERSION_STRING VERSION_GREATER_EQUAL "3") - # set(_boost-python-module-name "python${PYTHON_VERSION_MAJOR}") - # else() -- set(_boost-python-module-name "python") # to overwrite possible value from a previous run -+ set(_boost-python-module-name "python${Python3_VERSION_MAJOR}") # to overwrite possible value from a previous run - # endif() - endif() - -@@ -55,7 +50,7 @@ set(boost-python-module-name ${_boost-python-module-name} CACHE STRING "Boost:py - - find_package(Boost REQUIRED COMPONENTS ${boost-python-module-name}) - --python_add_module(python-libtorrent -+Python3_add_library(python-libtorrent STATIC - src/module.cpp - src/sha1_hash.cpp - src/converters.cpp -@@ -80,12 +75,12 @@ python_add_module(python-libtorrent - - set_target_properties(python-libtorrent - PROPERTIES -- OUTPUT_NAME libtorrent -+ OUTPUT_NAME torrent - ) - - target_include_directories(python-libtorrent - PRIVATE -- ${PYTHON_INCLUDE_DIRS} -+ ${Python3_INCLUDE_DIRS} - ) - - string(TOUPPER "${boost-python-module-name}" boost_python_module_name_uppercase) -@@ -96,7 +91,7 @@ target_link_libraries(python-libtorrent - # Boost::python adds that but without a path to the library. Therefore we have to either - # provide the path (but, unfortunately, FindPythonLibs.cmake does not return the library dir), - # or give the full file name here (this FindPythonLibs.cmake provides to us). -- ${PYTHON_LIBRARIES} -+ ${Python3_LIBRARIES} - ) - - # Bindings module uses deprecated libtorrent features, thus we disable these warnings -@@ -108,7 +103,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - endif() - - execute_process(COMMAND -- ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig; -+ ${Python3_EXECUTABLE} -c "import distutils.sysconfig; - print(';'.join(map(str, [ - distutils.sysconfig.get_python_lib(plat_specific=True, prefix=''), - distutils.sysconfig.get_config_var('EXT_SUFFIX') -@@ -119,13 +114,11 @@ list(GET _python_sysconfig_vars 0 PYTHON_SITE_PACKAGES) - list(GET _python_sysconfig_vars 1 PYTHON_EXT_SUFFIX) - - message(STATUS "Python site packages: ${PYTHON_SITE_PACKAGES}") --# python 2 does not provide the 'EXT_SUFFIX' sysconfig variable, so we use cmake default then --if (NOT "${PYTHON_EXT_SUFFIX}" STREQUAL "None") -- message(STATUS "Python extension suffix: ${PYTHON_EXT_SUFFIX}") -- # we mimic the name, created by setuptools -- # example: libtorrent.cpython-36m-x86_64-linux-gnu.so -- set_target_properties(python-libtorrent PROPERTIES SUFFIX ${PYTHON_EXT_SUFFIX}) --endif() -+ -+message(STATUS "Python extension suffix: ${PYTHON_EXT_SUFFIX}") -+# we mimic the name, created by setuptools -+# example: libtorrent.cpython-36m-x86_64-linux-gnu.so -+set_target_properties(python-libtorrent PROPERTIES SUFFIX ${PYTHON_EXT_SUFFIX}) - - set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/setup.py.cmake.in") - set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py") -@@ -135,8 +128,8 @@ set(DEPS python-libtorrent "${SETUP_PY}") - configure_file(${SETUP_PY_IN} ${SETUP_PY} @ONLY) - - add_custom_command(OUTPUT ${OUTPUT} -- COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} build -b "${CMAKE_CURRENT_SOURCE_DIR}" -- COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} egg_info -b "${CMAKE_CURRENT_SOURCE_DIR}" -+ COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} build -b "${CMAKE_CURRENT_SOURCE_DIR}" -+ COMMAND ${Python3_EXECUTABLE} ${SETUP_PY} egg_info -b "${CMAKE_CURRENT_SOURCE_DIR}" - COMMAND ${CMAKE_COMMAND} -E touch ${OUTPUT} - DEPENDS ${DEPS}) - diff --git a/ports/libtorrent/portfile.cmake b/ports/libtorrent/portfile.cmake index e548b9b44187d5..ec1d7d07561333 100644 --- a/ports/libtorrent/portfile.cmake +++ b/ports/libtorrent/portfile.cmake @@ -37,12 +37,10 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO arvidn/libtorrent - REF libtorrent-1.2.10 - SHA512 e6de939fb6527783695e0b6623ddbe27f85842a36c0899b93ea0284cb3c6f3d14b8c39e29316adb3bf9acac7804f38385cc06854a32df28e7f4f6839af9f382d + REF v1.2.11 + SHA512 d502286f67bf462f14169daafe12b94ca723598530c85360c3a4b3c73535202b63632036248fdecc942cb559e66e6a5cb5afa830dc78bbff72a6c9a330710b62 HEAD_REF RC_1_2 PATCHES - add-datetime-to-boost-libs.patch - fix_python_cmake.patch ${ICONV_PATCH} ) diff --git a/ports/libxml2/CMakeLists.txt b/ports/libxml2/CMakeLists.txt index 323f64c34eb60d..bdc3939bff1325 100644 --- a/ports/libxml2/CMakeLists.txt +++ b/ports/libxml2/CMakeLists.txt @@ -108,6 +108,19 @@ if(INSTALL_HEADERS) set_target_properties(libxml2 PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") endif() target_include_directories(libxml2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include include ${LIBLZMA_INCLUDE_DIRS}) +get_property(LIBRARIES TARGET Iconv::Iconv PROPERTY INTERFACE_LINK_LIBRARIES) +if(LIBRARIES) + set_property(TARGET Iconv::Iconv PROPERTY INTERFACE_LINK_LIBRARIES "") + foreach(LIBRARY ${LIBRARIES}) + # Since `libc.so` has no SONAME, CMake maps e.g. `/usr/lib/x86_64-linux-gnu/libc.so` to `-llibc`. + # This is not found: it should be mapped to `-lc`. + if(LIBRARY MATCHES "/libc\\.so$") + set_property(TARGET Iconv::Iconv APPEND PROPERTY INTERFACE_LINK_LIBRARIES "c") + else() + set_property(TARGET Iconv::Iconv APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${LIBRARY}") + endif() + endforeach() +endif() target_link_libraries(libxml2 PRIVATE Iconv::Iconv ZLIB::ZLIB diff --git a/ports/libxml2/CONTROL b/ports/libxml2/CONTROL index 462ecfec676d6e..fe8dec589f3cac 100644 --- a/ports/libxml2/CONTROL +++ b/ports/libxml2/CONTROL @@ -1,6 +1,6 @@ Source: libxml2 Version: 2.9.10 -Port-Version: 1 +Port-Version: 2 Homepage: https://xmlsoft.org/ Description: Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform) Build-Depends: zlib, libiconv, liblzma diff --git a/ports/magic-enum/CONTROL b/ports/magic-enum/CONTROL index 51bc8e7f723c02..25dc3520f99d2d 100644 --- a/ports/magic-enum/CONTROL +++ b/ports/magic-enum/CONTROL @@ -1,4 +1,4 @@ Source: magic-enum -Version: 0.7.0 +Version: 0.7.1 Description: Header-only C++17 library provides static reflection for enums, work with any enum type without any macro or boilerplate code. Homepage: https://github.com/Neargye/magic_enum diff --git a/ports/magic-enum/portfile.cmake b/ports/magic-enum/portfile.cmake index d2437e02e6359c..11b48af3b5f1ae 100644 --- a/ports/magic-enum/portfile.cmake +++ b/ports/magic-enum/portfile.cmake @@ -3,8 +3,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO Neargye/magic_enum - REF v0.7.0 - SHA512 f56c081063846b87e8b811babe9a0e961efd29bef52359e14cb33773f8393640196c0808e201800c3adb82d0bf362d1f941e31df0fc3739d35a367f918409822 + REF v0.7.1 + SHA512 0eff2901d9829289fa36811fd428a9a6b66d6b88971948a385c9e74e5bbe3f52f4b80321c96a4d002bfe2c9b3d45e9bae8fbe17d718643fa318ab845b887be09 HEAD_REF master ) diff --git a/ports/microsoft-signalr/CONTROL b/ports/microsoft-signalr/CONTROL index 0cec60bf9f9bfa..6b0f314a33c334 100644 --- a/ports/microsoft-signalr/CONTROL +++ b/ports/microsoft-signalr/CONTROL @@ -1,5 +1,6 @@ Source: microsoft-signalr -Version: 0.1.0-alpha1-1 +Version: 0.1.0-alpha1 +Port-Version: 2 Description: C++ Client for ASP.NET Core SignalR. Default-Features: default-features Homepage: https://github.com/aspnet/SignalR-Client-Cpp diff --git a/ports/microsoft-signalr/portfile.cmake b/ports/microsoft-signalr/portfile.cmake index e566f594e49a3b..ff5b6074c7ca99 100644 --- a/ports/microsoft-signalr/portfile.cmake +++ b/ports/microsoft-signalr/portfile.cmake @@ -4,6 +4,7 @@ vcpkg_from_github( REF v0.1.0-alpha1 SHA512 d37eea194b0352a08dd89ac7622bdd6224312ad48a31d8ab36627a8aaff5e795e3513ad010eed516703f6da842a95119c1a4a290b145a43e91ff80a37fff8676 HEAD_REF master + PATCHES remove-fno-rtti-compile-option.patch ) vcpkg_check_features( @@ -30,6 +31,6 @@ vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) -file(COPY ${SOURCE_PATH}/third-party-notices.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/microsoft-signalr) +file(COPY ${SOURCE_PATH}/third-party-notices.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) vcpkg_copy_pdbs() \ No newline at end of file diff --git a/ports/microsoft-signalr/remove-fno-rtti-compile-option.patch b/ports/microsoft-signalr/remove-fno-rtti-compile-option.patch new file mode 100644 index 00000000000000..4c2aac20c7b305 --- /dev/null +++ b/ports/microsoft-signalr/remove-fno-rtti-compile-option.patch @@ -0,0 +1,17 @@ +diff --git a/src/signalrclient/CMakeLists.txt b/src/signalrclient/CMakeLists.txt +index 42d64d3..10fa72f 100644 +--- a/src/signalrclient/CMakeLists.txt ++++ b/src/signalrclient/CMakeLists.txt +@@ -58,10 +58,10 @@ else() + target_compile_options(signalrclient PRIVATE -Wall) + endif() + +- # GCC on OSX has a bug with exceptions and no-rtti that can cause crashes +- if(NOT APPLE) ++ # boost-asio (a dependency) doesn't support fno-rtti anymore ++ if(0) + target_compile_options(signalrclient PRIVATE -fno-rtti) + endif() + target_compile_options(signalrclient PRIVATE -Wextra -Wpedantic -Wno-unknown-pragmas) + endif() + diff --git a/ports/mongo-c-driver/CONTROL b/ports/mongo-c-driver/CONTROL index 7bbddb172e2b87..5cc9c336ea59a5 100644 --- a/ports/mongo-c-driver/CONTROL +++ b/ports/mongo-c-driver/CONTROL @@ -1,6 +1,6 @@ Source: mongo-c-driver -Version: 1.16.1-1 -Port-Version: 1 +Version: 1.16.1 +Port-Version: 3 Build-Depends: libbson, openssl (!windows), zlib Description: Client library written in C for MongoDB. Homepage: https://github.com/mongodb/mongo-c-driver diff --git a/ports/mongo-c-driver/portfile.cmake b/ports/mongo-c-driver/portfile.cmake index 74a1d8c0d27175..9ddf3a6b41da61 100644 --- a/ports/mongo-c-driver/portfile.cmake +++ b/ports/mongo-c-driver/portfile.cmake @@ -40,6 +40,8 @@ file(READ ${CMAKE_CURRENT_LIST_DIR}/CONTROL _contents) string(REGEX MATCH "\nVersion:[ ]*[^ \n]+" _contents "${_contents}") string(REGEX REPLACE ".+Version:[ ]*([\\.0-9]+).*" "\\1" BUILD_VERSION "${_contents}") +file(WRITE "${BUILD_VERSION}" ${SOURCE_PATH}/VERSION_CURRENT) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -55,6 +57,7 @@ vcpkg_configure_cmake( -DENABLE_ZLIB=SYSTEM -DENABLE_STATIC=${ENABLE_STATIC} -DBUILD_VERSION=${BUILD_VERSION} + -DCMAKE_DISABLE_FIND_PACKAGE_PythonInterp=ON ${FEATURE_OPTIONS} ) diff --git a/ports/monkeys-audio/CONTROL b/ports/monkeys-audio/CONTROL index 4ccdbc52a51cb7..6a9b6a2a3c9740 100644 --- a/ports/monkeys-audio/CONTROL +++ b/ports/monkeys-audio/CONTROL @@ -1,5 +1,5 @@ Source: monkeys-audio -Version: 5.59 +Version: 5.65 Homepage: https://monkeysaudio.com Description: Monkey's Audio is an excellent audio compression tool which has multiple advantages over traditional methods. Audio files compressed with it end with .ape extension. diff --git a/ports/monkeys-audio/portfile.cmake b/ports/monkeys-audio/portfile.cmake index 4fed4a0520431d..338310604b45fd 100644 --- a/ports/monkeys-audio/portfile.cmake +++ b/ports/monkeys-audio/portfile.cmake @@ -2,12 +2,12 @@ vcpkg_fail_port_install(ON_TARGET "UWP" "OSX" "Linux") vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) -set(MA_VERSION 559c) +set(MA_VERSION 565d) vcpkg_download_distfile(ARCHIVE URLS "https://monkeysaudio.com/files/MAC_SDK_${MA_VERSION}.zip" FILENAME "MAC_SDK_${MA_VERSION}.zip" - SHA512 83ed3e2a4de62cb95e508a12146cecfe6bb584ce3cb30c20ae2f8e2f76839f4a83a4a0f68399a68dfd56829bcd5678824bcdf46730ae6662e14a5248522c0554 + SHA512 785273b4fe19dad284b2c51fb648b2cbae66af069fac75745909862e084e8bfe175703b0997b20cd15a54985e8d707810d8cdcc849692767e71ace924ddfd951 ) vcpkg_extract_source_archive_ex( diff --git a/ports/moos-core/CONTROL b/ports/moos-core/CONTROL index 15a5a5e1f7c0b9..1d1e20d0920c12 100644 --- a/ports/moos-core/CONTROL +++ b/ports/moos-core/CONTROL @@ -1,4 +1,5 @@ Source: moos-core -Version: 10.4.0-4 +Version: 10.4.0 +Port-Version: 5 Description: A very light weight, easy to use middleware. Homepage: https://sites.google.com/site/moossoftware/ diff --git a/ports/moos-core/portfile.cmake b/ports/moos-core/portfile.cmake index b3bdda6ff95e88..197467428edef2 100644 --- a/ports/moos-core/portfile.cmake +++ b/ports/moos-core/portfile.cmake @@ -13,6 +13,7 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA + DISABLE_PARALLEL_CONFIGURE OPTIONS -DCMAKE_ENABLE_EXPORT=OFF ) diff --git a/ports/nanobench/CONTROL b/ports/nanobench/CONTROL index f8366a089e4fb7..7e01f0e1f1c849 100644 --- a/ports/nanobench/CONTROL +++ b/ports/nanobench/CONTROL @@ -1,4 +1,4 @@ Source: nanobench -Version: 4.0.0 +Version: 4.3.0 Homepage: https://nanobench.ankerl.com Description: Simple, fast, accurate single-header microbenchmarking functionality for C++11/14/17/20 diff --git a/ports/nanobench/portfile.cmake b/ports/nanobench/portfile.cmake index 272306f264a76e..86b144ca5f102b 100644 --- a/ports/nanobench/portfile.cmake +++ b/ports/nanobench/portfile.cmake @@ -2,8 +2,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO martinus/nanobench - REF c534992696b9341274c6714931d0064d74239fcb #v4.0.0 - SHA512 09078f1100c6f843e7646b8aaab687c32e71ba2dc05a2a5b282c72ab064ceffbf4aeb5ad14c4a2bdbe2ea66dca9cd207dee5eade44f77844cddfa490b4c09c32 + REF ee8b36e956bb2b8753dd1f6732b4d9d90afb09f9 #v4.3.0 + SHA512 46807f3b945d062dd3c829ec349cc892f9b2334c8a3c74c1225b0cd918af6864a1e539ac2bbad0ee6e20d285b5ad8e307e72996f2531377c55683cb0593ed3e7 HEAD_REF master ) diff --git a/ports/nettle/CONTROL b/ports/nettle/CONTROL index 49308ce9580128..e8cffedd7d0b91 100644 --- a/ports/nettle/CONTROL +++ b/ports/nettle/CONTROL @@ -1,6 +1,6 @@ Source: nettle Version: 3.5.1 -Port-Version: 4 +Port-Version: 5 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), yasm-tool-helper (windows) diff --git a/ports/nettle/portfile.cmake b/ports/nettle/portfile.cmake index 2d3fc952abfc54..616d9af2888326 100644 --- a/ports/nettle/portfile.cmake +++ b/ports/nettle/portfile.cmake @@ -84,7 +84,7 @@ if(VCPKG_TARGET_IS_WINDOWS) set(exec_prefix "\${prefix}") set(libdir "\${prefix}/lib") set(includedir "\${prefix}/include") - set(LIBS -lnettle -lgmp) + set(LIBS "-lnettle -lgmp") configure_file("${SOURCE_PATH}/nettle.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/nettle.pc" @ONLY) set(HOGWEED -lhogweed) set(LIBS -lnettle) @@ -93,7 +93,7 @@ if(VCPKG_TARGET_IS_WINDOWS) set(exec_prefix "\${prefix}") set(libdir "\${prefix}/lib") set(includedir "\${prefix}/../include") - set(LIBS -lnettled -lgmpd) + set(LIBS "-lnettled -lgmpd") configure_file("${SOURCE_PATH}/nettle.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/nettle.pc" @ONLY) set(LIBS -lnettled) set(HOGWEED -lhogweedd) diff --git a/ports/nghttp2/CONTROL b/ports/nghttp2/CONTROL index 6afd6f83b1a254..7f0bf107d6f8df 100644 --- a/ports/nghttp2/CONTROL +++ b/ports/nghttp2/CONTROL @@ -1,4 +1,4 @@ Source: nghttp2 -Version: 1.39.2-2 +Version: 1.42.0 Homepage: https://github.com/nghttp2/nghttp2 Description: Implementation of the Hypertext Transfer Protocol version 2 in C diff --git a/ports/nghttp2/portfile.cmake b/ports/nghttp2/portfile.cmake index c7b5a5388d6bf0..9ed523648d0bf7 100644 --- a/ports/nghttp2/portfile.cmake +++ b/ports/nghttp2/portfile.cmake @@ -1,5 +1,5 @@ set(LIB_NAME nghttp2) -set(LIB_VERSION 1.39.2) +set(LIB_VERSION 1.42.0) set(LIB_FILENAME ${LIB_NAME}-${LIB_VERSION}.tar.gz) @@ -7,7 +7,7 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO nghttp2/nghttp2 REF v${LIB_VERSION} - SHA512 1ddfb8c6538e209e39199fb5e2f9c262d58d188f25c98cd03f9f733bb261055b7625f0f79863731b112e69bc40c9d6a7d10d4fe69f56c615127e03277ee3af1d + SHA512 717494c9aa4eda64414535752df947d62311e7aed5cc6c4936400fcb2c9fc2818923668bcabc3e1bc61154d660f6765dad120e5a113d9eee3e934d66ee63a406 HEAD_REF master ) @@ -30,6 +30,7 @@ vcpkg_configure_cmake( ) vcpkg_install_cmake() +vcpkg_fixup_pkgconfig() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) diff --git a/ports/opencascade/CONTROL b/ports/opencascade/CONTROL index a171581b606133..7d26a2cc495a5f 100644 --- a/ports/opencascade/CONTROL +++ b/ports/opencascade/CONTROL @@ -1,9 +1,9 @@ Source: opencascade Version: 7.4.0 -Port-Version: 1 +Port-Version: 2 Build-Depends: freetype Description: Open CASCADE Technology (OCCT) is an open-source software development platform for 3D CAD, CAM, CAE. -Supports: !(uwp|osx|linux|arm|static) +Supports: !(uwp|osx|linux|arm) Feature: freeimage Build-Depends: freeimage diff --git a/ports/opencascade/fix-build-with-vs2017.patch b/ports/opencascade/fix-build-with-vs2017.patch new file mode 100644 index 00000000000000..53b0ab0ea837c8 --- /dev/null +++ b/ports/opencascade/fix-build-with-vs2017.patch @@ -0,0 +1,13 @@ +diff --git a/adm/cmake/occt_defs_flags.cmake b/adm/cmake/occt_defs_flags.cmake +index 203ca6b..4ff433a 100644 +--- a/adm/cmake/occt_defs_flags.cmake ++++ b/adm/cmake/occt_defs_flags.cmake +@@ -18,7 +18,7 @@ endif() + + # Turn off the "improved inline analyzer" that stalls on x86 release builds using MSVC 16.7 for 32-bit + if (NOT CMAKE_SIZEOF_VOID_P EQUAL 8) +- if (MSVC) ++ if (MSVC AND MSVC_VERSION GREATER 1919) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /d2DeepThoughtInliner-") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /d2DeepThoughtInliner-") + endif() diff --git a/ports/opencascade/fix-static-build.patch b/ports/opencascade/fix-static-build.patch new file mode 100644 index 00000000000000..05c105f588e45d --- /dev/null +++ b/ports/opencascade/fix-static-build.patch @@ -0,0 +1,76 @@ +diff --git a/adm/cmake/freetype.cmake b/adm/cmake/freetype.cmake +index 7f6f950..ca0c525 100644 +--- a/adm/cmake/freetype.cmake ++++ b/adm/cmake/freetype.cmake +@@ -111,6 +111,8 @@ if (IS_BUILTIN_SEARCH_REQUIRED) + endif() + + find_package(Freetype) ++ find_package(freetype CONFIG REQUIRED) ++ set(FREETYPE_LIBRARY freetype) + + # restore ENV{FREETYPE_DIR} + if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}") +@@ -230,6 +232,22 @@ endif() + # set 3RDPARTY_FREETYPE_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_LIBRARY + set (3RDPARTY_FREETYPE_LIBRARY "3RDPARTY_FREETYPE_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to freetype library" FORCE) + ++ if (BUILD_SHARED_LIBS) ++ if (CMAKE_BUILD_TYPE STREQUAL "Debug") ++ get_target_property(3RDPARTY_FREETYPE_LIBRARY freetype IMPORTED_IMPLIB_DEBUG) ++ else() ++ get_target_property(3RDPARTY_FREETYPE_LIBRARY freetype IMPORTED_IMPLIB_RELEASE) ++ endif() ++ else() ++ if (CMAKE_BUILD_TYPE STREQUAL "Debug") ++ get_target_property(3RDPARTY_FREETYPE_LIBRARY freetype IMPORTED_LOCATION_DEBUG) ++ else() ++ get_target_property(3RDPARTY_FREETYPE_LIBRARY freetype IMPORTED_LOCATION_RELEASE) ++ endif() ++ endif() ++ get_filename_component(3RDPARTY_FREETYPE_LIBRARY_DIR ${3RDPARTY_FREETYPE_LIBRARY} DIRECTORY) ++ ++ if(0) + if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}") + find_library (3RDPARTY_FREETYPE_LIBRARY ${CSF_FREETYPE} + PATHS "${3RDPARTY_FREETYPE_LIBRARY_DIR}" "${3RDPARTY_FREETYPE_DIR}" +@@ -257,9 +275,10 @@ endif() + + set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "The path to freetype library" FORCE) + endif() ++ endif() + + # freetype shared library +- if (WIN32) ++ if (0) + if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}") + + set (CMAKE_FIND_LIBRARY_SUFFIXES .dll) +diff --git a/adm/cmake/occt_toolkit.cmake b/adm/cmake/occt_toolkit.cmake +index f59b163..92175e4 100644 +--- a/adm/cmake/occt_toolkit.cmake ++++ b/adm/cmake/occt_toolkit.cmake +@@ -208,7 +208,7 @@ if (EXECUTABLE_PROJECT) + else() + add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RESOURCE_FILES} ${${PROJECT_NAME}_MOC_FILES}) + +- if (MSVC) ++ if (MSVC AND BUILD_SHARED_LIBS) + install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb + CONFIGURATIONS Debug RelWithDebInfo + DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}") +diff --git a/src/Font/Font_FontMgr.cxx b/src/Font/Font_FontMgr.cxx +index 4fad2f6..ba64b51 100644 +--- a/src/Font/Font_FontMgr.cxx ++++ b/src/Font/Font_FontMgr.cxx +@@ -36,10 +36,6 @@ IMPLEMENT_STANDARD_RTTIEXT(Font_FontMgr,Standard_Transient) + #include + #include + +- #ifdef _MSC_VER +- #pragma comment (lib, "freetype.lib") +- #endif +- + namespace + { + diff --git a/ports/opencascade/portfile.cmake b/ports/opencascade/portfile.cmake index dd953124859a26..0a8bff0447a499 100644 --- a/ports/opencascade/portfile.cmake +++ b/ports/opencascade/portfile.cmake @@ -1,5 +1,4 @@ vcpkg_fail_port_install(ON_ARCH "arm" "arm64" ON_TARGET "UWP" "OSX" "Linux") -vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH @@ -7,9 +6,18 @@ vcpkg_from_github( REF V7_4_0 SHA512 595ad7226b9365c1a7670b77001f71787a5d8aaa4a93a4a4d8eb938564670d79ae5a247ae7cc770b5da53c9a9f2e4166ba6e5ae104c1f2debad19ec2187f4a56 HEAD_REF master - PATCHES fix-msvc-32bit-builds.patch + PATCHES + fix-msvc-32bit-builds.patch + fix-build-with-vs2017.patch + fix-static-build.patch ) +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + set(BUILD_TYPE "Shared") +else() + set(BUILD_TYPE "Static") +endif() + vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS "freeimage" USE_FREEIMAGE "tbb" USE_TBB @@ -24,25 +32,21 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA - OPTIONS - -DBUILD_LIBRARY_TYPE="Shared" + OPTIONS ${FEATURE_OPTIONS} + -DBUILD_LIBRARY_TYPE=${BUILD_TYPE} -DBUILD_MODULE_Draw=OFF -DINSTALL_DIR_LAYOUT=Unix -DBUILD_SAMPLES_MFC=OFF -DBUILD_SAMPLES_QT=OFF -DBUILD_DOC_Overview=OFF - ## Options from vcpkg_check_features() - ${FEATURE_OPTIONS} + -DINSTALL_TEST_CASES=OFF + -DINSTALL_SAMPLES=OFF ) vcpkg_install_cmake() vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/opencascade TARGET_PATH share/opencascade) -# debug creates libd and bind directories that need moving -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) -file(RENAME ${CURRENT_PACKAGES_DIR}/debug/bind ${CURRENT_PACKAGES_DIR}/debug/bin) - # Remove libd to lib, libd just has cmake files we dont want too file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/libd ${CURRENT_PACKAGES_DIR}/debug/lib) @@ -50,26 +54,36 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/libd ${CURRENT_PACKAGES_DIR}/debug/lib file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) -# fix paths in target files -list(APPEND TARGET_FILES - ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEApplicationFrameworkTargets-debug.cmake - ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADECompileDefinitionsAndFlags-debug.cmake - ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEDataExchangeTargets-debug.cmake - ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEFoundationClassesTargets-debug.cmake - ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEModelingAlgorithmsTargets-debug.cmake - ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEModelingDataTargets-debug.cmake - ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEVisualizationTargets-debug.cmake -) -foreach(TARGET_FILE ${TARGET_FILES}) - file(READ ${TARGET_FILE} filedata) - string(REGEX REPLACE "libd" "lib" filedata "${filedata}") - string(REGEX REPLACE "bind" "bin" filedata "${filedata}") - file(WRITE ${TARGET_FILE} ${filedata}) -endforeach() -# the bin directory ends up with bat files that are noise, let's clean that up -file(GLOB BATS ${CURRENT_PACKAGES_DIR}/bin/*.bat) -file(REMOVE_RECURSE ${BATS}) +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + # debug creates libd and bind directories that need moving + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) + file(RENAME ${CURRENT_PACKAGES_DIR}/debug/bind ${CURRENT_PACKAGES_DIR}/debug/bin) + + # fix paths in target files + list(APPEND TARGET_FILES + ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEApplicationFrameworkTargets-debug.cmake + ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADECompileDefinitionsAndFlags-debug.cmake + ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEDataExchangeTargets-debug.cmake + ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEFoundationClassesTargets-debug.cmake + ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEModelingAlgorithmsTargets-debug.cmake + ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEModelingDataTargets-debug.cmake + ${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEVisualizationTargets-debug.cmake + ) + + foreach(TARGET_FILE ${TARGET_FILES}) + file(READ ${TARGET_FILE} filedata) + string(REGEX REPLACE "libd" "lib" filedata "${filedata}") + string(REGEX REPLACE "bind" "bin" filedata "${filedata}") + file(WRITE ${TARGET_FILE} ${filedata}) + endforeach() + # the bin directory ends up with bat files that are noise, let's clean that up + file(GLOB BATS ${CURRENT_PACKAGES_DIR}/bin/*.bat) + file(REMOVE_RECURSE ${BATS}) +else() + # remove scripts in bin dir + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() file(INSTALL ${SOURCE_PATH}/OCCT_LGPL_EXCEPTION.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/osg/CONTROL b/ports/osg/CONTROL index 241d89f52b09b4..1a1fb7d6b8a1ad 100644 --- a/ports/osg/CONTROL +++ b/ports/osg/CONTROL @@ -1,9 +1,9 @@ Source: osg Version: 3.6.5 -Port-Version: 3 +Port-Version: 4 Homepage: https://github.com/openscenegraph/OpenSceneGraph Description: The OpenSceneGraph is an open source high performance 3D graphics toolkit. -Build-Depends: zlib, fontconfig, boost-asio (!windows), boost-core (!windows), boost-logic (!windows), boost-lexical-cast (!windows), boost-smart-ptr (!windows), boost-tuple (!windows), boost-bind (!windows), freeglut (windows), expat (windows), openimageio (osx) +Build-Depends: zlib, fontconfig, freeglut (windows), expat (windows), openimageio (osx) Feature: collada Description: Support for Collada (.dae) files @@ -19,7 +19,7 @@ Build-Depends: freetype, sdl1, sdl2, libiconv (windows) Feature: plugins Description: Build OSG Plugins - Disable for compile testing examples on a time limit -Build-Depends: freetype, sdl1, curl, openexr, ilmbase, gdal, giflib (windows), jasper, libjpeg-turbo, libpng, tiff, libxml2 (windows), libiconv (windows), libgta, liblas, nvtt, coin +Build-Depends: freetype, sdl1, curl, openexr, ilmbase, gdal, giflib (windows), jasper, libjpeg-turbo, libpng, tiff, libxml2 (windows), libiconv (windows), libgta, liblas, nvtt (!x86), coin, boost-asio (!windows), boost-core (!windows), boost-logic (!windows), boost-lexical-cast (!windows), boost-smart-ptr (!windows), boost-tuple (!windows), boost-bind (!windows) Feature: packages Description: Set to ON to generate CPack configuration files and packaging targets diff --git a/ports/pcl/CONTROL b/ports/pcl/CONTROL index f44015523a03e6..4590159012fe65 100644 --- a/ports/pcl/CONTROL +++ b/ports/pcl/CONTROL @@ -1,5 +1,6 @@ Source: pcl Version: 1.11.1 +Port-Version: 1 Homepage: https://github.com/PointCloudLibrary/pcl Description: Point Cloud Library (PCL) is open source library for 2D/3D image and point cloud processing. Build-Depends: eigen3, flann, qhull, libpng, boost-system, boost-filesystem, boost-thread, boost-date-time, boost-iostreams, boost-random, boost-foreach, boost-dynamic-bitset, boost-property-map, boost-graph, boost-multi-array, boost-signals2, boost-sort, boost-ptr-container, boost-uuid, boost-interprocess, boost-asio diff --git a/ports/pcl/portfile.cmake b/ports/pcl/portfile.cmake index de5752e7459452..6fe027ce9cb7c0 100644 --- a/ports/pcl/portfile.cmake +++ b/ports/pcl/portfile.cmake @@ -12,6 +12,7 @@ vcpkg_from_github( fix-link-libpng.patch remove-broken-targets.patch fix-check-sse.patch + realsense2.patch ) file(REMOVE ${SOURCE_PATH}/cmake/Modules/FindFLANN.cmake) diff --git a/ports/pcl/realsense2.patch b/ports/pcl/realsense2.patch new file mode 100644 index 00000000000000..cfe2cc41f1b255 --- /dev/null +++ b/ports/pcl/realsense2.patch @@ -0,0 +1,13 @@ +diff --git a/io/src/real_sense_2_grabber.cpp b/io/src/real_sense_2_grabber.cpp +index d13231e..06d1238 100644 +--- a/io/src/real_sense_2_grabber.cpp ++++ b/io/src/real_sense_2_grabber.cpp +@@ -287,7 +287,7 @@ namespace pcl + cloud->width = sp.width (); + cloud->height = sp.height (); + cloud->is_dense = false; +- cloud->points.resize ( size () ); ++ cloud->points.resize ( points.size () ); + + const auto cloud_vertices_ptr = points.get_vertices (); + const auto cloud_texture_ptr = points.get_texture_coordinates (); diff --git a/ports/pegtl/CONTROL b/ports/pegtl/CONTROL index be3e18fc5e406f..4fdc23ea38b9c6 100644 --- a/ports/pegtl/CONTROL +++ b/ports/pegtl/CONTROL @@ -1,4 +1,4 @@ Source: pegtl -Version: 3.0.0-pre-70971f4 +Version: 2020-12-07 Description: The Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency C++ header-only parser combinator library for creating parsers according to a Parsing Expression Grammar (PEG). Homepage: https://github.com/taocpp/PEGTL diff --git a/ports/pegtl/portfile.cmake b/ports/pegtl/portfile.cmake index 6735a36efd0341..cde2031469b9ba 100644 --- a/ports/pegtl/portfile.cmake +++ b/ports/pegtl/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO taocpp/pegtl - REF 70971f441d7611ba3905b5c0d5c8bf4338602ef2 - SHA512 8ff0f06eaa59e547e4f00002d27241f99f06b398d7cd021c3b8475431d59234d0aa32fff8ce74faee3468c9fb542020326547a6d9cd7b98561b3bdd233a1e715 + REF 93b53c80058b2632a7260ab10ef2a06abcc0fc7f + SHA512 83b198465bca60b95c670aa72681aed0448025b506c6f6a196446608eb47ee9d8828c51ac8735caa2b2ec1e53d6a13bd6ad287a4abb8690a570036b90918907a HEAD_REF master ) diff --git a/ports/pugixml/CONTROL b/ports/pugixml/CONTROL index 2d4b2a42c9d27f..65e6732495b46c 100644 --- a/ports/pugixml/CONTROL +++ b/ports/pugixml/CONTROL @@ -1,5 +1,4 @@ Source: pugixml -Version: 1.10 -Port-Version: 2 +Version: 1.11.1 Homepage: https://github.com/zeux/pugixml -Description: C++ XML processing library +Description: Light-weight, simple and fast XML parser for C++ with XPath support diff --git a/ports/pugixml/portfile.cmake b/ports/pugixml/portfile.cmake index a96d0adbe69227..72381eb5d8d0da 100644 --- a/ports/pugixml/portfile.cmake +++ b/ports/pugixml/portfile.cmake @@ -1,10 +1,9 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO zeux/pugixml - REF v1.10 - SHA512 0634053d4f757b9293997763bb2e51595197c192f3974e954975d6d6ff91e4a6cb7c194efa530e0eef1a2a93db16592c5630010b6482430dff5ffc6879e84b6a + REF v1.11.1 + SHA512 94a79a28d96e763cdd8951c4d0b20aefb43cd1b32cbf5a5354b09f2636710e960e2dbfa56534b61c8d6ddecb2126a006e5f485c1465a97376e1cc077df25f16e HEAD_REF master - PATCHES pugixml-v1.10_fix_debug_pkgconfig.patch # Upstream: https://github.com/zeux/pugixml/pull/363 ) vcpkg_configure_cmake( diff --git a/ports/pugixml/pugixml-v1.10_fix_debug_pkgconfig.patch b/ports/pugixml/pugixml-v1.10_fix_debug_pkgconfig.patch deleted file mode 100644 index 24d428d98a1c32..00000000000000 --- a/ports/pugixml/pugixml-v1.10_fix_debug_pkgconfig.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f043962..b281cba 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -94,6 +94,16 @@ install(TARGETS ${LIBRARY} EXPORT pugixml-config - install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${INSTALL_SUFFIX}) - install(EXPORT pugixml-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml) - -+if (USE_POSTFIX) -+ if(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo) -+ set(LIB_POSTFIX "_r") -+ elseif(CMAKE_BUILD_TYPE MATCHES MinSizeRel) -+ set(LIB_POSTFIX "_m") -+ elseif(CMAKE_BUILD_TYPE MATCHES Debug) -+ set(LIB_POSTFIX "_d") -+ endif() -+endif() -+ - configure_file(scripts/pugixml.pc.in ${PROJECT_BINARY_DIR}/pugixml.pc @ONLY) - install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig) - -diff --git a/scripts/pugixml.pc.in b/scripts/pugixml.pc.in -index f9c3fd4..7958774 100644 ---- a/scripts/pugixml.pc.in -+++ b/scripts/pugixml.pc.in -@@ -8,4 +8,4 @@ Description: Light-weight, simple and fast XML parser for C++ with XPath support - URL: https://pugixml.org/ - Version: @pugixml_VERSION@ - Cflags: -I${includedir} --Libs: -L${libdir} -lpugixml -+Libs: -L${libdir} -lpugixml@LIB_POSTFIX@ diff --git a/ports/quill/CONTROL b/ports/quill/CONTROL index e6a4da865aadab..30f3ccddf8b0b6 100644 --- a/ports/quill/CONTROL +++ b/ports/quill/CONTROL @@ -1,5 +1,5 @@ Source: quill -Version: 1.5.2 +Version: 1.6.0 Homepage: https://github.com/odygrd/quill/ Description: C++14 Asynchronous Low Latency Logging Library Supports: !(arm|uwp|android) diff --git a/ports/quill/portfile.cmake b/ports/quill/portfile.cmake index 746e710d4bd25c..91c197b81d90cb 100644 --- a/ports/quill/portfile.cmake +++ b/ports/quill/portfile.cmake @@ -1,11 +1,12 @@ vcpkg_fail_port_install(ON_ARCH "arm" ON_TARGET "uwp") + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO odygrd/quill - REF 5a4dbedd2e59249719f0053b86f521c2b8cfca83 # v1.5.2 - SHA512 3328d13acf65364ee51fa954e279e854c867d542ec1dc6ce0ee1385fd53a9105009f56d8fa5ccd6e623dc19dba25e7b3ce0f4974756e9a461e77a05ce1a3aac2 + REF a893abd49188c5567340ae38fd14ecbac02286f7 # v1.6.0 + SHA512 35b20c12b441e96af17cc373004c040dc8b8b43263d12924d60ea8068ccb4e2eaa4cd8e5a4099cc5d46f6f8f1651252d1f041287c76579dca87b6a1c6a729612 HEAD_REF master ) @@ -17,7 +18,7 @@ vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS - -DQUILL_FMT_EXTERNAL=ON + -DQUILL_FMT_EXTERNAL=ON ) vcpkg_install_cmake() diff --git a/ports/termcolor/portfile.cmake b/ports/termcolor/portfile.cmake new file mode 100644 index 00000000000000..7ff0af33dedd3f --- /dev/null +++ b/ports/termcolor/portfile.cmake @@ -0,0 +1,17 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ikalnytskyi/termcolor + REF v1.0.1 + SHA512 15deaa7d225fa7934c207e6a57d89fd4c0ea5ebef38c4ff58ff27e19f444b030c265406a525f545592d67cff2b24ed839992693bb6d043cb3d8bca986c53fd95 + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${port}/ TARGET_PATH share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib ${CURRENT_PACKAGES_DIR}/debug) +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/termcolor/vcpkg.json b/ports/termcolor/vcpkg.json new file mode 100644 index 00000000000000..b226e8d3a89b97 --- /dev/null +++ b/ports/termcolor/vcpkg.json @@ -0,0 +1,6 @@ +{ + "name": "termcolor", + "version-string": "1.0.1", + "description": "Termcolor is a header-only C++ library for printing colored messages to the terminal.", + "homepage": "https://github.com/ikalnytskyi/termcolor" +} diff --git a/ports/usockets/CMakeLists.txt b/ports/usockets/CMakeLists.txt index 0a5fd0dae2e0ed..a57ce6b08a626e 100644 --- a/ports/usockets/CMakeLists.txt +++ b/ports/usockets/CMakeLists.txt @@ -24,8 +24,10 @@ set(USOCKETS_EXT_INCLUDE_DIR ) set(USOCKETS_EXT_LIBS ) if (CMAKE_USE_OPENSSL) + # It requires C++17 or later, see https://github.com/uNetworking/uSockets/blob/master/Makefile#L43 + set(CMAKE_CXX_STANDARD 17) find_package(OpenSSL REQUIRED) - file(GLOB SSL_SOURCES src/crypto/*.c) + file(GLOB SSL_SOURCES src/crypto/*.c*) list(APPEND SOURCES ${SSL_SOURCES}) list(APPEND USOCKETS_EXT_LIBS OpenSSL::SSL OpenSSL::Crypto) endif() diff --git a/ports/usockets/CONTROL b/ports/usockets/CONTROL index 7d7efdb48e886e..e8dc13ac68ca08 100644 --- a/ports/usockets/CONTROL +++ b/ports/usockets/CONTROL @@ -1,5 +1,6 @@ Source: usockets Version: 0.6.0 +Port-Version: 1 Build-Depends:libuv Description: Miniscule cross-platform eventing, networking & crypto for async applications diff --git a/ports/vtk-m/CONTROL b/ports/vtk-m/CONTROL index 6fe2933c298fcf..e221eeccecd23c 100644 --- a/ports/vtk-m/CONTROL +++ b/ports/vtk-m/CONTROL @@ -1,5 +1,6 @@ Source: vtk-m Version: 1.5.0 +Port-Version: 1 Homepage: https://gitlab.kitware.com/vtk/vtk-m/ Description: VTK-m is a toolkit of scientific visualization algorithms for emerging processor architectures. Supports: x64 & !uwp diff --git a/ports/vtk-m/portfile.cmake b/ports/vtk-m/portfile.cmake index 658a12d2ea5889..c33eb065fdca9a 100644 --- a/ports/vtk-m/portfile.cmake +++ b/ports/vtk-m/portfile.cmake @@ -41,7 +41,8 @@ vcpkg_from_gitlab(GITLAB_URL "https://gitlab.kitware.com" OUT_SOURCE_PATH SOURCE_PATH REPO vtk/vtk-m REF f2aa6ad5be1a97e3fb41ef4680ee2c76c3434ac0 # v1.5.0 Version is strongly locked to VTK 9.0. Upgrading will most likly brake the VTK build - SHA512 2f2a273f74d9a583df9e25a4792440d8d89652fa14b3153f2ea5afbd329b50970e7b9bd68e0ccd036baf5c1f3ad7a8302d95c01dbb30d9a46c045987eebf5370) + SHA512 35e8a2c0ad6cd3c1f02a71a50d781c89f93909ad27030b406fd69f4fea5c1862c48a6e541fd07562947322c3a69bdfdb54206ae51bb86ef7a710f9e9898e9638 + FILE_DISAMBIGUATOR 1) # For people only wanting vtk-m and not VTK #REF 74ffad9bd0679d061bc87e544a728f1c3c926269 # v1.5.1 #SHA512 c9e1c18432b6c11ae086445255acf9477fe4c888122a2b2a9713dc63a40d2e4c2375742157526b5f0869f14c62a4ad66d81ee58d6cc75a1d53a1d615525a03c9) diff --git a/ports/wepoll/CONTROL b/ports/wepoll/CONTROL deleted file mode 100644 index f4882434a3f610..00000000000000 --- a/ports/wepoll/CONTROL +++ /dev/null @@ -1,4 +0,0 @@ -Source: wepoll -Version: 1.5.8 -Description: Fast epoll for windows -Homepage: https://github.com/piscisaureus/wepoll diff --git a/ports/wepoll/vcpkg.json b/ports/wepoll/vcpkg.json new file mode 100644 index 00000000000000..c2d14c63730b74 --- /dev/null +++ b/ports/wepoll/vcpkg.json @@ -0,0 +1,8 @@ +{ + "name": "wepoll", + "version-string": "1.5.8", + "port-version": 1, + "description": "Fast epoll for windows", + "homepage": "https://github.com/piscisaureus/wepoll", + "supports": "windows" +} diff --git a/ports/x265/CONTROL b/ports/x265/CONTROL index 58fe1b99ebd028..269a4c30d37068 100644 --- a/ports/x265/CONTROL +++ b/ports/x265/CONTROL @@ -1,5 +1,5 @@ Source: x265 Version: 3.4 -Port-Version: 1 +Port-Version: 2 Homepage: https://github.com/videolan/x265 Description: x265 is a H.265 / HEVC video encoder application library, designed to encode video or images into an H.265 / HEVC encoded bitstream. diff --git a/ports/x265/portfile.cmake b/ports/x265/portfile.cmake index 754e4127f2f3da..01fa6688df0557 100644 --- a/ports/x265/portfile.cmake +++ b/ports/x265/portfile.cmake @@ -63,6 +63,17 @@ if(VCPKG_TARGET_IS_MINGW AND ENABLE_SHARED) endif() if(UNIX) + foreach(FILE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/x265.pc" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/x265.pc") + if(EXISTS "${FILE}") + file(READ "${FILE}" _contents) + string(REPLACE " -lstdc++" "" _contents "${_contents}") + string(REPLACE " -lc++" "" _contents "${_contents}") + string(REPLACE " -lgcc_s" "" _contents "${_contents}") + string(REPLACE " -lgcc" "" _contents "${_contents}") + string(REPLACE " -lrt" "" _contents "${_contents}") + file(WRITE "${FILE}" "${_contents}") + endif() + endforeach() vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES numa) else() vcpkg_fixup_pkgconfig() diff --git a/scripts/azure-pipelines/end-to-end-tests.ps1 b/scripts/azure-pipelines/end-to-end-tests.ps1 index 3b6fe5aaaa3fa6..99e56ce45db0cf 100644 --- a/scripts/azure-pipelines/end-to-end-tests.ps1 +++ b/scripts/azure-pipelines/end-to-end-tests.ps1 @@ -91,6 +91,18 @@ function Run-Vcpkg { ./vcpkg @testArgs } +##### Test spaces in the path +Refresh-TestRoot +$CurrentTest = "zlib with spaces in path" +Write-Host $CurrentTest +./vcpkg install zlib "--triplet" $Triplet ` + "--no-binarycaching" ` + "--x-buildtrees-root=$TestingRoot/build Trees" ` + "--x-install-root=$TestingRoot/instalL ed" ` + "--x-packages-root=$TestingRoot/packaG es" +Throw-IfFailed + +##### Binary caching tests if (-not $IsLinux -and -not $IsMacOS) { Refresh-TestRoot # Test msbuild props and targets diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index e5503f3866d75d..fa1a64622e34c9 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -74,7 +74,7 @@ vcpkgCheckRepoTool() __tool=$1 if ! command -v "$__tool" >/dev/null 2>&1 ; then echo "Could not find $__tool. Please install it (and other dependencies) with:" - echo "sudo apt-get install curl unzip tar" + echo "sudo apt-get install curl zip unzip tar" exit 1 fi } diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 55516b1f72ec94..d721bbafa36149 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -503,14 +503,17 @@ endfunction() # DESTINATION - the runtime directory for those targets (usually `bin`) function(x_vcpkg_install_local_dependencies) if(_VCPKG_TARGET_TRIPLET_PLAT MATCHES "windows|uwp") - cmake_parse_arguments(PARSE_ARGV __VCPKG_APPINSTALL "" "DESTINATION" "TARGETS") + cmake_parse_arguments(PARSE_ARGV 0 __VCPKG_APPINSTALL "" "DESTINATION" "TARGETS") _vcpkg_set_powershell_path() foreach(TARGET IN LISTS __VCPKG_APPINSTALL_TARGETS) - install(CODE "message(\"-- Installing app dependencies for ${TARGET}...\") - execute_process(COMMAND \"${_VCPKG_POWERSHELL_PATH}\" -noprofile -executionpolicy Bypass -file \"${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1\" - -targetBinary \"\${CMAKE_INSTALL_PREFIX}/${__VCPKG_APPINSTALL_DESTINATION}/$\" - -installedDir \"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/bin\" - -OutVariable out)") + get_target_property(TARGETTYPE ${TARGET} TYPE) + if(NOT TARGETTYPE STREQUAL "INTERFACE_LIBRARY") + install(CODE "message(\"-- Installing app dependencies for ${TARGET}...\") + execute_process(COMMAND \"${_VCPKG_POWERSHELL_PATH}\" -noprofile -executionpolicy Bypass -file \"${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1\" + -targetBinary \"\${CMAKE_INSTALL_PREFIX}/${__VCPKG_APPINSTALL_DESTINATION}/$\" + -installedDir \"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/bin\" + -OutVariable out)") + endif() endforeach() endif() endfunction() diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index e95105dc28568a..79728d8629b3b9 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -100,11 +100,6 @@ chartdir:arm64-windows=fail chartdir:arm-uwp=fail chartdir:x64-uwp=fail chartdir:x64-windows-static=fail -chipmunk:arm64-windows=fail -chipmunk:arm-uwp=fail -chipmunk:x64-linux=fail -chipmunk:x64-osx=fail -chipmunk:x64-uwp=fail chmlib:arm-uwp=fail chmlib:x64-uwp=fail # Chromium Base requires a recent version of Clang to be installed. @@ -461,7 +456,6 @@ ignition-common1:x64-linux=fail ignition-msgs1:arm64-windows=fail ignition-msgs1:arm-uwp=fail ignition-msgs1:x64-uwp=fail -ignition-msgs5:x64-linux=fail ignition-msgs5:arm64-windows=fail ignition-msgs5:arm-uwp=fail ignition-msgs5:x64-uwp=fail @@ -693,11 +687,8 @@ libqcow:x64-windows=skip libqcow:x64-linux=skip libqcow:x86-windows=skip libqcow:arm64-windows=skip - -libraqm:x64-windows-static=fail librdkafka:arm-uwp=fail librdkafka:x64-uwp=fail - # Conflicts with openssl boringssl:arm64-windows = skip boringssl:arm-uwp = skip @@ -998,9 +989,10 @@ numactl:x86-windows=fail nvtt:arm64-windows=fail nvtt:arm-uwp=fail nvtt:x64-uwp=fail -ocilib:arm64-windows=fail ocilib:arm-uwp=fail +ocilib:arm64-windows=fail ocilib:x64-uwp=fail +ocilib:x64-windows-static=fail octomap:arm-uwp=fail octomap:x64-uwp=fail ode:arm64-windows=fail @@ -1106,10 +1098,6 @@ openssl-uwp:x64-osx=fail openssl-uwp:x64-windows=fail openssl-uwp:x64-windows-static=fail openssl-uwp:x86-windows=fail -openssl-windows:arm-uwp=fail -openssl-windows:x64-linux=fail -openssl-windows:x64-osx=fail -openssl-windows:x64-uwp=fail opentracing:arm-uwp=fail opentracing:x64-uwp=fail openvpn3:x64-osx=fail @@ -1459,17 +1447,12 @@ spdk-isal:x64-windows=fail spdk-isal:x64-windows-static=fail spdk-isal:x86-windows=fail speexdsp:x64-linux=fail -speexdsp:x64-osx=fail spirv-tools:arm-uwp=fail spirv-tools:x64-uwp=fail stormlib:arm-uwp=fail stormlib:x64-uwp=fail stxxl:arm-uwp=fail stxxl:x64-uwp=fail -# Sundials was broken by Ninja 1.9.0 https://github.com/ninja-build/ninja/pull/1406 -sundials:arm64-windows=fail -sundials:x64-windows=fail -sundials:x86-windows=fail systemc:arm64-windows=fail systemc:arm-uwp=fail systemc:x64-uwp=fail @@ -1592,10 +1575,6 @@ vxl:x64-windows = skip vxl:x64-windows-static = skip vxl:x86-windows = skip wampcc:arm64-windows=fail -wepoll:arm-uwp=fail -wepoll:x64-uwp=fail -wepoll:x64-linux=fail -wepoll:x64-osx=fail wildmidi:x64-osx=fail wincrypt:x64-linux=fail wincrypt:x64-osx=fail diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 278d7e6a4f4f6a..f8fc6f6f4e2532 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -79,7 +79,7 @@ function(vcpkg_find_acquire_program VAR) set(HASH d353d3dc743ebdc6d1e9f6f2b7a6db3c387c1ce6c890bae8adc8ae5deae8404f4c5e3cf249d1e151e7256d4c5ee9cd317e6c41f3b6f244340de18a24b938e0c4) elseif(VAR MATCHES "NASM") set(PROGNAME nasm) - set(NASM_VERSION 2.14.02) + set(NASM_VERSION 2.15.05) set(PATHS ${DOWNLOADS}/tools/nasm/nasm-${NASM_VERSION}) set(BREW_PACKAGE_NAME "nasm") set(APT_PACKAGE_NAME "nasm") @@ -88,7 +88,7 @@ function(vcpkg_find_acquire_program VAR) "https://fossies.org/windows/misc/nasm-${NASM_VERSION}-win32.zip" ) set(ARCHIVE "nasm-${NASM_VERSION}-win32.zip") - set(HASH a0f16a9f3b668b086e3c4e23a33ff725998e120f2e3ccac8c28293fd4faeae6fc59398919e1b89eed7461685d2730de02f2eb83e321f73609f35bf6b17a23d1e) + set(HASH 9412b8caa07e15eac8f500f6f8fab9f038d95dc25e0124b08a80645607cf5761225f98546b52eac7b894420d64f26c3cbf22c19cd286bbe583f7c964256c97ed) elseif(VAR MATCHES "YASM") set(PROGNAME yasm) set(YASM_VERSION 1.3.0.6.g1962) diff --git a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake index f003b6d2d8f6d2..8f0d950eef5b70 100644 --- a/scripts/cmake/vcpkg_fixup_pkgconfig.cmake +++ b/scripts/cmake/vcpkg_fixup_pkgconfig.cmake @@ -8,8 +8,6 @@ Fix common paths in *.pc files and make everything relativ to $(prefix) vcpkg_fixup_pkgconfig( [RELEASE_FILES ...] [DEBUG_FILES ...] - [SYSTEM_LIBRARIES ...] - [IGNORE_FLAGS ] [SKIP_CHECK] ) ``` @@ -23,37 +21,40 @@ Defaults to every *.pc file in the folder ${CURRENT_PACKAGES_DIR} without ${CURR Specifies a list of files to apply the fixes for debug paths. Defaults to every *.pc file in the folder ${CURRENT_PACKAGES_DIR}/debug/ -### SYSTEM_LIBRARIES -If the *.pc file contains system libraries outside vcpkg these need to be listed here. -VCPKG checks every -l flag for the existence of the required library within vcpkg. +### SKIP_CHECK +Skips the library checks in vcpkg_fixup_pkgconfig. Only use if the script itself has unhandled cases. -### IGNORE_FLAGS -If the *.pc file contains flags in the lib field which are not libraries. These can be listed here +### SYSTEM_PACKAGES (deprecated) +This argument has been deprecated and has no effect. -### SKIP_CHECK -Skips the library checks in vcpkg_fixup_pkgconfig. Only use if the script itself has unhandled cases. +### SYSTEM_LIBRARIES (deprecated) +This argument has been deprecated and has no effect. + +### IGNORE_FLAGS (deprecated) +This argument has been deprecated and has no effect. ## Notes Still work in progress. If there are more cases which can be handled here feel free to add them ## Examples -Just call `vcpkg_fixup_pkgconfig()` after any install step which installs *.pc files. + +* [brotli](https://github.com/Microsoft/vcpkg/blob/master/ports/brotli/portfile.cmake) #]===] -include(vcpkg_internal_escape_regex_control_characters) -function(vcpkg_fixup_pkgconfig_check_files pkg_cfg_cmd _file _config _system_libs _ignore_flags) - # Setup pkg-config paths - set(_VCPKG_INSTALLED_PKGCONF "${CURRENT_INSTALLED_DIR}") - set(_VCPKG_PACKAGES_PKGCONF "${CURRENT_PACKAGES_DIR}") - +function(vcpkg_fixup_pkgconfig_check_files pkg_cfg_cmd _file _config) set(PATH_SUFFIX_DEBUG /debug) - set(PKGCONFIG_INSTALLED_DIR "${_VCPKG_INSTALLED_PKGCONF}${PATH_SUFFIX_${_config}}/lib/pkgconfig") - set(PKGCONFIG_INSTALLED_SHARE_DIR "${_VCPKG_INSTALLED_PKGCONF}/share/pkgconfig") - set(PKGCONFIG_PACKAGES_DIR "${_VCPKG_PACKAGES_PKGCONF}${PATH_SUFFIX_${_config}}/lib/pkgconfig") - set(PKGCONFIG_PACKAGES_SHARE_DIR "${_VCPKG_PACKAGES_PKGCONF}/share/pkgconfig") - - if(ENV{PKG_CONFIG_PATH}) - set(BACKUP_ENV_PKG_CONFIG_PATH_${_config} $ENV{PKG_CONFIG_PATH}) + set(PATH_SUFFIX_RELEASE) + set(PKGCONFIG_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_config}}/lib/pkgconfig") + set(PKGCONFIG_INSTALLED_SHARE_DIR "${CURRENT_INSTALLED_DIR}/share/pkgconfig") + set(PKGCONFIG_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}${PATH_SUFFIX_${_config}}/lib/pkgconfig") + set(PKGCONFIG_PACKAGES_SHARE_DIR "${CURRENT_PACKAGES_DIR}/share/pkgconfig") + + if(DEFINED ENV{PKG_CONFIG_PATH}) + set(BACKUP_ENV_PKG_CONFIG_PATH "$ENV{PKG_CONFIG_PATH}") + else() + unset(BACKUP_ENV_PKG_CONFIG_PATH) + endif() + if(DEFINED ENV{PKG_CONFIG_PATH} AND NOT ENV{PKG_CONFIG_PATH} STREQUAL "") set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_INSTALLED_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}$ENV{PKG_CONFIG_PATH}") else() set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_INSTALLED_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_INSTALLED_SHARE_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_DIR}${VCPKG_HOST_PATH_SEPARATOR}${PKGCONFIG_PACKAGES_SHARE_DIR}") @@ -81,194 +82,31 @@ function(vcpkg_fixup_pkgconfig_check_files pkg_cfg_cmd _file _config _system_lib debug_message("pkg-config output:${_pkg_output}") debug_message("pkg-config error output:${_pkg_error_out}") endif() - - # Get all required libs. --static means we get all libraries required for static linkage - # which is the worst case and includes the case without --static - # This retests already tested *.pc files since pkg-config will recursivly search for - # required packages and add there link flags to the one being tested - # as such NOT_STATIC_PKGCONFIG might be used to deactivate the --static arg to pkg-config - - execute_process(COMMAND "${pkg_cfg_cmd}" --print-errors ${PKGCONFIG_STATIC} --libs ${_package_name} - WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" - RESULT_VARIABLE _pkg_error_var - OUTPUT_VARIABLE _pkg_libs_output - ERROR_VARIABLE _pkg_error_out - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE - ) - if(NOT _pkg_error_var EQUAL 0) - message(STATUS "pkg_cfg_cmd call with:${pkg_cfg_cmd} --libs ${_package_name} failed") - message(STATUS "pkg-config call failed with error code:${_pkg_error_var}") - message(STATUS "pkg-config output:${_pkg_libs_output}") - message(FATAL_ERROR "pkg-config error output:${_pkg_error_out}") - else() - debug_message("pkg-config returned:${_pkg_error_var}") - debug_message("pkg-config output:${_pkg_libs_output}") - debug_message("pkg-config error output:${_pkg_error_out}") - endif() - - execute_process(COMMAND "${pkg_cfg_cmd}" --print-errors --static --libs-only-L ${_package_name} - WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" - RESULT_VARIABLE _pkg_error_var - OUTPUT_VARIABLE _pkg_lib_paths_output - ERROR_VARIABLE _pkg_error_out - OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_STRIP_TRAILING_WHITESPACE - ) - - if(NOT _pkg_error_var EQUAL 0) - message(STATUS "pkg_cfg_cmd call with:${pkg_cfg_cmd} --libs-only-L ${_package_name} failed") - message(STATUS "pkg-config call failed with error code:${_pkg_error_var}") - message(STATUS "pkg-config output:${_pkg_lib_paths_output}") - message(FATAL_ERROR "pkg-config error output:${_pkg_error_out}") - else() - debug_message("pkg-config returned:${_pkg_error_var}") - debug_message("pkg-config output:${_pkg_lib_paths_output}") - debug_message("pkg-config error output:${_pkg_error_out}") - endif() - - string(REPLACE "\\ " "##" _pkg_lib_paths_output "${_pkg_lib_paths_output}") # Whitespace path protection - string(REGEX REPLACE "(^[\t ]*|[\t ]+)-L" ";" _pkg_lib_paths_output "${_pkg_lib_paths_output}") - debug_message("-L LIST TRANSFORMATION:'${_pkg_lib_paths_output}'") - string(REGEX REPLACE "^[\t ]*;" "" _pkg_lib_paths_output "${_pkg_lib_paths_output}") - string(REPLACE "##" "\\ " _pkg_lib_paths_output "${_pkg_lib_paths_output}") - - list(REMOVE_DUPLICATES _pkg_lib_paths_output) # We don't care about linker order and repeats - ## Remove search paths from LIBS - foreach(_search_path IN LISTS _pkg_lib_paths_output) - debug_message("REMOVING:'${_search_path}'") - debug_message("FROM:'${_pkg_libs_output}'") - vcpkg_internal_escape_regex_control_characters(_search_path "${_search_path}") - string(REGEX REPLACE "(^[\t ]*|[\t ]+|;[\t ]*)-L${_search_path}([\t ]+|[\t ]*$)" ";" _pkg_libs_output "${_pkg_libs_output}") # Remove search paths from libs - endforeach() - debug_message("LIBS AFTER -L REMOVAL:'${_pkg_libs_output}'") - - #Make the remaining libs a proper CMake List - string(REPLACE "\\ " "##" _pkg_libs_output "${_pkg_libs_output}") # Whitespace path protection - string(REGEX REPLACE "(^[\t ]*|[\t ]+)-l" ";-l" _pkg_libs_output "${_pkg_libs_output}") - string(REGEX REPLACE "[\t ]*(-pthreads?)" ";\\1" _pkg_libs_output "${_pkg_libs_output}") # handle pthread without -l here (makes a lot of problems otherwise) - string(REGEX REPLACE "^[\t ]*;[\t ]*" "" _pkg_libs_output "${_pkg_libs_output}") - string(REPLACE "##" "\\ " _pkg_libs_output "${_pkg_libs_output}") - - #Windows path transformations - if(CMAKE_HOST_WIN32) - string(REGEX REPLACE "(^|;)/([a-zA-Z])/" "\\1\\2:/" _pkg_lib_paths_output "${_pkg_lib_paths_output}") - string(REGEX REPLACE " /([a-zA-Z])/" ";\\1:/" _pkg_libs_output "${_pkg_libs_output}") - string(REGEX REPLACE "-l/([a-zA-Z])/" "-l\\1:/" _pkg_libs_output "${_pkg_libs_output}") - debug_message("pkg-config output lib paths after replacement (cmake style):${_pkg_lib_paths_output}") - debug_message("pkg-config output lib after replacement (cmake style):${_pkg_libs_output}") - endif() - - if("${_config}" STREQUAL "DEBUG") - set(lib_suffixes d _d _debug -s -sd _s _sd -static -staticd _static _staticd) - elseif("${_config}" STREQUAL "RELEASE") - set(lib_suffixes -s _s -static _static) + if(DEFINED BACKUP_ENV_PKG_CONFIG_PATH) + set(ENV{PKG_CONFIG_PATH} "${BACKUP_ENV_PKG_CONFIG_PATH}") else() - message(FATAL_ERROR "Unknown configuration in vcpkg_fixup_pkgconfig_check_libraries!") + unset(ENV{PKG_CONFIG_PATH}) endif() - - debug_message("IGNORED FLAGS:'${_ignore_flags}'") - debug_message("BEFORE IGNORE FLAGS REMOVAL: ${_pkg_libs_output}") - foreach(_ignore IN LISTS _ignore_flags) # Remove ignore with whitespace - debug_message("REMOVING FLAG:'${_ignore}'") - vcpkg_internal_escape_regex_control_characters(_ignore "${_ignore}") - string(REGEX REPLACE "(^[\t ]*|;[\t ]*|[\t ]+)${_ignore}([\t ]+|[\t ]*;|[\t ]*$)" "\\2" _pkg_libs_output "${_pkg_libs_output}") - debug_message("AFTER REMOVAL: ${_pkg_libs_output}") - endforeach() - - string(REGEX REPLACE ";?[\t ]*;[\t ]*" ";" _pkg_libs_output "${_pkg_libs_output}") # Double ;; and Whitespace before/after ; removal - - debug_message("SYSTEM LIBRARIES:'${_system_libs}'") - debug_message("LIBRARIES in PC:'${_pkg_libs_output}'") - foreach(_system_lib IN LISTS _system_libs) # Remove system libs with whitespace - debug_message("REMOVING:'${_system_lib}'") - debug_message("FROM:'${_pkg_libs_output}'") - string(REGEX REPLACE "(^[\t ]*|;[\t ]*|[\t ]+)(-l?)${_system_lib}([\t ]+|[\t ]*;|[\t ]*$)" "\\3" _pkg_libs_output "${_pkg_libs_output}") - string(REGEX REPLACE "(^[\t ]*|;[\t ]*|[\t ]+)${_system_lib}([\t ]+|[\t ]*;|[\t ]*$)" "\\2" _pkg_libs_output "${_pkg_libs_output}") - string(TOLOWER "${_system_lib}" _system_lib_lower) - string(REGEX REPLACE "(^[\t ]*|;[\t ]*|[\t ]+)(-l?)${_system_lib_lower}([\t ]+|[\t ]*;|[\t ]*$)" "\\3" _pkg_libs_output "${_pkg_libs_output}") - string(REGEX REPLACE "(^[\t ]*|;[\t ]*|[\t ]+)${_system_lib_lower}([\t ]+|[\t ]*;|[\t ]*$)" "\\2" _pkg_libs_output "${_pkg_libs_output}") - debug_message("AFTER REMOVAL:'${_pkg_libs_output}'") - endforeach() - list(REMOVE_DUPLICATES _pkg_libs_output) # We don't care about linker order and repeats - - string(REGEX REPLACE ";?[\t ]*;[\t ]*" ";" _pkg_libs_output "${_pkg_libs_output}") # Double ;; and Whitespace before/after ; removal - - debug_message("Library search paths:${_pkg_lib_paths_output}") - debug_message("Libraries to search:${_pkg_libs_output}") - set(CMAKE_FIND_LIBRARY_SUFFIXES_BACKUP ${CMAKE_FIND_LIBRARY_SUFFIXES}) - list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll.a .a) - foreach(_lib IN LISTS _pkg_libs_output) - if(EXISTS "${_lib}" OR "x${_lib}x" STREQUAL "xx" ) # eat; all ok _lib is a fullpath to a library or empty - continue() - elseif (_lib MATCHES "^-l(.+)$") - debug_message("Library match: CMAKE_MATCH_1:${CMAKE_MATCH_1}") - set(_libname "${CMAKE_MATCH_1}") - if(EXISTS "${_libname}") - debug_message("${_libname} detected as an existing full path!") - continue() # fullpath in -l argument and exists; all ok - endif() - debug_message("CHECK_LIB_${_libname}_${_config} before: ${CHECK_LIB_${_libname}_${_config}}") - find_library(CHECK_LIB_${_libname}_${_config} NAMES ${_libname} PATHS ${_pkg_lib_paths_output} "${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_config}}/lib" NO_DEFAULT_PATH) - debug_message("CHECK_LIB_${_libname}_${_config} after: ${CHECK_LIB_${_libname}_${_config}}") - if(CHECK_LIB_${_libname}_${_config}) - unset(CHECK_LIB_${_libname}_${_config} CACHE) # need to unset or else other configurations will not check correctly - debug_message("CHECK_LIB_${_libname}_${_config} after unset: ${CHECK_LIB_${_libname}_${_config}}") - continue() # found library; all ok - endif() - debug_message("Searching with additional suffixes: '${lib_suffixes}'") - foreach(_lib_suffix IN LISTS lib_suffixes) - string(REPLACE ".dll.a|.a|.lib|.so" "" _name_without_extension "${_libname}") - set(search_name ${_name_without_extension}${_lib_suffix}) - debug_message("Search name: '${search_name}'") - debug_message("CHECK_LIB_${search_name}_${_config} before: ${CHECK_LIB_${search_name}_${_config}}") - debug_message("Search paths:'${_pkg_lib_paths_output}' '${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_config}}/lib'") - find_library(CHECK_LIB_${search_name}_${_config} NAMES ${search_name} PATHS ${_pkg_lib_paths_output} "${CURRENT_INSTALLED_DIR}${PATH_SUFFIX_${_config}}/lib" NO_DEFAULT_PATH) - debug_message("CHECK_LIB_${search_name}_${_config} after: ${CHECK_LIB_${search_name}_${_config}}") - if(CHECK_LIB_${search_name}_${_config}) - message(FATAL_ERROR "Found ${CHECK_LIB_${search_name}_${_config}} with additional '${_lib_suffix}' suffix! Please correct the *.pc file!") - unset(CHECK_LIB_${search_name}_${_config} CACHE) # need to unset or else other configurations will not check correctly - endif() - endforeach() - # Reaching here means error! - message(STATUS "CHECK_LIB_${_libname}_${_config}:${CHECK_LIB_${_libname}_${_config}}") - message(FATAL_ERROR "Library \"${_libname}\" was not found! If it is a system library use the SYSTEM_LIBRARIES parameter for the vcpkg_fixup_pkgconfig call! Otherwise, correct the *.pc file") - else () - message(FATAL_ERROR "Unhandled string \"${_lib}\" was found! If it is a system library use the SYSTEM_LIBRARIES parameter for the vcpkg_fixup_pkgconfig call! Otherwise, correct the *.pc file or add the case to vcpkg_fixup_pkgconfig") - endif() - endforeach() - - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BACKUP}) endfunction() function(vcpkg_fixup_pkgconfig) # parse parameters such that semicolons in options arguments to COMMAND don't get erased - cmake_parse_arguments(PARSE_ARGV 0 _vfpkg "SKIP_CHECK;NOT_STATIC_PKGCONFIG" "" "RELEASE_FILES;DEBUG_FILES;SYSTEM_LIBRARIES;SYSTEM_PACKAGES;IGNORE_FLAGS") - - # Note about SYSTEM_PACKAGES: pkg-config requires all packages mentioned in pc files to exists. Otherwise pkg-config will fail to find the pkg. - # As such naming any SYSTEM_PACKAGES is damned to fail which is why it is not mentioned in the docs at the beginning. - if(VCPKG_SYSTEM_LIBRARIES) - list(APPEND _vfpkg_SYSTEM_LIBRARIES ${VCPKG_SYSTEM_LIBRARIES}) - endif() + cmake_parse_arguments(PARSE_ARGV 0 _vfpkg "SKIP_CHECK" "" "RELEASE_FILES;DEBUG_FILES;SYSTEM_LIBRARIES;SYSTEM_PACKAGES;IGNORE_FLAGS") - if(_vfpkg_NOT_STATIC_PKGCONFIG) - set(PKGCONFIG_STATIC) - else() - set(PKGCONFIG_STATIC --static) - endif() - if(_vfpkg_UNPARSED_ARGUMENTS) - message(FATAL_ERROR "vcpkg_fixup_pkgconfig was passed extra arguments: ${_vfct_UNPARSED_ARGUMENTS}") + message(FATAL_ERROR "vcpkg_fixup_pkgconfig() was passed extra arguments: ${_vfct_UNPARSED_ARGUMENTS}") endif() - vcpkg_internal_escape_regex_control_characters(_vfpkg_ESCAPED_CURRENT_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}") - if(NOT _vfpkg_RELEASE_FILES) - file(GLOB_RECURSE _vfpkg_RELEASE_FILES "${CURRENT_PACKAGES_DIR}/**/*.pc") - list(FILTER _vfpkg_RELEASE_FILES EXCLUDE REGEX "${_vfpkg_ESCAPED_CURRENT_PACKAGES_DIR}/debug/") + if((DEFINED _vfpkg_RELEASE_FILES AND NOT DEFINED _vfpkg_DEBUG_FILES) OR (NOT DEFINED _vfpkg_RELEASE_FILES AND DEFINED _vfpkg_DEBUG_FILES)) + message(FATAL_ERROR "vcpkg_fixup_pkgconfig() requires both or neither of DEBUG_FILES and RELEASE_FILES") endif() - if(NOT _vfpkg_DEBUG_FILES) + if(NOT DEFINED _vfpkg_RELEASE_FILES) + file(GLOB_RECURSE _vfpkg_RELEASE_FILES "${CURRENT_PACKAGES_DIR}/**/*.pc") file(GLOB_RECURSE _vfpkg_DEBUG_FILES "${CURRENT_PACKAGES_DIR}/debug/**/*.pc") + if(_vfpkg_DEBUG_FILES) + list(REMOVE_ITEM _vfpkg_RELEASE_FILES ${_vfpkg_DEBUG_FILES}) + endif() endif() vcpkg_find_acquire_program(PKGCONFIG) @@ -278,60 +116,71 @@ function(vcpkg_fixup_pkgconfig) string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}") string(REGEX REPLACE "([a-zA-Z]):/" "/\\1/" _VCPKG_INSTALLED_DIR "${CURRENT_INSTALLED_DIR}") - debug_message("Release Files: ${_vfpkg_RELEASE_FILES}") - foreach(_file ${_vfpkg_RELEASE_FILES}) - message(STATUS "Fixing pkgconfig file: ${_file}") - get_filename_component(PKG_LIB_SEARCH_PATH "${_file}" DIRECTORY) - file(RELATIVE_PATH RELATIVE_PC_PATH "${PKG_LIB_SEARCH_PATH}" "${CURRENT_PACKAGES_DIR}") - string(REGEX REPLACE "/$" "" RELATIVE_PC_PATH "${RELATIVE_PC_PATH}") - #Correct *.pc file - file(READ "${_file}" _contents) - string(REPLACE "${CURRENT_PACKAGES_DIR}" "\${prefix}" _contents "${_contents}") - string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${prefix}" _contents "${_contents}") - string(REPLACE "${_VCPKG_PACKAGES_DIR}" "\${prefix}" _contents "${_contents}") - string(REPLACE "${_VCPKG_INSTALLED_DIR}" "\${prefix}" _contents "${_contents}") - string(REGEX REPLACE "^prefix[\t ]*=[^\n]*" "" _contents "${_contents}") - string(REGEX REPLACE "[\n]prefix[\t ]*=[^\n]*" "" _contents "${_contents}") - file(WRITE "${_file}" "prefix=\${pcfiledir}/${RELATIVE_PC_PATH}\n${_contents}") - unset(PKG_LIB_SEARCH_PATH) - endforeach() - - if(NOT _vfpkg_SKIP_CHECK) # The check can only run after all files have been corrected! - foreach(_file ${_vfpkg_RELEASE_FILES}) - vcpkg_fixup_pkgconfig_check_files("${PKGCONFIG}" "${_file}" "RELEASE" "${_vfpkg_SYSTEM_LIBRARIES}" "${_vfpkg_IGNORE_FLAGS}") + foreach(CONFIG RELEASE DEBUG) + debug_message("${CONFIG} Files: ${_vfpkg_${CONFIG}_FILES}") + if(VCPKG_BUILD_TYPE STREQUAL "debug" AND CONFIG STREQUAL "RELEASE") + continue() + endif() + if(VCPKG_BUILD_TYPE STREQUAL "release" AND CONFIG STREQUAL "DEBUG") + continue() + endif() + foreach(_file ${_vfpkg_${CONFIG}_FILES}) + message(STATUS "Fixing pkgconfig file: ${_file}") + get_filename_component(PKG_LIB_SEARCH_PATH "${_file}" DIRECTORY) + if(CONFIG STREQUAL "DEBUG") + file(RELATIVE_PATH RELATIVE_PC_PATH "${PKG_LIB_SEARCH_PATH}" "${CURRENT_PACKAGES_DIR}/debug/") + else() + file(RELATIVE_PATH RELATIVE_PC_PATH "${PKG_LIB_SEARCH_PATH}" "${CURRENT_PACKAGES_DIR}") + endif() + # strip trailing slash + string(REGEX REPLACE "/$" "" RELATIVE_PC_PATH "${RELATIVE_PC_PATH}") + #Correct *.pc file + file(READ "${_file}" _contents) + string(REPLACE "${CURRENT_PACKAGES_DIR}" "\${prefix}" _contents "${_contents}") + string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${prefix}" _contents "${_contents}") + string(REPLACE "${_VCPKG_PACKAGES_DIR}" "\${prefix}" _contents "${_contents}") + string(REPLACE "${_VCPKG_INSTALLED_DIR}" "\${prefix}" _contents "${_contents}") + string(REGEX REPLACE "(^|\n)prefix[\t ]*=[^\n]*" "" _contents "${_contents}") + if(CONFIG STREQUAL "DEBUG") + string(REPLACE "}/debug" "}" _contents "${_contents}") + # Prefix points at the debug subfolder + string(REPLACE "\${prefix}/include" "\${prefix}/../include" _contents "${_contents}") + string(REPLACE "\${prefix}/share" "\${prefix}/../share" _contents "${_contents}") + endif() + string(REGEX REPLACE " -L(\\\${[^}]*}[^ \n\t]*)" " -L\"\\1\"" _contents "${_contents}") + string(REGEX REPLACE " -I(\\\${[^}]*}[^ \n\t]*)" " -I\"\\1\"" _contents "${_contents}") + string(REGEX REPLACE " -l(\\\${[^}]*}[^ \n\t]*)" " -l\"\\1\"" _contents "${_contents}") + # This section fuses XYZ.private and XYZ according to VCPKG_LIBRARY_LINKAGE + # + # Pkgconfig searches Requires.private transitively for Cflags in the dynamic case, + # which prevents us from removing it. + # + # Once this transformation is complete, users of vcpkg should never need to pass + # --static. + if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + # Libs comes before Libs.private + string(REGEX REPLACE "(^|\n)(Libs: [^\n]*)(.*)\nLibs.private:( [^\n]*)" "\\1\\2\\4\\3" _contents "${_contents}") + # Libs.private comes before Libs + string(REGEX REPLACE "(^|\n)Libs.private:( [^\n]*)(.*\nLibs: [^\n]*)" "\\3\\2" _contents "${_contents}") + # Only Libs.private + string(REGEX REPLACE "(^|\n)Libs.private: " "\\1Libs: " _contents "${_contents}") + # Requires comes before Requires.private + string(REGEX REPLACE "(^|\n)(Requires: [^\n]*)(.*)\nRequires.private:( [^\n]*)" "\\1\\2\\4\\3" _contents "${_contents}") + # Requires.private comes before Requires + string(REGEX REPLACE "(^|\n)Requires.private:( [^\n]*)(.*\nRequires: [^\n]*)" "\\3\\2" _contents "${_contents}") + # Only Requires.private + string(REGEX REPLACE "(^|\n)Requires.private: " "\\1Requires: " _contents "${_contents}") + endif() + file(WRITE "${_file}" "prefix=\${pcfiledir}/${RELATIVE_PC_PATH}\n${_contents}") + unset(PKG_LIB_SEARCH_PATH) endforeach() - endif() - debug_message("Debug Files: ${_vfpkg_DEBUG_FILES}") - foreach(_file ${_vfpkg_DEBUG_FILES}) - message(STATUS "Fixing pkgconfig file: ${_file}") - get_filename_component(PKG_LIB_SEARCH_PATH "${_file}" DIRECTORY) - file(RELATIVE_PATH RELATIVE_PC_PATH "${PKG_LIB_SEARCH_PATH}" "${CURRENT_PACKAGES_DIR}/debug/") - string(REGEX REPLACE "/$" "" RELATIVE_PC_PATH "${RELATIVE_PC_PATH}") - string(REGEX REPLACE "/pkgconfig/?" "" PKG_LIB_SEARCH_PATH "${PKG_LIB_SEARCH_PATH}") - #Correct *.pc file - file(READ "${_file}" _contents) - string(REPLACE "${CURRENT_PACKAGES_DIR}" "\${prefix}" _contents "${_contents}") - string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${prefix}" _contents "${_contents}") - string(REPLACE "${_VCPKG_PACKAGES_DIR}" "\${prefix}" _contents "${_contents}") - string(REPLACE "${_VCPKG_INSTALLED_DIR}" "\${prefix}" _contents "${_contents}") - string(REPLACE "debug/include" "../include" _contents "${_contents}") - string(REPLACE "\${prefix}/include" "\${prefix}/../include" _contents "${_contents}") - string(REPLACE "debug/share" "../share" _contents "${_contents}") - string(REPLACE "\${prefix}/share" "\${prefix}/../share" _contents "${_contents}") - string(REPLACE "debug/lib" "lib" _contents "${_contents}") # the prefix will contain the debug keyword - string(REGEX REPLACE "^prefix[\t ]*=[^\n]*" "" _contents "${_contents}") # make pc file relocatable - string(REGEX REPLACE "[\n]prefix[\t ]*=[^\n]*" "" _contents "${_contents}") # make pc file relocatable - string(REPLACE "\${prefix}/debug" "\${prefix}" _contents "${_contents}") # replace remaining debug paths if they exist. - file(WRITE "${_file}" "prefix=\${pcfiledir}/${RELATIVE_PC_PATH}\n${_contents}") - unset(PKG_LIB_SEARCH_PATH) + if(NOT _vfpkg_SKIP_CHECK) # The check can only run after all files have been corrected! + foreach(_file ${_vfpkg_${CONFIG}_FILES}) + vcpkg_fixup_pkgconfig_check_files("${PKGCONFIG}" "${_file}" "${CONFIG}") + endforeach() + endif() endforeach() - - if(NOT _vfpkg_SKIP_CHECK) # The check can only run after all files have been corrected! - foreach(_file ${_vfpkg_DEBUG_FILES}) - vcpkg_fixup_pkgconfig_check_files("${PKGCONFIG}" "${_file}" "DEBUG" "${_vfpkg_SYSTEM_LIBRARIES}" "${_vfpkg_IGNORE_FLAGS}") - endforeach() - endif() debug_message("Fixing pkgconfig --- finished") set(VCPKG_FIXUP_PKGCONFIG_CALLED TRUE CACHE INTERNAL "See below" FORCE) @@ -340,14 +189,3 @@ function(vcpkg_fixup_pkgconfig) # or check if this function has been called if *.pc files are detected. # The same is true for vcpkg_fixup_cmake_targets endfunction() - - - # script to test the function locally without running vcpkg. Uncomment fix filepaths and use cmake -P vcpkg_fixup_pkgconfig - # set(_file "G:\\xlinux\\packages\\xlib_x64-windows\\lib\\pkgconfig\\x11.pc") - # include(${CMAKE_CURRENT_LIST_DIR}/vcpkg_common_definitions.cmake) - # file(READ "${_file}" _contents) - # set(CURRENT_INSTALLED_DIR "G:/xlinux/installed/x64-windows") - # set(CURRENT_PACKAGES_DIR "G:/xlinux/packages/xlib_x64-windows") - # set(_vfpkg_SYSTEM_LIBRARIES "blu\\ ub") - # set(_vfpkg_SYSTEM_PACKAGES "szip") - # vcpkg_fixup_pkgconfig_check_libraries("RELEASE" _contents "${_vfpkg_SYSTEM_LIBRARIES}" "${_vfpkg_SYSTEM_PACKAGES}") diff --git a/scripts/cmake/vcpkg_from_github.cmake b/scripts/cmake/vcpkg_from_github.cmake index f52538c8ef222f..1c1b71679f95b8 100644 --- a/scripts/cmake/vcpkg_from_github.cmake +++ b/scripts/cmake/vcpkg_from_github.cmake @@ -14,6 +14,7 @@ vcpkg_from_github( [PATCHES ...] [GITHUB_HOST ] [AUTHORIZATION_TOKEN <${SECRET_FROM_FILE}>] + [FILE_DISAMBIGUATOR ] ) ``` diff --git a/scripts/cmake/vcpkg_from_gitlab.cmake b/scripts/cmake/vcpkg_from_gitlab.cmake index 354ff85b987cfe..865c5326ea3a14 100644 --- a/scripts/cmake/vcpkg_from_gitlab.cmake +++ b/scripts/cmake/vcpkg_from_gitlab.cmake @@ -13,6 +13,7 @@ vcpkg_from_gitlab( [SHA512 <45d0d7f8cc350...>] [HEAD_REF ] [PATCHES ...] + [FILE_DISAMBIGUATOR ] ) ``` @@ -52,6 +53,9 @@ A list of patches to be applied to the extracted sources. Relative paths are based on the port directory. +### FILE_DISAMBIGUATOR +A token to uniquely identify the resulting filename if the SHA512 changes even though a git ref does not, to avoid stepping on the same file name. + ## Notes: At least one of `REF` and `HEAD_REF` must be specified, however it is preferable for both to be present. @@ -66,7 +70,7 @@ This exports the `VCPKG_HEAD_VERSION` variable during head builds. include(vcpkg_execute_in_download_mode) function(vcpkg_from_gitlab) - set(oneValueArgs OUT_SOURCE_PATH GITLAB_URL USER REPO REF SHA512 HEAD_REF) + set(oneValueArgs OUT_SOURCE_PATH GITLAB_URL USER REPO REF SHA512 HEAD_REF FILE_DISAMBIGUATOR) set(multipleValuesArgs PATCHES) # parse parameters such that semicolons in options arguments to COMMAND don't get erased cmake_parse_arguments(PARSE_ARGV 0 _vdud "" "${oneValueArgs}" "${multipleValuesArgs}") @@ -119,11 +123,17 @@ function(vcpkg_from_gitlab) endif() string(REPLACE "/" "-" SANITIZED_REF "${_vdud_REF}") + set(downloaded_file_name "${ORG_NAME}-${REPO_NAME}-${SANITIZED_REF}") + if (_vdud_FILE_DISAMBIGUATOR) + set(downloaded_file_name "${downloaded_file_name}-${_vdud_FILE_DISAMBIGUATOR}") + endif() + + set(downloaded_file_name "${downloaded_file_name}.tar.gz") vcpkg_download_distfile(ARCHIVE URLS "${GITLAB_LINK}/-/archive/${_vdud_REF}/${REPO_NAME}-${_vdud_REF}.tar.gz" SHA512 "${_vdud_SHA512}" - FILENAME "${ORG_NAME}-${REPO_NAME}-${SANITIZED_REF}.tar.gz" + FILENAME "${downloaded_file_name}" ) vcpkg_extract_source_archive_ex( diff --git a/scripts/generateBaseline.py b/scripts/generateBaseline.py new file mode 100644 index 00000000000000..45c424a7df362d --- /dev/null +++ b/scripts/generateBaseline.py @@ -0,0 +1,50 @@ +import os +import json +import subprocess +import sys + +SCRIPT_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) + + +def generate_baseline(ports_path, output_filepath): + port_names = [item for item in os.listdir( + ports_path) if os.path.isdir(os.path.join(ports_path, item))] + port_names.sort() + + total = len(port_names) + baseline_versions = {} + for counter, port_name in enumerate(port_names): + vcpkg_exe = os.path.join(SCRIPT_DIRECTORY, '../vcpkg') + print(f'[{counter + 1}/{total}] Getting package info for {port_name}') + output = subprocess.run( + [vcpkg_exe, 'x-package-info', '--x-json', port_name], + capture_output=True, + encoding='utf-8') + + if output.returncode == 0: + package_info = json.loads(output.stdout) + port_info = package_info['results'][port_name] + + version = {} + for scheme in ['version-string', 'version-semver', 'version-date', 'version']: + if scheme in port_info: + version[scheme] = package_info['results'][port_name][scheme] + break + version['port-version'] = 0 + if 'port-version' in port_info: + version['port-version'] = port_info['port-version'] + baseline_versions[port_name] = version + else: + print(f'x-package-info --x-json {port_name} failed: ', output.stdout.strip(), file=sys.stderr) + + output = {} + output['default'] = baseline_versions + + with open(output_filepath, 'r') as output_file: + json.dump(baseline_versions, output_file) + sys.exit(0) + + +if __name__ == '__main__': + generate_baseline( + ports_path=f'{SCRIPT_DIRECTORY}/../ports', output_filepath='baseline.json') diff --git a/scripts/vcpkg.schema.json b/scripts/vcpkg.schema.json index ae20ad6e3298bc..723b14646b06d9 100644 --- a/scripts/vcpkg.schema.json +++ b/scripts/vcpkg.schema.json @@ -21,6 +21,69 @@ } ] }, + "version-text": { + "type": "string", + "pattern": "[^#]+" + }, + "has-schemed-version": { + "type": "object", + "oneOf": [ + { + "properties": { + "version-string": { + "description": "Text used to identify an arbitrary version", + "type": "string", + "pattern": "^[^#]+$" + } + }, + "required": [ + "version-string" + ] + }, + { + "properties": { + "version": { + "description": "A relaxed version string (1.2.3.4...)", + "type": "string", + "pattern": "^\\d+(\\.\\d+)*$" + } + }, + "required": [ + "version" + ] + }, + { + "properties": { + "version-semver": { + "description": "A semantic version string. See https://semver.org/", + "type": "string", + "pattern": "^\\d+\\.\\d+\\.\\d+([+-].+)?$" + } + }, + "required": [ + "version-semver" + ] + }, + { + "properties": { + "version-date": { + "description": "A date version string (e.g. 2020-01-20)", + "type": "string", + "pattern": "^\\d{4}-\\d{2}-\\d{2}(\\.\\d+)*$" + } + }, + "required": [ + "version-date" + ] + } + ] + }, + "port-version": { + "description": "A non-negative integer indicating the port revision. If this field doesn't exist, it's assumed to be `0`.", + "type": "integer", + "minimum": 0, + "default": 0 + }, "package-name": { "description": "Name of a package.", "allOf": [ @@ -71,6 +134,14 @@ }, "platform": { "$ref": "#/definitions/platform-expression" + }, + "version>=": { + "description": "Minimum required port version", + "$ref": "#/definitions/version-text" + }, + "port-version": { + "description": "Minimum port revision (defaults to 0)", + "$ref": "#/definitions/port-version" } }, "patternProperties": { @@ -92,6 +163,28 @@ } ] }, + "override": { + "description": "A version override.", + "type": "object", + "properties": { + "name": { + "$ref": "#/definitions/identifier" + }, + "version": { + "$ref": "#/definitions/version-text" + }, + "port-version": { + "$ref": "#/definitions/port-version" + } + }, + "patternProperties": { + "^\\$": {} + }, + "required": [ + "name", + "version" + ] + }, "platform-expression": { "description": "A specification of a set of platforms. See https://github.com/microsoft/vcpkg/blob/master/docs/specifications/manifests.md#definitions.", "type": "string" @@ -125,82 +218,93 @@ } }, "type": "object", - "properties": { - "name": { - "$ref": "#/definitions/package-name" - }, - "version-string": { - "description": "A string without semantic meaning, equivalent to `CONTROL`'s `Version` field.", - "type": "string" - }, - "port-version": { - "description": "A non-negative integer. If this field doesn't exist, it's assumed to be `0`.", - "type": "integer", - "minimum": 0, - "default": 0 - }, - "maintainers": { - "description": "An array of strings which contain the authors of a package", - "type": "array", - "items": { - "type": "string" - } - }, - "description": { - "$ref": "#/definitions/description-field" - }, - "homepage": { - "description": "A url which points to the homepage of a package.", - "type": "string", - "format": "uri" - }, - "documentation": { - "description": "A url which points to the documentation of a package.", - "type": "string", - "format": "uri" - }, - "license": { - "description": "An SPDX license expression at version 3.9.", - "type": "string" - }, - "dependencies": { - "description": "Dependencies that are always required.", - "type": "array", - "items": { - "$ref": "#/definitions/dependency" - } - }, - "dev-dependencies": { - "description": "Dependencies only required for developers (testing and the like).", - "type": "array", - "items": { - "$ref": "#/definitions/dependency" - } - }, - "features": { - "description": "An array of features supported by the package", - "type": "array", - "items": { - "$ref": "#/definitions/feature" - } - }, - "default-features": { - "description": "Features enabled by default with the package.", - "type": "array", - "items": { - "$ref": "#/definitions/identifier" - } + "allOf": [ + { + "properties": { + "name": { + "description": "The name of the top-level package", + "$ref": "#/definitions/package-name" + }, + "version-string": {}, + "version": {}, + "version-date": {}, + "version-semver": {}, + "port-version": { + "$ref": "#/definitions/port-version" + }, + "maintainers": { + "description": "An array of strings which contain the authors of a package", + "type": "array", + "items": { + "type": "string" + } + }, + "description": { + "$ref": "#/definitions/description-field" + }, + "homepage": { + "description": "A url which points to the homepage of a package.", + "type": "string", + "format": "uri" + }, + "documentation": { + "description": "A url which points to the documentation of a package.", + "type": "string", + "format": "uri" + }, + "license": { + "description": "An SPDX license expression at version 3.9.", + "type": "string" + }, + "dependencies": { + "description": "Dependencies that are always required.", + "type": "array", + "items": { + "$ref": "#/definitions/dependency" + } + }, + "overrides": { + "description": "Version overrides for dependencies.", + "type": "array", + "items": { + "$ref": "#/definitions/override" + } + }, + "dev-dependencies": { + "description": "Dependencies only required for developers (testing and the like).", + "type": "array", + "items": { + "$ref": "#/definitions/dependency" + } + }, + "features": { + "description": "An array of features supported by the package", + "type": "array", + "items": { + "$ref": "#/definitions/feature" + } + }, + "default-features": { + "description": "Features enabled by default with the package.", + "type": "array", + "items": { + "$ref": "#/definitions/identifier" + } + }, + "supports": { + "$ref": "#/definitions/platform-expression" + } + }, + "patternProperties": { + "^\\$": {} + }, + "required": [ + "name" + ], + "additionalProperties": false }, - "supports": { - "$ref": "#/definitions/platform-expression" + { + "$ref": "#/definitions/has-schemed-version" } - }, - "patternProperties": { - "^\\$": {} - }, - "required": [ - "name", - "version-string" - ], - "additionalProperties": false + ] } diff --git a/toolsrc/include/vcpkg/base/jsonreader.h b/toolsrc/include/vcpkg/base/jsonreader.h index 02c1936e251e57..bea60e7ce5b644 100644 --- a/toolsrc/include/vcpkg/base/jsonreader.h +++ b/toolsrc/include/vcpkg/base/jsonreader.h @@ -33,13 +33,14 @@ namespace vcpkg::Json virtual Optional visit_object(Reader&, const Object&); virtual View valid_fields() const; + virtual ~IDeserializer() = default; + protected: IDeserializer() = default; IDeserializer(const IDeserializer&) = default; IDeserializer& operator=(const IDeserializer&) = default; IDeserializer(IDeserializer&&) = default; IDeserializer& operator=(IDeserializer&&) = default; - virtual ~IDeserializer() = default; }; struct Reader diff --git a/toolsrc/include/vcpkg/base/parse.h b/toolsrc/include/vcpkg/base/parse.h index cc5db02d375ca6..b3577e82119e89 100644 --- a/toolsrc/include/vcpkg/base/parse.h +++ b/toolsrc/include/vcpkg/base/parse.h @@ -16,6 +16,7 @@ namespace vcpkg::Parse { virtual ~IParseError() = default; virtual std::string format() const = 0; + virtual const std::string& get_message() const = 0; }; struct ParseError : IParseError @@ -38,6 +39,7 @@ namespace vcpkg::Parse const std::string message; virtual std::string format() const override; + virtual const std::string& get_message() const override; }; struct ParserBase diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h index ca5104c234c631..b5ad1d04f05e57 100644 --- a/toolsrc/include/vcpkg/base/util.h +++ b/toolsrc/include/vcpkg/base/util.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -28,6 +29,15 @@ namespace vcpkg::Util { return std::find(container.begin(), container.end(), item) != container.end(); } + template + std::vector concat(View r1, View r2) + { + std::vector v; + v.reserve(r1.size() + r2.size()); + v.insert(v.end(), r1.begin(), r1.end()); + v.insert(v.end(), r2.begin(), r2.end()); + return v; + } } namespace Sets diff --git a/toolsrc/include/vcpkg/base/xmlserializer.h b/toolsrc/include/vcpkg/base/xmlserializer.h new file mode 100644 index 00000000000000..33b7c0811fb11c --- /dev/null +++ b/toolsrc/include/vcpkg/base/xmlserializer.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include + +#include + +namespace vcpkg +{ + struct XmlSerializer + { + XmlSerializer& emit_declaration(); + XmlSerializer& open_tag(StringLiteral sl); + XmlSerializer& start_complex_open_tag(StringLiteral sl); + XmlSerializer& text_attr(StringLiteral name, StringView content); + XmlSerializer& finish_complex_open_tag(); + XmlSerializer& finish_self_closing_complex_tag(); + XmlSerializer& close_tag(StringLiteral sl); + XmlSerializer& text(StringView sv); + XmlSerializer& simple_tag(StringLiteral tag, StringView content); + XmlSerializer& line_break(); + + std::string buf; + + private: + XmlSerializer& emit_pending_indent(); + + int m_indent = 0; + bool m_pending_indent = false; + }; +} diff --git a/toolsrc/include/vcpkg/binarycaching.private.h b/toolsrc/include/vcpkg/binarycaching.private.h index 209807ccc5051d..2ac44679297fd8 100644 --- a/toolsrc/include/vcpkg/binarycaching.private.h +++ b/toolsrc/include/vcpkg/binarycaching.private.h @@ -48,27 +48,4 @@ namespace vcpkg const Dependencies::InstallPlanAction& action, const NugetReference& ref, details::NuGetRepoInfo rinfo = details::get_nuget_repo_info_from_env()); - - struct XmlSerializer - { - XmlSerializer& emit_declaration(); - XmlSerializer& open_tag(StringLiteral sl); - XmlSerializer& start_complex_open_tag(StringLiteral sl); - XmlSerializer& text_attr(StringLiteral name, StringView content); - XmlSerializer& finish_complex_open_tag(); - XmlSerializer& finish_self_closing_complex_tag(); - XmlSerializer& close_tag(StringLiteral sl); - XmlSerializer& text(StringView sv); - XmlSerializer& simple_tag(StringLiteral tag, StringView content); - XmlSerializer& line_break(); - - std::string buf; - - private: - XmlSerializer& emit_pending_indent(); - - int m_indent = 0; - bool m_pending_indent = false; - }; - } diff --git a/toolsrc/include/vcpkg/versiondeserializers.h b/toolsrc/include/vcpkg/versiondeserializers.h index f5ffda101e2293..249d685cbbbb16 100644 --- a/toolsrc/include/vcpkg/versiondeserializers.h +++ b/toolsrc/include/vcpkg/versiondeserializers.h @@ -13,19 +13,32 @@ namespace vcpkg struct VersionDbEntry { VersionT version; - Versions::Scheme scheme; + Versions::Scheme scheme = Versions::Scheme::String; std::string git_tree; - - VersionDbEntry(const std::string& version_string, - int port_version, - Versions::Scheme scheme, - const std::string& git_tree) - : version(VersionT(version_string, port_version)), scheme(scheme), git_tree(git_tree) - { - } }; Json::IDeserializer& get_versiont_deserializer_instance(); + std::unique_ptr> make_version_deserializer(StringLiteral type_name); + + struct SchemedVersion + { + Versions::Scheme scheme = Versions::Scheme::String; + VersionT versiont; + }; + + Optional visit_optional_schemed_deserializer(StringView parent_type, + Json::Reader& r, + const Json::Object& obj); + SchemedVersion visit_required_schemed_deserializer(StringView parent_type, + Json::Reader& r, + const Json::Object& obj); + View schemed_deserializer_fields(); + + void serialize_schemed_version(Json::Object& out_obj, + Versions::Scheme scheme, + const std::string& version, + int port_version, + bool always_emit_port_version = false); ExpectedS>> parse_baseline_file(Files::Filesystem& fs, StringView baseline_name, diff --git a/toolsrc/include/vcpkg/versions.h b/toolsrc/include/vcpkg/versions.h index 09df1536665b2e..19b5546eaf2c10 100644 --- a/toolsrc/include/vcpkg/versions.h +++ b/toolsrc/include/vcpkg/versions.h @@ -6,6 +6,14 @@ namespace vcpkg::Versions { using Version = VersionT; + enum class VerComp + { + unk, + lt, + eq, + gt, + }; + enum class Scheme { Relaxed, @@ -32,6 +40,42 @@ namespace vcpkg::Versions std::size_t operator()(const VersionSpec& key) const; }; + struct RelaxedVersion + { + std::string original_string; + std::vector version; + + static ExpectedS from_string(const std::string& str); + }; + + struct SemanticVersion + { + std::string original_string; + std::string version_string; + std::string prerelease_string; + + std::vector version; + std::vector identifiers; + + static ExpectedS from_string(const std::string& str); + }; + + struct DateVersion + { + std::string original_string; + std::string version_string; + std::string identifiers_string; + + std::vector identifiers; + + static ExpectedS from_string(const std::string& str); + }; + + VerComp compare(const std::string& a, const std::string& b, Scheme scheme); + VerComp compare(const RelaxedVersion& a, const RelaxedVersion& b); + VerComp compare(const SemanticVersion& a, const SemanticVersion& b); + VerComp compare(const DateVersion& a, const DateVersion& b); + struct Constraint { enum class Type diff --git a/toolsrc/include/vcpkg/versiont.h b/toolsrc/include/vcpkg/versiont.h index 7819f98759d042..910183b9d49223 100644 --- a/toolsrc/include/vcpkg/versiont.h +++ b/toolsrc/include/vcpkg/versiont.h @@ -23,7 +23,7 @@ namespace vcpkg private: std::string m_text; - int m_port_version; + int m_port_version = 0; }; struct VersionDiff diff --git a/toolsrc/src/vcpkg-test/binarycaching.cpp b/toolsrc/src/vcpkg-test/binarycaching.cpp index cb0d7cb99d5d58..3cede064c585bb 100644 --- a/toolsrc/src/vcpkg-test/binarycaching.cpp +++ b/toolsrc/src/vcpkg-test/binarycaching.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include @@ -29,28 +30,28 @@ using namespace vcpkg; TEST_CASE ("reformat_version semver-ish", "[reformat_version]") { - REQUIRE(reformat_version("0.0.0", "abitag") == "0.0.0-abitag"); - REQUIRE(reformat_version("1.0.1", "abitag") == "1.0.1-abitag"); - REQUIRE(reformat_version("1.01.000", "abitag") == "1.1.0-abitag"); - REQUIRE(reformat_version("1.2", "abitag") == "1.2.0-abitag"); - REQUIRE(reformat_version("v52", "abitag") == "52.0.0-abitag"); - REQUIRE(reformat_version("v09.01.02", "abitag") == "9.1.2-abitag"); - REQUIRE(reformat_version("1.1.1q", "abitag") == "1.1.1-abitag"); - REQUIRE(reformat_version("1", "abitag") == "1.0.0-abitag"); + REQUIRE(reformat_version("0.0.0", "abitag") == "0.0.0-vcpkgabitag"); + REQUIRE(reformat_version("1.0.1", "abitag") == "1.0.1-vcpkgabitag"); + REQUIRE(reformat_version("1.01.000", "abitag") == "1.1.0-vcpkgabitag"); + REQUIRE(reformat_version("1.2", "abitag") == "1.2.0-vcpkgabitag"); + REQUIRE(reformat_version("v52", "abitag") == "52.0.0-vcpkgabitag"); + REQUIRE(reformat_version("v09.01.02", "abitag") == "9.1.2-vcpkgabitag"); + REQUIRE(reformat_version("1.1.1q", "abitag") == "1.1.1-vcpkgabitag"); + REQUIRE(reformat_version("1", "abitag") == "1.0.0-vcpkgabitag"); } TEST_CASE ("reformat_version date", "[reformat_version]") { - REQUIRE(reformat_version("2020-06-26", "abitag") == "2020.6.26-abitag"); - REQUIRE(reformat_version("20-06-26", "abitag") == "0.0.0-abitag"); - REQUIRE(reformat_version("2020-06-26-release", "abitag") == "2020.6.26-abitag"); - REQUIRE(reformat_version("2020-06-26000", "abitag") == "2020.6.26-abitag"); + REQUIRE(reformat_version("2020-06-26", "abitag") == "2020.6.26-vcpkgabitag"); + REQUIRE(reformat_version("20-06-26", "abitag") == "0.0.0-vcpkgabitag"); + REQUIRE(reformat_version("2020-06-26-release", "abitag") == "2020.6.26-vcpkgabitag"); + REQUIRE(reformat_version("2020-06-26000", "abitag") == "2020.6.26-vcpkgabitag"); } TEST_CASE ("reformat_version generic", "[reformat_version]") { - REQUIRE(reformat_version("apr", "abitag") == "0.0.0-abitag"); - REQUIRE(reformat_version("", "abitag") == "0.0.0-abitag"); + REQUIRE(reformat_version("apr", "abitag") == "0.0.0-vcpkgabitag"); + REQUIRE(reformat_version("", "abitag") == "0.0.0-vcpkgabitag"); } TEST_CASE ("generate_nuspec", "[generate_nuspec]") @@ -96,7 +97,7 @@ Build-Depends: bzip NugetReference ref(ipa); - REQUIRE(ref.nupkg_filename() == "zlib2_x64-windows.1.5.0-packageabi.nupkg"); + REQUIRE(ref.nupkg_filename() == "zlib2_x64-windows.1.5.0-vcpkgpackageabi.nupkg"); { auto nuspec = generate_nuspec(paths, ipa, ref, {}); @@ -108,7 +109,7 @@ Build-Depends: bzip std::string expected = R"( zlib2_x64-windows - 1.5.0-packageabi + 1.5.0-vcpkgpackageabi vcpkg NOT FOR DIRECT USE. Automatically generated cache package. @@ -140,7 +141,7 @@ Features: a, b std::string expected = R"( zlib2_x64-windows - 1.5.0-packageabi + 1.5.0-vcpkgpackageabi vcpkg NOT FOR DIRECT USE. Automatically generated cache package. @@ -172,7 +173,7 @@ Features: a, b std::string expected = R"( zlib2_x64-windows - 1.5.0-packageabi + 1.5.0-vcpkgpackageabi vcpkg NOT FOR DIRECT USE. Automatically generated cache package. @@ -267,7 +268,7 @@ Description: a spiffy compression library wrapper packageconfig = generate_nuget_packages_config(plan); REQUIRE(packageconfig == R"( - + )"); @@ -290,8 +291,8 @@ Description: a spiffy compression library wrapper packageconfig = generate_nuget_packages_config(plan); REQUIRE(packageconfig == R"( - - + + )"); } diff --git a/toolsrc/src/vcpkg-test/dependencies.cpp b/toolsrc/src/vcpkg-test/dependencies.cpp index bcc2f14a070d6e..2aae7fffacf818 100644 --- a/toolsrc/src/vcpkg-test/dependencies.cpp +++ b/toolsrc/src/vcpkg-test/dependencies.cpp @@ -121,6 +121,42 @@ static void check_name_and_version(const Dependencies::InstallPlanAction& ipa, } } +static void check_semver_version(const ExpectedS& maybe_version, + const std::string& version_string, + const std::string& prerelease_string, + uint64_t major, + uint64_t minor, + uint64_t patch, + const std::vector& identifiers) +{ + auto actual_version = unwrap(maybe_version); + CHECK(actual_version.version_string == version_string); + CHECK(actual_version.prerelease_string == prerelease_string); + REQUIRE(actual_version.version.size() == 3); + CHECK(actual_version.version[0] == major); + CHECK(actual_version.version[1] == minor); + CHECK(actual_version.version[2] == patch); + CHECK(actual_version.identifiers == identifiers); +} + +static void check_relaxed_version(const ExpectedS& maybe_version, + const std::vector& version) +{ + auto actual_version = unwrap(maybe_version); + CHECK(actual_version.version == version); +} + +static void check_date_version(const ExpectedS& maybe_version, + const std::string& version_string, + const std::string& identifiers_string, + const std::vector& identifiers) +{ + auto actual_version = unwrap(maybe_version); + CHECK(actual_version.version_string == version_string); + CHECK(actual_version.identifiers_string == identifiers_string); + CHECK(actual_version.identifiers == identifiers); +} + static const PackageSpec& toplevel_spec() { static const PackageSpec ret("toplevel-spec", Test::X86_WINDOWS); @@ -506,6 +542,426 @@ TEST_CASE ("version install diamond relaxed", "[versionplan]") check_name_and_version(install_plan.install_actions[2], "a", {"3", 0}); } +TEST_CASE ("version parse semver", "[versionplan]") +{ + auto version_basic = Versions::SemanticVersion::from_string("1.2.3"); + check_semver_version(version_basic, "1.2.3", "", 1, 2, 3, {}); + + auto version_simple_tag = Versions::SemanticVersion::from_string("1.0.0-alpha"); + check_semver_version(version_simple_tag, "1.0.0", "alpha", 1, 0, 0, {"alpha"}); + + auto version_alphanumeric_tag = Versions::SemanticVersion::from_string("1.0.0-0alpha0"); + check_semver_version(version_alphanumeric_tag, "1.0.0", "0alpha0", 1, 0, 0, {"0alpha0"}); + + auto version_complex_tag = Versions::SemanticVersion::from_string("1.0.0-alpha.1.0.0"); + check_semver_version(version_complex_tag, "1.0.0", "alpha.1.0.0", 1, 0, 0, {"alpha", "1", "0", "0"}); + + auto version_complexer_tag = Versions::SemanticVersion::from_string("1.0.0-alpha.1.x.y.z.0-alpha.0-beta.l-a-s-t"); + check_semver_version(version_complexer_tag, + "1.0.0", + "alpha.1.x.y.z.0-alpha.0-beta.l-a-s-t", + 1, + 0, + 0, + {"alpha", "1", "x", "y", "z", "0-alpha", "0-beta", "l-a-s-t"}); + + auto version_ridiculous_tag = Versions::SemanticVersion::from_string("1.0.0----------------------------------"); + check_semver_version(version_ridiculous_tag, + "1.0.0", + "---------------------------------", + 1, + 0, + 0, + {"---------------------------------"}); + + auto version_build_tag = Versions::SemanticVersion::from_string("1.0.0+build"); + check_semver_version(version_build_tag, "1.0.0", "", 1, 0, 0, {}); + + auto version_prerelease_build_tag = Versions::SemanticVersion::from_string("1.0.0-alpha+build"); + check_semver_version(version_prerelease_build_tag, "1.0.0", "alpha", 1, 0, 0, {"alpha"}); + + auto version_invalid_incomplete = Versions::SemanticVersion::from_string("1.0-alpha"); + CHECK(!version_invalid_incomplete.has_value()); + + auto version_invalid_leading_zeroes = Versions::SemanticVersion::from_string("1.02.03-alpha+build"); + CHECK(!version_invalid_leading_zeroes.has_value()); + + auto version_invalid_leading_zeroes_in_tag = Versions::SemanticVersion::from_string("1.0.0-01"); + CHECK(!version_invalid_leading_zeroes_in_tag.has_value()); + + auto version_invalid_characters = Versions::SemanticVersion::from_string("1.0.0-alpha#2"); + CHECK(!version_invalid_characters.has_value()); +} + +TEST_CASE ("version parse relaxed", "[versionplan]") +{ + auto version_basic = Versions::RelaxedVersion::from_string("1.2.3"); + check_relaxed_version(version_basic, {1, 2, 3}); + + auto version_short = Versions::RelaxedVersion::from_string("1"); + check_relaxed_version(version_short, {1}); + + auto version_long = + Versions::RelaxedVersion::from_string("1.20.300.4000.50000.6000000.70000000.80000000.18446744073709551610"); + check_relaxed_version(version_long, {1, 20, 300, 4000, 50000, 6000000, 70000000, 80000000, 18446744073709551610}); + + auto version_invalid_characters = Versions::RelaxedVersion::from_string("1.a.0"); + CHECK(!version_invalid_characters.has_value()); + + auto version_invalid_identifiers_2 = Versions::RelaxedVersion::from_string("1.1a.2"); + CHECK(!version_invalid_identifiers_2.has_value()); + + auto version_invalid_leading_zeroes = Versions::RelaxedVersion::from_string("01.002.003"); + CHECK(!version_invalid_leading_zeroes.has_value()); +} + +TEST_CASE ("version parse date", "[versionplan]") +{ + auto version_basic = Versions::DateVersion::from_string("2020-12-25"); + check_date_version(version_basic, "2020-12-25", "", {}); + + auto version_identifiers = Versions::DateVersion::from_string("2020-12-25.1.2.3"); + check_date_version(version_identifiers, "2020-12-25", "1.2.3", {1, 2, 3}); + + auto version_invalid_date = Versions::DateVersion::from_string("2020-1-1"); + CHECK(!version_invalid_date.has_value()); + + auto version_invalid_identifiers = Versions::DateVersion::from_string("2020-01-01.alpha"); + CHECK(!version_invalid_identifiers.has_value()); + + auto version_invalid_identifiers_2 = Versions::DateVersion::from_string("2020-01-01.2a"); + CHECK(!version_invalid_identifiers_2.has_value()); + + auto version_invalid_leading_zeroes = Versions::DateVersion::from_string("2020-01-01.01"); + CHECK(!version_invalid_leading_zeroes.has_value()); +} + +TEST_CASE ("version sort semver", "[versionplan]") +{ + std::vector versions{unwrap(Versions::SemanticVersion::from_string("1.0.0")), + unwrap(Versions::SemanticVersion::from_string("0.0.0")), + unwrap(Versions::SemanticVersion::from_string("1.1.0")), + unwrap(Versions::SemanticVersion::from_string("2.0.0")), + unwrap(Versions::SemanticVersion::from_string("1.1.1")), + unwrap(Versions::SemanticVersion::from_string("1.0.1")), + unwrap(Versions::SemanticVersion::from_string("1.0.0-alpha.1")), + unwrap(Versions::SemanticVersion::from_string("1.0.0-beta")), + unwrap(Versions::SemanticVersion::from_string("1.0.0-alpha")), + unwrap(Versions::SemanticVersion::from_string("1.0.0-alpha.beta")), + unwrap(Versions::SemanticVersion::from_string("1.0.0-rc")), + unwrap(Versions::SemanticVersion::from_string("1.0.0-beta.2")), + unwrap(Versions::SemanticVersion::from_string("1.0.0-beta.20")), + unwrap(Versions::SemanticVersion::from_string("1.0.0-beta.3")), + unwrap(Versions::SemanticVersion::from_string("1.0.0-1")), + unwrap(Versions::SemanticVersion::from_string("1.0.0-0alpha"))}; + + std::sort(std::begin(versions), std::end(versions), [](const auto& lhs, const auto& rhs) -> bool { + return Versions::compare(lhs, rhs) == Versions::VerComp::lt; + }); + + CHECK(versions[0].original_string == "0.0.0"); + CHECK(versions[1].original_string == "1.0.0-1"); + CHECK(versions[2].original_string == "1.0.0-0alpha"); + CHECK(versions[3].original_string == "1.0.0-alpha"); + CHECK(versions[4].original_string == "1.0.0-alpha.1"); + CHECK(versions[5].original_string == "1.0.0-alpha.beta"); + CHECK(versions[6].original_string == "1.0.0-beta"); + CHECK(versions[7].original_string == "1.0.0-beta.2"); + CHECK(versions[8].original_string == "1.0.0-beta.3"); + CHECK(versions[9].original_string == "1.0.0-beta.20"); + CHECK(versions[10].original_string == "1.0.0-rc"); + CHECK(versions[11].original_string == "1.0.0"); + CHECK(versions[12].original_string == "1.0.1"); + CHECK(versions[13].original_string == "1.1.0"); + CHECK(versions[14].original_string == "1.1.1"); + CHECK(versions[15].original_string == "2.0.0"); +} + +TEST_CASE ("version sort relaxed", "[versionplan]") +{ + std::vector versions{unwrap(Versions::RelaxedVersion::from_string("1.0.0")), + unwrap(Versions::RelaxedVersion::from_string("1.0")), + unwrap(Versions::RelaxedVersion::from_string("1")), + unwrap(Versions::RelaxedVersion::from_string("2")), + unwrap(Versions::RelaxedVersion::from_string("1.1")), + unwrap(Versions::RelaxedVersion::from_string("1.10.1")), + unwrap(Versions::RelaxedVersion::from_string("1.0.1")), + unwrap(Versions::RelaxedVersion::from_string("1.0.0.1")), + unwrap(Versions::RelaxedVersion::from_string("1.0.0.2"))}; + + std::sort(std::begin(versions), std::end(versions), [](const auto& lhs, const auto& rhs) -> bool { + return Versions::compare(lhs, rhs) == Versions::VerComp::lt; + }); + + CHECK(versions[0].original_string == "1"); + CHECK(versions[1].original_string == "1.0"); + CHECK(versions[2].original_string == "1.0.0"); + CHECK(versions[3].original_string == "1.0.0.1"); + CHECK(versions[4].original_string == "1.0.0.2"); + CHECK(versions[5].original_string == "1.0.1"); + CHECK(versions[6].original_string == "1.1"); + CHECK(versions[7].original_string == "1.10.1"); + CHECK(versions[8].original_string == "2"); +} + +TEST_CASE ("version sort date", "[versionplan]") +{ + std::vector versions{unwrap(Versions::DateVersion::from_string("2021-01-01.2")), + unwrap(Versions::DateVersion::from_string("2021-01-01.1")), + unwrap(Versions::DateVersion::from_string("2021-01-01.1.1")), + unwrap(Versions::DateVersion::from_string("2021-01-01.1.0")), + unwrap(Versions::DateVersion::from_string("2021-01-01")), + unwrap(Versions::DateVersion::from_string("2021-01-01")), + unwrap(Versions::DateVersion::from_string("2020-12-25")), + unwrap(Versions::DateVersion::from_string("2020-12-31")), + unwrap(Versions::DateVersion::from_string("2021-01-01.10"))}; + + std::sort(std::begin(versions), std::end(versions), [](const auto& lhs, const auto& rhs) -> bool { + return Versions::compare(lhs, rhs) == Versions::VerComp::lt; + }); + + CHECK(versions[0].original_string == "2020-12-25"); + CHECK(versions[1].original_string == "2020-12-31"); + CHECK(versions[2].original_string == "2021-01-01"); + CHECK(versions[3].original_string == "2021-01-01"); + CHECK(versions[4].original_string == "2021-01-01.1"); + CHECK(versions[5].original_string == "2021-01-01.1.0"); + CHECK(versions[6].original_string == "2021-01-01.1.1"); + CHECK(versions[7].original_string == "2021-01-01.2"); + CHECK(versions[8].original_string == "2021-01-01.10"); +} + +TEST_CASE ("version install simple semver", "[versionplan]") +{ + MockBaselineProvider bp; + bp.v["a"] = {"2.0.0", 0}; + + MockVersionedPortfileProvider vp; + vp.emplace("a", {"2.0.0", 0}, Scheme::Semver); + vp.emplace("a", {"3.0.0", 0}, Scheme::Semver); + + MockCMakeVarProvider var_provider; + + auto install_plan = unwrap(Dependencies::create_versioned_install_plan( + vp, + bp, + var_provider, + { + Dependency{"a", {}, {}, {Constraint::Type::Minimum, "3.0.0", 0}}, + }, + {}, + toplevel_spec())); + + REQUIRE(install_plan.size() == 1); + check_name_and_version(install_plan.install_actions[0], "a", {"3.0.0", 0}); +} + +TEST_CASE ("version install transitive semver", "[versionplan]") +{ + MockBaselineProvider bp; + bp.v["a"] = {"2.0.0", 0}; + bp.v["b"] = {"2.0.0", 0}; + + MockVersionedPortfileProvider vp; + vp.emplace("a", {"2.0.0", 0}, Scheme::Semver); + vp.emplace("a", {"3.0.0", 0}, Scheme::Semver).source_control_file->core_paragraph->dependencies = { + Dependency{"b", {}, {}, DependencyConstraint{Constraint::Type::Minimum, "3.0.0"}}, + }; + vp.emplace("b", {"2.0.0", 0}, Scheme::Semver); + vp.emplace("b", {"3.0.0", 0}, Scheme::Semver); + + MockCMakeVarProvider var_provider; + + auto install_plan = unwrap(Dependencies::create_versioned_install_plan( + vp, + bp, + var_provider, + { + Dependency{"a", {}, {}, {Constraint::Type::Minimum, "3.0.0", 0}}, + }, + {}, + toplevel_spec())); + + REQUIRE(install_plan.size() == 2); + check_name_and_version(install_plan.install_actions[0], "b", {"3.0.0", 0}); + check_name_and_version(install_plan.install_actions[1], "a", {"3.0.0", 0}); +} + +TEST_CASE ("version install diamond semver", "[versionplan]") +{ + MockBaselineProvider bp; + bp.v["a"] = {"2.0.0", 0}; + bp.v["b"] = {"3.0.0", 0}; + + MockVersionedPortfileProvider vp; + vp.emplace("a", {"2.0.0", 0}, Scheme::Semver); + vp.emplace("a", {"3.0.0", 0}, Scheme::Semver).source_control_file->core_paragraph->dependencies = { + Dependency{"b", {}, {}, DependencyConstraint{Constraint::Type::Minimum, "2.0.0", 1}}, + Dependency{"c", {}, {}, DependencyConstraint{Constraint::Type::Minimum, "5.0.0", 1}}, + }; + vp.emplace("b", {"2.0.0", 1}, Scheme::Semver); + vp.emplace("b", {"3.0.0", 0}, Scheme::Semver).source_control_file->core_paragraph->dependencies = { + Dependency{"c", {}, {}, DependencyConstraint{Constraint::Type::Minimum, "9.0.0", 2}}, + }; + vp.emplace("c", {"5.0.0", 1}, Scheme::Semver); + vp.emplace("c", {"9.0.0", 2}, Scheme::Semver); + + MockCMakeVarProvider var_provider; + + auto install_plan = unwrap(Dependencies::create_versioned_install_plan( + vp, + bp, + var_provider, + { + Dependency{"a", {}, {}, {Constraint::Type::Minimum, "3.0.0", 0}}, + Dependency{"b", {}, {}, {Constraint::Type::Minimum, "2.0.0", 1}}, + }, + {}, + toplevel_spec())); + + REQUIRE(install_plan.size() == 3); + check_name_and_version(install_plan.install_actions[0], "c", {"9.0.0", 2}); + check_name_and_version(install_plan.install_actions[1], "b", {"3.0.0", 0}); + check_name_and_version(install_plan.install_actions[2], "a", {"3.0.0", 0}); +} + +TEST_CASE ("version install simple date", "[versionplan]") +{ + MockBaselineProvider bp; + bp.v["a"] = {"2020-02-01", 0}; + + MockVersionedPortfileProvider vp; + vp.emplace("a", {"2020-02-01", 0}, Scheme::Date); + vp.emplace("a", {"2020-03-01", 0}, Scheme::Date); + + MockCMakeVarProvider var_provider; + + auto install_plan = unwrap(Dependencies::create_versioned_install_plan( + vp, + bp, + var_provider, + { + Dependency{"a", {}, {}, {Constraint::Type::Minimum, "2020-03-01", 0}}, + }, + {}, + toplevel_spec())); + + REQUIRE(install_plan.size() == 1); + check_name_and_version(install_plan.install_actions[0], "a", {"2020-03-01", 0}); +} + +TEST_CASE ("version install transitive date", "[versionplan]") +{ + MockBaselineProvider bp; + bp.v["a"] = {"2020-01-01.2", 0}; + bp.v["b"] = {"2020-01-01.3", 0}; + + MockVersionedPortfileProvider vp; + vp.emplace("a", {"2020-01-01.2", 0}, Scheme::Date); + vp.emplace("a", {"2020-01-01.3", 0}, Scheme::Date).source_control_file->core_paragraph->dependencies = { + Dependency{"b", {}, {}, DependencyConstraint{Constraint::Type::Minimum, "2020-01-01.3"}}, + }; + vp.emplace("b", {"2020-01-01.2", 0}, Scheme::Date); + vp.emplace("b", {"2020-01-01.3", 0}, Scheme::Date); + + MockCMakeVarProvider var_provider; + + auto install_plan = unwrap(Dependencies::create_versioned_install_plan( + vp, + bp, + var_provider, + { + Dependency{"a", {}, {}, {Constraint::Type::Minimum, "2020-01-01.3", 0}}, + }, + {}, + toplevel_spec())); + + REQUIRE(install_plan.size() == 2); + check_name_and_version(install_plan.install_actions[0], "b", {"2020-01-01.3", 0}); + check_name_and_version(install_plan.install_actions[1], "a", {"2020-01-01.3", 0}); +} + +TEST_CASE ("version install diamond date", "[versionplan]") +{ + MockBaselineProvider bp; + bp.v["a"] = {"2020-01-02", 0}; + bp.v["b"] = {"2020-01-03", 0}; + + MockVersionedPortfileProvider vp; + vp.emplace("a", {"2020-01-02", 0}, Scheme::Date); + vp.emplace("a", {"2020-01-03", 0}, Scheme::Date).source_control_file->core_paragraph->dependencies = { + Dependency{"b", {}, {}, DependencyConstraint{Constraint::Type::Minimum, "2020-01-02", 1}}, + Dependency{"c", {}, {}, DependencyConstraint{Constraint::Type::Minimum, "2020-01-05", 1}}, + }; + vp.emplace("b", {"2020-01-02", 1}, Scheme::Date); + vp.emplace("b", {"2020-01-03", 0}, Scheme::Date).source_control_file->core_paragraph->dependencies = { + Dependency{"c", {}, {}, DependencyConstraint{Constraint::Type::Minimum, "2020-01-09", 2}}, + }; + vp.emplace("c", {"2020-01-05", 1}, Scheme::Date); + vp.emplace("c", {"2020-01-09", 2}, Scheme::Date); + + MockCMakeVarProvider var_provider; + + auto install_plan = unwrap(Dependencies::create_versioned_install_plan( + vp, + bp, + var_provider, + { + Dependency{"a", {}, {}, {Constraint::Type::Minimum, "2020-01-03", 0}}, + Dependency{"b", {}, {}, {Constraint::Type::Minimum, "2020-01-02", 1}}, + }, + {}, + toplevel_spec())); + + REQUIRE(install_plan.size() == 3); + check_name_and_version(install_plan.install_actions[0], "c", {"2020-01-09", 2}); + check_name_and_version(install_plan.install_actions[1], "b", {"2020-01-03", 0}); + check_name_and_version(install_plan.install_actions[2], "a", {"2020-01-03", 0}); +} + +TEST_CASE ("version install scheme failure", "[versionplan]") +{ + MockVersionedPortfileProvider vp; + vp.emplace("a", {"1.0.0", 0}, Scheme::Semver); + vp.emplace("a", {"1.0.1", 0}, Scheme::Relaxed); + vp.emplace("a", {"1.0.2", 0}, Scheme::Semver); + + MockCMakeVarProvider var_provider; + + SECTION ("lower baseline") + { + MockBaselineProvider bp; + bp.v["a"] = {"1.0.0", 0}; + + auto install_plan = Dependencies::create_versioned_install_plan( + vp, + bp, + var_provider, + {Dependency{"a", {}, {}, {Constraint::Type::Minimum, "1.0.1", 0}}}, + {}, + toplevel_spec()); + + REQUIRE(!install_plan.error().empty()); + CHECK(install_plan.error() == "Version conflict on a@1.0.1: baseline required 1.0.0"); + } + SECTION ("higher baseline") + { + MockBaselineProvider bp; + bp.v["a"] = {"1.0.2", 0}; + + auto install_plan = Dependencies::create_versioned_install_plan( + vp, + bp, + var_provider, + {Dependency{"a", {}, {}, {Constraint::Type::Minimum, "1.0.1", 0}}}, + {}, + toplevel_spec()); + + REQUIRE(!install_plan.error().empty()); + CHECK(install_plan.error() == "Version conflict on a@1.0.1: baseline required 1.0.2"); + } +} + TEST_CASE ("version install scheme change in port version", "[versionplan]") { MockVersionedPortfileProvider vp; diff --git a/toolsrc/src/vcpkg-test/manifests.cpp b/toolsrc/src/vcpkg-test/manifests.cpp index 32aa11f8a7a73d..f03caf3bf76bd7 100644 --- a/toolsrc/src/vcpkg-test/manifests.cpp +++ b/toolsrc/src/vcpkg-test/manifests.cpp @@ -115,6 +115,103 @@ TEST_CASE ("manifest versioning", "[manifests]") "version-semver": "1.2.3-rc3" })json", true); + + test_parse_manifest(R"json({ + "name": "zlib", + "version-string": "abcd#1" + })json", + true); + test_parse_manifest(R"json({ + "name": "zlib", + "version": "abcd#1" + })json", + true); + test_parse_manifest(R"json({ + "name": "zlib", + "version-date": "abcd#1" + })json", + true); + test_parse_manifest(R"json({ + "name": "zlib", + "version-semver": "abcd#1" + })json", + true); +} + +TEST_CASE ("manifest constraints error hash", "[manifests]") +{ + test_parse_manifest(R"json({ + "name": "zlib", + "version-string": "abcd", + "dependencies": [ + { + "name": "b", + "version=": "5#1" + } + ] +} +)json", + true); + + test_parse_manifest(R"json({ + "name": "zlib", + "version-string": "abcd", + "dependencies": [ + { + "name": "d", + "version>=": "2018-09-01#1" + } + ] +})json", + true); +} + +TEST_CASE ("manifest overrides error hash", "[manifests]") +{ + test_parse_manifest(R"json({ + "name": "zlib", + "version-string": "abcd", + "overrides": [ + { + "name": "d", + "version-string": "abcd#1" + } + ] +})json", + true); + test_parse_manifest(R"json({ + "name": "zlib", + "version-string": "abcd", + "overrides": [ + { + "name": "d", + "version-date": "2018-01-01#1" + } + ] +})json", + true); + test_parse_manifest(R"json({ + "name": "zlib", + "version-string": "abcd", + "overrides": [ + { + "name": "d", + "version": "1.2#1" + } + ] +})json", + true); + test_parse_manifest(R"json({ + "name": "zlib", + "version-string": "abcd", + "overrides": [ + { + "name": "d", + "version-semver": "1.2#1" + } + ] +})json", + true); } TEST_CASE ("manifest constraints", "[manifests]") @@ -286,13 +383,13 @@ TEST_CASE ("manifest overrides", "[manifests]") "overrides": [ { "name": "abc", - "port-version": 5, - "version-string": "hello" + "version-string": "hello", + "port-version": 5 }, { "name": "abcd", - "port-version": 7, - "version-string": "hello" + "version-string": "hello", + "port-version": 7 } ] } diff --git a/toolsrc/src/vcpkg/base/parse.cpp b/toolsrc/src/vcpkg/base/parse.cpp index c6a7de83d32974..a082c4d9c710b5 100644 --- a/toolsrc/src/vcpkg/base/parse.cpp +++ b/toolsrc/src/vcpkg/base/parse.cpp @@ -50,6 +50,8 @@ namespace vcpkg::Parse "^\n"); } + const std::string& ParseError::get_message() const { return this->message; } + ParserBase::ParserBase(StringView text, StringView origin, TextRowCol init_rowcol) : m_it(text.begin(), text.end()) , m_start_of_line(m_it) diff --git a/toolsrc/src/vcpkg/base/xmlserializer.cpp b/toolsrc/src/vcpkg/base/xmlserializer.cpp new file mode 100644 index 00000000000000..535a0a92b38069 --- /dev/null +++ b/toolsrc/src/vcpkg/base/xmlserializer.cpp @@ -0,0 +1,113 @@ +#include +#include + +namespace vcpkg +{ + XmlSerializer& XmlSerializer::emit_declaration() + { + buf.append(R"()"); + return *this; + } + XmlSerializer& XmlSerializer::open_tag(StringLiteral sl) + { + emit_pending_indent(); + Strings::append(buf, '<', sl, '>'); + m_indent += 2; + return *this; + } + XmlSerializer& XmlSerializer::start_complex_open_tag(StringLiteral sl) + { + emit_pending_indent(); + Strings::append(buf, '<', sl); + m_indent += 2; + return *this; + } + XmlSerializer& XmlSerializer::text_attr(StringLiteral name, StringView content) + { + if (m_pending_indent) + { + m_pending_indent = false; + buf.append(m_indent, ' '); + } + else + { + buf.push_back(' '); + } + Strings::append(buf, name, "=\""); + text(content); + Strings::append(buf, '"'); + return *this; + } + XmlSerializer& XmlSerializer::finish_complex_open_tag() + { + emit_pending_indent(); + Strings::append(buf, '>'); + return *this; + } + XmlSerializer& XmlSerializer::finish_self_closing_complex_tag() + { + emit_pending_indent(); + Strings::append(buf, "/>"); + m_indent -= 2; + return *this; + } + XmlSerializer& XmlSerializer::close_tag(StringLiteral sl) + { + m_indent -= 2; + emit_pending_indent(); + Strings::append(buf, "'); + return *this; + } + XmlSerializer& XmlSerializer::text(StringView sv) + { + emit_pending_indent(); + for (auto ch : sv) + { + if (ch == '&') + { + buf.append("&"); + } + else if (ch == '<') + { + buf.append("<"); + } + else if (ch == '>') + { + buf.append(">"); + } + else if (ch == '"') + { + buf.append("""); + } + else if (ch == '\'') + { + buf.append("'"); + } + else + { + buf.push_back(ch); + } + } + return *this; + } + XmlSerializer& XmlSerializer::simple_tag(StringLiteral tag, StringView content) + { + return emit_pending_indent().open_tag(tag).text(content).close_tag(tag); + } + XmlSerializer& XmlSerializer::line_break() + { + buf.push_back('\n'); + m_pending_indent = true; + return *this; + } + XmlSerializer& XmlSerializer::emit_pending_indent() + { + if (m_pending_indent) + { + m_pending_indent = false; + buf.append(m_indent, ' '); + } + return *this; + } + +} diff --git a/toolsrc/src/vcpkg/binarycaching.cpp b/toolsrc/src/vcpkg/binarycaching.cpp index 8624cb3d3115fd..c73e789d0a631b 100644 --- a/toolsrc/src/vcpkg/binarycaching.cpp +++ b/toolsrc/src/vcpkg/binarycaching.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -377,6 +378,45 @@ namespace { } + int run_nuget_commandline(const std::string& cmdline) + { + if (m_interactive) + { + return System::cmd_execute(cmdline); + } + + auto res = System::cmd_execute_and_capture_output(cmdline); + if (Debug::g_debugging) + { + System::print2(res.output); + } + if (res.output.find("Authentication may require manual action.") != std::string::npos) + { + System::print2(System::Color::warning, + "One or more NuGet credential providers requested manual action. Add the binary " + "source 'interactive' to allow interactivity.\n"); + } + else if (res.output.find("Response status code does not indicate success: 401 (Unauthorized)") != + std::string::npos && + res.exit_code != 0) + { + System::print2(System::Color::warning, + "One or more NuGet credential providers failed to authenticate. See " + "https://github.com/Microsoft/vcpkg/tree/master/docs/users/binarycaching.md for " + "more details on how to provide credentials.\n"); + } + else if (res.output.find("for example \"-ApiKey AzureDevOps\"") != std::string::npos) + { + auto res2 = System::cmd_execute_and_capture_output(cmdline + " -ApiKey AzureDevOps"); + if (Debug::g_debugging) + { + System::print2(res2.output); + } + return res2.exit_code; + } + return res.exit_code; + } + void prefetch(const VcpkgPaths& paths, std::vector& actions) override { if (m_read_sources.empty() && m_read_configs.empty()) return; @@ -481,19 +521,7 @@ namespace [&] { generate_packages_config(); - if (Debug::g_debugging) - System::cmd_execute(cmdline); - else - { - auto res = System::cmd_execute_and_capture_output(cmdline); - if (res.output.find("Authentication may require manual action.") != std::string::npos) - { - System::print2( - System::Color::warning, - "One or more NuGet credential providers requested manual action. Add the binary " - "source 'interactive' to allow interactivity.\n"); - } - } + run_nuget_commandline(cmdline); }(); Util::erase_remove_if(nuget_refs, [&](const std::pair& nuget_ref) -> bool { @@ -554,12 +582,7 @@ namespace .string_arg("-ForceEnglishOutput"); if (!m_interactive) cmdline.string_arg("-NonInteractive"); - auto pack_rc = [&] { - if (Debug::g_debugging) - return System::cmd_execute(cmdline); - else - return System::cmd_execute_and_capture_output(cmdline).exit_code; - }(); + auto pack_rc = run_nuget_commandline(cmdline.extract()); if (pack_rc != 0) { @@ -584,12 +607,7 @@ namespace System::print2("Uploading binaries for ", spec, " to NuGet source ", write_src, ".\n"); - auto rc = [&] { - if (Debug::g_debugging) - return System::cmd_execute(cmd); - else - return System::cmd_execute_and_capture_output(cmd).exit_code; - }(); + auto rc = run_nuget_commandline(cmd.extract()); if (rc != 0) { @@ -616,12 +634,7 @@ namespace System::print2( "Uploading binaries for ", spec, " using NuGet config ", fs::u8string(write_cfg), ".\n"); - auto rc = [&] { - if (Debug::g_debugging) - return System::cmd_execute(cmd); - else - return System::cmd_execute_and_capture_output(cmd).exit_code; - }(); + auto rc = run_nuget_commandline(cmd.extract()); if (rc != 0) { @@ -699,113 +712,6 @@ namespace vcpkg }; } -XmlSerializer& XmlSerializer::emit_declaration() -{ - buf.append(R"()"); - return *this; -} -XmlSerializer& XmlSerializer::open_tag(StringLiteral sl) -{ - emit_pending_indent(); - Strings::append(buf, '<', sl, '>'); - m_indent += 2; - return *this; -} -XmlSerializer& XmlSerializer::start_complex_open_tag(StringLiteral sl) -{ - emit_pending_indent(); - Strings::append(buf, '<', sl); - m_indent += 2; - return *this; -} -XmlSerializer& XmlSerializer::text_attr(StringLiteral name, StringView content) -{ - if (m_pending_indent) - { - m_pending_indent = false; - buf.append(m_indent, ' '); - } - else - { - buf.push_back(' '); - } - Strings::append(buf, name, "=\""); - text(content); - Strings::append(buf, '"'); - return *this; -} -XmlSerializer& XmlSerializer::finish_complex_open_tag() -{ - emit_pending_indent(); - Strings::append(buf, '>'); - return *this; -} -XmlSerializer& XmlSerializer::finish_self_closing_complex_tag() -{ - emit_pending_indent(); - Strings::append(buf, "/>"); - m_indent -= 2; - return *this; -} -XmlSerializer& XmlSerializer::close_tag(StringLiteral sl) -{ - m_indent -= 2; - emit_pending_indent(); - Strings::append(buf, "'); - return *this; -} -XmlSerializer& XmlSerializer::text(StringView sv) -{ - emit_pending_indent(); - for (auto ch : sv) - { - if (ch == '&') - { - buf.append("&"); - } - else if (ch == '<') - { - buf.append("<"); - } - else if (ch == '>') - { - buf.append(">"); - } - else if (ch == '"') - { - buf.append("""); - } - else if (ch == '\'') - { - buf.append("'"); - } - else - { - buf.push_back(ch); - } - } - return *this; -} -XmlSerializer& XmlSerializer::simple_tag(StringLiteral tag, StringView content) -{ - return emit_pending_indent().open_tag(tag).text(content).close_tag(tag); -} -XmlSerializer& XmlSerializer::line_break() -{ - buf.push_back('\n'); - m_pending_indent = true; - return *this; -} -XmlSerializer& XmlSerializer::emit_pending_indent() -{ - if (m_pending_indent) - { - m_pending_indent = false; - buf.append(m_indent, ' '); - } - return *this; -} - IBinaryProvider& vcpkg::null_binary_provider() { static NullBinaryProvider p; @@ -1131,6 +1037,7 @@ ExpectedS> vcpkg::create_binary_provider_from_c BinaryConfigParser default_parser("default,readwrite", "", &s); default_parser.parse(); + if (auto err = default_parser.get_error()) return err->get_message(); BinaryConfigParser env_parser(env_string, "VCPKG_BINARY_SOURCES", &s); env_parser.parse(); @@ -1179,7 +1086,7 @@ std::string vcpkg::reformat_version(const std::string& version, const std::strin auto major = trim_leading_zeroes(sm.str(1)); auto minor = sm.size() > 2 && !sm.str(2).empty() ? trim_leading_zeroes(sm.str(2).substr(1)) : "0"; auto patch = sm.size() > 3 && !sm.str(3).empty() ? trim_leading_zeroes(sm.str(3).substr(1)) : "0"; - return Strings::concat(major, '.', minor, '.', patch, "-", abi_tag); + return Strings::concat(major, '.', minor, '.', patch, "-vcpkg", abi_tag); } static const std::regex date_matcher(R"((\d\d\d\d)-(\d\d)-(\d\d).*)"); @@ -1190,11 +1097,11 @@ std::string vcpkg::reformat_version(const std::string& version, const std::strin trim_leading_zeroes(sm.str(2)), '.', trim_leading_zeroes(sm.str(3)), - "-", + "-vcpkg", abi_tag); } - return Strings::concat("0.0.0-", abi_tag); + return Strings::concat("0.0.0-vcpkg", abi_tag); } details::NuGetRepoInfo details::get_nuget_repo_info_from_env() @@ -1281,13 +1188,12 @@ void vcpkg::help_topic_binary_caching(const VcpkgPaths&) { HelpTableFormatter tbl; tbl.text("Vcpkg can cache compiled packages to accelerate restoration on a single machine or across the network." - " This functionality is currently enabled by default and can be disabled by either passing " - "`--no-binarycaching` to every vcpkg command line or setting the environment variable " - "`VCPKG_FEATURE_FLAGS` to `-binarycaching`."); + " By default, vcpkg will save builds to a local machine cache. This can be disabled by passing " + "`--binarysource=clear` as the last option on the command line."); tbl.blank(); tbl.blank(); tbl.text( - "Once caching is enabled, it can be further configured by either passing `--binarysource=` options " + "Binary caching can be further configured by either passing `--binarysource=` options " "to every command line or setting the `VCPKG_BINARY_SOURCES` environment variable to a set of sources (Ex: " "\";;...\"). Command line sources are interpreted after environment sources."); tbl.blank(); diff --git a/toolsrc/src/vcpkg/commands.porthistory.cpp b/toolsrc/src/vcpkg/commands.porthistory.cpp index 045562136bc9b9..7efb36bd18f078 100644 --- a/toolsrc/src/vcpkg/commands.porthistory.cpp +++ b/toolsrc/src/vcpkg/commands.porthistory.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include namespace vcpkg::Commands::PortHistory @@ -230,8 +231,9 @@ namespace vcpkg::Commands::PortHistory { Json::Object object; object.insert("git-tree", Json::Value::string(version.git_tree)); - object.insert("version-string", Json::Value::string(version.version)); - object.insert("port-version", Json::Value::integer(version.port_version)); + + serialize_schemed_version( + object, Versions::Scheme::String, version.version, version.port_version, true); versions_json.push_back(std::move(object)); } diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp index 7d69becdf5b31e..e7768f2bfd4dbd 100644 --- a/toolsrc/src/vcpkg/dependencies.cpp +++ b/toolsrc/src/vcpkg/dependencies.cpp @@ -1215,6 +1215,8 @@ namespace vcpkg::Dependencies std::map vermap; std::map exacts; Optional> relaxed; + Optional> semver; + Optional> date; std::set features; bool default_features = true; @@ -1271,6 +1273,30 @@ namespace vcpkg::Dependencies vsi = relaxed.get()->get(); } } + else if (scheme == Versions::Scheme::Semver) + { + if (auto p = semver.get()) + { + vsi = p->get(); + } + else + { + semver = std::make_unique(); + vsi = semver.get()->get(); + } + } + else if (scheme == Versions::Scheme::Date) + { + if (auto p = date.get()) + { + vsi = p->get(); + } + else + { + date = std::make_unique(); + vsi = date.get()->get(); + } + } else { // not implemented @@ -1287,40 +1313,24 @@ namespace vcpkg::Dependencies return it == vermap.end() ? nullptr : it->second; } - enum class VerComp - { - unk, - lt, - eq, - gt, - }; + using Versions::VerComp; + static VerComp compare_versions(Versions::Scheme sa, const Versions::Version& a, Versions::Scheme sb, const Versions::Version& b) { if (sa != sb) return VerComp::unk; - switch (sa) + + if (a.text() != b.text()) { - case Versions::Scheme::String: - { - if (a.text() != b.text()) return VerComp::unk; - if (a.port_version() < b.port_version()) return VerComp::lt; - if (a.port_version() > b.port_version()) return VerComp::gt; - return VerComp::eq; - } - case Versions::Scheme::Relaxed: - { - auto i1 = atoi(a.text().c_str()); - auto i2 = atoi(b.text().c_str()); - if (i1 < i2) return VerComp::lt; - if (i1 > i2) return VerComp::gt; - if (a.port_version() < b.port_version()) return VerComp::lt; - if (a.port_version() > b.port_version()) return VerComp::gt; - return VerComp::eq; - } - default: Checks::unreachable(VCPKG_LINE_INFO); + auto result = Versions::compare(a.text(), b.text(), sa); + if (result != VerComp::eq) return result; } + + if (a.port_version() < b.port_version()) return VerComp::lt; + if (a.port_version() > b.port_version()) return VerComp::gt; + return VerComp::eq; } bool VersionedPackageGraph::VersionSchemeInfo::is_less_than(const Versions::Version& new_ver) const diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp index 6d0c95aa81ef7e..b5c36ff87092fb 100644 --- a/toolsrc/src/vcpkg/export.cpp +++ b/toolsrc/src/vcpkg/export.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -28,37 +29,47 @@ namespace vcpkg::Export const fs::path& targets_redirect_path, const fs::path& props_redirect_path, const std::string& nuget_id, - const std::string& nupkg_version) + const std::string& nupkg_version, + const std::string& nuget_description) { - static constexpr auto CONTENT_TEMPLATE = R"( - - - @NUGET_ID@ - @VERSION@ - vcpkg - - Vcpkg NuGet export - - - - - - - - - - -)"; - - std::string nuspec_file_content = Strings::replace_all(CONTENT_TEMPLATE, "@NUGET_ID@", nuget_id); - nuspec_file_content = Strings::replace_all(std::move(nuspec_file_content), "@VERSION@", nupkg_version); - nuspec_file_content = - Strings::replace_all(std::move(nuspec_file_content), "@RAW_EXPORTED_DIR@", raw_exported_dir); - nuspec_file_content = Strings::replace_all( - std::move(nuspec_file_content), "@TARGETS_REDIRECT_PATH@", fs::u8string(targets_redirect_path)); - nuspec_file_content = Strings::replace_all( - std::move(nuspec_file_content), "@PROPS_REDIRECT_PATH@", fs::u8string(props_redirect_path)); - return nuspec_file_content; + XmlSerializer xml; + xml.open_tag("package").line_break(); + xml.open_tag("metadata").line_break(); + xml.simple_tag("id", nuget_id).line_break(); + xml.simple_tag("version", nupkg_version).line_break(); + xml.simple_tag("authors", "vcpkg").line_break(); + xml.simple_tag("description", nuget_description).line_break(); + xml.close_tag("metadata").line_break(); + xml.open_tag("files").line_break(); + xml.start_complex_open_tag("file") + .text_attr("src", raw_exported_dir + "\\installed\\**") + .text_attr("target", "installed") + .finish_self_closing_complex_tag(); + + xml.start_complex_open_tag("file") + .text_attr("src", raw_exported_dir + "\\scripts\\**") + .text_attr("target", "scripts") + .finish_self_closing_complex_tag(); + + xml.start_complex_open_tag("file") + .text_attr("src", raw_exported_dir + "\\.vcpkg-root") + .text_attr("target", "") + .finish_self_closing_complex_tag(); + + xml.start_complex_open_tag("file") + .text_attr("src", fs::u8string(targets_redirect_path)) + .text_attr("target", Strings::concat("build\\native\\", nuget_id, ".targets")) + .finish_self_closing_complex_tag(); + + xml.start_complex_open_tag("file") + .text_attr("src", fs::u8string(props_redirect_path)) + .text_attr("target", Strings::concat("build\\native\\", nuget_id, ".props")) + .finish_self_closing_complex_tag(); + + xml.close_tag("files").line_break(); + xml.close_tag("package").line_break(); + + return std::move(xml.buf); } static std::string create_targets_redirect(const std::string& target_path) noexcept @@ -123,6 +134,7 @@ namespace vcpkg::Export static fs::path do_nuget_export(const VcpkgPaths& paths, const std::string& nuget_id, const std::string& nuget_version, + const std::string& nuget_description, const fs::path& raw_exported_dir, const fs::path& output_dir) { @@ -145,7 +157,7 @@ namespace vcpkg::Export fs.write_contents(props_redirect, props_redirect_content, VCPKG_LINE_INFO); const std::string nuspec_file_content = create_nuspec_file_contents( - raw_exported_dir.string(), targets_redirect, props_redirect, nuget_id, nuget_version); + raw_exported_dir.string(), targets_redirect, props_redirect, nuget_id, nuget_version, nuget_description); const fs::path nuspec_file_path = paths.buildsystems / "tmp" / "vcpkg.export.nuspec"; fs.write_contents(nuspec_file_path, nuspec_file_content, VCPKG_LINE_INFO); @@ -284,6 +296,7 @@ namespace vcpkg::Export Optional maybe_nuget_id; Optional maybe_nuget_version; + Optional maybe_nuget_description; IFW::Options ifw_options; Prefab::Options prefab_options; @@ -300,6 +313,7 @@ namespace vcpkg::Export static constexpr StringLiteral OPTION_ZIP = "zip"; static constexpr StringLiteral OPTION_SEVEN_ZIP = "7zip"; static constexpr StringLiteral OPTION_NUGET_ID = "nuget-id"; + static constexpr StringLiteral OPTION_NUGET_DESCRIPTION = "nuget-description"; static constexpr StringLiteral OPTION_NUGET_VERSION = "nuget-version"; static constexpr StringLiteral OPTION_IFW_REPOSITORY_URL = "ifw-repository-url"; static constexpr StringLiteral OPTION_IFW_PACKAGES_DIR_PATH = "ifw-packages-directory-path"; @@ -334,10 +348,11 @@ namespace vcpkg::Export {OPTION_ALL_INSTALLED, "Export all installed packages"}, }}; - static constexpr std::array EXPORT_SETTINGS = {{ + static constexpr std::array EXPORT_SETTINGS = {{ {OPTION_OUTPUT, "Specify the output name (used to construct filename)"}, {OPTION_OUTPUT_DIR, "Specify the output directory for produced artifacts"}, {OPTION_NUGET_ID, "Specify the id for the exported NuGet package (overrides --output)"}, + {OPTION_NUGET_DESCRIPTION, "Specify a description for the exported NuGet package"}, {OPTION_NUGET_VERSION, "Specify the version for the exported NuGet package"}, {OPTION_IFW_REPOSITORY_URL, "Specify the remote repository URL for the online installer"}, {OPTION_IFW_PACKAGES_DIR_PATH, "Specify the temporary directory path for the repacked packages"}, @@ -456,6 +471,7 @@ namespace vcpkg::Export { {OPTION_NUGET_ID, ret.maybe_nuget_id}, {OPTION_NUGET_VERSION, ret.maybe_nuget_version}, + {OPTION_NUGET_DESCRIPTION, ret.maybe_nuget_description}, }); options_implies(OPTION_IFW, @@ -567,8 +583,9 @@ namespace vcpkg::Export const std::string nuget_id = opts.maybe_nuget_id.value_or(raw_exported_dir_path.filename().string()); const std::string nuget_version = opts.maybe_nuget_version.value_or("1.0.0"); - const fs::path output_path = - do_nuget_export(paths, nuget_id, nuget_version, raw_exported_dir_path, opts.output_dir); + const std::string nuget_description = opts.maybe_nuget_description.value_or("Vcpkg NuGet export"); + const fs::path output_path = do_nuget_export( + paths, nuget_id, nuget_version, nuget_description, raw_exported_dir_path, opts.output_dir); System::print2(System::Color::success, "NuGet package exported at: ", fs::u8string(output_path), "\n"); System::printf(R"( diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index 8a9fec96326415..eee0eca0ed881e 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -839,20 +839,21 @@ namespace vcpkg::Install if (args.versions_enabled()) { PortFileProvider::VersionedPortfileProvider verprovider(paths); - auto baseprovider = [&]() -> PortFileProvider::BaselineProvider { + auto baseprovider = [&]() -> std::unique_ptr { if (auto p_baseline = manifest_scf.core_paragraph->extra_info.get("$x-default-baseline")) { - return PortFileProvider::BaselineProvider(paths, p_baseline->string().to_string()); + return std::make_unique(paths, + p_baseline->string().to_string()); } else { - return PortFileProvider::BaselineProvider(paths); + return std::make_unique(paths); } }(); auto install_plan = Dependencies::create_versioned_install_plan(verprovider, - baseprovider, + *baseprovider, var_provider, manifest_scf.core_paragraph->dependencies, manifest_scf.core_paragraph->overrides, diff --git a/toolsrc/src/vcpkg/sourceparagraph.cpp b/toolsrc/src/vcpkg/sourceparagraph.cpp index f05ebb619e130c..f80a1494e5d963 100644 --- a/toolsrc/src/vcpkg/sourceparagraph.cpp +++ b/toolsrc/src/vcpkg/sourceparagraph.cpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace vcpkg { @@ -487,12 +488,12 @@ namespace vcpkg r.optional_object_field(obj, PLATFORM, dep.platform, PlatformExprDeserializer::instance); - static Json::StringDeserializer version_deserializer{"a version"}; + static auto version_deserializer = make_version_deserializer("a version"); auto has_eq_constraint = - r.optional_object_field(obj, VERSION_EQ, dep.constraint.value, version_deserializer); + r.optional_object_field(obj, VERSION_EQ, dep.constraint.value, *version_deserializer); auto has_ge_constraint = - r.optional_object_field(obj, VERSION_GE, dep.constraint.value, version_deserializer); + r.optional_object_field(obj, VERSION_GE, dep.constraint.value, *version_deserializer); auto has_port_ver = r.optional_object_field( obj, PORT_VERSION, dep.constraint.port_version, Json::NaturalNumberDeserializer::instance); @@ -548,23 +549,11 @@ namespace vcpkg virtual StringView type_name() const override { return "an override"; } constexpr static StringLiteral NAME = "name"; - constexpr static StringLiteral PORT_VERSION = "port-version"; - constexpr static StringLiteral VERSION_RELAXED = "version"; - constexpr static StringLiteral VERSION_SEMVER = "version-semver"; - constexpr static StringLiteral VERSION_DATE = "version-date"; - constexpr static StringLiteral VERSION_STRING = "version-string"; virtual Span valid_fields() const override { - static const StringView t[] = { - NAME, - PORT_VERSION, - VERSION_RELAXED, - VERSION_SEMVER, - VERSION_DATE, - VERSION_STRING, - }; - + static const StringView u[] = {NAME}; + static const auto t = Util::Vectors::concat(schemed_deserializer_fields(), u); return t; } @@ -576,40 +565,12 @@ namespace vcpkg Versions::Scheme& version_scheme, int& port_version) { - static Json::StringDeserializer version_exact_deserializer{"an exact version string"}; - static Json::StringDeserializer version_relaxed_deserializer{"a relaxed version string"}; - static Json::StringDeserializer version_semver_deserializer{"a semantic version string"}; - static Json::StringDeserializer version_date_deserializer{"a date version string"}; - r.required_object_field(type_name, obj, NAME, name, Json::IdentifierDeserializer::instance); - bool has_exact = r.optional_object_field(obj, VERSION_STRING, version, version_exact_deserializer); - bool has_relax = r.optional_object_field(obj, VERSION_RELAXED, version, version_relaxed_deserializer); - bool has_semver = r.optional_object_field(obj, VERSION_SEMVER, version, version_semver_deserializer); - bool has_date = r.optional_object_field(obj, VERSION_DATE, version, version_date_deserializer); - int num_versions = (int)has_exact + (int)has_relax + (int)has_semver + (int)has_date; - if (num_versions == 0) - { - r.add_generic_error(type_name, "expected a versioning field (example: ", VERSION_STRING, ")"); - } - else if (num_versions > 1) - { - r.add_generic_error(type_name, "expected only one versioning field"); - } - else - { - if (has_exact) - version_scheme = Versions::Scheme::String; - else if (has_relax) - version_scheme = Versions::Scheme::Relaxed; - else if (has_semver) - version_scheme = Versions::Scheme::Semver; - else if (has_date) - version_scheme = Versions::Scheme::Date; - else - Checks::unreachable(VCPKG_LINE_INFO); - } - r.optional_object_field(obj, PORT_VERSION, port_version, Json::NaturalNumberDeserializer::instance); + auto schemed_version = visit_required_schemed_deserializer(type_name, r, obj); + version = schemed_version.versiont.text(); + version_scheme = schemed_version.scheme; + port_version = schemed_version.versiont.port_version(); } virtual Optional visit_object(Json::Reader& r, const Json::Object& obj) override @@ -634,11 +595,6 @@ namespace vcpkg DependencyOverrideDeserializer DependencyOverrideDeserializer::instance; constexpr StringLiteral DependencyOverrideDeserializer::NAME; - constexpr StringLiteral DependencyOverrideDeserializer::VERSION_STRING; - constexpr StringLiteral DependencyOverrideDeserializer::VERSION_RELAXED; - constexpr StringLiteral DependencyOverrideDeserializer::VERSION_SEMVER; - constexpr StringLiteral DependencyOverrideDeserializer::VERSION_DATE; - constexpr StringLiteral DependencyOverrideDeserializer::PORT_VERSION; // reasoning for these two distinct types -- FeatureDeserializer and ArrayFeatureDeserializer: // `"features"` may be defined in one of two ways: @@ -909,15 +865,6 @@ namespace vcpkg virtual StringView type_name() const override { return "a manifest"; } constexpr static StringLiteral NAME = "name"; - - // Default is a relaxed semver-like version - constexpr static StringLiteral VERSION_RELAXED = "version"; - constexpr static StringLiteral VERSION_SEMVER = "version-semver"; - constexpr static StringLiteral VERSION_DATE = "version-date"; - // Legacy version string, accepts arbitrary string values. - constexpr static StringLiteral VERSION_STRING = "version-string"; - - constexpr static StringLiteral PORT_VERSION = "port-version"; constexpr static StringLiteral MAINTAINERS = "maintainers"; constexpr static StringLiteral DESCRIPTION = "description"; constexpr static StringLiteral HOMEPAGE = "homepage"; @@ -932,13 +879,8 @@ namespace vcpkg virtual Span valid_fields() const override { - static const StringView t[] = { + static const StringView u[] = { NAME, - VERSION_STRING, - VERSION_RELAXED, - VERSION_SEMVER, - VERSION_DATE, - PORT_VERSION, MAINTAINERS, DESCRIPTION, HOMEPAGE, @@ -951,6 +893,7 @@ namespace vcpkg SUPPORTS, OVERRIDES, }; + static const auto t = Util::Vectors::concat(schemed_deserializer_fields(), u); return t; } @@ -1014,11 +957,6 @@ namespace vcpkg ManifestDeserializer ManifestDeserializer::instance; constexpr StringLiteral ManifestDeserializer::NAME; - constexpr StringLiteral ManifestDeserializer::VERSION_STRING; - constexpr StringLiteral ManifestDeserializer::VERSION_RELAXED; - constexpr StringLiteral ManifestDeserializer::VERSION_SEMVER; - constexpr StringLiteral ManifestDeserializer::VERSION_DATE; - constexpr StringLiteral ManifestDeserializer::PORT_VERSION; constexpr StringLiteral ManifestDeserializer::MAINTAINERS; constexpr StringLiteral ManifestDeserializer::DESCRIPTION; constexpr StringLiteral ManifestDeserializer::HOMEPAGE; @@ -1329,17 +1267,6 @@ namespace vcpkg } }; - auto version_field = [](Versions::Scheme version_scheme) { - switch (version_scheme) - { - case Versions::Scheme::String: return ManifestDeserializer::VERSION_STRING; - case Versions::Scheme::Semver: return ManifestDeserializer::VERSION_SEMVER; - case Versions::Scheme::Relaxed: return ManifestDeserializer::VERSION_RELAXED; - case Versions::Scheme::Date: return ManifestDeserializer::VERSION_DATE; - default: Checks::unreachable(VCPKG_LINE_INFO); - } - }; - auto serialize_override = [&](Json::Array& arr, const DependencyOverride& dep) { auto& dep_obj = arr.push_back(Json::Object()); for (const auto& el : dep.extra_info) @@ -1349,12 +1276,7 @@ namespace vcpkg dep_obj.insert(DependencyOverrideDeserializer::NAME, Json::Value::string(dep.name)); - if (dep.port_version != 0) - { - dep_obj.insert(DependencyDeserializer::PORT_VERSION, Json::Value::integer(dep.port_version)); - } - - dep_obj.insert(version_field(dep.version_scheme), Json::Value::string(dep.version)); + serialize_schemed_version(dep_obj, dep.version_scheme, dep.version, dep.port_version); }; Json::Object obj; @@ -1365,12 +1287,12 @@ namespace vcpkg } obj.insert(ManifestDeserializer::NAME, Json::Value::string(scf.core_paragraph->name)); - obj.insert(version_field(scf.core_paragraph->version_scheme), Json::Value::string(scf.core_paragraph->version)); - if (scf.core_paragraph->port_version != 0 || debug) - { - obj.insert(ManifestDeserializer::PORT_VERSION, Json::Value::integer(scf.core_paragraph->port_version)); - } + serialize_schemed_version(obj, + scf.core_paragraph->version_scheme, + scf.core_paragraph->version, + scf.core_paragraph->port_version, + debug); serialize_paragraph(obj, ManifestDeserializer::MAINTAINERS, scf.core_paragraph->maintainers); serialize_paragraph(obj, ManifestDeserializer::DESCRIPTION, scf.core_paragraph->description); diff --git a/toolsrc/src/vcpkg/versiondeserializers.cpp b/toolsrc/src/vcpkg/versiondeserializers.cpp index 276b70e4fa817a..5c57a99222e650 100644 --- a/toolsrc/src/vcpkg/versiondeserializers.cpp +++ b/toolsrc/src/vcpkg/versiondeserializers.cpp @@ -1,3 +1,5 @@ +#include + #include using namespace vcpkg; @@ -5,67 +7,171 @@ using namespace vcpkg::Versions; namespace { - struct VersionDbEntryDeserializer final : Json::IDeserializer + constexpr StringLiteral VERSION_RELAXED = "version"; + constexpr StringLiteral VERSION_SEMVER = "version-semver"; + constexpr StringLiteral VERSION_STRING = "version-string"; + constexpr StringLiteral VERSION_DATE = "version-date"; + constexpr StringLiteral PORT_VERSION = "port-version"; + constexpr StringLiteral GIT_TREE = "git-tree"; + + struct VersionDeserializer final : Json::IDeserializer { - static constexpr StringLiteral VERSION_RELAXED = "version"; - static constexpr StringLiteral VERSION_SEMVER = "version-semver"; - static constexpr StringLiteral VERSION_STRING = "version-string"; - static constexpr StringLiteral VERSION_DATE = "version-date"; - static constexpr StringLiteral PORT_VERSION = "port-version"; - static constexpr StringLiteral GIT_TREE = "git-tree"; + VersionDeserializer(StringLiteral type) : m_type(type) { } + StringView type_name() const override { return m_type; } - StringView type_name() const override { return "a version database entry"; } - View valid_fields() const override + Optional visit_string(Json::Reader& r, StringView sv) override { - static const StringView t[] = { - VERSION_RELAXED, VERSION_SEMVER, VERSION_STRING, VERSION_DATE, PORT_VERSION, GIT_TREE}; - return t; + StringView pv(std::find(sv.begin(), sv.end(), '#'), sv.end()); + if (pv.size() == 1) + { + r.add_generic_error(type_name(), "invalid character '#' in version text"); + } + else if (pv.size() > 1) + { + r.add_generic_error(type_name(), + "invalid character '#' in version text. Did you mean \"port-version\": ", + pv.substr(1), + "?"); + } + return sv.to_string(); } + StringLiteral m_type; + }; +} - Optional visit_object(Json::Reader& r, const Json::Object& obj) override +namespace vcpkg +{ + std::unique_ptr> make_version_deserializer(StringLiteral type_name) + { + return std::make_unique(type_name); + } + + SchemedVersion visit_required_schemed_deserializer(StringView parent_type, Json::Reader& r, const Json::Object& obj) + { + auto maybe_schemed_version = visit_optional_schemed_deserializer(parent_type, r, obj); + if (auto p = maybe_schemed_version.get()) { - std::string version; - int port_version = 0; - std::string git_tree; - Versions::Scheme version_scheme = Versions::Scheme::String; - - // Code copy-and-paste'd from sourceparagraph.cpp - static Json::StringDeserializer version_exact_deserializer{"an exact version string"}; - static Json::StringDeserializer version_relaxed_deserializer{"a relaxed version string"}; - static Json::StringDeserializer version_semver_deserializer{"a semantic version string"}; - static Json::StringDeserializer version_date_deserializer{"a date version string"}; - static Json::StringDeserializer git_tree_deserializer("a git object SHA"); + return std::move(*p); + } + else + { + r.add_generic_error(parent_type, "expected a versioning field (example: ", VERSION_STRING, ")"); + return {}; + } + } + Optional visit_optional_schemed_deserializer(StringView parent_type, + Json::Reader& r, + const Json::Object& obj) + { + Versions::Scheme version_scheme = Versions::Scheme::String; + std::string version; + int port_version = 0; + + static VersionDeserializer version_exact_deserializer{"an exact version string"}; + static VersionDeserializer version_relaxed_deserializer{"a relaxed version string"}; + static VersionDeserializer version_semver_deserializer{"a semantic version string"}; + static VersionDeserializer version_date_deserializer{"a date version string"}; + + bool has_exact = r.optional_object_field(obj, VERSION_STRING, version, version_exact_deserializer); + bool has_relax = r.optional_object_field(obj, VERSION_RELAXED, version, version_relaxed_deserializer); + bool has_semver = r.optional_object_field(obj, VERSION_SEMVER, version, version_semver_deserializer); + bool has_date = r.optional_object_field(obj, VERSION_DATE, version, version_date_deserializer); + int num_versions = (int)has_exact + (int)has_relax + (int)has_semver + (int)has_date; + bool has_port_version = + r.optional_object_field(obj, PORT_VERSION, port_version, Json::NaturalNumberDeserializer::instance); - bool has_exact = r.optional_object_field(obj, VERSION_STRING, version, version_exact_deserializer); - bool has_relax = r.optional_object_field(obj, VERSION_RELAXED, version, version_relaxed_deserializer); - bool has_semver = r.optional_object_field(obj, VERSION_SEMVER, version, version_semver_deserializer); - bool has_date = r.optional_object_field(obj, VERSION_DATE, version, version_date_deserializer); - int num_versions = (int)has_exact + (int)has_relax + (int)has_semver + (int)has_date; - if (num_versions == 0) + if (num_versions == 0) + { + if (!has_port_version) { - r.add_generic_error(type_name(), "expected a versioning field (example: ", VERSION_STRING, ")"); + return nullopt; } - else if (num_versions > 1) + else { - r.add_generic_error(type_name(), "expected only one versioning field"); + r.add_generic_error(parent_type, "unexpected \"port_version\" without a versioning field"); } + } + else if (num_versions > 1) + { + r.add_generic_error(parent_type, "expected only one versioning field"); + } + else + { + if (has_exact) + version_scheme = Versions::Scheme::String; + else if (has_relax) + version_scheme = Versions::Scheme::Relaxed; + else if (has_semver) + version_scheme = Versions::Scheme::Semver; + else if (has_date) + version_scheme = Versions::Scheme::Date; else + Checks::unreachable(VCPKG_LINE_INFO); + } + + return SchemedVersion{version_scheme, {version, port_version}}; + } + + View schemed_deserializer_fields() + { + static const StringView t[] = {VERSION_RELAXED, VERSION_SEMVER, VERSION_STRING, VERSION_DATE, PORT_VERSION}; + return t; + } + + void serialize_schemed_version(Json::Object& out_obj, + Versions::Scheme scheme, + const std::string& version, + int port_version, + bool always_emit_port_version) + { + auto version_field = [](Versions::Scheme version_scheme) { + switch (version_scheme) { - if (has_exact) - version_scheme = Versions::Scheme::String; - else if (has_relax) - version_scheme = Versions::Scheme::Relaxed; - else if (has_semver) - version_scheme = Versions::Scheme::Semver; - else if (has_date) - version_scheme = Versions::Scheme::Date; - else - Checks::unreachable(VCPKG_LINE_INFO); + case Versions::Scheme::String: return VERSION_STRING; + case Versions::Scheme::Semver: return VERSION_SEMVER; + case Versions::Scheme::Relaxed: return VERSION_RELAXED; + case Versions::Scheme::Date: return VERSION_DATE; + default: Checks::unreachable(VCPKG_LINE_INFO); } - r.optional_object_field(obj, PORT_VERSION, port_version, Json::NaturalNumberDeserializer::instance); - r.required_object_field(type_name(), obj, GIT_TREE, git_tree, git_tree_deserializer); + }; + + out_obj.insert(version_field(scheme), Json::Value::string(version)); + + if (port_version != 0 || always_emit_port_version) + { + out_obj.insert(PORT_VERSION, Json::Value::integer(port_version)); + } + } + +} + +namespace +{ + struct VersionDbEntryDeserializer final : Json::IDeserializer + { + static constexpr StringLiteral GIT_TREE = "git-tree"; + + StringView type_name() const override { return "a version database entry"; } + View valid_fields() const override + { + static const StringView u[] = {GIT_TREE}; + static const auto t = vcpkg::Util::Vectors::concat(schemed_deserializer_fields(), u); + return t; + } + + Optional visit_object(Json::Reader& r, const Json::Object& obj) override + { + VersionDbEntry ret; + + auto schemed_version = visit_required_schemed_deserializer(type_name(), r, obj); + ret.scheme = schemed_version.scheme; + ret.version = std::move(schemed_version.versiont); + + static Json::StringDeserializer git_tree_deserializer("a git object SHA"); + + r.required_object_field(type_name(), obj, GIT_TREE, ret.git_tree, git_tree_deserializer); - return VersionDbEntry(version, port_version, version_scheme, git_tree); + return std::move(ret); } static VersionDbEntryDeserializer instance; @@ -115,7 +221,7 @@ namespace StringView type_name() const override { return "a version object"; } View valid_fields() const override { - static const StringView t[] = {"version-string", "port-version"}; + static const StringView t[] = {VERSION_STRING, PORT_VERSION}; return t; } @@ -124,16 +230,16 @@ namespace std::string version; int port_version = 0; - r.required_object_field(type_name(), obj, "version-string", version, version_deserializer); - r.optional_object_field(obj, "port-version", port_version, Json::NaturalNumberDeserializer::instance); + static VersionDeserializer version_deserializer{"version"}; + + r.required_object_field(type_name(), obj, VERSION_STRING, version, version_deserializer); + r.optional_object_field(obj, PORT_VERSION, port_version, Json::NaturalNumberDeserializer::instance); return VersionT{std::move(version), port_version}; } - - static Json::StringDeserializer version_deserializer; static VersionTDeserializer instance; }; - Json::StringDeserializer VersionTDeserializer::version_deserializer{"version"}; + VersionTDeserializer VersionTDeserializer::instance; } diff --git a/toolsrc/src/vcpkg/versions.cpp b/toolsrc/src/vcpkg/versions.cpp index 7f19813ec07562..5ea2a8182e5f73 100644 --- a/toolsrc/src/vcpkg/versions.cpp +++ b/toolsrc/src/vcpkg/versions.cpp @@ -1,7 +1,29 @@ +#include + #include +#include + namespace vcpkg::Versions { + namespace + { + Optional as_numeric(StringView str) + { + uint64_t res = 0; + size_t digits = 0; + for (auto&& ch : str) + { + uint64_t digit_value = static_cast(ch) - static_cast('0'); + if (digit_value > 9) return nullopt; + if (res > std::numeric_limits::max() / 10 - digit_value) return nullopt; + ++digits; + res = res * 10 + digit_value; + } + return res; + } + } + VersionSpec::VersionSpec(const std::string& port_name, const VersionT& version) : port_name(port_name), version(version) { @@ -27,4 +49,199 @@ namespace vcpkg::Versions return hash()(key.port_name) ^ (hash()(key.version.to_string()) >> 1); } + + ExpectedS RelaxedVersion::from_string(const std::string& str) + { + std::regex relaxed_scheme_match("^(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*))*"); + + if (!std::regex_match(str, relaxed_scheme_match)) + { + return Strings::format( + "Error: String `%s` must only contain dot-separated numeric values without leading zeroes.", str); + } + + return RelaxedVersion{str, Util::fmap(Strings::split(str, '.'), [](auto&& strval) -> uint64_t { + return as_numeric(strval).value_or_exit(VCPKG_LINE_INFO); + })}; + } + + ExpectedS SemanticVersion::from_string(const std::string& str) + { + // Suggested regex by semver.org + std::regex semver_scheme_match("^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)" + "(?:-((?:0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9][0-9]*|[0-9]" + "*[a-zA-Z-][0-9a-zA-Z-]*))*))?" + "(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"); + + if (!std::regex_match(str, semver_scheme_match)) + { + return Strings::format( + "Error: String `%s` is not a valid Semantic Version string, consult https://semver.org", str); + } + + SemanticVersion ret; + ret.original_string = str; + ret.version_string = str; + + auto build_found = ret.version_string.find('+'); + if (build_found != std::string::npos) + { + ret.version_string.resize(build_found); + } + + auto prerelease_found = ret.version_string.find('-'); + if (prerelease_found != std::string::npos) + { + ret.prerelease_string = ret.version_string.substr(prerelease_found + 1); + ret.identifiers = Strings::split(ret.prerelease_string, '.'); + ret.version_string.resize(prerelease_found); + } + + std::regex version_match("(0|[1-9][0-9]*)(\\.(0|[1-9][0-9]*)){2}"); + if (!std::regex_match(ret.version_string, version_match)) + { + return Strings::format("Error: String `%s` does not follow the required MAJOR.MINOR.PATCH format.", + ret.version_string); + } + + auto parts = Strings::split(ret.version_string, '.'); + ret.version = Util::fmap( + parts, [](auto&& strval) -> uint64_t { return as_numeric(strval).value_or_exit(VCPKG_LINE_INFO); }); + + return ret; + } + + ExpectedS DateVersion::from_string(const std::string& str) + { + std::regex date_scheme_match("([0-9]{4}-[0-9]{2}-[0-9]{2})(\\.(0|[1-9][0-9]*))*"); + if (!std::regex_match(str, date_scheme_match)) + { + return Strings::format("Error: String `%s` is not a valid date version." + "Date section must follow the format YYYY-MM-DD and disambiguators must be " + "dot-separated positive integer values without leading zeroes.", + str); + } + + DateVersion ret; + ret.original_string = str; + ret.version_string = str; + + auto identifiers_found = ret.version_string.find('.'); + if (identifiers_found != std::string::npos) + { + ret.identifiers_string = ret.version_string.substr(identifiers_found + 1); + ret.identifiers = Util::fmap(Strings::split(ret.identifiers_string, '.'), [](auto&& strval) -> uint64_t { + return as_numeric(strval).value_or_exit(VCPKG_LINE_INFO); + }); + ret.version_string.resize(identifiers_found); + } + + return ret; + } + + VerComp compare(const std::string& a, const std::string& b, Scheme scheme) + { + if (scheme == Scheme::String) + { + return (a == b) ? VerComp::eq : VerComp::unk; + } + if (scheme == Scheme::Semver) + { + return compare(SemanticVersion::from_string(a).value_or_exit(VCPKG_LINE_INFO), + SemanticVersion::from_string(b).value_or_exit(VCPKG_LINE_INFO)); + } + if (scheme == Scheme::Relaxed) + { + return compare(RelaxedVersion::from_string(a).value_or_exit(VCPKG_LINE_INFO), + RelaxedVersion::from_string(b).value_or_exit(VCPKG_LINE_INFO)); + } + if (scheme == Scheme::Date) + { + return compare(DateVersion::from_string(a).value_or_exit(VCPKG_LINE_INFO), + DateVersion::from_string(b).value_or_exit(VCPKG_LINE_INFO)); + } + Checks::unreachable(VCPKG_LINE_INFO); + } + + VerComp compare(const RelaxedVersion& a, const RelaxedVersion& b) + { + if (a.original_string == b.original_string) return VerComp::eq; + + if (a.version < b.version) return VerComp::lt; + if (a.version > b.version) return VerComp::gt; + Checks::unreachable(VCPKG_LINE_INFO); + } + + VerComp compare(const SemanticVersion& a, const SemanticVersion& b) + { + if (a.version_string == b.version_string) + { + if (a.prerelease_string == b.prerelease_string) return VerComp::eq; + if (a.prerelease_string.empty()) return VerComp::gt; + if (b.prerelease_string.empty()) return VerComp::lt; + } + + // Compare version elements left-to-right. + if (a.version < b.version) return VerComp::lt; + if (a.version > b.version) return VerComp::gt; + + // Compare identifiers left-to-right. + auto count = std::min(a.identifiers.size(), b.identifiers.size()); + for (size_t i = 0; i < count; ++i) + { + auto&& iden_a = a.identifiers[i]; + auto&& iden_b = b.identifiers[i]; + + auto a_numeric = as_numeric(iden_a); + auto b_numeric = as_numeric(iden_b); + + // Numeric identifiers always have lower precedence than non-numeric identifiers. + if (a_numeric.has_value() && !b_numeric.has_value()) return VerComp::lt; + if (!a_numeric.has_value() && b_numeric.has_value()) return VerComp::gt; + + // Identifiers consisting of only digits are compared numerically. + if (a_numeric.has_value() && b_numeric.has_value()) + { + auto a_value = a_numeric.value_or_exit(VCPKG_LINE_INFO); + auto b_value = b_numeric.value_or_exit(VCPKG_LINE_INFO); + + if (a_value < b_value) return VerComp::lt; + if (a_value > b_value) return VerComp::gt; + continue; + } + + // Identifiers with letters or hyphens are compared lexically in ASCII sort order. + auto strcmp_result = std::strcmp(iden_a.c_str(), iden_b.c_str()); + if (strcmp_result < 0) return VerComp::lt; + if (strcmp_result > 0) return VerComp::gt; + } + + // A larger set of pre-release fields has a higher precedence than a smaller set, if all of the preceding + // identifiers are equal. + if (a.identifiers.size() < b.identifiers.size()) return VerComp::lt; + if (a.identifiers.size() > b.identifiers.size()) return VerComp::gt; + + // This should be unreachable since direct string comparisons of version_string and prerelease_string should + // handle this case. If we ever land here, then there's a bug in the the parsing on + // SemanticVersion::from_string(). + Checks::unreachable(VCPKG_LINE_INFO); + } + + VerComp compare(const Versions::DateVersion& a, const Versions::DateVersion& b) + { + if (a.version_string == b.version_string) + { + if (a.identifiers_string == b.identifiers_string) return VerComp::eq; + if (a.identifiers_string.empty() && !b.identifiers_string.empty()) return VerComp::lt; + if (!a.identifiers_string.empty() && b.identifiers_string.empty()) return VerComp::gt; + } + + // The date parts in our scheme is lexicographically sortable. + if (a.version_string < b.version_string) return VerComp::lt; + if (a.version_string > b.version_string) return VerComp::gt; + if (a.identifiers < b.identifiers) return VerComp::lt; + if (a.identifiers > b.identifiers) return VerComp::gt; + + Checks::unreachable(VCPKG_LINE_INFO); + } } \ No newline at end of file diff --git a/toolsrc/windows-bootstrap/vcpkg.vcxproj b/toolsrc/windows-bootstrap/vcpkg.vcxproj index 16de6e9c45179f..b11d5540c751ec 100644 --- a/toolsrc/windows-bootstrap/vcpkg.vcxproj +++ b/toolsrc/windows-bootstrap/vcpkg.vcxproj @@ -205,6 +205,7 @@ + @@ -296,6 +297,7 @@ + diff --git a/triplets/x64-osx.cmake b/triplets/x64-osx.cmake index af3a8c3483028e..8cd8c90b4a69ab 100644 --- a/triplets/x64-osx.cmake +++ b/triplets/x64-osx.cmake @@ -3,3 +3,4 @@ set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_CMAKE_SYSTEM_NAME Darwin) +set(VCPKG_OSX_ARCHITECTURES x86_64)