Skip to content

Commit

Permalink
CI: build Windows ARM (32-bit) with LLVM MinGW
Browse files Browse the repository at this point in the history
We are possibly violating the GPLv3 license by shipping
Windows executables statically-linked with MSVC's libraries [1]. Switch
from MSVC to LLVM-based MinGW for our 32-bit Windows ARM builds.

[1] #678
  • Loading branch information
strager committed Apr 9, 2022
1 parent 35290b0 commit 61bc436
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
33 changes: 33 additions & 0 deletions .github/toolchain-mingw-armv7.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (C) 2020 Matthew Glazar
# See end of file for extended copyright information.

# This is a CMake toolchain file used on CI to cross-compile to Linux AArch64.

set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(CMAKE_C_COMPILER armv7-w64-mingw32-cc)
set(CMAKE_CXX_COMPILER armv7-w64-mingw32-c++)
set(CMAKE_RC_COMPILER armv7-w64-mingw32-windres)

set(CMAKE_SYSTEM_INCLUDE_PATH /opt/llvm-mingw/armv7-w64-mingw32/include)
set(CMAKE_SYSTEM_LIBRARY_PATH /opt/llvm-mingw/armv7-w64-mingw32/lib)
set(CMAKE_SYSTEM_PREFIX_PATH /opt/llvm-mingw/armv7-w64-mingw32)

# quick-lint-js finds bugs in JavaScript programs.
# Copyright (C) 2020 Matthew Glazar
#
# This file is part of quick-lint-js.
#
# quick-lint-js is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# quick-lint-js is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>.
3 changes: 1 addition & 2 deletions .github/workflows/build-and-test-plugin-vscode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ jobs:
- {runs_on: ubuntu-latest, name: "Linux AArch64", platform_arch: "linux-arm64", test: false, docker_container: "ghcr.io/quick-lint/quick-lint-js-github-cross-builder:v1", CMAKE_FLAGS: "-DCMAKE_TOOLCHAIN_FILE=.github/toolchain-linux-aarch64.cmake -G Ninja", LDFLAGS: "-static-libgcc -static-libstdc++"}
- {runs_on: windows-2022, name: "Windows x86", platform_arch: "win32-ia32", test: true, CC: "c:/msys64/mingw32/bin/gcc.exe", CXX: "c:/msys64/mingw32/bin/g++.exe", CMAKE_FLAGS: "-G Ninja", chocolatey_packages: "ninja", msys2_packages: "mingw-w64-i686-gcc ninja", LDFLAGS: "-static"}
- {runs_on: windows-2022, name: "Windows x64", platform_arch: "win32-x64", test: true, CC: "c:/msys64/ucrt64/bin/gcc.exe", CXX: "c:/msys64/ucrt64/bin/g++.exe", CMAKE_FLAGS: "-G Ninja", chocolatey_packages: "ninja", msys2_packages: "mingw-w64-ucrt-x86_64-gcc ninja", LDFLAGS: "-static"}
- {runs_on: ubuntu-latest, name: "Windows ARM", platform_arch: "win32-arm", test: false, docker_container: "ghcr.io/quick-lint/quick-lint-js-github-mingw-builder:v1", CMAKE_FLAGS: "-DCMAKE_TOOLCHAIN_FILE=.github/toolchain-mingw-armv7.cmake -G Ninja", LDFLAGS: "-static"}
- {runs_on: ubuntu-latest, name: "Windows ARM64", platform_arch: "win32-arm64", test: false, docker_container: "ghcr.io/quick-lint/quick-lint-js-github-mingw-builder:v1", CMAKE_FLAGS: "-DCMAKE_TOOLCHAIN_FILE=.github/toolchain-mingw-aarch64.cmake -G Ninja", LDFLAGS: "-static"}
# TODO(strager): Switch to MinGW for these builds. https://github.com/quick-lint/quick-lint-js/issues/678
- {runs_on: windows-latest, name: "Windows ARM", platform_arch: "win32-arm", test: false, CMAKE_FLAGS: "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -A ARM"}
runs-on: ${{ matrix.os.runs_on }}
container: ${{ matrix.os.docker_container }}
env:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/build-static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ jobs:
- {runs_on: ubuntu-latest, name: "Linux AArch64", archive_name: "linux-aarch64", archive_extension: ".tar.gz", docker_container: "ghcr.io/quick-lint/quick-lint-js-github-cross-builder:v1", test: false, CMAKE_FLAGS: "-DCMAKE_TOOLCHAIN_FILE=.github/toolchain-linux-aarch64.cmake -G Ninja", LDFLAGS: "-static-libgcc -static-libstdc++"}
- {runs_on: windows-2022, name: "Windows x86", archive_name: "windows-x86", archive_extension: ".zip", test: true, CC: "c:/msys64/mingw32/bin/gcc.exe", CXX: "c:/msys64/mingw32/bin/g++.exe", CMAKE_FLAGS: "-G Ninja", chocolatey_packages: "ninja", msys2_packages: "mingw-w64-i686-gcc ninja", LDFLAGS: "-static"}
- {runs_on: windows-2022, name: "Windows x64", archive_name: "windows", archive_extension: ".zip", test: true, CC: "c:/msys64/ucrt64/bin/gcc.exe", CXX: "c:/msys64/ucrt64/bin/g++.exe", CMAKE_FLAGS: "-G Ninja", chocolatey_packages: "ninja", msys2_packages: "mingw-w64-ucrt-x86_64-gcc ninja", LDFLAGS: "-static"}
- {runs_on: ubuntu-latest, name: "Windows ARM", archive_name: "windows-arm", archive_extension: ".zip", docker_container: "ghcr.io/quick-lint/quick-lint-js-github-mingw-builder:v1", test: false, CMAKE_FLAGS: "-DCMAKE_TOOLCHAIN_FILE=.github/toolchain-mingw-armv7.cmake -G Ninja", LDFLAGS: "-static"}
- {runs_on: ubuntu-latest, name: "Windows ARM64", archive_name: "windows-arm64", archive_extension: ".zip", docker_container: "ghcr.io/quick-lint/quick-lint-js-github-mingw-builder:v1", test: false, CMAKE_FLAGS: "-DCMAKE_TOOLCHAIN_FILE=.github/toolchain-mingw-aarch64.cmake -G Ninja", LDFLAGS: "-static"}
# TODO(strager): Switch to MinGW for these builds. https://github.com/quick-lint/quick-lint-js/issues/678
- {runs_on: windows-latest, name: "Windows ARM", archive_name: "windows-arm", archive_extension: ".zip", test: false, CMAKE_FLAGS: "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -A ARM"}
runs-on: ${{ matrix.toolchain.runs_on }}
container: ${{ matrix.toolchain.docker_container }}
env:
Expand Down
2 changes: 1 addition & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Semantic Versioning.

### Changed

* Windows x86, x64, and ARM64 builds are now built with MinGW's C and C++
* Windows builds (x86, x64, ARM, and ARM64) are now built with MinGW's C and C++
runtime libraries instead of Microsoft's.

## 2.3.1 (2022-03-24)
Expand Down

0 comments on commit 61bc436

Please sign in to comment.