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 <mha1993@live.de>
  • Loading branch information
rimrul committed Jul 1, 2023
1 parent dc8e6ca commit 3c2fd59
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 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 @@ -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 @@ -288,13 +288,7 @@ build() {
}

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
echo
}

package_clang() {
Expand Down

0 comments on commit 3c2fd59

Please sign in to comment.