fix(build): run the NDK clang wrapper through .cmd on Windows

The extensionless wrapper is a Unix shell script; CreateProcess rejects
it with error 193. llvm-strip likewise needs .exe there.
This commit is contained in:
A-nony-mous committed 2026-10-24 00:22:59 +08:00
1 parent ae7fdef734
commit a32ffdc80f
1 file changed
+11 -2
+11 -2
View File
@@ -111,7 +111,12 @@ tasks.register("prepareFaceclawNativeLibs") {
if (ndkRoot == null || !ndkRoot.exists()) {
throw new GradleException("Android NDK is required to build libfaceclaw_lc3.so")
}
def clang = file("$ndkRoot/toolchains/llvm/prebuilt/${faceclawNdkHostTag()}/bin/aarch64-linux-android24-clang")
// The NDK ships the clang driver twice: extensionless (a Unix shell script)
// and as .cmd (the CreateProcess-launchable one Windows needs).
def clangBin = "$ndkRoot/toolchains/llvm/prebuilt/${faceclawNdkHostTag()}/bin/aarch64-linux-android24-clang"
def clang = Os.isFamily(Os.FAMILY_WINDOWS)
? file("${clangBin}.cmd")
: file(clangBin)
if (!clang.exists()) {
throw new GradleException("Could not find Android clang at $clang")
}
@@ -229,7 +234,11 @@ tasks.register("prepareFaceclawLlama") {
// strip it so the APK only pays for the code (~8MB).
def ndkRootForStrip = faceclawFindNdkRoot()
if (ndkRootForStrip != null) {
def llvmStrip = file("$ndkRootForStrip/toolchains/llvm/prebuilt/${faceclawNdkHostTag()}/bin/llvm-strip")
// Windows wants llvm-strip.exe; the extensionless file is a Unix script.
def llvmStripBin = "$ndkRootForStrip/toolchains/llvm/prebuilt/${faceclawNdkHostTag()}/bin/llvm-strip"
def llvmStrip = Os.isFamily(Os.FAMILY_WINDOWS) && file("${llvmStripBin}.exe").exists()
? file("${llvmStripBin}.exe")
: file(llvmStripBin)
if (llvmStrip.exists()) {
exec {
commandLine([llvmStrip.absolutePath, "--strip-unneeded", llamaSo.absolutePath])