Skip to content

Commit

Permalink
mesa: enable clangarm64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
driver1998 committed Jan 14, 2023
1 parent 4f73e5b commit 833a1b9
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 10 deletions.
2 changes: 1 addition & 1 deletion mingw-w64-glm/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pkgver=0.9.9.8
pkgrel=1
pkgdesc="C++ mathematics library for 3D software based on the OpenGL Shading Language (GLSL) specification (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url='https://glm.g-truc.net/'
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
Expand Down
2 changes: 1 addition & 1 deletion mingw-w64-libelf/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pkgver=0.8.13
pkgrel=6
pkgdesc="ELF object file access library (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
license=('LGPL')
url="http://www.mr511.de/software/english.html"
options=('staticlibs')
Expand Down
16 changes: 16 additions & 0 deletions mingw-w64-mesa/0001-mcjit-aarch64-windows-triplet.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 2279e5a..d50c30f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -370,8 +370,10 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
* different strings for MinGW/MSVC, so better play it safe and be
* explicit.
*/
-# ifdef _WIN64
+# if defined(PIPE_ARCH_X86_64)
LLVMSetTarget(M, "x86_64-pc-win32-elf");
+# elif defined(PIPE_ARCH_AARCH64)
+ LLVMSetTarget(M, "aarch64-pc-win32-elf");
# else
LLVMSetTarget(M, "i686-pc-win32-elf");
# endif
27 changes: 21 additions & 6 deletions mingw-w64-mesa/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ _realname=mesa
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=22.3.3
pkgrel=1
pkgrel=2
pkgdesc="Open-source implementation of the OpenGL, Vulkan and OpenCL specifications (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
makedepends=("git"
"${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-python-mako"
Expand All @@ -33,12 +33,14 @@ options=('staticlibs' 'strip')
source=(https://mesa.freedesktop.org/archive/${_realname}-${pkgver}.tar.xz{,.sig}
llvmwrapgen.sh
0005-win32-The-opengl-headers-should-install-to-mesa-GL-s.patch
0000-fix-dzn-build-with-clang.patch)
0000-fix-dzn-build-with-clang.patch
0001-mcjit-aarch64-windows-triplet.patch)
sha256sums=('bed799788bf2bd9ef079d97cd8e09348bf53cb086818578e40773b2b17812922'
'SKIP'
'69f21522f20c10f5699dfe3e128aa88d4fedde816f6e8df1506d7470c44bf3da'
'7f7874b89103c98dc0006bb64d209b5c0afa5a72b27e5e3d9f366a9609881714'
'82fd4661500fb245cea50f14c64ee9062c636adfebde4c101c73b777d8ee0759')
'82fd4661500fb245cea50f14c64ee9062c636adfebde4c101c73b777d8ee0759'
'462e114c9aea161c237738da2c4d53a61486a0e4434bc020853b2bfb44ceea40')
validpgpkeys=('8703B6700E7EE06D7A39B8D6EDAE37B02CEB490D') # Emil Velikov <emil.l.velikov@gmail.com>
validpgpkeys+=('946D09B5E4C9845E63075FF1D961C596A7203456') # Andres Gomez <tanty@igalia.com>
validpgpkeys+=('E3E8F480C52ADD73B278EE78E1ECBE07D7D70895') # Juan Antonio Suárez Romero (Igalia, S.L.) <jasuarez@igalia.com>"
Expand All @@ -64,6 +66,9 @@ case ${MSYSTEM} in
CLANG64)
_mach=clang-x86_64
;;
CLANGARM64)
_mach=clang-aarch64
;;
esac

# Helper macros to help make tasks easier #
Expand Down Expand Up @@ -99,6 +104,10 @@ prepare() {
# https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20676
apply_patch_with_msg \
0000-fix-dzn-build-with-clang.patch
# Enable llvmpipe on Windows ARM64.
# Backported from https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20675
apply_patch_with_msg \
0001-mcjit-aarch64-windows-triplet.patch

# Generate binary wrap for LLVM if llvm-config tool is busted
if ! [ "$(${MINGW_PREFIX}/bin/llvm-config --has-rtti 2>&1)" = YES ] && ! [ "$(${MINGW_PREFIX}/bin/llvm-config --has-rtti 2>&1)" = NO ]; then
Expand Down Expand Up @@ -135,10 +144,16 @@ build() {
--force-fallback-for=llvm"
fi

if [[ "${CARCH}" == "aarch64" ]]; then
_cc_march=armv8-a
else
_cc_march=core2
fi

MSYS2_ARG_CONV_EXCL="--prefix=" \
PROCESSOR_ARCHITECTURE="${CARCH}" ${buildconf} \
-Dc_args='-march=core2 -pipe' \
-Dcpp_args='-march=core2 -pipe' \
-Dc_args="-march=${_cc_march} -pipe" \
-Dcpp_args="-march=${_cc_march} -pipe" \
-Dc_link_args='-s' \
-Dcpp_link_args='-s'

Expand Down
2 changes: 1 addition & 1 deletion mingw-w64-opencl-headers/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pkgrel=1
epoch=2
pkgdesc='OpenCL (Open Computing Language) header files (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url='https://registry.khronos.org/OpenCL/'
license=('spdx:Apache-2.0')
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
Expand Down
2 changes: 1 addition & 1 deletion mingw-w64-opencl-icd/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pkgver=2022.09.30
pkgrel=1
pkgdesc="OpenCL ICD Loader (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url='/~https://github.com/KhronosGroup/OpenCL-ICD-Loader'
license=('Apache')
depends=("${MINGW_PACKAGE_PREFIX}-opencl-headers")
Expand Down

0 comments on commit 833a1b9

Please sign in to comment.