strip by ourselves

This commit is contained in:
5ec1cff
2023-12-08 19:46:40 +08:00
parent bcb65c4bd9
commit b34015b5f0
3 changed files with 34 additions and 5 deletions

View File

@@ -27,3 +27,33 @@ cargo {
spec.environment("MIN_MAGISK_VERSION", minMagiskVersion)
}
}
afterEvaluate {
task<Task>("buildAndStrip") {
dependsOn(":zygiskd:cargoBuild")
doLast {
val dir = File(buildDir, "rustJniLibs/android")
val prebuilt = File(android.ndkDirectory, "toolchains/llvm/prebuilt").listFiles()!!.first()
val binDir = File(prebuilt, "bin")
println("binDir $binDir")
val suffix = if (prebuilt.name.contains("windows")) ".exe" else ""
val strip = File(binDir, "llvm-strip$suffix")
val objcopy = File(binDir, "llvm-objcopy$suffix")
dir.listFiles()!!.forEach {
if (!it.isDirectory) return@forEach
exec {
workingDir = it
commandLine(objcopy, "--only-keep-debug", "zygiskd", "zygiskd.debug")
}
exec {
workingDir = it
commandLine(strip, "--strip-all", "zygiskd")
}
exec {
workingDir = it
commandLine(objcopy, "--add-gnu-debuglink", "zygiskd.debug", "zygiskd")
}
}
}
}
}