@@ -459,19 +459,24 @@ if (!$TOOLCHAIN_VER) {
459
459
$Global :is_clang = $TOOLCHAIN_NAME -eq ' clang'
460
460
$Global :is_msvc = $TOOLCHAIN_NAME -eq ' msvc'
461
461
462
- $external_prefix = if ($options.prefix ) { $options.prefix } else { Join-Path $HOME ' .1kiss' }
463
- if (! $1k.isdir ($external_prefix )) {
464
- $1k.mkdirs ($external_prefix )
465
- }
466
-
467
- $1k.println (" proj_dir=$ ( (Get-Location ).Path) , external_prefix=$external_prefix " )
468
-
469
462
# load toolset manifest
470
463
$manifest_file = Join-Path $myRoot ' manifest.ps1'
471
464
if ($1k.isfile ($manifest_file )) {
472
465
. $manifest_file
473
466
}
474
467
468
+ $install_prefix = if ($options.prefix ) { $options.prefix } else { Join-Path $HOME ' .1kiss' }
469
+ if (! $1k.isdir ($install_prefix )) {
470
+ $1k.mkdirs ($install_prefix )
471
+ }
472
+ if ($Global :download_path ) {
473
+ $1k.mkdirs ($Global :download_path )
474
+ } else {
475
+ $Global :download_path = $install_prefix
476
+ }
477
+
478
+ $1k.println (" proj_dir=$ ( (Get-Location ).Path) , install_prefix=$install_prefix " )
479
+
475
480
# 1kdist
476
481
$sentry_file = Join-Path $myRoot ' .gitee'
477
482
$mirror = if ($1k.isfile ($sentry_file )) { ' gitee' } else { ' github' }
@@ -745,11 +750,18 @@ function download_and_expand($url, $out, $dest) {
745
750
}
746
751
}
747
752
748
- function resolve_path ($path ) { if ($1k.isabspath ($path )) { $path } else { Join-Path $external_prefix $path } }
753
+ function resolve_path ($path , $prefix = $null ) {
754
+ if ($1k.isabspath ($path )) {
755
+ return $path
756
+ } else {
757
+ if (! $prefix ) { $prefix = $install_prefix }
758
+ return Join-Path $prefix $path
759
+ }
760
+ }
749
761
750
762
function fetch_pkg ($url , $out = $null , $exrep = $null , $prefix = $null ) {
751
- if (! $out ) { $out = Join-Path $external_prefix $ (Split-Path $url.Split (' ?' )[0 ] - Leaf) }
752
- else { $out = resolve_path $out }
763
+ if (! $out ) { $out = Join-Path $download_path $ (Split-Path $url.Split (' ?' )[0 ] - Leaf) }
764
+ else { $out = resolve_path $out $download_path }
753
765
754
766
$pfn_rename = $null
755
767
@@ -778,7 +790,7 @@ function fetch_pkg($url, $out = $null, $exrep = $null, $prefix = $null) {
778
790
if ($1k.isdir ($inst_dst )) { $1k.rmdirs ($inst_dst ) }
779
791
}
780
792
} else {
781
- $prefix = $external_prefix
793
+ $prefix = $install_prefix
782
794
}
783
795
784
796
download_and_expand $url $out $prefix
@@ -879,7 +891,7 @@ else {
879
891
# setup nuget, not add to path
880
892
function setup_nuget () {
881
893
if (! $manifest [' nuget' ]) { return $null }
882
- $nuget_bin = Join-Path $external_prefix ' nuget'
894
+ $nuget_bin = Join-Path $install_prefix ' nuget'
883
895
$nuget_prog , $nuget_ver = find_prog - name ' nuget' - path $nuget_bin - mode ' BOTH' - params ' help' - silent $true
884
896
if (! $nuget_prog ) {
885
897
$1k.rmdirs ($nuget_bin )
@@ -918,7 +930,7 @@ function setup_python3() {
918
930
# setup axslcc, not add to path
919
931
function setup_axslcc () {
920
932
if (! $manifest [' axslcc' ]) { return $null }
921
- $axslcc_bin = Join-Path $external_prefix ' axslcc'
933
+ $axslcc_bin = Join-Path $install_prefix ' axslcc'
922
934
$axslcc_prog , $axslcc_ver = find_prog - name ' axslcc' - path $axslcc_bin - mode ' BOTH'
923
935
if ($axslcc_prog ) {
924
936
return $axslcc_prog
@@ -949,7 +961,7 @@ function setup_axslcc() {
949
961
function setup_ninja () {
950
962
if (! $manifest [' ninja' ]) { return $null }
951
963
$suffix = $ (' win' , ' linux' , ' mac' ).Get($HOST_OS )
952
- $ninja_bin = Join-Path $external_prefix ' ninja'
964
+ $ninja_bin = Join-Path $install_prefix ' ninja'
953
965
$ninja_prog , $ninja_ver = find_prog - name ' ninja'
954
966
if ($ninja_prog ) {
955
967
return $ninja_prog
@@ -973,7 +985,7 @@ function setup_cmake($skipOS = $false) {
973
985
return $cmake_prog , $cmake_ver
974
986
}
975
987
976
- $cmake_root = $ (Join-Path $external_prefix ' cmake' )
988
+ $cmake_root = $ (Join-Path $install_prefix ' cmake' )
977
989
$cmake_bin = Join-Path $cmake_root ' bin'
978
990
$cmake_prog , $cmake_ver = find_prog - name ' cmake' - path $cmake_bin - mode ' ONLY' - silent $true
979
991
if (! $cmake_prog ) {
@@ -987,7 +999,7 @@ function setup_cmake($skipOS = $false) {
987
999
$cmake_pkg_name = " cmake-$cmake_ver -$HOST_OS_NAME -universal"
988
1000
}
989
1001
990
- $cmake_pkg_path = Join-Path $external_prefix " $cmake_pkg_name$cmake_suffix "
1002
+ $cmake_pkg_path = Join-Path $install_prefix " $cmake_pkg_name$cmake_suffix "
991
1003
992
1004
$assemble_url = $channels [' cmake' ]
993
1005
if (! $assemble_url ) {
@@ -997,7 +1009,7 @@ function setup_cmake($skipOS = $false) {
997
1009
$cmake_url = & $assemble_url - FileName " $cmake_pkg_name$cmake_suffix "
998
1010
}
999
1011
1000
- $cmake_dir = Join-Path $external_prefix $cmake_pkg_name
1012
+ $cmake_dir = Join-Path $install_prefix $cmake_pkg_name
1001
1013
if ($IsMacOS ) {
1002
1014
$cmake_app_contents = Join-Path $cmake_dir ' CMake.app/Contents'
1003
1015
}
@@ -1058,7 +1070,7 @@ function ensure_cmake_ninja($cmake_prog, $ninja_prog) {
1058
1070
1059
1071
function setup_nsis () {
1060
1072
if (! $manifest [' nsis' ]) { return $null }
1061
- $nsis_bin = Join-Path $external_prefix " nsis"
1073
+ $nsis_bin = Join-Path $install_prefix " nsis"
1062
1074
$nsis_prog , $nsis_ver = find_prog - name ' nsis' - cmd ' makensis' - params ' /VERSION'
1063
1075
if ($nsis_prog ) {
1064
1076
return $nsis_prog
@@ -1076,11 +1088,11 @@ function setup_nsis() {
1076
1088
1077
1089
function setup_nasm () {
1078
1090
if (! $manifest [' nasm' ]) { return $null }
1079
- $nasm_prog , $nasm_ver = find_prog - name ' nasm' - path " $external_prefix /nasm" - mode ' BOTH' - silent $true
1091
+ $nasm_prog , $nasm_ver = find_prog - name ' nasm' - path " $install_prefix /nasm" - mode ' BOTH' - silent $true
1080
1092
1081
1093
if (! $nasm_prog ) {
1082
1094
if ($IsWin ) {
1083
- $nasm_bin = Join-Path $external_prefix " nasm-$nasm_ver "
1095
+ $nasm_bin = Join-Path $install_prefix " nasm-$nasm_ver "
1084
1096
if (! $1k.isdir ($nasm_bin )) {
1085
1097
fetch_pkg " https://www.nasm.us/pub/nasm/releasebuilds/$nasm_ver /win64/nasm-$nasm_ver -win64.zip"
1086
1098
}
@@ -1096,7 +1108,7 @@ function setup_nasm() {
1096
1108
}
1097
1109
}
1098
1110
1099
- $nasm_prog , $nasm_ver = find_prog - name ' nasm' - path " $external_prefix /nasm" - mode ' BOTH' - silent $true
1111
+ $nasm_prog , $nasm_ver = find_prog - name ' nasm' - path " $install_prefix /nasm" - mode ' BOTH' - silent $true
1100
1112
if ($nasm_prog ) {
1101
1113
$1k.println (" Using nasm: $nasm_prog , version: $nasm_ver " )
1102
1114
}
@@ -1111,7 +1123,7 @@ function setup_jdk() {
1111
1123
return $javac_prog
1112
1124
}
1113
1125
1114
- $jdk_root = Join-Path $external_prefix " jdk"
1126
+ $jdk_root = Join-Path $install_prefix " jdk"
1115
1127
$java_home = if (! $IsMacOS ) { $jdk_root } else { Join-Path $jdk_root ' Contents/Home' }
1116
1128
$jdk_bin = Join-Path $java_home ' bin'
1117
1129
@@ -1155,7 +1167,7 @@ function setup_7z() {
1155
1167
$7z_cmd_info = Get-Command ' 7z' - ErrorAction SilentlyContinue
1156
1168
if (! $7z_cmd_info ) {
1157
1169
if ($IsWin ) {
1158
- $7z_prog = Join-Path $external_prefix ' 7z2301-x64/7z.exe'
1170
+ $7z_prog = Join-Path $install_prefix ' 7z2301-x64/7z.exe'
1159
1171
if (! $1k.isfile ($7z_prog )) {
1160
1172
fetch_pkg $ (devtool_url ' 7z2301-x64.zip' )
1161
1173
}
@@ -1181,7 +1193,7 @@ function setup_llvm() {
1181
1193
if (! $manifest.Contains (' llvm' )) { return $null }
1182
1194
$clang_prog , $clang_ver = find_prog - name ' llvm' - cmd " clang"
1183
1195
if (! $clang_prog ) {
1184
- $llvm_root = Join-Path $external_prefix ' LLVM'
1196
+ $llvm_root = Join-Path $install_prefix ' LLVM'
1185
1197
$llvm_bin = Join-Path $llvm_root ' bin'
1186
1198
$clang_prog , $clang_ver = find_prog - name ' llvm' - cmd " clang" - path $llvm_bin - silent $true
1187
1199
if (! $clang_prog ) {
@@ -1210,7 +1222,7 @@ function setup_android_sdk() {
1210
1222
$ndk_ver = $ndk_ver.Substring (0 , $ndk_ver.Length - 1 )
1211
1223
}
1212
1224
1213
- $my_sdk_root = Join-Path $external_prefix ' adt/sdk'
1225
+ $my_sdk_root = Join-Path $install_prefix ' adt/sdk'
1214
1226
1215
1227
$sdk_dirs = @ ()
1216
1228
$1k.insert ([ref ]$sdk_dirs , $env: ANDROID_HOME )
@@ -1278,24 +1290,24 @@ function setup_android_sdk() {
1278
1290
$sdkmanager_prog , $sdkmanager_ver = (find_prog - name ' cmdlinetools' - cmd ' sdkmanager' - path $cmdlinetools_bin - params " --version" , " --sdk_root=$sdk_root " )
1279
1291
}
1280
1292
else {
1281
- $sdk_root = Join-Path $external_prefix ' adt/sdk'
1293
+ $sdk_root = Join-Path $install_prefix ' adt/sdk'
1282
1294
if (! $1k.isdir ($sdk_root )) {
1283
1295
$1k.mkdirs ($sdk_root )
1284
1296
}
1285
1297
}
1286
1298
1287
1299
if (! $sdkmanager_prog ) {
1288
- $cmdlinetools_bin = Join-Path $external_prefix ' cmdline-tools/bin'
1300
+ $cmdlinetools_bin = Join-Path $install_prefix ' cmdline-tools/bin'
1289
1301
$sdkmanager_prog , $sdkmanager_ver = (find_prog - name ' cmdlinetools' - cmd ' sdkmanager' - path $cmdlinetools_bin - params " --version" , " --sdk_root=$sdk_root " )
1290
1302
$suffix = $ (' win' , ' linux' , ' mac' ).Get($HOST_OS )
1291
1303
if (! $sdkmanager_prog ) {
1292
1304
$1k.println (" Installing cmdlinetools version: $sdkmanager_ver ..." )
1293
1305
1294
1306
$cmdlinetools_pkg_name = " commandlinetools-$suffix -$ ( $cmdlinetools_rev ) _latest.zip"
1295
- $cmdlinetools_pkg_path = Join-Path $external_prefix $cmdlinetools_pkg_name
1307
+ $cmdlinetools_pkg_path = Join-Path $install_prefix $cmdlinetools_pkg_name
1296
1308
$cmdlinetools_url = " https://dl.google.com/android/repository/$cmdlinetools_pkg_name "
1297
1309
download_file $cmdlinetools_url $cmdlinetools_pkg_path
1298
- Expand-Archive - Path $cmdlinetools_pkg_path - DestinationPath " $external_prefix /"
1310
+ Expand-Archive - Path $cmdlinetools_pkg_path - DestinationPath " $install_prefix /"
1299
1311
$sdkmanager_prog , $_ = (find_prog - name ' cmdlinetools' - cmd ' sdkmanager' - path $cmdlinetools_bin - params " --version" , " --sdk_root=$sdk_root " - silent $True )
1300
1312
if (! $sdkmanager_prog ) {
1301
1313
throw " Install cmdlinetools version: $sdkmanager_ver fail"
@@ -1380,7 +1392,7 @@ function setup_emsdk() {
1380
1392
$1k.println (' Not found emcc toolchain in $env:PATH, setup emsdk ...' )
1381
1393
$emsdk_cmd = (Get-Command emsdk - ErrorAction SilentlyContinue)
1382
1394
if (! $emsdk_cmd ) {
1383
- $emsdk_root = Join-Path $external_prefix ' emsdk'
1395
+ $emsdk_root = Join-Path $install_prefix ' emsdk'
1384
1396
if (! $1k.isdir ($emsdk_root )) {
1385
1397
git clone ' https://github.com/emscripten-core/emsdk.git' $emsdk_root
1386
1398
}
@@ -1461,7 +1473,7 @@ function setup_gclient() {
1461
1473
# setup gclient tool
1462
1474
# download depot_tools
1463
1475
# git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $gclient_dir
1464
- $gclient_dir = Join-Path $external_prefix ' depot_tools'
1476
+ $gclient_dir = Join-Path $install_prefix ' depot_tools'
1465
1477
if (! $1k.isdir ($gclient_dir )) {
1466
1478
if ($IsWin ) {
1467
1479
$1k.mkdirs ($gclient_dir )
0 commit comments