upstream: https://github.com/mirage/mirage-crypto

remove dkml CI

+1 -6919
-2782
.ci/dkml-compilers/pc/setup-dkml-windows_x86.ps1
··· 1 - # setup-dkml 2 - # Short form: sd4 3 - 4 - <# 5 - .SYNOPSIS 6 - 7 - Setup Diskuv OCaml (DKML) compiler on a desktop PC. 8 - 9 - .DESCRIPTION 10 - 11 - Setup Diskuv OCaml (DKML) compiler on a desktop PC. 12 - 13 - .PARAMETER PC_PROJECT_DIR 14 - Context variable for the project directory. Defaults to the current directory. 15 - 16 - .PARAMETER FDOPEN_OPAMEXE_BOOTSTRAP 17 - Input variable. 18 - 19 - .PARAMETER CACHE_PREFIX 20 - Input variable. 21 - 22 - .PARAMETER OCAML_COMPILER 23 - Input variable. -DKML_COMPILER takes priority. If -DKML_COMPILER is not set and -OCAML_COMPILER is set, then the specified OCaml version tag of dkml-compiler (ex. 4.12.1) is used. 24 - 25 - .PARAMETER DKML_COMPILER 26 - Input variable. Unspecified or blank is the latest from the default branch (main) of dkml-compiler. @repository@ is the latest from Opam. 27 - 28 - .PARAMETER SKIP_OPAM_MODIFICATIONS 29 - Input variable. If true (the default is false) then the opam root and switches will not be created or modified. 30 - 31 - .PARAMETER SECONDARY_SWITCH 32 - Input variable. If true then the secondary switch named 'two' is created. 33 - 34 - .PARAMETER PRIMARY_SWITCH_SKIP_INSTALL 35 - Input variable. If true no dkml-base-compiler will be installed in the 'dkml' switch. 36 - 37 - .PARAMETER CONF_DKML_CROSS_TOOLCHAIN 38 - Input variable. Unspecified or blank is the latest from the default branch (main) of conf-dkml-cross-toolchain. @repository@ is the latest from Opam. 39 - 40 - .PARAMETER DISKUV_OPAM_REPOSITORY 41 - Input variable. Defaults to the value of -DEFAULT_DISKUV_OPAM_REPOSITORY_TAG (see below) 42 - 43 - .PARAMETER DKML_HOME 44 - Input variables. If specified then DiskuvOCamlHome, DiskuvOCamlBinaryPaths and DiskuvOCamlDeploymentId will be set, in addition to the always-present DiskuvOCamlVarsVersion, DiskuvOCamlVersion 45 - and DiskuvOCamlMSYS2Dir. 46 - 47 - # autogen from global_env_vars. 48 - .PARAMETER DKML_VERSION 49 - Environment variable. 50 - 51 - .PARAMETER DEFAULT_DISKUV_OPAM_REPOSITORY_TAG 52 - Environment variable. 53 - 54 - .PARAMETER DEFAULT_DKML_COMPILER 55 - Environment variable. 56 - 57 - .PARAMETER PIN_ASTRING 58 - Environment variable. 59 - 60 - .PARAMETER PIN_BASE 61 - Environment variable. 62 - 63 - .PARAMETER PIN_BASE64 64 - Environment variable. 65 - 66 - .PARAMETER PIN_BIGARRAY_COMPAT 67 - Environment variable. 68 - 69 - .PARAMETER PIN_BOS 70 - Environment variable. 71 - 72 - .PARAMETER PIN_CAMLP_STREAMS 73 - Environment variable. 74 - 75 - .PARAMETER PIN_CHROME_TRACE 76 - Environment variable. 77 - 78 - .PARAMETER PIN_CMDLINER 79 - Environment variable. 80 - 81 - .PARAMETER PIN_CONF_DKML_SYS_OPAM 82 - Environment variable. 83 - 84 - .PARAMETER PIN_CONF_PKG_CONFIG 85 - Environment variable. 86 - 87 - .PARAMETER PIN_CONF_SQLITE3 88 - Environment variable. 89 - 90 - .PARAMETER PIN_CPPO 91 - Environment variable. 92 - 93 - .PARAMETER PIN_CRUNCH 94 - Environment variable. 95 - 96 - .PARAMETER PIN_CSEXP 97 - Environment variable. 98 - 99 - .PARAMETER PIN_CSTRUCT 100 - Environment variable. 101 - 102 - .PARAMETER PIN_CTYPES_FOREIGN 103 - Environment variable. 104 - 105 - .PARAMETER PIN_CTYPES 106 - Environment variable. 107 - 108 - .PARAMETER PIN_CUDF 109 - Environment variable. 110 - 111 - .PARAMETER PIN_DIGESTIF 112 - Environment variable. 113 - 114 - .PARAMETER PIN_DISKUVBOX 115 - Environment variable. 116 - 117 - .PARAMETER PIN_DKML_APPS 118 - Environment variable. 119 - 120 - .PARAMETER PIN_DKML_BASE_COMPILER 121 - Environment variable. 122 - 123 - .PARAMETER PIN_DKML_BUILD_DESKTOP 124 - Environment variable. 125 - 126 - .PARAMETER PIN_DKML_C_PROBE 127 - Environment variable. 128 - 129 - .PARAMETER PIN_DKML_COMPILER_ENV 130 - Environment variable. 131 - 132 - .PARAMETER PIN_DKML_COMPILER_SRC 133 - Environment variable. 134 - 135 - .PARAMETER PIN_DKML_COMPONENT_COMMON_DESKTOP 136 - Environment variable. 137 - 138 - .PARAMETER PIN_DKML_COMPONENT_COMMON_OPAM 139 - Environment variable. 140 - 141 - .PARAMETER PIN_DKML_COMPONENT_COMMON_UNIXUTILS 142 - Environment variable. 143 - 144 - .PARAMETER PIN_DKML_COMPONENT_OCAMLCOMPILER_COMMON 145 - Environment variable. 146 - 147 - .PARAMETER PIN_DKML_COMPONENT_OCAMLCOMPILER_NETWORK 148 - Environment variable. 149 - 150 - .PARAMETER PIN_DKML_COMPONENT_OCAMLCOMPILER_OFFLINE 151 - Environment variable. 152 - 153 - .PARAMETER PIN_DKML_COMPONENT_OFFLINE_DESKTOP_FULL 154 - Environment variable. 155 - 156 - .PARAMETER PIN_DKML_COMPONENT_OFFLINE_OPAMSHIM 157 - Environment variable. 158 - 159 - .PARAMETER PIN_DKML_COMPONENT_OFFLINE_UNIXUTILS 160 - Environment variable. 161 - 162 - .PARAMETER PIN_DKML_COMPONENT_STAGING_DESKTOP_FULL 163 - Environment variable. 164 - 165 - .PARAMETER PIN_DKML_COMPONENT_STAGING_DKMLCONFDIR 166 - Environment variable. 167 - 168 - .PARAMETER PIN_DKML_COMPONENT_STAGING_OCAMLRUN 169 - Environment variable. 170 - 171 - .PARAMETER PIN_DKML_COMPONENT_STAGING_OPAM32 172 - Environment variable. 173 - 174 - .PARAMETER PIN_DKML_COMPONENT_STAGING_OPAM64 175 - Environment variable. 176 - 177 - .PARAMETER PIN_DKML_COMPONENT_STAGING_UNIXUTILS 178 - Environment variable. 179 - 180 - .PARAMETER PIN_DKML_COMPONENT_STAGING_WITHDKML 181 - Environment variable. 182 - 183 - .PARAMETER PIN_DKML_COMPONENT_XX_CONSOLE 184 - Environment variable. 185 - 186 - .PARAMETER PIN_DKML_EXE_LIB 187 - Environment variable. 188 - 189 - .PARAMETER PIN_DKML_EXE 190 - Environment variable. 191 - 192 - .PARAMETER PIN_DKML_INSTALL_INSTALLER 193 - Environment variable. 194 - 195 - .PARAMETER PIN_DKML_INSTALL_RUNNER 196 - Environment variable. 197 - 198 - .PARAMETER PIN_DKML_INSTALL 199 - Environment variable. 200 - 201 - .PARAMETER PIN_DKML_INSTALLER_OCAML_COMMON 202 - Environment variable. 203 - 204 - .PARAMETER PIN_DKML_INSTALLER_OCAML_OFFLINE 205 - Environment variable. 206 - 207 - .PARAMETER PIN_DKML_PACKAGE_CONSOLE 208 - Environment variable. 209 - 210 - .PARAMETER PIN_DKML_RUNTIME_COMMON_NATIVE 211 - Environment variable. 212 - 213 - .PARAMETER PIN_DKML_RUNTIME_COMMON 214 - Environment variable. 215 - 216 - .PARAMETER PIN_DKML_RUNTIME_DISTRIBUTION 217 - Environment variable. 218 - 219 - .PARAMETER PIN_DKML_RUNTIMELIB 220 - Environment variable. 221 - 222 - .PARAMETER PIN_DKML_RUNTIMESCRIPTS 223 - Environment variable. 224 - 225 - .PARAMETER PIN_DKML_WORKFLOWS 226 - Environment variable. 227 - 228 - .PARAMETER PIN_DUNE_ACTION_PLUGIN 229 - Environment variable. 230 - 231 - .PARAMETER PIN_DUNE_BUILD_INFO 232 - Environment variable. 233 - 234 - .PARAMETER PIN_DUNE_CONFIGURATOR 235 - Environment variable. 236 - 237 - .PARAMETER PIN_DUNE_GLOB 238 - Environment variable. 239 - 240 - .PARAMETER PIN_DUNE_PRIVATE_LIBS 241 - Environment variable. 242 - 243 - .PARAMETER PIN_DUNE_RPC_LWT 244 - Environment variable. 245 - 246 - .PARAMETER PIN_DUNE_RPC 247 - Environment variable. 248 - 249 - .PARAMETER PIN_DUNE_SITE 250 - Environment variable. 251 - 252 - .PARAMETER PIN_DUNE 253 - Environment variable. 254 - 255 - .PARAMETER PIN_DYN 256 - Environment variable. 257 - 258 - .PARAMETER PIN_EITHER 259 - Environment variable. 260 - 261 - .PARAMETER PIN_EQAF 262 - Environment variable. 263 - 264 - .PARAMETER PIN_EXTLIB 265 - Environment variable. 266 - 267 - .PARAMETER PIN_EZJSONM 268 - Environment variable. 269 - 270 - .PARAMETER PIN_FEATHER 271 - Environment variable. 272 - 273 - .PARAMETER PIN_FIBER 274 - Environment variable. 275 - 276 - .PARAMETER PIN_FIX 277 - Environment variable. 278 - 279 - .PARAMETER PIN_FMT 280 - Environment variable. 281 - 282 - .PARAMETER PIN_FPATH 283 - Environment variable. 284 - 285 - .PARAMETER PIN_GRAPHICS 286 - Environment variable. 287 - 288 - .PARAMETER PIN_HEX 289 - Environment variable. 290 - 291 - .PARAMETER PIN_INTEGERS 292 - Environment variable. 293 - 294 - .PARAMETER PIN_JANE_STREET_HEADERS 295 - Environment variable. 296 - 297 - .PARAMETER PIN_JINGOO 298 - Environment variable. 299 - 300 - .PARAMETER PIN_JSONM 301 - Environment variable. 302 - 303 - .PARAMETER PIN_JSONRPC 304 - Environment variable. 305 - 306 - .PARAMETER PIN_JST_CONFIG 307 - Environment variable. 308 - 309 - .PARAMETER PIN_LAMBDA_TERM 310 - Environment variable. 311 - 312 - .PARAMETER PIN_LOGS 313 - Environment variable. 314 - 315 - .PARAMETER PIN_LSP 316 - Environment variable. 317 - 318 - .PARAMETER PIN_LWT 319 - Environment variable. 320 - 321 - .PARAMETER PIN_LWT_REACT 322 - Environment variable. 323 - 324 - .PARAMETER PIN_MCCS 325 - Environment variable. 326 - 327 - .PARAMETER PIN_MDX 328 - Environment variable. 329 - 330 - .PARAMETER PIN_MENHIR 331 - Environment variable. 332 - 333 - .PARAMETER PIN_MENHIRLIB 334 - Environment variable. 335 - 336 - .PARAMETER PIN_MENHIRSDK 337 - Environment variable. 338 - 339 - .PARAMETER PIN_MERLIN_LIB 340 - Environment variable. 341 - 342 - .PARAMETER PIN_METAPP 343 - Environment variable. 344 - 345 - .PARAMETER PIN_METAQUOT 346 - Environment variable. 347 - 348 - .PARAMETER PIN_MEW 349 - Environment variable. 350 - 351 - .PARAMETER PIN_MEW_VI 352 - Environment variable. 353 - 354 - .PARAMETER PIN_NUM 355 - Environment variable. 356 - 357 - .PARAMETER PIN_OCAML_COMPILER_LIBS 358 - Environment variable. 359 - 360 - .PARAMETER PIN_OCAML_LSP_SERVER 361 - Environment variable. 362 - 363 - .PARAMETER PIN_OCAML_VERSION 364 - Environment variable. 365 - 366 - .PARAMETER PIN_OCAML 367 - Environment variable. 368 - 369 - .PARAMETER PIN_OCAMLBUILD 370 - Environment variable. 371 - 372 - .PARAMETER PIN_OCAMLC_LOC 373 - Environment variable. 374 - 375 - .PARAMETER PIN_OCAMLFIND 376 - Environment variable. 377 - 378 - .PARAMETER PIN_OCAMLFORMAT_LIB 379 - Environment variable. 380 - 381 - .PARAMETER PIN_OCAMLFORMAT_RPC_LIB 382 - Environment variable. 383 - 384 - .PARAMETER PIN_OCAMLFORMAT 385 - Environment variable. 386 - 387 - .PARAMETER PIN_OCP_INDENT 388 - Environment variable. 389 - 390 - .PARAMETER PIN_OCPLIB_ENDIAN 391 - Environment variable. 392 - 393 - .PARAMETER PIN_ODOC_PARSER 394 - Environment variable. 395 - 396 - .PARAMETER PIN_ODOC 397 - Environment variable. 398 - 399 - .PARAMETER PIN_ORDERING 400 - Environment variable. 401 - 402 - .PARAMETER PIN_PARSEXP 403 - Environment variable. 404 - 405 - .PARAMETER PIN_PP 406 - Environment variable. 407 - 408 - .PARAMETER PIN_PPX_ASSERT 409 - Environment variable. 410 - 411 - .PARAMETER PIN_PPX_BASE 412 - Environment variable. 413 - 414 - .PARAMETER PIN_PPX_COLD 415 - Environment variable. 416 - 417 - .PARAMETER PIN_PPX_COMPARE 418 - Environment variable. 419 - 420 - .PARAMETER PIN_PPX_DERIVERS 421 - Environment variable. 422 - 423 - .PARAMETER PIN_PPX_DERIVING 424 - Environment variable. 425 - 426 - .PARAMETER PIN_PPX_ENUMERATE 427 - Environment variable. 428 - 429 - .PARAMETER PIN_PPX_EXPECT 430 - Environment variable. 431 - 432 - .PARAMETER PIN_PPX_GLOBALIZE 433 - Environment variable. 434 - 435 - .PARAMETER PIN_PPX_HASH 436 - Environment variable. 437 - 438 - .PARAMETER PIN_PPX_HERE 439 - Environment variable. 440 - 441 - .PARAMETER PIN_PPX_IGNORE_INSTRUMENTATION 442 - Environment variable. 443 - 444 - .PARAMETER PIN_PPX_INLINE_TEST 445 - Environment variable. 446 - 447 - .PARAMETER PIN_PPX_OPTCOMP 448 - Environment variable. 449 - 450 - .PARAMETER PIN_PPX_PIPEBANG 451 - Environment variable. 452 - 453 - .PARAMETER PIN_PPX_SEXP_CONV 454 - Environment variable. 455 - 456 - .PARAMETER PIN_PPX_YOJSON_CONV_LIB 457 - Environment variable. 458 - 459 - .PARAMETER PIN_PPXLIB 460 - Environment variable. 461 - 462 - .PARAMETER PIN_PTIME 463 - Environment variable. 464 - 465 - .PARAMETER PIN_QRC 466 - Environment variable. 467 - 468 - .PARAMETER PIN_RE 469 - Environment variable. 470 - 471 - .PARAMETER PIN_REACT 472 - Environment variable. 473 - 474 - .PARAMETER PIN_REFL 475 - Environment variable. 476 - 477 - .PARAMETER PIN_RESULT 478 - Environment variable. 479 - 480 - .PARAMETER PIN_RRESULT 481 - Environment variable. 482 - 483 - .PARAMETER PIN_SEQ 484 - Environment variable. 485 - 486 - .PARAMETER PIN_SEXPLIB 487 - Environment variable. 488 - 489 - .PARAMETER PIN_SEXPLIB0 490 - Environment variable. 491 - 492 - .PARAMETER PIN_SHA 493 - Environment variable. 494 - 495 - .PARAMETER PIN_SPAWN 496 - Environment variable. 497 - 498 - .PARAMETER PIN_SQLITE3 499 - Environment variable. 500 - 501 - .PARAMETER PIN_STDCOMPAT 502 - Environment variable. 503 - 504 - .PARAMETER PIN_STDIO 505 - Environment variable. 506 - 507 - .PARAMETER PIN_STDLIB_SHIMS 508 - Environment variable. 509 - 510 - .PARAMETER PIN_STDUNE 511 - Environment variable. 512 - 513 - .PARAMETER PIN_TIME_NOW 514 - Environment variable. 515 - 516 - .PARAMETER PIN_TOPKG 517 - Environment variable. 518 - 519 - .PARAMETER PIN_TRAVERSE 520 - Environment variable. 521 - 522 - .PARAMETER PIN_TRIE 523 - Environment variable. 524 - 525 - .PARAMETER PIN_TSORT 526 - Environment variable. 527 - 528 - .PARAMETER PIN_TYXML 529 - Environment variable. 530 - 531 - .PARAMETER PIN_UCHAR 532 - Environment variable. 533 - 534 - .PARAMETER PIN_UTOP 535 - Environment variable. 536 - 537 - .PARAMETER PIN_UUCP 538 - Environment variable. 539 - 540 - .PARAMETER PIN_UUIDM 541 - Environment variable. 542 - 543 - .PARAMETER PIN_UUSEG 544 - Environment variable. 545 - 546 - .PARAMETER PIN_UUTF 547 - Environment variable. 548 - 549 - .PARAMETER PIN_WITH_DKML 550 - Environment variable. 551 - 552 - .PARAMETER PIN_XDG 553 - Environment variable. 554 - 555 - .PARAMETER PIN_YOJSON 556 - Environment variable. 557 - 558 - .PARAMETER PIN_ZED 559 - Environment variable. 560 - 561 - #> 562 - [CmdletBinding()] 563 - param ( 564 - # Context variables 565 - [Parameter(HelpMessage='Defaults to the current directory')] 566 - [string] 567 - $PC_PROJECT_DIR = $PWD, 568 - 569 - # Input variables 570 - [string] 571 - $FDOPEN_OPAMEXE_BOOTSTRAP = "false", 572 - [string] 573 - $CACHE_PREFIX = "v1", 574 - [string] 575 - $OCAML_COMPILER = "", 576 - [string] 577 - $DKML_COMPILER = "", 578 - [string] 579 - $SKIP_OPAM_MODIFICATIONS = "false", 580 - [string] 581 - $SECONDARY_SWITCH = "false", 582 - [string] 583 - $PRIMARY_SWITCH_SKIP_INSTALL = "false", 584 - [string] 585 - $CONF_DKML_CROSS_TOOLCHAIN = "@repository@", 586 - [string] 587 - $DISKUV_OPAM_REPOSITORY = "", 588 - [string] 589 - $DKML_HOME = "" 590 - 591 - # Conflicts with automatic variable $Verbose 592 - # [Parameter()] 593 - # [string] 594 - # $VERBOSE = "false" 595 - 596 - # Environment variables (can be overridden on command line) 597 - # autogen from global_env_vars. 598 - ,[Parameter()] [string] $DKML_VERSION = "2.0.3" 599 - ,[Parameter()] [string] $DEFAULT_DISKUV_OPAM_REPOSITORY_TAG = "2.0.3" 600 - ,[Parameter()] [string] $DEFAULT_DKML_COMPILER = "2.0.3" 601 - ,[Parameter()] [string] $PIN_ASTRING = "0.8.5" 602 - ,[Parameter()] [string] $PIN_BASE = "v0.16.1" 603 - ,[Parameter()] [string] $PIN_BASE64 = "3.5.1" 604 - ,[Parameter()] [string] $PIN_BIGARRAY_COMPAT = "1.1.0" 605 - ,[Parameter()] [string] $PIN_BOS = "0.2.1" 606 - ,[Parameter()] [string] $PIN_CAMLP_STREAMS = "5.0.1" 607 - ,[Parameter()] [string] $PIN_CHROME_TRACE = "3.10.0" 608 - ,[Parameter()] [string] $PIN_CMDLINER = "1.2.0" 609 - ,[Parameter()] [string] $PIN_CONF_DKML_SYS_OPAM = "1" 610 - ,[Parameter()] [string] $PIN_CONF_PKG_CONFIG = "2+cpkgs" 611 - ,[Parameter()] [string] $PIN_CONF_SQLITE3 = "3.1+cpkgs" 612 - ,[Parameter()] [string] $PIN_CPPO = "1.6.9" 613 - ,[Parameter()] [string] $PIN_CRUNCH = "3.3.1" 614 - ,[Parameter()] [string] $PIN_CSEXP = "1.5.2" 615 - ,[Parameter()] [string] $PIN_CSTRUCT = "6.2.0" 616 - ,[Parameter()] [string] $PIN_CTYPES_FOREIGN = "0.19.2-windowssupport-r7" 617 - ,[Parameter()] [string] $PIN_CTYPES = "0.19.2-windowssupport-r7" 618 - ,[Parameter()] [string] $PIN_CUDF = "0.10" 619 - ,[Parameter()] [string] $PIN_DIGESTIF = "1.1.4" 620 - ,[Parameter()] [string] $PIN_DISKUVBOX = "0.2.0" 621 - ,[Parameter()] [string] $PIN_DKML_APPS = "2.0.3" 622 - ,[Parameter()] [string] $PIN_DKML_BASE_COMPILER = "4.14.0~v2.0.3" 623 - ,[Parameter()] [string] $PIN_DKML_BUILD_DESKTOP = "2.0.3" 624 - ,[Parameter()] [string] $PIN_DKML_C_PROBE = "3.0.0" 625 - ,[Parameter()] [string] $PIN_DKML_COMPILER_ENV = "2.0.3" 626 - ,[Parameter()] [string] $PIN_DKML_COMPILER_SRC = "2.0.3" 627 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_COMMON_DESKTOP = "2.0.3" 628 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_COMMON_OPAM = "2.2.0~alpha0~20221228" 629 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_COMMON_UNIXUTILS = "0.2.0" 630 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_OCAMLCOMPILER_COMMON = "4.14.0~v2.0.3" 631 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_OCAMLCOMPILER_NETWORK = "4.14.0~v2.0.3" 632 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_OCAMLCOMPILER_OFFLINE = "4.14.0~v2.0.3" 633 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_OFFLINE_DESKTOP_FULL = "2.0.3" 634 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_OFFLINE_OPAMSHIM = "2.2.0~alpha0~20221228" 635 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_OFFLINE_UNIXUTILS = "0.2.0" 636 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_DESKTOP_FULL = "2.0.3" 637 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_DKMLCONFDIR = "2.0.3" 638 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_OCAMLRUN = "4.14.0~v2.0.3" 639 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_OPAM32 = "2.2.0~alpha0~20221228" 640 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_OPAM64 = "2.2.0~alpha0~20221228" 641 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_UNIXUTILS = "0.2.0" 642 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_WITHDKML = "2.0.3" 643 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_XX_CONSOLE = "0.1.1" 644 - ,[Parameter()] [string] $PIN_DKML_EXE_LIB = "2.0.3" 645 - ,[Parameter()] [string] $PIN_DKML_EXE = "2.0.3" 646 - ,[Parameter()] [string] $PIN_DKML_INSTALL_INSTALLER = "0.5.1" 647 - ,[Parameter()] [string] $PIN_DKML_INSTALL_RUNNER = "0.5.1" 648 - ,[Parameter()] [string] $PIN_DKML_INSTALL = "0.5.1" 649 - ,[Parameter()] [string] $PIN_DKML_INSTALLER_OCAML_COMMON = "2.0.3" 650 - ,[Parameter()] [string] $PIN_DKML_INSTALLER_OCAML_OFFLINE = "2.0.3" 651 - ,[Parameter()] [string] $PIN_DKML_PACKAGE_CONSOLE = "0.5.1" 652 - ,[Parameter()] [string] $PIN_DKML_RUNTIME_COMMON_NATIVE = "2.0.3" 653 - ,[Parameter()] [string] $PIN_DKML_RUNTIME_COMMON = "2.0.3" 654 - ,[Parameter()] [string] $PIN_DKML_RUNTIME_DISTRIBUTION = "2.0.3" 655 - ,[Parameter()] [string] $PIN_DKML_RUNTIMELIB = "2.0.3" 656 - ,[Parameter()] [string] $PIN_DKML_RUNTIMESCRIPTS = "2.0.3" 657 - ,[Parameter()] [string] $PIN_DKML_WORKFLOWS = "2.0.3" 658 - ,[Parameter()] [string] $PIN_DUNE_ACTION_PLUGIN = "3.8.3" 659 - ,[Parameter()] [string] $PIN_DUNE_BUILD_INFO = "3.8.3" 660 - ,[Parameter()] [string] $PIN_DUNE_CONFIGURATOR = "3.8.3" 661 - ,[Parameter()] [string] $PIN_DUNE_GLOB = "3.8.3" 662 - ,[Parameter()] [string] $PIN_DUNE_PRIVATE_LIBS = "3.8.3" 663 - ,[Parameter()] [string] $PIN_DUNE_RPC_LWT = "3.8.3" 664 - ,[Parameter()] [string] $PIN_DUNE_RPC = "3.8.3" 665 - ,[Parameter()] [string] $PIN_DUNE_SITE = "3.8.3" 666 - ,[Parameter()] [string] $PIN_DUNE = "3.8.3" 667 - ,[Parameter()] [string] $PIN_DYN = "3.8.3" 668 - ,[Parameter()] [string] $PIN_EITHER = "1.0.0" 669 - ,[Parameter()] [string] $PIN_EQAF = "0.9" 670 - ,[Parameter()] [string] $PIN_EXTLIB = "1.7.9" 671 - ,[Parameter()] [string] $PIN_EZJSONM = "1.3.0" 672 - ,[Parameter()] [string] $PIN_FEATHER = "0.3.0" 673 - ,[Parameter()] [string] $PIN_FIBER = "3.7.0" 674 - ,[Parameter()] [string] $PIN_FIX = "20230505" 675 - ,[Parameter()] [string] $PIN_FMT = "0.9.0" 676 - ,[Parameter()] [string] $PIN_FPATH = "0.7.3" 677 - ,[Parameter()] [string] $PIN_GRAPHICS = "5.1.2" 678 - ,[Parameter()] [string] $PIN_HEX = "1.5.0" 679 - ,[Parameter()] [string] $PIN_INTEGERS = "0.7.0" 680 - ,[Parameter()] [string] $PIN_JANE_STREET_HEADERS = "v0.16.0" 681 - ,[Parameter()] [string] $PIN_JINGOO = "1.4.4" 682 - ,[Parameter()] [string] $PIN_JSONM = "1.0.2" 683 - ,[Parameter()] [string] $PIN_JSONRPC = "1.16.2" 684 - ,[Parameter()] [string] $PIN_JST_CONFIG = "v0.16.0" 685 - ,[Parameter()] [string] $PIN_LAMBDA_TERM = "3.3.1" 686 - ,[Parameter()] [string] $PIN_LOGS = "0.7.0" 687 - ,[Parameter()] [string] $PIN_LSP = "1.16.2" 688 - ,[Parameter()] [string] $PIN_LWT = "5.6.1" 689 - ,[Parameter()] [string] $PIN_LWT_REACT = "1.2.0" 690 - ,[Parameter()] [string] $PIN_MCCS = "1.1+13" 691 - ,[Parameter()] [string] $PIN_MDX = "2.3.0" 692 - ,[Parameter()] [string] $PIN_MENHIR = "20230608" 693 - ,[Parameter()] [string] $PIN_MENHIRLIB = "20230608" 694 - ,[Parameter()] [string] $PIN_MENHIRSDK = "20230608" 695 - ,[Parameter()] [string] $PIN_MERLIN_LIB = "4.9-414" 696 - ,[Parameter()] [string] $PIN_METAPP = "0.4.4+win" 697 - ,[Parameter()] [string] $PIN_METAQUOT = "0.5.2" 698 - ,[Parameter()] [string] $PIN_MEW = "0.1.0" 699 - ,[Parameter()] [string] $PIN_MEW_VI = "0.5.0" 700 - ,[Parameter()] [string] $PIN_NUM = "1.4" 701 - ,[Parameter()] [string] $PIN_OCAML_COMPILER_LIBS = "v0.12.4" 702 - ,[Parameter()] [string] $PIN_OCAML_LSP_SERVER = "1.16.2" 703 - ,[Parameter()] [string] $PIN_OCAML_VERSION = "3.6.1" 704 - ,[Parameter()] [string] $PIN_OCAML = "4.14.0" 705 - ,[Parameter()] [string] $PIN_OCAMLBUILD = "0.14.2+win+unix" 706 - ,[Parameter()] [string] $PIN_OCAMLC_LOC = "3.8.3" 707 - ,[Parameter()] [string] $PIN_OCAMLFIND = "1.9.5" 708 - ,[Parameter()] [string] $PIN_OCAMLFORMAT_LIB = "0.25.1" 709 - ,[Parameter()] [string] $PIN_OCAMLFORMAT_RPC_LIB = "0.25.1" 710 - ,[Parameter()] [string] $PIN_OCAMLFORMAT = "0.25.1" 711 - ,[Parameter()] [string] $PIN_OCP_INDENT = "1.8.2-windowssupport" 712 - ,[Parameter()] [string] $PIN_OCPLIB_ENDIAN = "1.2" 713 - ,[Parameter()] [string] $PIN_ODOC_PARSER = "2.0.0" 714 - ,[Parameter()] [string] $PIN_ODOC = "2.2.0" 715 - ,[Parameter()] [string] $PIN_ORDERING = "3.8.3" 716 - ,[Parameter()] [string] $PIN_PARSEXP = "v0.16.0" 717 - ,[Parameter()] [string] $PIN_PP = "1.1.2" 718 - ,[Parameter()] [string] $PIN_PPX_ASSERT = "v0.16.0" 719 - ,[Parameter()] [string] $PIN_PPX_BASE = "v0.16.0" 720 - ,[Parameter()] [string] $PIN_PPX_COLD = "v0.16.0" 721 - ,[Parameter()] [string] $PIN_PPX_COMPARE = "v0.16.0" 722 - ,[Parameter()] [string] $PIN_PPX_DERIVERS = "1.2.1" 723 - ,[Parameter()] [string] $PIN_PPX_DERIVING = "5.2.1" 724 - ,[Parameter()] [string] $PIN_PPX_ENUMERATE = "v0.16.0" 725 - ,[Parameter()] [string] $PIN_PPX_EXPECT = "v0.16.0" 726 - ,[Parameter()] [string] $PIN_PPX_GLOBALIZE = "v0.16.0" 727 - ,[Parameter()] [string] $PIN_PPX_HASH = "v0.16.0" 728 - ,[Parameter()] [string] $PIN_PPX_HERE = "v0.16.0" 729 - ,[Parameter()] [string] $PIN_PPX_IGNORE_INSTRUMENTATION = "v0.16.0" 730 - ,[Parameter()] [string] $PIN_PPX_INLINE_TEST = "v0.16.0" 731 - ,[Parameter()] [string] $PIN_PPX_OPTCOMP = "v0.16.0" 732 - ,[Parameter()] [string] $PIN_PPX_PIPEBANG = "v0.16.0" 733 - ,[Parameter()] [string] $PIN_PPX_SEXP_CONV = "v0.16.0" 734 - ,[Parameter()] [string] $PIN_PPX_YOJSON_CONV_LIB = "v0.16.0" 735 - ,[Parameter()] [string] $PIN_PPXLIB = "0.30.0" 736 - ,[Parameter()] [string] $PIN_PTIME = "1.1.0" 737 - ,[Parameter()] [string] $PIN_QRC = "0.1.1~dune" 738 - ,[Parameter()] [string] $PIN_RE = "1.11.0" 739 - ,[Parameter()] [string] $PIN_REACT = "1.2.2" 740 - ,[Parameter()] [string] $PIN_REFL = "0.4.1" 741 - ,[Parameter()] [string] $PIN_RESULT = "1.5" 742 - ,[Parameter()] [string] $PIN_RRESULT = "0.7.0" 743 - ,[Parameter()] [string] $PIN_SEQ = "base" 744 - ,[Parameter()] [string] $PIN_SEXPLIB = "v0.16.0" 745 - ,[Parameter()] [string] $PIN_SEXPLIB0 = "v0.16.0" 746 - ,[Parameter()] [string] $PIN_SHA = "1.15.4" 747 - ,[Parameter()] [string] $PIN_SPAWN = "v0.15.1" 748 - ,[Parameter()] [string] $PIN_SQLITE3 = "5.1.0+msvc" 749 - ,[Parameter()] [string] $PIN_STDCOMPAT = "19+optautoconf" 750 - ,[Parameter()] [string] $PIN_STDIO = "v0.16.0" 751 - ,[Parameter()] [string] $PIN_STDLIB_SHIMS = "0.3.0" 752 - ,[Parameter()] [string] $PIN_STDUNE = "3.8.3" 753 - ,[Parameter()] [string] $PIN_TIME_NOW = "v0.16.0" 754 - ,[Parameter()] [string] $PIN_TOPKG = "1.0.7" 755 - ,[Parameter()] [string] $PIN_TRAVERSE = "0.3.0" 756 - ,[Parameter()] [string] $PIN_TRIE = "1.0.0" 757 - ,[Parameter()] [string] $PIN_TSORT = "2.1.0" 758 - ,[Parameter()] [string] $PIN_TYXML = "4.5.0" 759 - ,[Parameter()] [string] $PIN_UCHAR = "0.0.2" 760 - ,[Parameter()] [string] $PIN_UTOP = "2.13.1" 761 - ,[Parameter()] [string] $PIN_UUCP = "15.0.0" 762 - ,[Parameter()] [string] $PIN_UUIDM = "0.9.8" 763 - ,[Parameter()] [string] $PIN_UUSEG = "15.0.0" 764 - ,[Parameter()] [string] $PIN_UUTF = "1.0.3" 765 - ,[Parameter()] [string] $PIN_WITH_DKML = "2.0.3" 766 - ,[Parameter()] [string] $PIN_XDG = "3.9.0" 767 - ,[Parameter()] [string] $PIN_YOJSON = "2.1.0" 768 - ,[Parameter()] [string] $PIN_ZED = "3.2.2" 769 - ) 770 - 771 - $ErrorActionPreference = "Stop" 772 - 773 - # Reset environment so no conflicts with a parent Opam or OCaml system 774 - if (Test-Path Env:OPAMROOT) { Remove-Item Env:OPAMROOT } 775 - if (Test-Path Env:OPAMSWITCH) { Remove-Item Env:OPAMSWITCH } 776 - if (Test-Path Env:OPAM_SWITCH_PREFIX) { Remove-Item Env:OPAM_SWITCH_PREFIX } 777 - if (Test-Path Env:CAML_LD_LIBRARY_PATH) { Remove-Item Env:CAML_LD_LIBRARY_PATH } 778 - if (Test-Path Env:OCAMLLIB) { Remove-Item Env:OCAMLLIB } 779 - if (Test-Path Env:OCAML_TOPLEVEL_PATH) { Remove-Item Env:OCAML_TOPLEVEL_PATH } 780 - 781 - # Pushdown context variables 782 - $env:PC_CI = 'true' 783 - $env:PC_PROJECT_DIR = $PC_PROJECT_DIR 784 - 785 - # Pushdown input variables 786 - $env:FDOPEN_OPAMEXE_BOOTSTRAP = $FDOPEN_OPAMEXE_BOOTSTRAP 787 - $env:CACHE_PREFIX = $CACHE_PREFIX 788 - $env:OCAML_COMPILER = $OCAML_COMPILER 789 - $env:DKML_COMPILER = $DKML_COMPILER 790 - $env:SKIP_OPAM_MODIFICATIONS = $SKIP_OPAM_MODIFICATIONS 791 - $env:SECONDARY_SWITCH = $SECONDARY_SWITCH 792 - $env:PRIMARY_SWITCH_SKIP_INSTALL = $PRIMARY_SWITCH_SKIP_INSTALL 793 - $env:CONF_DKML_CROSS_TOOLCHAIN = $CONF_DKML_CROSS_TOOLCHAIN 794 - $env:DISKUV_OPAM_REPOSITORY = $DISKUV_OPAM_REPOSITORY 795 - $env:DKML_HOME = $DKML_HOME 796 - 797 - # Set matrix variables 798 - # autogen from pc_vars. only windows_x86 799 - $env:dkml_host_os = "windows" 800 - $env:opam_root_cacheable = "${env:PC_PROJECT_DIR}/.ci/o" 801 - $env:abi_pattern = "win32-windows_x86" 802 - $env:msys2_system = "MINGW32" 803 - $env:msys2_packages = "mingw-w64-i686-pkg-config" 804 - $env:exe_ext = ".exe" 805 - $env:bootstrap_opam_version = "2.2.0-alpha-20221228" 806 - $env:opam_abi = "windows_x86" 807 - $env:dkml_host_abi = "windows_x86" 808 - $env:opam_root = "${env:PC_PROJECT_DIR}/.ci/o" 809 - $env:vsstudio_hostarch = "x64" 810 - $env:vsstudio_arch = "x86" 811 - $env:ocaml_options = "ocaml-option-32bit" 812 - 813 - 814 - # Set environment variables 815 - # autogen from global_env_vars. 816 - $env:DKML_VERSION = $DKML_VERSION 817 - $env:DEFAULT_DISKUV_OPAM_REPOSITORY_TAG = $DEFAULT_DISKUV_OPAM_REPOSITORY_TAG 818 - $env:DEFAULT_DKML_COMPILER = $DEFAULT_DKML_COMPILER 819 - $env:PIN_ASTRING = $PIN_ASTRING 820 - $env:PIN_BASE = $PIN_BASE 821 - $env:PIN_BASE64 = $PIN_BASE64 822 - $env:PIN_BIGARRAY_COMPAT = $PIN_BIGARRAY_COMPAT 823 - $env:PIN_BOS = $PIN_BOS 824 - $env:PIN_CAMLP_STREAMS = $PIN_CAMLP_STREAMS 825 - $env:PIN_CHROME_TRACE = $PIN_CHROME_TRACE 826 - $env:PIN_CMDLINER = $PIN_CMDLINER 827 - $env:PIN_CONF_DKML_SYS_OPAM = $PIN_CONF_DKML_SYS_OPAM 828 - $env:PIN_CONF_PKG_CONFIG = $PIN_CONF_PKG_CONFIG 829 - $env:PIN_CONF_SQLITE3 = $PIN_CONF_SQLITE3 830 - $env:PIN_CPPO = $PIN_CPPO 831 - $env:PIN_CRUNCH = $PIN_CRUNCH 832 - $env:PIN_CSEXP = $PIN_CSEXP 833 - $env:PIN_CSTRUCT = $PIN_CSTRUCT 834 - $env:PIN_CTYPES_FOREIGN = $PIN_CTYPES_FOREIGN 835 - $env:PIN_CTYPES = $PIN_CTYPES 836 - $env:PIN_CUDF = $PIN_CUDF 837 - $env:PIN_DIGESTIF = $PIN_DIGESTIF 838 - $env:PIN_DISKUVBOX = $PIN_DISKUVBOX 839 - $env:PIN_DKML_APPS = $PIN_DKML_APPS 840 - $env:PIN_DKML_BASE_COMPILER = $PIN_DKML_BASE_COMPILER 841 - $env:PIN_DKML_BUILD_DESKTOP = $PIN_DKML_BUILD_DESKTOP 842 - $env:PIN_DKML_C_PROBE = $PIN_DKML_C_PROBE 843 - $env:PIN_DKML_COMPILER_ENV = $PIN_DKML_COMPILER_ENV 844 - $env:PIN_DKML_COMPILER_SRC = $PIN_DKML_COMPILER_SRC 845 - $env:PIN_DKML_COMPONENT_COMMON_DESKTOP = $PIN_DKML_COMPONENT_COMMON_DESKTOP 846 - $env:PIN_DKML_COMPONENT_COMMON_OPAM = $PIN_DKML_COMPONENT_COMMON_OPAM 847 - $env:PIN_DKML_COMPONENT_COMMON_UNIXUTILS = $PIN_DKML_COMPONENT_COMMON_UNIXUTILS 848 - $env:PIN_DKML_COMPONENT_OCAMLCOMPILER_COMMON = $PIN_DKML_COMPONENT_OCAMLCOMPILER_COMMON 849 - $env:PIN_DKML_COMPONENT_OCAMLCOMPILER_NETWORK = $PIN_DKML_COMPONENT_OCAMLCOMPILER_NETWORK 850 - $env:PIN_DKML_COMPONENT_OCAMLCOMPILER_OFFLINE = $PIN_DKML_COMPONENT_OCAMLCOMPILER_OFFLINE 851 - $env:PIN_DKML_COMPONENT_OFFLINE_DESKTOP_FULL = $PIN_DKML_COMPONENT_OFFLINE_DESKTOP_FULL 852 - $env:PIN_DKML_COMPONENT_OFFLINE_OPAMSHIM = $PIN_DKML_COMPONENT_OFFLINE_OPAMSHIM 853 - $env:PIN_DKML_COMPONENT_OFFLINE_UNIXUTILS = $PIN_DKML_COMPONENT_OFFLINE_UNIXUTILS 854 - $env:PIN_DKML_COMPONENT_STAGING_DESKTOP_FULL = $PIN_DKML_COMPONENT_STAGING_DESKTOP_FULL 855 - $env:PIN_DKML_COMPONENT_STAGING_DKMLCONFDIR = $PIN_DKML_COMPONENT_STAGING_DKMLCONFDIR 856 - $env:PIN_DKML_COMPONENT_STAGING_OCAMLRUN = $PIN_DKML_COMPONENT_STAGING_OCAMLRUN 857 - $env:PIN_DKML_COMPONENT_STAGING_OPAM32 = $PIN_DKML_COMPONENT_STAGING_OPAM32 858 - $env:PIN_DKML_COMPONENT_STAGING_OPAM64 = $PIN_DKML_COMPONENT_STAGING_OPAM64 859 - $env:PIN_DKML_COMPONENT_STAGING_UNIXUTILS = $PIN_DKML_COMPONENT_STAGING_UNIXUTILS 860 - $env:PIN_DKML_COMPONENT_STAGING_WITHDKML = $PIN_DKML_COMPONENT_STAGING_WITHDKML 861 - $env:PIN_DKML_COMPONENT_XX_CONSOLE = $PIN_DKML_COMPONENT_XX_CONSOLE 862 - $env:PIN_DKML_EXE_LIB = $PIN_DKML_EXE_LIB 863 - $env:PIN_DKML_EXE = $PIN_DKML_EXE 864 - $env:PIN_DKML_INSTALL_INSTALLER = $PIN_DKML_INSTALL_INSTALLER 865 - $env:PIN_DKML_INSTALL_RUNNER = $PIN_DKML_INSTALL_RUNNER 866 - $env:PIN_DKML_INSTALL = $PIN_DKML_INSTALL 867 - $env:PIN_DKML_INSTALLER_OCAML_COMMON = $PIN_DKML_INSTALLER_OCAML_COMMON 868 - $env:PIN_DKML_INSTALLER_OCAML_OFFLINE = $PIN_DKML_INSTALLER_OCAML_OFFLINE 869 - $env:PIN_DKML_PACKAGE_CONSOLE = $PIN_DKML_PACKAGE_CONSOLE 870 - $env:PIN_DKML_RUNTIME_COMMON_NATIVE = $PIN_DKML_RUNTIME_COMMON_NATIVE 871 - $env:PIN_DKML_RUNTIME_COMMON = $PIN_DKML_RUNTIME_COMMON 872 - $env:PIN_DKML_RUNTIME_DISTRIBUTION = $PIN_DKML_RUNTIME_DISTRIBUTION 873 - $env:PIN_DKML_RUNTIMELIB = $PIN_DKML_RUNTIMELIB 874 - $env:PIN_DKML_RUNTIMESCRIPTS = $PIN_DKML_RUNTIMESCRIPTS 875 - $env:PIN_DKML_WORKFLOWS = $PIN_DKML_WORKFLOWS 876 - $env:PIN_DUNE_ACTION_PLUGIN = $PIN_DUNE_ACTION_PLUGIN 877 - $env:PIN_DUNE_BUILD_INFO = $PIN_DUNE_BUILD_INFO 878 - $env:PIN_DUNE_CONFIGURATOR = $PIN_DUNE_CONFIGURATOR 879 - $env:PIN_DUNE_GLOB = $PIN_DUNE_GLOB 880 - $env:PIN_DUNE_PRIVATE_LIBS = $PIN_DUNE_PRIVATE_LIBS 881 - $env:PIN_DUNE_RPC_LWT = $PIN_DUNE_RPC_LWT 882 - $env:PIN_DUNE_RPC = $PIN_DUNE_RPC 883 - $env:PIN_DUNE_SITE = $PIN_DUNE_SITE 884 - $env:PIN_DUNE = $PIN_DUNE 885 - $env:PIN_DYN = $PIN_DYN 886 - $env:PIN_EITHER = $PIN_EITHER 887 - $env:PIN_EQAF = $PIN_EQAF 888 - $env:PIN_EXTLIB = $PIN_EXTLIB 889 - $env:PIN_EZJSONM = $PIN_EZJSONM 890 - $env:PIN_FEATHER = $PIN_FEATHER 891 - $env:PIN_FIBER = $PIN_FIBER 892 - $env:PIN_FIX = $PIN_FIX 893 - $env:PIN_FMT = $PIN_FMT 894 - $env:PIN_FPATH = $PIN_FPATH 895 - $env:PIN_GRAPHICS = $PIN_GRAPHICS 896 - $env:PIN_HEX = $PIN_HEX 897 - $env:PIN_INTEGERS = $PIN_INTEGERS 898 - $env:PIN_JANE_STREET_HEADERS = $PIN_JANE_STREET_HEADERS 899 - $env:PIN_JINGOO = $PIN_JINGOO 900 - $env:PIN_JSONM = $PIN_JSONM 901 - $env:PIN_JSONRPC = $PIN_JSONRPC 902 - $env:PIN_JST_CONFIG = $PIN_JST_CONFIG 903 - $env:PIN_LAMBDA_TERM = $PIN_LAMBDA_TERM 904 - $env:PIN_LOGS = $PIN_LOGS 905 - $env:PIN_LSP = $PIN_LSP 906 - $env:PIN_LWT = $PIN_LWT 907 - $env:PIN_LWT_REACT = $PIN_LWT_REACT 908 - $env:PIN_MCCS = $PIN_MCCS 909 - $env:PIN_MDX = $PIN_MDX 910 - $env:PIN_MENHIR = $PIN_MENHIR 911 - $env:PIN_MENHIRLIB = $PIN_MENHIRLIB 912 - $env:PIN_MENHIRSDK = $PIN_MENHIRSDK 913 - $env:PIN_MERLIN_LIB = $PIN_MERLIN_LIB 914 - $env:PIN_METAPP = $PIN_METAPP 915 - $env:PIN_METAQUOT = $PIN_METAQUOT 916 - $env:PIN_MEW = $PIN_MEW 917 - $env:PIN_MEW_VI = $PIN_MEW_VI 918 - $env:PIN_NUM = $PIN_NUM 919 - $env:PIN_OCAML_COMPILER_LIBS = $PIN_OCAML_COMPILER_LIBS 920 - $env:PIN_OCAML_LSP_SERVER = $PIN_OCAML_LSP_SERVER 921 - $env:PIN_OCAML_VERSION = $PIN_OCAML_VERSION 922 - $env:PIN_OCAML = $PIN_OCAML 923 - $env:PIN_OCAMLBUILD = $PIN_OCAMLBUILD 924 - $env:PIN_OCAMLC_LOC = $PIN_OCAMLC_LOC 925 - $env:PIN_OCAMLFIND = $PIN_OCAMLFIND 926 - $env:PIN_OCAMLFORMAT_LIB = $PIN_OCAMLFORMAT_LIB 927 - $env:PIN_OCAMLFORMAT_RPC_LIB = $PIN_OCAMLFORMAT_RPC_LIB 928 - $env:PIN_OCAMLFORMAT = $PIN_OCAMLFORMAT 929 - $env:PIN_OCP_INDENT = $PIN_OCP_INDENT 930 - $env:PIN_OCPLIB_ENDIAN = $PIN_OCPLIB_ENDIAN 931 - $env:PIN_ODOC_PARSER = $PIN_ODOC_PARSER 932 - $env:PIN_ODOC = $PIN_ODOC 933 - $env:PIN_ORDERING = $PIN_ORDERING 934 - $env:PIN_PARSEXP = $PIN_PARSEXP 935 - $env:PIN_PP = $PIN_PP 936 - $env:PIN_PPX_ASSERT = $PIN_PPX_ASSERT 937 - $env:PIN_PPX_BASE = $PIN_PPX_BASE 938 - $env:PIN_PPX_COLD = $PIN_PPX_COLD 939 - $env:PIN_PPX_COMPARE = $PIN_PPX_COMPARE 940 - $env:PIN_PPX_DERIVERS = $PIN_PPX_DERIVERS 941 - $env:PIN_PPX_DERIVING = $PIN_PPX_DERIVING 942 - $env:PIN_PPX_ENUMERATE = $PIN_PPX_ENUMERATE 943 - $env:PIN_PPX_EXPECT = $PIN_PPX_EXPECT 944 - $env:PIN_PPX_GLOBALIZE = $PIN_PPX_GLOBALIZE 945 - $env:PIN_PPX_HASH = $PIN_PPX_HASH 946 - $env:PIN_PPX_HERE = $PIN_PPX_HERE 947 - $env:PIN_PPX_IGNORE_INSTRUMENTATION = $PIN_PPX_IGNORE_INSTRUMENTATION 948 - $env:PIN_PPX_INLINE_TEST = $PIN_PPX_INLINE_TEST 949 - $env:PIN_PPX_OPTCOMP = $PIN_PPX_OPTCOMP 950 - $env:PIN_PPX_PIPEBANG = $PIN_PPX_PIPEBANG 951 - $env:PIN_PPX_SEXP_CONV = $PIN_PPX_SEXP_CONV 952 - $env:PIN_PPX_YOJSON_CONV_LIB = $PIN_PPX_YOJSON_CONV_LIB 953 - $env:PIN_PPXLIB = $PIN_PPXLIB 954 - $env:PIN_PTIME = $PIN_PTIME 955 - $env:PIN_QRC = $PIN_QRC 956 - $env:PIN_RE = $PIN_RE 957 - $env:PIN_REACT = $PIN_REACT 958 - $env:PIN_REFL = $PIN_REFL 959 - $env:PIN_RESULT = $PIN_RESULT 960 - $env:PIN_RRESULT = $PIN_RRESULT 961 - $env:PIN_SEQ = $PIN_SEQ 962 - $env:PIN_SEXPLIB = $PIN_SEXPLIB 963 - $env:PIN_SEXPLIB0 = $PIN_SEXPLIB0 964 - $env:PIN_SHA = $PIN_SHA 965 - $env:PIN_SPAWN = $PIN_SPAWN 966 - $env:PIN_SQLITE3 = $PIN_SQLITE3 967 - $env:PIN_STDCOMPAT = $PIN_STDCOMPAT 968 - $env:PIN_STDIO = $PIN_STDIO 969 - $env:PIN_STDLIB_SHIMS = $PIN_STDLIB_SHIMS 970 - $env:PIN_STDUNE = $PIN_STDUNE 971 - $env:PIN_TIME_NOW = $PIN_TIME_NOW 972 - $env:PIN_TOPKG = $PIN_TOPKG 973 - $env:PIN_TRAVERSE = $PIN_TRAVERSE 974 - $env:PIN_TRIE = $PIN_TRIE 975 - $env:PIN_TSORT = $PIN_TSORT 976 - $env:PIN_TYXML = $PIN_TYXML 977 - $env:PIN_UCHAR = $PIN_UCHAR 978 - $env:PIN_UTOP = $PIN_UTOP 979 - $env:PIN_UUCP = $PIN_UUCP 980 - $env:PIN_UUIDM = $PIN_UUIDM 981 - $env:PIN_UUSEG = $PIN_UUSEG 982 - $env:PIN_UUTF = $PIN_UUTF 983 - $env:PIN_WITH_DKML = $PIN_WITH_DKML 984 - $env:PIN_XDG = $PIN_XDG 985 - $env:PIN_YOJSON = $PIN_YOJSON 986 - $env:PIN_ZED = $PIN_ZED 987 - 988 - # https://patchwork.kernel.org/project/qemu-devel/patch/20211215073402.144286-17-thuth@redhat.com/ 989 - $env:CHERE_INVOKING = "yes" # Preserve the current working directory 990 - $env:MSYSTEM = $env:msys2_system # Start a 64 bit environment if CLANG64, etc. 991 - 992 - ########################### before_script ############################### 993 - 994 - # Troubleshooting 995 - If ( "${env:VERBOSE}" -eq "true" ) { Get-ChildItem 'env:' } 996 - 997 - # ----- 998 - # MSYS2 999 - # ----- 1000 - # 1001 - # https://www.msys2.org/docs/ci/ 1002 - # https://patchwork.kernel.org/project/qemu-devel/patch/20211215073402.144286-17-thuth@redhat.com/ 1003 - 1004 - if ( Test-Path -Path msys64\usr\bin\pacman.exe ) { 1005 - Write-Host "Re-using MSYS2 from cache." 1006 - } 1007 - else { 1008 - Write-Host "Download the archive ..." 1009 - If ( !(Test-Path -Path msys64\var\cache ) ) { New-Item msys64\var\cache -ItemType Directory | Out-Null } 1010 - If ( !(Test-Path -Path msys64\var\cache\msys2.exe ) ) { Invoke-WebRequest "https://github.com/msys2/msys2-installer/releases/download/2022-09-04/msys2-base-x86_64-20220904.sfx.exe" -outfile "msys64\var\cache\msys2.exe" } 1011 - 1012 - Write-Host "Extract the archive ..." 1013 - msys64\var\cache\msys2.exe -y # Extract to msys64 1014 - Remove-Item msys64\var\cache\msys2.exe # Delete the archive again 1015 - ((Get-Content -path msys64\etc\post-install\07-pacman-key.post -Raw) -replace '--refresh-keys', '--version') | Set-Content -Path msys64\etc\post-install\07-pacman-key.post 1016 - msys64\usr\bin\bash -lc "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf" 1017 - 1018 - Write-Host "Run for the first time ..." 1019 - msys64\usr\bin\bash -lc ' ' 1020 - } 1021 - Write-Host "Update MSYS2 ..." 1022 - msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' # Core update (in case any core packages are outdated) 1023 - msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' # Normal update 1024 - if ("${env:CI}" -eq "true") { taskkill /F /FI "MODULES eq msys-2.0.dll" } # Only safe to kill MSYS2 in CI 1025 - 1026 - Write-Host "Install matrix, required and CI packages ..." 1027 - # Packages for GitLab CI: 1028 - # dos2unix (used to translate PowerShell written files below in this CI .yml into MSYS2 scripts) 1029 - msys64\usr\bin\bash -lc 'set -x; pacman -Sy --noconfirm --needed ${msys2_packages} wget make rsync diffutils patch unzip git tar xz dos2unix' 1030 - 1031 - Write-Host "Uninstall MSYS2 conflicting executables ..." 1032 - msys64\usr\bin\bash -lc 'rm -vf /usr/bin/link.exe' # link.exe interferes with MSVC's link.exe 1033 - 1034 - Write-Host "Installing VSSetup for the Get-VSSetupInstance function ..." 1035 - Install-Module VSSetup -Scope CurrentUser -Force 1036 - 1037 - Write-Host "Writing scripts ..." 1038 - 1039 - # POSIX and AWK scripts 1040 - 1041 - If ( !(Test-Path -Path.ci\sd4 ) ) { New-Item .ci\sd4 -ItemType Directory | Out-Null } 1042 - 1043 - $Content = @' 1044 - #!/bin/sh 1045 - 1046 - # ------------------------ Log Formatting ------------------------ 1047 - 1048 - TXT_SECTION="\e[94m" # bright blue 1049 - TXT_CLEAR="\e[0m" 1050 - 1051 - if [ "${GITLAB_CI:-}" = "true" ]; then 1052 - # https://docs.gitlab.com/ee/ci/jobs/#expand-and-collapse-job-log-sections 1053 - print_section_start() { 1054 - print_section_start_NAME=$1 1055 - shift 1056 - printf "\e[0Ksection_start:%s:%s[collapsed=true]\r\e[0K" \ 1057 - "$(date +%s)" \ 1058 - "$print_section_start_NAME" 1059 - } 1060 - print_section_end() { 1061 - print_section_end_NAME=$1 1062 - shift 1063 - printf "\e[0Ksection_end:%s:%s\r\e[0K\n" \ 1064 - "$(date +%s)" \ 1065 - "$print_section_end_NAME" 1066 - } 1067 - elif [ -n "${GITHUB_ENV:-}" ]; then 1068 - # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines 1069 - print_section_start() { 1070 - print_section_start_NAME=$1 1071 - shift 1072 - printf "::group::" 1073 - } 1074 - print_section_end() { 1075 - print_section_end_NAME=$1 1076 - shift 1077 - printf "::endgroup::\n" 1078 - } 1079 - else 1080 - print_section_start() { 1081 - print_section_start_NAME=$1 1082 - shift 1083 - } 1084 - print_section_end() { 1085 - print_section_end_NAME=$1 1086 - shift 1087 - } 1088 - fi 1089 - 1090 - section_begin() { 1091 - # https://docs.gitlab.com/ee/ci/yaml/script.html#add-color-codes-to-script-output 1092 - section_NAME=$1 1093 - shift 1094 - section_HEADER=$1 1095 - shift 1096 - print_section_start "$section_NAME" 1097 - printf "${TXT_SECTION}%s${TXT_CLEAR}\n" "$section_HEADER" 1098 - } 1099 - 1100 - section_end() { 1101 - section_NAME=$1 1102 - shift 1103 - print_section_end "$section_NAME" 1104 - } 1105 - 1106 - # ------------------- Other Functions ----------------- 1107 - 1108 - transfer_dir() { 1109 - transfer_dir_SRC=$1 1110 - shift 1111 - transfer_dir_DST=$1 1112 - shift 1113 - # Remove the destination directory completely, but make sure the parent of the 1114 - # destination directory exists so `mv` will work 1115 - install -d "$transfer_dir_DST" 1116 - rm -rf "$transfer_dir_DST" 1117 - # Move 1118 - mv "$transfer_dir_SRC" "$transfer_dir_DST" 1119 - } 1120 - 1121 - # Set TEMP variable which is used, among other things, for OCaml's 1122 - # [Filename.temp_dir_name] on Win32, and by with-dkml.exe on Windows 1123 - export_temp_for_windows() { 1124 - if [ -x /usr/bin/cygpath ]; then 1125 - if [ -n "${RUNNER_TEMP:-}" ]; then 1126 - # GitHub Actions 1127 - TEMP=$(cygpath -am "$RUNNER_TEMP") 1128 - else 1129 - # GitLab CI/CD or desktop 1130 - install -d .ci/tmp 1131 - TEMP=$(cygpath -am ".ci/tmp") 1132 - fi 1133 - export TEMP 1134 - fi 1135 - } 1136 - 1137 - # Fixup opam_root on Windows to be mixed case. 1138 - # On input the following variables must be present: 1139 - # - opam_root 1140 - # - opam_root_cacheable 1141 - # On output the input variables will be modified _and_ the 1142 - # following variables will be available: 1143 - # - original_opam_root 1144 - # - original_opam_root_cacheable 1145 - # - unix_opam_root 1146 - # - unix_opam_root_cacheable 1147 - fixup_opam_root() { 1148 - # shellcheck disable=SC2034 1149 - original_opam_root=$opam_root 1150 - # shellcheck disable=SC2034 1151 - original_opam_root_cacheable=$opam_root_cacheable 1152 - if [ -x /usr/bin/cygpath ]; then 1153 - opam_root=$(/usr/bin/cygpath -m "$opam_root") 1154 - opam_root_cacheable=$(/usr/bin/cygpath -m "$opam_root_cacheable") 1155 - unix_opam_root=$(/usr/bin/cygpath -u "$opam_root") 1156 - unix_opam_root_cacheable=$(/usr/bin/cygpath -u "$opam_root_cacheable") 1157 - else 1158 - # shellcheck disable=SC2034 1159 - unix_opam_root=$opam_root 1160 - # shellcheck disable=SC2034 1161 - unix_opam_root_cacheable=$opam_root_cacheable 1162 - fi 1163 - } 1164 - '@ 1165 - Set-Content -Path ".ci\sd4\common-values.sh" -Encoding Unicode -Value $Content 1166 - msys64\usr\bin\bash -lc 'dos2unix .ci/sd4/common-values.sh' 1167 - 1168 - 1169 - $Content = @' 1170 - #!/bin/sh 1171 - 1172 - # ================ 1173 - # checkout-code.sh 1174 - # ================ 1175 - # 1176 - # Checkouts all of the git source code. 1177 - # 1178 - # This should be done outside of 1179 - # dockcross (used by Linux) since a Docker-in-Docker container can have 1180 - # difficulties doing a git checkout (the Git credentials for any private 1181 - # repositories are likely not present). We don't care about any private 1182 - # repositories for DKML but any code that extends this (ex. DKSDK) may 1183 - # need to use private repositories. 1184 - 1185 - set -euf 1186 - 1187 - setup_WORKSPACE_VARNAME=$1 1188 - shift 1189 - setup_WORKSPACE=$1 1190 - shift 1191 - 1192 - if [ -x /usr/bin/cygpath ]; then 1193 - setup_WORKSPACE=$(/usr/bin/cygpath -au "$setup_WORKSPACE") 1194 - fi 1195 - 1196 - # ------------------------ Functions ------------------------ 1197 - 1198 - # shellcheck source=./common-values.sh 1199 - . .ci/sd4/common-values.sh 1200 - 1201 - # Disable automatic garbage collection 1202 - git_disable_gc() { 1203 - git_disable_gc_NAME=$1 1204 - shift 1205 - git -C ".ci/sd4/g/$git_disable_gc_NAME" config --local gc.auto 0 1206 - } 1207 - 1208 - # Mimic the behavior of GitHub's actions/checkout@v3 1209 - # - the plus symbol in 'git fetch ... origin +REF:refs/tags/v0.0' overrides any existing REF 1210 - git_checkout() { 1211 - git_checkout_NAME=$1 1212 - shift 1213 - git_checkout_URL=$1 1214 - shift 1215 - git_checkout_REF=$1 1216 - shift 1217 - 1218 - if [ -e ".ci/sd4/g/$git_checkout_NAME" ]; then 1219 - git_disable_gc "$git_checkout_NAME" 1220 - git -C ".ci/sd4/g/$git_checkout_NAME" remote set-url origin "$git_checkout_URL" 1221 - git -C ".ci/sd4/g/$git_checkout_NAME" fetch --no-tags --progress --no-recurse-submodules --depth=1 origin "+${git_checkout_REF}:refs/tags/v0.0" 1222 - else 1223 - install -d ".ci/sd4/g/$git_checkout_NAME" 1224 - git -C ".ci/sd4/g/$git_checkout_NAME" -c init.defaultBranch=main init 1225 - git_disable_gc "$git_checkout_NAME" 1226 - git -C ".ci/sd4/g/$git_checkout_NAME" remote add origin "$git_checkout_URL" 1227 - git -C ".ci/sd4/g/$git_checkout_NAME" fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin "+${git_checkout_REF}:refs/tags/v0.0" 1228 - fi 1229 - git -C ".ci/sd4/g/$git_checkout_NAME" -c advice.detachedHead=false checkout --progress --force refs/tags/v0.0 1230 - git -C ".ci/sd4/g/$git_checkout_NAME" log -1 --format='%H' 1231 - } 1232 - 1233 - # --------------------------------------------------------------------- 1234 - 1235 - section_begin checkout-info "Summary: code checkout" 1236 - 1237 - # shellcheck disable=SC2154 1238 - echo " 1239 - ================ 1240 - checkout-code.sh 1241 - ================ 1242 - . 1243 - --------- 1244 - Arguments 1245 - --------- 1246 - WORKSPACE_VARNAME=$setup_WORKSPACE_VARNAME 1247 - WORKSPACE=$setup_WORKSPACE 1248 - . 1249 - ------ 1250 - Inputs 1251 - ------ 1252 - VERBOSE=${VERBOSE:-} 1253 - . 1254 - ------ 1255 - Matrix 1256 - ------ 1257 - dkml_host_abi=$dkml_host_abi 1258 - . 1259 - " 1260 - 1261 - section_end checkout-info 1262 - 1263 - install -d .ci/sd4/g 1264 - 1265 - # dkml-runtime-distribution 1266 - 1267 - # For 'Diagnose Visual Studio environment variables (Windows)' we need dkml-runtime-distribution 1268 - # so that 'Import-Module Machine' and 'Get-VSSetupInstance' can be run. 1269 - # The version doesn't matter too much, as long as it has a functioning Get-VSSetupInstance 1270 - # that supports the Visual Studio versions of the latest GitLab CI and GitHub Actions machines. 1271 - # commit 4d6f1bfc3510c55ba4273cb240e43727854b5718 = WinSDK 19041 and VS 14.29 1272 - case "$dkml_host_abi" in 1273 - windows_*) 1274 - section_begin checkout-dkml-runtime-distribution 'Checkout dkml-runtime-distribution' 1275 - git_checkout dkml-runtime-distribution https://github.com/diskuv/dkml-runtime-distribution.git "4d6f1bfc3510c55ba4273cb240e43727854b5718" 1276 - section_end checkout-dkml-runtime-distribution 1277 - ;; 1278 - esac 1279 - 1280 - '@ 1281 - Set-Content -Path ".ci\sd4\run-checkout-code.sh" -Encoding Unicode -Value $Content 1282 - msys64\usr\bin\bash -lc 'dos2unix .ci/sd4/run-checkout-code.sh' 1283 - 1284 - 1285 - $Content = @' 1286 - #!/bin/sh 1287 - set -euf 1288 - 1289 - # Constants 1290 - SHA512_DEVNULL='cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e' 1291 - 1292 - setup_WORKSPACE_VARNAME=$1 1293 - shift 1294 - setup_WORKSPACE=$1 1295 - shift 1296 - 1297 - if [ -x /usr/bin/cygpath ]; then 1298 - setup_WORKSPACE=$(/usr/bin/cygpath -au "$setup_WORKSPACE") 1299 - fi 1300 - 1301 - # ------------------ Variables and functions ------------------------ 1302 - 1303 - # shellcheck source=./common-values.sh 1304 - . .ci/sd4/common-values.sh 1305 - 1306 - if [ "${VERBOSE:-}" = "true" ]; then 1307 - do_tar_rf() { 1308 - tar rvf "$@" 1309 - } 1310 - else 1311 - do_tar_rf() { 1312 - tar rf "$@" 1313 - } 1314 - fi 1315 - 1316 - # Make the standard input work as an OCaml string. 1317 - # This currently only escapes backslashes and double quotes. 1318 - escape_arg_as_ocaml_string() { 1319 - escape_arg_as_ocaml_string_ARG=$1 1320 - shift 1321 - printf "%s" "$escape_arg_as_ocaml_string_ARG" | sed 's#\\#\\\\#g; s#"#\\"#g;' 1322 - } 1323 - 1324 - # Fixup opam_root on Windows to be mixed case. Set original_* and unix_* as well. 1325 - fixup_opam_root 1326 - 1327 - # Set TEMP variable for Windows 1328 - export_temp_for_windows 1329 - 1330 - # Load VS studio environment 1331 - if [ -e .ci/sd4/vsenv.sh ]; then 1332 - # shellcheck disable=SC1091 1333 - . .ci/sd4/vsenv.sh 1334 - fi 1335 - 1336 - # ------------------------------------------------------------------- 1337 - 1338 - section_begin setup-info "Summary: setup-dkml" 1339 - 1340 - SKIP_OPAM_MODIFICATIONS=${SKIP_OPAM_MODIFICATIONS:-false} # default is false 1341 - 1342 - # shellcheck disable=SC2154 1343 - echo " 1344 - ============= 1345 - setup-dkml.sh 1346 - ============= 1347 - . 1348 - --------- 1349 - Arguments 1350 - --------- 1351 - WORKSPACE_VARNAME=$setup_WORKSPACE_VARNAME 1352 - WORKSPACE=$setup_WORKSPACE 1353 - . 1354 - ------ 1355 - Inputs 1356 - ------ 1357 - FDOPEN_OPAMEXE_BOOTSTRAP=${FDOPEN_OPAMEXE_BOOTSTRAP:-} 1358 - DISKUV_OPAM_REPOSITORY=${DISKUV_OPAM_REPOSITORY:-} 1359 - DKML_COMPILER=${DKML_COMPILER:-} 1360 - OCAML_COMPILER=${OCAML_COMPILER:-} 1361 - CONF_DKML_CROSS_TOOLCHAIN=${CONF_DKML_CROSS_TOOLCHAIN:-} 1362 - SKIP_OPAM_MODIFICATIONS=${SKIP_OPAM_MODIFICATIONS:-} 1363 - SECONDARY_SWITCH=${SECONDARY_SWITCH:-} 1364 - PRIMARY_SWITCH_SKIP_INSTALL=${PRIMARY_SWITCH_SKIP_INSTALL:-} 1365 - MANYLINUX=${MANYLINUX:-} 1366 - DKML_HOME=${DKML_HOME:-} 1367 - VERBOSE=${VERBOSE:-} 1368 - . 1369 - ------------------- 1370 - Generated Constants 1371 - ------------------- 1372 - DKML_VERSION=$DKML_VERSION 1373 - DEFAULT_DISKUV_OPAM_REPOSITORY_TAG=$DEFAULT_DISKUV_OPAM_REPOSITORY_TAG 1374 - DEFAULT_DKML_COMPILER=$DEFAULT_DKML_COMPILER 1375 - . 1376 - ------ 1377 - Matrix 1378 - ------ 1379 - dkml_host_abi=$dkml_host_abi 1380 - bootstrap_opam_version=$bootstrap_opam_version 1381 - abi_pattern=$abi_pattern 1382 - opam_root=${opam_root} 1383 - opam_root_cacheable=${opam_root_cacheable} 1384 - original_opam_root=${original_opam_root} 1385 - original_opam_root_cacheable=${original_opam_root_cacheable} 1386 - unix_opam_root=${unix_opam_root} 1387 - unix_opam_root_cacheable=${unix_opam_root_cacheable} 1388 - dockcross_image=${dockcross_image:-} 1389 - dockcross_image_custom_prefix=${dockcross_image_custom_prefix:-} 1390 - dockcross_run_extra_args=${dockcross_run_extra_args:-} 1391 - docker_runner=${docker_runner:-} 1392 - in_docker=${in_docker:-} 1393 - ocaml_options=${ocaml_options:-} 1394 - . 1395 - ---- 1396 - Pins 1397 - ---- 1398 - " 1399 - set | grep ^PIN_ 1400 - echo ". 1401 - " 1402 - case "$dkml_host_abi" in 1403 - windows_*) 1404 - # shellcheck disable=SC2153 1405 - echo " 1406 - ------------- 1407 - Visual Studio 1408 - ------------- 1409 - VS_DIR=$VS_DIR 1410 - VS_VCVARSVER=$VS_VCVARSVER 1411 - VS_WINSDKVER=$VS_WINSDKVER 1412 - VS_MSVSPREFERENCE=$VS_MSVSPREFERENCE 1413 - VS_CMAKEGENERATOR=$VS_CMAKEGENERATOR 1414 - . 1415 - " 1416 - ;; 1417 - esac 1418 - section_end setup-info 1419 - 1420 - do_bootstrap() { 1421 - # Bootstrap from historical release 1422 - runit_BOOTSTRAPPED=0 1423 - 1424 - # Bootstrap opam from fdopen (Windows) 1425 - if [ "$runit_BOOTSTRAPPED" = 0 ] && [ "${FDOPEN_OPAMEXE_BOOTSTRAP:-}" = "true" ]; then 1426 - if [ -e .ci/sd4/opam64/bin/opam.exe ] && [ -e .ci/sd4/opam64/bin/opam-installer.exe ]; then 1427 - runit_BOOTSTRAPPED=1 1428 - else 1429 - case "$dkml_host_abi" in 1430 - windows_*) 1431 - echo 'Bootstrap opam from fdopen (Windows) ...' 1432 - install -d .ci/sd4/bs/bin 1433 - wget -O "$setup_WORKSPACE"/.ci/sd4/opam64.tar.xz https://github.com/fdopen/opam-repository-mingw/releases/download/0.0.0.2/opam64.tar.xz 1434 - 1435 - # this stalls: tar xvCfJ "$setup_WORKSPACE"/.ci/sd4 "$setup_WORKSPACE"/.ci/sd4/opam64.tar.xz 1436 - xz -v -d "$setup_WORKSPACE"/.ci/sd4/opam64.tar.xz 1437 - tar xvCf .ci/sd4 .ci/sd4/opam64.tar 1438 - 1439 - rm -rf "$setup_WORKSPACE"/.ci/sd4/bs/bin/Opam.Runtime.amd64 1440 - mv -v "$setup_WORKSPACE"/.ci/sd4/opam64/bin/Opam.Runtime.amd64/ "$setup_WORKSPACE"/.ci/sd4/bs/bin/ 1441 - mv -v "$setup_WORKSPACE"/.ci/sd4/opam64/bin/opam.exe "$setup_WORKSPACE"/.ci/sd4/bs/bin/ 1442 - mv -v "$setup_WORKSPACE"/.ci/sd4/opam64/bin/opam-installer.exe "$setup_WORKSPACE"/.ci/sd4/bs/bin/ 1443 - 1444 - # diagnostics 1445 - ldd "$setup_WORKSPACE"/.ci/sd4/bs/bin/opam.exe 1446 - ldd "$setup_WORKSPACE"/.ci/sd4/bs/bin/opam-installer.exe 1447 - 1448 - runit_BOOTSTRAPPED=1 1449 - ;; 1450 - esac 1451 - fi 1452 - fi 1453 - 1454 - # Bootstrap from historical release 1455 - if [ "$runit_BOOTSTRAPPED" = 0 ] && [ "$bootstrap_opam_version" != "os" ]; then 1456 - install -d .ci/sd4/bs 1457 - cd .ci/sd4/bs 1458 - 1459 - if [ ! -e version ] || [ "$(cat version)" != "$bootstrap_opam_version" ]; then 1460 - echo 'Bootstrap opam from historical release (non-Windows; Windows non-fdopen) ...' 1461 - if command -v curl > /dev/null 2> /dev/null; then 1462 - curl -L -o opam.tar.gz "https://github.com/diskuv/dkml-component-opam/releases/download/v${bootstrap_opam_version}/dkml-component-staging-opam.tar.gz" 1463 - else 1464 - wget -O opam.tar.gz "https://github.com/diskuv/dkml-component-opam/releases/download/v${bootstrap_opam_version}/dkml-component-staging-opam.tar.gz" 1465 - fi 1466 - tar tvfz opam.tar.gz 1467 - tar xfz opam.tar.gz "./staging-files/${dkml_host_abi}/" 1468 - rm -rf bin/ 1469 - mv "staging-files/${dkml_host_abi}/bin" . 1470 - rm -rf "${abi_pattern}" 1471 - printf "%s" "${bootstrap_opam_version}" >version 1472 - fi 1473 - 1474 - rm -f opam.tar.gz 1475 - cd ../../.. 1476 - 1477 - runit_BOOTSTRAPPED=1 1478 - fi 1479 - 1480 - # Bootstrap from package manager or GitHub ocaml/opam release 1481 - case "$runit_BOOTSTRAPPED,$bootstrap_opam_version,$dkml_host_abi" in 1482 - 0,os,darwin_*) 1483 - if ! command -v opam; then 1484 - echo 'Bootstrap opam from package manager (macOS) ...' 1485 - brew install gpatch 1486 - brew install opam 1487 - fi 1488 - runit_BOOTSTRAPPED=1 1489 - ;; 1490 - 0,os,linux_x86) 1491 - if [ ! -x .ci/sd4/bs/bin/opam ]; then 1492 - echo 'Bootstrap opam from GitHub ocaml/opam release (Linux x86) ...' 1493 - install -d .ci/sd4/bs/bin 1494 - if command -v curl > /dev/null 2> /dev/null; then 1495 - curl -L -o .ci/sd4/bs/bin/opam.tmp https://github.com/ocaml/opam/releases/download/2.1.2/opam-2.1.2-i686-linux 1496 - else 1497 - wget -O .ci/sd4/bs/bin/opam.tmp https://github.com/ocaml/opam/releases/download/2.1.2/opam-2.1.2-i686-linux 1498 - fi 1499 - sha512_check=$(openssl sha512 2>&1 </dev/null | cut -f 2 -d ' ') 1500 - if [ "$SHA512_DEVNULL" = "$sha512_check" ]; then 1501 - sha512=$(openssl sha512 ".ci/sd4/bs/bin/opam.tmp" 2>/dev/null | cut -f 2 -d ' ') 1502 - check="85a480d60e09a7d37fa0d0434ed97a3187434772ceb4e7e8faa5b06bc18423d004af3ad5849c7d35e72dca155103257fd6b1178872df8291583929eb8f884b6a" 1503 - test "$sha512" = "$check" 1504 - chmod +x .ci/sd4/bs/bin/opam.tmp 1505 - mv .ci/sd4/bs/bin/opam.tmp .ci/sd4/bs/bin/opam 1506 - else 1507 - echo "openssl 512 option unsupported." 1508 - exit 61 1509 - fi 1510 - fi 1511 - runit_BOOTSTRAPPED=1 1512 - ;; 1513 - 0,os,linux_x86_64) 1514 - if [ ! -x .ci/sd4/bs/bin/opam ]; then 1515 - echo 'Bootstrap opam from GitHub ocaml/opam release (Linux x86_64) ...' 1516 - install -d .ci/sd4/bs/bin 1517 - if command -v curl > /dev/null 2> /dev/null; then 1518 - curl -L -o .ci/sd4/bs/bin/opam.tmp https://github.com/ocaml/opam/releases/download/2.1.2/opam-2.1.2-x86_64-linux 1519 - else 1520 - wget -O .ci/sd4/bs/bin/opam.tmp https://github.com/ocaml/opam/releases/download/2.1.2/opam-2.1.2-x86_64-linux 1521 - fi 1522 - sha512_check=$(openssl sha512 2>&1 </dev/null | cut -f 2 -d ' ') 1523 - if [ "$SHA512_DEVNULL" = "$sha512_check" ]; then 1524 - sha512=$(openssl sha512 ".ci/sd4/bs/bin/opam.tmp" 2>/dev/null | cut -f 2 -d ' ') 1525 - check="c0657ecbd4dc212587a4da70c5ff0402df95d148867be0e1eb1be8863a2851015f191437c3c99b7c2b153fcaa56cac99169c76ec94c5787750d7a59cd1fbb68b" 1526 - test "$sha512" = "$check" 1527 - chmod +x .ci/sd4/bs/bin/opam.tmp 1528 - mv .ci/sd4/bs/bin/opam.tmp .ci/sd4/bs/bin/opam 1529 - else 1530 - echo "openssl 512 option unsupported." 1531 - exit 61 1532 - fi 1533 - fi 1534 - runit_BOOTSTRAPPED=1 1535 - ;; 1536 - esac 1537 - } 1538 - section_begin bootstrap-opam 'Bootstrap opam' 1539 - do_bootstrap 1540 - section_end bootstrap-opam 1541 - 1542 - # Start environment distribution tarball 1543 - # We use .tar rather than .tar.gz/.tar.bz2 because we can repeatedly add to an uncompressed .tar. But we need to 1544 - # start with an empty tarball since some tar programs will only add ('tar rf xyz.tar') to an existing .tar. 1545 - install -d .ci/sd4/dist 1546 - tar cf .ci/sd4/dist/run-with-env.tar -T /dev/null 1547 - 1548 - do_get_dockcross() { 1549 - if [ -n "${dockcross_image:-}" ]; then 1550 - # The dockcross script is super-slow 1551 - section_begin get-dockcross 'Get dockcross binary (ManyLinux)' 1552 - install -d .ci/sd4 1553 - # shellcheck disable=SC2086 1554 - docker run ${dockcross_run_extra_args:-} --rm "${dockcross_image_custom_prefix:-}${dockcross_image:-}" >.ci/sd4/dockcross.gen 1555 - 1556 - # PROBLEM 1 1557 - # --------- 1558 - # Super-annoying stderr output from dockcross at line: 1559 - # tty -s && [ -z "$MSYS" ] && TTY_ARGS=-ti 1560 - # When there is no tty, get: 1561 - # tty: ignoring all arguments 1562 - # not a tty 1563 - # So replace 'tty -s &&' with 'false &&' 1564 - sed 's/tty -s &&/false \&\&/' .ci/sd4/dockcross.gen >.ci/sd4/dockcross-real 1565 - rm -f .ci/sd4/dockcross.gen 1566 - chmod +x .ci/sd4/dockcross-real 1567 - 1568 - # PROBLEM 2 1569 - # --------- 1570 - # By default dockcross for ManyLinux will chown -R all python packages; super-slow (~10 seconds)! 1571 - # Confer: https://github.com/dockcross/dockcross/blob/master/manylinux-common/pre_exec.sh 1572 - # That kills speed for any repetitive dockcross invocation. 1573 - # 1574 - # BUT it is unnecessary to chown -R when the current user is root, because inside the Docker container 1575 - # the files are already root! 1576 - # 1577 - # The chown -R (within pre_exec.sh) is not run when the user ids are not passed in. 1578 - # Confer: https://github.com/dockcross/dockcross/blob/96d87416f639af0204bdd42553e4b99315ca8476/imagefiles/entrypoint.sh#L21-L53 1579 - # 1580 - # So explicitly call the entrypoint if root! 1581 - if echo "${dockcross_run_extra_args:-}" | grep -q linux/386; then 1582 - # https://github.com/dockcross/dockcross/blob/master/linux-x86/linux32-entrypoint.sh 1583 - # But only when `--platform linux/386` because the container image may be overridden. 1584 - dockcross_entrypoint=/dockcross/linux32-entrypoint.sh 1585 - else 1586 - dockcross_entrypoint=/dockcross/entrypoint.sh 1587 - fi 1588 - cat > .ci/sd4/dockcross <<EOF 1589 - #!/bin/bash 1590 - set -euf 1591 - BUILDER_UID="\$( id -u )" 1592 - BUILDER_GID="\$( id -g )" 1593 - if [ "\$BUILDER_UID" = 0 ] && [ "\$BUILDER_GID" = 0 ]; then 1594 - # ---------- Start of dockcross script snippet ------- 1595 - # Verbatim from 1596 - # https://github.com/dockcross/dockcross/blob/96d87416f639af0204bdd42553e4b99315ca8476/imagefiles/dockcross#L175-L204 1597 - # except 1) disabling of USER_IDS 1598 - 1599 - # Bash on Ubuntu on Windows 1600 - UBUNTU_ON_WINDOWS=\$([ -e /proc/version ] && grep -l Microsoft /proc/version || echo "") 1601 - # MSYS, Git Bash, etc. 1602 - MSYS=\$([ -e /proc/version ] && grep -l MINGW /proc/version || echo "") 1603 - # CYGWIN 1604 - CYGWIN=\$([ -e /proc/version ] && grep -l CYGWIN /proc/version || echo "") 1605 - 1606 - #if [ -z "\$UBUNTU_ON_WINDOWS" -a -z "\$MSYS" -a "\$OCI_EXE" != "podman" ]; then 1607 - # USER_IDS=(-e BUILDER_UID="\$( id -u )" -e BUILDER_GID="\$( id -g )" -e BUILDER_USER="\$( id -un )" -e BUILDER_GROUP="\$( id -gn )") 1608 - #fi 1609 - 1610 - # Change the PWD when working in Docker on Windows 1611 - if [ -n "\$UBUNTU_ON_WINDOWS" ]; then 1612 - WSL_ROOT="/mnt/" 1613 - CFG_FILE=/etc/wsl.conf 1614 - if [ -f "\$CFG_FILE" ]; then 1615 - CFG_CONTENT=\$(cat \$CFG_FILE | sed -r '/[^=]+=[^=]+/!d' | sed -r 's/\s+=\s/=/g') 1616 - eval "\$CFG_CONTENT" 1617 - if [ -n "\$root" ]; then 1618 - WSL_ROOT=\$root 1619 - fi 1620 - fi 1621 - HOST_PWD=\`pwd -P\` 1622 - HOST_PWD=\${HOST_PWD/\$WSL_ROOT//} 1623 - elif [ -n "\$MSYS" ]; then 1624 - HOST_PWD=\$PWD 1625 - HOST_PWD=\${HOST_PWD/\//} 1626 - HOST_PWD=\${HOST_PWD/\//:\/} 1627 - elif [ -n "\$CYGWIN" ]; then 1628 - for f in pwd readlink cygpath ; do 1629 - test -n "\$(type "\${f}" )" || { echo >&2 "Missing functionality (\${f}) (in cygwin)." ; exit 1 ; } ; 1630 - done ; 1631 - HOST_PWD="\$( cygpath -w "\$( readlink -f "\$( pwd ;)" ; )" ; )" ; 1632 - else 1633 - HOST_PWD=\$PWD 1634 - [ -L \$HOST_PWD ] && HOST_PWD=\$(readlink \$HOST_PWD) 1635 - fi 1636 - 1637 - # ---------- End of dockcross script snippet ------- 1638 - 1639 - # Handle: dockcross --args "-v X:Y --platform P" 1640 - ARGS= 1641 - if [ "\$#" -ge 1 ] && [ "\$1" = "--args" ]; then 1642 - shift 1643 - ARGS=\$1 1644 - shift 1645 - fi 1646 - 1647 - # Directly invoke entrypoint 1648 - exec docker run --entrypoint /bin/bash \ 1649 - --rm \ 1650 - \${ARGS:-} \ 1651 - -v "\$HOST_PWD":/work \ 1652 - ${dockcross_image_custom_prefix:-}${dockcross_image:-} ${dockcross_entrypoint} "\$@" 1653 - else 1654 - HERE=\$(dirname "\$0") 1655 - HERE=\$(cd "\$HERE" && pwd) 1656 - exec "\$HERE/dockcross-real" "\$@" 1657 - fi 1658 - EOF 1659 - chmod +x .ci/sd4/dockcross 1660 - 1661 - # Bundle for consumers of setup-dkml.yml 1662 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/dockcross .ci/sd4/dockcross-real 1663 - 1664 - section_end get-dockcross 1665 - fi 1666 - } 1667 - do_get_dockcross 1668 - 1669 - if [ -n "${dockcross_image:-}" ]; then 1670 - # rsync needs to be available, even after Docker container disappears 1671 - if [ ! -e .ci/sd4/bs/bin/rsync ]; then 1672 - section_begin get-opam-prereqs-in-dockcross 'Get Opam prerequisites (ManyLinux)' 1673 - install -d .ci/sd4/bs/bin 1674 - # Install rsync with 'yum' (ManyLinux) or 'apt' (dockcross/linux-x64, etc.) 1675 - # if not present. 1676 - # shellcheck disable=SC2016 1677 - .ci/sd4/dockcross --args "${dockcross_run_extra_args:-}" sh -c 'if ! command -v rsync; then if command -v yum; then sudo yum install -y rsync; else sudo apt-get install -qq -o=Dpkg::Use-Pty=0 -y rsync; fi; fi && install $(command -v rsync) .ci/sd4/bs/bin' 1678 - section_end get-opam-prereqs-in-dockcross 1679 - fi 1680 - fi 1681 - 1682 - # Opam prerequisites for using opam (not for installing opam) 1683 - 1684 - { 1685 - if [ -n "${docker_runner:-}" ]; then 1686 - # rsync needs to be available, even after Docker container disappears 1687 - if [ ! -e .ci/sd4/bs/bin/rsync.deps ]; then 1688 - section_begin get-opam-prereqs-in-docker 'Get Opam prerequisites (Linux Docker)' 1689 - install -d .ci/sd4/bs/bin 1690 - ${docker_runner} sh -c ' 1691 - apt-get update -qq -o=Dpkg::Use-Pty=0 && 1692 - apt-get install -qq -o=Dpkg::Use-Pty=0 -y rsync && 1693 - ldd /usr/bin/rsync && 1694 - ls -l /lib/i386-linux-gnu/libpopt.so.0 /lib/i386-linux-gnu/libacl.so.1 /lib/i386-linux-gnu/libattr.so.1 && 1695 - tar cCfhz / /work/.ci/sd4/bs/bin/deps.tar.gz /usr/bin/rsync /lib/i386-linux-gnu/libpopt.so.0 1696 - ' 1697 - touch .ci/sd4/bs/bin/rsync.deps 1698 - section_end get-opam-prereqs-in-docker 1699 - fi 1700 - fi 1701 - 1702 - # Bundle Opam prerequisites (ManyLinux or Linux Docker) 1703 - if [ -n "${docker_runner:-}" ] || [ -n "${dockcross_image:-}" ]; then 1704 - # Bundle for consumers of setup-dkml.yml 1705 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/bs/bin/rsync 1706 - fi 1707 - } 1708 - 1709 - # Get Opam Cache 1710 - do_get_opam_cache() { 1711 - if [ "$unix_opam_root_cacheable" = "$unix_opam_root" ]; then return; fi 1712 - if [ ! -e "$unix_opam_root_cacheable" ]; then return; fi 1713 - section_begin get-opam-cache "Transferring Opam cache to $original_opam_root_cacheable" 1714 - echo Starting transfer # need some output or GitLab CI will not display the section duration 1715 - transfer_dir "$unix_opam_root_cacheable" "$unix_opam_root" 1716 - echo Finished transfer 1717 - section_end get-opam-cache 1718 - } 1719 - do_get_opam_cache 1720 - 1721 - # Setup Opam 1722 - 1723 - do_write_opam_scripts() { 1724 - case "${FDOPEN_OPAMEXE_BOOTSTRAP:-},$dkml_host_abi" in 1725 - true,windows_*) 1726 - # With fdopen's opam.exe, 'os-distribution = "cygwinports"'. But native Windows opam.exe has 'os-distribution = "win32"'. 1727 - # But on Windows we always want MSYS2 or native Windows libraries, not Cygwin. If cygwinports then 1728 - # code like https://github.com/ocaml/opam-repository/blob/08cbb8258bd4bf30cd6f307c958911a29d537b54/packages/conf-pkg-config/conf-pkg-config.2/opam#L36 1729 - # will fail. So always set 'os-distribution = "win32"' on Windows. 1730 - PATCH_OS_DISTRIBUTION_WIN32=true 1731 - # With fdopen's opam.exe, no 'exe = ".exe"' is set because Cygwin does not need file extensions. 1732 - # Native Windows requires a .exe extension. 1733 - PATCH_EXE_WIN32=true 1734 - ;; 1735 - *) 1736 - PATCH_OS_DISTRIBUTION_WIN32=false 1737 - PATCH_EXE_WIN32=false 1738 - ;; 1739 - esac 1740 - 1741 - # --------------------- 1742 - # Empty opam repository 1743 - # --------------------- 1744 - 1745 - install -d .ci/sd4/eor 1746 - cat >.ci/sd4/eor/repo <<EOF 1747 - opam-version: "2.0" 1748 - browse: "https://opam.ocaml.org/pkg/" 1749 - upstream: "https://github.com/ocaml/opam-repository/tree/master/" 1750 - EOF 1751 - 1752 - # --------------- 1753 - # Create Opam troubleshooting script 1754 - # Dump logs modified within the last 4 hours 1755 - # --------------- 1756 - 1757 - cat >.ci/sd4/troubleshoot-opam.sh <<EOF 1758 - #!/bin/sh 1759 - set -euf 1760 - OPAMROOT=\$1 1761 - shift 1762 - if find . -maxdepth 0 -mmin -240 2>/dev/null >/dev/null; then 1763 - FINDARGS="-mmin -240" # is -mmin supported? BSD (incl. macOS), MSYS2, GNU 1764 - else 1765 - FINDARGS="-mtime -1" # use 1 day instead. Solaris 1766 - fi 1767 - printf "\n\n========= [START OF TROUBLESHOOTING] ===========\n\n" >&2 1768 - find "\$OPAMROOT"/log -mindepth 1 -maxdepth 1 \$FINDARGS -name "*.out" ! -name "log-*.out" ! -name "ocaml-variants-*.out" | while read -r dump_on_error_LOG; do 1769 - dump_on_error_BLOG=\$(basename "\$dump_on_error_LOG") 1770 - printf "\n\n========= [TROUBLESHOOTING] %s ===========\n\n" "\$dump_on_error_BLOG" >&2 1771 - awk -v BLOG="\$dump_on_error_BLOG" '{print "[" BLOG "]", \$0}' "\$dump_on_error_LOG" >&2 1772 - done 1773 - printf "\nScroll up to see the [TROUBLESHOOTING] logs that begin at the [START OF TROUBLESHOOTING] line\n" >&2 1774 - EOF 1775 - 1776 - chmod +x .ci/sd4/troubleshoot-opam.sh 1777 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/troubleshoot-opam.sh 1778 - 1779 - # --------------- 1780 - # Create Opam support scripts (not needed for all platforms) 1781 - # The PATH to find opam must work internally in setup-dkml.yml (sd4/bs/bin) and 1782 - # by consumers of setup-dkml.yml (sd4/opamexe) 1783 - # --------------- 1784 - 1785 - USER_ID=$(id -u) 1786 - GROUP_ID=$(id -g) 1787 - USER_NAME=$(id -un) 1788 - GROUP_NAME=$(id -gn) 1789 - 1790 - case "${opam_root}" in 1791 - /* | ?:*) # /a/b/c or C:\Windows 1792 - validate_supports_docker() { 1793 - echo "Docker only supported with relative paths for the opam root, not: ${opam_root}" >&2 1794 - exit 3 1795 - } 1796 - ;; 1797 - *) # relative path 1798 - validate_supports_docker() { 1799 - true 1800 - } 1801 - cat >.ci/sd4/run-in-docker <<EOF 1802 - #!/bin/sh 1803 - set -euf 1804 - export PATH="/work/.ci/local/bin:/work/.ci/sd4/bs/bin:/work/.ci/sd4/opamexe:\$PATH" 1805 - export OPAMROOT=/work/${opam_root} 1806 - export OPAMROOTISOK=1 1807 - if [ "${PATCH_OS_DISTRIBUTION_WIN32}" = true ]; then export OPAMVAR_os_distribution=win32; fi 1808 - if [ "${PATCH_EXE_WIN32}" = true ]; then export OPAMVAR_exe=.exe; fi 1809 - 1810 - # Reset environment so no conflicts with a parent Opam or OCaml system 1811 - unset OPAM_SWITCH_PREFIX 1812 - unset OPAMSWITCH 1813 - unset CAML_LD_LIBRARY_PATH 1814 - unset OCAMLLIB 1815 - unset OCAML_TOPLEVEL_PATH 1816 - 1817 - prog=\$1 1818 - shift 1819 - 1820 - # Optionally skip troubleshooting 1821 - troubleshooting=1 1822 - if [ "\$#" -ge 1 ] && [ "\$prog" = opam ] && [ "\$1" = "--no-troubleshooting" ]; then 1823 - shift 1824 - troubleshooting=0 1825 - fi 1826 - 1827 - echo "Running inside Docker container: \$prog \$*" >&2 1828 - set +e 1829 - "\$prog" "\$@" 1830 - exitcode=\$? 1831 - if [ \$troubleshooting = 1 ] && [ \$prog = opam ]; then 1832 - [ \$exitcode = 0 ] || "/work/.ci/sd4/troubleshoot-opam.sh" \$OPAMROOT 1833 - fi 1834 - exit \$exitcode 1835 - EOF 1836 - chmod +x .ci/sd4/run-in-docker 1837 - ;; 1838 - esac 1839 - 1840 - cat >.ci/sd4/deescalate <<EOF 1841 - #!/bin/sh 1842 - set -euf 1843 - 1844 - if [ -e /work/.ci/sd4/bs/bin/deps.tar.gz ]; then 1845 - tar xCfz / /work/.ci/sd4/bs/bin/deps.tar.gz 1846 - fi 1847 - 1848 - groupadd -g ${GROUP_ID} ${GROUP_NAME} 1849 - useradd -l -m -u ${USER_ID} -g ${GROUP_ID} ${USER_NAME} 1850 - exec runuser -u ${USER_NAME} -g ${GROUP_NAME} -- "\$@" 1851 - EOF 1852 - 1853 - chmod +x .ci/sd4/deescalate 1854 - 1855 - # ----------------------------------- 1856 - # Create run-with-env 1857 - # ----------------------------------- 1858 - 1859 - install -d .ci/sd4/dist 1860 - 1861 - if [ -x .ci/sd4/dockcross ]; then 1862 - # Adding empty dockcross root volume avoids: 1863 - # cp: target ‘/home/root/’ is not a directory 1864 - # chown: cannot access ‘/home/root’: No such file or directory 1865 - # from https://github.com/dockcross/dockcross/blob/96d87416f639af0204bdd42553e4b99315ca8476/imagefiles/entrypoint.sh#L31-L32 1866 - install -d .ci/sd4/edr 1867 - 1868 - cat >.ci/sd4/run-with-env <<EOF 1869 - #!/bin/sh 1870 - set -euf 1871 - 1872 - HERE=\$(dirname "\$0") 1873 - HERE=\$(cd "\$HERE" && pwd) 1874 - PROJECT_DIR=\$(cd "\$HERE"/../.. && pwd) 1875 - 1876 - # Optionally enable terminal if and only if '-it' option given 1877 - termargs= 1878 - if [ "\$#" -ge 1 ] && [ "\$1" = "-it" ]; then 1879 - shift 1880 - termargs=-it 1881 - fi 1882 - 1883 - exec bash "\${PROJECT_DIR}"/.ci/sd4/dockcross --args "\${termargs} -v \${PROJECT_DIR}/.ci/sd4/edr:/home/root ${dockcross_run_extra_args:-}" /work/.ci/sd4/run-in-docker "\$@" 1884 - EOF 1885 - chmod +x .ci/sd4/run-with-env 1886 - 1887 - validate_supports_docker 1888 - 1889 - # Bundle for consumers of setup-dkml.yml 1890 - echo '__ run-in-docker __' >&2 1891 - cat .ci/sd4/run-in-docker >&2 1892 - echo '___________________' >&2 1893 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/run-with-env .ci/sd4/run-in-docker .ci/sd4/edr 1894 - 1895 - elif [ -n "${docker_runner:-}" ]; then 1896 - 1897 - cat >.ci/sd4/run-with-env <<EOF 1898 - #!/bin/sh 1899 - set -euf 1900 - exec ${docker_runner:-} /work/.ci/sd4/deescalate /work/.ci/sd4/run-in-docker "\$@" 1901 - EOF 1902 - chmod +x .ci/sd4/run-with-env 1903 - 1904 - validate_supports_docker 1905 - 1906 - # Bundle for consumers of setup-dkml.yml 1907 - echo '__ run-in-docker __' >&2 1908 - cat .ci/sd4/run-in-docker >&2 1909 - echo '________________________' >&2 1910 - echo '__ deescalate __' >&2 1911 - cat .ci/sd4/deescalate >&2 1912 - echo '________________' >&2 1913 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/run-with-env .ci/sd4/run-in-docker .ci/sd4/deescalate 1914 - 1915 - else 1916 - 1917 - cat >.ci/sd4/run-with-env <<EOF 1918 - #!/bin/sh 1919 - set -euf 1920 - 1921 - HERE=\$(dirname "\$0") 1922 - HERE=\$(cd "\$HERE" && pwd) 1923 - PROJECT_DIR=\$(cd "\$HERE"/../.. && pwd) 1924 - 1925 - export PATH="\${PROJECT_DIR}/.ci/local/bin:\${PROJECT_DIR}/.ci/sd4/bs/bin:\${PROJECT_DIR}/.ci/sd4/opamexe:\$PATH" 1926 - export OPAMROOT='${opam_root}' 1927 - export OPAMROOTISOK=1 1928 - if [ "${PATCH_OS_DISTRIBUTION_WIN32}" = true ]; then export OPAMVAR_os_distribution=win32; fi 1929 - if [ "${PATCH_EXE_WIN32}" = true ]; then export OPAMVAR_exe=.exe; fi 1930 - 1931 - # Reset environment so no conflicts with a parent Opam or OCaml system 1932 - unset OPAM_SWITCH_PREFIX 1933 - unset OPAMSWITCH 1934 - unset CAML_LD_LIBRARY_PATH 1935 - unset OCAMLLIB 1936 - unset OCAML_TOPLEVEL_PATH 1937 - 1938 - prog=\$1 1939 - shift 1940 - 1941 - # Optionally skip troubleshooting 1942 - troubleshooting=1 1943 - if [ "\$#" -ge 1 ] && [ "\$prog" = opam ] && [ "\$1" = "--no-troubleshooting" ]; then 1944 - shift 1945 - troubleshooting=0 1946 - fi 1947 - 1948 - echo "Running: \$prog \$*" >&2 1949 - set +e 1950 - "\$prog" "\$@" 1951 - exitcode=\$? 1952 - if [ \$troubleshooting = 1 ] && [ \$prog = opam ]; then 1953 - [ \$exitcode = 0 ] || "\${PROJECT_DIR}/.ci/sd4/troubleshoot-opam.sh" \$OPAMROOT 1954 - fi 1955 - exit \$exitcode 1956 - EOF 1957 - chmod +x .ci/sd4/run-with-env 1958 - 1959 - # Bundle for consumers of setup-dkml.yml 1960 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/run-with-env 1961 - 1962 - fi 1963 - echo '__ run-with-env __' >&2 1964 - cat .ci/sd4/run-with-env >&2 1965 - echo '__________________' >&2 1966 - 1967 - # ------ 1968 - # cmdrun 1969 - # ------ 1970 - 1971 - install -d .ci/sd4/opamrun 1972 - cat >.ci/sd4/opamrun/cmdrun <<EOF 1973 - #!/bin/sh 1974 - set -euf 1975 - 1976 - HERE=\$(dirname "\$0") 1977 - HERE=\$(cd "\$HERE" && pwd) 1978 - PROJECT_DIR=\$(cd "\$HERE"/../../.. && pwd) 1979 - 1980 - # Add MSVC compiler environment if available 1981 - if [ -e "\${PROJECT_DIR}/.ci/sd4/msvcenv" ]; then 1982 - _oldpath="\$PATH" 1983 - # shellcheck disable=SC1091 1984 - . "\${PROJECT_DIR}/.ci/sd4/msvcenv" 1985 - PATH="\$PATH:\$_oldpath" 1986 - 1987 - # MSVC (link.exe) needs a TMP as well. 1988 - # Confer: https://docs.microsoft.com/en-us/cpp/build/reference/linking?view=msvc-170#link-environment-variables 1989 - if [ -z "\${TMP:-}" ]; then 1990 - # GitHub Actions as of 2022-10 does not set TMP. GitLab CI/CD does. 1991 - TMP="\$RUNNER_TEMP" 1992 - fi 1993 - export TMP 1994 - if [ -x /usr/bin/cygpath ]; then 1995 - TMP=\$(/usr/bin/cygpath -aw "\$TMP") 1996 - fi 1997 - fi 1998 - 1999 - # Windows 2000 - if [ -n "\${COMSPEC:-}" ]; then 2001 - # We must place MSYS2 in front of path so that MSYS2 2002 - # tar.exe is used instead of Windows tar.exe. 2003 - PATH="/usr/bin:\$PATH" 2004 - fi 2005 - 2006 - exec "\${PROJECT_DIR}/.ci/sd4/run-with-env" "\$@" 2007 - EOF 2008 - chmod +x .ci/sd4/opamrun/cmdrun 2009 - 2010 - # ------- 2011 - # opamrun 2012 - # ------- 2013 - 2014 - install -d .ci/sd4/opamrun 2015 - cat >.ci/sd4/opamrun/opamrun <<EOF 2016 - #!/bin/sh 2017 - set -euf 2018 - 2019 - HERE=\$(dirname "\$0") 2020 - HERE=\$(cd "\$HERE" && pwd) 2021 - PROJECT_DIR=\$(cd "\$HERE"/../../.. && pwd) 2022 - 2023 - exec "\${PROJECT_DIR}/.ci/sd4/opamrun/cmdrun" opam "\$@" 2024 - EOF 2025 - chmod +x .ci/sd4/opamrun/opamrun 2026 - 2027 - # Bundle for consumers of setup-dkml.yml 2028 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/opamrun 2029 - } 2030 - section_begin 'write-opam-scripts' 'Write opam scripts' 2031 - do_write_opam_scripts 2032 - section_end 'write-opam-scripts' 2033 - 2034 - # Expose opamrun (also used for consumers of setup-dkml.yml) to GitHub 2035 - if [ -n "${GITHUB_PATH:-}" ]; then 2036 - opamrunabs="$setup_WORKSPACE/.ci/sd4/opamrun" 2037 - if [ -x /usr/bin/cygpath ]; then opamrunabs=$(/usr/bin/cygpath -aw "$opamrunabs"); fi 2038 - echo "$opamrunabs" >>"$GITHUB_PATH" 2039 - # Special case: GITHUB_PATH does not influence msys2.CMD of msys2/setup-msys2@v2, so place in real MSYS2 PATH 2040 - if [ -n "${MSYSTEM:-}" ]; then 2041 - install -d /usr/local/bin 2042 - install .ci/sd4/opamrun/opamrun /usr/local/bin/opamrun 2043 - fi 2044 - fi 2045 - 2046 - # Place opamrun in the immediate PATH 2047 - PATH="$setup_WORKSPACE/.ci/sd4/opamrun:$PATH" 2048 - 2049 - # Complicated Opam sequence is because: 2050 - # 1. Opam's default curl does not work on Windows, 2051 - # and `opam init` does not provide a way to change it (TODO: need 2052 - # a PR!). 2053 - # 2. We have to separate the Opam download cache from the other Opam 2054 - # caches 2055 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ] && [ ! -s "$opam_root/.ci.root-init" ]; then # non-empty init file so can be cached irrespective of existence 2056 - section_begin opam-init 'Initialize opam root' 2057 - 2058 - # Clear any partial previous attempt 2059 - rm -rf "$opam_root" 2060 - 2061 - case "$dkml_host_abi,${in_docker:-}" in 2062 - windows_*,*) 2063 - eor=$(cygpath -am "$setup_WORKSPACE"/.ci/sd4/eor) 2064 - opamrun init --disable-sandboxing --no-setup --kind local --bare "$eor" 2065 - case "$(opamrun --version)" in 2066 - 2.0.*) echo 'download-command: wget' >>"$opam_root/config" ;; 2067 - *) opamrun option --yes --global download-command=wget ;; 2068 - esac 2069 - ;; 2070 - *,true) 2071 - opamrun init --disable-sandboxing --no-setup --kind local --bare "/work/.ci/sd4/eor" 2072 - ;; 2073 - *) 2074 - opamrun init --disable-sandboxing --no-setup --kind local --bare "$setup_WORKSPACE/.ci/sd4/eor" 2075 - ;; 2076 - esac 2077 - echo yes > "$opam_root/.ci.root-init" 2078 - 2079 - section_end opam-init 2080 - fi 2081 - 2082 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2083 - section_begin opam-vars "Summary: opam global variables" 2084 - opamrun --no-troubleshooting var --global || true 2085 - section_end opam-vars 2086 - fi 2087 - 2088 - # Build OCaml 2089 - 2090 - do_switch_create() { 2091 - do_switch_create_NAME=$1 2092 - shift 2093 - 2094 - section_begin "switch-create-$do_switch_create_NAME" "Create opam switch '$do_switch_create_NAME'" 2095 - # Create, or recreate, the Opam switch. The Opam switch should not be 2096 - # cached except for the compiler (confer docs for setup-ocaml GitHub 2097 - # Action) which is the 'dkml' switch (or the 'two' switch). 2098 - # Check if the switch name is present in the Opam root (which may come from cache) 2099 - NOMINALLY_PRESENT=false 2100 - if opamrun switch list --short | grep "^${do_switch_create_NAME}\$"; then NOMINALLY_PRESENT=true; fi 2101 - 2102 - # Check if the switch is actually present in case of cache incoherence 2103 - # or corrupt Opam state that could result in: 2104 - # Error: No config file found for switch dkml. Switch broken? 2105 - if [ $NOMINALLY_PRESENT = true ] && [ ! -e "$opam_root/$do_switch_create_NAME/.opam-switch/switch-config" ]; then 2106 - # Remove the switch name from Opam root, and any partial switch state. 2107 - # Ignore inevitable warnings/failure about missing switch. 2108 - opamrun --no-troubleshooting switch remove "$do_switch_create_NAME" --yes || true 2109 - rm -rf "${opam_root:?}/$do_switch_create_NAME" 2110 - NOMINALLY_PRESENT=false 2111 - fi 2112 - 2113 - if [ $NOMINALLY_PRESENT = false ]; then 2114 - opamrun switch create "$do_switch_create_NAME" --empty --yes 2115 - fi 2116 - section_end "switch-create-$do_switch_create_NAME" 2117 - } 2118 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2119 - do_switch_create dkml 2120 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2121 - do_switch_create two 2122 - else 2123 - section_begin "switch-create-two" "Create empty opam switch 'two'" 2124 - # Always create a secondary switch ... just empty. Avoid problems with cache content missing 2125 - # and idempotency. 2126 - opamrun --no-troubleshooting switch remove two --yes || true 2127 - rm -rf "$opam_root/two" 2128 - opamrun switch create two --empty --yes 2129 - section_end "switch-create-two" 2130 - fi 2131 - fi 2132 - 2133 - do_switch_active() { 2134 - section_begin "switch-active" "Set dkml as active switch" 2135 - opamrun switch set dkml --yes 2136 - section_end "switch-active" 2137 - } 2138 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2139 - do_switch_active 2140 - fi 2141 - 2142 - do_opam_repositories_add() { 2143 - section_begin "opam-repo-add" "Add 'diskuv' opam repository" 2144 - if ! opamrun --no-troubleshooting repository list -s | grep '^diskuv'; then 2145 - opamrun repository add diskuv "git+https://github.com/diskuv/diskuv-opam-repository.git#${DISKUV_OPAM_REPOSITORY:-$DEFAULT_DISKUV_OPAM_REPOSITORY_TAG}" --yes --dont-select 2146 - fi 2147 - section_end "opam-repo-add" 2148 - } 2149 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2150 - do_opam_repositories_add 2151 - fi 2152 - 2153 - do_opam_repositories_config() { 2154 - do_opam_repositories_config_NAME=$1 2155 - shift 2156 - 2157 - section_begin "opam-repo-$do_opam_repositories_config_NAME" "Attach repositories to $do_opam_repositories_config_NAME" 2158 - 2159 - if [ ! -s "$opam_root/.ci.$do_opam_repositories_config_NAME.repo-init" ]; then # non-empty init file so can be cached irrespective of existence 2160 - opamrun --no-troubleshooting repository remove default --switch "$do_opam_repositories_config_NAME" --yes || true 2161 - opamrun --no-troubleshooting repository remove diskuv --switch "$do_opam_repositories_config_NAME" --yes || true 2162 - opamrun repository add default --switch "$do_opam_repositories_config_NAME" --yes 2163 - opamrun repository add diskuv --switch "$do_opam_repositories_config_NAME" --yes 2164 - echo yes > "$opam_root/.ci.$do_opam_repositories_config_NAME.repo-init" 2165 - fi 2166 - 2167 - section_end "opam-repo-$do_opam_repositories_config_NAME" 2168 - } 2169 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2170 - do_opam_repositories_config dkml 2171 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2172 - do_opam_repositories_config two 2173 - fi 2174 - fi 2175 - 2176 - do_opam_repositories_update() { 2177 - section_begin "opam-repo-update" "Update opam repositories" 2178 - # The default repository may be the initial 'eor' (empty) repository 2179 - opamrun repository set-url default https://opam.ocaml.org --yes 2180 - # Always set the `diskuv` repository url since it can change 2181 - opamrun repository set-url diskuv "git+https://github.com/diskuv/diskuv-opam-repository.git#${DISKUV_OPAM_REPOSITORY:-$DEFAULT_DISKUV_OPAM_REPOSITORY_TAG}" --yes --dont-select 2182 - # Update both `default` and `diskuv` Opam repositories 2183 - opamrun update default diskuv 2184 - section_end "opam-repo-update" 2185 - } 2186 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2187 - do_opam_repositories_update 2188 - fi 2189 - 2190 - do_pins() { 2191 - do_pins_NAME=$1 2192 - shift 2193 - 2194 - section_begin "opam-pins-$do_pins_NAME" "Opam pins for $do_pins_NAME switch" 2195 - ### BEGIN pin-adds. DO NOT EDIT THE LINES IN THIS SECTION 2196 - # Managed by bump-packages.cmake 2197 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version astring "${PIN_ASTRING}" 2198 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version base "${PIN_BASE}" 2199 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version base64 "${PIN_BASE64}" 2200 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version bigarray-compat "${PIN_BIGARRAY_COMPAT}" 2201 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version bos "${PIN_BOS}" 2202 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version camlp-streams "${PIN_CAMLP_STREAMS}" 2203 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version chrome-trace "${PIN_CHROME_TRACE}" 2204 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version cmdliner "${PIN_CMDLINER}" 2205 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version conf-dkml-sys-opam "${PIN_CONF_DKML_SYS_OPAM}" 2206 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version conf-pkg-config "${PIN_CONF_PKG_CONFIG}" 2207 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version conf-sqlite3 "${PIN_CONF_SQLITE3}" 2208 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version cppo "${PIN_CPPO}" 2209 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version crunch "${PIN_CRUNCH}" 2210 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version csexp "${PIN_CSEXP}" 2211 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version cstruct "${PIN_CSTRUCT}" 2212 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ctypes "${PIN_CTYPES}" 2213 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ctypes-foreign "${PIN_CTYPES_FOREIGN}" 2214 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version cudf "${PIN_CUDF}" 2215 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version digestif "${PIN_DIGESTIF}" 2216 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version diskuvbox "${PIN_DISKUVBOX}" 2217 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-apps "${PIN_DKML_APPS}" 2218 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-base-compiler "${PIN_DKML_BASE_COMPILER}" 2219 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-build-desktop "${PIN_DKML_BUILD_DESKTOP}" 2220 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-c-probe "${PIN_DKML_C_PROBE}" 2221 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-compiler-env "${PIN_DKML_COMPILER_ENV}" 2222 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-compiler-src "${PIN_DKML_COMPILER_SRC}" 2223 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-common-desktop "${PIN_DKML_COMPONENT_COMMON_DESKTOP}" 2224 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-common-opam "${PIN_DKML_COMPONENT_COMMON_OPAM}" 2225 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-common-unixutils "${PIN_DKML_COMPONENT_COMMON_UNIXUTILS}" 2226 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-ocamlcompiler-common "${PIN_DKML_COMPONENT_OCAMLCOMPILER_COMMON}" 2227 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-ocamlcompiler-network "${PIN_DKML_COMPONENT_OCAMLCOMPILER_NETWORK}" 2228 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-ocamlcompiler-offline "${PIN_DKML_COMPONENT_OCAMLCOMPILER_OFFLINE}" 2229 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-offline-desktop-full "${PIN_DKML_COMPONENT_OFFLINE_DESKTOP_FULL}" 2230 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-offline-opamshim "${PIN_DKML_COMPONENT_OFFLINE_OPAMSHIM}" 2231 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-offline-unixutils "${PIN_DKML_COMPONENT_OFFLINE_UNIXUTILS}" 2232 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-desktop-full "${PIN_DKML_COMPONENT_STAGING_DESKTOP_FULL}" 2233 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-dkmlconfdir "${PIN_DKML_COMPONENT_STAGING_DKMLCONFDIR}" 2234 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-ocamlrun "${PIN_DKML_COMPONENT_STAGING_OCAMLRUN}" 2235 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-opam32 "${PIN_DKML_COMPONENT_STAGING_OPAM32}" 2236 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-opam64 "${PIN_DKML_COMPONENT_STAGING_OPAM64}" 2237 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-unixutils "${PIN_DKML_COMPONENT_STAGING_UNIXUTILS}" 2238 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-withdkml "${PIN_DKML_COMPONENT_STAGING_WITHDKML}" 2239 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-xx-console "${PIN_DKML_COMPONENT_XX_CONSOLE}" 2240 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-exe "${PIN_DKML_EXE}" 2241 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-exe-lib "${PIN_DKML_EXE_LIB}" 2242 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-install "${PIN_DKML_INSTALL}" 2243 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-install-installer "${PIN_DKML_INSTALL_INSTALLER}" 2244 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-install-runner "${PIN_DKML_INSTALL_RUNNER}" 2245 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-installer-ocaml-common "${PIN_DKML_INSTALLER_OCAML_COMMON}" 2246 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-installer-ocaml-offline "${PIN_DKML_INSTALLER_OCAML_OFFLINE}" 2247 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-package-console "${PIN_DKML_PACKAGE_CONSOLE}" 2248 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-runtime-common "${PIN_DKML_RUNTIME_COMMON}" 2249 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-runtime-common-native "${PIN_DKML_RUNTIME_COMMON_NATIVE}" 2250 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-runtime-distribution "${PIN_DKML_RUNTIME_DISTRIBUTION}" 2251 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-runtimelib "${PIN_DKML_RUNTIMELIB}" 2252 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-runtimescripts "${PIN_DKML_RUNTIMESCRIPTS}" 2253 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-workflows "${PIN_DKML_WORKFLOWS}" 2254 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune "${PIN_DUNE}" 2255 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-action-plugin "${PIN_DUNE_ACTION_PLUGIN}" 2256 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-build-info "${PIN_DUNE_BUILD_INFO}" 2257 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-configurator "${PIN_DUNE_CONFIGURATOR}" 2258 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-glob "${PIN_DUNE_GLOB}" 2259 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-private-libs "${PIN_DUNE_PRIVATE_LIBS}" 2260 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-rpc "${PIN_DUNE_RPC}" 2261 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-rpc-lwt "${PIN_DUNE_RPC_LWT}" 2262 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-site "${PIN_DUNE_SITE}" 2263 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dyn "${PIN_DYN}" 2264 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version either "${PIN_EITHER}" 2265 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version eqaf "${PIN_EQAF}" 2266 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version extlib "${PIN_EXTLIB}" 2267 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ezjsonm "${PIN_EZJSONM}" 2268 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version feather "${PIN_FEATHER}" 2269 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version fiber "${PIN_FIBER}" 2270 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version fix "${PIN_FIX}" 2271 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version fmt "${PIN_FMT}" 2272 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version fpath "${PIN_FPATH}" 2273 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version graphics "${PIN_GRAPHICS}" 2274 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version hex "${PIN_HEX}" 2275 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version integers "${PIN_INTEGERS}" 2276 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version jane-street-headers "${PIN_JANE_STREET_HEADERS}" 2277 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version jingoo "${PIN_JINGOO}" 2278 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version jsonm "${PIN_JSONM}" 2279 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version jsonrpc "${PIN_JSONRPC}" 2280 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version jst-config "${PIN_JST_CONFIG}" 2281 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version lambda-term "${PIN_LAMBDA_TERM}" 2282 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version logs "${PIN_LOGS}" 2283 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version lsp "${PIN_LSP}" 2284 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version lwt "${PIN_LWT}" 2285 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version lwt_react "${PIN_LWT_REACT}" 2286 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version mccs "${PIN_MCCS}" 2287 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version mdx "${PIN_MDX}" 2288 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version menhir "${PIN_MENHIR}" 2289 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version menhirLib "${PIN_MENHIRLIB}" 2290 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version menhirSdk "${PIN_MENHIRSDK}" 2291 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version merlin-lib "${PIN_MERLIN_LIB}" 2292 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version metapp "${PIN_METAPP}" 2293 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version metaquot "${PIN_METAQUOT}" 2294 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version mew "${PIN_MEW}" 2295 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version mew_vi "${PIN_MEW_VI}" 2296 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version num "${PIN_NUM}" 2297 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocaml "${PIN_OCAML}" 2298 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocaml-compiler-libs "${PIN_OCAML_COMPILER_LIBS}" 2299 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocaml-lsp-server "${PIN_OCAML_LSP_SERVER}" 2300 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocaml-version "${PIN_OCAML_VERSION}" 2301 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocamlbuild "${PIN_OCAMLBUILD}" 2302 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocamlc-loc "${PIN_OCAMLC_LOC}" 2303 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocamlfind "${PIN_OCAMLFIND}" 2304 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocamlformat "${PIN_OCAMLFORMAT}" 2305 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocamlformat-lib "${PIN_OCAMLFORMAT_LIB}" 2306 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocamlformat-rpc-lib "${PIN_OCAMLFORMAT_RPC_LIB}" 2307 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocp-indent "${PIN_OCP_INDENT}" 2308 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocplib-endian "${PIN_OCPLIB_ENDIAN}" 2309 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version odoc "${PIN_ODOC}" 2310 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version odoc-parser "${PIN_ODOC_PARSER}" 2311 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ordering "${PIN_ORDERING}" 2312 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version parsexp "${PIN_PARSEXP}" 2313 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version pp "${PIN_PP}" 2314 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_assert "${PIN_PPX_ASSERT}" 2315 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_base "${PIN_PPX_BASE}" 2316 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_cold "${PIN_PPX_COLD}" 2317 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_compare "${PIN_PPX_COMPARE}" 2318 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_derivers "${PIN_PPX_DERIVERS}" 2319 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_deriving "${PIN_PPX_DERIVING}" 2320 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_enumerate "${PIN_PPX_ENUMERATE}" 2321 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_expect "${PIN_PPX_EXPECT}" 2322 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_globalize "${PIN_PPX_GLOBALIZE}" 2323 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_hash "${PIN_PPX_HASH}" 2324 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_here "${PIN_PPX_HERE}" 2325 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_ignore_instrumentation "${PIN_PPX_IGNORE_INSTRUMENTATION}" 2326 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_inline_test "${PIN_PPX_INLINE_TEST}" 2327 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_optcomp "${PIN_PPX_OPTCOMP}" 2328 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_pipebang "${PIN_PPX_PIPEBANG}" 2329 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_sexp_conv "${PIN_PPX_SEXP_CONV}" 2330 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_yojson_conv_lib "${PIN_PPX_YOJSON_CONV_LIB}" 2331 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppxlib "${PIN_PPXLIB}" 2332 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ptime "${PIN_PTIME}" 2333 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version qrc "${PIN_QRC}" 2334 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version re "${PIN_RE}" 2335 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version react "${PIN_REACT}" 2336 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version refl "${PIN_REFL}" 2337 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version result "${PIN_RESULT}" 2338 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version rresult "${PIN_RRESULT}" 2339 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version seq "${PIN_SEQ}" 2340 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version sexplib "${PIN_SEXPLIB}" 2341 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version sexplib0 "${PIN_SEXPLIB0}" 2342 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version sha "${PIN_SHA}" 2343 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version spawn "${PIN_SPAWN}" 2344 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version sqlite3 "${PIN_SQLITE3}" 2345 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version stdcompat "${PIN_STDCOMPAT}" 2346 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version stdio "${PIN_STDIO}" 2347 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version stdlib-shims "${PIN_STDLIB_SHIMS}" 2348 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version stdune "${PIN_STDUNE}" 2349 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version time_now "${PIN_TIME_NOW}" 2350 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version topkg "${PIN_TOPKG}" 2351 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version traverse "${PIN_TRAVERSE}" 2352 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version trie "${PIN_TRIE}" 2353 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version tsort "${PIN_TSORT}" 2354 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version tyxml "${PIN_TYXML}" 2355 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version uchar "${PIN_UCHAR}" 2356 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version utop "${PIN_UTOP}" 2357 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version uucp "${PIN_UUCP}" 2358 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version uuidm "${PIN_UUIDM}" 2359 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version uuseg "${PIN_UUSEG}" 2360 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version uutf "${PIN_UUTF}" 2361 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version with-dkml "${PIN_WITH_DKML}" 2362 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version xdg "${PIN_XDG}" 2363 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version yojson "${PIN_YOJSON}" 2364 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version zed "${PIN_ZED}" 2365 - ### END pin-adds. DO NOT EDIT THE LINES ABOVE 2366 - section_end "opam-pins-$do_pins_NAME" 2367 - 2368 - # -------------- 2369 - # REMAINING PINS 2370 - # -------------- 2371 - 2372 - # These come after [pin-adds] section since [pin-adds] may need to be overridden by 2373 - # users' choice. 2374 - 2375 - # dkml-base-compiler 2376 - 2377 - if [ "${DKML_COMPILER:-}" != '@repository@' ] && [ -z "${DKML_COMPILER:-}" ] && [ -z "${OCAML_COMPILER:-}" ]; then 2378 - section_begin checkout-dkml-base-compiler "Pin dkml-base-compiler to default ${DEFAULT_DKML_COMPILER} (neither dkml-base-compiler nor OCAML_COMPILER specified) for $do_pins_NAME switch" 2379 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action dkml-base-compiler "https://github.com/diskuv/dkml-compiler.git#${DEFAULT_DKML_COMPILER}" 2380 - section_end checkout-dkml-base-compiler 2381 - elif [ "${DKML_COMPILER:-}" != '@repository@' ] && [ -n "${DKML_COMPILER:-}" ] && [ -z "${OCAML_COMPILER:-}" ]; then 2382 - section_begin checkout-dkml-base-compiler "Pin dkml-base-compiler to $DKML_COMPILER (dkml-base-compiler specified; no OCAML_COMPILER specified) for $do_pins_NAME switch" 2383 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action dkml-base-compiler "https://github.com/diskuv/dkml-compiler.git#${DKML_COMPILER}" 2384 - section_end checkout-dkml-base-compiler 2385 - elif [ -n "${OCAML_COMPILER:-}" ]; then 2386 - # Validate OCAML_COMPILER (OCAML_COMPILER specified) 2387 - case "${OCAML_COMPILER:-}" in 2388 - 4.12.1) true ;; 2389 - 4.14.0) true ;; 2390 - *) 2391 - echo "OCAML_COMPILER version ${OCAML_COMPILER:-} is not supported" >&2 2392 - exit 109 2393 - ;; 2394 - esac 2395 - 2396 - section_begin checkout-dkml-base-compiler "Pin dkml-base-compiler (OCAML_COMPILER specified) for $do_pins_NAME switch" 2397 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action dkml-base-compiler "https://github.com/diskuv/dkml-compiler.git#${OCAML_COMPILER}-v${DKML_VERSION}" 2398 - section_end checkout-dkml-base-compiler 2399 - fi 2400 - 2401 - # conf-dkml-cross-toolchain 2402 - 2403 - if [ "${CONF_DKML_CROSS_TOOLCHAIN:-}" != '@repository@' ]; then 2404 - section_begin checkout-conf-dkml-cross-toolchain "Pin conf-dkml-cross-toolchain for $do_pins_NAME switch" 2405 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action conf-dkml-cross-toolchain "https://github.com/diskuv/conf-dkml-cross-toolchain.git#$CONF_DKML_CROSS_TOOLCHAIN" 2406 - section_end checkout-conf-dkml-cross-toolchain 2407 - fi 2408 - } 2409 - 2410 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2411 - do_pins dkml 2412 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2413 - do_pins two 2414 - fi 2415 - fi 2416 - 2417 - do_use_vsstudio() { 2418 - do_use_vsstudio_NAME=$1 2419 - shift 2420 - case "$dkml_host_abi" in 2421 - windows_*) 2422 - section_begin "use-vsstudio-$do_use_vsstudio_NAME" "Use Visual Studio in dkml-* Opam packages (Windows) for $do_use_vsstudio_NAME switch" 2423 - 2424 - # shellcheck disable=SC2153 2425 - E_VS_DIR=$(escape_arg_as_ocaml_string "$VS_DIR") 2426 - # shellcheck disable=SC2153 2427 - E_VS_VCVARSVER=$(escape_arg_as_ocaml_string "$VS_VCVARSVER") 2428 - # shellcheck disable=SC2153 2429 - E_VS_WINSDKVER=$(escape_arg_as_ocaml_string "$VS_WINSDKVER") 2430 - # shellcheck disable=SC2153 2431 - E_VS_MSVSPREFERENCE=$(escape_arg_as_ocaml_string "$VS_MSVSPREFERENCE") 2432 - # shellcheck disable=SC2153 2433 - E_VS_CMAKEGENERATOR=$(escape_arg_as_ocaml_string "$VS_CMAKEGENERATOR") 2434 - 2435 - case "$(opamrun --version)" in 2436 - 2.0.*) 2437 - if [ "${in_docker}" = "true" ]; then 2438 - echo Opam 2.0 support in dockcross to use a portable opam var prefix not yet implemented 2439 - exit 67 2440 - fi 2441 - OP=$(opamrun var prefix --switch "$do_use_vsstudio_NAME") 2442 - OPSC=$OP/.opam-switch/switch-config 2443 - if grep setenv: "$OPSC"; then 2444 - echo "INFO: Updating switch-config. Old was:" 2445 - awk '{print ">> " $0}' "$OPSC" 2446 - 2447 - awk '$1=="setenv:"{x=1} x==0{print} x==1 && $0=="]"{x=0}' "$OPSC" >"$OPSC".trimmed 2448 - mv "$OPSC".trimmed "$OPSC" 2449 - fi 2450 - echo 'setenv: [' >>"$OPSC" 2451 - echo ' [DKML_COMPILE_SPEC = "1"]' >>"$OPSC" 2452 - echo ' [DKML_COMPILE_TYPE = "VS"]' >>"$OPSC" 2453 - echo " [DKML_COMPILE_VS_DIR = \"$E_VS_DIR\"]" >>"$OPSC" 2454 - echo " [DKML_COMPILE_VS_VCVARSVER = \"$E_VS_VCVARSVER\"]" >>"$OPSC" 2455 - echo " [DKML_COMPILE_VS_WINSDKVER = \"$E_VS_WINSDKVER\"]" >>"$OPSC" 2456 - echo " [DKML_COMPILE_VS_MSVSPREFERENCE = \"$E_VS_MSVSPREFERENCE\"]" >>"$OPSC" 2457 - echo " [DKML_COMPILE_VS_CMAKEGENERATOR = \"$E_VS_CMAKEGENERATOR\"]" >>"$OPSC" 2458 - echo " [DKML_HOST_ABI = \"${dkml_host_abi}\"]" >>"$OPSC" 2459 - echo ']' >>"$OPSC" 2460 - cat "$OPSC" >&2 # print 2461 - ;; 2462 - *) 2463 - opamrun option --switch "$do_use_vsstudio_NAME" setenv= # reset 2464 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+='DKML_COMPILE_SPEC = "1"' 2465 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+='DKML_COMPILE_TYPE = "VS"' 2466 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_DIR = \"$E_VS_DIR\"" 2467 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_VCVARSVER = \"$E_VS_VCVARSVER\"" 2468 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_WINSDKVER = \"$E_VS_WINSDKVER\"" 2469 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_MSVSPREFERENCE = \"$E_VS_MSVSPREFERENCE\"" 2470 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_CMAKEGENERATOR = \"$E_VS_CMAKEGENERATOR\"" 2471 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_HOST_ABI = \"${dkml_host_abi}\"" 2472 - opamrun option --switch "$do_use_vsstudio_NAME" setenv # print 2473 - ;; 2474 - esac 2475 - 2476 - # shellcheck disable=SC2016 2477 - opamrun exec --switch "$do_use_vsstudio_NAME" -- sh -c 'echo $VCToolsRedistDir' 2478 - 2479 - section_end "use-vsstudio-$do_use_vsstudio_NAME" 2480 - ;; 2481 - esac 2482 - } 2483 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2484 - do_use_vsstudio dkml 2485 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2486 - do_use_vsstudio two 2487 - fi 2488 - fi 2489 - 2490 - # Because dune.X.Y.Z+shim (and any user DKML packages) requires DKML installed (after all, it is just 2491 - # a with-dkml.exe shim), we need either dkmlvars-v2.sexp or DKML environment 2492 - # variables. Confer: Dkml_runtimelib.Dkml_context.get_dkmlversion 2493 - # 2494 - # grep matches either: 2495 - # [... [DiskuvOCamlVersion = "1.0.1"] ...] 2496 - # DiskuvOCamlVersion = "1.0.1" 2497 - do_setenv() { 2498 - do_setenv_SWITCH=$1 2499 - shift 2500 - section_begin "setenv-$do_setenv_SWITCH" "Set opam option for $do_setenv_SWITCH switch" 2501 - opamrun option --switch "$do_setenv_SWITCH" setenv > ".ci/sd4/setenv.$do_setenv_SWITCH.txt" 2502 - if ! grep -q '\(^|\[\)DiskuvOCamlVarsVersion ' ".ci/sd4/setenv.$do_setenv_SWITCH.txt"; then 2503 - opamrun option --switch "$do_setenv_SWITCH" setenv+='DiskuvOCamlVarsVersion = "2"' 2504 - fi 2505 - if ! grep -q '\(^|\[\)DiskuvOCamlVersion ' ".ci/sd4/setenv.$do_setenv_SWITCH.txt"; then 2506 - opamrun option --switch "$do_setenv_SWITCH" setenv+="DiskuvOCamlVersion = \"$DKML_VERSION\"" 2507 - fi 2508 - if [ "$do_setenv_SWITCH" = dkml ] && [ -n "${DKML_HOME:-}" ]; then 2509 - do_setenv_DKMLHOME_ESCAPED="$DKML_HOME" 2510 - do_setenv_USRBIN_ESCAPED="$DKML_HOME/usr/bin" 2511 - do_setenv_BIN_ESCAPED="$DKML_HOME/bin" 2512 - if [ -x /usr/bin/cygpath ]; then 2513 - do_setenv_DKMLHOME_ESCAPED=$(/usr/bin/cygpath -aw "$do_setenv_DKMLHOME_ESCAPED" | sed 's/\\/\\\\/g') 2514 - do_setenv_USRBIN_ESCAPED=$(/usr/bin/cygpath -aw "$do_setenv_USRBIN_ESCAPED" | sed 's/\\/\\\\/g') 2515 - do_setenv_BIN_ESCAPED=$(/usr/bin/cygpath -aw "$do_setenv_BIN_ESCAPED" | sed 's/\\/\\\\/g') 2516 - fi 2517 - if ! grep -q '\(^|\[\)DiskuvOCamlHome ' ".ci/sd4/setenv.$do_setenv_SWITCH.txt"; then 2518 - opamrun option --switch "$do_setenv_SWITCH" setenv+="DiskuvOCamlHome = \"$do_setenv_DKMLHOME_ESCAPED\"" 2519 - fi 2520 - if ! grep -q '\(^|\[\)DiskuvOCamlBinaryPaths ' ".ci/sd4/setenv.$do_setenv_SWITCH.txt"; then 2521 - opamrun option --switch "$do_setenv_SWITCH" setenv+="DiskuvOCamlBinaryPaths = \"$do_setenv_USRBIN_ESCAPED;$do_setenv_BIN_ESCAPED\"" 2522 - fi 2523 - if ! grep -q '\(^|\[\)DiskuvOCamlDeploymentId ' ".ci/sd4/setenv.$do_setenv_SWITCH.txt"; then 2524 - opamrun option --switch "$do_setenv_SWITCH" setenv+="DiskuvOCamlDeploymentId = \"setup-dkml-switch-$do_setenv_SWITCH\"" 2525 - fi 2526 - fi 2527 - case "${dkml_host_abi}" in 2528 - windows_*) 2529 - if ! grep -q '\(^|\[\)DiskuvOCamlMSYS2Dir ' ".ci/sd4/setenv.$do_setenv_SWITCH.txt"; then 2530 - if [ -x /usr/bin/cygpath ]; then 2531 - MSYS2_DIR_NATIVE=$(/usr/bin/cygpath -aw /) 2532 - else 2533 - # If we are already inside MSYS2 then MSYSTEM_PREFIX should be set. But cygpath should be there as well!! 2534 - echo "FATAL: Could not locate MSYS2: there was no cygpath" >&2 2535 - exit 3 2536 - fi 2537 - MSYS2_DIR_NATIVE_ESCAPED=$(printf "%s" "$MSYS2_DIR_NATIVE" | sed 's/\\/\\\\/g') 2538 - opamrun option --switch "$do_setenv_SWITCH" setenv+="DiskuvOCamlMSYS2Dir = \"$MSYS2_DIR_NATIVE_ESCAPED\"" 2539 - fi 2540 - esac 2541 - section_end "setenv-$do_setenv_SWITCH" 2542 - } 2543 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2544 - do_setenv dkml 2545 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2546 - do_setenv two 2547 - fi 2548 - fi 2549 - 2550 - do_install_compiler() { 2551 - do_install_compiler_NAME=$1 2552 - shift 2553 - section_begin "install-compiler-$do_install_compiler_NAME" "Install OCaml compiler for $do_install_compiler_NAME switch" 2554 - opamrun pin list --switch "$do_install_compiler_NAME" 2555 - # shellcheck disable=SC2086 2556 - opamrun upgrade --switch "$do_install_compiler_NAME" --yes dkml-base-compiler conf-dkml-cross-toolchain ${ocaml_options:-} 2557 - section_end "install-compiler-$do_install_compiler_NAME" 2558 - } 2559 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2560 - if ! [ "${PRIMARY_SWITCH_SKIP_INSTALL:-}" = "true" ]; then 2561 - do_install_compiler dkml 2562 - fi 2563 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2564 - do_install_compiler two 2565 - fi 2566 - fi 2567 - 2568 - do_summary() { 2569 - do_summary_NAME=$1 2570 - shift 2571 - section_begin "summary-$do_summary_NAME" "Summary: $do_summary_NAME switch" 2572 - opamrun var --switch "$do_summary_NAME" 2573 - opamrun exec --switch "$do_summary_NAME" -- ocamlc -config 2574 - section_end "summary-$do_summary_NAME" 2575 - } 2576 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2577 - do_summary dkml 2578 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2579 - do_summary two 2580 - fi 2581 - fi 2582 - 2583 - '@ 2584 - Set-Content -Path ".ci\sd4\run-setup-dkml.sh" -Encoding Unicode -Value $Content 2585 - msys64\usr\bin\bash -lc 'dos2unix .ci/sd4/run-setup-dkml.sh' 2586 - 2587 - $Content = @' 2588 - # MSVC environment variables: 2589 - # 1. https://docs.microsoft.com/en-us/cpp/build/reference/cl-environment-variables?view=msvc-170 2590 - # 2. https://docs.microsoft.com/en-us/cpp/build/reference/linking?view=msvc-170#link-environment-variables (except TMP) 2591 - # 3. VCToolsRedistDir: https://docs.microsoft.com/en-us/cpp/windows/redistributing-visual-cpp-files?view=msvc-170#locate-the-redistributable-files 2592 - BEGIN{FS="="} 2593 - $1=="CL"||$1=="_CL_"||$1=="INCLUDE"||$1=="LIBPATH" {print "export " $0} 2594 - $1=="LINK"||$1=="_LINK_"||$1=="LIB"||$1=="PATH" {print "export " $0} 2595 - $1=="VCToolsRedistDir" {print "export " $0} 2596 - 2597 - '@ 2598 - Set-Content -Path ".ci\sd4\msvcenv.awk" -Encoding Unicode -Value $Content 2599 - msys64\usr\bin\bash -lc 'dos2unix .ci/sd4/msvcenv.awk' 2600 - 2601 - 2602 - $Content = @' 2603 - { 2604 - # trim leading and trailing space 2605 - sub(/^ */, ""); 2606 - sub(/ *$/, ""); 2607 - 2608 - print "export PATH='" $0 "'"; 2609 - } 2610 - '@ 2611 - Set-Content -Path ".ci\sd4\msvcpath.awk" -Encoding Unicode -Value $Content 2612 - msys64\usr\bin\bash -lc 'dos2unix .ci/sd4/msvcpath.awk' 2613 - 2614 - # PowerShell (UTF-16) and Batch (ANSI) scripts 2615 - 2616 - 2617 - $Content = @' 2618 - # Diagnose Visual Studio environment variables (Windows) 2619 - # This wastes time and has lots of rows! Only run if "VERBOSE" GitHub input key. 2620 - if ( "${env:VERBOSE}" -eq "true" ) { 2621 - if (Test-Path -Path "C:\Program Files (x86)\Windows Kits\10\include") { 2622 - Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\include" 2623 - } 2624 - if (Test-Path -Path "C:\Program Files (x86)\Windows Kits\10\Extension SDKs\WindowsDesktop") { 2625 - Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\Extension SDKs\WindowsDesktop" 2626 - } 2627 - 2628 - $env:PSModulePath += "$([System.IO.Path]::PathSeparator).ci\sd4\g\dkml-runtime-distribution\src\windows" 2629 - Import-Module Machine 2630 - 2631 - $allinstances = Get-VSSetupInstance 2632 - $allinstances | ConvertTo-Json -Depth 5 2633 - } 2634 - 2635 - # Make export expression [SN]NAME=[SV]VALUE[EV] 2636 - # where [SN] is start name and [SV] and [EV] are start and end value 2637 - if (("${env:GITLAB_CI}" -eq "true") -or ("${env:PC_CI}" -eq "true")) { 2638 - # Executed immediately in POSIX shell, so must be a real POSIX shell variable declaration 2639 - $ExportSN = "export " 2640 - $ExportSV = "'" 2641 - $ExportEV = "'" 2642 - $ExportExt = ".sh" 2643 - } else { 2644 - # Goes into $env:GITHUB_ENV, so must be plain NAME=VALUE 2645 - $ExportSN = "" 2646 - $ExportSV = "" 2647 - $ExportEV = "" 2648 - $ExportExt = ".github" 2649 - } 2650 - 2651 - # Locate Visual Studio (Windows) 2652 - if ("${env:vsstudio_dir}" -eq "" -and (!(Test-Path -Path .ci/sd4/vsenv${ExportExt}) -or !(Test-Path -Path .ci/sd4/vsenv.ps1))) { 2653 - $env:PSModulePath += "$([System.IO.Path]::PathSeparator).ci\sd4\g\dkml-runtime-distribution\src\windows" 2654 - Import-Module Machine 2655 - 2656 - $CompatibleVisualStudios = Get-CompatibleVisualStudios -ErrorIfNotFound 2657 - $CompatibleVisualStudios 2658 - $ChosenVisualStudio = ($CompatibleVisualStudios | Select-Object -First 1) 2659 - $VisualStudioProps = Get-VisualStudioProperties -VisualStudioInstallation $ChosenVisualStudio 2660 - $VisualStudioProps 2661 - 2662 - Write-Output "${ExportSN}VS_DIR=${ExportSV}$($VisualStudioProps.InstallPath)${ExportEV}" > .ci/sd4/vsenv${ExportExt} 2663 - Write-Output "${ExportSN}VS_VCVARSVER=${ExportSV}$($VisualStudioProps.VcVarsVer)${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2664 - Write-Output "${ExportSN}VS_WINSDKVER=${ExportSV}$($VisualStudioProps.WinSdkVer)${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2665 - Write-Output "${ExportSN}VS_MSVSPREFERENCE=${ExportSV}$($VisualStudioProps.MsvsPreference)${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2666 - Write-Output "${ExportSN}VS_CMAKEGENERATOR=${ExportSV}$($VisualStudioProps.CMakeGenerator)${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2667 - 2668 - Write-Output "`$env:VS_DIR='$($VisualStudioProps.InstallPath)'" > .ci/sd4/vsenv.ps1 2669 - Write-Output "`$env:VS_VCVARSVER='$($VisualStudioProps.VcVarsVer)'" >> .ci/sd4/vsenv.ps1 2670 - Write-Output "`$env:VS_WINSDKVER='$($VisualStudioProps.WinSdkVer)'" >> .ci/sd4/vsenv.ps1 2671 - Write-Output "`$env:VS_MSVSPREFERENCE='$($VisualStudioProps.MsvsPreference)'" >> .ci/sd4/vsenv.ps1 2672 - Write-Output "`$env:VS_CMAKEGENERATOR='$($VisualStudioProps.CMakeGenerator)'" >> .ci/sd4/vsenv.ps1 2673 - } 2674 - 2675 - # Link to hardcoded Visual Studio (Windows) 2676 - if ("${env:vsstudio_dir}" -ne "") { 2677 - Write-Output "${ExportSN}VS_DIR=${ExportSV}${env:vsstudio_dir}${ExportEV}" > .ci/sd4/vsenv${ExportExt} 2678 - Write-Output "${ExportSN}VS_VCVARSVER=${ExportSV}${env:vsstudio_vcvarsver}${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2679 - Write-Output "${ExportSN}VS_WINSDKVER=${ExportSV}${env:vsstudio_winsdkver}${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2680 - Write-Output "${ExportSN}VS_MSVSPREFERENCE=${ExportSV}${env:vsstudio_msvspreference}${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2681 - Write-Output "${ExportSN}VS_CMAKEGENERATOR=${ExportSV}${env:vsstudio_cmakegenerator}${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2682 - 2683 - Write-Output "`$env:VS_DIR='${env:vsstudio_dir}'" > .ci/sd4/vsenv.ps1 2684 - Write-Output "`$env:VS_VCVARSVER='${env:vsstudio_vcvarsver}'" >> .ci/sd4/vsenv.ps1 2685 - Write-Output "`$env:VS_WINSDKVER='${env:vsstudio_winsdkver}'" >> .ci/sd4/vsenv.ps1 2686 - Write-Output "`$env:VS_MSVSPREFERENCE='${env:vsstudio_msvspreference}'" >> .ci/sd4/vsenv.ps1 2687 - Write-Output "`$env:VS_CMAKEGENERATOR='${env:vsstudio_cmakegenerator}'" >> .ci/sd4/vsenv.ps1 2688 - } 2689 - 2690 - '@ 2691 - Set-Content -Path ".ci\sd4\config-vsstudio.ps1" -Encoding Unicode -Value $Content 2692 - 2693 - 2694 - $Content = @' 2695 - @ECHO OFF 2696 - 2697 - REM The OCaml dkml-base-compiler will compile fine but any other 2698 - REM packages (ocamlbuild, etc.) which 2699 - REM need a native compiler will fail without the MSVC compiler in the 2700 - REM PATH. There isn't a `with-dkml.exe` alternative available at 2701 - REM this stage of the GitHub workflow. 2702 - SET VSCMD_DEBUG=2 2703 - SET VSCMD_SKIP_SENDTELEMETRY=1 2704 - call "%VS_DIR%\Common7\Tools\VsDevCmd.bat" -no_logo -host_arch=%vsstudio_hostarch% -arch=%vsstudio_arch% -vcvars_ver=%VS_VCVARSVER% -winsdk=%VS_WINSDKVER% 2705 - if %ERRORLEVEL% neq 0 ( 2706 - echo. 2707 - echo.The "%VS_DIR%\Common7\Tools\VsDevCmd.bat" command failed 2708 - echo.with exit code %ERRORLEVEL%. 2709 - echo. 2710 - exit /b %ERRORLEVEL% 2711 - ) 2712 - 2713 - REM VsDevCmd.bat turns off echo; be explicit if we want it on or off 2714 - @echo OFF 2715 - 2716 - REM MSVC environment variables in Unix format. 2717 - echo %PATH% > .ci\sd4\msvcpath 2718 - 2719 - 2720 - REM * We can't use `bash -lc` directly to query for all MSVC environment variables 2721 - REM because it stomps over the PATH. So we are inside a Batch script to do the query. 2722 - msys64\usr\bin\bash -lc "set | grep -v '^PATH=' | awk -f .ci/sd4/msvcenv.awk > .ci/sd4/msvcenv" 2723 - '@ 2724 - Set-Content -Path ".ci\sd4\get-msvcpath-into-msys2.bat" -Encoding Default -Value $Content 2725 - 2726 - msys64\usr\bin\bash -lc "sh .ci/sd4/run-checkout-code.sh PC_PROJECT_DIR '${env:PC_PROJECT_DIR}'" 2727 - if ($LASTEXITCODE -ne 0) { 2728 - throw "run-checkout-code.sh failed" 2729 - } 2730 - 2731 - # Diagnose Visual Studio environment variables (Windows) 2732 - # This wastes time and has lots of rows! Only run if "VERBOSE" GitHub input key. 2733 - 2734 - If ( "${env:VERBOSE}" -eq "true" ) { 2735 - if (Test-Path -Path "C:\Program Files (x86)\Windows Kits\10\include") { 2736 - Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\include" 2737 - } 2738 - if (Test-Path -Path "C:\Program Files (x86)\Windows Kits\10\Extension SDKs\WindowsDesktop") { 2739 - Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\Extension SDKs\WindowsDesktop" 2740 - } 2741 - 2742 - $env:PSModulePath += "$([System.IO.Path]::PathSeparator).ci\sd4\g\dkml-runtime-distribution\src\windows" 2743 - Import-Module Machine 2744 - 2745 - $allinstances = Get-VSSetupInstance 2746 - $allinstances | ConvertTo-Json -Depth 5 2747 - } 2748 - .ci\sd4\config-vsstudio.ps1 2749 - msys64\usr\bin\bash -lc "dos2unix .ci/sd4/vsenv.sh" 2750 - Get-Content .ci/sd4/vsenv.sh 2751 - Get-Content .ci/sd4/vsenv.ps1 2752 - 2753 - # Capture Visual Studio compiler environment 2754 - & .ci\sd4\vsenv.ps1 2755 - & .ci\sd4\get-msvcpath-into-msys2.bat 2756 - msys64\usr\bin\bash -lc "cat .ci/sd4/msvcpath | tr -d '\r' | cygpath --path -f - | awk -f .ci/sd4/msvcpath.awk >> .ci/sd4/msvcenv" 2757 - msys64\usr\bin\bash -lc "tail -n100 .ci/sd4/msvcpath .ci/sd4/msvcenv" 2758 - 2759 - msys64\usr\bin\bash -lc "sh .ci/sd4/run-setup-dkml.sh PC_PROJECT_DIR '${env:PC_PROJECT_DIR}'" 2760 - if ($LASTEXITCODE -ne 0) { 2761 - throw "run-setup-dkml.sh failed" 2762 - } 2763 - 2764 - ########################### script ############################### 2765 - 2766 - Write-Host @" 2767 - Finished setup. 2768 - 2769 - To continue your testing, run in PowerShell: 2770 - `$env:CHERE_INVOKING = "yes" 2771 - `$env:MSYSTEM = "$env:msys2_system" 2772 - `$env:dkml_host_abi = "$env:dkml_host_abi" 2773 - `$env:abi_pattern = "$env:abi_pattern" 2774 - `$env:opam_root = "$env:opam_root" 2775 - `$env:exe_ext = "$env:exe_ext" 2776 - 2777 - Now you can use 'opamrun' to do opam commands like: 2778 - 2779 - msys64\usr\bin\bash -lc 'PATH="`$PWD/.ci/sd4/opamrun:`$PATH"; opamrun install XYZ.opam' 2780 - msys64\usr\bin\bash -lc 'PATH="`$PWD/.ci/sd4/opamrun:`$PATH"; opamrun exec -- bash' 2781 - msys64\usr\bin\bash -lc 'sh ci/build-test.sh' 2782 - "@
-2781
.ci/dkml-compilers/pc/setup-dkml-windows_x86_64.ps1
··· 1 - # setup-dkml 2 - # Short form: sd4 3 - 4 - <# 5 - .SYNOPSIS 6 - 7 - Setup Diskuv OCaml (DKML) compiler on a desktop PC. 8 - 9 - .DESCRIPTION 10 - 11 - Setup Diskuv OCaml (DKML) compiler on a desktop PC. 12 - 13 - .PARAMETER PC_PROJECT_DIR 14 - Context variable for the project directory. Defaults to the current directory. 15 - 16 - .PARAMETER FDOPEN_OPAMEXE_BOOTSTRAP 17 - Input variable. 18 - 19 - .PARAMETER CACHE_PREFIX 20 - Input variable. 21 - 22 - .PARAMETER OCAML_COMPILER 23 - Input variable. -DKML_COMPILER takes priority. If -DKML_COMPILER is not set and -OCAML_COMPILER is set, then the specified OCaml version tag of dkml-compiler (ex. 4.12.1) is used. 24 - 25 - .PARAMETER DKML_COMPILER 26 - Input variable. Unspecified or blank is the latest from the default branch (main) of dkml-compiler. @repository@ is the latest from Opam. 27 - 28 - .PARAMETER SKIP_OPAM_MODIFICATIONS 29 - Input variable. If true (the default is false) then the opam root and switches will not be created or modified. 30 - 31 - .PARAMETER SECONDARY_SWITCH 32 - Input variable. If true then the secondary switch named 'two' is created. 33 - 34 - .PARAMETER PRIMARY_SWITCH_SKIP_INSTALL 35 - Input variable. If true no dkml-base-compiler will be installed in the 'dkml' switch. 36 - 37 - .PARAMETER CONF_DKML_CROSS_TOOLCHAIN 38 - Input variable. Unspecified or blank is the latest from the default branch (main) of conf-dkml-cross-toolchain. @repository@ is the latest from Opam. 39 - 40 - .PARAMETER DISKUV_OPAM_REPOSITORY 41 - Input variable. Defaults to the value of -DEFAULT_DISKUV_OPAM_REPOSITORY_TAG (see below) 42 - 43 - .PARAMETER DKML_HOME 44 - Input variables. If specified then DiskuvOCamlHome, DiskuvOCamlBinaryPaths and DiskuvOCamlDeploymentId will be set, in addition to the always-present DiskuvOCamlVarsVersion, DiskuvOCamlVersion 45 - and DiskuvOCamlMSYS2Dir. 46 - 47 - # autogen from global_env_vars. 48 - .PARAMETER DKML_VERSION 49 - Environment variable. 50 - 51 - .PARAMETER DEFAULT_DISKUV_OPAM_REPOSITORY_TAG 52 - Environment variable. 53 - 54 - .PARAMETER DEFAULT_DKML_COMPILER 55 - Environment variable. 56 - 57 - .PARAMETER PIN_ASTRING 58 - Environment variable. 59 - 60 - .PARAMETER PIN_BASE 61 - Environment variable. 62 - 63 - .PARAMETER PIN_BASE64 64 - Environment variable. 65 - 66 - .PARAMETER PIN_BIGARRAY_COMPAT 67 - Environment variable. 68 - 69 - .PARAMETER PIN_BOS 70 - Environment variable. 71 - 72 - .PARAMETER PIN_CAMLP_STREAMS 73 - Environment variable. 74 - 75 - .PARAMETER PIN_CHROME_TRACE 76 - Environment variable. 77 - 78 - .PARAMETER PIN_CMDLINER 79 - Environment variable. 80 - 81 - .PARAMETER PIN_CONF_DKML_SYS_OPAM 82 - Environment variable. 83 - 84 - .PARAMETER PIN_CONF_PKG_CONFIG 85 - Environment variable. 86 - 87 - .PARAMETER PIN_CONF_SQLITE3 88 - Environment variable. 89 - 90 - .PARAMETER PIN_CPPO 91 - Environment variable. 92 - 93 - .PARAMETER PIN_CRUNCH 94 - Environment variable. 95 - 96 - .PARAMETER PIN_CSEXP 97 - Environment variable. 98 - 99 - .PARAMETER PIN_CSTRUCT 100 - Environment variable. 101 - 102 - .PARAMETER PIN_CTYPES_FOREIGN 103 - Environment variable. 104 - 105 - .PARAMETER PIN_CTYPES 106 - Environment variable. 107 - 108 - .PARAMETER PIN_CUDF 109 - Environment variable. 110 - 111 - .PARAMETER PIN_DIGESTIF 112 - Environment variable. 113 - 114 - .PARAMETER PIN_DISKUVBOX 115 - Environment variable. 116 - 117 - .PARAMETER PIN_DKML_APPS 118 - Environment variable. 119 - 120 - .PARAMETER PIN_DKML_BASE_COMPILER 121 - Environment variable. 122 - 123 - .PARAMETER PIN_DKML_BUILD_DESKTOP 124 - Environment variable. 125 - 126 - .PARAMETER PIN_DKML_C_PROBE 127 - Environment variable. 128 - 129 - .PARAMETER PIN_DKML_COMPILER_ENV 130 - Environment variable. 131 - 132 - .PARAMETER PIN_DKML_COMPILER_SRC 133 - Environment variable. 134 - 135 - .PARAMETER PIN_DKML_COMPONENT_COMMON_DESKTOP 136 - Environment variable. 137 - 138 - .PARAMETER PIN_DKML_COMPONENT_COMMON_OPAM 139 - Environment variable. 140 - 141 - .PARAMETER PIN_DKML_COMPONENT_COMMON_UNIXUTILS 142 - Environment variable. 143 - 144 - .PARAMETER PIN_DKML_COMPONENT_OCAMLCOMPILER_COMMON 145 - Environment variable. 146 - 147 - .PARAMETER PIN_DKML_COMPONENT_OCAMLCOMPILER_NETWORK 148 - Environment variable. 149 - 150 - .PARAMETER PIN_DKML_COMPONENT_OCAMLCOMPILER_OFFLINE 151 - Environment variable. 152 - 153 - .PARAMETER PIN_DKML_COMPONENT_OFFLINE_DESKTOP_FULL 154 - Environment variable. 155 - 156 - .PARAMETER PIN_DKML_COMPONENT_OFFLINE_OPAMSHIM 157 - Environment variable. 158 - 159 - .PARAMETER PIN_DKML_COMPONENT_OFFLINE_UNIXUTILS 160 - Environment variable. 161 - 162 - .PARAMETER PIN_DKML_COMPONENT_STAGING_DESKTOP_FULL 163 - Environment variable. 164 - 165 - .PARAMETER PIN_DKML_COMPONENT_STAGING_DKMLCONFDIR 166 - Environment variable. 167 - 168 - .PARAMETER PIN_DKML_COMPONENT_STAGING_OCAMLRUN 169 - Environment variable. 170 - 171 - .PARAMETER PIN_DKML_COMPONENT_STAGING_OPAM32 172 - Environment variable. 173 - 174 - .PARAMETER PIN_DKML_COMPONENT_STAGING_OPAM64 175 - Environment variable. 176 - 177 - .PARAMETER PIN_DKML_COMPONENT_STAGING_UNIXUTILS 178 - Environment variable. 179 - 180 - .PARAMETER PIN_DKML_COMPONENT_STAGING_WITHDKML 181 - Environment variable. 182 - 183 - .PARAMETER PIN_DKML_COMPONENT_XX_CONSOLE 184 - Environment variable. 185 - 186 - .PARAMETER PIN_DKML_EXE_LIB 187 - Environment variable. 188 - 189 - .PARAMETER PIN_DKML_EXE 190 - Environment variable. 191 - 192 - .PARAMETER PIN_DKML_INSTALL_INSTALLER 193 - Environment variable. 194 - 195 - .PARAMETER PIN_DKML_INSTALL_RUNNER 196 - Environment variable. 197 - 198 - .PARAMETER PIN_DKML_INSTALL 199 - Environment variable. 200 - 201 - .PARAMETER PIN_DKML_INSTALLER_OCAML_COMMON 202 - Environment variable. 203 - 204 - .PARAMETER PIN_DKML_INSTALLER_OCAML_OFFLINE 205 - Environment variable. 206 - 207 - .PARAMETER PIN_DKML_PACKAGE_CONSOLE 208 - Environment variable. 209 - 210 - .PARAMETER PIN_DKML_RUNTIME_COMMON_NATIVE 211 - Environment variable. 212 - 213 - .PARAMETER PIN_DKML_RUNTIME_COMMON 214 - Environment variable. 215 - 216 - .PARAMETER PIN_DKML_RUNTIME_DISTRIBUTION 217 - Environment variable. 218 - 219 - .PARAMETER PIN_DKML_RUNTIMELIB 220 - Environment variable. 221 - 222 - .PARAMETER PIN_DKML_RUNTIMESCRIPTS 223 - Environment variable. 224 - 225 - .PARAMETER PIN_DKML_WORKFLOWS 226 - Environment variable. 227 - 228 - .PARAMETER PIN_DUNE_ACTION_PLUGIN 229 - Environment variable. 230 - 231 - .PARAMETER PIN_DUNE_BUILD_INFO 232 - Environment variable. 233 - 234 - .PARAMETER PIN_DUNE_CONFIGURATOR 235 - Environment variable. 236 - 237 - .PARAMETER PIN_DUNE_GLOB 238 - Environment variable. 239 - 240 - .PARAMETER PIN_DUNE_PRIVATE_LIBS 241 - Environment variable. 242 - 243 - .PARAMETER PIN_DUNE_RPC_LWT 244 - Environment variable. 245 - 246 - .PARAMETER PIN_DUNE_RPC 247 - Environment variable. 248 - 249 - .PARAMETER PIN_DUNE_SITE 250 - Environment variable. 251 - 252 - .PARAMETER PIN_DUNE 253 - Environment variable. 254 - 255 - .PARAMETER PIN_DYN 256 - Environment variable. 257 - 258 - .PARAMETER PIN_EITHER 259 - Environment variable. 260 - 261 - .PARAMETER PIN_EQAF 262 - Environment variable. 263 - 264 - .PARAMETER PIN_EXTLIB 265 - Environment variable. 266 - 267 - .PARAMETER PIN_EZJSONM 268 - Environment variable. 269 - 270 - .PARAMETER PIN_FEATHER 271 - Environment variable. 272 - 273 - .PARAMETER PIN_FIBER 274 - Environment variable. 275 - 276 - .PARAMETER PIN_FIX 277 - Environment variable. 278 - 279 - .PARAMETER PIN_FMT 280 - Environment variable. 281 - 282 - .PARAMETER PIN_FPATH 283 - Environment variable. 284 - 285 - .PARAMETER PIN_GRAPHICS 286 - Environment variable. 287 - 288 - .PARAMETER PIN_HEX 289 - Environment variable. 290 - 291 - .PARAMETER PIN_INTEGERS 292 - Environment variable. 293 - 294 - .PARAMETER PIN_JANE_STREET_HEADERS 295 - Environment variable. 296 - 297 - .PARAMETER PIN_JINGOO 298 - Environment variable. 299 - 300 - .PARAMETER PIN_JSONM 301 - Environment variable. 302 - 303 - .PARAMETER PIN_JSONRPC 304 - Environment variable. 305 - 306 - .PARAMETER PIN_JST_CONFIG 307 - Environment variable. 308 - 309 - .PARAMETER PIN_LAMBDA_TERM 310 - Environment variable. 311 - 312 - .PARAMETER PIN_LOGS 313 - Environment variable. 314 - 315 - .PARAMETER PIN_LSP 316 - Environment variable. 317 - 318 - .PARAMETER PIN_LWT 319 - Environment variable. 320 - 321 - .PARAMETER PIN_LWT_REACT 322 - Environment variable. 323 - 324 - .PARAMETER PIN_MCCS 325 - Environment variable. 326 - 327 - .PARAMETER PIN_MDX 328 - Environment variable. 329 - 330 - .PARAMETER PIN_MENHIR 331 - Environment variable. 332 - 333 - .PARAMETER PIN_MENHIRLIB 334 - Environment variable. 335 - 336 - .PARAMETER PIN_MENHIRSDK 337 - Environment variable. 338 - 339 - .PARAMETER PIN_MERLIN_LIB 340 - Environment variable. 341 - 342 - .PARAMETER PIN_METAPP 343 - Environment variable. 344 - 345 - .PARAMETER PIN_METAQUOT 346 - Environment variable. 347 - 348 - .PARAMETER PIN_MEW 349 - Environment variable. 350 - 351 - .PARAMETER PIN_MEW_VI 352 - Environment variable. 353 - 354 - .PARAMETER PIN_NUM 355 - Environment variable. 356 - 357 - .PARAMETER PIN_OCAML_COMPILER_LIBS 358 - Environment variable. 359 - 360 - .PARAMETER PIN_OCAML_LSP_SERVER 361 - Environment variable. 362 - 363 - .PARAMETER PIN_OCAML_VERSION 364 - Environment variable. 365 - 366 - .PARAMETER PIN_OCAML 367 - Environment variable. 368 - 369 - .PARAMETER PIN_OCAMLBUILD 370 - Environment variable. 371 - 372 - .PARAMETER PIN_OCAMLC_LOC 373 - Environment variable. 374 - 375 - .PARAMETER PIN_OCAMLFIND 376 - Environment variable. 377 - 378 - .PARAMETER PIN_OCAMLFORMAT_LIB 379 - Environment variable. 380 - 381 - .PARAMETER PIN_OCAMLFORMAT_RPC_LIB 382 - Environment variable. 383 - 384 - .PARAMETER PIN_OCAMLFORMAT 385 - Environment variable. 386 - 387 - .PARAMETER PIN_OCP_INDENT 388 - Environment variable. 389 - 390 - .PARAMETER PIN_OCPLIB_ENDIAN 391 - Environment variable. 392 - 393 - .PARAMETER PIN_ODOC_PARSER 394 - Environment variable. 395 - 396 - .PARAMETER PIN_ODOC 397 - Environment variable. 398 - 399 - .PARAMETER PIN_ORDERING 400 - Environment variable. 401 - 402 - .PARAMETER PIN_PARSEXP 403 - Environment variable. 404 - 405 - .PARAMETER PIN_PP 406 - Environment variable. 407 - 408 - .PARAMETER PIN_PPX_ASSERT 409 - Environment variable. 410 - 411 - .PARAMETER PIN_PPX_BASE 412 - Environment variable. 413 - 414 - .PARAMETER PIN_PPX_COLD 415 - Environment variable. 416 - 417 - .PARAMETER PIN_PPX_COMPARE 418 - Environment variable. 419 - 420 - .PARAMETER PIN_PPX_DERIVERS 421 - Environment variable. 422 - 423 - .PARAMETER PIN_PPX_DERIVING 424 - Environment variable. 425 - 426 - .PARAMETER PIN_PPX_ENUMERATE 427 - Environment variable. 428 - 429 - .PARAMETER PIN_PPX_EXPECT 430 - Environment variable. 431 - 432 - .PARAMETER PIN_PPX_GLOBALIZE 433 - Environment variable. 434 - 435 - .PARAMETER PIN_PPX_HASH 436 - Environment variable. 437 - 438 - .PARAMETER PIN_PPX_HERE 439 - Environment variable. 440 - 441 - .PARAMETER PIN_PPX_IGNORE_INSTRUMENTATION 442 - Environment variable. 443 - 444 - .PARAMETER PIN_PPX_INLINE_TEST 445 - Environment variable. 446 - 447 - .PARAMETER PIN_PPX_OPTCOMP 448 - Environment variable. 449 - 450 - .PARAMETER PIN_PPX_PIPEBANG 451 - Environment variable. 452 - 453 - .PARAMETER PIN_PPX_SEXP_CONV 454 - Environment variable. 455 - 456 - .PARAMETER PIN_PPX_YOJSON_CONV_LIB 457 - Environment variable. 458 - 459 - .PARAMETER PIN_PPXLIB 460 - Environment variable. 461 - 462 - .PARAMETER PIN_PTIME 463 - Environment variable. 464 - 465 - .PARAMETER PIN_QRC 466 - Environment variable. 467 - 468 - .PARAMETER PIN_RE 469 - Environment variable. 470 - 471 - .PARAMETER PIN_REACT 472 - Environment variable. 473 - 474 - .PARAMETER PIN_REFL 475 - Environment variable. 476 - 477 - .PARAMETER PIN_RESULT 478 - Environment variable. 479 - 480 - .PARAMETER PIN_RRESULT 481 - Environment variable. 482 - 483 - .PARAMETER PIN_SEQ 484 - Environment variable. 485 - 486 - .PARAMETER PIN_SEXPLIB 487 - Environment variable. 488 - 489 - .PARAMETER PIN_SEXPLIB0 490 - Environment variable. 491 - 492 - .PARAMETER PIN_SHA 493 - Environment variable. 494 - 495 - .PARAMETER PIN_SPAWN 496 - Environment variable. 497 - 498 - .PARAMETER PIN_SQLITE3 499 - Environment variable. 500 - 501 - .PARAMETER PIN_STDCOMPAT 502 - Environment variable. 503 - 504 - .PARAMETER PIN_STDIO 505 - Environment variable. 506 - 507 - .PARAMETER PIN_STDLIB_SHIMS 508 - Environment variable. 509 - 510 - .PARAMETER PIN_STDUNE 511 - Environment variable. 512 - 513 - .PARAMETER PIN_TIME_NOW 514 - Environment variable. 515 - 516 - .PARAMETER PIN_TOPKG 517 - Environment variable. 518 - 519 - .PARAMETER PIN_TRAVERSE 520 - Environment variable. 521 - 522 - .PARAMETER PIN_TRIE 523 - Environment variable. 524 - 525 - .PARAMETER PIN_TSORT 526 - Environment variable. 527 - 528 - .PARAMETER PIN_TYXML 529 - Environment variable. 530 - 531 - .PARAMETER PIN_UCHAR 532 - Environment variable. 533 - 534 - .PARAMETER PIN_UTOP 535 - Environment variable. 536 - 537 - .PARAMETER PIN_UUCP 538 - Environment variable. 539 - 540 - .PARAMETER PIN_UUIDM 541 - Environment variable. 542 - 543 - .PARAMETER PIN_UUSEG 544 - Environment variable. 545 - 546 - .PARAMETER PIN_UUTF 547 - Environment variable. 548 - 549 - .PARAMETER PIN_WITH_DKML 550 - Environment variable. 551 - 552 - .PARAMETER PIN_XDG 553 - Environment variable. 554 - 555 - .PARAMETER PIN_YOJSON 556 - Environment variable. 557 - 558 - .PARAMETER PIN_ZED 559 - Environment variable. 560 - 561 - #> 562 - [CmdletBinding()] 563 - param ( 564 - # Context variables 565 - [Parameter(HelpMessage='Defaults to the current directory')] 566 - [string] 567 - $PC_PROJECT_DIR = $PWD, 568 - 569 - # Input variables 570 - [string] 571 - $FDOPEN_OPAMEXE_BOOTSTRAP = "false", 572 - [string] 573 - $CACHE_PREFIX = "v1", 574 - [string] 575 - $OCAML_COMPILER = "", 576 - [string] 577 - $DKML_COMPILER = "", 578 - [string] 579 - $SKIP_OPAM_MODIFICATIONS = "false", 580 - [string] 581 - $SECONDARY_SWITCH = "false", 582 - [string] 583 - $PRIMARY_SWITCH_SKIP_INSTALL = "false", 584 - [string] 585 - $CONF_DKML_CROSS_TOOLCHAIN = "@repository@", 586 - [string] 587 - $DISKUV_OPAM_REPOSITORY = "", 588 - [string] 589 - $DKML_HOME = "" 590 - 591 - # Conflicts with automatic variable $Verbose 592 - # [Parameter()] 593 - # [string] 594 - # $VERBOSE = "false" 595 - 596 - # Environment variables (can be overridden on command line) 597 - # autogen from global_env_vars. 598 - ,[Parameter()] [string] $DKML_VERSION = "2.0.3" 599 - ,[Parameter()] [string] $DEFAULT_DISKUV_OPAM_REPOSITORY_TAG = "2.0.3" 600 - ,[Parameter()] [string] $DEFAULT_DKML_COMPILER = "2.0.3" 601 - ,[Parameter()] [string] $PIN_ASTRING = "0.8.5" 602 - ,[Parameter()] [string] $PIN_BASE = "v0.16.1" 603 - ,[Parameter()] [string] $PIN_BASE64 = "3.5.1" 604 - ,[Parameter()] [string] $PIN_BIGARRAY_COMPAT = "1.1.0" 605 - ,[Parameter()] [string] $PIN_BOS = "0.2.1" 606 - ,[Parameter()] [string] $PIN_CAMLP_STREAMS = "5.0.1" 607 - ,[Parameter()] [string] $PIN_CHROME_TRACE = "3.10.0" 608 - ,[Parameter()] [string] $PIN_CMDLINER = "1.2.0" 609 - ,[Parameter()] [string] $PIN_CONF_DKML_SYS_OPAM = "1" 610 - ,[Parameter()] [string] $PIN_CONF_PKG_CONFIG = "2+cpkgs" 611 - ,[Parameter()] [string] $PIN_CONF_SQLITE3 = "3.1+cpkgs" 612 - ,[Parameter()] [string] $PIN_CPPO = "1.6.9" 613 - ,[Parameter()] [string] $PIN_CRUNCH = "3.3.1" 614 - ,[Parameter()] [string] $PIN_CSEXP = "1.5.2" 615 - ,[Parameter()] [string] $PIN_CSTRUCT = "6.2.0" 616 - ,[Parameter()] [string] $PIN_CTYPES_FOREIGN = "0.19.2-windowssupport-r7" 617 - ,[Parameter()] [string] $PIN_CTYPES = "0.19.2-windowssupport-r7" 618 - ,[Parameter()] [string] $PIN_CUDF = "0.10" 619 - ,[Parameter()] [string] $PIN_DIGESTIF = "1.1.4" 620 - ,[Parameter()] [string] $PIN_DISKUVBOX = "0.2.0" 621 - ,[Parameter()] [string] $PIN_DKML_APPS = "2.0.3" 622 - ,[Parameter()] [string] $PIN_DKML_BASE_COMPILER = "4.14.0~v2.0.3" 623 - ,[Parameter()] [string] $PIN_DKML_BUILD_DESKTOP = "2.0.3" 624 - ,[Parameter()] [string] $PIN_DKML_C_PROBE = "3.0.0" 625 - ,[Parameter()] [string] $PIN_DKML_COMPILER_ENV = "2.0.3" 626 - ,[Parameter()] [string] $PIN_DKML_COMPILER_SRC = "2.0.3" 627 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_COMMON_DESKTOP = "2.0.3" 628 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_COMMON_OPAM = "2.2.0~alpha0~20221228" 629 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_COMMON_UNIXUTILS = "0.2.0" 630 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_OCAMLCOMPILER_COMMON = "4.14.0~v2.0.3" 631 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_OCAMLCOMPILER_NETWORK = "4.14.0~v2.0.3" 632 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_OCAMLCOMPILER_OFFLINE = "4.14.0~v2.0.3" 633 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_OFFLINE_DESKTOP_FULL = "2.0.3" 634 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_OFFLINE_OPAMSHIM = "2.2.0~alpha0~20221228" 635 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_OFFLINE_UNIXUTILS = "0.2.0" 636 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_DESKTOP_FULL = "2.0.3" 637 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_DKMLCONFDIR = "2.0.3" 638 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_OCAMLRUN = "4.14.0~v2.0.3" 639 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_OPAM32 = "2.2.0~alpha0~20221228" 640 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_OPAM64 = "2.2.0~alpha0~20221228" 641 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_UNIXUTILS = "0.2.0" 642 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_STAGING_WITHDKML = "2.0.3" 643 - ,[Parameter()] [string] $PIN_DKML_COMPONENT_XX_CONSOLE = "0.1.1" 644 - ,[Parameter()] [string] $PIN_DKML_EXE_LIB = "2.0.3" 645 - ,[Parameter()] [string] $PIN_DKML_EXE = "2.0.3" 646 - ,[Parameter()] [string] $PIN_DKML_INSTALL_INSTALLER = "0.5.1" 647 - ,[Parameter()] [string] $PIN_DKML_INSTALL_RUNNER = "0.5.1" 648 - ,[Parameter()] [string] $PIN_DKML_INSTALL = "0.5.1" 649 - ,[Parameter()] [string] $PIN_DKML_INSTALLER_OCAML_COMMON = "2.0.3" 650 - ,[Parameter()] [string] $PIN_DKML_INSTALLER_OCAML_OFFLINE = "2.0.3" 651 - ,[Parameter()] [string] $PIN_DKML_PACKAGE_CONSOLE = "0.5.1" 652 - ,[Parameter()] [string] $PIN_DKML_RUNTIME_COMMON_NATIVE = "2.0.3" 653 - ,[Parameter()] [string] $PIN_DKML_RUNTIME_COMMON = "2.0.3" 654 - ,[Parameter()] [string] $PIN_DKML_RUNTIME_DISTRIBUTION = "2.0.3" 655 - ,[Parameter()] [string] $PIN_DKML_RUNTIMELIB = "2.0.3" 656 - ,[Parameter()] [string] $PIN_DKML_RUNTIMESCRIPTS = "2.0.3" 657 - ,[Parameter()] [string] $PIN_DKML_WORKFLOWS = "2.0.3" 658 - ,[Parameter()] [string] $PIN_DUNE_ACTION_PLUGIN = "3.8.3" 659 - ,[Parameter()] [string] $PIN_DUNE_BUILD_INFO = "3.8.3" 660 - ,[Parameter()] [string] $PIN_DUNE_CONFIGURATOR = "3.8.3" 661 - ,[Parameter()] [string] $PIN_DUNE_GLOB = "3.8.3" 662 - ,[Parameter()] [string] $PIN_DUNE_PRIVATE_LIBS = "3.8.3" 663 - ,[Parameter()] [string] $PIN_DUNE_RPC_LWT = "3.8.3" 664 - ,[Parameter()] [string] $PIN_DUNE_RPC = "3.8.3" 665 - ,[Parameter()] [string] $PIN_DUNE_SITE = "3.8.3" 666 - ,[Parameter()] [string] $PIN_DUNE = "3.8.3" 667 - ,[Parameter()] [string] $PIN_DYN = "3.8.3" 668 - ,[Parameter()] [string] $PIN_EITHER = "1.0.0" 669 - ,[Parameter()] [string] $PIN_EQAF = "0.9" 670 - ,[Parameter()] [string] $PIN_EXTLIB = "1.7.9" 671 - ,[Parameter()] [string] $PIN_EZJSONM = "1.3.0" 672 - ,[Parameter()] [string] $PIN_FEATHER = "0.3.0" 673 - ,[Parameter()] [string] $PIN_FIBER = "3.7.0" 674 - ,[Parameter()] [string] $PIN_FIX = "20230505" 675 - ,[Parameter()] [string] $PIN_FMT = "0.9.0" 676 - ,[Parameter()] [string] $PIN_FPATH = "0.7.3" 677 - ,[Parameter()] [string] $PIN_GRAPHICS = "5.1.2" 678 - ,[Parameter()] [string] $PIN_HEX = "1.5.0" 679 - ,[Parameter()] [string] $PIN_INTEGERS = "0.7.0" 680 - ,[Parameter()] [string] $PIN_JANE_STREET_HEADERS = "v0.16.0" 681 - ,[Parameter()] [string] $PIN_JINGOO = "1.4.4" 682 - ,[Parameter()] [string] $PIN_JSONM = "1.0.2" 683 - ,[Parameter()] [string] $PIN_JSONRPC = "1.16.2" 684 - ,[Parameter()] [string] $PIN_JST_CONFIG = "v0.16.0" 685 - ,[Parameter()] [string] $PIN_LAMBDA_TERM = "3.3.1" 686 - ,[Parameter()] [string] $PIN_LOGS = "0.7.0" 687 - ,[Parameter()] [string] $PIN_LSP = "1.16.2" 688 - ,[Parameter()] [string] $PIN_LWT = "5.6.1" 689 - ,[Parameter()] [string] $PIN_LWT_REACT = "1.2.0" 690 - ,[Parameter()] [string] $PIN_MCCS = "1.1+13" 691 - ,[Parameter()] [string] $PIN_MDX = "2.3.0" 692 - ,[Parameter()] [string] $PIN_MENHIR = "20230608" 693 - ,[Parameter()] [string] $PIN_MENHIRLIB = "20230608" 694 - ,[Parameter()] [string] $PIN_MENHIRSDK = "20230608" 695 - ,[Parameter()] [string] $PIN_MERLIN_LIB = "4.9-414" 696 - ,[Parameter()] [string] $PIN_METAPP = "0.4.4+win" 697 - ,[Parameter()] [string] $PIN_METAQUOT = "0.5.2" 698 - ,[Parameter()] [string] $PIN_MEW = "0.1.0" 699 - ,[Parameter()] [string] $PIN_MEW_VI = "0.5.0" 700 - ,[Parameter()] [string] $PIN_NUM = "1.4" 701 - ,[Parameter()] [string] $PIN_OCAML_COMPILER_LIBS = "v0.12.4" 702 - ,[Parameter()] [string] $PIN_OCAML_LSP_SERVER = "1.16.2" 703 - ,[Parameter()] [string] $PIN_OCAML_VERSION = "3.6.1" 704 - ,[Parameter()] [string] $PIN_OCAML = "4.14.0" 705 - ,[Parameter()] [string] $PIN_OCAMLBUILD = "0.14.2+win+unix" 706 - ,[Parameter()] [string] $PIN_OCAMLC_LOC = "3.8.3" 707 - ,[Parameter()] [string] $PIN_OCAMLFIND = "1.9.5" 708 - ,[Parameter()] [string] $PIN_OCAMLFORMAT_LIB = "0.25.1" 709 - ,[Parameter()] [string] $PIN_OCAMLFORMAT_RPC_LIB = "0.25.1" 710 - ,[Parameter()] [string] $PIN_OCAMLFORMAT = "0.25.1" 711 - ,[Parameter()] [string] $PIN_OCP_INDENT = "1.8.2-windowssupport" 712 - ,[Parameter()] [string] $PIN_OCPLIB_ENDIAN = "1.2" 713 - ,[Parameter()] [string] $PIN_ODOC_PARSER = "2.0.0" 714 - ,[Parameter()] [string] $PIN_ODOC = "2.2.0" 715 - ,[Parameter()] [string] $PIN_ORDERING = "3.8.3" 716 - ,[Parameter()] [string] $PIN_PARSEXP = "v0.16.0" 717 - ,[Parameter()] [string] $PIN_PP = "1.1.2" 718 - ,[Parameter()] [string] $PIN_PPX_ASSERT = "v0.16.0" 719 - ,[Parameter()] [string] $PIN_PPX_BASE = "v0.16.0" 720 - ,[Parameter()] [string] $PIN_PPX_COLD = "v0.16.0" 721 - ,[Parameter()] [string] $PIN_PPX_COMPARE = "v0.16.0" 722 - ,[Parameter()] [string] $PIN_PPX_DERIVERS = "1.2.1" 723 - ,[Parameter()] [string] $PIN_PPX_DERIVING = "5.2.1" 724 - ,[Parameter()] [string] $PIN_PPX_ENUMERATE = "v0.16.0" 725 - ,[Parameter()] [string] $PIN_PPX_EXPECT = "v0.16.0" 726 - ,[Parameter()] [string] $PIN_PPX_GLOBALIZE = "v0.16.0" 727 - ,[Parameter()] [string] $PIN_PPX_HASH = "v0.16.0" 728 - ,[Parameter()] [string] $PIN_PPX_HERE = "v0.16.0" 729 - ,[Parameter()] [string] $PIN_PPX_IGNORE_INSTRUMENTATION = "v0.16.0" 730 - ,[Parameter()] [string] $PIN_PPX_INLINE_TEST = "v0.16.0" 731 - ,[Parameter()] [string] $PIN_PPX_OPTCOMP = "v0.16.0" 732 - ,[Parameter()] [string] $PIN_PPX_PIPEBANG = "v0.16.0" 733 - ,[Parameter()] [string] $PIN_PPX_SEXP_CONV = "v0.16.0" 734 - ,[Parameter()] [string] $PIN_PPX_YOJSON_CONV_LIB = "v0.16.0" 735 - ,[Parameter()] [string] $PIN_PPXLIB = "0.30.0" 736 - ,[Parameter()] [string] $PIN_PTIME = "1.1.0" 737 - ,[Parameter()] [string] $PIN_QRC = "0.1.1~dune" 738 - ,[Parameter()] [string] $PIN_RE = "1.11.0" 739 - ,[Parameter()] [string] $PIN_REACT = "1.2.2" 740 - ,[Parameter()] [string] $PIN_REFL = "0.4.1" 741 - ,[Parameter()] [string] $PIN_RESULT = "1.5" 742 - ,[Parameter()] [string] $PIN_RRESULT = "0.7.0" 743 - ,[Parameter()] [string] $PIN_SEQ = "base" 744 - ,[Parameter()] [string] $PIN_SEXPLIB = "v0.16.0" 745 - ,[Parameter()] [string] $PIN_SEXPLIB0 = "v0.16.0" 746 - ,[Parameter()] [string] $PIN_SHA = "1.15.4" 747 - ,[Parameter()] [string] $PIN_SPAWN = "v0.15.1" 748 - ,[Parameter()] [string] $PIN_SQLITE3 = "5.1.0+msvc" 749 - ,[Parameter()] [string] $PIN_STDCOMPAT = "19+optautoconf" 750 - ,[Parameter()] [string] $PIN_STDIO = "v0.16.0" 751 - ,[Parameter()] [string] $PIN_STDLIB_SHIMS = "0.3.0" 752 - ,[Parameter()] [string] $PIN_STDUNE = "3.8.3" 753 - ,[Parameter()] [string] $PIN_TIME_NOW = "v0.16.0" 754 - ,[Parameter()] [string] $PIN_TOPKG = "1.0.7" 755 - ,[Parameter()] [string] $PIN_TRAVERSE = "0.3.0" 756 - ,[Parameter()] [string] $PIN_TRIE = "1.0.0" 757 - ,[Parameter()] [string] $PIN_TSORT = "2.1.0" 758 - ,[Parameter()] [string] $PIN_TYXML = "4.5.0" 759 - ,[Parameter()] [string] $PIN_UCHAR = "0.0.2" 760 - ,[Parameter()] [string] $PIN_UTOP = "2.13.1" 761 - ,[Parameter()] [string] $PIN_UUCP = "15.0.0" 762 - ,[Parameter()] [string] $PIN_UUIDM = "0.9.8" 763 - ,[Parameter()] [string] $PIN_UUSEG = "15.0.0" 764 - ,[Parameter()] [string] $PIN_UUTF = "1.0.3" 765 - ,[Parameter()] [string] $PIN_WITH_DKML = "2.0.3" 766 - ,[Parameter()] [string] $PIN_XDG = "3.9.0" 767 - ,[Parameter()] [string] $PIN_YOJSON = "2.1.0" 768 - ,[Parameter()] [string] $PIN_ZED = "3.2.2" 769 - ) 770 - 771 - $ErrorActionPreference = "Stop" 772 - 773 - # Reset environment so no conflicts with a parent Opam or OCaml system 774 - if (Test-Path Env:OPAMROOT) { Remove-Item Env:OPAMROOT } 775 - if (Test-Path Env:OPAMSWITCH) { Remove-Item Env:OPAMSWITCH } 776 - if (Test-Path Env:OPAM_SWITCH_PREFIX) { Remove-Item Env:OPAM_SWITCH_PREFIX } 777 - if (Test-Path Env:CAML_LD_LIBRARY_PATH) { Remove-Item Env:CAML_LD_LIBRARY_PATH } 778 - if (Test-Path Env:OCAMLLIB) { Remove-Item Env:OCAMLLIB } 779 - if (Test-Path Env:OCAML_TOPLEVEL_PATH) { Remove-Item Env:OCAML_TOPLEVEL_PATH } 780 - 781 - # Pushdown context variables 782 - $env:PC_CI = 'true' 783 - $env:PC_PROJECT_DIR = $PC_PROJECT_DIR 784 - 785 - # Pushdown input variables 786 - $env:FDOPEN_OPAMEXE_BOOTSTRAP = $FDOPEN_OPAMEXE_BOOTSTRAP 787 - $env:CACHE_PREFIX = $CACHE_PREFIX 788 - $env:OCAML_COMPILER = $OCAML_COMPILER 789 - $env:DKML_COMPILER = $DKML_COMPILER 790 - $env:SKIP_OPAM_MODIFICATIONS = $SKIP_OPAM_MODIFICATIONS 791 - $env:SECONDARY_SWITCH = $SECONDARY_SWITCH 792 - $env:PRIMARY_SWITCH_SKIP_INSTALL = $PRIMARY_SWITCH_SKIP_INSTALL 793 - $env:CONF_DKML_CROSS_TOOLCHAIN = $CONF_DKML_CROSS_TOOLCHAIN 794 - $env:DISKUV_OPAM_REPOSITORY = $DISKUV_OPAM_REPOSITORY 795 - $env:DKML_HOME = $DKML_HOME 796 - 797 - # Set matrix variables 798 - # autogen from pc_vars. only windows_x86_64 799 - $env:dkml_host_os = "windows" 800 - $env:opam_root_cacheable = "${env:PC_PROJECT_DIR}/.ci/o" 801 - $env:abi_pattern = "win32-windows_x86_64" 802 - $env:msys2_system = "CLANG64" 803 - $env:msys2_packages = "mingw-w64-clang-x86_64-pkg-config" 804 - $env:exe_ext = ".exe" 805 - $env:bootstrap_opam_version = "2.2.0-alpha-20221228" 806 - $env:opam_abi = "windows_x86_64" 807 - $env:dkml_host_abi = "windows_x86_64" 808 - $env:opam_root = "${env:PC_PROJECT_DIR}/.ci/o" 809 - $env:vsstudio_hostarch = "x64" 810 - $env:vsstudio_arch = "x64" 811 - 812 - 813 - # Set environment variables 814 - # autogen from global_env_vars. 815 - $env:DKML_VERSION = $DKML_VERSION 816 - $env:DEFAULT_DISKUV_OPAM_REPOSITORY_TAG = $DEFAULT_DISKUV_OPAM_REPOSITORY_TAG 817 - $env:DEFAULT_DKML_COMPILER = $DEFAULT_DKML_COMPILER 818 - $env:PIN_ASTRING = $PIN_ASTRING 819 - $env:PIN_BASE = $PIN_BASE 820 - $env:PIN_BASE64 = $PIN_BASE64 821 - $env:PIN_BIGARRAY_COMPAT = $PIN_BIGARRAY_COMPAT 822 - $env:PIN_BOS = $PIN_BOS 823 - $env:PIN_CAMLP_STREAMS = $PIN_CAMLP_STREAMS 824 - $env:PIN_CHROME_TRACE = $PIN_CHROME_TRACE 825 - $env:PIN_CMDLINER = $PIN_CMDLINER 826 - $env:PIN_CONF_DKML_SYS_OPAM = $PIN_CONF_DKML_SYS_OPAM 827 - $env:PIN_CONF_PKG_CONFIG = $PIN_CONF_PKG_CONFIG 828 - $env:PIN_CONF_SQLITE3 = $PIN_CONF_SQLITE3 829 - $env:PIN_CPPO = $PIN_CPPO 830 - $env:PIN_CRUNCH = $PIN_CRUNCH 831 - $env:PIN_CSEXP = $PIN_CSEXP 832 - $env:PIN_CSTRUCT = $PIN_CSTRUCT 833 - $env:PIN_CTYPES_FOREIGN = $PIN_CTYPES_FOREIGN 834 - $env:PIN_CTYPES = $PIN_CTYPES 835 - $env:PIN_CUDF = $PIN_CUDF 836 - $env:PIN_DIGESTIF = $PIN_DIGESTIF 837 - $env:PIN_DISKUVBOX = $PIN_DISKUVBOX 838 - $env:PIN_DKML_APPS = $PIN_DKML_APPS 839 - $env:PIN_DKML_BASE_COMPILER = $PIN_DKML_BASE_COMPILER 840 - $env:PIN_DKML_BUILD_DESKTOP = $PIN_DKML_BUILD_DESKTOP 841 - $env:PIN_DKML_C_PROBE = $PIN_DKML_C_PROBE 842 - $env:PIN_DKML_COMPILER_ENV = $PIN_DKML_COMPILER_ENV 843 - $env:PIN_DKML_COMPILER_SRC = $PIN_DKML_COMPILER_SRC 844 - $env:PIN_DKML_COMPONENT_COMMON_DESKTOP = $PIN_DKML_COMPONENT_COMMON_DESKTOP 845 - $env:PIN_DKML_COMPONENT_COMMON_OPAM = $PIN_DKML_COMPONENT_COMMON_OPAM 846 - $env:PIN_DKML_COMPONENT_COMMON_UNIXUTILS = $PIN_DKML_COMPONENT_COMMON_UNIXUTILS 847 - $env:PIN_DKML_COMPONENT_OCAMLCOMPILER_COMMON = $PIN_DKML_COMPONENT_OCAMLCOMPILER_COMMON 848 - $env:PIN_DKML_COMPONENT_OCAMLCOMPILER_NETWORK = $PIN_DKML_COMPONENT_OCAMLCOMPILER_NETWORK 849 - $env:PIN_DKML_COMPONENT_OCAMLCOMPILER_OFFLINE = $PIN_DKML_COMPONENT_OCAMLCOMPILER_OFFLINE 850 - $env:PIN_DKML_COMPONENT_OFFLINE_DESKTOP_FULL = $PIN_DKML_COMPONENT_OFFLINE_DESKTOP_FULL 851 - $env:PIN_DKML_COMPONENT_OFFLINE_OPAMSHIM = $PIN_DKML_COMPONENT_OFFLINE_OPAMSHIM 852 - $env:PIN_DKML_COMPONENT_OFFLINE_UNIXUTILS = $PIN_DKML_COMPONENT_OFFLINE_UNIXUTILS 853 - $env:PIN_DKML_COMPONENT_STAGING_DESKTOP_FULL = $PIN_DKML_COMPONENT_STAGING_DESKTOP_FULL 854 - $env:PIN_DKML_COMPONENT_STAGING_DKMLCONFDIR = $PIN_DKML_COMPONENT_STAGING_DKMLCONFDIR 855 - $env:PIN_DKML_COMPONENT_STAGING_OCAMLRUN = $PIN_DKML_COMPONENT_STAGING_OCAMLRUN 856 - $env:PIN_DKML_COMPONENT_STAGING_OPAM32 = $PIN_DKML_COMPONENT_STAGING_OPAM32 857 - $env:PIN_DKML_COMPONENT_STAGING_OPAM64 = $PIN_DKML_COMPONENT_STAGING_OPAM64 858 - $env:PIN_DKML_COMPONENT_STAGING_UNIXUTILS = $PIN_DKML_COMPONENT_STAGING_UNIXUTILS 859 - $env:PIN_DKML_COMPONENT_STAGING_WITHDKML = $PIN_DKML_COMPONENT_STAGING_WITHDKML 860 - $env:PIN_DKML_COMPONENT_XX_CONSOLE = $PIN_DKML_COMPONENT_XX_CONSOLE 861 - $env:PIN_DKML_EXE_LIB = $PIN_DKML_EXE_LIB 862 - $env:PIN_DKML_EXE = $PIN_DKML_EXE 863 - $env:PIN_DKML_INSTALL_INSTALLER = $PIN_DKML_INSTALL_INSTALLER 864 - $env:PIN_DKML_INSTALL_RUNNER = $PIN_DKML_INSTALL_RUNNER 865 - $env:PIN_DKML_INSTALL = $PIN_DKML_INSTALL 866 - $env:PIN_DKML_INSTALLER_OCAML_COMMON = $PIN_DKML_INSTALLER_OCAML_COMMON 867 - $env:PIN_DKML_INSTALLER_OCAML_OFFLINE = $PIN_DKML_INSTALLER_OCAML_OFFLINE 868 - $env:PIN_DKML_PACKAGE_CONSOLE = $PIN_DKML_PACKAGE_CONSOLE 869 - $env:PIN_DKML_RUNTIME_COMMON_NATIVE = $PIN_DKML_RUNTIME_COMMON_NATIVE 870 - $env:PIN_DKML_RUNTIME_COMMON = $PIN_DKML_RUNTIME_COMMON 871 - $env:PIN_DKML_RUNTIME_DISTRIBUTION = $PIN_DKML_RUNTIME_DISTRIBUTION 872 - $env:PIN_DKML_RUNTIMELIB = $PIN_DKML_RUNTIMELIB 873 - $env:PIN_DKML_RUNTIMESCRIPTS = $PIN_DKML_RUNTIMESCRIPTS 874 - $env:PIN_DKML_WORKFLOWS = $PIN_DKML_WORKFLOWS 875 - $env:PIN_DUNE_ACTION_PLUGIN = $PIN_DUNE_ACTION_PLUGIN 876 - $env:PIN_DUNE_BUILD_INFO = $PIN_DUNE_BUILD_INFO 877 - $env:PIN_DUNE_CONFIGURATOR = $PIN_DUNE_CONFIGURATOR 878 - $env:PIN_DUNE_GLOB = $PIN_DUNE_GLOB 879 - $env:PIN_DUNE_PRIVATE_LIBS = $PIN_DUNE_PRIVATE_LIBS 880 - $env:PIN_DUNE_RPC_LWT = $PIN_DUNE_RPC_LWT 881 - $env:PIN_DUNE_RPC = $PIN_DUNE_RPC 882 - $env:PIN_DUNE_SITE = $PIN_DUNE_SITE 883 - $env:PIN_DUNE = $PIN_DUNE 884 - $env:PIN_DYN = $PIN_DYN 885 - $env:PIN_EITHER = $PIN_EITHER 886 - $env:PIN_EQAF = $PIN_EQAF 887 - $env:PIN_EXTLIB = $PIN_EXTLIB 888 - $env:PIN_EZJSONM = $PIN_EZJSONM 889 - $env:PIN_FEATHER = $PIN_FEATHER 890 - $env:PIN_FIBER = $PIN_FIBER 891 - $env:PIN_FIX = $PIN_FIX 892 - $env:PIN_FMT = $PIN_FMT 893 - $env:PIN_FPATH = $PIN_FPATH 894 - $env:PIN_GRAPHICS = $PIN_GRAPHICS 895 - $env:PIN_HEX = $PIN_HEX 896 - $env:PIN_INTEGERS = $PIN_INTEGERS 897 - $env:PIN_JANE_STREET_HEADERS = $PIN_JANE_STREET_HEADERS 898 - $env:PIN_JINGOO = $PIN_JINGOO 899 - $env:PIN_JSONM = $PIN_JSONM 900 - $env:PIN_JSONRPC = $PIN_JSONRPC 901 - $env:PIN_JST_CONFIG = $PIN_JST_CONFIG 902 - $env:PIN_LAMBDA_TERM = $PIN_LAMBDA_TERM 903 - $env:PIN_LOGS = $PIN_LOGS 904 - $env:PIN_LSP = $PIN_LSP 905 - $env:PIN_LWT = $PIN_LWT 906 - $env:PIN_LWT_REACT = $PIN_LWT_REACT 907 - $env:PIN_MCCS = $PIN_MCCS 908 - $env:PIN_MDX = $PIN_MDX 909 - $env:PIN_MENHIR = $PIN_MENHIR 910 - $env:PIN_MENHIRLIB = $PIN_MENHIRLIB 911 - $env:PIN_MENHIRSDK = $PIN_MENHIRSDK 912 - $env:PIN_MERLIN_LIB = $PIN_MERLIN_LIB 913 - $env:PIN_METAPP = $PIN_METAPP 914 - $env:PIN_METAQUOT = $PIN_METAQUOT 915 - $env:PIN_MEW = $PIN_MEW 916 - $env:PIN_MEW_VI = $PIN_MEW_VI 917 - $env:PIN_NUM = $PIN_NUM 918 - $env:PIN_OCAML_COMPILER_LIBS = $PIN_OCAML_COMPILER_LIBS 919 - $env:PIN_OCAML_LSP_SERVER = $PIN_OCAML_LSP_SERVER 920 - $env:PIN_OCAML_VERSION = $PIN_OCAML_VERSION 921 - $env:PIN_OCAML = $PIN_OCAML 922 - $env:PIN_OCAMLBUILD = $PIN_OCAMLBUILD 923 - $env:PIN_OCAMLC_LOC = $PIN_OCAMLC_LOC 924 - $env:PIN_OCAMLFIND = $PIN_OCAMLFIND 925 - $env:PIN_OCAMLFORMAT_LIB = $PIN_OCAMLFORMAT_LIB 926 - $env:PIN_OCAMLFORMAT_RPC_LIB = $PIN_OCAMLFORMAT_RPC_LIB 927 - $env:PIN_OCAMLFORMAT = $PIN_OCAMLFORMAT 928 - $env:PIN_OCP_INDENT = $PIN_OCP_INDENT 929 - $env:PIN_OCPLIB_ENDIAN = $PIN_OCPLIB_ENDIAN 930 - $env:PIN_ODOC_PARSER = $PIN_ODOC_PARSER 931 - $env:PIN_ODOC = $PIN_ODOC 932 - $env:PIN_ORDERING = $PIN_ORDERING 933 - $env:PIN_PARSEXP = $PIN_PARSEXP 934 - $env:PIN_PP = $PIN_PP 935 - $env:PIN_PPX_ASSERT = $PIN_PPX_ASSERT 936 - $env:PIN_PPX_BASE = $PIN_PPX_BASE 937 - $env:PIN_PPX_COLD = $PIN_PPX_COLD 938 - $env:PIN_PPX_COMPARE = $PIN_PPX_COMPARE 939 - $env:PIN_PPX_DERIVERS = $PIN_PPX_DERIVERS 940 - $env:PIN_PPX_DERIVING = $PIN_PPX_DERIVING 941 - $env:PIN_PPX_ENUMERATE = $PIN_PPX_ENUMERATE 942 - $env:PIN_PPX_EXPECT = $PIN_PPX_EXPECT 943 - $env:PIN_PPX_GLOBALIZE = $PIN_PPX_GLOBALIZE 944 - $env:PIN_PPX_HASH = $PIN_PPX_HASH 945 - $env:PIN_PPX_HERE = $PIN_PPX_HERE 946 - $env:PIN_PPX_IGNORE_INSTRUMENTATION = $PIN_PPX_IGNORE_INSTRUMENTATION 947 - $env:PIN_PPX_INLINE_TEST = $PIN_PPX_INLINE_TEST 948 - $env:PIN_PPX_OPTCOMP = $PIN_PPX_OPTCOMP 949 - $env:PIN_PPX_PIPEBANG = $PIN_PPX_PIPEBANG 950 - $env:PIN_PPX_SEXP_CONV = $PIN_PPX_SEXP_CONV 951 - $env:PIN_PPX_YOJSON_CONV_LIB = $PIN_PPX_YOJSON_CONV_LIB 952 - $env:PIN_PPXLIB = $PIN_PPXLIB 953 - $env:PIN_PTIME = $PIN_PTIME 954 - $env:PIN_QRC = $PIN_QRC 955 - $env:PIN_RE = $PIN_RE 956 - $env:PIN_REACT = $PIN_REACT 957 - $env:PIN_REFL = $PIN_REFL 958 - $env:PIN_RESULT = $PIN_RESULT 959 - $env:PIN_RRESULT = $PIN_RRESULT 960 - $env:PIN_SEQ = $PIN_SEQ 961 - $env:PIN_SEXPLIB = $PIN_SEXPLIB 962 - $env:PIN_SEXPLIB0 = $PIN_SEXPLIB0 963 - $env:PIN_SHA = $PIN_SHA 964 - $env:PIN_SPAWN = $PIN_SPAWN 965 - $env:PIN_SQLITE3 = $PIN_SQLITE3 966 - $env:PIN_STDCOMPAT = $PIN_STDCOMPAT 967 - $env:PIN_STDIO = $PIN_STDIO 968 - $env:PIN_STDLIB_SHIMS = $PIN_STDLIB_SHIMS 969 - $env:PIN_STDUNE = $PIN_STDUNE 970 - $env:PIN_TIME_NOW = $PIN_TIME_NOW 971 - $env:PIN_TOPKG = $PIN_TOPKG 972 - $env:PIN_TRAVERSE = $PIN_TRAVERSE 973 - $env:PIN_TRIE = $PIN_TRIE 974 - $env:PIN_TSORT = $PIN_TSORT 975 - $env:PIN_TYXML = $PIN_TYXML 976 - $env:PIN_UCHAR = $PIN_UCHAR 977 - $env:PIN_UTOP = $PIN_UTOP 978 - $env:PIN_UUCP = $PIN_UUCP 979 - $env:PIN_UUIDM = $PIN_UUIDM 980 - $env:PIN_UUSEG = $PIN_UUSEG 981 - $env:PIN_UUTF = $PIN_UUTF 982 - $env:PIN_WITH_DKML = $PIN_WITH_DKML 983 - $env:PIN_XDG = $PIN_XDG 984 - $env:PIN_YOJSON = $PIN_YOJSON 985 - $env:PIN_ZED = $PIN_ZED 986 - 987 - # https://patchwork.kernel.org/project/qemu-devel/patch/20211215073402.144286-17-thuth@redhat.com/ 988 - $env:CHERE_INVOKING = "yes" # Preserve the current working directory 989 - $env:MSYSTEM = $env:msys2_system # Start a 64 bit environment if CLANG64, etc. 990 - 991 - ########################### before_script ############################### 992 - 993 - # Troubleshooting 994 - If ( "${env:VERBOSE}" -eq "true" ) { Get-ChildItem 'env:' } 995 - 996 - # ----- 997 - # MSYS2 998 - # ----- 999 - # 1000 - # https://www.msys2.org/docs/ci/ 1001 - # https://patchwork.kernel.org/project/qemu-devel/patch/20211215073402.144286-17-thuth@redhat.com/ 1002 - 1003 - if ( Test-Path -Path msys64\usr\bin\pacman.exe ) { 1004 - Write-Host "Re-using MSYS2 from cache." 1005 - } 1006 - else { 1007 - Write-Host "Download the archive ..." 1008 - If ( !(Test-Path -Path msys64\var\cache ) ) { New-Item msys64\var\cache -ItemType Directory | Out-Null } 1009 - If ( !(Test-Path -Path msys64\var\cache\msys2.exe ) ) { Invoke-WebRequest "https://github.com/msys2/msys2-installer/releases/download/2022-09-04/msys2-base-x86_64-20220904.sfx.exe" -outfile "msys64\var\cache\msys2.exe" } 1010 - 1011 - Write-Host "Extract the archive ..." 1012 - msys64\var\cache\msys2.exe -y # Extract to .\msys64 1013 - Remove-Item msys64\var\cache\msys2.exe # Delete the archive again 1014 - ((Get-Content -path msys64\etc\post-install\07-pacman-key.post -Raw) -replace '--refresh-keys', '--version') | Set-Content -Path msys64\etc\post-install\07-pacman-key.post 1015 - msys64\usr\bin\bash -lc "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf" 1016 - 1017 - Write-Host "Run for the first time ..." 1018 - msys64\usr\bin\bash -lc ' ' 1019 - } 1020 - Write-Host "Update MSYS2 ..." 1021 - msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' # Core update (in case any core packages are outdated) 1022 - msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' # Normal update 1023 - if ("${env:CI}" -eq "true") { taskkill /F /FI "MODULES eq msys-2.0.dll" } # Only safe to kill MSYS2 in CI 1024 - 1025 - Write-Host "Install matrix, required and CI packages ..." 1026 - # Packages for GitLab CI: 1027 - # dos2unix (used to translate PowerShell written files below in this CI .yml into MSYS2 scripts) 1028 - msys64\usr\bin\bash -lc 'set -x; pacman -Sy --noconfirm --needed ${msys2_packages} wget make rsync diffutils patch unzip git tar xz dos2unix' 1029 - 1030 - Write-Host "Uninstall MSYS2 conflicting executables ..." 1031 - msys64\usr\bin\bash -lc 'rm -vf /usr/bin/link.exe' # link.exe interferes with MSVC's link.exe 1032 - 1033 - Write-Host "Installing VSSetup for the Get-VSSetupInstance function ..." 1034 - Install-Module VSSetup -Scope CurrentUser -Force 1035 - 1036 - Write-Host "Writing scripts ..." 1037 - 1038 - # POSIX and AWK scripts 1039 - 1040 - If ( !(Test-Path -Path.ci\sd4 ) ) { New-Item .ci\sd4 -ItemType Directory | Out-Null } 1041 - 1042 - $Content = @' 1043 - #!/bin/sh 1044 - 1045 - # ------------------------ Log Formatting ------------------------ 1046 - 1047 - TXT_SECTION="\e[94m" # bright blue 1048 - TXT_CLEAR="\e[0m" 1049 - 1050 - if [ "${GITLAB_CI:-}" = "true" ]; then 1051 - # https://docs.gitlab.com/ee/ci/jobs/#expand-and-collapse-job-log-sections 1052 - print_section_start() { 1053 - print_section_start_NAME=$1 1054 - shift 1055 - printf "\e[0Ksection_start:%s:%s[collapsed=true]\r\e[0K" \ 1056 - "$(date +%s)" \ 1057 - "$print_section_start_NAME" 1058 - } 1059 - print_section_end() { 1060 - print_section_end_NAME=$1 1061 - shift 1062 - printf "\e[0Ksection_end:%s:%s\r\e[0K\n" \ 1063 - "$(date +%s)" \ 1064 - "$print_section_end_NAME" 1065 - } 1066 - elif [ -n "${GITHUB_ENV:-}" ]; then 1067 - # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#grouping-log-lines 1068 - print_section_start() { 1069 - print_section_start_NAME=$1 1070 - shift 1071 - printf "::group::" 1072 - } 1073 - print_section_end() { 1074 - print_section_end_NAME=$1 1075 - shift 1076 - printf "::endgroup::\n" 1077 - } 1078 - else 1079 - print_section_start() { 1080 - print_section_start_NAME=$1 1081 - shift 1082 - } 1083 - print_section_end() { 1084 - print_section_end_NAME=$1 1085 - shift 1086 - } 1087 - fi 1088 - 1089 - section_begin() { 1090 - # https://docs.gitlab.com/ee/ci/yaml/script.html#add-color-codes-to-script-output 1091 - section_NAME=$1 1092 - shift 1093 - section_HEADER=$1 1094 - shift 1095 - print_section_start "$section_NAME" 1096 - printf "${TXT_SECTION}%s${TXT_CLEAR}\n" "$section_HEADER" 1097 - } 1098 - 1099 - section_end() { 1100 - section_NAME=$1 1101 - shift 1102 - print_section_end "$section_NAME" 1103 - } 1104 - 1105 - # ------------------- Other Functions ----------------- 1106 - 1107 - transfer_dir() { 1108 - transfer_dir_SRC=$1 1109 - shift 1110 - transfer_dir_DST=$1 1111 - shift 1112 - # Remove the destination directory completely, but make sure the parent of the 1113 - # destination directory exists so `mv` will work 1114 - install -d "$transfer_dir_DST" 1115 - rm -rf "$transfer_dir_DST" 1116 - # Move 1117 - mv "$transfer_dir_SRC" "$transfer_dir_DST" 1118 - } 1119 - 1120 - # Set TEMP variable which is used, among other things, for OCaml's 1121 - # [Filename.temp_dir_name] on Win32, and by with-dkml.exe on Windows 1122 - export_temp_for_windows() { 1123 - if [ -x /usr/bin/cygpath ]; then 1124 - if [ -n "${RUNNER_TEMP:-}" ]; then 1125 - # GitHub Actions 1126 - TEMP=$(cygpath -am "$RUNNER_TEMP") 1127 - else 1128 - # GitLab CI/CD or desktop 1129 - install -d .ci/tmp 1130 - TEMP=$(cygpath -am ".ci/tmp") 1131 - fi 1132 - export TEMP 1133 - fi 1134 - } 1135 - 1136 - # Fixup opam_root on Windows to be mixed case. 1137 - # On input the following variables must be present: 1138 - # - opam_root 1139 - # - opam_root_cacheable 1140 - # On output the input variables will be modified _and_ the 1141 - # following variables will be available: 1142 - # - original_opam_root 1143 - # - original_opam_root_cacheable 1144 - # - unix_opam_root 1145 - # - unix_opam_root_cacheable 1146 - fixup_opam_root() { 1147 - # shellcheck disable=SC2034 1148 - original_opam_root=$opam_root 1149 - # shellcheck disable=SC2034 1150 - original_opam_root_cacheable=$opam_root_cacheable 1151 - if [ -x /usr/bin/cygpath ]; then 1152 - opam_root=$(/usr/bin/cygpath -m "$opam_root") 1153 - opam_root_cacheable=$(/usr/bin/cygpath -m "$opam_root_cacheable") 1154 - unix_opam_root=$(/usr/bin/cygpath -u "$opam_root") 1155 - unix_opam_root_cacheable=$(/usr/bin/cygpath -u "$opam_root_cacheable") 1156 - else 1157 - # shellcheck disable=SC2034 1158 - unix_opam_root=$opam_root 1159 - # shellcheck disable=SC2034 1160 - unix_opam_root_cacheable=$opam_root_cacheable 1161 - fi 1162 - } 1163 - '@ 1164 - Set-Content -Path ".ci\sd4\common-values.sh" -Encoding Unicode -Value $Content 1165 - msys64\usr\bin\bash -lc 'dos2unix .ci/sd4/common-values.sh' 1166 - 1167 - 1168 - $Content = @' 1169 - #!/bin/sh 1170 - 1171 - # ================ 1172 - # checkout-code.sh 1173 - # ================ 1174 - # 1175 - # Checkouts all of the git source code. 1176 - # 1177 - # This should be done outside of 1178 - # dockcross (used by Linux) since a Docker-in-Docker container can have 1179 - # difficulties doing a git checkout (the Git credentials for any private 1180 - # repositories are likely not present). We don't care about any private 1181 - # repositories for DKML but any code that extends this (ex. DKSDK) may 1182 - # need to use private repositories. 1183 - 1184 - set -euf 1185 - 1186 - setup_WORKSPACE_VARNAME=$1 1187 - shift 1188 - setup_WORKSPACE=$1 1189 - shift 1190 - 1191 - if [ -x /usr/bin/cygpath ]; then 1192 - setup_WORKSPACE=$(/usr/bin/cygpath -au "$setup_WORKSPACE") 1193 - fi 1194 - 1195 - # ------------------------ Functions ------------------------ 1196 - 1197 - # shellcheck source=./common-values.sh 1198 - . .ci/sd4/common-values.sh 1199 - 1200 - # Disable automatic garbage collection 1201 - git_disable_gc() { 1202 - git_disable_gc_NAME=$1 1203 - shift 1204 - git -C ".ci/sd4/g/$git_disable_gc_NAME" config --local gc.auto 0 1205 - } 1206 - 1207 - # Mimic the behavior of GitHub's actions/checkout@v3 1208 - # - the plus symbol in 'git fetch ... origin +REF:refs/tags/v0.0' overrides any existing REF 1209 - git_checkout() { 1210 - git_checkout_NAME=$1 1211 - shift 1212 - git_checkout_URL=$1 1213 - shift 1214 - git_checkout_REF=$1 1215 - shift 1216 - 1217 - if [ -e ".ci/sd4/g/$git_checkout_NAME" ]; then 1218 - git_disable_gc "$git_checkout_NAME" 1219 - git -C ".ci/sd4/g/$git_checkout_NAME" remote set-url origin "$git_checkout_URL" 1220 - git -C ".ci/sd4/g/$git_checkout_NAME" fetch --no-tags --progress --no-recurse-submodules --depth=1 origin "+${git_checkout_REF}:refs/tags/v0.0" 1221 - else 1222 - install -d ".ci/sd4/g/$git_checkout_NAME" 1223 - git -C ".ci/sd4/g/$git_checkout_NAME" -c init.defaultBranch=main init 1224 - git_disable_gc "$git_checkout_NAME" 1225 - git -C ".ci/sd4/g/$git_checkout_NAME" remote add origin "$git_checkout_URL" 1226 - git -C ".ci/sd4/g/$git_checkout_NAME" fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin "+${git_checkout_REF}:refs/tags/v0.0" 1227 - fi 1228 - git -C ".ci/sd4/g/$git_checkout_NAME" -c advice.detachedHead=false checkout --progress --force refs/tags/v0.0 1229 - git -C ".ci/sd4/g/$git_checkout_NAME" log -1 --format='%H' 1230 - } 1231 - 1232 - # --------------------------------------------------------------------- 1233 - 1234 - section_begin checkout-info "Summary: code checkout" 1235 - 1236 - # shellcheck disable=SC2154 1237 - echo " 1238 - ================ 1239 - checkout-code.sh 1240 - ================ 1241 - . 1242 - --------- 1243 - Arguments 1244 - --------- 1245 - WORKSPACE_VARNAME=$setup_WORKSPACE_VARNAME 1246 - WORKSPACE=$setup_WORKSPACE 1247 - . 1248 - ------ 1249 - Inputs 1250 - ------ 1251 - VERBOSE=${VERBOSE:-} 1252 - . 1253 - ------ 1254 - Matrix 1255 - ------ 1256 - dkml_host_abi=$dkml_host_abi 1257 - . 1258 - " 1259 - 1260 - section_end checkout-info 1261 - 1262 - install -d .ci/sd4/g 1263 - 1264 - # dkml-runtime-distribution 1265 - 1266 - # For 'Diagnose Visual Studio environment variables (Windows)' we need dkml-runtime-distribution 1267 - # so that 'Import-Module Machine' and 'Get-VSSetupInstance' can be run. 1268 - # The version doesn't matter too much, as long as it has a functioning Get-VSSetupInstance 1269 - # that supports the Visual Studio versions of the latest GitLab CI and GitHub Actions machines. 1270 - # commit 4d6f1bfc3510c55ba4273cb240e43727854b5718 = WinSDK 19041 and VS 14.29 1271 - case "$dkml_host_abi" in 1272 - windows_*) 1273 - section_begin checkout-dkml-runtime-distribution 'Checkout dkml-runtime-distribution' 1274 - git_checkout dkml-runtime-distribution https://github.com/diskuv/dkml-runtime-distribution.git "4d6f1bfc3510c55ba4273cb240e43727854b5718" 1275 - section_end checkout-dkml-runtime-distribution 1276 - ;; 1277 - esac 1278 - 1279 - '@ 1280 - Set-Content -Path ".ci\sd4\run-checkout-code.sh" -Encoding Unicode -Value $Content 1281 - msys64\usr\bin\bash -lc 'dos2unix .ci/sd4/run-checkout-code.sh' 1282 - 1283 - 1284 - $Content = @' 1285 - #!/bin/sh 1286 - set -euf 1287 - 1288 - # Constants 1289 - SHA512_DEVNULL='cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e' 1290 - 1291 - setup_WORKSPACE_VARNAME=$1 1292 - shift 1293 - setup_WORKSPACE=$1 1294 - shift 1295 - 1296 - if [ -x /usr/bin/cygpath ]; then 1297 - setup_WORKSPACE=$(/usr/bin/cygpath -au "$setup_WORKSPACE") 1298 - fi 1299 - 1300 - # ------------------ Variables and functions ------------------------ 1301 - 1302 - # shellcheck source=./common-values.sh 1303 - . .ci/sd4/common-values.sh 1304 - 1305 - if [ "${VERBOSE:-}" = "true" ]; then 1306 - do_tar_rf() { 1307 - tar rvf "$@" 1308 - } 1309 - else 1310 - do_tar_rf() { 1311 - tar rf "$@" 1312 - } 1313 - fi 1314 - 1315 - # Make the standard input work as an OCaml string. 1316 - # This currently only escapes backslashes and double quotes. 1317 - escape_arg_as_ocaml_string() { 1318 - escape_arg_as_ocaml_string_ARG=$1 1319 - shift 1320 - printf "%s" "$escape_arg_as_ocaml_string_ARG" | sed 's#\\#\\\\#g; s#"#\\"#g;' 1321 - } 1322 - 1323 - # Fixup opam_root on Windows to be mixed case. Set original_* and unix_* as well. 1324 - fixup_opam_root 1325 - 1326 - # Set TEMP variable for Windows 1327 - export_temp_for_windows 1328 - 1329 - # Load VS studio environment 1330 - if [ -e .ci/sd4/vsenv.sh ]; then 1331 - # shellcheck disable=SC1091 1332 - . .ci/sd4/vsenv.sh 1333 - fi 1334 - 1335 - # ------------------------------------------------------------------- 1336 - 1337 - section_begin setup-info "Summary: setup-dkml" 1338 - 1339 - SKIP_OPAM_MODIFICATIONS=${SKIP_OPAM_MODIFICATIONS:-false} # default is false 1340 - 1341 - # shellcheck disable=SC2154 1342 - echo " 1343 - ============= 1344 - setup-dkml.sh 1345 - ============= 1346 - . 1347 - --------- 1348 - Arguments 1349 - --------- 1350 - WORKSPACE_VARNAME=$setup_WORKSPACE_VARNAME 1351 - WORKSPACE=$setup_WORKSPACE 1352 - . 1353 - ------ 1354 - Inputs 1355 - ------ 1356 - FDOPEN_OPAMEXE_BOOTSTRAP=${FDOPEN_OPAMEXE_BOOTSTRAP:-} 1357 - DISKUV_OPAM_REPOSITORY=${DISKUV_OPAM_REPOSITORY:-} 1358 - DKML_COMPILER=${DKML_COMPILER:-} 1359 - OCAML_COMPILER=${OCAML_COMPILER:-} 1360 - CONF_DKML_CROSS_TOOLCHAIN=${CONF_DKML_CROSS_TOOLCHAIN:-} 1361 - SKIP_OPAM_MODIFICATIONS=${SKIP_OPAM_MODIFICATIONS:-} 1362 - SECONDARY_SWITCH=${SECONDARY_SWITCH:-} 1363 - PRIMARY_SWITCH_SKIP_INSTALL=${PRIMARY_SWITCH_SKIP_INSTALL:-} 1364 - MANYLINUX=${MANYLINUX:-} 1365 - DKML_HOME=${DKML_HOME:-} 1366 - VERBOSE=${VERBOSE:-} 1367 - . 1368 - ------------------- 1369 - Generated Constants 1370 - ------------------- 1371 - DKML_VERSION=$DKML_VERSION 1372 - DEFAULT_DISKUV_OPAM_REPOSITORY_TAG=$DEFAULT_DISKUV_OPAM_REPOSITORY_TAG 1373 - DEFAULT_DKML_COMPILER=$DEFAULT_DKML_COMPILER 1374 - . 1375 - ------ 1376 - Matrix 1377 - ------ 1378 - dkml_host_abi=$dkml_host_abi 1379 - bootstrap_opam_version=$bootstrap_opam_version 1380 - abi_pattern=$abi_pattern 1381 - opam_root=${opam_root} 1382 - opam_root_cacheable=${opam_root_cacheable} 1383 - original_opam_root=${original_opam_root} 1384 - original_opam_root_cacheable=${original_opam_root_cacheable} 1385 - unix_opam_root=${unix_opam_root} 1386 - unix_opam_root_cacheable=${unix_opam_root_cacheable} 1387 - dockcross_image=${dockcross_image:-} 1388 - dockcross_image_custom_prefix=${dockcross_image_custom_prefix:-} 1389 - dockcross_run_extra_args=${dockcross_run_extra_args:-} 1390 - docker_runner=${docker_runner:-} 1391 - in_docker=${in_docker:-} 1392 - ocaml_options=${ocaml_options:-} 1393 - . 1394 - ---- 1395 - Pins 1396 - ---- 1397 - " 1398 - set | grep ^PIN_ 1399 - echo ". 1400 - " 1401 - case "$dkml_host_abi" in 1402 - windows_*) 1403 - # shellcheck disable=SC2153 1404 - echo " 1405 - ------------- 1406 - Visual Studio 1407 - ------------- 1408 - VS_DIR=$VS_DIR 1409 - VS_VCVARSVER=$VS_VCVARSVER 1410 - VS_WINSDKVER=$VS_WINSDKVER 1411 - VS_MSVSPREFERENCE=$VS_MSVSPREFERENCE 1412 - VS_CMAKEGENERATOR=$VS_CMAKEGENERATOR 1413 - . 1414 - " 1415 - ;; 1416 - esac 1417 - section_end setup-info 1418 - 1419 - do_bootstrap() { 1420 - # Bootstrap from historical release 1421 - runit_BOOTSTRAPPED=0 1422 - 1423 - # Bootstrap opam from fdopen (Windows) 1424 - if [ "$runit_BOOTSTRAPPED" = 0 ] && [ "${FDOPEN_OPAMEXE_BOOTSTRAP:-}" = "true" ]; then 1425 - if [ -e .ci/sd4/opam64/bin/opam.exe ] && [ -e .ci/sd4/opam64/bin/opam-installer.exe ]; then 1426 - runit_BOOTSTRAPPED=1 1427 - else 1428 - case "$dkml_host_abi" in 1429 - windows_*) 1430 - echo 'Bootstrap opam from fdopen (Windows) ...' 1431 - install -d .ci/sd4/bs/bin 1432 - wget -O "$setup_WORKSPACE"/.ci/sd4/opam64.tar.xz https://github.com/fdopen/opam-repository-mingw/releases/download/0.0.0.2/opam64.tar.xz 1433 - 1434 - # this stalls: tar xvCfJ "$setup_WORKSPACE"/.ci/sd4 "$setup_WORKSPACE"/.ci/sd4/opam64.tar.xz 1435 - xz -v -d "$setup_WORKSPACE"/.ci/sd4/opam64.tar.xz 1436 - tar xvCf .ci/sd4 .ci/sd4/opam64.tar 1437 - 1438 - rm -rf "$setup_WORKSPACE"/.ci/sd4/bs/bin/Opam.Runtime.amd64 1439 - mv -v "$setup_WORKSPACE"/.ci/sd4/opam64/bin/Opam.Runtime.amd64/ "$setup_WORKSPACE"/.ci/sd4/bs/bin/ 1440 - mv -v "$setup_WORKSPACE"/.ci/sd4/opam64/bin/opam.exe "$setup_WORKSPACE"/.ci/sd4/bs/bin/ 1441 - mv -v "$setup_WORKSPACE"/.ci/sd4/opam64/bin/opam-installer.exe "$setup_WORKSPACE"/.ci/sd4/bs/bin/ 1442 - 1443 - # diagnostics 1444 - ldd "$setup_WORKSPACE"/.ci/sd4/bs/bin/opam.exe 1445 - ldd "$setup_WORKSPACE"/.ci/sd4/bs/bin/opam-installer.exe 1446 - 1447 - runit_BOOTSTRAPPED=1 1448 - ;; 1449 - esac 1450 - fi 1451 - fi 1452 - 1453 - # Bootstrap from historical release 1454 - if [ "$runit_BOOTSTRAPPED" = 0 ] && [ "$bootstrap_opam_version" != "os" ]; then 1455 - install -d .ci/sd4/bs 1456 - cd .ci/sd4/bs 1457 - 1458 - if [ ! -e version ] || [ "$(cat version)" != "$bootstrap_opam_version" ]; then 1459 - echo 'Bootstrap opam from historical release (non-Windows; Windows non-fdopen) ...' 1460 - if command -v curl > /dev/null 2> /dev/null; then 1461 - curl -L -o opam.tar.gz "https://github.com/diskuv/dkml-component-opam/releases/download/v${bootstrap_opam_version}/dkml-component-staging-opam.tar.gz" 1462 - else 1463 - wget -O opam.tar.gz "https://github.com/diskuv/dkml-component-opam/releases/download/v${bootstrap_opam_version}/dkml-component-staging-opam.tar.gz" 1464 - fi 1465 - tar tvfz opam.tar.gz 1466 - tar xfz opam.tar.gz "./staging-files/${dkml_host_abi}/" 1467 - rm -rf bin/ 1468 - mv "staging-files/${dkml_host_abi}/bin" . 1469 - rm -rf "${abi_pattern}" 1470 - printf "%s" "${bootstrap_opam_version}" >version 1471 - fi 1472 - 1473 - rm -f opam.tar.gz 1474 - cd ../../.. 1475 - 1476 - runit_BOOTSTRAPPED=1 1477 - fi 1478 - 1479 - # Bootstrap from package manager or GitHub ocaml/opam release 1480 - case "$runit_BOOTSTRAPPED,$bootstrap_opam_version,$dkml_host_abi" in 1481 - 0,os,darwin_*) 1482 - if ! command -v opam; then 1483 - echo 'Bootstrap opam from package manager (macOS) ...' 1484 - brew install gpatch 1485 - brew install opam 1486 - fi 1487 - runit_BOOTSTRAPPED=1 1488 - ;; 1489 - 0,os,linux_x86) 1490 - if [ ! -x .ci/sd4/bs/bin/opam ]; then 1491 - echo 'Bootstrap opam from GitHub ocaml/opam release (Linux x86) ...' 1492 - install -d .ci/sd4/bs/bin 1493 - if command -v curl > /dev/null 2> /dev/null; then 1494 - curl -L -o .ci/sd4/bs/bin/opam.tmp https://github.com/ocaml/opam/releases/download/2.1.2/opam-2.1.2-i686-linux 1495 - else 1496 - wget -O .ci/sd4/bs/bin/opam.tmp https://github.com/ocaml/opam/releases/download/2.1.2/opam-2.1.2-i686-linux 1497 - fi 1498 - sha512_check=$(openssl sha512 2>&1 </dev/null | cut -f 2 -d ' ') 1499 - if [ "$SHA512_DEVNULL" = "$sha512_check" ]; then 1500 - sha512=$(openssl sha512 ".ci/sd4/bs/bin/opam.tmp" 2>/dev/null | cut -f 2 -d ' ') 1501 - check="85a480d60e09a7d37fa0d0434ed97a3187434772ceb4e7e8faa5b06bc18423d004af3ad5849c7d35e72dca155103257fd6b1178872df8291583929eb8f884b6a" 1502 - test "$sha512" = "$check" 1503 - chmod +x .ci/sd4/bs/bin/opam.tmp 1504 - mv .ci/sd4/bs/bin/opam.tmp .ci/sd4/bs/bin/opam 1505 - else 1506 - echo "openssl 512 option unsupported." 1507 - exit 61 1508 - fi 1509 - fi 1510 - runit_BOOTSTRAPPED=1 1511 - ;; 1512 - 0,os,linux_x86_64) 1513 - if [ ! -x .ci/sd4/bs/bin/opam ]; then 1514 - echo 'Bootstrap opam from GitHub ocaml/opam release (Linux x86_64) ...' 1515 - install -d .ci/sd4/bs/bin 1516 - if command -v curl > /dev/null 2> /dev/null; then 1517 - curl -L -o .ci/sd4/bs/bin/opam.tmp https://github.com/ocaml/opam/releases/download/2.1.2/opam-2.1.2-x86_64-linux 1518 - else 1519 - wget -O .ci/sd4/bs/bin/opam.tmp https://github.com/ocaml/opam/releases/download/2.1.2/opam-2.1.2-x86_64-linux 1520 - fi 1521 - sha512_check=$(openssl sha512 2>&1 </dev/null | cut -f 2 -d ' ') 1522 - if [ "$SHA512_DEVNULL" = "$sha512_check" ]; then 1523 - sha512=$(openssl sha512 ".ci/sd4/bs/bin/opam.tmp" 2>/dev/null | cut -f 2 -d ' ') 1524 - check="c0657ecbd4dc212587a4da70c5ff0402df95d148867be0e1eb1be8863a2851015f191437c3c99b7c2b153fcaa56cac99169c76ec94c5787750d7a59cd1fbb68b" 1525 - test "$sha512" = "$check" 1526 - chmod +x .ci/sd4/bs/bin/opam.tmp 1527 - mv .ci/sd4/bs/bin/opam.tmp .ci/sd4/bs/bin/opam 1528 - else 1529 - echo "openssl 512 option unsupported." 1530 - exit 61 1531 - fi 1532 - fi 1533 - runit_BOOTSTRAPPED=1 1534 - ;; 1535 - esac 1536 - } 1537 - section_begin bootstrap-opam 'Bootstrap opam' 1538 - do_bootstrap 1539 - section_end bootstrap-opam 1540 - 1541 - # Start environment distribution tarball 1542 - # We use .tar rather than .tar.gz/.tar.bz2 because we can repeatedly add to an uncompressed .tar. But we need to 1543 - # start with an empty tarball since some tar programs will only add ('tar rf xyz.tar') to an existing .tar. 1544 - install -d .ci/sd4/dist 1545 - tar cf .ci/sd4/dist/run-with-env.tar -T /dev/null 1546 - 1547 - do_get_dockcross() { 1548 - if [ -n "${dockcross_image:-}" ]; then 1549 - # The dockcross script is super-slow 1550 - section_begin get-dockcross 'Get dockcross binary (ManyLinux)' 1551 - install -d .ci/sd4 1552 - # shellcheck disable=SC2086 1553 - docker run ${dockcross_run_extra_args:-} --rm "${dockcross_image_custom_prefix:-}${dockcross_image:-}" >.ci/sd4/dockcross.gen 1554 - 1555 - # PROBLEM 1 1556 - # --------- 1557 - # Super-annoying stderr output from dockcross at line: 1558 - # tty -s && [ -z "$MSYS" ] && TTY_ARGS=-ti 1559 - # When there is no tty, get: 1560 - # tty: ignoring all arguments 1561 - # not a tty 1562 - # So replace 'tty -s &&' with 'false &&' 1563 - sed 's/tty -s &&/false \&\&/' .ci/sd4/dockcross.gen >.ci/sd4/dockcross-real 1564 - rm -f .ci/sd4/dockcross.gen 1565 - chmod +x .ci/sd4/dockcross-real 1566 - 1567 - # PROBLEM 2 1568 - # --------- 1569 - # By default dockcross for ManyLinux will chown -R all python packages; super-slow (~10 seconds)! 1570 - # Confer: https://github.com/dockcross/dockcross/blob/master/manylinux-common/pre_exec.sh 1571 - # That kills speed for any repetitive dockcross invocation. 1572 - # 1573 - # BUT it is unnecessary to chown -R when the current user is root, because inside the Docker container 1574 - # the files are already root! 1575 - # 1576 - # The chown -R (within pre_exec.sh) is not run when the user ids are not passed in. 1577 - # Confer: https://github.com/dockcross/dockcross/blob/96d87416f639af0204bdd42553e4b99315ca8476/imagefiles/entrypoint.sh#L21-L53 1578 - # 1579 - # So explicitly call the entrypoint if root! 1580 - if echo "${dockcross_run_extra_args:-}" | grep -q linux/386; then 1581 - # https://github.com/dockcross/dockcross/blob/master/linux-x86/linux32-entrypoint.sh 1582 - # But only when `--platform linux/386` because the container image may be overridden. 1583 - dockcross_entrypoint=/dockcross/linux32-entrypoint.sh 1584 - else 1585 - dockcross_entrypoint=/dockcross/entrypoint.sh 1586 - fi 1587 - cat > .ci/sd4/dockcross <<EOF 1588 - #!/bin/bash 1589 - set -euf 1590 - BUILDER_UID="\$( id -u )" 1591 - BUILDER_GID="\$( id -g )" 1592 - if [ "\$BUILDER_UID" = 0 ] && [ "\$BUILDER_GID" = 0 ]; then 1593 - # ---------- Start of dockcross script snippet ------- 1594 - # Verbatim from 1595 - # https://github.com/dockcross/dockcross/blob/96d87416f639af0204bdd42553e4b99315ca8476/imagefiles/dockcross#L175-L204 1596 - # except 1) disabling of USER_IDS 1597 - 1598 - # Bash on Ubuntu on Windows 1599 - UBUNTU_ON_WINDOWS=\$([ -e /proc/version ] && grep -l Microsoft /proc/version || echo "") 1600 - # MSYS, Git Bash, etc. 1601 - MSYS=\$([ -e /proc/version ] && grep -l MINGW /proc/version || echo "") 1602 - # CYGWIN 1603 - CYGWIN=\$([ -e /proc/version ] && grep -l CYGWIN /proc/version || echo "") 1604 - 1605 - #if [ -z "\$UBUNTU_ON_WINDOWS" -a -z "\$MSYS" -a "\$OCI_EXE" != "podman" ]; then 1606 - # USER_IDS=(-e BUILDER_UID="\$( id -u )" -e BUILDER_GID="\$( id -g )" -e BUILDER_USER="\$( id -un )" -e BUILDER_GROUP="\$( id -gn )") 1607 - #fi 1608 - 1609 - # Change the PWD when working in Docker on Windows 1610 - if [ -n "\$UBUNTU_ON_WINDOWS" ]; then 1611 - WSL_ROOT="/mnt/" 1612 - CFG_FILE=/etc/wsl.conf 1613 - if [ -f "\$CFG_FILE" ]; then 1614 - CFG_CONTENT=\$(cat \$CFG_FILE | sed -r '/[^=]+=[^=]+/!d' | sed -r 's/\s+=\s/=/g') 1615 - eval "\$CFG_CONTENT" 1616 - if [ -n "\$root" ]; then 1617 - WSL_ROOT=\$root 1618 - fi 1619 - fi 1620 - HOST_PWD=\`pwd -P\` 1621 - HOST_PWD=\${HOST_PWD/\$WSL_ROOT//} 1622 - elif [ -n "\$MSYS" ]; then 1623 - HOST_PWD=\$PWD 1624 - HOST_PWD=\${HOST_PWD/\//} 1625 - HOST_PWD=\${HOST_PWD/\//:\/} 1626 - elif [ -n "\$CYGWIN" ]; then 1627 - for f in pwd readlink cygpath ; do 1628 - test -n "\$(type "\${f}" )" || { echo >&2 "Missing functionality (\${f}) (in cygwin)." ; exit 1 ; } ; 1629 - done ; 1630 - HOST_PWD="\$( cygpath -w "\$( readlink -f "\$( pwd ;)" ; )" ; )" ; 1631 - else 1632 - HOST_PWD=\$PWD 1633 - [ -L \$HOST_PWD ] && HOST_PWD=\$(readlink \$HOST_PWD) 1634 - fi 1635 - 1636 - # ---------- End of dockcross script snippet ------- 1637 - 1638 - # Handle: dockcross --args "-v X:Y --platform P" 1639 - ARGS= 1640 - if [ "\$#" -ge 1 ] && [ "\$1" = "--args" ]; then 1641 - shift 1642 - ARGS=\$1 1643 - shift 1644 - fi 1645 - 1646 - # Directly invoke entrypoint 1647 - exec docker run --entrypoint /bin/bash \ 1648 - --rm \ 1649 - \${ARGS:-} \ 1650 - -v "\$HOST_PWD":/work \ 1651 - ${dockcross_image_custom_prefix:-}${dockcross_image:-} ${dockcross_entrypoint} "\$@" 1652 - else 1653 - HERE=\$(dirname "\$0") 1654 - HERE=\$(cd "\$HERE" && pwd) 1655 - exec "\$HERE/dockcross-real" "\$@" 1656 - fi 1657 - EOF 1658 - chmod +x .ci/sd4/dockcross 1659 - 1660 - # Bundle for consumers of setup-dkml.yml 1661 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/dockcross .ci/sd4/dockcross-real 1662 - 1663 - section_end get-dockcross 1664 - fi 1665 - } 1666 - do_get_dockcross 1667 - 1668 - if [ -n "${dockcross_image:-}" ]; then 1669 - # rsync needs to be available, even after Docker container disappears 1670 - if [ ! -e .ci/sd4/bs/bin/rsync ]; then 1671 - section_begin get-opam-prereqs-in-dockcross 'Get Opam prerequisites (ManyLinux)' 1672 - install -d .ci/sd4/bs/bin 1673 - # Install rsync with 'yum' (ManyLinux) or 'apt' (dockcross/linux-x64, etc.) 1674 - # if not present. 1675 - # shellcheck disable=SC2016 1676 - .ci/sd4/dockcross --args "${dockcross_run_extra_args:-}" sh -c 'if ! command -v rsync; then if command -v yum; then sudo yum install -y rsync; else sudo apt-get install -qq -o=Dpkg::Use-Pty=0 -y rsync; fi; fi && install $(command -v rsync) .ci/sd4/bs/bin' 1677 - section_end get-opam-prereqs-in-dockcross 1678 - fi 1679 - fi 1680 - 1681 - # Opam prerequisites for using opam (not for installing opam) 1682 - 1683 - { 1684 - if [ -n "${docker_runner:-}" ]; then 1685 - # rsync needs to be available, even after Docker container disappears 1686 - if [ ! -e .ci/sd4/bs/bin/rsync.deps ]; then 1687 - section_begin get-opam-prereqs-in-docker 'Get Opam prerequisites (Linux Docker)' 1688 - install -d .ci/sd4/bs/bin 1689 - ${docker_runner} sh -c ' 1690 - apt-get update -qq -o=Dpkg::Use-Pty=0 && 1691 - apt-get install -qq -o=Dpkg::Use-Pty=0 -y rsync && 1692 - ldd /usr/bin/rsync && 1693 - ls -l /lib/i386-linux-gnu/libpopt.so.0 /lib/i386-linux-gnu/libacl.so.1 /lib/i386-linux-gnu/libattr.so.1 && 1694 - tar cCfhz / /work/.ci/sd4/bs/bin/deps.tar.gz /usr/bin/rsync /lib/i386-linux-gnu/libpopt.so.0 1695 - ' 1696 - touch .ci/sd4/bs/bin/rsync.deps 1697 - section_end get-opam-prereqs-in-docker 1698 - fi 1699 - fi 1700 - 1701 - # Bundle Opam prerequisites (ManyLinux or Linux Docker) 1702 - if [ -n "${docker_runner:-}" ] || [ -n "${dockcross_image:-}" ]; then 1703 - # Bundle for consumers of setup-dkml.yml 1704 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/bs/bin/rsync 1705 - fi 1706 - } 1707 - 1708 - # Get Opam Cache 1709 - do_get_opam_cache() { 1710 - if [ "$unix_opam_root_cacheable" = "$unix_opam_root" ]; then return; fi 1711 - if [ ! -e "$unix_opam_root_cacheable" ]; then return; fi 1712 - section_begin get-opam-cache "Transferring Opam cache to $original_opam_root_cacheable" 1713 - echo Starting transfer # need some output or GitLab CI will not display the section duration 1714 - transfer_dir "$unix_opam_root_cacheable" "$unix_opam_root" 1715 - echo Finished transfer 1716 - section_end get-opam-cache 1717 - } 1718 - do_get_opam_cache 1719 - 1720 - # Setup Opam 1721 - 1722 - do_write_opam_scripts() { 1723 - case "${FDOPEN_OPAMEXE_BOOTSTRAP:-},$dkml_host_abi" in 1724 - true,windows_*) 1725 - # With fdopen's opam.exe, 'os-distribution = "cygwinports"'. But native Windows opam.exe has 'os-distribution = "win32"'. 1726 - # But on Windows we always want MSYS2 or native Windows libraries, not Cygwin. If cygwinports then 1727 - # code like https://github.com/ocaml/opam-repository/blob/08cbb8258bd4bf30cd6f307c958911a29d537b54/packages/conf-pkg-config/conf-pkg-config.2/opam#L36 1728 - # will fail. So always set 'os-distribution = "win32"' on Windows. 1729 - PATCH_OS_DISTRIBUTION_WIN32=true 1730 - # With fdopen's opam.exe, no 'exe = ".exe"' is set because Cygwin does not need file extensions. 1731 - # Native Windows requires a .exe extension. 1732 - PATCH_EXE_WIN32=true 1733 - ;; 1734 - *) 1735 - PATCH_OS_DISTRIBUTION_WIN32=false 1736 - PATCH_EXE_WIN32=false 1737 - ;; 1738 - esac 1739 - 1740 - # --------------------- 1741 - # Empty opam repository 1742 - # --------------------- 1743 - 1744 - install -d .ci/sd4/eor 1745 - cat >.ci/sd4/eor/repo <<EOF 1746 - opam-version: "2.0" 1747 - browse: "https://opam.ocaml.org/pkg/" 1748 - upstream: "https://github.com/ocaml/opam-repository/tree/master/" 1749 - EOF 1750 - 1751 - # --------------- 1752 - # Create Opam troubleshooting script 1753 - # Dump logs modified within the last 4 hours 1754 - # --------------- 1755 - 1756 - cat >.ci/sd4/troubleshoot-opam.sh <<EOF 1757 - #!/bin/sh 1758 - set -euf 1759 - OPAMROOT=\$1 1760 - shift 1761 - if find . -maxdepth 0 -mmin -240 2>/dev/null >/dev/null; then 1762 - FINDARGS="-mmin -240" # is -mmin supported? BSD (incl. macOS), MSYS2, GNU 1763 - else 1764 - FINDARGS="-mtime -1" # use 1 day instead. Solaris 1765 - fi 1766 - printf "\n\n========= [START OF TROUBLESHOOTING] ===========\n\n" >&2 1767 - find "\$OPAMROOT"/log -mindepth 1 -maxdepth 1 \$FINDARGS -name "*.out" ! -name "log-*.out" ! -name "ocaml-variants-*.out" | while read -r dump_on_error_LOG; do 1768 - dump_on_error_BLOG=\$(basename "\$dump_on_error_LOG") 1769 - printf "\n\n========= [TROUBLESHOOTING] %s ===========\n\n" "\$dump_on_error_BLOG" >&2 1770 - awk -v BLOG="\$dump_on_error_BLOG" '{print "[" BLOG "]", \$0}' "\$dump_on_error_LOG" >&2 1771 - done 1772 - printf "\nScroll up to see the [TROUBLESHOOTING] logs that begin at the [START OF TROUBLESHOOTING] line\n" >&2 1773 - EOF 1774 - 1775 - chmod +x .ci/sd4/troubleshoot-opam.sh 1776 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/troubleshoot-opam.sh 1777 - 1778 - # --------------- 1779 - # Create Opam support scripts (not needed for all platforms) 1780 - # The PATH to find opam must work internally in setup-dkml.yml (sd4/bs/bin) and 1781 - # by consumers of setup-dkml.yml (sd4/opamexe) 1782 - # --------------- 1783 - 1784 - USER_ID=$(id -u) 1785 - GROUP_ID=$(id -g) 1786 - USER_NAME=$(id -un) 1787 - GROUP_NAME=$(id -gn) 1788 - 1789 - case "${opam_root}" in 1790 - /* | ?:*) # /a/b/c or C:\Windows 1791 - validate_supports_docker() { 1792 - echo "Docker only supported with relative paths for the opam root, not: ${opam_root}" >&2 1793 - exit 3 1794 - } 1795 - ;; 1796 - *) # relative path 1797 - validate_supports_docker() { 1798 - true 1799 - } 1800 - cat >.ci/sd4/run-in-docker <<EOF 1801 - #!/bin/sh 1802 - set -euf 1803 - export PATH="/work/.ci/local/bin:/work/.ci/sd4/bs/bin:/work/.ci/sd4/opamexe:\$PATH" 1804 - export OPAMROOT=/work/${opam_root} 1805 - export OPAMROOTISOK=1 1806 - if [ "${PATCH_OS_DISTRIBUTION_WIN32}" = true ]; then export OPAMVAR_os_distribution=win32; fi 1807 - if [ "${PATCH_EXE_WIN32}" = true ]; then export OPAMVAR_exe=.exe; fi 1808 - 1809 - # Reset environment so no conflicts with a parent Opam or OCaml system 1810 - unset OPAM_SWITCH_PREFIX 1811 - unset OPAMSWITCH 1812 - unset CAML_LD_LIBRARY_PATH 1813 - unset OCAMLLIB 1814 - unset OCAML_TOPLEVEL_PATH 1815 - 1816 - prog=\$1 1817 - shift 1818 - 1819 - # Optionally skip troubleshooting 1820 - troubleshooting=1 1821 - if [ "\$#" -ge 1 ] && [ "\$prog" = opam ] && [ "\$1" = "--no-troubleshooting" ]; then 1822 - shift 1823 - troubleshooting=0 1824 - fi 1825 - 1826 - echo "Running inside Docker container: \$prog \$*" >&2 1827 - set +e 1828 - "\$prog" "\$@" 1829 - exitcode=\$? 1830 - if [ \$troubleshooting = 1 ] && [ \$prog = opam ]; then 1831 - [ \$exitcode = 0 ] || "/work/.ci/sd4/troubleshoot-opam.sh" \$OPAMROOT 1832 - fi 1833 - exit \$exitcode 1834 - EOF 1835 - chmod +x .ci/sd4/run-in-docker 1836 - ;; 1837 - esac 1838 - 1839 - cat >.ci/sd4/deescalate <<EOF 1840 - #!/bin/sh 1841 - set -euf 1842 - 1843 - if [ -e /work/.ci/sd4/bs/bin/deps.tar.gz ]; then 1844 - tar xCfz / /work/.ci/sd4/bs/bin/deps.tar.gz 1845 - fi 1846 - 1847 - groupadd -g ${GROUP_ID} ${GROUP_NAME} 1848 - useradd -l -m -u ${USER_ID} -g ${GROUP_ID} ${USER_NAME} 1849 - exec runuser -u ${USER_NAME} -g ${GROUP_NAME} -- "\$@" 1850 - EOF 1851 - 1852 - chmod +x .ci/sd4/deescalate 1853 - 1854 - # ----------------------------------- 1855 - # Create run-with-env 1856 - # ----------------------------------- 1857 - 1858 - install -d .ci/sd4/dist 1859 - 1860 - if [ -x .ci/sd4/dockcross ]; then 1861 - # Adding empty dockcross root volume avoids: 1862 - # cp: target ‘/home/root/’ is not a directory 1863 - # chown: cannot access ‘/home/root’: No such file or directory 1864 - # from https://github.com/dockcross/dockcross/blob/96d87416f639af0204bdd42553e4b99315ca8476/imagefiles/entrypoint.sh#L31-L32 1865 - install -d .ci/sd4/edr 1866 - 1867 - cat >.ci/sd4/run-with-env <<EOF 1868 - #!/bin/sh 1869 - set -euf 1870 - 1871 - HERE=\$(dirname "\$0") 1872 - HERE=\$(cd "\$HERE" && pwd) 1873 - PROJECT_DIR=\$(cd "\$HERE"/../.. && pwd) 1874 - 1875 - # Optionally enable terminal if and only if '-it' option given 1876 - termargs= 1877 - if [ "\$#" -ge 1 ] && [ "\$1" = "-it" ]; then 1878 - shift 1879 - termargs=-it 1880 - fi 1881 - 1882 - exec bash "\${PROJECT_DIR}"/.ci/sd4/dockcross --args "\${termargs} -v \${PROJECT_DIR}/.ci/sd4/edr:/home/root ${dockcross_run_extra_args:-}" /work/.ci/sd4/run-in-docker "\$@" 1883 - EOF 1884 - chmod +x .ci/sd4/run-with-env 1885 - 1886 - validate_supports_docker 1887 - 1888 - # Bundle for consumers of setup-dkml.yml 1889 - echo '__ run-in-docker __' >&2 1890 - cat .ci/sd4/run-in-docker >&2 1891 - echo '___________________' >&2 1892 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/run-with-env .ci/sd4/run-in-docker .ci/sd4/edr 1893 - 1894 - elif [ -n "${docker_runner:-}" ]; then 1895 - 1896 - cat >.ci/sd4/run-with-env <<EOF 1897 - #!/bin/sh 1898 - set -euf 1899 - exec ${docker_runner:-} /work/.ci/sd4/deescalate /work/.ci/sd4/run-in-docker "\$@" 1900 - EOF 1901 - chmod +x .ci/sd4/run-with-env 1902 - 1903 - validate_supports_docker 1904 - 1905 - # Bundle for consumers of setup-dkml.yml 1906 - echo '__ run-in-docker __' >&2 1907 - cat .ci/sd4/run-in-docker >&2 1908 - echo '________________________' >&2 1909 - echo '__ deescalate __' >&2 1910 - cat .ci/sd4/deescalate >&2 1911 - echo '________________' >&2 1912 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/run-with-env .ci/sd4/run-in-docker .ci/sd4/deescalate 1913 - 1914 - else 1915 - 1916 - cat >.ci/sd4/run-with-env <<EOF 1917 - #!/bin/sh 1918 - set -euf 1919 - 1920 - HERE=\$(dirname "\$0") 1921 - HERE=\$(cd "\$HERE" && pwd) 1922 - PROJECT_DIR=\$(cd "\$HERE"/../.. && pwd) 1923 - 1924 - export PATH="\${PROJECT_DIR}/.ci/local/bin:\${PROJECT_DIR}/.ci/sd4/bs/bin:\${PROJECT_DIR}/.ci/sd4/opamexe:\$PATH" 1925 - export OPAMROOT='${opam_root}' 1926 - export OPAMROOTISOK=1 1927 - if [ "${PATCH_OS_DISTRIBUTION_WIN32}" = true ]; then export OPAMVAR_os_distribution=win32; fi 1928 - if [ "${PATCH_EXE_WIN32}" = true ]; then export OPAMVAR_exe=.exe; fi 1929 - 1930 - # Reset environment so no conflicts with a parent Opam or OCaml system 1931 - unset OPAM_SWITCH_PREFIX 1932 - unset OPAMSWITCH 1933 - unset CAML_LD_LIBRARY_PATH 1934 - unset OCAMLLIB 1935 - unset OCAML_TOPLEVEL_PATH 1936 - 1937 - prog=\$1 1938 - shift 1939 - 1940 - # Optionally skip troubleshooting 1941 - troubleshooting=1 1942 - if [ "\$#" -ge 1 ] && [ "\$prog" = opam ] && [ "\$1" = "--no-troubleshooting" ]; then 1943 - shift 1944 - troubleshooting=0 1945 - fi 1946 - 1947 - echo "Running: \$prog \$*" >&2 1948 - set +e 1949 - "\$prog" "\$@" 1950 - exitcode=\$? 1951 - if [ \$troubleshooting = 1 ] && [ \$prog = opam ]; then 1952 - [ \$exitcode = 0 ] || "\${PROJECT_DIR}/.ci/sd4/troubleshoot-opam.sh" \$OPAMROOT 1953 - fi 1954 - exit \$exitcode 1955 - EOF 1956 - chmod +x .ci/sd4/run-with-env 1957 - 1958 - # Bundle for consumers of setup-dkml.yml 1959 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/run-with-env 1960 - 1961 - fi 1962 - echo '__ run-with-env __' >&2 1963 - cat .ci/sd4/run-with-env >&2 1964 - echo '__________________' >&2 1965 - 1966 - # ------ 1967 - # cmdrun 1968 - # ------ 1969 - 1970 - install -d .ci/sd4/opamrun 1971 - cat >.ci/sd4/opamrun/cmdrun <<EOF 1972 - #!/bin/sh 1973 - set -euf 1974 - 1975 - HERE=\$(dirname "\$0") 1976 - HERE=\$(cd "\$HERE" && pwd) 1977 - PROJECT_DIR=\$(cd "\$HERE"/../../.. && pwd) 1978 - 1979 - # Add MSVC compiler environment if available 1980 - if [ -e "\${PROJECT_DIR}/.ci/sd4/msvcenv" ]; then 1981 - _oldpath="\$PATH" 1982 - # shellcheck disable=SC1091 1983 - . "\${PROJECT_DIR}/.ci/sd4/msvcenv" 1984 - PATH="\$PATH:\$_oldpath" 1985 - 1986 - # MSVC (link.exe) needs a TMP as well. 1987 - # Confer: https://docs.microsoft.com/en-us/cpp/build/reference/linking?view=msvc-170#link-environment-variables 1988 - if [ -z "\${TMP:-}" ]; then 1989 - # GitHub Actions as of 2022-10 does not set TMP. GitLab CI/CD does. 1990 - TMP="\$RUNNER_TEMP" 1991 - fi 1992 - export TMP 1993 - if [ -x /usr/bin/cygpath ]; then 1994 - TMP=\$(/usr/bin/cygpath -aw "\$TMP") 1995 - fi 1996 - fi 1997 - 1998 - # Windows 1999 - if [ -n "\${COMSPEC:-}" ]; then 2000 - # We must place MSYS2 in front of path so that MSYS2 2001 - # tar.exe is used instead of Windows tar.exe. 2002 - PATH="/usr/bin:\$PATH" 2003 - fi 2004 - 2005 - exec "\${PROJECT_DIR}/.ci/sd4/run-with-env" "\$@" 2006 - EOF 2007 - chmod +x .ci/sd4/opamrun/cmdrun 2008 - 2009 - # ------- 2010 - # opamrun 2011 - # ------- 2012 - 2013 - install -d .ci/sd4/opamrun 2014 - cat >.ci/sd4/opamrun/opamrun <<EOF 2015 - #!/bin/sh 2016 - set -euf 2017 - 2018 - HERE=\$(dirname "\$0") 2019 - HERE=\$(cd "\$HERE" && pwd) 2020 - PROJECT_DIR=\$(cd "\$HERE"/../../.. && pwd) 2021 - 2022 - exec "\${PROJECT_DIR}/.ci/sd4/opamrun/cmdrun" opam "\$@" 2023 - EOF 2024 - chmod +x .ci/sd4/opamrun/opamrun 2025 - 2026 - # Bundle for consumers of setup-dkml.yml 2027 - do_tar_rf .ci/sd4/dist/run-with-env.tar .ci/sd4/opamrun 2028 - } 2029 - section_begin 'write-opam-scripts' 'Write opam scripts' 2030 - do_write_opam_scripts 2031 - section_end 'write-opam-scripts' 2032 - 2033 - # Expose opamrun (also used for consumers of setup-dkml.yml) to GitHub 2034 - if [ -n "${GITHUB_PATH:-}" ]; then 2035 - opamrunabs="$setup_WORKSPACE/.ci/sd4/opamrun" 2036 - if [ -x /usr/bin/cygpath ]; then opamrunabs=$(/usr/bin/cygpath -aw "$opamrunabs"); fi 2037 - echo "$opamrunabs" >>"$GITHUB_PATH" 2038 - # Special case: GITHUB_PATH does not influence msys2.CMD of msys2/setup-msys2@v2, so place in real MSYS2 PATH 2039 - if [ -n "${MSYSTEM:-}" ]; then 2040 - install -d /usr/local/bin 2041 - install .ci/sd4/opamrun/opamrun /usr/local/bin/opamrun 2042 - fi 2043 - fi 2044 - 2045 - # Place opamrun in the immediate PATH 2046 - PATH="$setup_WORKSPACE/.ci/sd4/opamrun:$PATH" 2047 - 2048 - # Complicated Opam sequence is because: 2049 - # 1. Opam's default curl does not work on Windows, 2050 - # and `opam init` does not provide a way to change it (TODO: need 2051 - # a PR!). 2052 - # 2. We have to separate the Opam download cache from the other Opam 2053 - # caches 2054 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ] && [ ! -s "$opam_root/.ci.root-init" ]; then # non-empty init file so can be cached irrespective of existence 2055 - section_begin opam-init 'Initialize opam root' 2056 - 2057 - # Clear any partial previous attempt 2058 - rm -rf "$opam_root" 2059 - 2060 - case "$dkml_host_abi,${in_docker:-}" in 2061 - windows_*,*) 2062 - eor=$(cygpath -am "$setup_WORKSPACE"/.ci/sd4/eor) 2063 - opamrun init --disable-sandboxing --no-setup --kind local --bare "$eor" 2064 - case "$(opamrun --version)" in 2065 - 2.0.*) echo 'download-command: wget' >>"$opam_root/config" ;; 2066 - *) opamrun option --yes --global download-command=wget ;; 2067 - esac 2068 - ;; 2069 - *,true) 2070 - opamrun init --disable-sandboxing --no-setup --kind local --bare "/work/.ci/sd4/eor" 2071 - ;; 2072 - *) 2073 - opamrun init --disable-sandboxing --no-setup --kind local --bare "$setup_WORKSPACE/.ci/sd4/eor" 2074 - ;; 2075 - esac 2076 - echo yes > "$opam_root/.ci.root-init" 2077 - 2078 - section_end opam-init 2079 - fi 2080 - 2081 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2082 - section_begin opam-vars "Summary: opam global variables" 2083 - opamrun --no-troubleshooting var --global || true 2084 - section_end opam-vars 2085 - fi 2086 - 2087 - # Build OCaml 2088 - 2089 - do_switch_create() { 2090 - do_switch_create_NAME=$1 2091 - shift 2092 - 2093 - section_begin "switch-create-$do_switch_create_NAME" "Create opam switch '$do_switch_create_NAME'" 2094 - # Create, or recreate, the Opam switch. The Opam switch should not be 2095 - # cached except for the compiler (confer docs for setup-ocaml GitHub 2096 - # Action) which is the 'dkml' switch (or the 'two' switch). 2097 - # Check if the switch name is present in the Opam root (which may come from cache) 2098 - NOMINALLY_PRESENT=false 2099 - if opamrun switch list --short | grep "^${do_switch_create_NAME}\$"; then NOMINALLY_PRESENT=true; fi 2100 - 2101 - # Check if the switch is actually present in case of cache incoherence 2102 - # or corrupt Opam state that could result in: 2103 - # Error: No config file found for switch dkml. Switch broken? 2104 - if [ $NOMINALLY_PRESENT = true ] && [ ! -e "$opam_root/$do_switch_create_NAME/.opam-switch/switch-config" ]; then 2105 - # Remove the switch name from Opam root, and any partial switch state. 2106 - # Ignore inevitable warnings/failure about missing switch. 2107 - opamrun --no-troubleshooting switch remove "$do_switch_create_NAME" --yes || true 2108 - rm -rf "${opam_root:?}/$do_switch_create_NAME" 2109 - NOMINALLY_PRESENT=false 2110 - fi 2111 - 2112 - if [ $NOMINALLY_PRESENT = false ]; then 2113 - opamrun switch create "$do_switch_create_NAME" --empty --yes 2114 - fi 2115 - section_end "switch-create-$do_switch_create_NAME" 2116 - } 2117 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2118 - do_switch_create dkml 2119 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2120 - do_switch_create two 2121 - else 2122 - section_begin "switch-create-two" "Create empty opam switch 'two'" 2123 - # Always create a secondary switch ... just empty. Avoid problems with cache content missing 2124 - # and idempotency. 2125 - opamrun --no-troubleshooting switch remove two --yes || true 2126 - rm -rf "$opam_root/two" 2127 - opamrun switch create two --empty --yes 2128 - section_end "switch-create-two" 2129 - fi 2130 - fi 2131 - 2132 - do_switch_active() { 2133 - section_begin "switch-active" "Set dkml as active switch" 2134 - opamrun switch set dkml --yes 2135 - section_end "switch-active" 2136 - } 2137 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2138 - do_switch_active 2139 - fi 2140 - 2141 - do_opam_repositories_add() { 2142 - section_begin "opam-repo-add" "Add 'diskuv' opam repository" 2143 - if ! opamrun --no-troubleshooting repository list -s | grep '^diskuv'; then 2144 - opamrun repository add diskuv "git+https://github.com/diskuv/diskuv-opam-repository.git#${DISKUV_OPAM_REPOSITORY:-$DEFAULT_DISKUV_OPAM_REPOSITORY_TAG}" --yes --dont-select 2145 - fi 2146 - section_end "opam-repo-add" 2147 - } 2148 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2149 - do_opam_repositories_add 2150 - fi 2151 - 2152 - do_opam_repositories_config() { 2153 - do_opam_repositories_config_NAME=$1 2154 - shift 2155 - 2156 - section_begin "opam-repo-$do_opam_repositories_config_NAME" "Attach repositories to $do_opam_repositories_config_NAME" 2157 - 2158 - if [ ! -s "$opam_root/.ci.$do_opam_repositories_config_NAME.repo-init" ]; then # non-empty init file so can be cached irrespective of existence 2159 - opamrun --no-troubleshooting repository remove default --switch "$do_opam_repositories_config_NAME" --yes || true 2160 - opamrun --no-troubleshooting repository remove diskuv --switch "$do_opam_repositories_config_NAME" --yes || true 2161 - opamrun repository add default --switch "$do_opam_repositories_config_NAME" --yes 2162 - opamrun repository add diskuv --switch "$do_opam_repositories_config_NAME" --yes 2163 - echo yes > "$opam_root/.ci.$do_opam_repositories_config_NAME.repo-init" 2164 - fi 2165 - 2166 - section_end "opam-repo-$do_opam_repositories_config_NAME" 2167 - } 2168 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2169 - do_opam_repositories_config dkml 2170 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2171 - do_opam_repositories_config two 2172 - fi 2173 - fi 2174 - 2175 - do_opam_repositories_update() { 2176 - section_begin "opam-repo-update" "Update opam repositories" 2177 - # The default repository may be the initial 'eor' (empty) repository 2178 - opamrun repository set-url default https://opam.ocaml.org --yes 2179 - # Always set the `diskuv` repository url since it can change 2180 - opamrun repository set-url diskuv "git+https://github.com/diskuv/diskuv-opam-repository.git#${DISKUV_OPAM_REPOSITORY:-$DEFAULT_DISKUV_OPAM_REPOSITORY_TAG}" --yes --dont-select 2181 - # Update both `default` and `diskuv` Opam repositories 2182 - opamrun update default diskuv 2183 - section_end "opam-repo-update" 2184 - } 2185 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2186 - do_opam_repositories_update 2187 - fi 2188 - 2189 - do_pins() { 2190 - do_pins_NAME=$1 2191 - shift 2192 - 2193 - section_begin "opam-pins-$do_pins_NAME" "Opam pins for $do_pins_NAME switch" 2194 - ### BEGIN pin-adds. DO NOT EDIT THE LINES IN THIS SECTION 2195 - # Managed by bump-packages.cmake 2196 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version astring "${PIN_ASTRING}" 2197 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version base "${PIN_BASE}" 2198 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version base64 "${PIN_BASE64}" 2199 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version bigarray-compat "${PIN_BIGARRAY_COMPAT}" 2200 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version bos "${PIN_BOS}" 2201 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version camlp-streams "${PIN_CAMLP_STREAMS}" 2202 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version chrome-trace "${PIN_CHROME_TRACE}" 2203 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version cmdliner "${PIN_CMDLINER}" 2204 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version conf-dkml-sys-opam "${PIN_CONF_DKML_SYS_OPAM}" 2205 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version conf-pkg-config "${PIN_CONF_PKG_CONFIG}" 2206 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version conf-sqlite3 "${PIN_CONF_SQLITE3}" 2207 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version cppo "${PIN_CPPO}" 2208 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version crunch "${PIN_CRUNCH}" 2209 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version csexp "${PIN_CSEXP}" 2210 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version cstruct "${PIN_CSTRUCT}" 2211 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ctypes "${PIN_CTYPES}" 2212 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ctypes-foreign "${PIN_CTYPES_FOREIGN}" 2213 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version cudf "${PIN_CUDF}" 2214 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version digestif "${PIN_DIGESTIF}" 2215 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version diskuvbox "${PIN_DISKUVBOX}" 2216 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-apps "${PIN_DKML_APPS}" 2217 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-base-compiler "${PIN_DKML_BASE_COMPILER}" 2218 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-build-desktop "${PIN_DKML_BUILD_DESKTOP}" 2219 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-c-probe "${PIN_DKML_C_PROBE}" 2220 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-compiler-env "${PIN_DKML_COMPILER_ENV}" 2221 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-compiler-src "${PIN_DKML_COMPILER_SRC}" 2222 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-common-desktop "${PIN_DKML_COMPONENT_COMMON_DESKTOP}" 2223 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-common-opam "${PIN_DKML_COMPONENT_COMMON_OPAM}" 2224 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-common-unixutils "${PIN_DKML_COMPONENT_COMMON_UNIXUTILS}" 2225 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-ocamlcompiler-common "${PIN_DKML_COMPONENT_OCAMLCOMPILER_COMMON}" 2226 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-ocamlcompiler-network "${PIN_DKML_COMPONENT_OCAMLCOMPILER_NETWORK}" 2227 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-ocamlcompiler-offline "${PIN_DKML_COMPONENT_OCAMLCOMPILER_OFFLINE}" 2228 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-offline-desktop-full "${PIN_DKML_COMPONENT_OFFLINE_DESKTOP_FULL}" 2229 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-offline-opamshim "${PIN_DKML_COMPONENT_OFFLINE_OPAMSHIM}" 2230 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-offline-unixutils "${PIN_DKML_COMPONENT_OFFLINE_UNIXUTILS}" 2231 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-desktop-full "${PIN_DKML_COMPONENT_STAGING_DESKTOP_FULL}" 2232 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-dkmlconfdir "${PIN_DKML_COMPONENT_STAGING_DKMLCONFDIR}" 2233 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-ocamlrun "${PIN_DKML_COMPONENT_STAGING_OCAMLRUN}" 2234 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-opam32 "${PIN_DKML_COMPONENT_STAGING_OPAM32}" 2235 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-opam64 "${PIN_DKML_COMPONENT_STAGING_OPAM64}" 2236 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-unixutils "${PIN_DKML_COMPONENT_STAGING_UNIXUTILS}" 2237 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-staging-withdkml "${PIN_DKML_COMPONENT_STAGING_WITHDKML}" 2238 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-component-xx-console "${PIN_DKML_COMPONENT_XX_CONSOLE}" 2239 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-exe "${PIN_DKML_EXE}" 2240 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-exe-lib "${PIN_DKML_EXE_LIB}" 2241 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-install "${PIN_DKML_INSTALL}" 2242 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-install-installer "${PIN_DKML_INSTALL_INSTALLER}" 2243 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-install-runner "${PIN_DKML_INSTALL_RUNNER}" 2244 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-installer-ocaml-common "${PIN_DKML_INSTALLER_OCAML_COMMON}" 2245 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-installer-ocaml-offline "${PIN_DKML_INSTALLER_OCAML_OFFLINE}" 2246 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-package-console "${PIN_DKML_PACKAGE_CONSOLE}" 2247 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-runtime-common "${PIN_DKML_RUNTIME_COMMON}" 2248 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-runtime-common-native "${PIN_DKML_RUNTIME_COMMON_NATIVE}" 2249 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-runtime-distribution "${PIN_DKML_RUNTIME_DISTRIBUTION}" 2250 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-runtimelib "${PIN_DKML_RUNTIMELIB}" 2251 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-runtimescripts "${PIN_DKML_RUNTIMESCRIPTS}" 2252 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dkml-workflows "${PIN_DKML_WORKFLOWS}" 2253 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune "${PIN_DUNE}" 2254 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-action-plugin "${PIN_DUNE_ACTION_PLUGIN}" 2255 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-build-info "${PIN_DUNE_BUILD_INFO}" 2256 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-configurator "${PIN_DUNE_CONFIGURATOR}" 2257 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-glob "${PIN_DUNE_GLOB}" 2258 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-private-libs "${PIN_DUNE_PRIVATE_LIBS}" 2259 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-rpc "${PIN_DUNE_RPC}" 2260 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-rpc-lwt "${PIN_DUNE_RPC_LWT}" 2261 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dune-site "${PIN_DUNE_SITE}" 2262 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version dyn "${PIN_DYN}" 2263 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version either "${PIN_EITHER}" 2264 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version eqaf "${PIN_EQAF}" 2265 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version extlib "${PIN_EXTLIB}" 2266 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ezjsonm "${PIN_EZJSONM}" 2267 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version feather "${PIN_FEATHER}" 2268 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version fiber "${PIN_FIBER}" 2269 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version fix "${PIN_FIX}" 2270 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version fmt "${PIN_FMT}" 2271 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version fpath "${PIN_FPATH}" 2272 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version graphics "${PIN_GRAPHICS}" 2273 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version hex "${PIN_HEX}" 2274 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version integers "${PIN_INTEGERS}" 2275 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version jane-street-headers "${PIN_JANE_STREET_HEADERS}" 2276 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version jingoo "${PIN_JINGOO}" 2277 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version jsonm "${PIN_JSONM}" 2278 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version jsonrpc "${PIN_JSONRPC}" 2279 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version jst-config "${PIN_JST_CONFIG}" 2280 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version lambda-term "${PIN_LAMBDA_TERM}" 2281 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version logs "${PIN_LOGS}" 2282 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version lsp "${PIN_LSP}" 2283 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version lwt "${PIN_LWT}" 2284 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version lwt_react "${PIN_LWT_REACT}" 2285 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version mccs "${PIN_MCCS}" 2286 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version mdx "${PIN_MDX}" 2287 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version menhir "${PIN_MENHIR}" 2288 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version menhirLib "${PIN_MENHIRLIB}" 2289 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version menhirSdk "${PIN_MENHIRSDK}" 2290 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version merlin-lib "${PIN_MERLIN_LIB}" 2291 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version metapp "${PIN_METAPP}" 2292 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version metaquot "${PIN_METAQUOT}" 2293 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version mew "${PIN_MEW}" 2294 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version mew_vi "${PIN_MEW_VI}" 2295 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version num "${PIN_NUM}" 2296 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocaml "${PIN_OCAML}" 2297 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocaml-compiler-libs "${PIN_OCAML_COMPILER_LIBS}" 2298 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocaml-lsp-server "${PIN_OCAML_LSP_SERVER}" 2299 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocaml-version "${PIN_OCAML_VERSION}" 2300 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocamlbuild "${PIN_OCAMLBUILD}" 2301 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocamlc-loc "${PIN_OCAMLC_LOC}" 2302 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocamlfind "${PIN_OCAMLFIND}" 2303 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocamlformat "${PIN_OCAMLFORMAT}" 2304 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocamlformat-lib "${PIN_OCAMLFORMAT_LIB}" 2305 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocamlformat-rpc-lib "${PIN_OCAMLFORMAT_RPC_LIB}" 2306 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocp-indent "${PIN_OCP_INDENT}" 2307 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ocplib-endian "${PIN_OCPLIB_ENDIAN}" 2308 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version odoc "${PIN_ODOC}" 2309 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version odoc-parser "${PIN_ODOC_PARSER}" 2310 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ordering "${PIN_ORDERING}" 2311 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version parsexp "${PIN_PARSEXP}" 2312 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version pp "${PIN_PP}" 2313 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_assert "${PIN_PPX_ASSERT}" 2314 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_base "${PIN_PPX_BASE}" 2315 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_cold "${PIN_PPX_COLD}" 2316 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_compare "${PIN_PPX_COMPARE}" 2317 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_derivers "${PIN_PPX_DERIVERS}" 2318 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_deriving "${PIN_PPX_DERIVING}" 2319 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_enumerate "${PIN_PPX_ENUMERATE}" 2320 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_expect "${PIN_PPX_EXPECT}" 2321 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_globalize "${PIN_PPX_GLOBALIZE}" 2322 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_hash "${PIN_PPX_HASH}" 2323 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_here "${PIN_PPX_HERE}" 2324 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_ignore_instrumentation "${PIN_PPX_IGNORE_INSTRUMENTATION}" 2325 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_inline_test "${PIN_PPX_INLINE_TEST}" 2326 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_optcomp "${PIN_PPX_OPTCOMP}" 2327 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_pipebang "${PIN_PPX_PIPEBANG}" 2328 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_sexp_conv "${PIN_PPX_SEXP_CONV}" 2329 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppx_yojson_conv_lib "${PIN_PPX_YOJSON_CONV_LIB}" 2330 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ppxlib "${PIN_PPXLIB}" 2331 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version ptime "${PIN_PTIME}" 2332 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version qrc "${PIN_QRC}" 2333 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version re "${PIN_RE}" 2334 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version react "${PIN_REACT}" 2335 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version refl "${PIN_REFL}" 2336 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version result "${PIN_RESULT}" 2337 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version rresult "${PIN_RRESULT}" 2338 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version seq "${PIN_SEQ}" 2339 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version sexplib "${PIN_SEXPLIB}" 2340 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version sexplib0 "${PIN_SEXPLIB0}" 2341 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version sha "${PIN_SHA}" 2342 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version spawn "${PIN_SPAWN}" 2343 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version sqlite3 "${PIN_SQLITE3}" 2344 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version stdcompat "${PIN_STDCOMPAT}" 2345 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version stdio "${PIN_STDIO}" 2346 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version stdlib-shims "${PIN_STDLIB_SHIMS}" 2347 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version stdune "${PIN_STDUNE}" 2348 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version time_now "${PIN_TIME_NOW}" 2349 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version topkg "${PIN_TOPKG}" 2350 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version traverse "${PIN_TRAVERSE}" 2351 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version trie "${PIN_TRIE}" 2352 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version tsort "${PIN_TSORT}" 2353 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version tyxml "${PIN_TYXML}" 2354 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version uchar "${PIN_UCHAR}" 2355 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version utop "${PIN_UTOP}" 2356 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version uucp "${PIN_UUCP}" 2357 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version uuidm "${PIN_UUIDM}" 2358 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version uuseg "${PIN_UUSEG}" 2359 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version uutf "${PIN_UUTF}" 2360 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version with-dkml "${PIN_WITH_DKML}" 2361 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version xdg "${PIN_XDG}" 2362 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version yojson "${PIN_YOJSON}" 2363 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action -k version zed "${PIN_ZED}" 2364 - ### END pin-adds. DO NOT EDIT THE LINES ABOVE 2365 - section_end "opam-pins-$do_pins_NAME" 2366 - 2367 - # -------------- 2368 - # REMAINING PINS 2369 - # -------------- 2370 - 2371 - # These come after [pin-adds] section since [pin-adds] may need to be overridden by 2372 - # users' choice. 2373 - 2374 - # dkml-base-compiler 2375 - 2376 - if [ "${DKML_COMPILER:-}" != '@repository@' ] && [ -z "${DKML_COMPILER:-}" ] && [ -z "${OCAML_COMPILER:-}" ]; then 2377 - section_begin checkout-dkml-base-compiler "Pin dkml-base-compiler to default ${DEFAULT_DKML_COMPILER} (neither dkml-base-compiler nor OCAML_COMPILER specified) for $do_pins_NAME switch" 2378 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action dkml-base-compiler "https://github.com/diskuv/dkml-compiler.git#${DEFAULT_DKML_COMPILER}" 2379 - section_end checkout-dkml-base-compiler 2380 - elif [ "${DKML_COMPILER:-}" != '@repository@' ] && [ -n "${DKML_COMPILER:-}" ] && [ -z "${OCAML_COMPILER:-}" ]; then 2381 - section_begin checkout-dkml-base-compiler "Pin dkml-base-compiler to $DKML_COMPILER (dkml-base-compiler specified; no OCAML_COMPILER specified) for $do_pins_NAME switch" 2382 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action dkml-base-compiler "https://github.com/diskuv/dkml-compiler.git#${DKML_COMPILER}" 2383 - section_end checkout-dkml-base-compiler 2384 - elif [ -n "${OCAML_COMPILER:-}" ]; then 2385 - # Validate OCAML_COMPILER (OCAML_COMPILER specified) 2386 - case "${OCAML_COMPILER:-}" in 2387 - 4.12.1) true ;; 2388 - 4.14.0) true ;; 2389 - *) 2390 - echo "OCAML_COMPILER version ${OCAML_COMPILER:-} is not supported" >&2 2391 - exit 109 2392 - ;; 2393 - esac 2394 - 2395 - section_begin checkout-dkml-base-compiler "Pin dkml-base-compiler (OCAML_COMPILER specified) for $do_pins_NAME switch" 2396 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action dkml-base-compiler "https://github.com/diskuv/dkml-compiler.git#${OCAML_COMPILER}-v${DKML_VERSION}" 2397 - section_end checkout-dkml-base-compiler 2398 - fi 2399 - 2400 - # conf-dkml-cross-toolchain 2401 - 2402 - if [ "${CONF_DKML_CROSS_TOOLCHAIN:-}" != '@repository@' ]; then 2403 - section_begin checkout-conf-dkml-cross-toolchain "Pin conf-dkml-cross-toolchain for $do_pins_NAME switch" 2404 - opamrun pin add --switch "$do_pins_NAME" --yes --no-action conf-dkml-cross-toolchain "https://github.com/diskuv/conf-dkml-cross-toolchain.git#$CONF_DKML_CROSS_TOOLCHAIN" 2405 - section_end checkout-conf-dkml-cross-toolchain 2406 - fi 2407 - } 2408 - 2409 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2410 - do_pins dkml 2411 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2412 - do_pins two 2413 - fi 2414 - fi 2415 - 2416 - do_use_vsstudio() { 2417 - do_use_vsstudio_NAME=$1 2418 - shift 2419 - case "$dkml_host_abi" in 2420 - windows_*) 2421 - section_begin "use-vsstudio-$do_use_vsstudio_NAME" "Use Visual Studio in dkml-* Opam packages (Windows) for $do_use_vsstudio_NAME switch" 2422 - 2423 - # shellcheck disable=SC2153 2424 - E_VS_DIR=$(escape_arg_as_ocaml_string "$VS_DIR") 2425 - # shellcheck disable=SC2153 2426 - E_VS_VCVARSVER=$(escape_arg_as_ocaml_string "$VS_VCVARSVER") 2427 - # shellcheck disable=SC2153 2428 - E_VS_WINSDKVER=$(escape_arg_as_ocaml_string "$VS_WINSDKVER") 2429 - # shellcheck disable=SC2153 2430 - E_VS_MSVSPREFERENCE=$(escape_arg_as_ocaml_string "$VS_MSVSPREFERENCE") 2431 - # shellcheck disable=SC2153 2432 - E_VS_CMAKEGENERATOR=$(escape_arg_as_ocaml_string "$VS_CMAKEGENERATOR") 2433 - 2434 - case "$(opamrun --version)" in 2435 - 2.0.*) 2436 - if [ "${in_docker}" = "true" ]; then 2437 - echo Opam 2.0 support in dockcross to use a portable opam var prefix not yet implemented 2438 - exit 67 2439 - fi 2440 - OP=$(opamrun var prefix --switch "$do_use_vsstudio_NAME") 2441 - OPSC=$OP/.opam-switch/switch-config 2442 - if grep setenv: "$OPSC"; then 2443 - echo "INFO: Updating switch-config. Old was:" 2444 - awk '{print ">> " $0}' "$OPSC" 2445 - 2446 - awk '$1=="setenv:"{x=1} x==0{print} x==1 && $0=="]"{x=0}' "$OPSC" >"$OPSC".trimmed 2447 - mv "$OPSC".trimmed "$OPSC" 2448 - fi 2449 - echo 'setenv: [' >>"$OPSC" 2450 - echo ' [DKML_COMPILE_SPEC = "1"]' >>"$OPSC" 2451 - echo ' [DKML_COMPILE_TYPE = "VS"]' >>"$OPSC" 2452 - echo " [DKML_COMPILE_VS_DIR = \"$E_VS_DIR\"]" >>"$OPSC" 2453 - echo " [DKML_COMPILE_VS_VCVARSVER = \"$E_VS_VCVARSVER\"]" >>"$OPSC" 2454 - echo " [DKML_COMPILE_VS_WINSDKVER = \"$E_VS_WINSDKVER\"]" >>"$OPSC" 2455 - echo " [DKML_COMPILE_VS_MSVSPREFERENCE = \"$E_VS_MSVSPREFERENCE\"]" >>"$OPSC" 2456 - echo " [DKML_COMPILE_VS_CMAKEGENERATOR = \"$E_VS_CMAKEGENERATOR\"]" >>"$OPSC" 2457 - echo " [DKML_HOST_ABI = \"${dkml_host_abi}\"]" >>"$OPSC" 2458 - echo ']' >>"$OPSC" 2459 - cat "$OPSC" >&2 # print 2460 - ;; 2461 - *) 2462 - opamrun option --switch "$do_use_vsstudio_NAME" setenv= # reset 2463 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+='DKML_COMPILE_SPEC = "1"' 2464 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+='DKML_COMPILE_TYPE = "VS"' 2465 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_DIR = \"$E_VS_DIR\"" 2466 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_VCVARSVER = \"$E_VS_VCVARSVER\"" 2467 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_WINSDKVER = \"$E_VS_WINSDKVER\"" 2468 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_MSVSPREFERENCE = \"$E_VS_MSVSPREFERENCE\"" 2469 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_COMPILE_VS_CMAKEGENERATOR = \"$E_VS_CMAKEGENERATOR\"" 2470 - opamrun option --switch "$do_use_vsstudio_NAME" setenv+="DKML_HOST_ABI = \"${dkml_host_abi}\"" 2471 - opamrun option --switch "$do_use_vsstudio_NAME" setenv # print 2472 - ;; 2473 - esac 2474 - 2475 - # shellcheck disable=SC2016 2476 - opamrun exec --switch "$do_use_vsstudio_NAME" -- sh -c 'echo $VCToolsRedistDir' 2477 - 2478 - section_end "use-vsstudio-$do_use_vsstudio_NAME" 2479 - ;; 2480 - esac 2481 - } 2482 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2483 - do_use_vsstudio dkml 2484 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2485 - do_use_vsstudio two 2486 - fi 2487 - fi 2488 - 2489 - # Because dune.X.Y.Z+shim (and any user DKML packages) requires DKML installed (after all, it is just 2490 - # a with-dkml.exe shim), we need either dkmlvars-v2.sexp or DKML environment 2491 - # variables. Confer: Dkml_runtimelib.Dkml_context.get_dkmlversion 2492 - # 2493 - # grep matches either: 2494 - # [... [DiskuvOCamlVersion = "1.0.1"] ...] 2495 - # DiskuvOCamlVersion = "1.0.1" 2496 - do_setenv() { 2497 - do_setenv_SWITCH=$1 2498 - shift 2499 - section_begin "setenv-$do_setenv_SWITCH" "Set opam option for $do_setenv_SWITCH switch" 2500 - opamrun option --switch "$do_setenv_SWITCH" setenv > ".ci/sd4/setenv.$do_setenv_SWITCH.txt" 2501 - if ! grep -q '\(^|\[\)DiskuvOCamlVarsVersion ' ".ci/sd4/setenv.$do_setenv_SWITCH.txt"; then 2502 - opamrun option --switch "$do_setenv_SWITCH" setenv+='DiskuvOCamlVarsVersion = "2"' 2503 - fi 2504 - if ! grep -q '\(^|\[\)DiskuvOCamlVersion ' ".ci/sd4/setenv.$do_setenv_SWITCH.txt"; then 2505 - opamrun option --switch "$do_setenv_SWITCH" setenv+="DiskuvOCamlVersion = \"$DKML_VERSION\"" 2506 - fi 2507 - if [ "$do_setenv_SWITCH" = dkml ] && [ -n "${DKML_HOME:-}" ]; then 2508 - do_setenv_DKMLHOME_ESCAPED="$DKML_HOME" 2509 - do_setenv_USRBIN_ESCAPED="$DKML_HOME/usr/bin" 2510 - do_setenv_BIN_ESCAPED="$DKML_HOME/bin" 2511 - if [ -x /usr/bin/cygpath ]; then 2512 - do_setenv_DKMLHOME_ESCAPED=$(/usr/bin/cygpath -aw "$do_setenv_DKMLHOME_ESCAPED" | sed 's/\\/\\\\/g') 2513 - do_setenv_USRBIN_ESCAPED=$(/usr/bin/cygpath -aw "$do_setenv_USRBIN_ESCAPED" | sed 's/\\/\\\\/g') 2514 - do_setenv_BIN_ESCAPED=$(/usr/bin/cygpath -aw "$do_setenv_BIN_ESCAPED" | sed 's/\\/\\\\/g') 2515 - fi 2516 - if ! grep -q '\(^|\[\)DiskuvOCamlHome ' ".ci/sd4/setenv.$do_setenv_SWITCH.txt"; then 2517 - opamrun option --switch "$do_setenv_SWITCH" setenv+="DiskuvOCamlHome = \"$do_setenv_DKMLHOME_ESCAPED\"" 2518 - fi 2519 - if ! grep -q '\(^|\[\)DiskuvOCamlBinaryPaths ' ".ci/sd4/setenv.$do_setenv_SWITCH.txt"; then 2520 - opamrun option --switch "$do_setenv_SWITCH" setenv+="DiskuvOCamlBinaryPaths = \"$do_setenv_USRBIN_ESCAPED;$do_setenv_BIN_ESCAPED\"" 2521 - fi 2522 - if ! grep -q '\(^|\[\)DiskuvOCamlDeploymentId ' ".ci/sd4/setenv.$do_setenv_SWITCH.txt"; then 2523 - opamrun option --switch "$do_setenv_SWITCH" setenv+="DiskuvOCamlDeploymentId = \"setup-dkml-switch-$do_setenv_SWITCH\"" 2524 - fi 2525 - fi 2526 - case "${dkml_host_abi}" in 2527 - windows_*) 2528 - if ! grep -q '\(^|\[\)DiskuvOCamlMSYS2Dir ' ".ci/sd4/setenv.$do_setenv_SWITCH.txt"; then 2529 - if [ -x /usr/bin/cygpath ]; then 2530 - MSYS2_DIR_NATIVE=$(/usr/bin/cygpath -aw /) 2531 - else 2532 - # If we are already inside MSYS2 then MSYSTEM_PREFIX should be set. But cygpath should be there as well!! 2533 - echo "FATAL: Could not locate MSYS2: there was no cygpath" >&2 2534 - exit 3 2535 - fi 2536 - MSYS2_DIR_NATIVE_ESCAPED=$(printf "%s" "$MSYS2_DIR_NATIVE" | sed 's/\\/\\\\/g') 2537 - opamrun option --switch "$do_setenv_SWITCH" setenv+="DiskuvOCamlMSYS2Dir = \"$MSYS2_DIR_NATIVE_ESCAPED\"" 2538 - fi 2539 - esac 2540 - section_end "setenv-$do_setenv_SWITCH" 2541 - } 2542 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2543 - do_setenv dkml 2544 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2545 - do_setenv two 2546 - fi 2547 - fi 2548 - 2549 - do_install_compiler() { 2550 - do_install_compiler_NAME=$1 2551 - shift 2552 - section_begin "install-compiler-$do_install_compiler_NAME" "Install OCaml compiler for $do_install_compiler_NAME switch" 2553 - opamrun pin list --switch "$do_install_compiler_NAME" 2554 - # shellcheck disable=SC2086 2555 - opamrun upgrade --switch "$do_install_compiler_NAME" --yes dkml-base-compiler conf-dkml-cross-toolchain ${ocaml_options:-} 2556 - section_end "install-compiler-$do_install_compiler_NAME" 2557 - } 2558 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2559 - if ! [ "${PRIMARY_SWITCH_SKIP_INSTALL:-}" = "true" ]; then 2560 - do_install_compiler dkml 2561 - fi 2562 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2563 - do_install_compiler two 2564 - fi 2565 - fi 2566 - 2567 - do_summary() { 2568 - do_summary_NAME=$1 2569 - shift 2570 - section_begin "summary-$do_summary_NAME" "Summary: $do_summary_NAME switch" 2571 - opamrun var --switch "$do_summary_NAME" 2572 - opamrun exec --switch "$do_summary_NAME" -- ocamlc -config 2573 - section_end "summary-$do_summary_NAME" 2574 - } 2575 - if [ "${SKIP_OPAM_MODIFICATIONS:-}" = "false" ]; then 2576 - do_summary dkml 2577 - if [ "${SECONDARY_SWITCH:-}" = "true" ]; then 2578 - do_summary two 2579 - fi 2580 - fi 2581 - 2582 - '@ 2583 - Set-Content -Path ".ci\sd4\run-setup-dkml.sh" -Encoding Unicode -Value $Content 2584 - msys64\usr\bin\bash -lc 'dos2unix .ci/sd4/run-setup-dkml.sh' 2585 - 2586 - $Content = @' 2587 - # MSVC environment variables: 2588 - # 1. https://docs.microsoft.com/en-us/cpp/build/reference/cl-environment-variables?view=msvc-170 2589 - # 2. https://docs.microsoft.com/en-us/cpp/build/reference/linking?view=msvc-170#link-environment-variables (except TMP) 2590 - # 3. VCToolsRedistDir: https://docs.microsoft.com/en-us/cpp/windows/redistributing-visual-cpp-files?view=msvc-170#locate-the-redistributable-files 2591 - BEGIN{FS="="} 2592 - $1=="CL"||$1=="_CL_"||$1=="INCLUDE"||$1=="LIBPATH" {print "export " $0} 2593 - $1=="LINK"||$1=="_LINK_"||$1=="LIB"||$1=="PATH" {print "export " $0} 2594 - $1=="VCToolsRedistDir" {print "export " $0} 2595 - 2596 - '@ 2597 - Set-Content -Path ".ci\sd4\msvcenv.awk" -Encoding Unicode -Value $Content 2598 - msys64\usr\bin\bash -lc 'dos2unix .ci/sd4/msvcenv.awk' 2599 - 2600 - 2601 - $Content = @' 2602 - { 2603 - # trim leading and trailing space 2604 - sub(/^ */, ""); 2605 - sub(/ *$/, ""); 2606 - 2607 - print "export PATH='" $0 "'"; 2608 - } 2609 - '@ 2610 - Set-Content -Path ".ci\sd4\msvcpath.awk" -Encoding Unicode -Value $Content 2611 - msys64\usr\bin\bash -lc 'dos2unix .ci/sd4/msvcpath.awk' 2612 - 2613 - # PowerShell (UTF-16) and Batch (ANSI) scripts 2614 - 2615 - 2616 - $Content = @' 2617 - # Diagnose Visual Studio environment variables (Windows) 2618 - # This wastes time and has lots of rows! Only run if "VERBOSE" GitHub input key. 2619 - if ( "${env:VERBOSE}" -eq "true" ) { 2620 - if (Test-Path -Path "C:\Program Files (x86)\Windows Kits\10\include") { 2621 - Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\include" 2622 - } 2623 - if (Test-Path -Path "C:\Program Files (x86)\Windows Kits\10\Extension SDKs\WindowsDesktop") { 2624 - Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\Extension SDKs\WindowsDesktop" 2625 - } 2626 - 2627 - $env:PSModulePath += "$([System.IO.Path]::PathSeparator).ci\sd4\g\dkml-runtime-distribution\src\windows" 2628 - Import-Module Machine 2629 - 2630 - $allinstances = Get-VSSetupInstance 2631 - $allinstances | ConvertTo-Json -Depth 5 2632 - } 2633 - 2634 - # Make export expression [SN]NAME=[SV]VALUE[EV] 2635 - # where [SN] is start name and [SV] and [EV] are start and end value 2636 - if (("${env:GITLAB_CI}" -eq "true") -or ("${env:PC_CI}" -eq "true")) { 2637 - # Executed immediately in POSIX shell, so must be a real POSIX shell variable declaration 2638 - $ExportSN = "export " 2639 - $ExportSV = "'" 2640 - $ExportEV = "'" 2641 - $ExportExt = ".sh" 2642 - } else { 2643 - # Goes into $env:GITHUB_ENV, so must be plain NAME=VALUE 2644 - $ExportSN = "" 2645 - $ExportSV = "" 2646 - $ExportEV = "" 2647 - $ExportExt = ".github" 2648 - } 2649 - 2650 - # Locate Visual Studio (Windows) 2651 - if ("${env:vsstudio_dir}" -eq "" -and (!(Test-Path -Path .ci/sd4/vsenv${ExportExt}) -or !(Test-Path -Path .ci/sd4/vsenv.ps1))) { 2652 - $env:PSModulePath += "$([System.IO.Path]::PathSeparator).ci\sd4\g\dkml-runtime-distribution\src\windows" 2653 - Import-Module Machine 2654 - 2655 - $CompatibleVisualStudios = Get-CompatibleVisualStudios -ErrorIfNotFound 2656 - $CompatibleVisualStudios 2657 - $ChosenVisualStudio = ($CompatibleVisualStudios | Select-Object -First 1) 2658 - $VisualStudioProps = Get-VisualStudioProperties -VisualStudioInstallation $ChosenVisualStudio 2659 - $VisualStudioProps 2660 - 2661 - Write-Output "${ExportSN}VS_DIR=${ExportSV}$($VisualStudioProps.InstallPath)${ExportEV}" > .ci/sd4/vsenv${ExportExt} 2662 - Write-Output "${ExportSN}VS_VCVARSVER=${ExportSV}$($VisualStudioProps.VcVarsVer)${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2663 - Write-Output "${ExportSN}VS_WINSDKVER=${ExportSV}$($VisualStudioProps.WinSdkVer)${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2664 - Write-Output "${ExportSN}VS_MSVSPREFERENCE=${ExportSV}$($VisualStudioProps.MsvsPreference)${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2665 - Write-Output "${ExportSN}VS_CMAKEGENERATOR=${ExportSV}$($VisualStudioProps.CMakeGenerator)${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2666 - 2667 - Write-Output "`$env:VS_DIR='$($VisualStudioProps.InstallPath)'" > .ci/sd4/vsenv.ps1 2668 - Write-Output "`$env:VS_VCVARSVER='$($VisualStudioProps.VcVarsVer)'" >> .ci/sd4/vsenv.ps1 2669 - Write-Output "`$env:VS_WINSDKVER='$($VisualStudioProps.WinSdkVer)'" >> .ci/sd4/vsenv.ps1 2670 - Write-Output "`$env:VS_MSVSPREFERENCE='$($VisualStudioProps.MsvsPreference)'" >> .ci/sd4/vsenv.ps1 2671 - Write-Output "`$env:VS_CMAKEGENERATOR='$($VisualStudioProps.CMakeGenerator)'" >> .ci/sd4/vsenv.ps1 2672 - } 2673 - 2674 - # Link to hardcoded Visual Studio (Windows) 2675 - if ("${env:vsstudio_dir}" -ne "") { 2676 - Write-Output "${ExportSN}VS_DIR=${ExportSV}${env:vsstudio_dir}${ExportEV}" > .ci/sd4/vsenv${ExportExt} 2677 - Write-Output "${ExportSN}VS_VCVARSVER=${ExportSV}${env:vsstudio_vcvarsver}${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2678 - Write-Output "${ExportSN}VS_WINSDKVER=${ExportSV}${env:vsstudio_winsdkver}${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2679 - Write-Output "${ExportSN}VS_MSVSPREFERENCE=${ExportSV}${env:vsstudio_msvspreference}${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2680 - Write-Output "${ExportSN}VS_CMAKEGENERATOR=${ExportSV}${env:vsstudio_cmakegenerator}${ExportEV}" >> .ci/sd4/vsenv${ExportExt} 2681 - 2682 - Write-Output "`$env:VS_DIR='${env:vsstudio_dir}'" > .ci/sd4/vsenv.ps1 2683 - Write-Output "`$env:VS_VCVARSVER='${env:vsstudio_vcvarsver}'" >> .ci/sd4/vsenv.ps1 2684 - Write-Output "`$env:VS_WINSDKVER='${env:vsstudio_winsdkver}'" >> .ci/sd4/vsenv.ps1 2685 - Write-Output "`$env:VS_MSVSPREFERENCE='${env:vsstudio_msvspreference}'" >> .ci/sd4/vsenv.ps1 2686 - Write-Output "`$env:VS_CMAKEGENERATOR='${env:vsstudio_cmakegenerator}'" >> .ci/sd4/vsenv.ps1 2687 - } 2688 - 2689 - '@ 2690 - Set-Content -Path ".ci\sd4\config-vsstudio.ps1" -Encoding Unicode -Value $Content 2691 - 2692 - 2693 - $Content = @' 2694 - @ECHO OFF 2695 - 2696 - REM The OCaml dkml-base-compiler will compile fine but any other 2697 - REM packages (ocamlbuild, etc.) which 2698 - REM need a native compiler will fail without the MSVC compiler in the 2699 - REM PATH. There isn't a `with-dkml.exe` alternative available at 2700 - REM this stage of the GitHub workflow. 2701 - SET VSCMD_DEBUG=2 2702 - SET VSCMD_SKIP_SENDTELEMETRY=1 2703 - call "%VS_DIR%\Common7\Tools\VsDevCmd.bat" -no_logo -host_arch=%vsstudio_hostarch% -arch=%vsstudio_arch% -vcvars_ver=%VS_VCVARSVER% -winsdk=%VS_WINSDKVER% 2704 - if %ERRORLEVEL% neq 0 ( 2705 - echo. 2706 - echo.The "%VS_DIR%\Common7\Tools\VsDevCmd.bat" command failed 2707 - echo.with exit code %ERRORLEVEL%. 2708 - echo. 2709 - exit /b %ERRORLEVEL% 2710 - ) 2711 - 2712 - REM VsDevCmd.bat turns off echo; be explicit if we want it on or off 2713 - @echo OFF 2714 - 2715 - REM MSVC environment variables in Unix format. 2716 - echo %PATH% > .ci\sd4\msvcpath 2717 - 2718 - 2719 - REM * We can't use `bash -lc` directly to query for all MSVC environment variables 2720 - REM because it stomps over the PATH. So we are inside a Batch script to do the query. 2721 - msys64\usr\bin\bash -lc "set | grep -v '^PATH=' | awk -f .ci/sd4/msvcenv.awk > .ci/sd4/msvcenv" 2722 - '@ 2723 - Set-Content -Path ".ci\sd4\get-msvcpath-into-msys2.bat" -Encoding Default -Value $Content 2724 - 2725 - msys64\usr\bin\bash -lc "sh .ci/sd4/run-checkout-code.sh PC_PROJECT_DIR '${env:PC_PROJECT_DIR}'" 2726 - if ($LASTEXITCODE -ne 0) { 2727 - throw "run-checkout-code.sh failed" 2728 - } 2729 - 2730 - # Diagnose Visual Studio environment variables (Windows) 2731 - # This wastes time and has lots of rows! Only run if "VERBOSE" GitHub input key. 2732 - 2733 - If ( "${env:VERBOSE}" -eq "true" ) { 2734 - if (Test-Path -Path "C:\Program Files (x86)\Windows Kits\10\include") { 2735 - Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\include" 2736 - } 2737 - if (Test-Path -Path "C:\Program Files (x86)\Windows Kits\10\Extension SDKs\WindowsDesktop") { 2738 - Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\Extension SDKs\WindowsDesktop" 2739 - } 2740 - 2741 - $env:PSModulePath += "$([System.IO.Path]::PathSeparator).ci\sd4\g\dkml-runtime-distribution\src\windows" 2742 - Import-Module Machine 2743 - 2744 - $allinstances = Get-VSSetupInstance 2745 - $allinstances | ConvertTo-Json -Depth 5 2746 - } 2747 - .ci\sd4\config-vsstudio.ps1 2748 - msys64\usr\bin\bash -lc "dos2unix .ci/sd4/vsenv.sh" 2749 - Get-Content .ci/sd4/vsenv.sh 2750 - Get-Content .ci/sd4/vsenv.ps1 2751 - 2752 - # Capture Visual Studio compiler environment 2753 - & .ci\sd4\vsenv.ps1 2754 - & .ci\sd4\get-msvcpath-into-msys2.bat 2755 - msys64\usr\bin\bash -lc "cat .ci/sd4/msvcpath | tr -d '\r' | cygpath --path -f - | awk -f .ci/sd4/msvcpath.awk >> .ci/sd4/msvcenv" 2756 - msys64\usr\bin\bash -lc "tail -n100 .ci/sd4/msvcpath .ci/sd4/msvcenv" 2757 - 2758 - msys64\usr\bin\bash -lc "sh .ci/sd4/run-setup-dkml.sh PC_PROJECT_DIR '${env:PC_PROJECT_DIR}'" 2759 - if ($LASTEXITCODE -ne 0) { 2760 - throw "run-setup-dkml.sh failed" 2761 - } 2762 - 2763 - ########################### script ############################### 2764 - 2765 - Write-Host @" 2766 - Finished setup. 2767 - 2768 - To continue your testing, run in PowerShell: 2769 - `$env:CHERE_INVOKING = "yes" 2770 - `$env:MSYSTEM = "$env:msys2_system" 2771 - `$env:dkml_host_abi = "$env:dkml_host_abi" 2772 - `$env:abi_pattern = "$env:abi_pattern" 2773 - `$env:opam_root = "$env:opam_root" 2774 - `$env:exe_ext = "$env:exe_ext" 2775 - 2776 - Now you can use 'opamrun' to do opam commands like: 2777 - 2778 - msys64\usr\bin\bash -lc 'PATH="`$PWD/.ci/sd4/opamrun:`$PATH"; opamrun install XYZ.opam' 2779 - msys64\usr\bin\bash -lc 'PATH="`$PWD/.ci/sd4/opamrun:`$PATH"; opamrun exec -- bash' 2780 - msys64\usr\bin\bash -lc 'sh ci/build-test.sh' 2781 - "@
-6
.gitattributes
··· 2 2 3 3 # Shell scripts are required to be LF 4 4 *.sh text eol=lf 5 - 6 - # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_character_encoding?view=powershell-7.1 7 - *.ps1 text working-tree-encoding=UTF-16 eol=crlf 8 - *.psm1 text working-tree-encoding=UTF-16 eol=crlf 9 - # Other file types that must be CRLF 10 - *.sln text eol=crlf
-103
.github/workflows/dkml.yml
··· 1 - ########################################################################## 2 - # File: dktool/cmake/scripts/dkml/workflow/compilers-github-workflows-dkml.in.yml# 3 - # # 4 - # Copyright 2022 Diskuv, Inc. # 5 - # # 6 - # Licensed under the Apache License, Version 2.0 (the "License"); # 7 - # you may not use this file except in compliance with the License. # 8 - # You may obtain a copy of the License at # 9 - # # 10 - # http://www.apache.org/licenses/LICENSE-2.0 # 11 - # # 12 - # Unless required by applicable law or agreed to in writing, software # 13 - # distributed under the License is distributed on an "AS IS" BASIS, # 14 - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # 15 - # implied. See the License for the specific language governing # 16 - # permissions and limitations under the License. # 17 - # # 18 - ########################################################################## 19 - 20 - # Updating 21 - # -------- 22 - # 23 - # 1. Delete this file. 24 - # 2. Run dk with your original arguments: 25 - # ./dk dkml.workflow.compilers CI GitHub Desktop OS Windows 26 - # or get help to come up with new arguments: 27 - # ./dk dkml.workflow.compilers HELP 28 - 29 - name: Build with DkML compiler 30 - 31 - on: 32 - # trigger on any push or pull request 33 - push: 34 - pull_request: 35 - # ... or trigger manually from GitHub web interface 36 - workflow_dispatch: 37 - 38 - jobs: 39 - build: 40 - strategy: 41 - matrix: 42 - include: # 43 - - gh_os: windows-2019 44 - abi_pattern: win32-windows_x86 45 - dkml_host_abi: windows_x86 46 - - gh_os: windows-2019 47 - abi_pattern: win32-windows_x86_64 48 - dkml_host_abi: windows_x86_64 49 - 50 - runs-on: ${{ matrix.gh_os }} 51 - name: build / ${{ matrix.abi_pattern }} 52 - 53 - steps: 54 - - name: Checkout code 55 - uses: actions/checkout@v3 56 - 57 - - name: Cache DkML compilers code 58 - uses: actions/cache@v3 59 - id: cache-dkml-compilers 60 - with: 61 - path: .ci/dkml-compilers 62 - key: ${{ runner.os }} 63 - 64 - - name: Checkout DkML compilers code 65 - if: steps.cache-dkml-compilers.outputs.cache-hit != 'true' 66 - # For help: ./dk dkml.workflow.compilers HELP 67 - run: ./dk dkml.workflow.compilers CI GitHub 68 - 69 - # The .ci/dkml-compilers "pre" actions will create the environment variables: 70 - # opam_root, exe_ext, dkml_host_abi, abi_pattern (and many more) 71 - # 72 - - name: Setup DkML compilers on a Windows host 73 - if: startsWith(matrix.dkml_host_abi, 'windows_') 74 - uses: ./.ci/dkml-compilers/gh-windows/pre 75 - with: 76 - DKML_COMPILER: ${{ env.DKML_COMPILER }} 77 - CACHE_PREFIX: ${{ env.CACHE_PREFIX }} 78 - 79 - # This section is for your own build logic which you should place in 80 - # ci/build-test.sh or a similar file 81 - 82 - - name: Build and test on Windows host 83 - if: startsWith(matrix.dkml_host_abi, 'windows_') 84 - shell: msys2 {0} 85 - run: ci/build-test.sh 86 - 87 - - name: Build and test on non-Windows host 88 - if: "!startsWith(matrix.dkml_host_abi, 'windows_')" 89 - run: ci/build-test.sh 90 - 91 - # The .ci/dkml-compilers "post" actions will finalize caching, etc. 92 - 93 - - name: Teardown DkML compilers on a Windows host 94 - if: startsWith(matrix.dkml_host_abi, 'windows_') 95 - uses: ./.ci/dkml-compilers/gh-windows/post 96 - 97 - - name: Teardown DkML compilers on a Darwin host 98 - if: startsWith(matrix.dkml_host_abi, 'darwin_') 99 - uses: ./.ci/dkml-compilers/gh-darwin/post 100 - 101 - - name: Teardown DkML compilers on a Linux host 102 - if: startsWith(matrix.dkml_host_abi, 'linux_') 103 - uses: ./.ci/dkml-compilers/gh-linux/post
+1 -10
.gitignore
··· 15 15 mirage/.mirage.config 16 16 _opam 17 17 *.install 18 - 19 - # CI using dkml-workflows' DkML compilers. 20 - # DkML compilers populate the .opam folder. 21 - /.opam/ 22 - # GitHub, unlike GitLab, does not need its CI files to exist 23 - # before referencing them. That means the GitHub scripts do not need 24 - # to be checked in. 25 - /.ci/dkml-compilers/gh-* 26 - # Desktop testing on Windows uses MSYS2. 27 - /msys64/ 18 + .opam/
-96
ci/build-test.sh
··· 1 - #!/bin/sh 2 - ########################################################################## 3 - # File: dktool/cmake/scripts/dkml/workflow/compilers-build-test.in.sh # 4 - # # 5 - # Copyright 2022 Diskuv, Inc. # 6 - # # 7 - # Licensed under the Apache License, Version 2.0 (the "License"); # 8 - # you may not use this file except in compliance with the License. # 9 - # You may obtain a copy of the License at # 10 - # # 11 - # http://www.apache.org/licenses/LICENSE-2.0 # 12 - # # 13 - # Unless required by applicable law or agreed to in writing, software # 14 - # distributed under the License is distributed on an "AS IS" BASIS, # 15 - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # 16 - # implied. See the License for the specific language governing # 17 - # permissions and limitations under the License. # 18 - # # 19 - ########################################################################## 20 - 21 - # Updating 22 - # -------- 23 - # 24 - # 1. Delete this file. 25 - # 2. Run dk with your original arguments: 26 - # ./dk dkml.workflow.compilers CI GitHub Desktop OS Windows 27 - # or get help to come up with new arguments: 28 - # ./dk dkml.workflow.compilers HELP 29 - 30 - set -euf 31 - 32 - # Set project directory 33 - if [ -n "${CI_PROJECT_DIR:-}" ]; then 34 - PROJECT_DIR="$CI_PROJECT_DIR" 35 - elif [ -n "${PC_PROJECT_DIR:-}" ]; then 36 - PROJECT_DIR="$PC_PROJECT_DIR" 37 - elif [ -n "${GITHUB_WORKSPACE:-}" ]; then 38 - PROJECT_DIR="$GITHUB_WORKSPACE" 39 - else 40 - PROJECT_DIR="$PWD" 41 - fi 42 - if [ -x /usr/bin/cygpath ]; then 43 - PROJECT_DIR=$(/usr/bin/cygpath -au "$PROJECT_DIR") 44 - fi 45 - 46 - # shellcheck disable=SC2154 47 - echo " 48 - ============= 49 - build-test.sh 50 - ============= 51 - . 52 - --------- 53 - Arguments 54 - --------- 55 - $* 56 - . 57 - ------ 58 - Matrix 59 - ------ 60 - dkml_host_abi=$dkml_host_abi 61 - abi_pattern=$abi_pattern 62 - opam_root=$opam_root 63 - exe_ext=${exe_ext:-} 64 - . 65 - " 66 - 67 - # PATH. Add opamrun 68 - export PATH="$PROJECT_DIR/.ci/sd4/opamrun:$PATH" 69 - 70 - # Initial Diagnostics (optional but useful) 71 - opamrun switch 72 - opamrun list 73 - opamrun var 74 - opamrun config report 75 - opamrun option 76 - opamrun exec -- ocamlc -config 77 - 78 - # Update 79 - opamrun update 80 - 81 - # Build logic 82 - # 2024-02-09: Remove mirage-crypto-pk on Windows since no portable GMP library (used by Zarith). 83 - # 2024-02-24: Remove mirage-crypto-ec on Windows since it results in test failures. 84 - packages_TOPOLOGICALSORT="mirage-crypto,mirage-crypto-rng,mirage-crypto-rng-mirage" 85 - case "$dkml_host_abi" in 86 - windows_*) 87 - packages_TOPOLOGICALSORT="$packages_TOPOLOGICALSORT" 88 - ;; 89 - *) 90 - packages_TOPOLOGICALSORT="$packages_TOPOLOGICALSORT,mirage-crypto-pk,mirage-crypto-ec" 91 - esac 92 - # shellcheck disable=SC2086 93 - opamrun pin add -y -n . 94 - opamrun install --yes --deps-only --with-test $(echo $packages_TOPOLOGICALSORT | tr ',' ' ') 95 - opamrun exec -- dune build -p "$packages_TOPOLOGICALSORT" 96 - opamrun exec -- dune runtest -p "$packages_TOPOLOGICALSORT"
-235
cmake/FindDkToolScripts.cmake
··· 1 - ########################################################################## 2 - # File: dktool/cmake/FindDkToolScripts.cmake # 3 - # # 4 - # Copyright 2023 Diskuv, Inc. # 5 - # # 6 - # Licensed under the Apache License, Version 2.0 (the "License"); # 7 - # you may not use this file except in compliance with the License. # 8 - # You may obtain a copy of the License at # 9 - # # 10 - # http://www.apache.org/licenses/LICENSE-2.0 # 11 - # # 12 - # Unless required by applicable law or agreed to in writing, software # 13 - # distributed under the License is distributed on an "AS IS" BASIS, # 14 - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # 15 - # implied. See the License for the specific language governing # 16 - # permissions and limitations under the License. # 17 - # # 18 - ########################################################################## 19 - 20 - # Recommendation: Place this file in source control. 21 - # Auto-generated by `./dk dksdk.project.new` of dktool. 22 - 23 - include(FetchContent) 24 - 25 - function(parse_dktool_command_line) 26 - # The first argument is <command>. All dots will be replaced with a 27 - # triple underscore as a convenience and to be pretty for the user. 28 - # However, we do not error if no <command> is given ... we'll do 29 - # that later. 30 - set(command) 31 - set(expected_function_name) 32 - set(quotedArgs "") 33 - if(ARGC EQUAL 0 OR (ARGC EQUAL 1 AND ARGV0 STREQUAL HELP)) 34 - message(NOTICE [[Usage: 35 - ./dk <command> HELP 36 - ./dk <command> [args] 37 - ]]) 38 - else() 39 - set(command ${ARGV0}) 40 - string(REPLACE "." "___" expected_function_name ${command}) 41 - message(VERBOSE "Searching for ${expected_function_name}") 42 - 43 - # Parse the remainder of the arguments [args] 44 - # * Use technique from [Professional CMake: A Practical Guide - Forwarding Command Arguments] 45 - # to be able to forward arguments correctly to an inner function (the <command> function). 46 - cmake_parse_arguments(PARSE_ARGV 1 FWD "" "" "") 47 - foreach(arg IN LISTS FWD_UNPARSED_ARGUMENTS) 48 - string(APPEND quotedArgs " [===[${arg}]===]") 49 - endforeach() 50 - endif() 51 - 52 - # Set policies (we are in a new EVAL CODE context) 53 - # Included scripts do automatic cmake_policy PUSH and POP 54 - if(POLICY CMP0011) 55 - cmake_policy(SET CMP0011 NEW) 56 - endif() 57 - # Allow GIT_SUBMODULES empty to mean no submodules 58 - if(POLICY CMP0097) 59 - cmake_policy(SET CMP0097 NEW) 60 - endif() 61 - 62 - # Setup the binary directory 63 - if(NOT DKTOOL_WORKDIR) 64 - message(FATAL_ERROR "Illegal state. Expecting DKTOOL_WORKDIR") 65 - endif() 66 - set(CMAKE_BINARY_DIR ${DKTOOL_WORKDIR}) 67 - set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_BINARY_DIR}) 68 - 69 - # Search in all the user scripts 70 - set(dot_function_names) 71 - file(GLOB_RECURSE command_files 72 - LIST_DIRECTORIES FALSE 73 - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts 74 - cmake/scripts/*.cmake) 75 - foreach(command_file IN LISTS command_files) 76 - # Normalize and lowercase 77 - cmake_path(NORMAL_PATH command_file) 78 - string(TOLOWER "${command_file}" command_file) 79 - cmake_path(REMOVE_EXTENSION command_file OUTPUT_VARIABLE command_file_no_ext) 80 - 81 - # Convert to list 82 - string(REPLACE "/" ";" command_stems_no_namespace ${command_file_no_ext}) 83 - 84 - # Make a pretty description only for validation 85 - set(pretty_stems ${command_stems_no_namespace}) 86 - list(TRANSFORM pretty_stems PREPEND "'") 87 - list(TRANSFORM pretty_stems APPEND "'") 88 - string(JOIN ", " pretty_stems_str ${pretty_stems}) 89 - string(REGEX REPLACE ",([^,]*)" " and \\1" pretty_stems_str "${pretty_stems_str}") 90 - 91 - # Validate that only alphanumeric with underscores (but not the reserved three underscores) 92 - string(REGEX MATCH "[/a-z0-9_]*" only_alphanum_and_underscores "${command_file_no_ext}") 93 - if(NOT only_alphanum_and_underscores STREQUAL "${command_file_no_ext}") 94 - message(WARNING "Ignoring user script ${CMAKE_CURRENT_SOURCE_DIR}/${command_file}. 95 - The stems of the user script (${pretty_stems_str}) must only contain letters, numbers and underscores.") 96 - continue() 97 - endif() 98 - string(FIND "${command_file_no_ext}" "___" reserved_underscores) 99 - if(reserved_underscores GREATER_EQUAL 0) 100 - message(WARNING "Ignoring user script ${CMAKE_CURRENT_SOURCE_DIR}/${command_file}. 101 - No stem of the user script (${pretty_stems_str}) can contain a triple underscore ('___').") 102 - continue() 103 - endif() 104 - 105 - # Translate dev/xxx.cmake to the "user" namespaced function name 106 - # `user__dev__xxx` and `user.dev.xxx`. 107 - set(command_stems ${command_stems_no_namespace}) 108 - list(PREPEND command_stems "user") 109 - string(JOIN "___" command_function_name ${command_stems}) 110 - string(JOIN "." dot_function_name ${command_stems}) 111 - list(APPEND dot_function_names ${dot_function_name}) 112 - 113 - # In a new scope (to avoid a global, leaky namespace) register the function. 114 - message(VERBOSE "Shimming ${command_function_name}") 115 - cmake_language(EVAL CODE " 116 - function(${command_function_name}) 117 - include(\"${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/${command_file}\") 118 - if(COMMAND run) 119 - run(${quotedArgs}) 120 - else() 121 - message(FATAL_ERROR [[The user script ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/${command_file} was missing: 122 - function(run) 123 - # Your user code 124 - endfunction() 125 - ]]) 126 - endif() 127 - endfunction() 128 - ") 129 - endforeach() 130 - 131 - # Include all the system scripts. 132 - # - Since the system scripts come after the user scripts, the user scripts 133 - # don't override the system scripts unless the user scripts use deferred 134 - # hooks or redefine CMake built-in functions. Regardless, the user 135 - # scripts are namespaced with `user__` prefix 136 - if(NOT IS_DIRECTORY cmake/scripts/dksdk) 137 - # If this project (ex. dktool) has the system scripts, it must 138 - # have all of them. Otherwise we download the system scripts. 139 - FetchContent_Populate(dktool 140 - QUIET 141 - GIT_REPOSITORY https://gitlab.com/diskuv/dktool.git 142 - GIT_TAG 1.0 143 - # As of 3.25.3 the bug https://gitlab.kitware.com/cmake/cmake/-/issues/24578 144 - # has still not been fixed. That means empty strings get removed. 145 - # ExternalProject_Add(GIT_SUBMODULES) in dktool-subbuild/CMakeLists.txt 146 - # means fetch all submodules. 147 - # https://gitlab.kitware.com/cmake/cmake/-/issues/20579#note_734045 148 - # has a workaround. 149 - GIT_SUBMODULES cmake # Non-git-submodule dir that already exists 150 - GIT_SUBMODULES_RECURSE OFF 151 - ) 152 - file(GLOB_RECURSE system_command_files 153 - LIST_DIRECTORIES FALSE 154 - RELATIVE ${dktool_SOURCE_DIR}/cmake/scripts 155 - ${dktool_SOURCE_DIR}/cmake/scripts/dkml/*.cmake 156 - ${dktool_SOURCE_DIR}/cmake/scripts/dksdk/*.cmake) 157 - foreach(command_file IN LISTS system_command_files) 158 - # Normalize and lowercase 159 - cmake_path(NORMAL_PATH command_file) 160 - string(TOLOWER "${command_file}" command_file) 161 - cmake_path(REMOVE_EXTENSION command_file OUTPUT_VARIABLE command_file_no_ext) 162 - 163 - # Convert to list 164 - string(REPLACE "/" ";" command_stems_no_namespace ${command_file_no_ext}) 165 - 166 - # Translate dksdk/xxx.cmake to the function name `dksdk__xxx` and `dksdk.xxx` 167 - set(command_stems ${command_stems_no_namespace}) 168 - string(JOIN "___" command_function_name ${command_stems}) 169 - string(JOIN "." dot_function_name ${command_stems}) 170 - list(APPEND dot_function_names ${dot_function_name}) 171 - 172 - # In a new scope (to avoid a global, leaky namespace) register the function. 173 - message(VERBOSE "Shimming ${command_function_name}") 174 - cmake_language(EVAL CODE " 175 - function(${command_function_name}) 176 - include(\"${dktool_SOURCE_DIR}/cmake/scripts/${command_file}\") 177 - if(COMMAND run) 178 - run(${quotedArgs}) 179 - else() 180 - message(FATAL_ERROR [[The system script ${dktool_SOURCE_DIR}/cmake/scripts/${command_file} was missing: 181 - function(run) 182 - # The system code 183 - endfunction() 184 - ]]) 185 - endif() 186 - endfunction() 187 - ") 188 - 189 - endforeach() 190 - endif() 191 - 192 - # Pretty function names that are available 193 - set(pretty_function_names ${dot_function_names}) 194 - list(TRANSFORM pretty_function_names PREPEND " ") 195 - list(TRANSFORM pretty_function_names APPEND "\n") 196 - string(JOIN "" str_pretty_function_names ${pretty_function_names}) 197 - 198 - # Exit if no <command> 199 - if(NOT command) 200 - message(NOTICE "The following commands are available: 201 - ${str_pretty_function_names}") 202 - return() 203 - endif() 204 - 205 - # Validate the <command> exists 206 - if(NOT COMMAND ${expected_function_name}) 207 - message(FATAL_ERROR "No command '${command}' exists. The following commands are available: 208 - ${str_pretty_function_names}") 209 - message(FATAL_ERROR "No command '${command}' exists") 210 - endif() 211 - 212 - # Call the <command> function 213 - cmake_language(EVAL CODE "${expected_function_name}()") 214 - endfunction() 215 - 216 - # DkML data home 217 - if(WIN32) 218 - set(DKML_DATA_HOME "$ENV{LOCALAPPDATA}/Programs/DiskuvOCaml") 219 - elseif(DEFINED ENV{XDG_DATA_HOME}) 220 - set(DKML_DATA_HOME "$ENV{XDG_DATA_HOME}/diskuv-ocaml") 221 - else() 222 - set(DKML_DATA_HOME "$ENV{HOME}/.local/share/diskuv-ocaml") 223 - endif() 224 - 225 - # DkSDK data home 226 - if(WIN32) 227 - set(DKSDK_DATA_HOME "$ENV{LOCALAPPDATA}/Programs/DkSDK") 228 - elseif(DEFINED ENV{XDG_DATA_HOME}) 229 - set(DKSDK_DATA_HOME "$ENV{XDG_DATA_HOME}/dksdk") 230 - else() 231 - set(DKSDK_DATA_HOME "$ENV{HOME}/.local/share/dksdk") 232 - endif() 233 - 234 - # Splat DKTOOL_CMDLINE 235 - cmake_language(EVAL CODE "parse_dktool_command_line(${DKTOOL_CMDLINE})")
-723
dk
··· 1 - #!/bin/sh 2 - ########################################################################## 3 - # File: dktool/dk # 4 - # # 5 - # Copyright 2023 Diskuv, Inc. # 6 - # # 7 - # Licensed under the Apache License, Version 2.0 (the "License"); # 8 - # you may not use this file except in compliance with the License. # 9 - # You may obtain a copy of the License at # 10 - # # 11 - # http://www.apache.org/licenses/LICENSE-2.0 # 12 - # # 13 - # Unless required by applicable law or agreed to in writing, software # 14 - # distributed under the License is distributed on an "AS IS" BASIS, # 15 - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # 16 - # implied. See the License for the specific language governing # 17 - # permissions and limitations under the License. # 18 - # # 19 - ########################################################################## 20 - 21 - # Recommendation: Place this file in source control. 22 - # Auto-generated by `./dk dksdk.project.new` of dktool. 23 - # 24 - # Invoking: ./dk 25 - # That works in Powershell on Windows, and in Unix. Copy-and-paste works! 26 - # 27 - # Purpose: Install CMake if not already. Then invoke CMake. 28 - 29 - set -euf 30 - 31 - dk_pwd=$PWD 32 - 33 - # --- Imports of dkml-runtime-common's crossplatform-functions.sh --- 34 - 35 - # Get standard locations of Unix system binaries like `/usr/bin/mv` (or `/bin/mv`). 36 - # 37 - # Will not return anything in `/usr/local/bin` or `/usr/sbin`. Use when you do not 38 - # know whether the PATH has been set correctly, or when you do not know if the 39 - # system binary exists. 40 - # 41 - # At some point in the future, this function will error out if the required system binaries 42 - # do not exist. Most system binaries are common to all Unix/Linux/macOS installations but 43 - # some (like `comm`) may need to be installed for proper functioning of DKML. 44 - # 45 - # Outputs: 46 - # - env:DKMLSYS_MV - Location of `mv` 47 - # - env:DKMLSYS_CHMOD - Location of `chmod` 48 - # - env:DKMLSYS_UNAME - Location of `uname` 49 - # - env:DKMLSYS_ENV - Location of `env` 50 - # - env:DKMLSYS_AWK - Location of `awk` 51 - # - env:DKMLSYS_SED - Location of `sed` 52 - # - env:DKMLSYS_COMM - Location of `comm` 53 - # - env:DKMLSYS_INSTALL - Location of `install` 54 - # - env:DKMLSYS_RM - Location of `rm` 55 - # - env:DKMLSYS_SORT - Location of `sort` 56 - # - env:DKMLSYS_CAT - Location of `cat` 57 - # - env:DKMLSYS_STAT - Location of `stat` 58 - # - env:DKMLSYS_GREP - Location of `grep` 59 - # - env:DKMLSYS_CURL - Location of `curl` (empty if not found) 60 - # - env:DKMLSYS_WGET - Location of `wget` (empty if not found) 61 - # - env:DKMLSYS_TR - Location of `tr` 62 - autodetect_system_binaries() { 63 - if [ -z "${DKMLSYS_MV:-}" ]; then 64 - if [ -x /usr/bin/mv ]; then 65 - DKMLSYS_MV=/usr/bin/mv 66 - else 67 - DKMLSYS_MV=/bin/mv 68 - fi 69 - fi 70 - if [ -z "${DKMLSYS_CHMOD:-}" ]; then 71 - if [ -x /usr/bin/chmod ]; then 72 - DKMLSYS_CHMOD=/usr/bin/chmod 73 - else 74 - DKMLSYS_CHMOD=/bin/chmod 75 - fi 76 - fi 77 - if [ -z "${DKMLSYS_UNAME:-}" ]; then 78 - if [ -x /usr/bin/uname ]; then 79 - DKMLSYS_UNAME=/usr/bin/uname 80 - else 81 - DKMLSYS_UNAME=/bin/uname 82 - fi 83 - fi 84 - if [ -z "${DKMLSYS_ENV:-}" ]; then 85 - if [ -x /usr/bin/env ]; then 86 - DKMLSYS_ENV=/usr/bin/env 87 - else 88 - DKMLSYS_ENV=/bin/env 89 - fi 90 - fi 91 - if [ -z "${DKMLSYS_AWK:-}" ]; then 92 - if [ -x /usr/bin/awk ]; then 93 - DKMLSYS_AWK=/usr/bin/awk 94 - else 95 - DKMLSYS_AWK=/bin/awk 96 - fi 97 - fi 98 - if [ -z "${DKMLSYS_SED:-}" ]; then 99 - if [ -x /usr/bin/sed ]; then 100 - DKMLSYS_SED=/usr/bin/sed 101 - else 102 - DKMLSYS_SED=/bin/sed 103 - fi 104 - fi 105 - if [ -z "${DKMLSYS_COMM:-}" ]; then 106 - if [ -x /usr/bin/comm ]; then 107 - DKMLSYS_COMM=/usr/bin/comm 108 - else 109 - DKMLSYS_COMM=/bin/comm 110 - fi 111 - fi 112 - if [ -z "${DKMLSYS_INSTALL:-}" ]; then 113 - if [ -x /usr/bin/install ]; then 114 - DKMLSYS_INSTALL=/usr/bin/install 115 - else 116 - DKMLSYS_INSTALL=/bin/install 117 - fi 118 - fi 119 - if [ -z "${DKMLSYS_RM:-}" ]; then 120 - if [ -x /usr/bin/rm ]; then 121 - DKMLSYS_RM=/usr/bin/rm 122 - else 123 - DKMLSYS_RM=/bin/rm 124 - fi 125 - fi 126 - if [ -z "${DKMLSYS_SORT:-}" ]; then 127 - if [ -x /usr/bin/sort ]; then 128 - DKMLSYS_SORT=/usr/bin/sort 129 - else 130 - DKMLSYS_SORT=/bin/sort 131 - fi 132 - fi 133 - if [ -z "${DKMLSYS_CAT:-}" ]; then 134 - if [ -x /usr/bin/cat ]; then 135 - DKMLSYS_CAT=/usr/bin/cat 136 - else 137 - DKMLSYS_CAT=/bin/cat 138 - fi 139 - fi 140 - if [ -z "${DKMLSYS_STAT:-}" ]; then 141 - if [ -x /usr/bin/stat ]; then 142 - DKMLSYS_STAT=/usr/bin/stat 143 - else 144 - DKMLSYS_STAT=/bin/stat 145 - fi 146 - fi 147 - if [ -z "${DKMLSYS_GREP:-}" ]; then 148 - if [ -x /usr/bin/grep ]; then 149 - DKMLSYS_GREP=/usr/bin/grep 150 - else 151 - DKMLSYS_GREP=/bin/grep 152 - fi 153 - fi 154 - if [ -z "${DKMLSYS_CURL:-}" ]; then 155 - if [ -x /usr/bin/curl ]; then 156 - DKMLSYS_CURL=/usr/bin/curl 157 - elif [ -x /bin/curl ]; then 158 - DKMLSYS_CURL=/bin/curl 159 - else 160 - DKMLSYS_CURL= 161 - fi 162 - fi 163 - if [ -z "${DKMLSYS_WGET:-}" ]; then 164 - if [ -x /usr/bin/wget ]; then 165 - DKMLSYS_WGET=/usr/bin/wget 166 - elif [ -x /bin/wget ]; then 167 - DKMLSYS_WGET=/bin/wget 168 - else 169 - DKMLSYS_WGET= 170 - fi 171 - fi 172 - if [ -z "${DKMLSYS_TR:-}" ]; then 173 - if [ -x /usr/bin/tr ]; then 174 - DKMLSYS_TR=/usr/bin/tr 175 - else 176 - DKMLSYS_TR=/bin/tr 177 - fi 178 - fi 179 - export DKMLSYS_MV DKMLSYS_CHMOD DKMLSYS_UNAME DKMLSYS_ENV DKMLSYS_AWK DKMLSYS_SED DKMLSYS_COMM DKMLSYS_INSTALL 180 - export DKMLSYS_RM DKMLSYS_SORT DKMLSYS_CAT DKMLSYS_STAT DKMLSYS_GREP DKMLSYS_CURL DKMLSYS_WGET DKMLSYS_TR 181 - } 182 - 183 - # Is a Windows build machine if we are in a MSYS2 or Cygwin environment. 184 - # 185 - # Better alternatives 186 - # ------------------- 187 - # 188 - # 1. If you are checking to see if you should do a cygpath, then just guard it 189 - # like so: 190 - # if [ -x /usr/bin/cygpath ]; then 191 - # do_something $(/usr/bin/cygpath ...) ... 192 - # fi 193 - # This clearly guards what you are about to do (cygpath) with what you will 194 - # need (cygpath). 195 - # 2. is_arg_windows_platform 196 - is_unixy_windows_build_machine() { 197 - if is_msys2_msys_build_machine || is_cygwin_build_machine; then 198 - return 0 199 - fi 200 - return 1 201 - } 202 - 203 - # Is a MSYS2 environment with the MSYS or MINGW64 subsystem? 204 - # * MSYS2 can also do MinGW 32-bit and 64-bit subsystems. Used by Diskuv OCaml 205 - # * MINGW64 used by Git Bash (aka. GitHub Actions `shell: bash`) 206 - # https://www.msys2.org/docs/environments/ 207 - is_msys2_msys_build_machine() { 208 - if [ -e /usr/bin/msys-2.0.dll ] && { 209 - [ "${MSYSTEM:-}" = "MSYS" ] || [ "${MSYSTEM:-}" = "MINGW64" ] || [ "${MSYSTEM:-}" = "UCRT64" ] || [ "${MSYSTEM:-}" = "CLANG64" ] || [ "${MSYSTEM:-}" = "MINGW32" ] || [ "${MSYSTEM:-}" = "CLANG32" ] || [ "${MSYSTEM:-}" = "CLANGARM64" ] 210 - }; then 211 - return 0 212 - fi 213 - return 1 214 - } 215 - 216 - is_cygwin_build_machine() { 217 - if [ -e /usr/bin/cygwin1.dll ]; then 218 - return 0 219 - fi 220 - return 1 221 - } 222 - 223 - # Tries to find the host ABI. 224 - # 225 - # Beware: This function uses `uname` probing which is inaccurate during 226 - # cross-compilation. 227 - # 228 - # Outputs: 229 - # - env:BUILDHOST_ARCH will contain the host ABI. 230 - autodetect_buildhost_arch() { 231 - # Set DKMLSYS_* 232 - autodetect_system_binaries 233 - 234 - autodetect_buildhost_arch_SYSTEM=$("$DKMLSYS_UNAME" -s) 235 - autodetect_buildhost_arch_MACHINE=$("$DKMLSYS_UNAME" -m) 236 - # list from https://en.wikipedia.org/wiki/Uname and https://stackoverflow.com/questions/45125516/possible-values-for-uname-m 237 - case "${autodetect_buildhost_arch_SYSTEM}-${autodetect_buildhost_arch_MACHINE}" in 238 - Linux-armv7*) 239 - BUILDHOST_ARCH=linux_arm32v7;; 240 - Linux-armv6* | Linux-arm) 241 - BUILDHOST_ARCH=linux_arm32v6;; 242 - Linux-aarch64 | Linux-arm64 | Linux-armv8*) 243 - BUILDHOST_ARCH=linux_arm64;; 244 - Linux-i386 | Linux-i686) 245 - BUILDHOST_ARCH=linux_x86;; 246 - Linux-x86_64) 247 - BUILDHOST_ARCH=linux_x86_64;; 248 - Darwin-arm64) 249 - BUILDHOST_ARCH=darwin_arm64;; 250 - Darwin-x86_64) 251 - BUILDHOST_ARCH=darwin_x86_64;; 252 - *-i386 | *-i686) 253 - if is_unixy_windows_build_machine; then 254 - BUILDHOST_ARCH=windows_x86 255 - else 256 - printf "%s\n" "FATAL: Unsupported build machine type obtained from 'uname -s' and 'uname -m': $autodetect_buildhost_arch_SYSTEM and $autodetect_buildhost_arch_MACHINE" >&2 257 - exit 1 258 - fi 259 - ;; 260 - *-x86_64) 261 - if is_unixy_windows_build_machine; then 262 - BUILDHOST_ARCH=windows_x86_64 263 - else 264 - printf "%s\n" "FATAL: Unsupported build machine type obtained from 'uname -s' and 'uname -m': $autodetect_buildhost_arch_SYSTEM and $autodetect_buildhost_arch_MACHINE" >&2 265 - exit 1 266 - fi 267 - ;; 268 - *) 269 - # Since: 270 - # 1) MSYS2 does not run on ARM/ARM64 (https://www.msys2.org/docs/environments/) 271 - # 2) MSVC does not use ARM/ARM64 as host machine (https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-160) 272 - # we do not support Windows ARM/ARM64 as a build machine 273 - printf "%s\n" "FATAL: Unsupported build machine type obtained from 'uname -s' and 'uname -m': $autodetect_buildhost_arch_SYSTEM and $autodetect_buildhost_arch_MACHINE" >&2 274 - exit 1 275 - ;; 276 - esac 277 - } 278 - 279 - # A function that will try to print an ISO8601 timestamp, but will fallback to 280 - # the system default. Always uses UTC timezone. 281 - try_iso8601_timestamp() { 282 - date -u -Iseconds 2>/dev/null || TZ=UTC date 283 - } 284 - 285 - # A function that will print the command and possibly time it (if and only if it uses a full path to 286 - # an executable, so that 'time' does not fail on internal shell functions). 287 - # If --return-error-code is the first argument or LOG_TRACE_RETURN_ERROR_CODE=ON, then instead of exiting the 288 - # function will return the error code. 289 - log_trace() { 290 - log_trace_RETURN=${LOG_TRACE_RETURN_ERROR_CODE:-OFF} 291 - 292 - log_trace_1="$1" 293 - if [ "$log_trace_1" = "--return-error-code" ]; then 294 - shift 295 - log_trace_RETURN=ON 296 - fi 297 - 298 - if [ "${DKML_BUILD_TRACE:-OFF}" = ON ]; then 299 - printf "[%s] %s\n" "$(try_iso8601_timestamp)" "+ $*" >&2 300 - if [ -x "$1" ]; then 301 - time "$@" 302 - else 303 - "$@" 304 - fi 305 - else 306 - # use judgement so we essentially have log at an INFO level 307 - case "$1" in 308 - rm|cp) 309 - # debug level. only show when DKML_BUILD_TRACE=ON 310 - ;; 311 - git|make|ocaml_configure|ocaml_make|make_host|make_target) 312 - # info level. and can show entire command without polluting the screen 313 - printf "[%s] %s\n" "$(try_iso8601_timestamp)" "$*" >&2 314 - ;; 315 - *) printf "[%s] %s\n" "$(try_iso8601_timestamp)" "$1" >&2 316 - esac 317 - "$@" 318 - fi 319 - log_trace_ec="$?" 320 - if [ "$log_trace_ec" -ne 0 ]; then 321 - if [ "$log_trace_RETURN" = ON ]; then 322 - return "$log_trace_ec" 323 - else 324 - printf "FATAL: Command failed with exit code %s: %s\n" "$log_trace_ec" "$*" >&2 325 - exit "$log_trace_ec" 326 - fi 327 - fi 328 - } 329 - 330 - # [sha256compute FILE] writes the SHA256 checksum (hex encoded) of file FILE to the standard output. 331 - sha256compute() { 332 - sha256compute_FILE="$1" 333 - shift 334 - # For reasons unclear doing the following in MSYS2: 335 - # sha256sum 'Z:\source\README.md' 336 - # will produce a backslash like: 337 - # \5518c76ed7234a153941fb7bc94b6e91d9cb8f1c4e22daf169a59b5878c3fc8a *Z:\\source\\README.md 338 - # So always cygpath the filename if available 339 - if [ -x /usr/bin/cygpath ]; then 340 - sha256compute_FILE=$(/usr/bin/cygpath -a "$sha256compute_FILE") 341 - fi 342 - 343 - if [ -x /usr/bin/shasum ]; then 344 - /usr/bin/shasum -a 256 "$sha256compute_FILE" | awk '{print $1}' 345 - elif [ -x /usr/bin/sha256sum ]; then 346 - /usr/bin/sha256sum "$sha256compute_FILE" | awk '{print $1}' 347 - else 348 - printf "FATAL: %s\n" "No sha256 checksum utility found" >&2 349 - exit 107 350 - fi 351 - } 352 - 353 - # [sha256check FILE SUM] checks that the file FILE has a SHA256 checksum (hex encoded) of SUM. 354 - # The function will return nonzero (and exit with failure if `set -e` is enabled) if the checksum does not match. 355 - sha256check() { 356 - sha256check_FILE="$1" 357 - shift 358 - sha256check_SUM="$1" 359 - shift 360 - if [ -x /usr/bin/shasum ]; then 361 - printf "%s %s" "$sha256check_SUM" "$sha256check_FILE" | /usr/bin/shasum -a 256 -c >&2 362 - elif [ -x /usr/bin/sha256sum ]; then 363 - printf "%s %s" "$sha256check_SUM" "$sha256check_FILE" | /usr/bin/sha256sum -c >&2 364 - else 365 - printf "FATAL: %s\n" "No sha256 checksum utility found" >&2 366 - exit 107 367 - fi 368 - } 369 - 370 - # [downloadfile URL FILE SUM] downloads from URL into FILE and verifies the SHA256 checksum of SUM. 371 - # If the FILE already exists with the correct checksum it is not redownloaded. 372 - # The function will exit with failure if the checksum does not match. 373 - downloadfile() { 374 - downloadfile_URL="$1" 375 - shift 376 - downloadfile_FILE="$1" 377 - shift 378 - downloadfile_SUM="$1" 379 - shift 380 - 381 - # Set DKMLSYS_* 382 - autodetect_system_binaries 383 - 384 - if [ -e "$downloadfile_FILE" ]; then 385 - if sha256check "$downloadfile_FILE" "$downloadfile_SUM"; then 386 - return 0 387 - else 388 - $DKMLSYS_RM -f "$downloadfile_FILE" 389 - fi 390 - fi 391 - if [ "${CI:-}" = true ]; then 392 - if [ -n "$DKMLSYS_CURL" ]; then 393 - log_trace "$DKMLSYS_CURL" -L -s "$downloadfile_URL" -o "$downloadfile_FILE".tmp 394 - elif [ -n "$DKMLSYS_WGET" ]; then 395 - log_trace "$DKMLSYS_WGET" -q -O "$downloadfile_FILE".tmp "$downloadfile_URL" 396 - else 397 - echo "No curl or wget available on the system paths" >&2 398 - exit 107 399 - fi 400 - else 401 - if [ -n "$DKMLSYS_CURL" ]; then 402 - log_trace "$DKMLSYS_CURL" -L "$downloadfile_URL" -o "$downloadfile_FILE".tmp 403 - elif [ -n "$DKMLSYS_WGET" ]; then 404 - log_trace "$DKMLSYS_WGET" -O "$downloadfile_FILE".tmp "$downloadfile_URL" 405 - else 406 - echo "No curl or wget available on the system paths" >&2 407 - exit 107 408 - fi 409 - fi 410 - if ! sha256check "$downloadfile_FILE".tmp "$downloadfile_SUM"; then 411 - printf "%s\n" "FATAL: Encountered a corrupted or compromised download from $downloadfile_URL" >&2 412 - exit 1 413 - fi 414 - $DKMLSYS_MV "$downloadfile_FILE".tmp "$downloadfile_FILE" 415 - } 416 - 417 - # --- Environment detection --- 418 - 419 - # Set DKMLSYS_* 420 - autodetect_system_binaries 421 - 422 - # Find host ABI. Set in BUILDHOST_ARCH 423 - autodetect_buildhost_arch 424 - 425 - # Use the project tree as the current directory 426 - PROJ_DIR=$(dirname "$0") 427 - PROJ_DIR=$(cd "$PROJ_DIR" && pwd) 428 - cd "$PROJ_DIR" 429 - 430 - # --- Tool directory selection --- 431 - 432 - tools_dir= 433 - tools_name=dktool 434 - # 1. Check if CI since many CI providers can only cache content in a subdirectory 435 - # of the project. 436 - if [ -z "$tools_dir" ] && [ "${CI:-}" = true ]; then 437 - install -d "$PROJ_DIR/.tools" 438 - tools_dir="$PROJ_DIR/.tools" 439 - fi 440 - # 2. Check in locations rooted under /opt/diskuv 441 - # We look under a /opt/diskuv early because 442 - # - Especially important for WSL2 to use a pure Linux filesystem (ext4) for 443 - # best performance. 444 - # - Using a canonical location (especially /opt/diskuv/usr/share) makes 445 - # it easy to use CMake presets for non-Windows hosts. 446 - if [ -z "$tools_dir" ] && [ -n "${XDG_DATA_HOME:-}" ] && [ -w "/opt/diskuv/$XDG_DATA_HOME" ]; then 447 - install -d "/opt/diskuv/$XDG_DATA_HOME/$tools_name" 448 - tools_dir="/opt/diskuv/$XDG_DATA_HOME/$tools_name" 449 - fi 450 - if [ -z "$tools_dir" ] && [ -n "${HOME:-}" ] && [ -w "/opt/diskuv/$HOME" ]; then 451 - install -d "/opt/diskuv/$HOME/.local/share/$tools_name" 452 - tools_dir="/opt/diskuv/$HOME/.local/share/$tools_name" 453 - fi 454 - if [ -z "$tools_dir" ] && [ -w "/opt/diskuv/usr/share" ]; then 455 - install -d "/opt/diskuv/usr/share/$tools_name" 456 - tools_dir="/opt/diskuv/usr/share/$tools_name" 457 - fi 458 - # 3. Check in the conventional locations rooted under / 459 - if [ -z "$tools_dir" ] && [ -n "${XDG_DATA_HOME:-}" ] && [ -w "$XDG_DATA_HOME" ]; then 460 - install -d "$XDG_DATA_HOME/$tools_name" 461 - tools_dir="$XDG_DATA_HOME/$tools_name" 462 - fi 463 - if [ -z "$tools_dir" ] && [ -n "${HOME:-}" ] && [ -w "$HOME" ]; then 464 - install -d "$HOME/.local/share/$tools_name" 465 - tools_dir="$HOME/.local/share/$tools_name" 466 - fi 467 - # 4. Validate 468 - if [ -z "$tools_dir" ]; then 469 - echo "FATAL: Could not find a location to install the tools necessary for this project." >&2 470 - echo " ...: Make sure you have a home directory and that it is write-able, or define" >&2 471 - echo " ...: the environment variable XDG_DATA_HOME in a shell profile script after" >&2 472 - echo " ...: creating the \$XDG_DATA_HOME directory." >&2 473 - exit 2 474 - fi 475 - 476 - # --- Tool downloads and installs --- 477 - 478 - # PREREQS 479 - # ------- 480 - 481 - install_linux_prog() { 482 - install_linux_prog_NAME=$1 483 - shift 484 - install_linux_prog_PKG=$1 485 - shift 486 - if [ -x "/usr/bin/$install_linux_prog_NAME" ]; then 487 - export DK_PROG_INSTALLED_LOCATION="/usr/bin/$install_linux_prog_NAME" 488 - else 489 - if command -v yum > /dev/null 2> /dev/null; then 490 - if [ "$(id -u)" -eq 0 ]; then 491 - yum install -y "$install_linux_prog_PKG" 492 - else 493 - echo "Running: sudo yum install -y $install_linux_prog_PKG" 494 - sudo yum install -y "$install_linux_prog_PKG" 495 - fi 496 - else 497 - if [ "$(id -u)" -eq 0 ]; then 498 - apt-get -q install -y "$install_linux_prog_PKG" 499 - else 500 - echo "Running: sudo -q apt-get -qq install -y --no-install-suggests $install_linux_prog_PKG" 501 - sudo apt-get -qq install -y --no-install-suggests "$install_linux_prog_PKG" 502 - fi 503 - fi 504 - DK_PROG_INSTALLED_LOCATION=$(command -v "$install_linux_prog_NAME") 505 - export DK_PROG_INSTALLED_LOCATION 506 - fi 507 - } 508 - 509 - get_homebrew_binary() { 510 - get_homebrew_binary_NAME=$1 511 - shift 512 - if command -v brew > /dev/null 2> /dev/null; then 513 - get_homebrew_binary_PREFIX=$(brew --prefix) 514 - if [ -x "$get_homebrew_binary_PREFIX/bin/$get_homebrew_binary_NAME" ]; then 515 - export DK_PROG_INSTALLED_LOCATION="$get_homebrew_binary_PREFIX/bin/$get_homebrew_binary_NAME" 516 - return 0 517 - fi 518 - fi 519 - return 1 520 - } 521 - 522 - install_macos_prog() { 523 - install_macos_prog_NAME=$1 524 - shift 525 - install_macos_prog_PKG=$1 526 - shift 527 - if [ -x "/usr/bin/$install_macos_prog_NAME" ]; then 528 - export DK_PROG_INSTALLED_LOCATION="/usr/bin/$install_macos_prog_NAME" 529 - elif [ -x "/usr/local/bin/$install_macos_prog_NAME" ]; then 530 - export DK_PROG_INSTALLED_LOCATION="/usr/local/bin/$install_macos_prog_NAME" 531 - elif get_homebrew_binary "$install_macos_prog_NAME"; then 532 - # DK_PROG_INSTALLED_LOCATION already set by [get_homebrew_binary] 533 - true 534 - else 535 - if command -v brew > /dev/null 2> /dev/null; then 536 - brew install --quiet --formula "$install_macos_prog_PKG" >&2 537 - get_homebrew_binary "$install_macos_prog_NAME" 538 - # DK_PROG_INSTALLED_LOCATION already set by [get_homebrew_binary] 539 - elif command -v port > /dev/null 2> /dev/null; then 540 - if [ "$(id -u)" -eq 0 ]; then 541 - port install "$install_macos_prog_PKG" 542 - else 543 - echo "Running: sudo port install $install_macos_prog_PKG" 544 - sudo port install "$install_macos_prog_PKG" 545 - fi 546 - DK_PROG_INSTALLED_LOCATION=$(command -v "$install_macos_prog_NAME") 547 - export DK_PROG_INSTALLED_LOCATION 548 - else 549 - echo "FATAL: Neither Homebrew nor MacPorts are available on your macOS. You can follow https://docs.brew.sh/Installation to install Homebrew." >&2 550 - exit 2 551 - fi 552 - fi 553 - } 554 - 555 - case $BUILDHOST_ARCH in 556 - linux_*) 557 - install_linux_prog wget wget # For [downloadfile] 558 - install_linux_prog tar tar # For handling tar balls later in this script 559 - ;; 560 - esac 561 - 562 - # NINJA 563 - # ----- 564 - # We need a valid CMAKE_GENERATOR to do FetchContent_Populate() in script mode 565 - 566 - NINJA_EXE= 567 - case $BUILDHOST_ARCH in 568 - darwin_*) 569 - install_macos_prog ninja ninja 570 - NINJA_EXE=$DK_PROG_INSTALLED_LOCATION;; 571 - linux_*) 572 - install_linux_prog ninja ninja-build 573 - NINJA_EXE=$DK_PROG_INSTALLED_LOCATION;; 574 - esac 575 - 576 - # CMAKE 577 - # ----- 578 - 579 - case $BUILDHOST_ARCH in 580 - linux_*) 581 - # This is for CMake to do FetchContent() 582 - install_linux_prog git git ;; 583 - esac 584 - case $BUILDHOST_ARCH in 585 - linux_x86) 586 - # This is for Python wheel extraction 587 - install_linux_prog unzip unzip ;; 588 - esac 589 - 590 - cmake_base= 591 - cmake_majmin_ver=3.25 592 - cmake_majminpat_ver=3.25.2 593 - cmake_bindir= 594 - cmake_destdir=$tools_dir/cmake-$cmake_majminpat_ver 595 - install -d "$tools_dir/dl" 596 - download_cmake() { 597 - case $BUILDHOST_ARCH in 598 - darwin_*) 599 - install_macos_prog cmake cmake 600 - cmake_bindir=$(dirname "$DK_PROG_INSTALLED_LOCATION") 601 - ;; 602 - linux_x86_64) 603 - cmake_base="cmake-$cmake_majminpat_ver-linux-x86_64" 604 - printf "%s\n\n" "-- Downloading cmake-$cmake_majminpat_ver for Linux x86_64" >&2 605 - downloadfile \ 606 - "https://github.com/Kitware/CMake/releases/download/v$cmake_majminpat_ver/$cmake_base.tar.gz" \ 607 - "$tools_dir/dl/cmake.tar.gz" \ 608 - 783da74f132fd1fea91b8236d267efa4df5b91c5eec1dea0a87f0cf233748d99 609 - cmake_bindir="$cmake_destdir/bin" ;; 610 - linux_x86) 611 - # CMake does not provide 32-bit binaries. But pypi does at https://pypi.org/project/cmake/ 612 - printf "%s\n\n" "-- Downloading cmake-$cmake_majminpat_ver for Linux x86" >&2 613 - downloadfile \ 614 - https://files.pythonhosted.org/packages/11/6e/aeeddf2f5b16542b6a30ceab4896421e8705d8e9a9296dba79395db11b00/cmake-3.25.2-py2.py3-none-manylinux_2_17_i686.manylinux2014_i686.whl \ 615 - "$tools_dir/dl/cmake.whl" \ 616 - 715ef82e81b48db3e4c7744614c15ff361d53f6987fd70b1b66b0880595f2e2c 617 - cmake_bindir="$cmake_destdir/bin" ;; 618 - linux_arm64) 619 - cmake_base="cmake-$cmake_majminpat_ver-linux-aarch64" 620 - printf "%s\n\n" "-- Downloading cmake-$cmake_majminpat_ver for Linux ARM64" >&2 621 - downloadfile \ 622 - "https://github.com/Kitware/CMake/releases/download/v$cmake_majminpat_ver/$cmake_base.tar.gz" \ 623 - "$tools_dir/dl/cmake.tar.gz" \ 624 - 9216ecf0449ade700e66e0def11eeaebf9fa7d4428c02f49cb59f11418d3f8a5 625 - cmake_bindir="$cmake_destdir/bin" ;; 626 - esac 627 - } 628 - export_cmake_vars() { 629 - case $BUILDHOST_ARCH in 630 - darwin_*) 631 - if command -v brew > /dev/null 2> /dev/null; then 632 - cmake_bindir=$(brew --prefix cmake)/bin 633 - else 634 - cmake_bindir=$(command -v cmake) 635 - cmake_bindir=$(dirname "$cmake_bindir") 636 - fi 637 - ;; 638 - linux_x86_64) 639 - cmake_bindir="$cmake_destdir/bin" ;; 640 - linux_x86) 641 - cmake_bindir="$cmake_destdir/bin" ;; 642 - esac 643 - } 644 - have_correct_cmake=0 645 - if [ -x "$tools_dir/cmake-$cmake_majminpat_ver/bin/cmake" ]; then 646 - # shellcheck disable=SC2016 647 - have_correct_cmake_VER=$("$tools_dir/cmake-$cmake_majminpat_ver/bin/cmake" --version | $DKMLSYS_AWK 'NR==1{print $NF}') 648 - if [ "$have_correct_cmake_VER" = "$cmake_majminpat_ver" ]; then 649 - have_correct_cmake=1 650 - fi 651 - fi 652 - if [ $have_correct_cmake -eq 0 ]; then 653 - download_cmake 654 - fi 655 - # Handle tarball 656 - if [ -e "$tools_dir/dl/cmake.tar.gz" ] && [ -n "$cmake_base" ]; then 657 - rm -rf "$tools_dir/cmake-$cmake_majminpat_ver" 658 - install -d "$cmake_destdir" 659 - tar xCfz "$cmake_destdir" "$tools_dir/dl/cmake.tar.gz" 660 - rm -f "$tools_dir/dl/cmake.tar.gz" 661 - set +f 662 - if [ -e "$cmake_destdir/$cmake_base/CMake.app" ]; then 663 - mv "$cmake_destdir/$cmake_base/CMake.app/Contents"/* "$cmake_destdir/" 664 - else 665 - mv "$cmake_destdir/$cmake_base"/* "$cmake_destdir/" 666 - fi 667 - set -f 668 - fi 669 - # Handle Python wheel 670 - if [ -e "$tools_dir/dl/cmake.whl" ]; then 671 - rm -rf "$tools_dir/cmake-$cmake_majminpat_ver" 672 - cd "$tools_dir/dl" 673 - rm -rf cmake/data 674 - # Don't want cmake/data/{aclocal,bash-completion,emacs,vim} 675 - unzip -q cmake.whl 'cmake/data/bin/**' 676 - unzip -q cmake.whl 'cmake/data/doc/**' 677 - # Don't want cmake/data/share/cmake-$cmake_majmin_ver/Help 678 - unzip -q cmake.whl "cmake/data/share/cmake-$cmake_majmin_ver/"'include/**' 679 - unzip -q cmake.whl "cmake/data/share/cmake-$cmake_majmin_ver/"'Modules/**' 680 - unzip -q cmake.whl "cmake/data/share/cmake-$cmake_majmin_ver/"'Templates/**' 681 - rm -f cmake.whl 682 - cd - 683 - set +f 684 - install -d "$cmake_destdir/share" "$cmake_destdir/doc" "$cmake_destdir/bin" 685 - mv "$tools_dir/dl/cmake/data/bin"/* "$cmake_destdir/bin/" 686 - rm -rf "$cmake_destdir/share/cmake-$cmake_majmin_ver" "$cmake_destdir/doc/cmake-$cmake_majmin_ver" "$cmake_destdir/doc/cmake" 687 - mv "$tools_dir/dl/cmake/data/share/cmake-$cmake_majmin_ver" "$cmake_destdir/share/" 688 - if [ -e "$tools_dir/dl/cmake/data/doc/cmake" ]; then # Windows wheel 689 - mv "$tools_dir/dl/cmake/data/doc/cmake" "$cmake_destdir/doc/" 690 - fi 691 - if [ -e "$tools_dir/dl/cmake/data/doc/cmake-$cmake_majmin_ver" ]; then # Linux wheel 692 - mv "$tools_dir/dl/cmake/data/doc/cmake-$cmake_majmin_ver" "$cmake_destdir/doc/" 693 - fi 694 - set -f 695 - # other dirs: aclocal bash-completion emacs vim 696 - rm -rf "$tools_dir/dl/cmake/data/share" 697 - # be pedantic. if we don't know about a directory, it may be important. so error 698 - # if some directory is non-empty 699 - rmdir "$tools_dir/dl/cmake/data/bin" "$tools_dir/dl/cmake/data/doc" 700 - rmdir "$tools_dir/dl/cmake/data" 701 - fi 702 - 703 - # Put tools in PATH 704 - export_cmake_vars 705 - if [ -n "$cmake_bindir" ] && [ -d "$cmake_bindir" ]; then 706 - tools_bin_dir=$(cd "$cmake_bindir" && pwd) 707 - export PATH="$tools_bin_dir:$PATH" 708 - else 709 - echo "This platform is not supported. No cmake 3.25+ download logic has been added" >&2 710 - exit 1 711 - fi 712 - 713 - # Validate 714 - "$cmake_bindir/cmake" --version > /dev/null 715 - 716 - # --- Run finder script --- 717 - 718 - cd "$PROJ_DIR" 719 - "$cmake_bindir/cmake" \ 720 - -D CMAKE_GENERATOR=Ninja -D CMAKE_MAKE_PROGRAM="$NINJA_EXE" \ 721 - -D "DKTOOL_PWD:FILEPATH=$dk_pwd" \ 722 - -D "DKTOOL_WORKDIR:FILEPATH=$tools_dir/work" -D "DKTOOL_CMDLINE:STRING=$*" \ 723 - -P cmake/FindDkToolScripts.cmake
-183
dk.cmd
··· 1 - @ECHO OFF 2 - 3 - REM ########################################################################## 4 - REM # File: dktool/dk.cmd # 5 - REM # # 6 - REM # Copyright 2023 Diskuv, Inc. # 7 - REM # # 8 - REM # Licensed under the Apache License, Version 2.0 (the "License"); # 9 - REM # you may not use this file except in compliance with the License. # 10 - REM # You may obtain a copy of the License at # 11 - REM # # 12 - REM # http://www.apache.org/licenses/LICENSE-2.0 # 13 - REM # # 14 - REM # Unless required by applicable law or agreed to in writing, software # 15 - REM # distributed under the License is distributed on an "AS IS" BASIS, # 16 - REM # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # 17 - REM # implied. See the License for the specific language governing # 18 - REM # permissions and limitations under the License. # 19 - REM # # 20 - REM ########################################################################## 21 - 22 - REM Recommendation: Place this file in source control. 23 - REM Auto-generated by `./dk dksdk.project.new` of dktool. 24 - 25 - REM The canonical way to run this script is: ./dk 26 - REM That works in Powershell on Windows, and in Unix. Copy-and-paste works! 27 - 28 - SETLOCAL 29 - 30 - REM Coding guidelines 31 - REM 1. Microsoft way of getting around PowerShell permissions: 32 - REM https://github.com/microsoft/vcpkg/blob/71422c627264daedcbcd46f01f1ed0dcd8460f1b/bootstrap-vcpkg.bat 33 - REM 2. Write goto downward please so code flow is top to bottom. 34 - 35 - SET DK_CMAKE_VER=3.25.3 36 - SET DK_NINJA_VER=1.11.1 37 - SET DK_BUILD_TYPE=Release 38 - SET DK_SHARE=%LOCALAPPDATA%\Programs\DkSDK\dktool 39 - SET DK_PROJ_DIR=%~dp0 40 - SET DK_PWD=%CD% 41 - 42 - REM -------------- CMAKE -------------- 43 - 44 - REM Find CMAKE.EXE 45 - where.exe /q cmake.exe >NUL 2>NUL 46 - IF %ERRORLEVEL% neq 0 ( 47 - goto FindDownloadedCMake 48 - ) 49 - FOR /F "tokens=* usebackq" %%F IN (`where.exe cmake.exe`) DO ( 50 - SET "DK_CMAKE_EXE=%%F" 51 - ) 52 - 53 - REM Check if present at <data>/cmake-VER/bin/cmake.exe 54 - :FindDownloadedCMake 55 - IF EXIST %DK_SHARE%\cmake-%DK_CMAKE_VER%-windows-x86_64\bin\cmake.exe ( 56 - SET "DK_CMAKE_EXE=%DK_SHARE%\cmake-%DK_CMAKE_VER%-windows-x86_64\bin\cmake.exe" 57 - GOTO ValidateCMake 58 - ) 59 - 60 - REM Download CMAKE.EXE 61 - bitsadmin /transfer dktool-cmake /download /priority FOREGROUND ^ 62 - "https://github.com/Kitware/CMake/releases/download/v%DK_CMAKE_VER%/cmake-%DK_CMAKE_VER%-windows-x86_64.zip" ^ 63 - "%TEMP%\cmake-%DK_CMAKE_VER%-windows-x86_64.zip" 64 - IF %ERRORLEVEL% equ 0 ( 65 - GOTO UnzipCMakeZip 66 - ) 67 - REM Try PowerShell 3+ instead 68 - powershell -NoProfile -ExecutionPolicy Bypass -Command ^ 69 - "Invoke-WebRequest https://github.com/Kitware/CMake/releases/download/v%DK_CMAKE_VER%/cmake-%DK_CMAKE_VER%-windows-x86_64.zip -OutFile '%TEMP%\cmake-%DK_CMAKE_VER%-windows-x86_64.zip'" 70 - IF %ERRORLEVEL% neq 0 ( 71 - echo. 72 - echo.Could not download CMake %DK_CMAKE_VER%. Make sure that PowerShell is installed 73 - echo.and has not been disabled by a corporate policy. 74 - echo. 75 - EXIT /b 1 76 - ) 77 - 78 - REM Unzip CMAKE.EXE (use PowerShell; could download unzip.exe and sha256sum.exe as well in case corporate policy) 79 - :UnzipCMakeZip 80 - powershell -NoProfile -ExecutionPolicy Bypass -Command ^ 81 - "Expand-Archive '%TEMP%\cmake-%DK_CMAKE_VER%-windows-x86_64.zip' -DestinationPath '%DK_SHARE%'" 82 - IF %ERRORLEVEL% neq 0 ( 83 - echo. 84 - echo.Could not unzip CMake %DK_CMAKE_VER%. Make sure that PowerShell is installed 85 - echo.and has not been disabled by a corporate policy. 86 - echo. 87 - EXIT /b 1 88 - ) 89 - SET "DK_CMAKE_EXE=%DK_SHARE%\cmake-%DK_CMAKE_VER%-windows-x86_64\bin\cmake.exe" 90 - 91 - REM Validate cmake.exe 92 - :ValidateCMake 93 - "%DK_CMAKE_EXE%" -version >NUL 2>NUL 94 - if %ERRORLEVEL% neq 0 ( 95 - echo. 96 - echo.%DK_CMAKE_EXE% 97 - echo.is not responding to the -version option. Make sure that 98 - echo.CMake is installed correctly. 99 - echo. 100 - exit /b 1 101 - ) 102 - 103 - REM -------------- NINJA -------------- 104 - 105 - REM Find NINJA.EXE 106 - where.exe /q ninja.exe >NUL 2>NUL 107 - IF %ERRORLEVEL% neq 0 ( 108 - goto FindDownloadedNinja 109 - ) 110 - FOR /F "tokens=* usebackq" %%F IN (`where.exe ninja.exe`) DO ( 111 - SET "DK_NINJA_EXE=%%F" 112 - ) 113 - 114 - REM Check if present at <data>/ninja-VER/bin/ninja.exe 115 - :FindDownloadedNinja 116 - IF EXIST %DK_SHARE%\ninja-%DK_NINJA_VER%-windows-x86_64\bin\ninja.exe ( 117 - SET "DK_NINJA_EXE=%DK_SHARE%\ninja-%DK_NINJA_VER%-windows-x86_64\bin\ninja.exe" 118 - GOTO ValidateNinja 119 - ) 120 - 121 - REM Download NINJA.EXE 122 - bitsadmin /transfer dktool-ninja /download /priority FOREGROUND ^ 123 - "https://github.com/ninja-build/ninja/releases/download/v%DK_NINJA_VER%/ninja-win.zip" ^ 124 - "%TEMP%\ninja-%DK_NINJA_VER%-windows-x86_64.zip" 125 - IF %ERRORLEVEL% equ 0 ( 126 - GOTO UnzipNinjaZip 127 - ) 128 - REM Try PowerShell 3+ instead 129 - powershell -NoProfile -ExecutionPolicy Bypass -Command ^ 130 - "Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v%DK_NINJA_VER%/ninja-win.zip -OutFile '%TEMP%\ninja-%DK_NINJA_VER%-windows-x86_64.zip'" 131 - IF %ERRORLEVEL% neq 0 ( 132 - echo. 133 - echo.Could not download Ninja %DK_NINJA_VER%. Make sure that PowerShell is installed 134 - echo.and has not been disabled by a corporate policy. 135 - echo. 136 - EXIT /b 1 137 - ) 138 - 139 - REM Unzip NINJA.EXE (use PowerShell; could download unzip.exe and sha256sum.exe as well in case corporate policy) 140 - :UnzipNinjaZip 141 - powershell -NoProfile -ExecutionPolicy Bypass -Command ^ 142 - "Expand-Archive '%TEMP%\ninja-%DK_NINJA_VER%-windows-x86_64.zip' -DestinationPath '%DK_SHARE%\ninja-%DK_NINJA_VER%-windows-x86_64\bin'" 143 - IF %ERRORLEVEL% neq 0 ( 144 - echo. 145 - echo.Could not unzip Ninja %DK_NINJA_VER%. Make sure that PowerShell is installed 146 - echo.and has not been disabled by a corporate policy. 147 - echo. 148 - EXIT /b 1 149 - ) 150 - SET "DK_NINJA_EXE=%DK_SHARE%\ninja-%DK_NINJA_VER%-windows-x86_64\bin\ninja.exe" 151 - 152 - REM Validate ninja.exe 153 - :ValidateNinja 154 - "%DK_NINJA_EXE%" --version >NUL 2>NUL 155 - if %ERRORLEVEL% neq 0 ( 156 - echo. 157 - echo.%DK_NINJA_EXE% 158 - echo.is not responding to the --version option. Make sure that 159 - echo.Ninja is installed correctly. 160 - echo. 161 - exit /b 1 162 - ) 163 - 164 - REM -------------- DkML PATH --------- 165 - REM We get "git-sh-setup: file not found" in Git for Windows because 166 - REM Command Prompt has the "Path" environment variable, while PowerShell 167 - REM and `with-dkml` use the PATH environment variable. Sadly both 168 - REM can be present in Command Prompt at the same time. Git for Windows 169 - REM (called by FetchContent in CMake) does not comport with what Command 170 - REM Prompt is using. So we let Command Prompt be the source of truth by 171 - REM removing any duplicated PATH twice and resetting to what Command Prompt 172 - REM thinks the PATH is. 173 - 174 - SET _DK_PATH=%PATH% 175 - SET PATH= 176 - SET PATH= 177 - SET PATH=%_DK_PATH% 178 - SET _DK_PATH= 179 - 180 - REM -------------- Run finder -------------- 181 - 182 - cd /d %DK_PROJ_DIR% 183 - "%DK_CMAKE_EXE%" -D CMAKE_GENERATOR=Ninja -D "CMAKE_MAKE_PROGRAM=%DK_NINJA_EXE%" -D "DKTOOL_PWD:FILEPATH=%DK_PWD%" -D "DKTOOL_WORKDIR:FILEPATH=%DK_SHARE%\work" -D "DKTOOL_CMDLINE:STRING=%*" -P cmake/FindDkToolScripts.cmake