From 726c11148105a97aef39bec024fdb7c140b1b154 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 7 Oct 2019 19:35:13 +0200 Subject: [vcpkg] fatal_error when patch fails to apply (#8087) vcpkg will now fail on failure to apply patches except when using `--head`. --- scripts/boost/generate-ports.ps1 | 10 +++++----- scripts/bootstrap.sh | 14 +++++++++++--- scripts/cmake/vcpkg_apply_patches.cmake | 2 +- scripts/cmake/vcpkg_common_definitions.cmake | 3 +++ scripts/cmake/vcpkg_extract_source_archive_ex.cmake | 19 ++++++++++++++++++- scripts/cmake/vcpkg_fixup_cmake_targets.cmake | 2 ++ scripts/cmake/vcpkg_from_github.cmake | 1 + 7 files changed, 41 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/boost/generate-ports.ps1 b/scripts/boost/generate-ports.ps1 index d51b37f7e..5f5897718 100644 --- a/scripts/boost/generate-ports.ps1 +++ b/scripts/boost/generate-ports.ps1 @@ -13,9 +13,9 @@ function TransformReference() [string]$library ) - if ($library -match "python|fiber") + if ($library -match "fiber") { - # These two only work on windows desktop + # these only work on windows desktop "$library (windows)" } elseif ($library -match "type[_-]erasure|contract") @@ -47,12 +47,12 @@ function Generate() $sanitizedName = $name -replace "_","-" $versionsuffix = "" - if ($Name -eq "python" -or $Name -eq "asio" -or $Name -eq "mpi") + if ($Name -eq "asio" -or $Name -eq "mpi") { $versionsuffix = "-1" } - if ($Name -eq "test") + if ($Name -eq "python" -or $Name -eq "test") { $versionsuffix = "-2" } @@ -363,7 +363,7 @@ foreach ($library in $libraries) if ($library -eq "python") { - $deps += @("python3") + $deps += @("python3 (!osx&!linux)") $needsBuild = $true } elseif ($library -eq "iostreams") diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index afdd9c1b3..d89d5a15b 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -17,7 +17,7 @@ fi # Argument parsing vcpkgDisableMetrics="OFF" vcpkgUseSystem=false -vcpkgAllowAppleClang=OFF +vcpkgAllowAppleClang=false for var in "$@" do if [ "$var" = "-disableMetrics" -o "$var" = "--disableMetrics" ]; then @@ -25,7 +25,7 @@ do elif [ "$var" = "-useSystemBinaries" -o "$var" = "--useSystemBinaries" ]; then vcpkgUseSystem=true elif [ "$var" = "-allowAppleClang" -o "$var" = "--allowAppleClang" ]; then - vcpkgAllowAppleClang=ON + vcpkgAllowAppleClang=true elif [ "$var" = "-help" -o "$var" = "--help" ]; then echo "Usage: ./bootstrap-vcpkg.sh [options]" echo @@ -242,7 +242,15 @@ else fetchTool "cmake" "$UNAME" cmakeExe || exit 1 fetchTool "ninja" "$UNAME" ninjaExe || exit 1 fi -selectCXX CXX || exit 1 +if [ "$os" = "osx" ]; then + if [ "$vcpkgAllowAppleClang" = "true" ] ; then + CXX=clang + else + selectCXX CXX || exit 1 + fi +else + selectCXX CXX || exit 1 +fi # Do the build buildDir="$vcpkgRootDir/toolsrc/build.rel" diff --git a/scripts/cmake/vcpkg_apply_patches.cmake b/scripts/cmake/vcpkg_apply_patches.cmake index 9698917de..8957fca27 100644 --- a/scripts/cmake/vcpkg_apply_patches.cmake +++ b/scripts/cmake/vcpkg_apply_patches.cmake @@ -49,7 +49,7 @@ function(vcpkg_apply_patches) ) if(error_code AND NOT _ap_QUIET) - message(STATUS "Applying patch failed. This is expected if this patch was previously applied.") + message(FATAL_ERROR "Applying patch failed. Patch needs to be updated to work with source being used by vcpkg!") endif() math(EXPR PATCHNUM "${PATCHNUM}+1") diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake index 28177fbbf..60afeaf36 100644 --- a/scripts/cmake/vcpkg_common_definitions.cmake +++ b/scripts/cmake/vcpkg_common_definitions.cmake @@ -55,6 +55,7 @@ endif() #Helper variables for libraries if(VCPKG_TARGET_IS_WINDOWS) set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".lib") + set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib") set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dll") set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib") set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "") @@ -69,6 +70,7 @@ if(VCPKG_TARGET_IS_WINDOWS) #set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "") elseif(VCPKG_TARGET_IS_OSX) set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a") + set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "") set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dylib") set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib") set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib") @@ -76,6 +78,7 @@ elseif(VCPKG_TARGET_IS_OSX) set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "") else() set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a") + set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "") set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".so") set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib") set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib") diff --git a/scripts/cmake/vcpkg_extract_source_archive_ex.cmake b/scripts/cmake/vcpkg_extract_source_archive_ex.cmake index a775c2094..67916d09d 100644 --- a/scripts/cmake/vcpkg_extract_source_archive_ex.cmake +++ b/scripts/cmake/vcpkg_extract_source_archive_ex.cmake @@ -5,6 +5,7 @@ ## ## Usage ## ```cmake ## vcpkg_extract_source_archive_ex( +## SKIP_PATCH_CHECK ## OUT_SOURCE_PATH ## ARCHIVE <${ARCHIVE}> ## [REF <1.0.0>] @@ -14,6 +15,9 @@ ## ) ## ``` ## ## Parameters +## ### SKIP_PATCH_CHECK +## If this option is set the failure to apply a patch is ignored. +## ## ### OUT_SOURCE_PATH ## Specifies the out-variable that will contain the extracted location. ## @@ -51,7 +55,13 @@ include(vcpkg_apply_patches) include(vcpkg_extract_source_archive) function(vcpkg_extract_source_archive_ex) - cmake_parse_arguments(_vesae "NO_REMOVE_ONE_LEVEL" "OUT_SOURCE_PATH;ARCHIVE;REF;WORKING_DIRECTORY" "PATCHES" ${ARGN}) + cmake_parse_arguments( + _vesae + "NO_REMOVE_ONE_LEVEL;SKIP_PATCH_CHECK" + "OUT_SOURCE_PATH;ARCHIVE;REF;WORKING_DIRECTORY" + "PATCHES" + ${ARGN} + ) if(NOT _vesae_ARCHIVE) message(FATAL_ERROR "Must specify ARCHIVE parameter to vcpkg_extract_source_archive_ex()") @@ -115,7 +125,14 @@ function(vcpkg_extract_source_archive_ex) endif() endif() + if (_vesae_SKIP_PATCH_CHECK) + set (QUIET QUIET) + else() + set (QUIET) + endif() + vcpkg_apply_patches( + ${QUIET} SOURCE_PATH ${TEMP_SOURCE_PATH} PATCHES ${_vesae_PATCHES} ) diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake index 3b5370bcd..c383fcb56 100644 --- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake +++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake @@ -178,3 +178,5 @@ function(vcpkg_fixup_cmake_targets) file(WRITE ${CMAKE_FILE} "${_contents}") endforeach() endfunction() + + diff --git a/scripts/cmake/vcpkg_from_github.cmake b/scripts/cmake/vcpkg_from_github.cmake index c0d657bbc..a822ee40e 100644 --- a/scripts/cmake/vcpkg_from_github.cmake +++ b/scripts/cmake/vcpkg_from_github.cmake @@ -172,6 +172,7 @@ function(vcpkg_from_github) endif() vcpkg_extract_source_archive_ex( + SKIP_PATCH_CHECK OUT_SOURCE_PATH SOURCE_PATH ARCHIVE "${downloaded_file_path}" REF "${SANITIZED_HEAD_REF}" -- cgit v1.2.3