forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow building Git for Windows with LLVM
This is a work in progress. Will provide a proper commit message later. Signed-off-by: Dennis Ameling <dennis@dennisameling.com>
- Loading branch information
1 parent
3f28c5f
commit 9ca3275
Showing
3 changed files
with
135 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
name: LLVM build | ||
|
||
on: | ||
pull_request: | ||
|
||
env: | ||
LLVM_VERSION: 20210423 | ||
LLVM_TYPE: msvcrt | ||
VCPKG_VERSION_FOR_CACHE: 1 | ||
DEVELOPER: 1 | ||
|
||
jobs: | ||
vcpkg: | ||
runs-on: windows-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [arm64, x64] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- shell: cmd | ||
run: where windres | ||
- name: Set LLVM path | ||
shell: bash | ||
run: echo "LLVM_PATH=`pwd`/llvm-build/llvm-mingw-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}-x86_64" >> $GITHUB_ENV | ||
- name: Cache LLVM | ||
id: cache-llvm | ||
uses: actions/cache@v2 | ||
with: | ||
path: llvm-build | ||
key: llvm-build-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }} | ||
- shell: pwsh | ||
if: steps.cache-llvm.outputs.cache-hit != 'true' | ||
run: | | ||
Invoke-WebRequest -Uri "https://github.com/mstorsjo/llvm-mingw/releases/download/${{ env.LLVM_VERSION }}/llvm-mingw-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}-x86_64.zip" -OutFile "./llvm.zip" | ||
Expand-Archive -LiteralPath './llvm.zip' -DestinationPath ./llvm-build | ||
- name: initialize vcpkg | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: 'dennisameling/vcpkg' | ||
ref: 'llvm-mingw-clang' | ||
path: 'compat/vcbuild/vcpkg' | ||
- name: Cache vcpkg artifacts | ||
id: cache-vcpkg | ||
uses: actions/cache@v2 | ||
with: | ||
path: compat/vcbuild/vcpkg/installed | ||
key: vcpkg-cache-${{ env.VCPKG_VERSION_FOR_CACHE }}-${{ matrix.arch }}-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }} | ||
- name: build packages | ||
if: steps.cache-vcpkg.outputs.cache-hit != 'true' | ||
shell: pwsh | ||
run: .\compat\vcbuild\vcpkg_install.bat ${{ matrix.arch }}-windows-llvm-mingw | ||
env: | ||
# Temp workaround to get the paths to work | ||
LLVM_PATH: D:/a/git/git/llvm-build/llvm-mingw-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}-x86_64 | ||
VCPKG_ROOT: D:/a/git/git/compat/vcbuild/vcpkg | ||
VCPKG_KEEP_ENV_VARS: "LLVM_PATH;VCPKG_ROOT" | ||
- name: upload vcpkg artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: vcpkg-artifacts-${{ matrix.arch }} | ||
path: compat/vcbuild/vcpkg/installed | ||
|
||
llvm-build: | ||
needs: vcpkg | ||
runs-on: windows-latest | ||
env: | ||
NO_PERL: 1 | ||
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'" | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- arch: x64 | ||
compilerArch: x86_64 | ||
- arch: arm64 | ||
compilerArch: aarch64 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set LLVM path | ||
shell: bash | ||
run: echo "LLVM_PATH=`pwd`/llvm-build/llvm-mingw-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}-x86_64" >> $GITHUB_ENV | ||
- name: Cache LLVM | ||
id: cache-llvm | ||
uses: actions/cache@v2 | ||
with: | ||
path: llvm-build | ||
key: llvm-build-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }} | ||
- shell: pwsh | ||
if: steps.cache-llvm.outputs.cache-hit != 'true' | ||
run: | | ||
Invoke-WebRequest -Uri "https://github.com/mstorsjo/llvm-mingw/releases/download/${{ env.LLVM_VERSION }}/llvm-mingw-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}-x86_64.zip" -OutFile "./llvm.zip" | ||
Expand-Archive -LiteralPath './llvm.zip' -DestinationPath ./llvm-build | ||
- name: initialize vcpkg | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: 'microsoft/vcpkg' | ||
path: 'compat/vcbuild/vcpkg' | ||
- name: download vcpkg artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: vcpkg-artifacts-${{ matrix.arch }} | ||
path: compat/vcbuild/vcpkg/installed | ||
- name: copy dlls to root | ||
shell: cmd | ||
run: compat\vcbuild\vcpkg_copy_dlls.bat release ${{ matrix.arch }}-windows-llvm-mingw | ||
- shell: bash | ||
run: | | ||
mkdir `pwd`/artifacts | ||
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/${{ matrix.arch }}-windows-llvm-mingw -DVCPKG_ARCH=${{ matrix.arch }}-windows-llvm-mingw \ | ||
-DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON -DCMAKE_C_COMPILER=${{ env.LLVM_PATH }}/bin/${{ matrix.compilerArch }}-w64-mingw32-clang.exe \ | ||
-DCMAKE_CXX_COMPILER=${{ env.LLVM_PATH }}/bin/${{ matrix.compilerArch }}-w64-mingw32-clang++.exe -DCMAKE_INSTALL_PREFIX=`pwd`/artifacts -G "MinGW Makefiles" | ||
- shell: pwsh | ||
run: make -j2 | ||
- shell: pwsh | ||
run: make install | ||
- name: Copy DLLs | ||
shell: bash | ||
# Workaround to get the DLLs into the installation directory | ||
run: | | ||
cp `pwd`/compat/vcbuild/vcpkg/installed/${{ matrix.arch }}-windows-llvm-mingw/bin/*.dll `pwd`/artifacts/bin | ||
cp `pwd`/compat/vcbuild/vcpkg/installed/${{ matrix.arch }}-windows-llvm-mingw/bin/*.dll `pwd`/artifacts/libexec/git-core | ||
- name: upload build artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: llvm-artifacts-${{ matrix.arch }} | ||
path: artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters