Skip to content

Commit

Permalink
clang: build a smaller clang/llvm
Browse files Browse the repository at this point in the history
Msys2 builds pretty versatile Clang and LLVM packages with LLVM backends
to cross compile for various target architectures. That comes at the
cost of big binaries, that challenge how we manage the Git for Windows
SDK[1]. But for Git ffor Windows we don't need all of this. We only need
a Clang that can compile ARM64 binaries on ARM64.

[1] git-for-windows/git-sdk-arm64#7

Signed-off-by: Matthias Aßhauer <[email protected]>
  • Loading branch information
rimrul committed Jul 3, 2023
1 parent c77a0ff commit dc6ac7a
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions mingw-w64-clang/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ _version=16.0.5
_rc=""
_tag=llvmorg-${_version}${_rc}
pkgver=${_version}${_rc/-/}
pkgrel=1
pkgrel=2
pkgdesc="C language family frontend for LLVM (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
Expand Down Expand Up @@ -103,7 +103,7 @@ sha256sums=('701b764a182d8ea8fb017b6b5f7f5f1272a29f17c339b838f48de894ffdd4f91'
'715cb8862753854b2d9256e0b70003e2d1f57083d83eaeaf5a095fc72b8a4e26'
'd4b6d171f3fd878b7a21043824c0477235c7acb6a73115a337295724ff8b0d1c'
'de631ab199a6fe83b3f695350bffaad067a2f95fc2ba9c8fe57dc85665d3653c'
'1d33da596dcef12272389cb81277db205dd2153e2e52612d2d01ab3f0e7b3fb7')
'SKIP')
validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D' # Hans Wennborg, Google.
'474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard
'D574BD5D1D0E98895E3BF90044F2485E45D59042') # Tobias Hieta
Expand Down Expand Up @@ -197,7 +197,7 @@ build() {
common_cmake_args+=(-DCMAKE_BUILD_TYPE=Debug)
VERBOSE="VERBOSE=1"
else
common_cmake_args+=(-DCMAKE_BUILD_TYPE=Release)
common_cmake_args+=(-DCMAKE_BUILD_TYPE=MinSizeRel)
fi
common_cmake_args+=(-Wno-dev
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX}
Expand Down Expand Up @@ -247,9 +247,9 @@ build() {
# List of targets to build in CMake style
# For more info see: https://github.com/msys2/MINGW-packages/discussions/9765
if [ "${_compiler}" == "clang" ]; then
platform_config+=(-DLLVM_TARGETS_TO_BUILD="all")
platform_config+=(-DLLVM_TARGETS_TO_BUILD="host")
else
platform_config+=(-DLLVM_TARGETS_TO_BUILD="AArch64;AMDGPU;ARM;AVR;BPF;Mips;MSP430;NVPTX;RISCV;WebAssembly;X86")
platform_config+=(-DLLVM_TARGETS_TO_BUILD="host")
fi

mkdir build-${MSYSTEM} && cd build-${MSYSTEM}
Expand All @@ -265,7 +265,7 @@ build() {
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_FFI=ON \
-DLLVM_ENABLE_PROJECTS="${_projects}" \
-DLLVM_ENABLE_SPHINX=ON \
-DLLVM_ENABLE_SPHINX=OFF \
-DLLVM_ENABLE_THREADS=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_INCLUDE_EXAMPLES=OFF \
Expand All @@ -287,15 +287,6 @@ build() {
sed -i.orig '/compiler-rt\/cmake_install.cmake/d' projects/cmake_install.cmake
}

check() {
cd "${srcdir}"/build-${MSYSTEM}
# Remove || true once testcase doesn't cause failures.
# make check || true
# make check-clang || true
${MINGW_PREFIX}/bin/cmake.exe -DLLVM_INCLUDE_TESTS=ON ../llvm
${MINGW_PREFIX}/bin/cmake.exe --build .
${MINGW_PREFIX}/bin/cmake.exe --build . -- check-lld || true
}

package_clang() {
pkgdesc="C language family frontend for LLVM (mingw-w64)"
Expand Down

0 comments on commit dc6ac7a

Please sign in to comment.