Commit ba17370ff58cb029b36088dac74bacd431be51dc
1 parent
30df7c88
Make build-scripts portable for GitHub Actions
Showing
2 changed files
with
16 additions
and
9 deletions
build-scripts/build-windows
| @@ -6,12 +6,15 @@ tool=$2 | @@ -6,12 +6,15 @@ tool=$2 | ||
| 6 | 6 | ||
| 7 | if [[ $tool == mingw ]]; then | 7 | if [[ $tool == mingw ]]; then |
| 8 | pacman -Sy --noconfirm make base-devel tar zip unzip | 8 | pacman -Sy --noconfirm make base-devel tar zip unzip |
| 9 | - if [[ $wordsize == 64 ]]; then | ||
| 10 | - pacman -Sy --noconfirm mingw-w64-x86_64-toolchain | ||
| 11 | - PATH="/c/tools/msys64/mingw64/bin:$PATH" | 9 | + if [ -d /c/msys64 ]; then |
| 10 | + PATH="/c/msys64/mingw$wordsize/bin:$PATH" | ||
| 12 | else | 11 | else |
| 13 | - pacman -Sy --noconfirm mingw-w64-i686-toolchain | ||
| 14 | - PATH="/c/tools/msys64/mingw32/bin:$PATH" | 12 | + if [[ $wordsize == 64 ]]; then |
| 13 | + pacman -Sy --noconfirm mingw-w64-x86_64-toolchain | ||
| 14 | + else | ||
| 15 | + pacman -Sy --noconfirm mingw-w64-i686-toolchain | ||
| 16 | + fi | ||
| 17 | + PATH="/c/tools/msys64/mingw$wordsize/bin:$PATH" | ||
| 15 | fi | 18 | fi |
| 16 | g++ -v | 19 | g++ -v |
| 17 | elif [[ $tool == msvc ]]; then | 20 | elif [[ $tool == msvc ]]; then |
build-scripts/build-windows.bat
| 1 | @echo on | 1 | @echo on |
| 2 | @rem Usage: build-windows {32|64} {msvc|mingw} | 2 | @rem Usage: build-windows {32|64} {msvc|mingw} |
| 3 | +setlocal ENABLEDELAYEDEXPANSION | ||
| 3 | if %2 == msvc ( | 4 | if %2 == msvc ( |
| 4 | if %1 == 64 ( | 5 | if %1 == 64 ( |
| 5 | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | 6 | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" |
| @@ -9,8 +10,11 @@ if %2 == msvc ( | @@ -9,8 +10,11 @@ if %2 == msvc ( | ||
| 9 | choco install zip | 10 | choco install zip |
| 10 | bash ./build-scripts/build-windows %1 %2 | 11 | bash ./build-scripts/build-windows %1 %2 |
| 11 | ) else ( | 12 | ) else ( |
| 12 | - @rem The vs2017-win2016 pool has an ancient 64-bit-only mingw. | ||
| 13 | - @rem Install msys2 so we can get current gcc toolchains. | ||
| 14 | - choco install msys2 | ||
| 15 | - C:\tools\msys64\usr\bin\env.exe MSYSTEM=MINGW64 /bin/bash -l %CD%/build-scripts/build-windows %1 %2 | 13 | + if exist C:\msys64 ( |
| 14 | + set MSYS=C:\msys64 | ||
| 15 | + ) else ( | ||
| 16 | + choco install msys2 | ||
| 17 | + set MSYS=C:\tools\msys64 | ||
| 18 | + ) | ||
| 19 | + !MSYS!\usr\bin\env.exe MSYSTEM=MINGW64 /bin/bash -l %CD%/build-scripts/build-windows %1 %2 | ||
| 16 | ) | 20 | ) |