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

Add DkML compilers to bring MSVC

Ran: ./dk dkml.workflow.compilers CI GitHub Desktop OS Windows

+202
.ci/dkml-compilers/pc/setup-dkml-windows_x86.ps1

This is a binary file and will not be displayed.

.ci/dkml-compilers/pc/setup-dkml-windows_x86_64.ps1

This is a binary file and will not be displayed.

+6
.gitattributes
··· 1 1 *.ml linguist-language=OCaml 2 + 3 + # https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_character_encoding?view=powershell-7.1 4 + *.ps1 text working-tree-encoding=UTF-16 eol=crlf 5 + *.psm1 text working-tree-encoding=UTF-16 eol=crlf 6 + # Other file types that must be CRLF 7 + *.sln text eol=crlf
+102
.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 33 + push: 34 + # ... or trigger manually from GitHub web interface 35 + workflow_dispatch: 36 + 37 + jobs: 38 + build: 39 + strategy: 40 + matrix: 41 + include: # 42 + - gh_os: windows-2019 43 + abi_pattern: win32-windows_x86 44 + dkml_host_abi: windows_x86 45 + - gh_os: windows-2019 46 + abi_pattern: win32-windows_x86_64 47 + dkml_host_abi: windows_x86_64 48 + 49 + runs-on: ${{ matrix.gh_os }} 50 + name: build / ${{ matrix.abi_pattern }} 51 + 52 + steps: 53 + - name: Checkout code 54 + uses: actions/checkout@v3 55 + 56 + - name: Cache DkML compilers code 57 + uses: actions/cache@v3 58 + id: cache-dkml-compilers 59 + with: 60 + path: .ci/dkml-compilers 61 + key: ${{ runner.os }} 62 + 63 + - name: Checkout DkML compilers code 64 + if: steps.cache-dkml-compilers.outputs.cache-hit != 'true' 65 + # For help: ./dk dkml.workflow.compilers HELP 66 + run: ./dk dkml.workflow.compilers CI GitHub 67 + 68 + # The .ci/dkml-compilers "pre" actions will create the environment variables: 69 + # opam_root, exe_ext, dkml_host_abi, abi_pattern (and many more) 70 + # 71 + - name: Setup DkML compilers on a Windows host 72 + if: startsWith(matrix.dkml_host_abi, 'windows_') 73 + uses: ./.ci/dkml-compilers/gh-windows/pre 74 + with: 75 + DKML_COMPILER: ${{ env.DKML_COMPILER }} 76 + CACHE_PREFIX: ${{ env.CACHE_PREFIX }} 77 + 78 + # This section is for your own build logic which you should place in 79 + # ci/build-test.sh or a similar file 80 + 81 + - name: Build and test on Windows host 82 + if: startsWith(matrix.dkml_host_abi, 'windows_') 83 + shell: msys2 {0} 84 + run: ci/build-test.sh 85 + 86 + - name: Build and test on non-Windows host 87 + if: "!startsWith(matrix.dkml_host_abi, 'windows_')" 88 + run: ci/build-test.sh 89 + 90 + # The .ci/dkml-compilers "post" actions will finalize caching, etc. 91 + 92 + - name: Teardown DkML compilers on a Windows host 93 + if: startsWith(matrix.dkml_host_abi, 'windows_') 94 + uses: ./.ci/dkml-compilers/gh-windows/post 95 + 96 + - name: Teardown DkML compilers on a Darwin host 97 + if: startsWith(matrix.dkml_host_abi, 'darwin_') 98 + uses: ./.ci/dkml-compilers/gh-darwin/post 99 + 100 + - name: Teardown DkML compilers on a Linux host 101 + if: startsWith(matrix.dkml_host_abi, 'linux_') 102 + uses: ./.ci/dkml-compilers/gh-linux/post
+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/
+84
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 + # Make your own build logic! 82 + opamrun install --yes --deps-only -t mirage-crypto mirage-crypto-rng mirage-crypto-rng-lwt mirage-crypto-rng-mirage mirage-crypto-pk mirage-crypto-ec 83 + opamrun exec -- dune build -p mirage-crypto,mirage-crypto-rng,mirage-crypto-rng-lwt,mirage-crypto-rng-mirage,mirage-crypto-pk,mirage-crypto-ec 84 + opamrun exec -- dune runtest -p mirage-crypto,mirage-crypto-rng,mirage-crypto-rng-lwt,mirage-crypto-rng-mirage,mirage-crypto-pk,mirage-crypto-ec