diff options
| author | zi-m <zi.m.github.com@gmail.com> | 2019-08-29 20:39:11 +0200 |
|---|---|---|
| committer | zi-m <zi.m.github.com@gmail.com> | 2019-08-29 20:39:11 +0200 |
| commit | 7fd21c5d827c2d77b21270646c2fe53704245747 (patch) | |
| tree | 2e6c8a4e482c6093acec724a9ec6d1efb5207bd7 /scripts | |
| parent | 94d52ecffe377a3d11f626d84a2da9ca5c60be9a (diff) | |
| parent | f5c732b40d43f062278f247036b773477823813b (diff) | |
| download | vcpkg-7fd21c5d827c2d77b21270646c2fe53704245747.tar.gz vcpkg-7fd21c5d827c2d77b21270646c2fe53704245747.zip | |
Merge remote-tracking branch 'upstream/master' into wxchartdir
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/cmake/execute_process.cmake | 20 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_acquire_msys.cmake | 8 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_apply_patches.cmake | 2 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_common_functions.cmake | 1 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_download_distfile.cmake | 2 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_execute_required_process.cmake | 18 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_extract_source_archive.cmake | 1 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_find_acquire_program.cmake | 5 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_from_git.cmake | 5 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_from_gitlab.cmake | 2 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_test_cmake.cmake | 55 |
11 files changed, 53 insertions, 66 deletions
diff --git a/scripts/cmake/execute_process.cmake b/scripts/cmake/execute_process.cmake new file mode 100644 index 000000000..6d9bd6cfc --- /dev/null +++ b/scripts/cmake/execute_process.cmake @@ -0,0 +1,20 @@ +## # execute_process
+##
+## Intercepts all calls to execute_process() inside portfiles and fails when Download Mode
+## is enabled.
+##
+## In order to execute a process in Download Mode call `_execute_process()` instead.
+##
+if (NOT DEFINED OVERRIDEN_EXECUTE_PROCESS)
+ set(OVERRIDEN_EXECUTE_PROCESS ON)
+
+ if (DEFINED VCPKG_DOWNLOAD_MODE)
+ function(execute_process)
+ message(FATAL_ERROR "This command cannot be executed in Download Mode.\nHalting portfile execution.\n")
+ endfunction()
+ else()
+ function(execute_process)
+ _execute_process(${ARGV})
+ endfunction()
+ endif()
+endif()
\ No newline at end of file diff --git a/scripts/cmake/vcpkg_acquire_msys.cmake b/scripts/cmake/vcpkg_acquire_msys.cmake index 09090db68..f1f09dc7e 100644 --- a/scripts/cmake/vcpkg_acquire_msys.cmake +++ b/scripts/cmake/vcpkg_acquire_msys.cmake @@ -81,15 +81,15 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) file(REMOVE_RECURSE ${TOOLPATH}/${TOOLSUBPATH}) file(MAKE_DIRECTORY ${TOOLPATH}) - execute_process( + _execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf ${ARCHIVE_PATH} WORKING_DIRECTORY ${TOOLPATH} ) - execute_process( + _execute_process( COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman-key --init;pacman-key --populate" WORKING_DIRECTORY ${TOOLPATH} ) - execute_process( + _execute_process( COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "PATH=/usr/bin;pacman -Syu --noconfirm" WORKING_DIRECTORY ${TOOLPATH} ) @@ -104,6 +104,7 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) set(_ENV_ORIGINAL $ENV{PATH}) set(ENV{PATH} ${PATH_TO_ROOT}/usr/bin) vcpkg_execute_required_process( + ALLOW_IN_DOWNLOAD_MODE COMMAND ${PATH_TO_ROOT}/usr/bin/bash.exe --noprofile --norc -c "pacman -Sy --noconfirm --needed ${_am_PACKAGES}" WORKING_DIRECTORY ${TOOLPATH} LOGNAME msys-pacman-${TARGET_TRIPLET} @@ -116,6 +117,7 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT) # Deal with a stale process created by MSYS if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") vcpkg_execute_required_process( + ALLOW_IN_DOWNLOAD_MODE COMMAND TASKKILL /F /IM gpg-agent.exe /fi "memusage gt 2" WORKING_DIRECTORY ${SOURCE_PATH} ) diff --git a/scripts/cmake/vcpkg_apply_patches.cmake b/scripts/cmake/vcpkg_apply_patches.cmake index ac0b78e20..9698917de 100644 --- a/scripts/cmake/vcpkg_apply_patches.cmake +++ b/scripts/cmake/vcpkg_apply_patches.cmake @@ -40,7 +40,7 @@ function(vcpkg_apply_patches) get_filename_component(ABSOLUTE_PATCH "${PATCH}" ABSOLUTE BASE_DIR "${CURRENT_PORT_DIR}") message(STATUS "Applying patch ${PATCH}") set(LOGNAME patch-${TARGET_TRIPLET}-${PATCHNUM}) - execute_process( + _execute_process( COMMAND ${GIT} --work-tree=. --git-dir=.git apply "${ABSOLUTE_PATCH}" --ignore-whitespace --whitespace=nowarn --verbose OUTPUT_FILE ${CURRENT_BUILDTREES_DIR}/${LOGNAME}-out.log ERROR_FILE ${CURRENT_BUILDTREES_DIR}/${LOGNAME}-err.log diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake index e9e52bad8..5f4155e9d 100644 --- a/scripts/cmake/vcpkg_common_functions.cmake +++ b/scripts/cmake/vcpkg_common_functions.cmake @@ -1,3 +1,4 @@ +include(execute_process) include(vcpkg_acquire_msys) include(vcpkg_add_to_path) include(vcpkg_check_features) diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index 72016b8c9..1fbff40e5 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -120,7 +120,7 @@ function(vcpkg_download_distfile VAR) list(APPEND request_headers "--header=${header}") endforeach() endif() - execute_process( + _execute_process( COMMAND ${ARIA2} ${vcpkg_download_distfile_URLS} -o temp/${vcpkg_download_distfile_FILENAME} -l download-${vcpkg_download_distfile_FILENAME}-detailed.log diff --git a/scripts/cmake/vcpkg_execute_required_process.cmake b/scripts/cmake/vcpkg_execute_required_process.cmake index e65d1970a..f25a5b55e 100644 --- a/scripts/cmake/vcpkg_execute_required_process.cmake +++ b/scripts/cmake/vcpkg_execute_required_process.cmake @@ -11,6 +11,10 @@ ## ) ## ``` ## ## Parameters +## ### ALLOW_IN_DOWNLOAD_MODE +## Allows the command to execute in Download Mode. +## [See execute_process() override](../../scripts/cmake/execute_process.cmake). +## ## ### COMMAND ## The command to be executed, along with its arguments. ## @@ -30,10 +34,20 @@ ## * [qt5](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5/portfile.cmake) include(vcpkg_prettify_command) function(vcpkg_execute_required_process) - cmake_parse_arguments(vcpkg_execute_required_process "" "WORKING_DIRECTORY;LOGNAME" "COMMAND" ${ARGN}) + cmake_parse_arguments(vcpkg_execute_required_process "ALLOW_IN_DOWNLOAD_MODE" "WORKING_DIRECTORY;LOGNAME" "COMMAND" ${ARGN}) set(LOG_OUT "${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_LOGNAME}-out.log") set(LOG_ERR "${CURRENT_BUILDTREES_DIR}/${vcpkg_execute_required_process_LOGNAME}-err.log") - execute_process( + + set(execute_process_function execute_process) + if (DEFINED VCPKG_DOWNLOAD_MODE AND NOT vcpkg_execute_required_process_ALLOW_IN_DOWNLOAD_MODE) + message(FATAL_ERROR +[[ +This command cannot be executed in Download Mode. +Halting portfile execution. +]]) + endif() + + _execute_process( COMMAND ${vcpkg_execute_required_process_COMMAND} OUTPUT_FILE ${LOG_OUT} ERROR_FILE ${LOG_ERR} diff --git a/scripts/cmake/vcpkg_extract_source_archive.cmake b/scripts/cmake/vcpkg_extract_source_archive.cmake index a55419b19..fbae94b55 100644 --- a/scripts/cmake/vcpkg_extract_source_archive.cmake +++ b/scripts/cmake/vcpkg_extract_source_archive.cmake @@ -41,6 +41,7 @@ function(vcpkg_extract_source_archive ARCHIVE) message(STATUS "Extracting source ${ARCHIVE}") file(MAKE_DIRECTORY ${WORKING_DIRECTORY}) vcpkg_execute_required_process( + ALLOW_IN_DOWNLOAD_MODE COMMAND ${CMAKE_COMMAND} -E tar xjf ${ARCHIVE} WORKING_DIRECTORY ${WORKING_DIRECTORY} LOGNAME extract diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index fed016c7b..aa8a70026 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -302,12 +302,12 @@ function(vcpkg_find_acquire_program VAR) if(ARCHIVE_EXTENSION STREQUAL ".msi") file(TO_NATIVE_PATH "${ARCHIVE_PATH}" ARCHIVE_NATIVE_PATH) file(TO_NATIVE_PATH "${PROG_PATH_SUBDIR}" DESTINATION_NATIVE_PATH) - execute_process( + _execute_process( COMMAND msiexec /a ${ARCHIVE_NATIVE_PATH} /qn TARGETDIR=${DESTINATION_NATIVE_PATH} WORKING_DIRECTORY ${DOWNLOADS} ) else() - execute_process( + _execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf ${ARCHIVE_PATH} WORKING_DIRECTORY ${PROG_PATH_SUBDIR} ) @@ -316,6 +316,7 @@ function(vcpkg_find_acquire_program VAR) if(DEFINED POST_INSTALL_COMMAND) vcpkg_execute_required_process( + ALLOW_IN_DOWNLOAD_MODE COMMAND ${POST_INSTALL_COMMAND} WORKING_DIRECTORY ${PROG_PATH_SUBDIR} LOGNAME ${VAR}-tool-post-install diff --git a/scripts/cmake/vcpkg_from_git.cmake b/scripts/cmake/vcpkg_from_git.cmake index 0db818f80..bad5384ca 100644 --- a/scripts/cmake/vcpkg_from_git.cmake +++ b/scripts/cmake/vcpkg_from_git.cmake @@ -74,16 +74,18 @@ function(vcpkg_from_git) find_program(GIT NAMES git git.cmd) # Note: git init is safe to run multiple times vcpkg_execute_required_process( + ALLOW_IN_DOWNLOAD_MODE COMMAND ${GIT} init git-tmp WORKING_DIRECTORY ${DOWNLOADS} LOGNAME git-init-${TARGET_TRIPLET} ) vcpkg_execute_required_process( + ALLOW_IN_DOWNLOAD_MODE COMMAND ${GIT} fetch ${_vdud_URL} ${_vdud_REF} --depth 1 -n WORKING_DIRECTORY ${DOWNLOADS}/git-tmp LOGNAME git-fetch-${TARGET_TRIPLET} ) - execute_process( + _execute_process( COMMAND ${GIT} rev-parse FETCH_HEAD OUTPUT_VARIABLE REV_PARSE_HEAD ERROR_VARIABLE REV_PARSE_HEAD @@ -100,6 +102,7 @@ function(vcpkg_from_git) file(MAKE_DIRECTORY "${DOWNLOADS}/temp") vcpkg_execute_required_process( + ALLOW_IN_DOWNLOAD_MODE COMMAND ${GIT} archive FETCH_HEAD -o "${TEMP_ARCHIVE}" WORKING_DIRECTORY ${DOWNLOADS}/git-tmp LOGNAME git-archive diff --git a/scripts/cmake/vcpkg_from_gitlab.cmake b/scripts/cmake/vcpkg_from_gitlab.cmake index 6bbe81ed6..05253289e 100644 --- a/scripts/cmake/vcpkg_from_gitlab.cmake +++ b/scripts/cmake/vcpkg_from_gitlab.cmake @@ -150,7 +150,7 @@ function(vcpkg_from_gitlab) endif() # There are issues with the Gitlab API project paths being URL-escaped, so we use git here to get the head revision - execute_process(COMMAND ${GIT} ls-remote + _execute_process(COMMAND ${GIT} ls-remote "${_vdud_GITLAB_URL}/${ORG_NAME}/${REPO_NAME}.git" "${_vdud_HEAD_REF}" RESULT_VARIABLE _git_result OUTPUT_VARIABLE _git_output diff --git a/scripts/cmake/vcpkg_test_cmake.cmake b/scripts/cmake/vcpkg_test_cmake.cmake index 20343bf64..eeb27867c 100644 --- a/scripts/cmake/vcpkg_test_cmake.cmake +++ b/scripts/cmake/vcpkg_test_cmake.cmake @@ -21,59 +21,4 @@ function(vcpkg_test_cmake) # 2. Select a generator in the same method as vcpkg_configure_cmake() as though the PREFER_NINJA flag was always passed. # 3. Fully emulate the toolchain file for the just-built package (just adding it to CMAKE_PREFIX_PATH is not enough). return() - - cmake_parse_arguments(_tc "MODULE" "PACKAGE_NAME" "" ${ARGN}) - - if(NOT DEFINED _tc_PACKAGE_NAME) - message(FATAL_ERROR "PACKAGE_NAME must be specified") - endif() - if(_tc_MODULE) - set(PACKAGE_TYPE MODULE) - else() - set(PACKAGE_TYPE CONFIG) - endif() - - if(VCPKG_PLATFORM_TOOLSET STREQUAL "v142") - message(STATUS "Skipping CMake integration test due to v142 / CMake interaction issues") - return() - endif() - - message(STATUS "Performing CMake integration test") - file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-test) - file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-test) - - #Generate Dummy source -# set(VCPKG_TEST_SOURCE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-test/CMakeIntegration.cpp) -# file(WRITE ${VCPKG_TEST_SOURCE} "int main() \{\n") -# file(APPEND ${VCPKG_TEST_SOURCE} "return 0;}") - # Generate test source CMakeLists.txt - set(VCPKG_TEST_CMAKELIST ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-test/CMakeLists.txt) - file(WRITE ${VCPKG_TEST_CMAKELIST} "cmake_minimum_required(VERSION 3.10)\n") - file(APPEND ${VCPKG_TEST_CMAKELIST} "set(CMAKE_PREFIX_PATH \"${CURRENT_PACKAGES_DIR};${CURRENT_INSTALLED_DIR}\")\n") - file(APPEND ${VCPKG_TEST_CMAKELIST} "\n") - file(APPEND ${VCPKG_TEST_CMAKELIST} "find_package(${_tc_PACKAGE_NAME} ${PACKAGE_TYPE} REQUIRED)\n") - #To properly test if the package is actually working haveway correctly we have to link all targets of a package to - #a test executable and than actually build it. This will not discover if every symbol exported by the library is available/linked - #but it will doscover if all files which are linked by a target actual exist. Problem is: How to discover all targets? -# file(APPEND ${VCPKG_TEST_CMAKELIST} "add_executable(${_tc_PACKAGE_NAME}_exe ${VCPKG_TEST_SOURCE})\n") -# file(APPEND ${VCPKG_TEST_CMAKELIST} "target_link_libraries(${_tc_PACKAGE_NAME}_exe PRIVATE ${_tc_PACKAGE_NAME})\n") - - if(DEFINED _VCPKG_CMAKE_GENERATOR) - set(VCPKG_CMAKE_TEST_GENERATOR "${_VCPKG_CMAKE_GENERATOR}") - else() - set(VCPKG_CMAKE_TEST_GENERATOR Ninja) - endif() - - # Run cmake config with a generated CMakeLists.txt - set(LOGPREFIX "${CURRENT_BUILDTREES_DIR}/test-cmake-${TARGET_TRIPLET}") - execute_process( - COMMAND ${CMAKE_COMMAND} -G ${VCPKG_CMAKE_TEST_GENERATOR} . - OUTPUT_FILE "${LOGPREFIX}-out.log" - ERROR_FILE "${LOGPREFIX}-err.log" - RESULT_VARIABLE error_code - WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-test - ) - if(error_code) - message(FATAL_ERROR "CMake integration test failed; unable to find_package(${_tc_PACKAGE_NAME} ${PACKAGE_TYPE} REQUIRED)") - endif() endfunction() |
