diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 00000000..d6f49421
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,8 @@
+version: 2
+updates:
+
+ # Maintain dependencies for GitHub Actions
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cbd09331..a15c44ab 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,10 +1,14 @@
-name: CI CD
+name: Old CI CD
on:
push:
branches:
- master
+ paths:
+ - 'old/**'
pull_request:
+ paths:
+ - 'old/**'
jobs:
Docker_Linux:
@@ -101,6 +105,7 @@ jobs:
with:
name: libraries-catalina-macos.tar.xz
path: ./old/libraries-catalina-macos.tar.xz
+
CreateRelease:
needs: [macOS, Docker_Linux]
runs-on: ubuntu-latest
diff --git a/.github/workflows/vcpkg_ci_linux.yml b/.github/workflows/vcpkg_ci_linux.yml
new file mode 100644
index 00000000..16a46830
--- /dev/null
+++ b/.github/workflows/vcpkg_ci_linux.yml
@@ -0,0 +1,233 @@
+name: Linux Continuous Integration
+
+env:
+ # "Source" is set in the vcpkg install step
+ VCPKG_BINARY_SOURCES: 'clear;nuget,Source,readwrite'
+ TRIPLET: 'x64-linux-rel'
+
+on:
+ release:
+ types:
+ - published
+ push:
+ paths-ignore:
+ - 'docker/**'
+ - '.github/workflows/vcpkg_docker.yml'
+ - '**.md'
+ - 'old/**'
+ tags-ignore:
+ - 'v*'
+ branches:
+ - '*'
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ matrix:
+ image:
+ - { name: 'ubuntu', tag: '18.04' }
+ - { name: 'ubuntu', tag: '20.04' }
+ llvm: [
+ 'llvm-9',
+ 'llvm-10',
+ 'llvm-11'
+ ]
+
+ runs-on: ubuntu-20.04
+ container:
+ image: ghcr.io/${{ github.repository_owner }}/vcpkg-builder-${{ matrix.image.name }}:${{ matrix.image.tag }}
+ credentials:
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.GITHUB_PACKAGE_REGISTRY_TOKEN }}
+
+ env:
+ ARTIFACT_NAME: vcpkg_${{ matrix.image.name }}-${{ matrix.image.tag }}_${{ matrix.llvm }}_amd64.tar.xz
+
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+
+ - name: Read vcpkg Info
+ id: vcpkg_info
+ shell: bash
+ run: |
+ { read -r vcpkg_repo_url && read -r vcpkg_commit; } <./vcpkg_info.txt || exit 1
+ echo ::set-output name=repo_url::${vcpkg_repo_url}
+ echo ::set-output name=commit::${vcpkg_commit}
+
+ # Needed for caching the actual vcpkg executable
+ - name: 'Restore from cache and install vcpkg'
+ uses: lukka/run-vcpkg@v6.0
+ with:
+ vcpkgGitURL: ${{ steps.vcpkg_info.outputs.repo_url }}
+ vcpkgGitCommitId: ${{ steps.vcpkg_info.outputs.commit }}
+ appendedCacheKey: '${{ matrix.image.name }}-${{ matrix.image.tag }}-${{ matrix.llvm }}'
+ setupOnly: true
+
+ # Omit this step if using manifests
+ - name: 'vcpkg install dependencies'
+ shell: 'bash'
+ run: |
+ # Setup NuGet authentication
+ mono "$(${VCPKG_ROOT}/vcpkg fetch nuget | tail -n 1)" sources add \
+ -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
+ -storepasswordincleartext \
+ -name "Source" \
+ -username "${{ github.repository_owner }}" \
+ -password "${{ secrets.GITHUB_TOKEN }}"
+
+ mono "$(${VCPKG_ROOT}/vcpkg fetch nuget | tail -n 1)" setapikey \
+ -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
+ "${{ secrets.GITHUB_TOKEN }}"
+
+ ${VCPKG_ROOT}/vcpkg install \
+ --triplet "${TRIPLET}" \
+ --clean-after-build \
+ --debug \
+ ${{ matrix.llvm }} \
+ @overlays.txt \
+ @dependencies.txt
+
+ - name: 'Export Packages'
+ if: contains(github.event.head_commit.message, 'debug artifacts') || github.event.release
+ shell: 'bash'
+ run: |
+ apt-get update
+ apt-get install -y pixz
+ ./emit_artifacts.sh ${{ env.ARTIFACT_NAME }}
+
+ - uses: actions/upload-artifact@v2.2.1
+ if: "contains(github.event.head_commit.message, 'debug artifacts')"
+ with:
+ name: ${{ env.ARTIFACT_NAME }}
+ path: ${{ env.ARTIFACT_NAME }}
+
+ # Only for LLVM-10 right now...
+ - name: 'Build Packaged Lifting Tools'
+ if: ${{ matrix.llvm == 'llvm-10' }}
+ shell: 'bash'
+ # NOTE: Cannot use --clean-after-build because of path issue finding semantics files
+ run: |
+ ${VCPKG_ROOT}/vcpkg install \
+ --triplet "${TRIPLET}" \
+ --debug \
+ @overlays.txt \
+ remill
+
+ - name: Prepare ccache
+ id: ccache_prep
+ shell: bash
+ run: |
+ echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV
+ echo "CCACHE_COMPILERCHECK=content" >> $GITHUB_ENV
+ echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV
+ echo "CMAKE_C_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV
+ echo "CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV
+ echo ::set-output name=timestamp::$(date +"%Y-%m-%d-%H:%M:%S" --utc)
+
+ - name: ccache cache files
+ uses: actions/cache@v2.1.3
+ with:
+ path: ${{ github.workspace }}/.ccache
+ key: ccache-${{ matrix.image.name }}-${{ matrix.image.tag }}-${{ matrix.llvm }}-${{ steps.ccache_prep.outputs.timestamp }}
+ restore-keys: |
+ ccache-${{ matrix.image.name }}-${{ matrix.image.tag }}-${{ matrix.llvm }}-
+
+ - name: ccache Initial stats
+ shell: bash
+ run: |
+ ccache --show-stats
+
+ - name: 'Test rellic build'
+ shell: 'bash'
+ run: |
+ cd rellic
+ mkdir build && cd build
+ cmake -G Ninja \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DVCPKG_ROOT="${VCPKG_ROOT}" \
+ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
+ ..
+ cmake --build .
+ cmake --build . --target install
+ ../scripts/roundtrip.py ./tools/rellic-decomp-* ../tests/tools/decomp "${VCPKG_ROOT}/installed/${TRIPLET}/bin/clang" || true
+
+ - name: 'Test remill build'
+ shell: 'bash'
+ run: |
+ cd remill
+ mkdir build && cd build
+ cmake -G Ninja \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DVCPKG_ROOT="${VCPKG_ROOT}" \
+ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
+ ..
+ cmake --build .
+ cmake --build . --target install
+ cmake --build . --target test_dependencies
+ env CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target test || true
+
+ # Only for LLVM-10 right now...
+ - name: 'Anvill build - vcpkg remill'
+ if: ${{ matrix.llvm == 'llvm-10' }}
+ shell: 'bash'
+ run: |
+ cd anvill
+ mkdir build-vcpkg && cd build-vcpkg
+ cmake -G Ninja \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DVCPKG_ROOT="${VCPKG_ROOT}" \
+ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
+ ..
+ cmake --build .
+ cmake --build . --target install
+ ./anvill-decompile-json-* -spec ../examples/ret0.json -bc_out ./ret0.bc -ir_out ret0.ir
+
+ - name: 'Anvill build - custom remill'
+ shell: 'bash'
+ run: |
+ cd anvill
+ mkdir build && cd build
+ cmake -G Ninja \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
+ -Dremill_DIR="$(pwd)/../../remill/build/install/lib/cmake/remill" \
+ ..
+ cmake --build .
+ cmake --build . --target install
+ ./anvill-decompile-json-* -spec ../examples/ret0.json -bc_out ./ret0.bc -ir_out ret0.ir
+
+ - name: 'Test mcsema build'
+ if: ${{ matrix.llvm != 'llvm-11' }}
+ shell: 'bash'
+ run: |
+ cd mcsema
+ mkdir build && cd build
+ cmake -G Ninja \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
+ -Dremill_DIR="$(pwd)/../../remill/build/install/lib/cmake/remill" \
+ -Danvill_DIR="$(pwd)/../../anvill/build/install/lib/cmake/anvill" \
+ ..
+ cmake --build .
+ cmake --build . --target install
+
+ - name: Publish Release Assets
+ if: |
+ github.event.release
+ uses: actions/upload-release-asset@v1.0.2
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ github.event.release.upload_url }}
+ asset_path: ${{ env.ARTIFACT_NAME }}
+ asset_name: ${{ env.ARTIFACT_NAME }}
+ asset_content_type: application/x-xz
+
+ - name: Cache cleanup and reporting
+ shell: 'bash'
+ run: |
+ rm -rf ${VCPKG_ROOT}/{buildtrees,installed,packages}
+ ccache --show-stats
diff --git a/.github/workflows/vcpkg_ci_mac.yml b/.github/workflows/vcpkg_ci_mac.yml
new file mode 100644
index 00000000..76224db3
--- /dev/null
+++ b/.github/workflows/vcpkg_ci_mac.yml
@@ -0,0 +1,239 @@
+name: MacOS Continuous Integration
+
+env:
+ # "Source" is set in the setup-dotnet action
+ VCPKG_BINARY_SOURCES: 'clear;nuget,Source,readwrite'
+ TRIPLET: 'x64-osx-rel'
+
+on:
+ release:
+ types:
+ - published
+ push:
+ paths-ignore:
+ - 'docker/**'
+ - '.github/workflows/vcpkg_docker.yml'
+ - '**.md'
+ - 'old/**'
+ tags-ignore:
+ - 'v*'
+ branches:
+ - "*"
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ matrix:
+ # Two latest released stable Xcode versions
+ os:
+ - { runner: 'macos-10.15', xcode: '12.1.0' }
+ - { runner: 'macos-11.0', xcode: '12.2.0' }
+ llvm: [
+ 'llvm-9',
+ 'llvm-10',
+ 'llvm-11'
+ ]
+
+ runs-on: ${{ matrix.os.runner }}
+
+ env:
+ ARTIFACT_NAME: vcpkg_${{ matrix.os.runner }}_${{ matrix.llvm }}_xcode-${{ matrix.os.xcode }}_amd64.tar.xz
+
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+
+ - uses: actions/setup-dotnet@v1.7.2
+ with:
+ dotnet-version: '3.1.x' # SDK Version to use.
+ # Sets as "Source"
+ source-url: https://nuget.pkg.github.com/ekilmer/index.json
+ env:
+ NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - uses: maxim-lobanov/setup-xcode@v1.2.1
+ # 'latest-stable' has some bugs... Keep explicit for now
+ with:
+ xcode-version: ${{ matrix.os.xcode }}
+
+ - name: Read vcpkg Info
+ id: vcpkg_info
+ shell: bash
+ run: |
+ { read -r vcpkg_repo_url && read -r vcpkg_commit; } <./vcpkg_info.txt || exit 1
+ echo ::set-output name=repo_url::${vcpkg_repo_url}
+ echo ::set-output name=commit::${vcpkg_commit}
+
+ # Needed for caching the actual vcpkg executable
+ - name: 'Restore from cache and install vcpkg'
+ uses: lukka/run-vcpkg@v6.0
+ with:
+ vcpkgGitURL: ${{ steps.vcpkg_info.outputs.repo_url }}
+ vcpkgGitCommitId: ${{ steps.vcpkg_info.outputs.commit }}
+ appendedCacheKey: '${{ matrix.os.runner }}-${{ matrix.os.xcode }}-${{ matrix.llvm }}'
+ setupOnly: true
+
+ # Omit this step if using manifests
+ - name: 'vcpkg install dependencies'
+ shell: 'bash'
+ run: |
+ # Setup NuGet authentication
+ mono "$(${VCPKG_ROOT}/vcpkg fetch nuget | tail -n 1)" setapikey \
+ -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \
+ "${{ secrets.GITHUB_TOKEN }}"
+
+ ${VCPKG_ROOT}/vcpkg install \
+ --triplet "${TRIPLET}" \
+ --clean-after-build \
+ --debug \
+ ${{ matrix.llvm }} \
+ @overlays.txt \
+ @dependencies.txt
+
+ - name: 'Export Packages'
+ if: contains(github.event.head_commit.message, 'debug artifacts') || github.event.release
+ shell: 'bash'
+ run: |
+ brew install pixz
+ ./emit_artifacts.sh ${{ env.ARTIFACT_NAME }}
+
+ - uses: actions/upload-artifact@v2.2.1
+ if: "contains(github.event.head_commit.message, 'debug artifacts')"
+ with:
+ name: ${{ env.ARTIFACT_NAME }}
+ path: ${{ env.ARTIFACT_NAME }}
+
+ # Only for LLVM-10 right now...
+ - name: 'Build Packaged Lifting Tools'
+ if: ${{ matrix.llvm == 'llvm-10' }}
+ shell: 'bash'
+ # NOTE: Cannot use --clean-after-build because of path issue finding semantics files
+ run: |
+ ${VCPKG_ROOT}/vcpkg install \
+ --triplet "${TRIPLET}" \
+ --debug \
+ @overlays.txt \
+ remill
+
+ - name: 'Install build dependencies'
+ shell: 'bash'
+ run: |
+ brew install ninja ccache
+
+ - name: Prepare ccache
+ id: ccache_prep
+ shell: bash
+ run: |
+ echo "CCACHE_COMPRESS=true" >> $GITHUB_ENV
+ echo "CCACHE_COMPILERCHECK=content" >> $GITHUB_ENV
+ echo "CCACHE_DIR=${{ github.workspace }}/.ccache" >> $GITHUB_ENV
+ echo "CMAKE_C_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV
+ echo "CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache)" >> $GITHUB_ENV
+ echo ::set-output name=timestamp::$(python -c 'from datetime import datetime; print(datetime.utcnow().strftime("%Y-%m-%d-%H:%M:%S"))')
+
+ - name: ccache cache files
+ uses: actions/cache@v2.1.3
+ with:
+ path: ${{ github.workspace }}/.ccache
+ key: ccache-${{ matrix.os.runner }}-${{ matrix.os.xcode }}-${{ matrix.llvm }}-${{ steps.ccache_prep.outputs.timestamp }}
+ restore-keys: |
+ ccache-${{ matrix.os.runner }}-${{ matrix.os.xcode }}-${{ matrix.llvm }}-
+
+ - name: ccache Initial stats
+ shell: bash
+ run: |
+ ccache --show-stats
+
+ - name: 'Test rellic build'
+ shell: 'bash'
+ run: |
+ cd rellic
+ mkdir build && cd build
+ cmake -G Ninja \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DVCPKG_ROOT="${VCPKG_ROOT}" \
+ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
+ ..
+ cmake --build .
+ cmake --build . --target install
+ ../scripts/roundtrip.py ./tools/rellic-decomp-* ../tests/tools/decomp "${VCPKG_ROOT}/installed/${TRIPLET}/bin/clang" || true
+
+ - name: 'Test remill build'
+ shell: 'bash'
+ run: |
+ cd remill
+ mkdir build && cd build
+ cmake -G Ninja \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DVCPKG_ROOT="${VCPKG_ROOT}" \
+ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
+ ..
+ cmake --build .
+ cmake --build . --target install
+ cmake --build . --target test_dependencies
+ env CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target test || true
+
+ # Only for LLVM-10 right now...
+ - name: 'Anvill build - vcpkg remill'
+ if: ${{ matrix.llvm == 'llvm-10' }}
+ shell: 'bash'
+ run: |
+ cd anvill
+ mkdir build-vcpkg && cd build-vcpkg
+ cmake -G Ninja \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DVCPKG_ROOT="${VCPKG_ROOT}" \
+ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
+ ..
+ cmake --build .
+ cmake --build . --target install
+ ./anvill-decompile-json-* -spec ../examples/ret0.json -bc_out ./ret0.bc -ir_out ret0.ir
+
+ - name: 'Anvill build - custom remill'
+ shell: 'bash'
+ run: |
+ cd anvill
+ mkdir build && cd build
+ cmake -G Ninja \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
+ -Dremill_DIR="$(pwd)/../../remill/build/install/lib/cmake/remill" \
+ ..
+ cmake --build .
+ cmake --build . --target install
+ ./anvill-decompile-json-* -spec ../examples/ret0.json -bc_out ./ret0.bc -ir_out ret0.ir
+
+ - name: 'Test mcsema build'
+ if: ${{ matrix.llvm != 'llvm-11' }}
+ shell: 'bash'
+ run: |
+ cd mcsema
+ mkdir build && cd build
+ cmake -G Ninja \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
+ -Dremill_DIR="$(pwd)/../../remill/build/install/lib/cmake/remill" \
+ -Danvill_DIR="$(pwd)/../../anvill/build/install/lib/cmake/anvill" \
+ ..
+ cmake --build .
+ cmake --build . --target install
+
+ - name: Publish Release Assets
+ if: |
+ github.event.release
+ uses: actions/upload-release-asset@v1.0.2
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ github.event.release.upload_url }}
+ asset_path: ${{ env.ARTIFACT_NAME }}
+ asset_name: ${{ env.ARTIFACT_NAME }}
+ asset_content_type: application/x-xz
+
+ - name: Cache cleanup and reporting
+ shell: 'bash'
+ run: |
+ rm -rf ${VCPKG_ROOT}/{buildtrees,installed,packages}
+ ccache --show-stats
diff --git a/.github/workflows/vcpkg_docker.yml b/.github/workflows/vcpkg_docker.yml
new file mode 100644
index 00000000..d42fcf7f
--- /dev/null
+++ b/.github/workflows/vcpkg_docker.yml
@@ -0,0 +1,46 @@
+name: Docker Build Images
+
+on:
+ schedule:
+ # Once every Wednesday at 00:00
+ - cron: '0 0 * * 3'
+ push:
+ # branches:
+ # - master
+ paths:
+ - 'docker/**'
+
+jobs:
+ build:
+ strategy:
+ fail-fast: false
+ matrix:
+ container:
+ - { distro: 'ubuntu', version: '18.04' }
+ - { distro: 'ubuntu', version: '20.04' }
+
+ runs-on: ubuntu-20.04
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v1.0.3
+
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: ${{ github.repository_owner }}
+ password: ${{ secrets.GITHUB_PACKAGE_REGISTRY_TOKEN }}
+
+ - name: Build and push
+ id: docker_build
+ uses: docker/build-push-action@v2.2.1
+ with:
+ file: ./docker/Dockerfile.${{ matrix.container.distro }}.vcpkg
+ target: caching
+ context: ./docker
+ push: true
+ tags: ghcr.io/${{ github.repository_owner }}/vcpkg-builder-${{ matrix.container.distro }}:${{ matrix.container.version }}
+ build-args: DISTRO_VERSION=${{ matrix.container.version }}
diff --git a/.github/workflows/vcpkg_release.yml b/.github/workflows/vcpkg_release.yml
new file mode 100644
index 00000000..63b5886b
--- /dev/null
+++ b/.github/workflows/vcpkg_release.yml
@@ -0,0 +1,26 @@
+#on:
+# push:
+# tags:
+# - 'v*'
+#
+#name: release
+#
+#jobs:
+# release:
+# name: Publish Release on GitHub
+# runs-on: ubuntu-20.04
+# steps:
+# - uses: actions/checkout@v2
+# - name: Create Release
+# id: create_release
+# uses: actions/create-release@v1.1.4
+# env:
+# # NOTE: GitHub actions doesn't allow workflows to trigger other
+# # workflows by default. The workaround is to use a PAT with
+# # repo/public_repo scope instead of the default GITHUB_TOKEN.
+# GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
+# with:
+# tag_name: ${{ github.ref }}
+# release_name: ${{ github.ref }}
+# draft: false
+# prerelease: ${{ contains(github.ref, 'pre') || contains(github.ref, 'rc') }}
diff --git a/.gitignore b/.gitignore
index 3648a9c5..6f353caa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+/vcpkg
+
/old/build
/old/repository
/old/sources
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 00000000..f5c2661a
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,16 @@
+[submodule "mcsema"]
+ path = mcsema
+ url = https://github.com/ekilmer/mcsema.git
+ branch = vcpkg
+[submodule "remill"]
+ path = remill
+ url = https://github.com/ekilmer/remill.git
+ branch = vcpkg
+[submodule "anvill"]
+ path = anvill
+ url = https://github.com/ekilmer/anvill.git
+ branch = vcpkg
+[submodule "rellic"]
+ path = rellic
+ url = https://github.com/ekilmer/rellic.git
+ branch = vcpkg
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..8dada3ed
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/NUPKG.outdated.md b/NUPKG.outdated.md
new file mode 100644
index 00000000..0adaa301
--- /dev/null
+++ b/NUPKG.outdated.md
@@ -0,0 +1,248 @@
+# WARNING OLD and UNTESTED
+
+Proceed with caution as this likely won't work exactly anymore.
+
+# Dependency Management for Lifting-Bits
+
+This repo contains scripts and custom packaging definitions for dependencies used by the `lifting-bits` organization.
+
+The aim is to make dependency management easier and more reproducible by using [vcpkg](https://github.com/microsoft/vcpkg) to build and find the required libraries.
+
+Currently, we try to support pre-built `Release` build-type libraries for OSX and Linux Ubuntu 18.04 and 20.04.
+
+# Table of Contents
+
+* [How to use](#how-to-use)
+ * [Required system dependencies](#required-system-dependencies)
+ * [Bootstrap and pull pre\-built dependencies natively](#bootstrap-and-pull-pre-built-dependencies-natively)
+ * [Example: Building remill](#example-building-remill)
+ * [Download pre\-built dependency bundle](#download-pre-built-dependency-bundle)
+ * [Example: Building remill](#example-building-remill-1)
+ * [Building it ALL from source](#building-it-all-from-source)
+ * [Using Docker Image](#using-docker-image)
+* [Common Issues](#common-issues)
+ * [Packages aren't being found in NuGet](#packages-arent-being-found-in-nuget)
+
+# How to use
+
+If you want to download pre-built dependencies, you'll need to generate a [GitHub Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token). The permissions only require `read:packages` to download. Note the generated token, as you'll be using it where you see `GITHUB_TOKEN`.
+
+## Required system dependencies
+
+[Mono](https://www.mono-project.com/) is required for fetching pre-built packages from NuGet.
+
+Linux (Ubuntu):
+
+* `clang-10` is used as the compiler in CI and should be used when building locally if you want to pull down binaries from GitHub that match exactly to your OS/Compiler.
+
+```bash
+sudo apt-get update && sudo apt-get install --yes clang-10 lld-10
+export CC=clang-10 && export CXX=clang++-10
+```
+
+OSX:
+
+* We use the latest available (by Software Update) XCode clang compiler, which is automatically picked up by vcpkg during the build, so as long as you haven't manually overridden the default C and C++ compiler, you should be able to use the libraries built by CI.
+
+## Bootstrap and pull pre-built dependencies natively
+
+If on Ubuntu 18.04 or 20.04, remember to `export CC=clang-10 && export CXX=clang++-10`.
+
+WARNING: This will write your Github token in plain text to `~/.config/NuGet/NuGet.config`.
+
+```bash
+./pull_dependencies.sh ${GITHUB_USERNAME} ${GITHUB_TOKEN}
+```
+
+If all goes well, and you are running an updated version of Mac OSX 10.15 with default Apple Compiler, and Ubuntu 18.04 or Ubuntu 20.04 with `clang-10` set as `CC` and `CXX`, then you should see that NuGet will find matching, compatible packages to download instead of building everything from source:
+
+**Note:** pre-built libraries are only found while using the `x64-{osx,linux}-rel` vcpkg [triplet](https://vcpkg.readthedocs.io/en/latest/users/triplets/) because `Debug` builds of LLVM are too demanding of the freely available CI runners. See the next section for building all dependencies (both `Release` and `Debug` types) from source.
+
+Sample good output for finding and using pre-built libraries:
+
+```log
+[DEBUG] system(/usr/bin/mono /workspace/vcpkg/downloads/tools/nuget-5.5.1-linux/nuget.exe install /workspace/vcpkg/buildtrees/packages.config -OutputDirectory /workspace/vcpkg/packages -Source Source -ExcludeVersion -NoCache -PreRelease -DirectDownload -PackageSaveMode nupkg -Verbosity detailed -ForceEnglishOutput -NonInteractive)
+NuGet Version: 5.5.1.6542
+Feeds used:
+ https://nuget.pkg.github.com/ekilmer/index.json
+
+Restoring NuGet package gflags_x64-linux-rel.2.2.2-0669208ed4e52ac76dcab743cc8159122e35a179.
+ GET https://nuget.pkg.github.com/ekilmer/download/gflags_x64-linux-rel/2.2.2-0669208ed4e52ac76dcab743cc8159122e35a179/gflags_x64-linux-rel.2.2.2-0669208ed4e52ac76dcab743cc8159122e35a179.nupkg
+ OK https://nuget.pkg.github.com/ekilmer/download/gflags_x64-linux-rel/2.2.2-0669208ed4e52ac76dcab743cc8159122e35a179/gflags_x64-linux-rel.2.2.2-0669208ed4e52ac76dcab743cc8159122e35a179.nupkg 492ms
+```
+
+### Example: Building remill
+
+:exclamation: **Still in the root of this repo:** :exclamation:
+
+```bash
+git clone --branch vcpkg https://github.com/ekilmer/remill.git
+cd remill
+mkdir build && cd build
+cmake -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DVCPKG_TARGET_TRIPLET=x64-linux-rel \
+ -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../../vcpkg/scripts/buildsystems/vcpkg.cmake" \
+ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
+ -G Ninja \
+ ..
+cmake --build .
+cmake --build . --target install
+cmake --build . --target test_dependencies
+env CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target test
+```
+
+These commands should be repeated in a similar manner for any other lifting-bits repositories.
+
+Change the `-DVCPKG_TARGET_TRIPLET=x64-linux-rel` to `x64-osx-rel` if on MacOS.
+
+**NOTE:** If you don't want to build the tools within this repo, you will need to modify the following line:
+
+```text
+-DCMAKE_TOOLCHAIN_FILE="PATH_TO_THIS_REPO/vcpkg/scripts/buildsystems/vcpkg.cmake"
+```
+
+## Download pre-built dependency bundle
+
+If you are having trouble getting NuGet to find the correct packages automatically, you may also try to download a zipped archive of the dependencies.
+
+Check out the release artifacts or CI run artifacts for your OS and download the zip corresponding to the LLVM version you'd like. You will need 7zip to extract the contents.
+
+:exclamation: **NOTE:** :exclamation: If you are not using Ubuntu, you can still try to download the artifacts and experiment with whether they work. There are no guarantees that they will work or be stable (even if tests pass). The only way to ensure the best stability is by compiling everything yourself.
+
+### Example: Building remill
+
+Anywhere on your computer:
+
+```bash
+git clone --branch vcpkg https://github.com/ekilmer/remill.git
+cd remill
+mv ~/Downloads/vcpkg_ubuntu-18.04_llvm.7z .
+7z x vcpkg_ubuntu-18.04_llvm.7z
+mkdir build && cd build
+cmake -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DVCPKG_TARGET_TRIPLET=x64-linux-rel \
+ -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../vcpkg_ubuntu-18.04_llvm/scripts/buildsystems/vcpkg.cmake" \
+ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" \
+ -G Ninja \
+ ..
+cmake --build .
+cmake --build . --target install
+cmake --build . --target test_dependencies
+env CTEST_OUTPUT_ON_FAILURE=1 cmake --build . --target test
+```
+
+There is always a chance that some incompatibility with the pre-built libraries has crept in, so please post your errors along with all of your build steps and their outputs.
+
+Or, build everything yourself.
+
+## Building it ALL from source
+
+This is required for Linux distributions other than Ubuntu 18.04, 20.04, and MacOS; _or_ if you don't want to use the `clang-10` compiler to compile the dependencies on Linux.
+
+The build types produced by vcpkg are controlled through triplet files. The `x64-{linux,os}-rel` triplet stands for `64-bit`, `linux` or `mac` system, `Release` build type.
+
+By default, vcpkg will choose a triplet based on your system, however this builds both `Release` and `Debug` builds of all dependencies, including LLVM. Our `x64-{linux-osx}-rel` triplet is not chosen by default, and it is in fact a custom (["overlay"](https://vcpkg.readthedocs.io/en/latest/examples/overlay-triplets-linux-dynamic/)) triplet that is in the `triplets` directory of this repo, therefore, we must specify it manually whenever we use vcpkg.
+
+Interestingly, triplets of different names (and configurations) can exist next to each other! However, if not using the default, you must specify which triplet (_universe_) of dependencies you want to build/link against.
+
+To build everything from source, including both `Release` and `Debug` build types, we can simply run the following (after checkout out the correct version of vcpkg), which should work on any vcpkg-supported OS:
+
+```bash
+$ ./vcpkg/bootstrap.sh
+$ ./vcpkg/vcpkg install \
+ --debug \
+ llvm-10 \
+ @dependencies.txt
+```
+
+Where `@dependencies.txt` is a file that contains pre-populated, unchanging options and packages required to build the lifting tools. Feel free to inspect that file to get a better idea of what is happening.
+
+If you don't want to use the default triplet, specify it with `--triplet my-triplet`.
+
+Then, follow the same exact steps in [building remill](#example-building-remill) when pulling the pre-built dependencies.
+
+## Using Docker Image
+
+If you want to test in a Docker image, run the following to pull dependencies from GitHub NuGet:
+
+```bash
+cd docker
+docker build -t vcpkg-base -f Dockerfile.vcpkg .
+cd ..
+docker run --rm -t -i -v "$(pwd):/workspace" \
+ -u $(id -u ${USER}):$(id -g ${USER}) \
+ vcpkg-base ./pull_dependencies.sh ${GITHUB_USERNAME} ${GITHUB_TOKEN}
+```
+
+Note that you should rebuild a fresh Docker image frequently to make sure you obtain the latest versions of the supported system dependencies to better match what is being run in CI.
+
+You could also use the built Docker image and follow any of the other steps to download the built dependency bundle or build everything from source.
+
+# Common Issues
+
+If reading through this doesn't help solve your problem, please open an issue.
+
+## Packages aren't being found in NuGet
+
+Barring any authentication issues, a message like the following means that there is a hash mismatch between CI and your machine:
+
+```log
+NuGet Version: 5.5.1.6542
+Feeds used:
+ https://nuget.pkg.github.com/ekilmer/index.json
+
+Restoring NuGet package gflags_x64-osx-rel.2.2.2-53884e51813100affbbcfbb754b564c1d9b9ddff.
+ GET https://nuget.pkg.github.com/ekilmer/download/gflags_x64-osx-rel/2.2.2-53884e51813100affbbcfbb754b564c1d9b9ddff/gflags_x64-osx-rel.2.2.2-53884e51813100affbbcfbb754b564c1d9b9ddff.nupkg
+ NotFound https://nuget.pkg.github.com/ekilmer/download/gflags_x64-osx-rel/2.2.2-53884e51813100affbbcfbb754b564c1d9b9ddff/gflags_x64-osx-rel.2.2.2-53884e51813100affbbcfbb754b564c1d9b9ddff.nupkg 173ms
+WARNING: Unable to find version '2.2.2-53884e51813100affbbcfbb754b564c1d9b9ddff' of package 'gflags_x64-osx-rel'.
+ https://nuget.pkg.github.com/ekilmer/index.json: Package 'gflags_x64-osx-rel.2.2.2-53884e51813100affbbcfbb754b564c1d9b9ddff' is not found on source 'https://nuget.pkg.github.com/ekilmer/index.json'.
+```
+
+This could be due to a multitude of things, but you should make sure that you are on the same `vcpkg` commit SHA as CI, this repo is updated, and that you are running the most up-to-date build tools.
+
+Digging through the debug output of `vcpkg` and comparing it a CI run will also help to determine the source of difference. Take a look at this section:
+
+```log
+[DEBUG] -- Build files have been written to: /Users/ekilmer/src/vcpkg-lifting-ports/vcpkg/buildtrees/detect_compiler/x64-osx-rel-rel
+[DEBUG]
+[DEBUG] #COMPILER_HASH#40c9eb093940d44cb6e6c8c0a7250ac20ec886ff
+[DEBUG] #COMPILER_C_HASH#a1db5d1638032ae8a49d431642a4ca746775e749
+[DEBUG] #COMPILER_C_VERSION#12.0.0.12000032
+[DEBUG] #COMPILER_C_ID#AppleClang
+[DEBUG] #COMPILER_CXX_HASH#a1db5d1638032ae8a49d431642a4ca746775e749
+[DEBUG] #COMPILER_CXX_VERSION#12.0.0.12000032
+[DEBUG] #COMPILER_CXX_ID#AppleClang
+[DEBUG] CMake Warning:
+[DEBUG] Manually-specified variables were not used by the project:
+[DEBUG]
+[DEBUG] BUILD_SHARED_LIBS
+[DEBUG] CMAKE_INSTALL_BINDIR
+[DEBUG] CMAKE_INSTALL_LIBDIR
+[DEBUG] VCPKG_CRT_LINKAGE
+[DEBUG] VCPKG_PLATFORM_TOOLSET
+[DEBUG] VCPKG_SET_CHARSET_FLAG
+```
+
+or at a particular package that will list everything that is being hashed:
+
+```log
+[DEBUG] Detecting compiler hash for triplet x64-osx-rel: 40c9eb093940d44cb6e6c8c0a7250ac20ec886ff
+[DEBUG]
+[DEBUG] 0001-patch-dir.patch|3c679554b70cba5a5dee554a4f02cfe2bbdf5ea5
+[DEBUG] CONTROL|4466385d3bffb1cbc43efe55180e9151a12d7116
+[DEBUG] cmake|3.18.4
+[DEBUG] features|core
+[DEBUG] fix_cmake_config.patch|6c3f00dcb6091bd3ab95ca452e2f685a4dd75dce
+[DEBUG] portfile.cmake|4b0207c608f1a09352c16fa7c970f12fec1927e1
+[DEBUG] post_build_checks|2
+[DEBUG] triplet|f57366c9c4a491b55f09403f44ae663a8935f5f9-94be8c046f9e0595c199a36690d288f70945643b-40c9eb093940d44cb6e6c8c0a7250ac20ec886ff
+[DEBUG] vcpkg_configure_cmake|ae0a97eff7f218b68bc4ab1b4bd661107893803e
+[DEBUG] vcpkg_copy_pdbs|dbca2886a2490c948893c8250a2b40a3006cf7a9
+[DEBUG] vcpkg_fixup_cmake_targets|799f0da59bbd2e387502be06a30e3d43f2e89b49
+[DEBUG] vcpkg_from_git|f29cbe08f369138581e36c864f9d08465c840e23
+[DEBUG] vcpkg_from_github|70d537ee6afbd1e8d40cc7d4e27a263ea5a81213
+[DEBUG] vcpkg_install_cmake|75d1079d6f563d87d08c8c5f63b359377aa19a6e
+[DEBUG]
+```
+
+In the end, if you still can't get NuGet to work, try [downloading pre-built dependency bundle](#download-pre-built-dependency-bundle) or [building everything yourself](#building-it-all-from-source).
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..703afa7d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,79 @@
+# VCPKG Ports Registry for common C/C++ packages
+
+Curated dependencies that are compatible with the [lifting-bits](https://github.com/lifting-bits) tools.
+
+# Pre-built
+
+Every [release](https://github.com/trailofbits/cxx-common/releases), we publish compressed archives of the pre-built dependencies built by [vcpkg](https://github.com/microsoft/vcpkg).
+
+We only officially support and test the libraries built for the OSes that appear in CI, which includes Ubuntu 18.04, 20.04, and Mac OS 10.15, 11.0.
+
+To use the dependencies, just download the compressed file and decompress it. The resulting directory _does not require_ installation of anything other than a recent version of CMake to use with a project.
+
+Many of the lifting-bits tools have support for using the vcpkg binaries written into their `CMakeLists.txt` files and will tell you how to pass the path.
+
+For example:
+
+```bash
+curl -LO https://github.com/trailofbits/cxx-common/releases/latest/download/vcpkg_ubuntu-20.04_llvm-10_amd64.tar.xz
+tar -xJf vcpkg_ubuntu-20.04_llvm-10_amd64.tar.xz
+```
+
+Will produce a directory, and then you'll have to set the following during your CMake configure command to use these dependencies!
+
+```text
+-DCMAKE_TOOLCHAIN_FILE="/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-linux-rel
+```
+
+or (if supported by the project's `CMakeLists.txt`)
+
+```text
+-DVCPKG_ROOT=""
+```
+
+# Building from source
+
+If you aren't running a supported operating system, or you just want to build it for fun, you can build everything from source using the `./build_dependencies.sh` script.
+
+By default, the script will install the dependencies listed in `dependencies.txt`, which doesn't include an LLVM version, so passing an `llvm-10` string as an argument will actually be passed to `vcpkg install`. Any other strings are also passed to the `vcpkg install` command.
+
+## Debug and Release
+
+To build both debug and release versions with llvm-10, just run the following
+
+```bash
+./build_dependencies.sh llvm-10
+```
+
+The script will be verbose about what it is doing and will clone the correct version of vcpkg (found in `vcpkg_info.txt`) and build everything in the `vcpkg` directory in the root of this repo.
+
+At the end it will print how to use the library.
+
+
+## Just release builds
+
+If you don't want to compile a debug version of the tools, just pass `--release` to the script.
+
+```bash
+./build_dependencies.sh --release llvm-10
+```
+
+## Additional Packages
+
+Just add another package name to the script
+```bash
+./build_dependencies.sh --release llvm-10 fmt
+```
+or add it to `dependencies.txt`.
+
+# Dependency Versioning
+
+The version of each dependency is influenced by the git checkout of vcpkg, contained in `vcpkg_info.txt`. Currently, the only way to upgrade is to push the commit in that file up, **_or_** to create (likely copy) a port definition for the required version and place it in our local `ports` ([overlay](https://github.com/microsoft/vcpkg/blob/master/docs/specifications/ports-overlay.md)) directory.
+
+See [here](https://github.com/microsoft/vcpkg/blob/master/docs/examples/packaging-github-repos.md) for how to package a new library.
+
+# LICENSING
+
+This repo is under the Apache-2.0 LICENSE, unless where specified. See below.
+
+The LLVM version port directories (ports/llvm-{9,10,11}) were initially copied from the upstream [vcpkg](https://github.com/microsoft/vcpkg) repo as a starting point. Eventually, we plan to submit the relevant patches for upstream when we have thoroughly tested these changes. More info can be found in the respective `LICENSE` and `NOTICE` files in those directories.
diff --git a/anvill b/anvill
new file mode 160000
index 00000000..8b1aaa13
--- /dev/null
+++ b/anvill
@@ -0,0 +1 @@
+Subproject commit 8b1aaa131b075ab81c76d4cf91a275834016d5c4
diff --git a/build_dependencies.sh b/build_dependencies.sh
new file mode 100755
index 00000000..11b16baa
--- /dev/null
+++ b/build_dependencies.sh
@@ -0,0 +1,89 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# Usage: ./build_dependencies.sh [--release] [...]
+# --release Optional, build only release versions with triplet as detected in this script
+# [...] Optional, extra args to pass to 'vcpkg install'. Like LLVM version, other ports, etc.
+
+function msg {
+ echo "[+]" "$@"
+}
+
+function die {
+ echo "[!]" "$@"
+ exit 1
+}
+
+msg "Building dependencies from source"
+
+triplet=""
+extra_vcpkg_args=()
+extra_cmake_usage_args=()
+
+if [ $# -ge 1 ] && [ "$1" = "--release" ]; then
+ msg "Only building release versions"
+
+ uname="$(uname -s)"
+ if [ "${uname}" = "Linux" ]; then
+ msg "Detected Linux OS"
+ triplet="x64-linux-rel"
+ elif [ "${uname}" = "Darwin" ]; then
+ msg "Detected Darwin OS"
+ triplet="x64-osx-rel"
+ else
+ die "Could not detect OS. OS detection required for release-only builds."
+ fi
+ extra_vcpkg_args+=("--triplet=${triplet}")
+ extra_cmake_usage_args+=("-DVCPKG_TARGET_TRIPLET=${triplet}")
+ shift
+else
+ msg "Building Release and Debug versions"
+fi
+
+repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+vcpkg_info_file="${repo_dir}/vcpkg_info.txt"
+
+# Read vcpkg cloning info
+{ read -r vcpkg_repo_url && read -r vcpkg_commit; } <"${vcpkg_info_file}" || die "line ${LINENO}: Could not parse vcpkg info file '${vcpkg_info_file}'"
+
+msg "Using vcpkg repo URL '${vcpkg_repo_url}'"
+msg "Using vcpkg commit '${vcpkg_commit}'"
+
+vcpkg_dir="${repo_dir:?}/vcpkg"
+
+if [ ! -d "${vcpkg_dir}" ]; then
+ msg "Cloning to '${vcpkg_dir}'"
+ git clone https://github.com/microsoft/vcpkg.git "${vcpkg_dir}"
+fi
+
+(
+ cd "${vcpkg_dir}" && git remote set-url origin "${vcpkg_repo_url}" && git fetch origin && git checkout "${vcpkg_commit}"
+)
+
+msg "Boostrapping vcpkg"
+(
+ set -x
+ "${vcpkg_dir}/bootstrap-vcpkg.sh"
+)
+
+msg "Building dependencies"
+msg "Passing extra args to 'vcpkg install':"
+msg " " "$@"
+(
+ cd "${repo_dir}"
+ (
+ set -x
+ # TODO: Better way to remove all unspecified packages that we're about to
+ # install for specified triplet? Need this because different LLVM versions
+ # conflict when installed at the same time
+ rm -rf "${vcpkg_dir:?}/installed" || true
+ "${vcpkg_dir}/vcpkg" install "${extra_vcpkg_args[@]}" '@overlays.txt' '@dependencies.txt' "$@"
+ "${vcpkg_dir}/vcpkg" upgrade "${extra_vcpkg_args[@]}" '@overlays.txt' --no-dry-run
+ )
+)
+
+echo ""
+msg "Set the following in your CMake configure command to use these dependencies!"
+msg " -DVCPKG_ROOT=\"${vcpkg_dir}\" ${extra_cmake_usage_args[*]}"
+msg "or"
+msg " -DCMAKE_TOOLCHAIN_FILE=\"${vcpkg_dir}/scripts/buildsystems/vcpkg.cmake\" ${extra_cmake_usage_args[*]}"
diff --git a/dependencies.txt b/dependencies.txt
new file mode 100644
index 00000000..ea34f135
--- /dev/null
+++ b/dependencies.txt
@@ -0,0 +1,6 @@
+xed
+z3
+glog
+gtest
+gflags
+protobuf
diff --git a/docker/.dockerignore b/docker/.dockerignore
new file mode 100644
index 00000000..72e8ffc0
--- /dev/null
+++ b/docker/.dockerignore
@@ -0,0 +1 @@
+*
diff --git a/docker/Dockerfile.ubuntu.vcpkg b/docker/Dockerfile.ubuntu.vcpkg
new file mode 100644
index 00000000..8be46e85
--- /dev/null
+++ b/docker/Dockerfile.ubuntu.vcpkg
@@ -0,0 +1,60 @@
+ARG DISTRO_VERSION=20.04
+
+ARG BUILD_BASE=ubuntu:${DISTRO_VERSION}
+FROM ${BUILD_BASE} as base
+ARG DISTRO_VERSION
+
+# All build dependencies for vcpkg packages
+# First row is build dependencies for lifting tools
+# Second row is toolchain and build programs
+# Third row is vcpkg library build-time dependencies
+RUN export DEBIAN_FRONTEND=noninteractive && \
+ apt-get update && \
+ apt-get install --yes --no-install-recommends apt-transport-https software-properties-common gnupg ca-certificates wget && \
+ apt-add-repository ppa:git-core/ppa --yes && \
+ wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
+ \
+ if [ ${DISTRO_VERSION} = "20.04" ] ; then \
+ apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main' ; \
+ elif [ ${DISTRO_VERSION} = "18.04" ] ; then \
+ apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' ; \
+ fi && \
+ \
+ apt-get update && \
+ apt-get dist-upgrade --yes --no-install-recommends \
+ g++-multilib libtinfo-dev libzstd-dev python3.8 python3-pip python3-setuptools python-setuptools \
+ clang-10 lld-10 cmake ninja-build \
+ curl unzip tar git zip python python3 pkg-config && \
+ apt-get clean --yes && \
+ rm -rf /var/lib/apt/lists/* && \
+ \
+ curl -s https://api.github.com/repos/ccache/ccache/releases/latest | grep tarball_url | cut -d '"' -f 4 | wget -i- -O - | tar -xz && \
+ cd ccache-ccache-* && \
+ cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release && \
+ cmake --build build --target install && \
+ cd .. && rm -rf ccache-ccache-*
+
+ENV CC=/usr/bin/clang-10 \
+ CXX=/usr/bin/clang++-10
+
+
+# Much heavier installation due to mono dependency for NuGet
+FROM base as caching
+ARG DISTRO_VERSION
+RUN export DEBIAN_FRONTEND=noninteractive && \
+ apt-get update && \
+ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
+ \
+ if [ ${DISTRO_VERSION} = "20.04" ] ; then \
+ echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list ; \
+ elif [ ${DISTRO_VERSION} = "18.04" ] ; then \
+ echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official-stable.list ; \
+ fi && \
+ \
+ apt-get update && \
+ apt-get install --yes mono-devel && \
+ apt-get clean --yes && \
+ rm -rf /var/lib/apt/lists/*
+
+# Only build base by default
+FROM base
diff --git a/docker/build.sh b/docker/build.sh
new file mode 100755
index 00000000..37745986
--- /dev/null
+++ b/docker/build.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+# Builds base images with all required dependencies to bootstrap vcpkg and
+# build vcpkg libraries as well as all lifting-bits tools
+
+# Ubuntu versions to build
+UBUNTU_VERSION_MATRIX=( "18.04" "20.04" )
+
+for version in "${UBUNTU_VERSION_MATRIX[@]}"; do
+ # Always pull from upstream
+ docker pull "ubuntu:${version}"
+
+ # Image identification
+ tag="vcpkg-builder-ubuntu:${version}"
+
+ # Build
+ docker build \
+ -f Dockerfile.ubuntu.vcpkg \
+ --no-cache \
+ --build-arg "DISTRO_VERSION=${version}" \
+ -t "${tag}" \
+ .
+done
diff --git a/emit_artifacts.sh b/emit_artifacts.sh
new file mode 100755
index 00000000..7df65c4c
--- /dev/null
+++ b/emit_artifacts.sh
@@ -0,0 +1,66 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# Compression tool to use
+compressor="pixz"
+
+# Extension for compressed file generated by this script
+output_extension=".tar.xz"
+
+# NOTE: vcpkg saves the raw directory layout into a directory of the same name
+# as passed as argument without the output extension
+if [[ $1 != *"${output_extension}" ]]; then
+ echo "Must provide output filename ending with '${output_extension}'"
+ exit 1
+fi
+export_dir="${1%%${output_extension}*}"
+echo "Exporting to directory: ${export_dir}"
+
+# check for pixz for parallel xz
+if ! command -v "${compressor}" &>/dev/null; then
+ echo "Could not find recommended compression tool '${compressor}'"
+ echo "Please install and place on PATH."
+ exit
+fi
+
+echo "Using compression tool '${compressor}'"
+echo ""
+
+# Check for vcpkg directory
+vcpkg_root="${PWD}/vcpkg"
+if [ ! -d "${vcpkg_root}" ]; then
+ echo "Could not find 'vcpkg' directory at '${PWD}'"
+ exit
+fi
+
+vcpkg_exe="${vcpkg_root}/vcpkg"
+if [ ! -f "${vcpkg_exe}" ]; then
+ echo "Could not find 'vcpkg' executable at '${vcpkg_root}'"
+ exit
+fi
+
+echo "Exporting all vcpkg packages"
+# TODO: Say something about the overlay directories
+# NOTE: Always saves the export output in vcpkg root
+start_time="$(date +%s)"
+(
+ set -x
+ "${vcpkg_exe}" export --x-all-installed --overlay-ports=./ports --overlay-triplets=./triplets --raw "--output=${export_dir}"
+)
+echo Duration: "$(($(date +%s) - start_time))s"
+echo ""
+
+echo "Compressing vcpkg packages with '${compressor}' to: ${1}"
+start_time="$(date +%s)"
+(
+ set -x
+ tar --use-compress-program "${compressor}" -cf "${1}" -C "${vcpkg_root}" "${export_dir}"
+)
+echo Duration: "$(($(date +%s) - start_time))s"
+echo ""
+
+echo "Cleaning up export directory"
+(
+ set -x
+ rm -r "${vcpkg_root:?}/${export_dir}"
+)
diff --git a/mcsema b/mcsema
new file mode 160000
index 00000000..f09a493a
--- /dev/null
+++ b/mcsema
@@ -0,0 +1 @@
+Subproject commit f09a493a7e377ffadd481bde08a9b98bc8b810e2
diff --git a/overlays.txt b/overlays.txt
new file mode 100644
index 00000000..20701e60
--- /dev/null
+++ b/overlays.txt
@@ -0,0 +1,2 @@
+--overlay-ports=./ports
+--overlay-triplets=./triplets
diff --git a/ports/llvm-10/0001-allow-to-use-commas.patch b/ports/llvm-10/0001-allow-to-use-commas.patch
new file mode 100644
index 00000000..8276efa5
--- /dev/null
+++ b/ports/llvm-10/0001-allow-to-use-commas.patch
@@ -0,0 +1,30 @@
+diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
+index a02c2a5a23f..bdbf0b1303c 100644
+--- a/llvm/CMakeLists.txt
++++ b/llvm/CMakeLists.txt
+@@ -70,6 +70,12 @@ if( LLVM_ENABLE_PROJECTS STREQUAL "all" )
+ set( LLVM_ENABLE_PROJECTS ${LLVM_ALL_PROJECTS})
+ endif()
+
++# Allow to use commas in LLVM_ENABLE_PROJECTS ("llvm,clang,...")
++string(REPLACE "," ";" fixed_LLVM_ENABLE_PROJECTS "${LLVM_ENABLE_PROJECTS}")
++if(NOT fixed_LLVM_ENABLE_PROJECTS STREQUAL LLVM_ENABLE_PROJECTS)
++ set(LLVM_ENABLE_PROJECTS "${fixed_LLVM_ENABLE_PROJECTS}" CACHE STRING "" FORCE)
++endif()
++
+ # LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the
+ # `LLVM_ENABLE_PROJECTS` CMake cache variable. This exists for
+ # several reasons:
+@@ -383,6 +389,12 @@ set(LLVM_TARGETS_TO_BUILD
+ ${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD})
+ list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD)
+
++# Allow to use commas in the LLVM_TARGETS_TO_BUILD ("X86,AArch64,...")
++string(REPLACE "," ";" fixed_LLVM_TARGETS_TO_BUILD "${LLVM_TARGETS_TO_BUILD}")
++if(NOT fixed_LLVM_TARGETS_TO_BUILD STREQUAL LLVM_TARGETS_TO_BUILD)
++ set(LLVM_TARGETS_TO_BUILD "${fixed_LLVM_TARGETS_TO_BUILD}" CACHE STRING "" FORCE)
++endif()
++
+ option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
+ option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
+ option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF)
diff --git a/ports/llvm-10/0002-fix-install-paths.patch b/ports/llvm-10/0002-fix-install-paths.patch
new file mode 100644
index 00000000..5e63424a
--- /dev/null
+++ b/ports/llvm-10/0002-fix-install-paths.patch
@@ -0,0 +1,42 @@
+diff --git a/clang/cmake/modules/CMakeLists.txt b/clang/cmake/modules/CMakeLists.txt
+index d233f552f01..26f502ad2d2 100644
+--- a/clang/cmake/modules/CMakeLists.txt
++++ b/clang/cmake/modules/CMakeLists.txt
+@@ -1,11 +1,11 @@
+ # Generate a list of CMake library targets so that other CMake projects can
+ # link against them. LLVM calls its version of this file LLVMExports.cmake, but
+ # the usual CMake convention seems to be ${Project}Targets.cmake.
+-set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang)
++set(CLANG_INSTALL_PACKAGE_DIR share/clang)
+ set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}")
+
+ # Keep this in sync with llvm/cmake/CMakeLists.txt!
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
+diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt
+index 9cf22b436fa..8eeb27d1794 100644
+--- a/llvm/cmake/modules/CMakeLists.txt
++++ b/llvm/cmake/modules/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
+diff --git a/polly/cmake/CMakeLists.txt b/polly/cmake/CMakeLists.txt
+index 211f9551271..2abe3803f91 100644
+--- a/polly/cmake/CMakeLists.txt
++++ b/polly/cmake/CMakeLists.txt
+@@ -1,7 +1,7 @@
+ # Keep this in sync with llvm/cmake/CMakeLists.txt!
+
+-set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+-set(POLLY_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/polly")
++set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
++set(POLLY_INSTALL_PACKAGE_DIR share/polly)
+ if (CMAKE_CONFIGURATION_TYPES)
+ set(POLLY_EXPORTS_FILE_NAME "PollyExports-$>.cmake")
+ else()
diff --git a/ports/llvm-10/0003-fix-vs2019-v16.6.patch b/ports/llvm-10/0003-fix-vs2019-v16.6.patch
new file mode 100644
index 00000000..0c89eb5c
--- /dev/null
+++ b/ports/llvm-10/0003-fix-vs2019-v16.6.patch
@@ -0,0 +1,15 @@
+diff --git a/llvm/include/llvm/Support/ManagedStatic.h b/llvm/include/llvm/Support/ManagedStatic.h
+index bbd0d04ed..f2b41422f 100644
+--- a/llvm/include/llvm/Support/ManagedStatic.h
++++ b/llvm/include/llvm/Support/ManagedStatic.h
+@@ -40,8 +40,8 @@ template struct object_deleter {
+ // constexpr, a dynamic initializer may be emitted depending on optimization
+ // settings. For the affected versions of MSVC, use the old linker
+ // initialization pattern of not providing a constructor and leaving the fields
+-// uninitialized.
+-#if !defined(_MSC_VER) || defined(__clang__)
++// uninitialized. See http://llvm.org/PR41367 for details.
++#if !defined(_MSC_VER) || (_MSC_VER >= 1925) || defined(__clang__)
+ #define LLVM_USE_CONSTEXPR_CTOR
+ #endif
+
diff --git a/ports/llvm-10/0004-fix-dr-1734.patch b/ports/llvm-10/0004-fix-dr-1734.patch
new file mode 100644
index 00000000..adfbe5a1
--- /dev/null
+++ b/ports/llvm-10/0004-fix-dr-1734.patch
@@ -0,0 +1,14 @@
+diff --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h
+index b7d48e8e1ad..53ba24efc00 100644
+--- a/llvm/include/llvm/Support/type_traits.h
++++ b/llvm/include/llvm/Support/type_traits.h
+@@ -177,7 +177,8 @@ class is_trivially_copyable {
+ (has_deleted_copy_assign || has_trivial_copy_assign) &&
+ (has_deleted_copy_constructor || has_trivial_copy_constructor);
+
+-#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE
++ // due to DR 1734, a type can be std::is_trivially_copyable but not llvm::is_trivially_copyable
++#if 0
+ static_assert(value == std::is_trivially_copyable::value,
+ "inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable");
+ #endif
diff --git a/ports/llvm-10/0005-remove-FindZ3.cmake.patch b/ports/llvm-10/0005-remove-FindZ3.cmake.patch
new file mode 100644
index 00000000..3d8cdc11
--- /dev/null
+++ b/ports/llvm-10/0005-remove-FindZ3.cmake.patch
@@ -0,0 +1,116 @@
+diff --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake
+deleted file mode 100644
+index 042942755..000000000
+--- a/llvm/cmake/modules/FindZ3.cmake
++++ /dev/null
+@@ -1,110 +0,0 @@
+-INCLUDE(CheckCXXSourceRuns)
+-
+-# Function to check Z3's version
+-function(check_z3_version z3_include z3_lib)
+- # The program that will be executed to print Z3's version.
+- file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testz3.c
+- "#include
+- #include
+- int main() {
+- unsigned int major, minor, build, rev;
+- Z3_get_version(&major, &minor, &build, &rev);
+- printf(\"%u.%u.%u\", major, minor, build);
+- return 0;
+- }")
+-
+- # Get lib path
+- get_filename_component(z3_lib_path ${z3_lib} PATH)
+-
+- try_run(
+- Z3_RETURNCODE
+- Z3_COMPILED
+- ${CMAKE_BINARY_DIR}
+- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testz3.c
+- COMPILE_DEFINITIONS -I"${z3_include}"
+- LINK_LIBRARIES -L${z3_lib_path} -lz3
+- RUN_OUTPUT_VARIABLE SRC_OUTPUT
+- )
+-
+- if(Z3_COMPILED)
+- string(REGEX REPLACE "([0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*)" "\\1"
+- z3_version "${SRC_OUTPUT}")
+- set(Z3_VERSION_STRING ${z3_version} PARENT_SCOPE)
+- endif()
+-endfunction(check_z3_version)
+-
+-# Looking for Z3 in LLVM_Z3_INSTALL_DIR
+-find_path(Z3_INCLUDE_DIR NAMES z3.h
+- NO_DEFAULT_PATH
+- PATHS ${LLVM_Z3_INSTALL_DIR}/include
+- PATH_SUFFIXES libz3 z3
+- )
+-
+-find_library(Z3_LIBRARIES NAMES z3 libz3
+- NO_DEFAULT_PATH
+- PATHS ${LLVM_Z3_INSTALL_DIR}
+- PATH_SUFFIXES lib bin
+- )
+-
+-# If Z3 has not been found in LLVM_Z3_INSTALL_DIR look in the default directories
+-find_path(Z3_INCLUDE_DIR NAMES z3.h
+- PATH_SUFFIXES libz3 z3
+- )
+-
+-find_library(Z3_LIBRARIES NAMES z3 libz3
+- PATH_SUFFIXES lib bin
+- )
+-
+-# Searching for the version of the Z3 library is a best-effort task
+-unset(Z3_VERSION_STRING)
+-
+-# First, try to check it dynamically, by compiling a small program that
+-# prints Z3's version
+-if(Z3_INCLUDE_DIR AND Z3_LIBRARIES)
+- # We do not have the Z3 binary to query for a version. Try to use
+- # a small C++ program to detect it via the Z3_get_version() API call.
+- check_z3_version(${Z3_INCLUDE_DIR} ${Z3_LIBRARIES})
+-endif()
+-
+-# If the dynamic check fails, we might be cross compiling: if that's the case,
+-# check the version in the headers, otherwise, fail with a message
+-if(NOT Z3_VERSION_STRING AND (CMAKE_CROSSCOMPILING AND
+- Z3_INCLUDE_DIR AND
+- EXISTS "${Z3_INCLUDE_DIR}/z3_version.h"))
+- # TODO: print message warning that we couldn't find a compatible lib?
+-
+- # Z3 4.8.1+ has the version is in a public header.
+- file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
+- z3_version_str REGEX "^#define[\t ]+Z3_MAJOR_VERSION[\t ]+.*")
+- string(REGEX REPLACE "^.*Z3_MAJOR_VERSION[\t ]+([0-9]).*$" "\\1"
+- Z3_MAJOR "${z3_version_str}")
+-
+- file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
+- z3_version_str REGEX "^#define[\t ]+Z3_MINOR_VERSION[\t ]+.*")
+- string(REGEX REPLACE "^.*Z3_MINOR_VERSION[\t ]+([0-9]).*$" "\\1"
+- Z3_MINOR "${z3_version_str}")
+-
+- file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
+- z3_version_str REGEX "^#define[\t ]+Z3_BUILD_NUMBER[\t ]+.*")
+- string(REGEX REPLACE "^.*Z3_BUILD_VERSION[\t ]+([0-9]).*$" "\\1"
+- Z3_BUILD "${z3_version_str}")
+-
+- set(Z3_VERSION_STRING ${Z3_MAJOR}.${Z3_MINOR}.${Z3_BUILD})
+- unset(z3_version_str)
+-endif()
+-
+-if(NOT Z3_VERSION_STRING)
+- # Give up: we are unable to obtain a version of the Z3 library. Be
+- # conservative and force the found version to 0.0.0 to make version
+- # checks always fail.
+- set(Z3_VERSION_STRING "0.0.0")
+-endif()
+-
+-# handle the QUIETLY and REQUIRED arguments and set Z3_FOUND to TRUE if
+-# all listed variables are TRUE
+-include(FindPackageHandleStandardArgs)
+-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3
+- REQUIRED_VARS Z3_LIBRARIES Z3_INCLUDE_DIR
+- VERSION_VAR Z3_VERSION_STRING)
+-
+-mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBRARIES)
diff --git a/ports/llvm-10/0006-fix-FindZ3.cmake.patch b/ports/llvm-10/0006-fix-FindZ3.cmake.patch
new file mode 100644
index 00000000..f8412194
--- /dev/null
+++ b/ports/llvm-10/0006-fix-FindZ3.cmake.patch
@@ -0,0 +1,132 @@
+diff --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake
+new file mode 100644
+index 000000000..32f6f4160
+--- /dev/null
++++ b/llvm/cmake/modules/FindZ3.cmake
+@@ -0,0 +1,112 @@
++INCLUDE(CheckCXXSourceRuns)
++
++# Function to check Z3's version
++function(check_z3_version z3_include z3_lib)
++ # Get lib path
++ get_filename_component(z3_lib_path ${z3_lib} PATH)
++
++ # Try to find a threading module in case Z3 was built with threading support.
++ # Threads are required elsewhere in LLVM, but not marked as required here because
++ # Z3 could have been compiled without threading support.
++ find_package(Threads)
++ set(z3_link_libs "-lz3" "${CMAKE_THREAD_LIBS_INIT}")
++
++ try_run(
++ Z3_RETURNCODE
++ Z3_COMPILED
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_SOURCE_DIR}/cmake/modules/testz3.cpp
++ COMPILE_DEFINITIONS -I"${z3_include}"
++ LINK_LIBRARIES -L${z3_lib_path} ${z3_link_libs}
++ RUN_OUTPUT_VARIABLE SRC_OUTPUT
++ )
++
++ if(Z3_COMPILED)
++ string(REGEX REPLACE "([0-9]*\\.[0-9]*\\.[0-9]*)" "\\1"
++ z3_version "${SRC_OUTPUT}")
++ set(Z3_VERSION_STRING ${z3_version} PARENT_SCOPE)
++ endif()
++endfunction(check_z3_version)
++
++# Looking for Z3 in LLVM_Z3_INSTALL_DIR
++find_path(Z3_INCLUDE_DIR NAMES z3.h
++ NO_DEFAULT_PATH
++ PATHS ${LLVM_Z3_INSTALL_DIR}/include
++ PATH_SUFFIXES libz3 z3
++ )
++
++find_library(Z3_LIBS NAMES z3 libz3
++ NO_DEFAULT_PATH
++ PATHS ${LLVM_Z3_INSTALL_DIR}
++ PATH_SUFFIXES lib bin
++ )
++
++# If Z3 has not been found in LLVM_Z3_INSTALL_DIR look in the default directories
++find_path(Z3_INCLUDE_DIR NAMES z3.h
++ PATH_SUFFIXES libz3 z3
++ )
++
++find_library(Z3_LIBS NAMES z3 libz3
++ PATH_SUFFIXES lib bin
++ )
++
++# Searching for the version of the Z3 library is a best-effort task
++unset(Z3_VERSION_STRING)
++
++# First, try to check it dynamically, by compiling a small program that
++# prints Z3's version
++if(Z3_INCLUDE_DIR AND Z3_LIBS)
++ # We do not have the Z3 binary to query for a version. Try to use
++ # a small C++ program to detect it via the Z3_get_version() API call.
++ check_z3_version(${Z3_INCLUDE_DIR} ${Z3_LIBS})
++endif()
++
++# If the dynamic check fails, we might be cross compiling: if that's the case,
++# check the version in the headers, otherwise, fail with a message
++if(NOT Z3_VERSION_STRING AND (CMAKE_CROSSCOMPILING AND
++ Z3_INCLUDE_DIR AND
++ EXISTS "${Z3_INCLUDE_DIR}/z3_version.h"))
++ # TODO: print message warning that we couldn't find a compatible lib?
++
++ # Z3 4.8.1+ has the version is in a public header.
++ file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
++ z3_version_str REGEX "^#define[\t ]+Z3_MAJOR_VERSION[\t ]+.*")
++ string(REGEX REPLACE "^.*Z3_MAJOR_VERSION[\t ]+([0-9]).*$" "\\1"
++ Z3_MAJOR "${z3_version_str}")
++
++ file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
++ z3_version_str REGEX "^#define[\t ]+Z3_MINOR_VERSION[\t ]+.*")
++ string(REGEX REPLACE "^.*Z3_MINOR_VERSION[\t ]+([0-9]).*$" "\\1"
++ Z3_MINOR "${z3_version_str}")
++
++ file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
++ z3_version_str REGEX "^#define[\t ]+Z3_BUILD_NUMBER[\t ]+.*")
++ string(REGEX REPLACE "^.*Z3_BUILD_VERSION[\t ]+([0-9]).*$" "\\1"
++ Z3_BUILD "${z3_version_str}")
++
++ set(Z3_VERSION_STRING ${Z3_MAJOR}.${Z3_MINOR}.${Z3_BUILD})
++ unset(z3_version_str)
++endif()
++
++if(NOT Z3_VERSION_STRING)
++ # Give up: we are unable to obtain a version of the Z3 library. Be
++ # conservative and force the found version to 0.0.0 to make version
++ # checks always fail.
++ set(Z3_VERSION_STRING "0.0.0")
++endif()
++
++# handle the QUIETLY and REQUIRED arguments and set Z3_FOUND to TRUE if
++# all listed variables are TRUE
++include(FindPackageHandleStandardArgs)
++FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3
++ REQUIRED_VARS Z3_LIBS Z3_INCLUDE_DIR
++ VERSION_VAR Z3_VERSION_STRING)
++if(Z3_FOUND AND NOT TARGET Z3)
++ add_library(Z3 UNKNOWN IMPORTED)
++ set_target_properties(Z3 PROPERTIES
++ INTERFACE_INCLUDE_DIRECTORIES "${Z3_INCLUDE_DIR}"
++ IMPORTED_LOCATION "${Z3_LIBS}"
++ )
++ set(Z3_LIBRARIES "Z3")
++endif()
++mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBS Z3_LIBRARIES)
+diff --git a/llvm/cmake/modules/testz3.cpp b/llvm/cmake/modules/testz3.cpp
+new file mode 100644
+index 000000000..2c55ba7d6
+--- /dev/null
++++ b/llvm/cmake/modules/testz3.cpp
+@@ -0,0 +1,8 @@
++#include
++#include
++int main() {
++ unsigned int major, minor, build, rev;
++ Z3_get_version(&major, &minor, &build, &rev);
++ printf("%u.%u.%u", major, minor, build);
++ return 0;
++}
diff --git a/ports/llvm-10/CONTROL b/ports/llvm-10/CONTROL
new file mode 100644
index 00000000..3fb381fe
--- /dev/null
+++ b/ports/llvm-10/CONTROL
@@ -0,0 +1,124 @@
+Source: llvm-10
+Version: 10.0.0
+Homepage: https://llvm.org/
+Description: The LLVM Compiler Infrastructure
+Supports: !uwp
+Default-Features: tools, clang, enable-rtti, enable-z3, disable-assertions, disable-abi-breaking-checks, disable-terminfo, libcxx, libcxxabi, target-aarch64, target-arm, target-nvptx, target-sparc, target-x86
+
+Feature: tools
+Description: Build LLVM tools.
+
+Feature: utils
+Description: Build LLVM utils.
+
+Feature: default-targets
+Description: Build with platform-specific default targets
+Build-Depends: llvm-10[core,target-x86] (x86|x64), llvm-10[core,target-arm] (arm&!arm64), llvm-10[core,target-aarch64] (arm64), llvm-10[core,target-all] (!x86&!x64&!arm&!arm64)
+
+Feature: target-all
+Description: Build with all backends.
+Build-Depends: llvm-10[core,target-aarch64,target-amdgpu,target-arm,target-bpf,target-hexagon,target-lanai,target-mips,target-msp430,target-nvptx,target-powerpc,target-riscv,target-sparc,target-systemz,target-webassembly,target-x86,target-xcore]
+
+Feature: target-aarch64
+Description: Build with AArch64 backend.
+
+Feature: target-amdgpu
+Description: Build with AMDGPU backend.
+
+Feature: target-arm
+Description: Build with ARM backend.
+
+Feature: target-bpf
+Description: Build with BPF backend.
+
+Feature: target-hexagon
+Description: Build with Hexagon backend.
+
+Feature: target-lanai
+Description: Build with Lanai backend.
+
+Feature: target-mips
+Description: Build with Mips backend.
+
+Feature: target-msp430
+Description: Build with MSP430 backend.
+
+Feature: target-nvptx
+Description: Build with NVPTX backend.
+
+Feature: target-powerpc
+Description: Build with PowerPC backend.
+
+Feature: target-riscv
+Description: Build with RISCV backend.
+
+Feature: target-sparc
+Description: Build with Sparc backend.
+
+Feature: target-systemz
+Description: Build with SystemZ backend.
+
+Feature: target-webassembly
+Description: Build with WebAssembly backend.
+
+Feature: target-x86
+Description: Build with X86 backend.
+
+Feature: target-xcore
+Description: Build with XCore backend.
+
+Feature: enable-rtti
+Description: Build LLVM with run-time type information.
+
+Feature: enable-assertions
+Description: Build LLVM with assertions.
+
+Feature: disable-assertions
+Description: Build LLVM without assertions.
+
+Feature: enable-terminfo
+Description: Build LLVM with linking to terminfo.
+Build-Depends: ncurses
+
+Feature: disable-terminfo
+Description: Build LLVM without linking to terminfo.
+
+Feature: enable-abi-breaking-checks
+Description: Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_ON.
+
+Feature: disable-abi-breaking-checks
+Description: Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_OFF.
+
+Feature: clang
+Description: Build C Language Family Front-end.
+
+Feature: disable-clang-static-analyzer
+Description: Build without static analyzer.
+
+Feature: clang-tools-extra
+Description: Build Clang tools.
+
+Feature: compiler-rt
+Description: Build compiler's runtime libraries.
+
+Feature: lld
+Description: Build LLVM linker.
+
+Feature: openmp
+Description: Build LLVM OpenMP libraries.
+
+Feature: lldb
+Description: Build LLDB debugger.
+
+Feature: polly
+Description: Build polyhedral optimizations for LLVM.
+
+Feature: enable-z3
+Description: Compile with Z3 SMT solver support for Clang static analyzer.
+Build-Depends: z3, llvm-10[core,clang]
+
+Feature: libcxx
+Description: Build libcxx runtime
+
+Feature: libcxxabi
+Description: Build libcxxabi runtime
diff --git a/ports/llvm-10/LICENSE b/ports/llvm-10/LICENSE
new file mode 100644
index 00000000..37eb2583
--- /dev/null
+++ b/ports/llvm-10/LICENSE
@@ -0,0 +1,23 @@
+Copyright (c) Microsoft Corporation
+
+All rights reserved.
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/ports/llvm-10/NOTICE b/ports/llvm-10/NOTICE
new file mode 100644
index 00000000..fd6b68ae
--- /dev/null
+++ b/ports/llvm-10/NOTICE
@@ -0,0 +1,2 @@
+This directory was initially copied from ports/llvm/portfile.cmake
+https://github.com/microsoft/vcpkg/tree/7e3d3beac5ca6fe8aab4599d4e1d8ce270ccdea8
diff --git a/ports/llvm-10/portfile.cmake b/ports/llvm-10/portfile.cmake
new file mode 100644
index 00000000..c2cf089c
--- /dev/null
+++ b/ports/llvm-10/portfile.cmake
@@ -0,0 +1,261 @@
+set(LLVM_VERSION "10.0.0")
+
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO llvm/llvm-project
+ REF llvmorg-${LLVM_VERSION}
+ SHA512 baa182d62fef1851836013ae8a1a00861ea89769778d67fb97b407a9de664e6c85da2af9c5b3f75d2bf34ff6b00004e531ca7e4b3115a26c0e61c575cf2303a0
+ HEAD_REF master
+ PATCHES
+ 0001-allow-to-use-commas.patch
+ 0002-fix-install-paths.patch
+ 0003-fix-vs2019-v16.6.patch
+ 0004-fix-dr-1734.patch
+ 0005-remove-FindZ3.cmake.patch
+ 0006-fix-FindZ3.cmake.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ tools LLVM_BUILD_TOOLS
+ tools LLVM_INCLUDE_TOOLS
+ utils LLVM_BUILD_UTILS
+ utils LLVM_INCLUDE_UTILS
+ enable-rtti LLVM_ENABLE_RTTI
+ enable-z3 LLVM_ENABLE_Z3_SOLVER
+)
+
+# Linking with gold is better
+if(VCPKG_TARGET_IS_LINUX)
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_USE_LINKER=gold
+ )
+endif()
+
+# By default assertions are enabled for Debug configuration only.
+if("enable-assertions" IN_LIST FEATURES)
+ # Force enable assertions for all configurations.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ )
+elseif("disable-assertions" IN_LIST FEATURES)
+ # Force disable assertions for all configurations.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ENABLE_ASSERTIONS=OFF
+ )
+endif()
+
+if("enable-terminfo" IN_LIST FEATURES)
+ # Force enable terminfo for all configurations.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ENABLE_TERMINFO=ON
+ )
+elseif("disable-terminfo" IN_LIST FEATURES)
+ # Force disable terminfo for all configurations.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ENABLE_TERMINFO=OFF
+ )
+endif()
+
+# LLVM_ABI_BREAKING_CHECKS can be WITH_ASSERTS (default), FORCE_ON or FORCE_OFF.
+# By default abi-breaking checks are enabled if assertions are enabled.
+if("enable-abi-breaking-checks" IN_LIST FEATURES)
+ # Force enable abi-breaking checks.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ABI_BREAKING_CHECKS=FORCE_ON
+ )
+elseif("disable-abi-breaking-checks" IN_LIST FEATURES)
+ # Force disable abi-breaking checks.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF
+ )
+endif()
+
+set(LLVM_ENABLE_PROJECTS)
+if("clang" IN_LIST FEATURES OR "clang-tools-extra" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "clang")
+ if("disable-clang-static-analyzer" IN_LIST FEATURES)
+ list(APPEND FEATURE_OPTIONS
+ # Disable ARCMT
+ -DCLANG_ENABLE_ARCMT=OFF
+ # Disable static analyzer
+ -DCLANG_ENABLE_STATIC_ANALYZER=OFF
+ )
+ endif()
+ if(VCPKG_TARGET_IS_WINDOWS)
+ list(APPEND FEATURE_OPTIONS
+ # Disable dl library on Windows
+ -DDL_LIBRARY_PATH:FILEPATH=
+ )
+ elseif(VCPKG_TARGET_IS_OSX)
+ list(APPEND FEATURE_OPTIONS
+ -DDEFAULT_SYSROOT:FILEPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
+ -DLLVM_CREATE_XCODE_TOOLCHAIN=ON
+ )
+ endif()
+endif()
+if("clang-tools-extra" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "clang-tools-extra")
+endif()
+if("compiler-rt" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "compiler-rt")
+endif()
+if("libcxx" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "libcxx")
+ list(APPEND FEATURE_OPTIONS
+ -DLIBCXX_ENABLE_STATIC=YES
+ -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=YES
+ -DLIBCXX_ENABLE_FILESYSTEM=YES
+ -DLIBCXX_INCLUDE_BENCHMARKS=NO
+ )
+ if(VCPKG_TARGET_IS_LINUX)
+ list(APPEND FEATURE_OPTIONS
+ # Broken on Linux when set to YES
+ # Error on installing shared debug lib
+ -DLIBCXX_ENABLE_SHARED=NO
+ )
+ else()
+ list(APPEND FEATURE_OPTIONS
+ -DLIBCXX_ENABLE_SHARED=YES
+ )
+ endif()
+endif()
+if("libcxxabi" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "libcxxabi")
+endif()
+if("lld" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "lld")
+endif()
+if("openmp" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "openmp")
+ # Perl is required for the OpenMP run-time
+ vcpkg_find_acquire_program(PERL)
+ list(APPEND FEATURE_OPTIONS
+ -DPERL_EXECUTABLE=${PERL}
+ )
+endif()
+if("lldb" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "lldb")
+endif()
+if("polly" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "polly")
+endif()
+
+set(known_llvm_targets
+ AArch64 AMDGPU ARM BPF Hexagon Lanai Mips
+ MSP430 NVPTX PowerPC RISCV Sparc SystemZ
+ WebAssembly X86 XCore)
+
+set(LLVM_TARGETS_TO_BUILD "")
+foreach(llvm_target IN LISTS known_llvm_targets)
+ string(TOLOWER "target-${llvm_target}" feature_name)
+ if(feature_name IN_LIST FEATURES)
+ list(APPEND LLVM_TARGETS_TO_BUILD "${llvm_target}")
+ endif()
+endforeach()
+
+# Use comma-separated string instead of semicolon-separated string.
+# See https://github.com/microsoft/vcpkg/issues/4320
+string(REPLACE ";" "," LLVM_ENABLE_PROJECTS "${LLVM_ENABLE_PROJECTS}")
+string(REPLACE ";" "," LLVM_TARGETS_TO_BUILD "${LLVM_TARGETS_TO_BUILD}")
+
+vcpkg_find_acquire_program(PYTHON3)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}/llvm
+ PREFER_NINJA
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DLLVM_INCLUDE_EXAMPLES=OFF
+ -DLLVM_BUILD_EXAMPLES=OFF
+ -DLLVM_INCLUDE_TESTS=OFF
+ -DLLVM_BUILD_TESTS=OFF
+ # Disable optional dependencies to libxml2, zlib, and libedit
+ -DLLVM_ENABLE_LIBXML2=OFF
+ -DLLVM_ENABLE_ZLIB=OFF
+ -DLLVM_ENABLE_LIBEDIT=OFF
+ # From llvm-9 onwards
+ -DCMAKE_CXX_STANDARD=14
+ # Force TableGen to be built with optimization. This will significantly improve build time.
+ -DLLVM_OPTIMIZED_TABLEGEN=ON
+ # LLVM generates CMake error due to Visual Studio version 16.4 is known to miscompile part of LLVM.
+ # LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON disables this error.
+ # See https://developercommunity.visualstudio.com/content/problem/845933/miscompile-boolean-condition-deduced-to-be-always.html
+ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON
+ -DLLVM_ENABLE_PROJECTS=${LLVM_ENABLE_PROJECTS}
+ -DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}
+ -DPACKAGE_VERSION=${LLVM_VERSION}
+ -DPYTHON_EXECUTABLE=${PYTHON3}
+ # Limit the maximum number of concurrent link jobs to 2. This should fix low amount of memory issue for link.
+ -DLLVM_PARALLEL_LINK_JOBS=2
+ # Disable build LLVM-C.dll (Windows only) due to doesn't compile with CMAKE_DEBUG_POSTFIX
+ -DLLVM_BUILD_LLVM_C_DYLIB=OFF
+ -DCMAKE_DEBUG_POSTFIX=d
+)
+
+vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/llvm TARGET_PATH share/llvm)
+if("clang" IN_LIST FEATURES)
+ vcpkg_fixup_cmake_targets(CONFIG_PATH share/clang TARGET_PATH share/clang)
+endif()
+
+if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
+ file(GLOB_RECURSE _llvm_release_targets
+ "${CURRENT_PACKAGES_DIR}/share/llvm/*-release.cmake"
+ )
+ set(_clang_release_targets)
+ if("clang" IN_LIST FEATURES)
+ file(GLOB_RECURSE _clang_release_targets
+ "${CURRENT_PACKAGES_DIR}/share/clang/*-release.cmake"
+ )
+ endif()
+ foreach(_target IN LISTS _llvm_release_targets _clang_release_targets)
+ file(READ ${_target} _contents)
+ # LLVM tools should be located in the bin folder because llvm-config expects to be inside a bin dir.
+ # Rename `/tools/${PORT}` to `/bin` back because there is no way to avoid this in vcpkg_fixup_cmake_targets.
+ string(REPLACE "{_IMPORT_PREFIX}/tools/${PORT}" "{_IMPORT_PREFIX}/bin" _contents "${_contents}")
+ file(WRITE ${_target} "${_contents}")
+ endforeach()
+endif()
+
+if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ file(GLOB_RECURSE _llvm_debug_targets
+ "${CURRENT_PACKAGES_DIR}/share/llvm/*-debug.cmake"
+ )
+ set(_clang_debug_targets)
+ if("clang" IN_LIST FEATURES)
+ file(GLOB_RECURSE _clang_debug_targets
+ "${CURRENT_PACKAGES_DIR}/share/clang/*-debug.cmake"
+ )
+ endif()
+ foreach(_target IN LISTS _llvm_debug_targets _clang_debug_targets)
+ file(READ ${_target} _contents)
+ # LLVM tools should be located in the bin folder because llvm-config expects to be inside a bin dir.
+ # Rename `/tools/${PORT}` to `/bin` back because there is no way to avoid this in vcpkg_fixup_cmake_targets.
+ string(REPLACE "{_IMPORT_PREFIX}/tools/${PORT}" "{_IMPORT_PREFIX}/bin" _contents "${_contents}")
+ # Debug shared libraries should have `d` suffix and should be installed in the `/bin` directory.
+ # Rename `/debug/bin/` to `/bin`
+ string(REPLACE "{_IMPORT_PREFIX}/debug/bin/" "{_IMPORT_PREFIX}/bin/" _contents "${_contents}")
+ file(WRITE ${_target} "${_contents}")
+ endforeach()
+
+ # Install debug shared libraries in the `/bin` directory
+ file(GLOB _debug_shared_libs ${CURRENT_PACKAGES_DIR}/debug/bin/*${CMAKE_SHARED_LIBRARY_SUFFIX})
+ file(INSTALL ${_debug_shared_libs} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+
+ file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/bin
+ ${CURRENT_PACKAGES_DIR}/debug/include
+ ${CURRENT_PACKAGES_DIR}/debug/share
+ )
+endif()
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/llvm/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/llvm RENAME copyright)
+if("clang" IN_LIST FEATURES)
+ file(INSTALL ${SOURCE_PATH}/clang/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/clang RENAME copyright)
+endif()
+
+# Don't fail if the bin folder exists.
+set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
diff --git a/ports/llvm-11/0001-allow-to-use-commas.patch b/ports/llvm-11/0001-allow-to-use-commas.patch
new file mode 100644
index 00000000..5e0b5103
--- /dev/null
+++ b/ports/llvm-11/0001-allow-to-use-commas.patch
@@ -0,0 +1,30 @@
+diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
+index 038139a24..a3d11ff67 100644
+--- a/llvm/CMakeLists.txt
++++ b/llvm/CMakeLists.txt
+@@ -86,6 +86,12 @@ if ("flang" IN_LIST LLVM_ENABLE_PROJECTS AND NOT "mlir" IN_LIST LLVM_ENABLE_PROJ
+ list(APPEND LLVM_ENABLE_PROJECTS "mlir")
+ endif()
+
++# Allow to use commas in LLVM_ENABLE_PROJECTS ("llvm,clang,...")
++string(REPLACE "," ";" fixed_LLVM_ENABLE_PROJECTS "${LLVM_ENABLE_PROJECTS}")
++if(NOT fixed_LLVM_ENABLE_PROJECTS STREQUAL LLVM_ENABLE_PROJECTS)
++ set(LLVM_ENABLE_PROJECTS "${fixed_LLVM_ENABLE_PROJECTS}" CACHE STRING "" FORCE)
++endif()
++
+ # LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the
+ # `LLVM_ENABLE_PROJECTS` CMake cache variable. This exists for
+ # several reasons:
+@@ -401,6 +407,12 @@ set(LLVM_TARGETS_TO_BUILD
+ ${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD})
+ list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD)
+
++# Allow to use commas in the LLVM_TARGETS_TO_BUILD ("X86,AArch64,...")
++string(REPLACE "," ";" fixed_LLVM_TARGETS_TO_BUILD "${LLVM_TARGETS_TO_BUILD}")
++if(NOT fixed_LLVM_TARGETS_TO_BUILD STREQUAL LLVM_TARGETS_TO_BUILD)
++ set(LLVM_TARGETS_TO_BUILD "${fixed_LLVM_TARGETS_TO_BUILD}" CACHE STRING "" FORCE)
++endif()
++
+ option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
+ option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
+ option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF)
diff --git a/ports/llvm-11/0002-fix-install-paths.patch b/ports/llvm-11/0002-fix-install-paths.patch
new file mode 100644
index 00000000..5e63424a
--- /dev/null
+++ b/ports/llvm-11/0002-fix-install-paths.patch
@@ -0,0 +1,42 @@
+diff --git a/clang/cmake/modules/CMakeLists.txt b/clang/cmake/modules/CMakeLists.txt
+index d233f552f01..26f502ad2d2 100644
+--- a/clang/cmake/modules/CMakeLists.txt
++++ b/clang/cmake/modules/CMakeLists.txt
+@@ -1,11 +1,11 @@
+ # Generate a list of CMake library targets so that other CMake projects can
+ # link against them. LLVM calls its version of this file LLVMExports.cmake, but
+ # the usual CMake convention seems to be ${Project}Targets.cmake.
+-set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang)
++set(CLANG_INSTALL_PACKAGE_DIR share/clang)
+ set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}")
+
+ # Keep this in sync with llvm/cmake/CMakeLists.txt!
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
+diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt
+index 9cf22b436fa..8eeb27d1794 100644
+--- a/llvm/cmake/modules/CMakeLists.txt
++++ b/llvm/cmake/modules/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
+diff --git a/polly/cmake/CMakeLists.txt b/polly/cmake/CMakeLists.txt
+index 211f9551271..2abe3803f91 100644
+--- a/polly/cmake/CMakeLists.txt
++++ b/polly/cmake/CMakeLists.txt
+@@ -1,7 +1,7 @@
+ # Keep this in sync with llvm/cmake/CMakeLists.txt!
+
+-set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+-set(POLLY_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/polly")
++set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
++set(POLLY_INSTALL_PACKAGE_DIR share/polly)
+ if (CMAKE_CONFIGURATION_TYPES)
+ set(POLLY_EXPORTS_FILE_NAME "PollyExports-$>.cmake")
+ else()
diff --git a/ports/llvm-11/0004-fix-dr-1734.patch b/ports/llvm-11/0004-fix-dr-1734.patch
new file mode 100644
index 00000000..adfbe5a1
--- /dev/null
+++ b/ports/llvm-11/0004-fix-dr-1734.patch
@@ -0,0 +1,14 @@
+diff --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h
+index b7d48e8e1ad..53ba24efc00 100644
+--- a/llvm/include/llvm/Support/type_traits.h
++++ b/llvm/include/llvm/Support/type_traits.h
+@@ -177,7 +177,8 @@ class is_trivially_copyable {
+ (has_deleted_copy_assign || has_trivial_copy_assign) &&
+ (has_deleted_copy_constructor || has_trivial_copy_constructor);
+
+-#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE
++ // due to DR 1734, a type can be std::is_trivially_copyable but not llvm::is_trivially_copyable
++#if 0
+ static_assert(value == std::is_trivially_copyable::value,
+ "inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable");
+ #endif
diff --git a/ports/llvm-11/0005-remove-FindZ3.cmake.patch b/ports/llvm-11/0005-remove-FindZ3.cmake.patch
new file mode 100644
index 00000000..22c3b125
--- /dev/null
+++ b/ports/llvm-11/0005-remove-FindZ3.cmake.patch
@@ -0,0 +1,116 @@
+diff --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake
+deleted file mode 100644
+index 95dd37789..000000000
+--- a/llvm/cmake/modules/FindZ3.cmake
++++ /dev/null
+@@ -1,110 +0,0 @@
+-INCLUDE(CheckCXXSourceRuns)
+-
+-# Function to check Z3's version
+-function(check_z3_version z3_include z3_lib)
+- # The program that will be executed to print Z3's version.
+- file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testz3.c
+- "#include
+- #include
+- int main() {
+- unsigned int major, minor, build, rev;
+- Z3_get_version(&major, &minor, &build, &rev);
+- printf(\"%u.%u.%u\", major, minor, build);
+- return 0;
+- }")
+-
+- # Get lib path
+- get_filename_component(z3_lib_path ${z3_lib} PATH)
+-
+- try_run(
+- Z3_RETURNCODE
+- Z3_COMPILED
+- ${CMAKE_BINARY_DIR}
+- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testz3.c
+- COMPILE_DEFINITIONS -I"${z3_include}"
+- LINK_LIBRARIES -L${z3_lib_path} -lz3
+- RUN_OUTPUT_VARIABLE SRC_OUTPUT
+- )
+-
+- if(Z3_COMPILED)
+- string(REGEX REPLACE "([0-9]*\\.[0-9]*\\.[0-9]*)" "\\1"
+- z3_version "${SRC_OUTPUT}")
+- set(Z3_VERSION_STRING ${z3_version} PARENT_SCOPE)
+- endif()
+-endfunction(check_z3_version)
+-
+-# Looking for Z3 in LLVM_Z3_INSTALL_DIR
+-find_path(Z3_INCLUDE_DIR NAMES z3.h
+- NO_DEFAULT_PATH
+- PATHS ${LLVM_Z3_INSTALL_DIR}/include
+- PATH_SUFFIXES libz3 z3
+- )
+-
+-find_library(Z3_LIBRARIES NAMES z3 libz3
+- NO_DEFAULT_PATH
+- PATHS ${LLVM_Z3_INSTALL_DIR}
+- PATH_SUFFIXES lib bin
+- )
+-
+-# If Z3 has not been found in LLVM_Z3_INSTALL_DIR look in the default directories
+-find_path(Z3_INCLUDE_DIR NAMES z3.h
+- PATH_SUFFIXES libz3 z3
+- )
+-
+-find_library(Z3_LIBRARIES NAMES z3 libz3
+- PATH_SUFFIXES lib bin
+- )
+-
+-# Searching for the version of the Z3 library is a best-effort task
+-unset(Z3_VERSION_STRING)
+-
+-# First, try to check it dynamically, by compiling a small program that
+-# prints Z3's version
+-if(Z3_INCLUDE_DIR AND Z3_LIBRARIES)
+- # We do not have the Z3 binary to query for a version. Try to use
+- # a small C++ program to detect it via the Z3_get_version() API call.
+- check_z3_version(${Z3_INCLUDE_DIR} ${Z3_LIBRARIES})
+-endif()
+-
+-# If the dynamic check fails, we might be cross compiling: if that's the case,
+-# check the version in the headers, otherwise, fail with a message
+-if(NOT Z3_VERSION_STRING AND (CMAKE_CROSSCOMPILING AND
+- Z3_INCLUDE_DIR AND
+- EXISTS "${Z3_INCLUDE_DIR}/z3_version.h"))
+- # TODO: print message warning that we couldn't find a compatible lib?
+-
+- # Z3 4.8.1+ has the version is in a public header.
+- file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
+- z3_version_str REGEX "^#define[\t ]+Z3_MAJOR_VERSION[\t ]+.*")
+- string(REGEX REPLACE "^.*Z3_MAJOR_VERSION[\t ]+([0-9]).*$" "\\1"
+- Z3_MAJOR "${z3_version_str}")
+-
+- file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
+- z3_version_str REGEX "^#define[\t ]+Z3_MINOR_VERSION[\t ]+.*")
+- string(REGEX REPLACE "^.*Z3_MINOR_VERSION[\t ]+([0-9]).*$" "\\1"
+- Z3_MINOR "${z3_version_str}")
+-
+- file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
+- z3_version_str REGEX "^#define[\t ]+Z3_BUILD_NUMBER[\t ]+.*")
+- string(REGEX REPLACE "^.*Z3_BUILD_VERSION[\t ]+([0-9]).*$" "\\1"
+- Z3_BUILD "${z3_version_str}")
+-
+- set(Z3_VERSION_STRING ${Z3_MAJOR}.${Z3_MINOR}.${Z3_BUILD})
+- unset(z3_version_str)
+-endif()
+-
+-if(NOT Z3_VERSION_STRING)
+- # Give up: we are unable to obtain a version of the Z3 library. Be
+- # conservative and force the found version to 0.0.0 to make version
+- # checks always fail.
+- set(Z3_VERSION_STRING "0.0.0")
+-endif()
+-
+-# handle the QUIETLY and REQUIRED arguments and set Z3_FOUND to TRUE if
+-# all listed variables are TRUE
+-include(FindPackageHandleStandardArgs)
+-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3
+- REQUIRED_VARS Z3_LIBRARIES Z3_INCLUDE_DIR
+- VERSION_VAR Z3_VERSION_STRING)
+-
+-mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBRARIES)
diff --git a/ports/llvm-11/0006-fix-FindZ3.cmake.patch b/ports/llvm-11/0006-fix-FindZ3.cmake.patch
new file mode 100644
index 00000000..f8412194
--- /dev/null
+++ b/ports/llvm-11/0006-fix-FindZ3.cmake.patch
@@ -0,0 +1,132 @@
+diff --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake
+new file mode 100644
+index 000000000..32f6f4160
+--- /dev/null
++++ b/llvm/cmake/modules/FindZ3.cmake
+@@ -0,0 +1,112 @@
++INCLUDE(CheckCXXSourceRuns)
++
++# Function to check Z3's version
++function(check_z3_version z3_include z3_lib)
++ # Get lib path
++ get_filename_component(z3_lib_path ${z3_lib} PATH)
++
++ # Try to find a threading module in case Z3 was built with threading support.
++ # Threads are required elsewhere in LLVM, but not marked as required here because
++ # Z3 could have been compiled without threading support.
++ find_package(Threads)
++ set(z3_link_libs "-lz3" "${CMAKE_THREAD_LIBS_INIT}")
++
++ try_run(
++ Z3_RETURNCODE
++ Z3_COMPILED
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_SOURCE_DIR}/cmake/modules/testz3.cpp
++ COMPILE_DEFINITIONS -I"${z3_include}"
++ LINK_LIBRARIES -L${z3_lib_path} ${z3_link_libs}
++ RUN_OUTPUT_VARIABLE SRC_OUTPUT
++ )
++
++ if(Z3_COMPILED)
++ string(REGEX REPLACE "([0-9]*\\.[0-9]*\\.[0-9]*)" "\\1"
++ z3_version "${SRC_OUTPUT}")
++ set(Z3_VERSION_STRING ${z3_version} PARENT_SCOPE)
++ endif()
++endfunction(check_z3_version)
++
++# Looking for Z3 in LLVM_Z3_INSTALL_DIR
++find_path(Z3_INCLUDE_DIR NAMES z3.h
++ NO_DEFAULT_PATH
++ PATHS ${LLVM_Z3_INSTALL_DIR}/include
++ PATH_SUFFIXES libz3 z3
++ )
++
++find_library(Z3_LIBS NAMES z3 libz3
++ NO_DEFAULT_PATH
++ PATHS ${LLVM_Z3_INSTALL_DIR}
++ PATH_SUFFIXES lib bin
++ )
++
++# If Z3 has not been found in LLVM_Z3_INSTALL_DIR look in the default directories
++find_path(Z3_INCLUDE_DIR NAMES z3.h
++ PATH_SUFFIXES libz3 z3
++ )
++
++find_library(Z3_LIBS NAMES z3 libz3
++ PATH_SUFFIXES lib bin
++ )
++
++# Searching for the version of the Z3 library is a best-effort task
++unset(Z3_VERSION_STRING)
++
++# First, try to check it dynamically, by compiling a small program that
++# prints Z3's version
++if(Z3_INCLUDE_DIR AND Z3_LIBS)
++ # We do not have the Z3 binary to query for a version. Try to use
++ # a small C++ program to detect it via the Z3_get_version() API call.
++ check_z3_version(${Z3_INCLUDE_DIR} ${Z3_LIBS})
++endif()
++
++# If the dynamic check fails, we might be cross compiling: if that's the case,
++# check the version in the headers, otherwise, fail with a message
++if(NOT Z3_VERSION_STRING AND (CMAKE_CROSSCOMPILING AND
++ Z3_INCLUDE_DIR AND
++ EXISTS "${Z3_INCLUDE_DIR}/z3_version.h"))
++ # TODO: print message warning that we couldn't find a compatible lib?
++
++ # Z3 4.8.1+ has the version is in a public header.
++ file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
++ z3_version_str REGEX "^#define[\t ]+Z3_MAJOR_VERSION[\t ]+.*")
++ string(REGEX REPLACE "^.*Z3_MAJOR_VERSION[\t ]+([0-9]).*$" "\\1"
++ Z3_MAJOR "${z3_version_str}")
++
++ file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
++ z3_version_str REGEX "^#define[\t ]+Z3_MINOR_VERSION[\t ]+.*")
++ string(REGEX REPLACE "^.*Z3_MINOR_VERSION[\t ]+([0-9]).*$" "\\1"
++ Z3_MINOR "${z3_version_str}")
++
++ file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
++ z3_version_str REGEX "^#define[\t ]+Z3_BUILD_NUMBER[\t ]+.*")
++ string(REGEX REPLACE "^.*Z3_BUILD_VERSION[\t ]+([0-9]).*$" "\\1"
++ Z3_BUILD "${z3_version_str}")
++
++ set(Z3_VERSION_STRING ${Z3_MAJOR}.${Z3_MINOR}.${Z3_BUILD})
++ unset(z3_version_str)
++endif()
++
++if(NOT Z3_VERSION_STRING)
++ # Give up: we are unable to obtain a version of the Z3 library. Be
++ # conservative and force the found version to 0.0.0 to make version
++ # checks always fail.
++ set(Z3_VERSION_STRING "0.0.0")
++endif()
++
++# handle the QUIETLY and REQUIRED arguments and set Z3_FOUND to TRUE if
++# all listed variables are TRUE
++include(FindPackageHandleStandardArgs)
++FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3
++ REQUIRED_VARS Z3_LIBS Z3_INCLUDE_DIR
++ VERSION_VAR Z3_VERSION_STRING)
++if(Z3_FOUND AND NOT TARGET Z3)
++ add_library(Z3 UNKNOWN IMPORTED)
++ set_target_properties(Z3 PROPERTIES
++ INTERFACE_INCLUDE_DIRECTORIES "${Z3_INCLUDE_DIR}"
++ IMPORTED_LOCATION "${Z3_LIBS}"
++ )
++ set(Z3_LIBRARIES "Z3")
++endif()
++mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBS Z3_LIBRARIES)
+diff --git a/llvm/cmake/modules/testz3.cpp b/llvm/cmake/modules/testz3.cpp
+new file mode 100644
+index 000000000..2c55ba7d6
+--- /dev/null
++++ b/llvm/cmake/modules/testz3.cpp
+@@ -0,0 +1,8 @@
++#include
++#include
++int main() {
++ unsigned int major, minor, build, rev;
++ Z3_get_version(&major, &minor, &build, &rev);
++ printf("%u.%u.%u", major, minor, build);
++ return 0;
++}
diff --git a/ports/llvm-11/CONTROL b/ports/llvm-11/CONTROL
new file mode 100644
index 00000000..8dc81661
--- /dev/null
+++ b/ports/llvm-11/CONTROL
@@ -0,0 +1,124 @@
+Source: llvm-11
+Version: 11.0.0
+Homepage: https://llvm.org/
+Description: The LLVM Compiler Infrastructure
+Supports: !uwp
+Default-Features: tools, clang, enable-rtti, enable-z3, disable-assertions, disable-abi-breaking-checks, disable-terminfo, libcxx, libcxxabi, target-aarch64, target-arm, target-nvptx, target-sparc, target-x86
+
+Feature: tools
+Description: Build LLVM tools.
+
+Feature: utils
+Description: Build LLVM utils.
+
+Feature: default-targets
+Description: Build with platform-specific default targets
+Build-Depends: llvm-11[core,target-x86] (x86|x64), llvm-11[core,target-arm] (arm&!arm64), llvm-11[core,target-aarch64] (arm64), llvm-11[core,target-all] (!x86&!x64&!arm&!arm64)
+
+Feature: target-all
+Description: Build with all backends.
+Build-Depends: llvm-11[core,target-aarch64,target-amdgpu,target-arm,target-bpf,target-hexagon,target-lanai,target-mips,target-msp430,target-nvptx,target-powerpc,target-riscv,target-sparc,target-systemz,target-webassembly,target-x86,target-xcore]
+
+Feature: target-aarch64
+Description: Build with AArch64 backend.
+
+Feature: target-amdgpu
+Description: Build with AMDGPU backend.
+
+Feature: target-arm
+Description: Build with ARM backend.
+
+Feature: target-bpf
+Description: Build with BPF backend.
+
+Feature: target-hexagon
+Description: Build with Hexagon backend.
+
+Feature: target-lanai
+Description: Build with Lanai backend.
+
+Feature: target-mips
+Description: Build with Mips backend.
+
+Feature: target-msp430
+Description: Build with MSP430 backend.
+
+Feature: target-nvptx
+Description: Build with NVPTX backend.
+
+Feature: target-powerpc
+Description: Build with PowerPC backend.
+
+Feature: target-riscv
+Description: Build with RISCV backend.
+
+Feature: target-sparc
+Description: Build with Sparc backend.
+
+Feature: target-systemz
+Description: Build with SystemZ backend.
+
+Feature: target-webassembly
+Description: Build with WebAssembly backend.
+
+Feature: target-x86
+Description: Build with X86 backend.
+
+Feature: target-xcore
+Description: Build with XCore backend.
+
+Feature: enable-rtti
+Description: Build LLVM with run-time type information.
+
+Feature: enable-assertions
+Description: Build LLVM with assertions.
+
+Feature: disable-assertions
+Description: Build LLVM without assertions.
+
+Feature: enable-terminfo
+Description: Build LLVM with linking to terminfo.
+Build-Depends: ncurses
+
+Feature: disable-terminfo
+Description: Build LLVM without linking to terminfo.
+
+Feature: enable-abi-breaking-checks
+Description: Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_ON.
+
+Feature: disable-abi-breaking-checks
+Description: Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_OFF.
+
+Feature: clang
+Description: Build C Language Family Front-end.
+
+Feature: disable-clang-static-analyzer
+Description: Build without static analyzer.
+
+Feature: clang-tools-extra
+Description: Build Clang tools.
+
+Feature: compiler-rt
+Description: Build compiler's runtime libraries.
+
+Feature: lld
+Description: Build LLVM linker.
+
+Feature: openmp
+Description: Build LLVM OpenMP libraries.
+
+Feature: lldb
+Description: Build LLDB debugger.
+
+Feature: polly
+Description: Build polyhedral optimizations for LLVM.
+
+Feature: enable-z3
+Description: Compile with Z3 SMT solver support for Clang static analyzer.
+Build-Depends: z3, llvm-11[core,clang]
+
+Feature: libcxx
+Description: Build libcxx runtime
+
+Feature: libcxxabi
+Description: Build libcxxabi runtime
diff --git a/ports/llvm-11/LICENSE b/ports/llvm-11/LICENSE
new file mode 100644
index 00000000..37eb2583
--- /dev/null
+++ b/ports/llvm-11/LICENSE
@@ -0,0 +1,23 @@
+Copyright (c) Microsoft Corporation
+
+All rights reserved.
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/ports/llvm-11/NOTICE b/ports/llvm-11/NOTICE
new file mode 100644
index 00000000..fd6b68ae
--- /dev/null
+++ b/ports/llvm-11/NOTICE
@@ -0,0 +1,2 @@
+This directory was initially copied from ports/llvm/portfile.cmake
+https://github.com/microsoft/vcpkg/tree/7e3d3beac5ca6fe8aab4599d4e1d8ce270ccdea8
diff --git a/ports/llvm-11/portfile.cmake b/ports/llvm-11/portfile.cmake
new file mode 100644
index 00000000..da0a5af5
--- /dev/null
+++ b/ports/llvm-11/portfile.cmake
@@ -0,0 +1,260 @@
+set(LLVM_VERSION "11.0.0")
+
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO llvm/llvm-project
+ REF llvmorg-${LLVM_VERSION}
+ SHA512 b6d38871ccce0e086e27d35e42887618d68e57d8274735c59e3eabc42dee352412489296293f8d5169fe0044936345915ee7da61ebdc64ec10f7737f6ecd90f2
+ HEAD_REF master
+ PATCHES
+ 0001-allow-to-use-commas.patch
+ 0002-fix-install-paths.patch
+ 0004-fix-dr-1734.patch
+ 0005-remove-FindZ3.cmake.patch
+ 0006-fix-FindZ3.cmake.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ tools LLVM_BUILD_TOOLS
+ tools LLVM_INCLUDE_TOOLS
+ utils LLVM_BUILD_UTILS
+ utils LLVM_INCLUDE_UTILS
+ enable-rtti LLVM_ENABLE_RTTI
+ enable-z3 LLVM_ENABLE_Z3_SOLVER
+)
+
+# Linking with gold is better
+if(VCPKG_TARGET_IS_LINUX)
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_USE_LINKER=gold
+ )
+endif()
+
+# By default assertions are enabled for Debug configuration only.
+if("enable-assertions" IN_LIST FEATURES)
+ # Force enable assertions for all configurations.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ )
+elseif("disable-assertions" IN_LIST FEATURES)
+ # Force disable assertions for all configurations.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ENABLE_ASSERTIONS=OFF
+ )
+endif()
+
+if("enable-terminfo" IN_LIST FEATURES)
+ # Force enable terminfo for all configurations.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ENABLE_TERMINFO=ON
+ )
+elseif("disable-terminfo" IN_LIST FEATURES)
+ # Force disable terminfo for all configurations.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ENABLE_TERMINFO=OFF
+ )
+endif()
+
+# LLVM_ABI_BREAKING_CHECKS can be WITH_ASSERTS (default), FORCE_ON or FORCE_OFF.
+# By default abi-breaking checks are enabled if assertions are enabled.
+if("enable-abi-breaking-checks" IN_LIST FEATURES)
+ # Force enable abi-breaking checks.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ABI_BREAKING_CHECKS=FORCE_ON
+ )
+elseif("disable-abi-breaking-checks" IN_LIST FEATURES)
+ # Force disable abi-breaking checks.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF
+ )
+endif()
+
+set(LLVM_ENABLE_PROJECTS)
+if("clang" IN_LIST FEATURES OR "clang-tools-extra" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "clang")
+ if("disable-clang-static-analyzer" IN_LIST FEATURES)
+ list(APPEND FEATURE_OPTIONS
+ # Disable ARCMT
+ -DCLANG_ENABLE_ARCMT=OFF
+ # Disable static analyzer
+ -DCLANG_ENABLE_STATIC_ANALYZER=OFF
+ )
+ endif()
+ if(VCPKG_TARGET_IS_WINDOWS)
+ list(APPEND FEATURE_OPTIONS
+ # Disable dl library on Windows
+ -DDL_LIBRARY_PATH:FILEPATH=
+ )
+ elseif(VCPKG_TARGET_IS_OSX)
+ list(APPEND FEATURE_OPTIONS
+ -DDEFAULT_SYSROOT:FILEPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
+ -DLLVM_CREATE_XCODE_TOOLCHAIN=ON
+ )
+ endif()
+endif()
+if("clang-tools-extra" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "clang-tools-extra")
+endif()
+if("compiler-rt" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "compiler-rt")
+endif()
+if("libcxx" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "libcxx")
+ list(APPEND FEATURE_OPTIONS
+ -DLIBCXX_ENABLE_STATIC=YES
+ -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=YES
+ -DLIBCXX_ENABLE_FILESYSTEM=YES
+ -DLIBCXX_INCLUDE_BENCHMARKS=NO
+ )
+ if(VCPKG_TARGET_IS_LINUX)
+ list(APPEND FEATURE_OPTIONS
+ # Broken on Linux when set to YES
+ # Error on installing shared debug lib
+ -DLIBCXX_ENABLE_SHARED=NO
+ )
+ else()
+ list(APPEND FEATURE_OPTIONS
+ -DLIBCXX_ENABLE_SHARED=YES
+ )
+ endif()
+endif()
+if("libcxxabi" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "libcxxabi")
+endif()
+if("lld" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "lld")
+endif()
+if("openmp" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "openmp")
+ # Perl is required for the OpenMP run-time
+ vcpkg_find_acquire_program(PERL)
+ list(APPEND FEATURE_OPTIONS
+ -DPERL_EXECUTABLE=${PERL}
+ )
+endif()
+if("lldb" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "lldb")
+endif()
+if("polly" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "polly")
+endif()
+
+set(known_llvm_targets
+ AArch64 AMDGPU ARM BPF Hexagon Lanai Mips
+ MSP430 NVPTX PowerPC RISCV Sparc SystemZ
+ WebAssembly X86 XCore)
+
+set(LLVM_TARGETS_TO_BUILD "")
+foreach(llvm_target IN LISTS known_llvm_targets)
+ string(TOLOWER "target-${llvm_target}" feature_name)
+ if(feature_name IN_LIST FEATURES)
+ list(APPEND LLVM_TARGETS_TO_BUILD "${llvm_target}")
+ endif()
+endforeach()
+
+# Use comma-separated string instead of semicolon-separated string.
+# See https://github.com/microsoft/vcpkg/issues/4320
+string(REPLACE ";" "," LLVM_ENABLE_PROJECTS "${LLVM_ENABLE_PROJECTS}")
+string(REPLACE ";" "," LLVM_TARGETS_TO_BUILD "${LLVM_TARGETS_TO_BUILD}")
+
+vcpkg_find_acquire_program(PYTHON3)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}/llvm
+ PREFER_NINJA
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DLLVM_INCLUDE_EXAMPLES=OFF
+ -DLLVM_BUILD_EXAMPLES=OFF
+ -DLLVM_INCLUDE_TESTS=OFF
+ -DLLVM_BUILD_TESTS=OFF
+ # Disable optional dependencies to libxml2, zlib, and libedit
+ -DLLVM_ENABLE_LIBXML2=OFF
+ -DLLVM_ENABLE_ZLIB=OFF
+ -DLLVM_ENABLE_LIBEDIT=OFF
+ # From llvm-9 onwards
+ -DCMAKE_CXX_STANDARD=14
+ # Force TableGen to be built with optimization. This will significantly improve build time.
+ -DLLVM_OPTIMIZED_TABLEGEN=ON
+ # LLVM generates CMake error due to Visual Studio version 16.4 is known to miscompile part of LLVM.
+ # LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON disables this error.
+ # See https://developercommunity.visualstudio.com/content/problem/845933/miscompile-boolean-condition-deduced-to-be-always.html
+ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON
+ -DLLVM_ENABLE_PROJECTS=${LLVM_ENABLE_PROJECTS}
+ -DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}
+ -DPACKAGE_VERSION=${LLVM_VERSION}
+ -DPYTHON_EXECUTABLE=${PYTHON3}
+ # Limit the maximum number of concurrent link jobs to 2. This should fix low amount of memory issue for link.
+ -DLLVM_PARALLEL_LINK_JOBS=2
+ # Disable build LLVM-C.dll (Windows only) due to doesn't compile with CMAKE_DEBUG_POSTFIX
+ -DLLVM_BUILD_LLVM_C_DYLIB=OFF
+ -DCMAKE_DEBUG_POSTFIX=d
+)
+
+vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/llvm TARGET_PATH share/llvm)
+if("clang" IN_LIST FEATURES)
+ vcpkg_fixup_cmake_targets(CONFIG_PATH share/clang TARGET_PATH share/clang)
+endif()
+
+if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
+ file(GLOB_RECURSE _llvm_release_targets
+ "${CURRENT_PACKAGES_DIR}/share/llvm/*-release.cmake"
+ )
+ set(_clang_release_targets)
+ if("clang" IN_LIST FEATURES)
+ file(GLOB_RECURSE _clang_release_targets
+ "${CURRENT_PACKAGES_DIR}/share/clang/*-release.cmake"
+ )
+ endif()
+ foreach(_target IN LISTS _llvm_release_targets _clang_release_targets)
+ file(READ ${_target} _contents)
+ # LLVM tools should be located in the bin folder because llvm-config expects to be inside a bin dir.
+ # Rename `/tools/${PORT}` to `/bin` back because there is no way to avoid this in vcpkg_fixup_cmake_targets.
+ string(REPLACE "{_IMPORT_PREFIX}/tools/${PORT}" "{_IMPORT_PREFIX}/bin" _contents "${_contents}")
+ file(WRITE ${_target} "${_contents}")
+ endforeach()
+endif()
+
+if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ file(GLOB_RECURSE _llvm_debug_targets
+ "${CURRENT_PACKAGES_DIR}/share/llvm/*-debug.cmake"
+ )
+ set(_clang_debug_targets)
+ if("clang" IN_LIST FEATURES)
+ file(GLOB_RECURSE _clang_debug_targets
+ "${CURRENT_PACKAGES_DIR}/share/clang/*-debug.cmake"
+ )
+ endif()
+ foreach(_target IN LISTS _llvm_debug_targets _clang_debug_targets)
+ file(READ ${_target} _contents)
+ # LLVM tools should be located in the bin folder because llvm-config expects to be inside a bin dir.
+ # Rename `/tools/${PORT}` to `/bin` back because there is no way to avoid this in vcpkg_fixup_cmake_targets.
+ string(REPLACE "{_IMPORT_PREFIX}/tools/${PORT}" "{_IMPORT_PREFIX}/bin" _contents "${_contents}")
+ # Debug shared libraries should have `d` suffix and should be installed in the `/bin` directory.
+ # Rename `/debug/bin/` to `/bin`
+ string(REPLACE "{_IMPORT_PREFIX}/debug/bin/" "{_IMPORT_PREFIX}/bin/" _contents "${_contents}")
+ file(WRITE ${_target} "${_contents}")
+ endforeach()
+
+ # Install debug shared libraries in the `/bin` directory
+ file(GLOB _debug_shared_libs ${CURRENT_PACKAGES_DIR}/debug/bin/*${CMAKE_SHARED_LIBRARY_SUFFIX})
+ file(INSTALL ${_debug_shared_libs} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+
+ file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/bin
+ ${CURRENT_PACKAGES_DIR}/debug/include
+ ${CURRENT_PACKAGES_DIR}/debug/share
+ )
+endif()
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/llvm/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
+if("clang" IN_LIST FEATURES)
+ file(INSTALL ${SOURCE_PATH}/clang/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/clang RENAME copyright)
+endif()
+
+# Don't fail if the bin folder exists.
+set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
diff --git a/ports/llvm-9/0001-allow-to-use-commas.patch b/ports/llvm-9/0001-allow-to-use-commas.patch
new file mode 100644
index 00000000..ee24928a
--- /dev/null
+++ b/ports/llvm-9/0001-allow-to-use-commas.patch
@@ -0,0 +1,30 @@
+diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
+index 15f1311ec3a..ad1bf293a99 100644
+--- a/llvm/CMakeLists.txt
++++ b/llvm/CMakeLists.txt
+@@ -66,6 +66,12 @@ if( LLVM_ENABLE_PROJECTS STREQUAL "all" )
+ set( LLVM_ENABLE_PROJECTS ${LLVM_ALL_PROJECTS})
+ endif()
+
++# Allow to use commas in LLVM_ENABLE_PROJECTS ("llvm,clang,...")
++string(REPLACE "," ";" fixed_LLVM_ENABLE_PROJECTS "${LLVM_ENABLE_PROJECTS}")
++if(NOT fixed_LLVM_ENABLE_PROJECTS STREQUAL LLVM_ENABLE_PROJECTS)
++ set(LLVM_ENABLE_PROJECTS "${fixed_LLVM_ENABLE_PROJECTS}" CACHE STRING "" FORCE)
++endif()
++
+ # LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the
+ # `LLVM_ENABLE_PROJECTS` CMake cache variable. This exists for
+ # several reasons:
+@@ -372,6 +378,12 @@ set(LLVM_TARGETS_TO_BUILD
+ ${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD})
+ list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD)
+
++# Allow to use commas in the LLVM_TARGETS_TO_BUILD ("X86,AArch64,...")
++string(REPLACE "," ";" fixed_LLVM_TARGETS_TO_BUILD "${LLVM_TARGETS_TO_BUILD}")
++if(NOT fixed_LLVM_TARGETS_TO_BUILD STREQUAL LLVM_TARGETS_TO_BUILD)
++ set(LLVM_TARGETS_TO_BUILD "${fixed_LLVM_TARGETS_TO_BUILD}" CACHE STRING "" FORCE)
++endif()
++
+ option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
+ option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
+ option(LLVM_ENABLE_MODULES "Compile with C++ modules enabled." OFF)
diff --git a/ports/llvm-9/0002-fix-install-paths.patch b/ports/llvm-9/0002-fix-install-paths.patch
new file mode 100644
index 00000000..5e63424a
--- /dev/null
+++ b/ports/llvm-9/0002-fix-install-paths.patch
@@ -0,0 +1,42 @@
+diff --git a/clang/cmake/modules/CMakeLists.txt b/clang/cmake/modules/CMakeLists.txt
+index d233f552f01..26f502ad2d2 100644
+--- a/clang/cmake/modules/CMakeLists.txt
++++ b/clang/cmake/modules/CMakeLists.txt
+@@ -1,11 +1,11 @@
+ # Generate a list of CMake library targets so that other CMake projects can
+ # link against them. LLVM calls its version of this file LLVMExports.cmake, but
+ # the usual CMake convention seems to be ${Project}Targets.cmake.
+-set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang)
++set(CLANG_INSTALL_PACKAGE_DIR share/clang)
+ set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}")
+
+ # Keep this in sync with llvm/cmake/CMakeLists.txt!
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS)
+diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt
+index 9cf22b436fa..8eeb27d1794 100644
+--- a/llvm/cmake/modules/CMakeLists.txt
++++ b/llvm/cmake/modules/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
+diff --git a/polly/cmake/CMakeLists.txt b/polly/cmake/CMakeLists.txt
+index 211f9551271..2abe3803f91 100644
+--- a/polly/cmake/CMakeLists.txt
++++ b/polly/cmake/CMakeLists.txt
+@@ -1,7 +1,7 @@
+ # Keep this in sync with llvm/cmake/CMakeLists.txt!
+
+-set(LLVM_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+-set(POLLY_INSTALL_PACKAGE_DIR "lib${LLVM_LIBDIR_SUFFIX}/cmake/polly")
++set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
++set(POLLY_INSTALL_PACKAGE_DIR share/polly)
+ if (CMAKE_CONFIGURATION_TYPES)
+ set(POLLY_EXPORTS_FILE_NAME "PollyExports-$>.cmake")
+ else()
diff --git a/ports/llvm-9/0004-fix-dr-1734.patch b/ports/llvm-9/0004-fix-dr-1734.patch
new file mode 100644
index 00000000..adfbe5a1
--- /dev/null
+++ b/ports/llvm-9/0004-fix-dr-1734.patch
@@ -0,0 +1,14 @@
+diff --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h
+index b7d48e8e1ad..53ba24efc00 100644
+--- a/llvm/include/llvm/Support/type_traits.h
++++ b/llvm/include/llvm/Support/type_traits.h
+@@ -177,7 +177,8 @@ class is_trivially_copyable {
+ (has_deleted_copy_assign || has_trivial_copy_assign) &&
+ (has_deleted_copy_constructor || has_trivial_copy_constructor);
+
+-#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE
++ // due to DR 1734, a type can be std::is_trivially_copyable but not llvm::is_trivially_copyable
++#if 0
+ static_assert(value == std::is_trivially_copyable::value,
+ "inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable");
+ #endif
diff --git a/ports/llvm-9/0005-remove-FindZ3.cmake.patch b/ports/llvm-9/0005-remove-FindZ3.cmake.patch
new file mode 100644
index 00000000..8d72bd3e
--- /dev/null
+++ b/ports/llvm-9/0005-remove-FindZ3.cmake.patch
@@ -0,0 +1,116 @@
+diff --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake
+deleted file mode 100644
+index 04294275535..00000000000
+--- a/llvm/cmake/modules/FindZ3.cmake
++++ /dev/null
+@@ -1,110 +0,0 @@
+-INCLUDE(CheckCXXSourceRuns)
+-
+-# Function to check Z3's version
+-function(check_z3_version z3_include z3_lib)
+- # The program that will be executed to print Z3's version.
+- file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testz3.c
+- "#include
+- #include
+- int main() {
+- unsigned int major, minor, build, rev;
+- Z3_get_version(&major, &minor, &build, &rev);
+- printf(\"%u.%u.%u\", major, minor, build);
+- return 0;
+- }")
+-
+- # Get lib path
+- get_filename_component(z3_lib_path ${z3_lib} PATH)
+-
+- try_run(
+- Z3_RETURNCODE
+- Z3_COMPILED
+- ${CMAKE_BINARY_DIR}
+- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testz3.c
+- COMPILE_DEFINITIONS -I"${z3_include}"
+- LINK_LIBRARIES -L${z3_lib_path} -lz3
+- RUN_OUTPUT_VARIABLE SRC_OUTPUT
+- )
+-
+- if(Z3_COMPILED)
+- string(REGEX REPLACE "([0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*)" "\\1"
+- z3_version "${SRC_OUTPUT}")
+- set(Z3_VERSION_STRING ${z3_version} PARENT_SCOPE)
+- endif()
+-endfunction(check_z3_version)
+-
+-# Looking for Z3 in LLVM_Z3_INSTALL_DIR
+-find_path(Z3_INCLUDE_DIR NAMES z3.h
+- NO_DEFAULT_PATH
+- PATHS ${LLVM_Z3_INSTALL_DIR}/include
+- PATH_SUFFIXES libz3 z3
+- )
+-
+-find_library(Z3_LIBRARIES NAMES z3 libz3
+- NO_DEFAULT_PATH
+- PATHS ${LLVM_Z3_INSTALL_DIR}
+- PATH_SUFFIXES lib bin
+- )
+-
+-# If Z3 has not been found in LLVM_Z3_INSTALL_DIR look in the default directories
+-find_path(Z3_INCLUDE_DIR NAMES z3.h
+- PATH_SUFFIXES libz3 z3
+- )
+-
+-find_library(Z3_LIBRARIES NAMES z3 libz3
+- PATH_SUFFIXES lib bin
+- )
+-
+-# Searching for the version of the Z3 library is a best-effort task
+-unset(Z3_VERSION_STRING)
+-
+-# First, try to check it dynamically, by compiling a small program that
+-# prints Z3's version
+-if(Z3_INCLUDE_DIR AND Z3_LIBRARIES)
+- # We do not have the Z3 binary to query for a version. Try to use
+- # a small C++ program to detect it via the Z3_get_version() API call.
+- check_z3_version(${Z3_INCLUDE_DIR} ${Z3_LIBRARIES})
+-endif()
+-
+-# If the dynamic check fails, we might be cross compiling: if that's the case,
+-# check the version in the headers, otherwise, fail with a message
+-if(NOT Z3_VERSION_STRING AND (CMAKE_CROSSCOMPILING AND
+- Z3_INCLUDE_DIR AND
+- EXISTS "${Z3_INCLUDE_DIR}/z3_version.h"))
+- # TODO: print message warning that we couldn't find a compatible lib?
+-
+- # Z3 4.8.1+ has the version is in a public header.
+- file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
+- z3_version_str REGEX "^#define[\t ]+Z3_MAJOR_VERSION[\t ]+.*")
+- string(REGEX REPLACE "^.*Z3_MAJOR_VERSION[\t ]+([0-9]).*$" "\\1"
+- Z3_MAJOR "${z3_version_str}")
+-
+- file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
+- z3_version_str REGEX "^#define[\t ]+Z3_MINOR_VERSION[\t ]+.*")
+- string(REGEX REPLACE "^.*Z3_MINOR_VERSION[\t ]+([0-9]).*$" "\\1"
+- Z3_MINOR "${z3_version_str}")
+-
+- file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
+- z3_version_str REGEX "^#define[\t ]+Z3_BUILD_NUMBER[\t ]+.*")
+- string(REGEX REPLACE "^.*Z3_BUILD_VERSION[\t ]+([0-9]).*$" "\\1"
+- Z3_BUILD "${z3_version_str}")
+-
+- set(Z3_VERSION_STRING ${Z3_MAJOR}.${Z3_MINOR}.${Z3_BUILD})
+- unset(z3_version_str)
+-endif()
+-
+-if(NOT Z3_VERSION_STRING)
+- # Give up: we are unable to obtain a version of the Z3 library. Be
+- # conservative and force the found version to 0.0.0 to make version
+- # checks always fail.
+- set(Z3_VERSION_STRING "0.0.0")
+-endif()
+-
+-# handle the QUIETLY and REQUIRED arguments and set Z3_FOUND to TRUE if
+-# all listed variables are TRUE
+-include(FindPackageHandleStandardArgs)
+-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3
+- REQUIRED_VARS Z3_LIBRARIES Z3_INCLUDE_DIR
+- VERSION_VAR Z3_VERSION_STRING)
+-
+-mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBRARIES)
diff --git a/ports/llvm-9/0006-fix-FindZ3.cmake.patch b/ports/llvm-9/0006-fix-FindZ3.cmake.patch
new file mode 100644
index 00000000..f8412194
--- /dev/null
+++ b/ports/llvm-9/0006-fix-FindZ3.cmake.patch
@@ -0,0 +1,132 @@
+diff --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake
+new file mode 100644
+index 000000000..32f6f4160
+--- /dev/null
++++ b/llvm/cmake/modules/FindZ3.cmake
+@@ -0,0 +1,112 @@
++INCLUDE(CheckCXXSourceRuns)
++
++# Function to check Z3's version
++function(check_z3_version z3_include z3_lib)
++ # Get lib path
++ get_filename_component(z3_lib_path ${z3_lib} PATH)
++
++ # Try to find a threading module in case Z3 was built with threading support.
++ # Threads are required elsewhere in LLVM, but not marked as required here because
++ # Z3 could have been compiled without threading support.
++ find_package(Threads)
++ set(z3_link_libs "-lz3" "${CMAKE_THREAD_LIBS_INIT}")
++
++ try_run(
++ Z3_RETURNCODE
++ Z3_COMPILED
++ ${CMAKE_BINARY_DIR}
++ ${CMAKE_SOURCE_DIR}/cmake/modules/testz3.cpp
++ COMPILE_DEFINITIONS -I"${z3_include}"
++ LINK_LIBRARIES -L${z3_lib_path} ${z3_link_libs}
++ RUN_OUTPUT_VARIABLE SRC_OUTPUT
++ )
++
++ if(Z3_COMPILED)
++ string(REGEX REPLACE "([0-9]*\\.[0-9]*\\.[0-9]*)" "\\1"
++ z3_version "${SRC_OUTPUT}")
++ set(Z3_VERSION_STRING ${z3_version} PARENT_SCOPE)
++ endif()
++endfunction(check_z3_version)
++
++# Looking for Z3 in LLVM_Z3_INSTALL_DIR
++find_path(Z3_INCLUDE_DIR NAMES z3.h
++ NO_DEFAULT_PATH
++ PATHS ${LLVM_Z3_INSTALL_DIR}/include
++ PATH_SUFFIXES libz3 z3
++ )
++
++find_library(Z3_LIBS NAMES z3 libz3
++ NO_DEFAULT_PATH
++ PATHS ${LLVM_Z3_INSTALL_DIR}
++ PATH_SUFFIXES lib bin
++ )
++
++# If Z3 has not been found in LLVM_Z3_INSTALL_DIR look in the default directories
++find_path(Z3_INCLUDE_DIR NAMES z3.h
++ PATH_SUFFIXES libz3 z3
++ )
++
++find_library(Z3_LIBS NAMES z3 libz3
++ PATH_SUFFIXES lib bin
++ )
++
++# Searching for the version of the Z3 library is a best-effort task
++unset(Z3_VERSION_STRING)
++
++# First, try to check it dynamically, by compiling a small program that
++# prints Z3's version
++if(Z3_INCLUDE_DIR AND Z3_LIBS)
++ # We do not have the Z3 binary to query for a version. Try to use
++ # a small C++ program to detect it via the Z3_get_version() API call.
++ check_z3_version(${Z3_INCLUDE_DIR} ${Z3_LIBS})
++endif()
++
++# If the dynamic check fails, we might be cross compiling: if that's the case,
++# check the version in the headers, otherwise, fail with a message
++if(NOT Z3_VERSION_STRING AND (CMAKE_CROSSCOMPILING AND
++ Z3_INCLUDE_DIR AND
++ EXISTS "${Z3_INCLUDE_DIR}/z3_version.h"))
++ # TODO: print message warning that we couldn't find a compatible lib?
++
++ # Z3 4.8.1+ has the version is in a public header.
++ file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
++ z3_version_str REGEX "^#define[\t ]+Z3_MAJOR_VERSION[\t ]+.*")
++ string(REGEX REPLACE "^.*Z3_MAJOR_VERSION[\t ]+([0-9]).*$" "\\1"
++ Z3_MAJOR "${z3_version_str}")
++
++ file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
++ z3_version_str REGEX "^#define[\t ]+Z3_MINOR_VERSION[\t ]+.*")
++ string(REGEX REPLACE "^.*Z3_MINOR_VERSION[\t ]+([0-9]).*$" "\\1"
++ Z3_MINOR "${z3_version_str}")
++
++ file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
++ z3_version_str REGEX "^#define[\t ]+Z3_BUILD_NUMBER[\t ]+.*")
++ string(REGEX REPLACE "^.*Z3_BUILD_VERSION[\t ]+([0-9]).*$" "\\1"
++ Z3_BUILD "${z3_version_str}")
++
++ set(Z3_VERSION_STRING ${Z3_MAJOR}.${Z3_MINOR}.${Z3_BUILD})
++ unset(z3_version_str)
++endif()
++
++if(NOT Z3_VERSION_STRING)
++ # Give up: we are unable to obtain a version of the Z3 library. Be
++ # conservative and force the found version to 0.0.0 to make version
++ # checks always fail.
++ set(Z3_VERSION_STRING "0.0.0")
++endif()
++
++# handle the QUIETLY and REQUIRED arguments and set Z3_FOUND to TRUE if
++# all listed variables are TRUE
++include(FindPackageHandleStandardArgs)
++FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3
++ REQUIRED_VARS Z3_LIBS Z3_INCLUDE_DIR
++ VERSION_VAR Z3_VERSION_STRING)
++if(Z3_FOUND AND NOT TARGET Z3)
++ add_library(Z3 UNKNOWN IMPORTED)
++ set_target_properties(Z3 PROPERTIES
++ INTERFACE_INCLUDE_DIRECTORIES "${Z3_INCLUDE_DIR}"
++ IMPORTED_LOCATION "${Z3_LIBS}"
++ )
++ set(Z3_LIBRARIES "Z3")
++endif()
++mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBS Z3_LIBRARIES)
+diff --git a/llvm/cmake/modules/testz3.cpp b/llvm/cmake/modules/testz3.cpp
+new file mode 100644
+index 000000000..2c55ba7d6
+--- /dev/null
++++ b/llvm/cmake/modules/testz3.cpp
+@@ -0,0 +1,8 @@
++#include
++#include
++int main() {
++ unsigned int major, minor, build, rev;
++ Z3_get_version(&major, &minor, &build, &rev);
++ printf("%u.%u.%u", major, minor, build);
++ return 0;
++}
diff --git a/ports/llvm-9/CONTROL b/ports/llvm-9/CONTROL
new file mode 100644
index 00000000..a7767f89
--- /dev/null
+++ b/ports/llvm-9/CONTROL
@@ -0,0 +1,124 @@
+Source: llvm-9
+Version: 9.0.0
+Homepage: https://llvm.org/
+Description: The LLVM Compiler Infrastructure
+Supports: !uwp
+Default-Features: tools, clang, enable-rtti, enable-z3, disable-assertions, disable-abi-breaking-checks, disable-terminfo, libcxx, libcxxabi, target-aarch64, target-arm, target-nvptx, target-sparc, target-x86
+
+Feature: tools
+Description: Build LLVM tools.
+
+Feature: utils
+Description: Build LLVM utils.
+
+Feature: default-targets
+Description: Build with platform-specific default targets
+Build-Depends: llvm-9[core,target-x86] (x86|x64), llvm-9[core,target-arm] (arm&!arm64), llvm-9[core,target-aarch64] (arm64), llvm-9[core,target-all] (!x86&!x64&!arm&!arm64)
+
+Feature: target-all
+Description: Build with all backends.
+Build-Depends: llvm-9[core,target-aarch64,target-amdgpu,target-arm,target-bpf,target-hexagon,target-lanai,target-mips,target-msp430,target-nvptx,target-powerpc,target-riscv,target-sparc,target-systemz,target-webassembly,target-x86,target-xcore]
+
+Feature: target-aarch64
+Description: Build with AArch64 backend.
+
+Feature: target-amdgpu
+Description: Build with AMDGPU backend.
+
+Feature: target-arm
+Description: Build with ARM backend.
+
+Feature: target-bpf
+Description: Build with BPF backend.
+
+Feature: target-hexagon
+Description: Build with Hexagon backend.
+
+Feature: target-lanai
+Description: Build with Lanai backend.
+
+Feature: target-mips
+Description: Build with Mips backend.
+
+Feature: target-msp430
+Description: Build with MSP430 backend.
+
+Feature: target-nvptx
+Description: Build with NVPTX backend.
+
+Feature: target-powerpc
+Description: Build with PowerPC backend.
+
+Feature: target-riscv
+Description: Build with RISCV backend.
+
+Feature: target-sparc
+Description: Build with Sparc backend.
+
+Feature: target-systemz
+Description: Build with SystemZ backend.
+
+Feature: target-webassembly
+Description: Build with WebAssembly backend.
+
+Feature: target-x86
+Description: Build with X86 backend.
+
+Feature: target-xcore
+Description: Build with XCore backend.
+
+Feature: enable-rtti
+Description: Build LLVM with run-time type information.
+
+Feature: enable-assertions
+Description: Build LLVM with assertions.
+
+Feature: disable-assertions
+Description: Build LLVM without assertions.
+
+Feature: enable-terminfo
+Description: Build LLVM with linking to terminfo.
+Build-Depends: ncurses
+
+Feature: disable-terminfo
+Description: Build LLVM without linking to terminfo.
+
+Feature: enable-abi-breaking-checks
+Description: Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_ON.
+
+Feature: disable-abi-breaking-checks
+Description: Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_OFF.
+
+Feature: clang
+Description: Build C Language Family Front-end.
+
+Feature: disable-clang-static-analyzer
+Description: Build without static analyzer.
+
+Feature: clang-tools-extra
+Description: Build Clang tools.
+
+Feature: compiler-rt
+Description: Build compiler's runtime libraries.
+
+Feature: lld
+Description: Build LLVM linker.
+
+Feature: openmp
+Description: Build LLVM OpenMP libraries.
+
+Feature: lldb
+Description: Build LLDB debugger.
+
+Feature: polly
+Description: Build polyhedral optimizations for LLVM.
+
+Feature: enable-z3
+Description: Compile with Z3 SMT solver support for Clang static analyzer.
+Build-Depends: z3, llvm-9[core,clang]
+
+Feature: libcxx
+Description: Build libcxx runtime
+
+Feature: libcxxabi
+Description: Build libcxxabi runtime
diff --git a/ports/llvm-9/LICENSE b/ports/llvm-9/LICENSE
new file mode 100644
index 00000000..37eb2583
--- /dev/null
+++ b/ports/llvm-9/LICENSE
@@ -0,0 +1,23 @@
+Copyright (c) Microsoft Corporation
+
+All rights reserved.
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/ports/llvm-9/NOTICE b/ports/llvm-9/NOTICE
new file mode 100644
index 00000000..fd6b68ae
--- /dev/null
+++ b/ports/llvm-9/NOTICE
@@ -0,0 +1,2 @@
+This directory was initially copied from ports/llvm/portfile.cmake
+https://github.com/microsoft/vcpkg/tree/7e3d3beac5ca6fe8aab4599d4e1d8ce270ccdea8
diff --git a/ports/llvm-9/portfile.cmake b/ports/llvm-9/portfile.cmake
new file mode 100644
index 00000000..29e4db16
--- /dev/null
+++ b/ports/llvm-9/portfile.cmake
@@ -0,0 +1,260 @@
+set(LLVM_VERSION "9.0.0")
+
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO llvm/llvm-project
+ REF llvmorg-${LLVM_VERSION}
+ SHA512 2ad844f2d85d6734178a4ad746975a03ea9cda1454f7ea436f0ef8cc3199edec15130e322b4372b28a3178a8033af72d0a907662706cbd282ef57359235225a5
+ HEAD_REF master
+ PATCHES
+ 0001-allow-to-use-commas.patch
+ 0002-fix-install-paths.patch
+ 0004-fix-dr-1734.patch
+ 0005-remove-FindZ3.cmake.patch
+ 0006-fix-FindZ3.cmake.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ tools LLVM_BUILD_TOOLS
+ tools LLVM_INCLUDE_TOOLS
+ utils LLVM_BUILD_UTILS
+ utils LLVM_INCLUDE_UTILS
+ enable-rtti LLVM_ENABLE_RTTI
+ enable-z3 LLVM_ENABLE_Z3_SOLVER
+)
+
+# Linking with gold is better
+if(VCPKG_TARGET_IS_LINUX)
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_USE_LINKER=gold
+ )
+endif()
+
+# By default assertions are enabled for Debug configuration only.
+if("enable-assertions" IN_LIST FEATURES)
+ # Force enable assertions for all configurations.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ENABLE_ASSERTIONS=ON
+ )
+elseif("disable-assertions" IN_LIST FEATURES)
+ # Force disable assertions for all configurations.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ENABLE_ASSERTIONS=OFF
+ )
+endif()
+
+if("enable-terminfo" IN_LIST FEATURES)
+ # Force enable terminfo for all configurations.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ENABLE_TERMINFO=ON
+ )
+elseif("disable-terminfo" IN_LIST FEATURES)
+ # Force disable terminfo for all configurations.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ENABLE_TERMINFO=OFF
+ )
+endif()
+
+# LLVM_ABI_BREAKING_CHECKS can be WITH_ASSERTS (default), FORCE_ON or FORCE_OFF.
+# By default abi-breaking checks are enabled if assertions are enabled.
+if("enable-abi-breaking-checks" IN_LIST FEATURES)
+ # Force enable abi-breaking checks.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ABI_BREAKING_CHECKS=FORCE_ON
+ )
+elseif("disable-abi-breaking-checks" IN_LIST FEATURES)
+ # Force disable abi-breaking checks.
+ list(APPEND FEATURE_OPTIONS
+ -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF
+ )
+endif()
+
+set(LLVM_ENABLE_PROJECTS)
+if("clang" IN_LIST FEATURES OR "clang-tools-extra" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "clang")
+ if("disable-clang-static-analyzer" IN_LIST FEATURES)
+ list(APPEND FEATURE_OPTIONS
+ # Disable ARCMT
+ -DCLANG_ENABLE_ARCMT=OFF
+ # Disable static analyzer
+ -DCLANG_ENABLE_STATIC_ANALYZER=OFF
+ )
+ endif()
+ if(VCPKG_TARGET_IS_WINDOWS)
+ list(APPEND FEATURE_OPTIONS
+ # Disable dl library on Windows
+ -DDL_LIBRARY_PATH:FILEPATH=
+ )
+ elseif(VCPKG_TARGET_IS_OSX)
+ list(APPEND FEATURE_OPTIONS
+ -DDEFAULT_SYSROOT:FILEPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
+ -DLLVM_CREATE_XCODE_TOOLCHAIN=ON
+ )
+ endif()
+endif()
+if("clang-tools-extra" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "clang-tools-extra")
+endif()
+if("compiler-rt" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "compiler-rt")
+endif()
+if("libcxx" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "libcxx")
+ list(APPEND FEATURE_OPTIONS
+ -DLIBCXX_ENABLE_STATIC=YES
+ -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=YES
+ -DLIBCXX_ENABLE_FILESYSTEM=YES
+ -DLIBCXX_INCLUDE_BENCHMARKS=NO
+ )
+ if(VCPKG_TARGET_IS_LINUX)
+ list(APPEND FEATURE_OPTIONS
+ # Broken on Linux when set to YES
+ # Error on installing shared debug lib
+ -DLIBCXX_ENABLE_SHARED=NO
+ )
+ else()
+ list(APPEND FEATURE_OPTIONS
+ -DLIBCXX_ENABLE_SHARED=YES
+ )
+ endif()
+endif()
+if("libcxxabi" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "libcxxabi")
+endif()
+if("lld" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "lld")
+endif()
+if("openmp" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "openmp")
+ # Perl is required for the OpenMP run-time
+ vcpkg_find_acquire_program(PERL)
+ list(APPEND FEATURE_OPTIONS
+ -DPERL_EXECUTABLE=${PERL}
+ )
+endif()
+if("lldb" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "lldb")
+endif()
+if("polly" IN_LIST FEATURES)
+ list(APPEND LLVM_ENABLE_PROJECTS "polly")
+endif()
+
+set(known_llvm_targets
+ AArch64 AMDGPU ARM BPF Hexagon Lanai Mips
+ MSP430 NVPTX PowerPC RISCV Sparc SystemZ
+ WebAssembly X86 XCore)
+
+set(LLVM_TARGETS_TO_BUILD "")
+foreach(llvm_target IN LISTS known_llvm_targets)
+ string(TOLOWER "target-${llvm_target}" feature_name)
+ if(feature_name IN_LIST FEATURES)
+ list(APPEND LLVM_TARGETS_TO_BUILD "${llvm_target}")
+ endif()
+endforeach()
+
+# Use comma-separated string instead of semicolon-separated string.
+# See https://github.com/microsoft/vcpkg/issues/4320
+string(REPLACE ";" "," LLVM_ENABLE_PROJECTS "${LLVM_ENABLE_PROJECTS}")
+string(REPLACE ";" "," LLVM_TARGETS_TO_BUILD "${LLVM_TARGETS_TO_BUILD}")
+
+vcpkg_find_acquire_program(PYTHON3)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}/llvm
+ PREFER_NINJA
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DLLVM_INCLUDE_EXAMPLES=OFF
+ -DLLVM_BUILD_EXAMPLES=OFF
+ -DLLVM_INCLUDE_TESTS=OFF
+ -DLLVM_BUILD_TESTS=OFF
+ # Disable optional dependencies to libxml2, zlib, and libedit
+ -DLLVM_ENABLE_LIBXML2=OFF
+ -DLLVM_ENABLE_ZLIB=OFF
+ -DLLVM_ENABLE_LIBEDIT=OFF
+ # From llvm-9 onwards
+ -DCMAKE_CXX_STANDARD=14
+ # Force TableGen to be built with optimization. This will significantly improve build time.
+ -DLLVM_OPTIMIZED_TABLEGEN=ON
+ # LLVM generates CMake error due to Visual Studio version 16.4 is known to miscompile part of LLVM.
+ # LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON disables this error.
+ # See https://developercommunity.visualstudio.com/content/problem/845933/miscompile-boolean-condition-deduced-to-be-always.html
+ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON
+ -DLLVM_ENABLE_PROJECTS=${LLVM_ENABLE_PROJECTS}
+ -DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}
+ -DPACKAGE_VERSION=${LLVM_VERSION}
+ -DPYTHON_EXECUTABLE=${PYTHON3}
+ # Limit the maximum number of concurrent link jobs to 2. This should fix low amount of memory issue for link.
+ -DLLVM_PARALLEL_LINK_JOBS=2
+ # Disable build LLVM-C.dll (Windows only) due to doesn't compile with CMAKE_DEBUG_POSTFIX
+ -DLLVM_BUILD_LLVM_C_DYLIB=OFF
+ -DCMAKE_DEBUG_POSTFIX=d
+)
+
+vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/llvm TARGET_PATH share/llvm)
+if("clang" IN_LIST FEATURES)
+ vcpkg_fixup_cmake_targets(CONFIG_PATH share/clang TARGET_PATH share/clang)
+endif()
+
+if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
+ file(GLOB_RECURSE _llvm_release_targets
+ "${CURRENT_PACKAGES_DIR}/share/llvm/*-release.cmake"
+ )
+ set(_clang_release_targets)
+ if("clang" IN_LIST FEATURES)
+ file(GLOB_RECURSE _clang_release_targets
+ "${CURRENT_PACKAGES_DIR}/share/clang/*-release.cmake"
+ )
+ endif()
+ foreach(_target IN LISTS _llvm_release_targets _clang_release_targets)
+ file(READ ${_target} _contents)
+ # LLVM tools should be located in the bin folder because llvm-config expects to be inside a bin dir.
+ # Rename `/tools/${PORT}` to `/bin` back because there is no way to avoid this in vcpkg_fixup_cmake_targets.
+ string(REPLACE "{_IMPORT_PREFIX}/tools/${PORT}" "{_IMPORT_PREFIX}/bin" _contents "${_contents}")
+ file(WRITE ${_target} "${_contents}")
+ endforeach()
+endif()
+
+if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ file(GLOB_RECURSE _llvm_debug_targets
+ "${CURRENT_PACKAGES_DIR}/share/llvm/*-debug.cmake"
+ )
+ set(_clang_debug_targets)
+ if("clang" IN_LIST FEATURES)
+ file(GLOB_RECURSE _clang_debug_targets
+ "${CURRENT_PACKAGES_DIR}/share/clang/*-debug.cmake"
+ )
+ endif()
+ foreach(_target IN LISTS _llvm_debug_targets _clang_debug_targets)
+ file(READ ${_target} _contents)
+ # LLVM tools should be located in the bin folder because llvm-config expects to be inside a bin dir.
+ # Rename `/tools/${PORT}` to `/bin` back because there is no way to avoid this in vcpkg_fixup_cmake_targets.
+ string(REPLACE "{_IMPORT_PREFIX}/tools/${PORT}" "{_IMPORT_PREFIX}/bin" _contents "${_contents}")
+ # Debug shared libraries should have `d` suffix and should be installed in the `/bin` directory.
+ # Rename `/debug/bin/` to `/bin`
+ string(REPLACE "{_IMPORT_PREFIX}/debug/bin/" "{_IMPORT_PREFIX}/bin/" _contents "${_contents}")
+ file(WRITE ${_target} "${_contents}")
+ endforeach()
+
+ # Install debug shared libraries in the `/bin` directory
+ file(GLOB _debug_shared_libs ${CURRENT_PACKAGES_DIR}/debug/bin/*${CMAKE_SHARED_LIBRARY_SUFFIX})
+ file(INSTALL ${_debug_shared_libs} DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+
+ file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/bin
+ ${CURRENT_PACKAGES_DIR}/debug/include
+ ${CURRENT_PACKAGES_DIR}/debug/share
+ )
+endif()
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/llvm/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/llvm RENAME copyright)
+if("clang" IN_LIST FEATURES)
+ file(INSTALL ${SOURCE_PATH}/clang/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/clang RENAME copyright)
+endif()
+
+# Don't fail if the bin folder exists.
+set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
diff --git a/ports/remill/portfile.cmake b/ports/remill/portfile.cmake
new file mode 100644
index 00000000..d7c79eda
--- /dev/null
+++ b/ports/remill/portfile.cmake
@@ -0,0 +1,26 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO ekilmer/remill
+ REF abebf20a29456ed2f5229277b575ca4d6859b0b6
+ SHA512 d23a653bbbb2a9d0a36eb8425651154df0bd3339f8286d9e7449b128b6ae045c0aaefc864613910c2cda548d395b1f3c926bbb9b7b58e46657aa6572fa8179f3
+ HEAD_REF vcpkg
+)
+
+# Configure and Build
+vcpkg_configure_cmake(
+ SOURCE_PATH "${SOURCE_PATH}"
+ PREFER_NINJA
+ OPTIONS
+ -DUSE_SYSTEM_DEPENDENCIES=ON
+)
+
+# Install
+vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
+vcpkg_copy_pdbs()
+
+# Cleanup
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
+
+# Don't fail if the bin folder exists.
+set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
diff --git a/ports/remill/vcpkg.json b/ports/remill/vcpkg.json
new file mode 100644
index 00000000..52851b88
--- /dev/null
+++ b/ports/remill/vcpkg.json
@@ -0,0 +1,32 @@
+{
+ "name": "remill",
+ "version-string": "2020-12-05",
+ "description": "Library for lifting of x86, amd64, and aarch64 machine code to LLVM bitcode",
+ "homepage": "https://github.com/lifting-bits/remill",
+ "default-features": [
+ "llvm-10"
+ ],
+ "features": {
+ "llvm-9": {
+ "description": "Use LLVM 9",
+ "dependencies": [
+ "llvm-9"
+ ]
+ },
+ "llvm-10": {
+ "description": "Use LLVM 10",
+ "dependencies": [
+ "llvm-10"
+ ]
+ },
+ "llvm-11": {
+ "description": "Use LLVM 11",
+ "dependencies": [
+ "llvm-11"
+ ]
+ }
+ },
+ "dependencies": [
+ "xed"
+ ]
+}
diff --git a/ports/xed/XEDConfig.cmake b/ports/xed/XEDConfig.cmake
new file mode 100644
index 00000000..d3b5bdab
--- /dev/null
+++ b/ports/xed/XEDConfig.cmake
@@ -0,0 +1,43 @@
+FUNCTION(SET_LIBRARY_TARGET NAMESPACE LIB_NAME LINK_TYPE DEBUG_LIB_FILE_NAME RELEASE_LIB_FILE_NAME INCLUDE_DIR)
+ ADD_LIBRARY(${NAMESPACE}::${LIB_NAME} ${LINK_TYPE} IMPORTED)
+ SET_TARGET_PROPERTIES(${NAMESPACE}::${LIB_NAME} PROPERTIES
+ IMPORTED_CONFIGURATIONS "RELEASE;DEBUG"
+ IMPORTED_LOCATION_RELEASE "${RELEASE_LIB_FILE_NAME}"
+ IMPORTED_LOCATION_DEBUG "${DEBUG_LIB_FILE_NAME}"
+ INTERFACE_INCLUDE_DIRECTORIES "${INCLUDE_DIR}"
+ )
+ SET(${NAMESPACE}_${LIB_NAME}_FOUND 1)
+ENDFUNCTION()
+
+GET_FILENAME_COMPONENT(ROOT "${CMAKE_CURRENT_LIST_FILE}" PATH)
+GET_FILENAME_COMPONENT(ROOT "${ROOT}" PATH)
+GET_FILENAME_COMPONENT(ROOT "${ROOT}" PATH)
+
+set(XED_STATIC_DEBUG_LIB "${ROOT}/debug/lib/libxed${CMAKE_STATIC_LIBRARY_SUFFIX}")
+set(XED_SHARE_DEBUG_LIB "${ROOT}/debug/lib/libxed${CMAKE_SHARED_LIBRARY_SUFFIX}")
+set(ILD_STATIC_DEBUG_LIB "${ROOT}/debug/lib/libxed-ild${CMAKE_STATIC_LIBRARY_SUFFIX}")
+set(ILD_SHARE_DEBUG_LIB "${ROOT}/debug/lib/libxed-ild${CMAKE_SHARED_LIBRARY_SUFFIX}")
+
+set(XED_STATIC_RELEASE_LIB "${ROOT}/lib/libxed${CMAKE_STATIC_LIBRARY_SUFFIX}")
+set(XED_SHARE_RELEASE_LIB "${ROOT}/lib/libxed${CMAKE_SHARED_LIBRARY_SUFFIX}")
+set(ILD_STATIC_RELEASE_LIB "${ROOT}/lib/libxed-ild${CMAKE_STATIC_LIBRARY_SUFFIX}")
+set(ILD_SHARE_RELEASE_LIB "${ROOT}/lib/libxed-ild${CMAKE_SHARED_LIBRARY_SUFFIX}")
+
+# Check for existence of debug libs
+if (NOT EXISTS "${XED_STATIC_DEBUG_LIB}")
+ set(XED_STATIC_DEBUG_LIB "${XED_STATIC_RELEASE_LIB}")
+endif()
+if (NOT EXISTS "${ILD_STATIC_DEBUG_LIB}")
+ set(ILD_STATIC_DEBUG_LIB "${ILD_STATIC_RELEASE_LIB}")
+endif()
+
+# Check for existence of release libs
+if (NOT EXISTS "${XED_STATIC_RELEASE_LIB}")
+ set(XED_STATIC_RELEASE_LIB "${XED_STATIC_DEBUG_LIB}")
+endif()
+if (NOT EXISTS "${ILD_STATIC_RELEASE_LIB}")
+ set(ILD_STATIC_RELEASE_LIB "${ILD_STATIC_DEBUG_LIB}")
+endif()
+
+SET_LIBRARY_TARGET("XED" "XED" "STATIC" "${XED_STATIC_DEBUG_LIB}" "${XED_STATIC_RELEASE_LIB}" "${ROOT}/include/xed")
+SET_LIBRARY_TARGET("ILD" "XED" "STATIC" "${ILD_STATIC_DEBUG_LIB}" "${ILD_STATIC_RELEASE_LIB}" "${ROOT}/include/xed")
diff --git a/ports/xed/portfile.cmake b/ports/xed/portfile.cmake
new file mode 100644
index 00000000..51fac8e9
--- /dev/null
+++ b/ports/xed/portfile.cmake
@@ -0,0 +1,79 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO intelxed/xed
+ REF afbb851b5f2f2ac6cdb6e6d9bebbaf2d4e77286d
+ SHA512 fe80db93d7734e318184a4fcf9737f4bc6a7169bce3e52fa59c95eaa27ba77027127964c557fcafee6b0fd490b860ee0bca6d790efa23d1a7b1b709f0c3b77ed
+ HEAD_REF master
+)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH MBUILD_SOURCE_PATH
+ REPO intelxed/mbuild
+ REF 03ee9d52adb7f01d476ced0dba1534cfc7edff36
+ SHA512 8080944b3833d249828c7e86c52d997dc54779b7d236620b892affe7c364152f45d38a1434e788257a42b5ef0f324aa46a713492bf9af14c2147c34c4fdb5684
+ HEAD_REF master
+)
+
+# Copy mbuild sources.
+message(STATUS "Copying mbuild to parallel source directory...")
+file(COPY ${MBUILD_SOURCE_PATH}/ DESTINATION ${SOURCE_PATH}/../mbuild)
+message(STATUS "Copied mbuild")
+
+set(LINK_TYPE shared)
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ set(LINK_TYPE static)
+endif()
+
+set(RELEASE_TRIPLET ${TARGET_TRIPLET}-rel)
+set(DEBUG_TRIPLET ${TARGET_TRIPLET}-dbg)
+
+# Build
+vcpkg_find_acquire_program(PYTHON3)
+if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release)
+
+ # Not entirely sure if we actually repeat any of the build work if we do
+ # separate build and install phases, so just combine them for now
+ message(STATUS "Building and installing ${RELEASE_TRIPLET}")
+ file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET})
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET})
+ vcpkg_execute_required_process(
+ COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR} --build-dir "${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_C_FLAGS_RELEASE}" "--extra-cxxflags=${VCPKG_CXX_FLAGS_RELEASE}" "--extra-linkflags=${VCPKG_LINKER_FLAGS_RELEASE}" --verbose=9
+ WORKING_DIRECTORY ${SOURCE_PATH}
+ LOGNAME python-${TARGET_TRIPLET}-build-install-rel
+ )
+
+ # Cleanup
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin"
+ "${CURRENT_PACKAGES_DIR}/extlib"
+ "${CURRENT_PACKAGES_DIR}/doc"
+ "${CURRENT_PACKAGES_DIR}/examples"
+ "${CURRENT_PACKAGES_DIR}/mbuild"
+ )
+endif()
+
+if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug)
+
+ # Not entirely sure if we actually repeat any of the build work if we do
+ # separate build and install phases, so just combine them for now
+ message(STATUS "Building and installing ${DEBUG_TRIPLET}")
+ file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET})
+ file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET})
+ vcpkg_execute_required_process(
+ COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install --debug --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR}/debug --build-dir "${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_C_FLAGS_DEBUG}" "--extra-cxxflags=${VCPKG_CXX_FLAGS_DEBUG}" "--extra-linkflags=${VCPKG_LINKER_FLAGS_DEBUG}" --verbose=9
+ WORKING_DIRECTORY ${SOURCE_PATH}
+ LOGNAME python-${TARGET_TRIPLET}-build-install-dbg
+ )
+
+ # Cleanup
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin"
+ "${CURRENT_PACKAGES_DIR}/debug/include"
+ "${CURRENT_PACKAGES_DIR}/debug/extlib"
+ "${CURRENT_PACKAGES_DIR}/debug/doc"
+ "${CURRENT_PACKAGES_DIR}/debug/examples"
+ "${CURRENT_PACKAGES_DIR}/debug/mbuild"
+ )
+endif()
+
+FILE(INSTALL ${CMAKE_CURRENT_LIST_DIR}/XEDConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
+file(INSTALL ${MBUILD_SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME mbuild.copyright)
diff --git a/ports/xed/usage b/ports/xed/usage
new file mode 100644
index 00000000..521dcbec
--- /dev/null
+++ b/ports/xed/usage
@@ -0,0 +1,4 @@
+The package xed is compatible with built-in CMake targets:
+
+ FIND_PACKAGE(XED REQUIRED)
+ TARGET_LINK_LIBRARIES(main PRIVATE XED::XED)
diff --git a/ports/xed/vcpkg.json b/ports/xed/vcpkg.json
new file mode 100644
index 00000000..c73cf374
--- /dev/null
+++ b/ports/xed/vcpkg.json
@@ -0,0 +1,6 @@
+{
+ "name": "xed",
+ "version-string": "2020-10-16",
+ "description": "x86 encoder decoder",
+ "homepage": "https://intelxed.github.io/"
+}
diff --git a/pull_dependencies.sh b/pull_dependencies.sh
new file mode 100755
index 00000000..2e7683b2
--- /dev/null
+++ b/pull_dependencies.sh
@@ -0,0 +1,81 @@
+#!/usr/bin/env bash
+
+# Try to pull prebuilt library dependencies using NuGet with your GitHub
+# credentials
+
+set -x -euo pipefail
+
+echo "Untested..."
+exit 1
+
+usage()
+{
+cat << EOF
+usage: pull_dependencies GITHUB_USERNAME GITHUB_TOKEN
+ GITHUB_USERNAME | GitHub username associated with Token
+ GITHUB_TOKEN | GitHub token to pull NuGet packages
+
+WARNING: Will write your token in plaintext at ~/.conig/NuGet/NuGet.config
+EOF
+}
+
+
+if [ -z ${1+x} ]; then
+ echo "First argument GITHUB_USERNAME variable is unset";
+ usage
+ exit 1
+else
+ GITHUB_USERNAME="$1"
+fi
+if [ -z ${2+x} ]; then
+ echo "Second argument GITHUB_USERNAME variable is unset";
+ usage
+ exit 1
+else
+ GITHUB_TOKEN="$2"
+fi
+
+
+#### Bootstrap vcpkg
+git clone https://github.com/microsoft/vcpkg.git || true
+# Thu Nov 12 23:28:59 2020 +0100
+# NOTE: Update .github/workflows/ci.yml as well
+pushd vcpkg && git fetch && git checkout b518035a33941380c044b00a1b4f8abff764cbdc && popd
+./vcpkg/bootstrap-vcpkg.sh
+
+
+#### Caching Setup
+
+# NOTE: "Source" is specific to what you name the NuGet feed when adding it
+export VCPKG_BINARY_SOURCES='clear;nuget,Source,read'
+
+# WARNING
+# Password stored in cleartext
+# TODO(ekilmer): Parameterize llvm version
+mono "$(./vcpkg/vcpkg fetch nuget | tail -n 1)" sources add \
+ -source "https://nuget.pkg.github.com/trailofbits/index.json" \
+ -storepasswordincleartext \
+ -name "Source" \
+ -username "${GITHUB_USERNAME}" \
+ -password "${GITHUB_TOKEN}" || true
+
+mono "$(./vcpkg/vcpkg fetch nuget | tail -n 1)" setapikey \
+ -source "https://nuget.pkg.github.com/trailofbits/index.json" \
+ "${GITHUB_TOKEN}"
+
+#### Pulling dependencies with correct triplet
+
+unameOut="$(uname -s)"
+case "${unameOut}" in
+ Linux*) triplet=x64-linux-rel;;
+ Darwin*) triplet=x64-osx-rel;;
+ *) triplet="UNKNOWN:${unameOut}"
+esac
+echo Using Triplet: "${triplet}"
+
+# TODO(ekilmer): Parameterize llvm version
+./vcpkg/vcpkg install \
+ --triplet "${triplet}" \
+ --debug \
+ llvm-10 \
+ @dependencies.txt
diff --git a/rellic b/rellic
new file mode 160000
index 00000000..d2a2fa02
--- /dev/null
+++ b/rellic
@@ -0,0 +1 @@
+Subproject commit d2a2fa02102a0d38b0999da14f57c1b1151e49d9
diff --git a/remill b/remill
new file mode 160000
index 00000000..f93c2630
--- /dev/null
+++ b/remill
@@ -0,0 +1 @@
+Subproject commit f93c26304d27a85fc70728d551da8c9fd8d5ba33
diff --git a/triplets/x64-linux-rel.cmake b/triplets/x64-linux-rel.cmake
new file mode 100644
index 00000000..74336d9f
--- /dev/null
+++ b/triplets/x64-linux-rel.cmake
@@ -0,0 +1,8 @@
+set(VCPKG_TARGET_ARCHITECTURE x64)
+set(VCPKG_CRT_LINKAGE dynamic)
+set(VCPKG_LIBRARY_LINKAGE static)
+
+# Only release builds
+set(VCPKG_BUILD_TYPE release)
+
+set(VCPKG_CMAKE_SYSTEM_NAME Linux)
diff --git a/triplets/x64-osx-rel.cmake b/triplets/x64-osx-rel.cmake
new file mode 100644
index 00000000..46cb3285
--- /dev/null
+++ b/triplets/x64-osx-rel.cmake
@@ -0,0 +1,6 @@
+set(VCPKG_TARGET_ARCHITECTURE x64)
+set(VCPKG_CRT_LINKAGE dynamic)
+set(VCPKG_LIBRARY_LINKAGE static)
+set(VCPKG_BUILD_TYPE release)
+
+set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
diff --git a/vcpkg_info.txt b/vcpkg_info.txt
new file mode 100644
index 00000000..58689e71
--- /dev/null
+++ b/vcpkg_info.txt
@@ -0,0 +1,2 @@
+https://github.com/microsoft/vcpkg.git
+38752e29c2b60ea522d629a40b57b95606e16715