From cdb9fc77e1565d4885d188641218b504dd468d97 Mon Sep 17 00:00:00 2001 From: halx99 Date: Wed, 7 Aug 2024 23:35:39 +0800 Subject: [PATCH] Improve 1k scripts --- 1k/1kiss.ps1 | 1 + 1k/fetch.cmake | 8 +++++++- build.ps1 | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/1k/1kiss.ps1 b/1k/1kiss.ps1 index 4932e1f..1189a31 100644 --- a/1k/1kiss.ps1 +++ b/1k/1kiss.ps1 @@ -904,6 +904,7 @@ function setup_cmake($skipOS = $false, $scope = 'local') { else { & "$cmake_pkg_path" '--skip-license' '--prefix=/usr/local' 1>$null 2>$null } + if (!$?) { Remove-Item $cmake_pkg_path -Force } } $cmake_prog, $_ = find_prog -name 'cmake' -path $cmake_bin -silent $true diff --git a/1k/fetch.cmake b/1k/fetch.cmake index 4556042..6fa0c08 100644 --- a/1k/fetch.cmake +++ b/1k/fetch.cmake @@ -20,10 +20,16 @@ function(_1kfetch_init) set(_1kfetch_manifest "${_1kfetch_manifest}" CACHE STRING "" FORCE) endif() + if(NOT EXISTS ${PWSH_PROG}) # try again + unset(PWSH_PROG CACHE) + find_program(PWSH_PROG NAMES pwsh powershell NO_PACKAGE_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH) + endif() + execute_process(COMMAND ${PWSH_PROG} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/resolv-uri.ps1 -name "1kdist" -manifest ${_1kfetch_manifest} OUTPUT_VARIABLE _1kdist_url + RESULT_VARIABLE _1kdist_error ) if(_1kdist_url) @@ -33,7 +39,7 @@ function(_1kfetch_init) set(_1kdist_base_url "${_1kdist_base_url}/${_1kdist_ver}" PARENT_SCOPE) set(_1kdist_ver ${_1kdist_ver} PARENT_SCOPE) else() - message(WARNING "Resolve 1kdist uri fail, the _1kfetch_dist will not work") + message(WARNING "Resolve 1kdist uri fail, ${_1kdist_error}, the _1kfetch_dist will not work") endif() endfunction() diff --git a/build.ps1 b/build.ps1 index 113790c..ad0bb30 100644 --- a/build.ps1 +++ b/build.ps1 @@ -222,7 +222,7 @@ Foreach ($lib_name in $libs) { $patches = Get-ChildItem (Split-Path $patch_script -Parent) -Filter '*.patch' foreach($patch_file in $patches) { println "apply patch: $patch_file" - git -C $lib_src apply --verbose $patch_file + git -C $lib_src apply --verbose --ignore-whitespace $patch_file } }