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 for 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 <mha1993@live.de>
  • Loading branch information
rimrul committed Oct 13, 2023
1 parent c687341 commit a45aa33
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions mingw-w64-clang/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,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 @@ -226,9 +226,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 @@ -244,7 +244,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 @@ -266,15 +266,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 a45aa33

Please sign in to comment.