mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 09:49:23 +02:00
GP-0: z3 dependency improvements
This commit is contained in:
parent
9018e9a05a
commit
b6968e26c5
2 changed files with 33 additions and 99 deletions
|
@ -21,16 +21,9 @@ apply from: "$rootProject.projectDir/gradle/distributableGhidraExtension.gradle"
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
eclipse.project.name = 'Xtra SymbolicSummaryZ3'
|
eclipse.project.name = 'Xtra SymbolicSummaryZ3'
|
||||||
|
|
||||||
ext.Z3_VER = "4.13.0"
|
|
||||||
ext.Z3_ARM64_OSX_VER = "11.0"
|
|
||||||
ext.Z3_X64_OSX_VER = "11.7.10"
|
|
||||||
ext.Z3_X64_GLIBC_VER = "2.31"
|
|
||||||
// NO Z3_WIN_VER
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':Debugger')
|
api project(':Debugger')
|
||||||
api project(':SystemEmulation')
|
api project(':SystemEmulation')
|
||||||
//api "com.microsoft.z3:java-jar:${Z3_VER}"
|
|
||||||
api ":com.microsoft.z3:"
|
api ":com.microsoft.z3:"
|
||||||
|
|
||||||
// Oof. Apparently, this doesn't work transitively....
|
// Oof. Apparently, this doesn't work transitively....
|
||||||
|
@ -41,94 +34,30 @@ dependencies {
|
||||||
testImplementation project(path: ':Debugger', configuration: 'testArtifacts')
|
testImplementation project(path: ':Debugger', configuration: 'testArtifacts')
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.PLATFORM_BINDINGS = [
|
CopySpec z3LibsCopySpec = copySpec {
|
||||||
[
|
File depsDir = file("${DEPS_DIR}/SymbolicSummaryZ3/os")
|
||||||
name: "mac_arm_64",
|
File binRepoDir = file("${BIN_REPO}/Ghidra/Extensions/SymbolicSummaryZ3/os")
|
||||||
zip: "z3-${Z3_VER}-arm64-osx-${Z3_ARM64_OSX_VER}.zip",
|
from(depsDir.exists() ? depsDir : binRepoDir) {
|
||||||
files: [
|
into("os")
|
||||||
"z3-${Z3_VER}-arm64-osx-${Z3_ARM64_OSX_VER}/bin/libz3.dylib",
|
|
||||||
"z3-${Z3_VER}-arm64-osx-${Z3_ARM64_OSX_VER}/bin/libz3java.dylib"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
name: "linux_x86_64",
|
|
||||||
zip: "z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}.zip",
|
|
||||||
files: [
|
|
||||||
"z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}/bin/libz3.so",
|
|
||||||
"z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}/bin/libz3java.so"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
name: "mac_x86_64",
|
|
||||||
zip: "z3-${Z3_VER}-x64-osx-${Z3_X64_OSX_VER}.zip",
|
|
||||||
files: [
|
|
||||||
"z3-${Z3_VER}-x64-osx-${Z3_X64_OSX_VER}/bin/libz3.dylib",
|
|
||||||
"z3-${Z3_VER}-x64-osx-${Z3_X64_OSX_VER}/bin/libz3java.dylib"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
[
|
|
||||||
name: "win_x86_64",
|
|
||||||
zip: "z3-${Z3_VER}-x64-win.zip",
|
|
||||||
files: [
|
|
||||||
"z3-${Z3_VER}-x64-win/bin/libz3.dll",
|
|
||||||
"z3-${Z3_VER}-x64-win/bin/libz3java.dll",
|
|
||||||
|
|
||||||
"z3-${Z3_VER}-x64-win/bin/msvcp140.dll",
|
|
||||||
"z3-${Z3_VER}-x64-win/bin/msvcp140_1.dll",
|
|
||||||
"z3-${Z3_VER}-x64-win/bin/msvcp140_2.dll",
|
|
||||||
"z3-${Z3_VER}-x64-win/bin/msvcp140_atomic_wait.dll",
|
|
||||||
"z3-${Z3_VER}-x64-win/bin/msvcp140_codecvt_ids.dll",
|
|
||||||
"z3-${Z3_VER}-x64-win/bin/vcomp140.dll",
|
|
||||||
"z3-${Z3_VER}-x64-win/bin/vcruntime140.dll",
|
|
||||||
"z3-${Z3_VER}-x64-win/bin/vcruntime140_1.dll"
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
// Note: jars vary among platform zips, but contain all the same file names
|
|
||||||
// I'm presuming they vary only by java compiler and/or target JVM.
|
|
||||||
ext.JAVA_JAR = [
|
|
||||||
zip: "z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}.zip",
|
|
||||||
files: [
|
|
||||||
"z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}/bin/com.microsoft.z3.jar",
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
RelativePath computeInto(FileCopyDetails fcd) {
|
|
||||||
def dstSegs = fcd.relativePath.segments
|
|
||||||
def diff = dstSegs.length - fcd.relativeSourcePath.segments.length
|
|
||||||
RelativePath pre = new RelativePath(false, dstSegs.take(diff))
|
|
||||||
assert pre.append(fcd.relativeSourcePath).equals(fcd.relativePath)
|
|
||||||
return pre
|
|
||||||
}
|
|
||||||
|
|
||||||
CopySpec z3CopySpec = copySpec {
|
|
||||||
PLATFORM_BINDINGS.forEach { platform ->
|
|
||||||
File depsFile = file("${DEPS_DIR}/SymbolicSummaryZ3/${platform.zip}")
|
|
||||||
File binRepoFile = file("${BIN_REPO}/Ghidra/Extensions/SymbolicSummaryZ3/${platform.zip}")
|
|
||||||
def z3ZipTree = depsFile.exists() ? zipTree(depsFile) : zipTree(binRepoFile)
|
|
||||||
|
|
||||||
from(z3ZipTree) {
|
|
||||||
include platform.files
|
|
||||||
eachFile { fcd ->
|
|
||||||
fcd.relativePath = computeInto(fcd).append(true, fcd.relativePath.lastName)
|
|
||||||
}
|
|
||||||
into("${platform.name}")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task z3DevUnpackPlatforms(type: Copy) {
|
task z3DevLibsCopy(type: Copy) {
|
||||||
description "Unpack Z3 archives for development use"
|
description "Unpack Z3 archives for development use"
|
||||||
group = "Development Preparation"
|
group = "Development Preparation"
|
||||||
|
|
||||||
with z3CopySpec
|
onlyIf {
|
||||||
destinationDir file("build/os")
|
// Only need to do this if using dependencies directory
|
||||||
|
file("${DEPS_DIR}/SymbolicSummaryZ3/os").exists()
|
||||||
|
}
|
||||||
|
|
||||||
|
with z3LibsCopySpec
|
||||||
|
destinationDir file("build")
|
||||||
}
|
}
|
||||||
|
|
||||||
zipExtensions {
|
zipExtensions {
|
||||||
into(getBaseProjectName(this.project) + "/os") {
|
into(getBaseProjectName(this.project)) {
|
||||||
with z3CopySpec
|
with z3LibsCopySpec
|
||||||
}
|
}
|
||||||
into(getBaseProjectName(this.project)) {
|
into(getBaseProjectName(this.project)) {
|
||||||
from(this.project.file(".")) {
|
from(this.project.file(".")) {
|
||||||
|
@ -137,4 +66,4 @@ zipExtensions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.prepDev.dependsOn(z3DevUnpackPlatforms)
|
rootProject.prepDev.dependsOn(z3DevLibsCopy)
|
||||||
|
|
|
@ -174,37 +174,42 @@ ext.deps = [
|
||||||
destination: FID_DIR
|
destination: FID_DIR
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
name: "z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}.zip", // Use this one for the Java jar
|
name: "z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}.zip", // Linux on 64-bit Intel (use this one for the Java jar)
|
||||||
url: "https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VER}/z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}.zip",
|
url: "https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VER}/z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}.zip",
|
||||||
sha256: "bc31ad12446d7db1bd9d0ac82dec9d7b5129b8b8dd6e44b571a83ac6010d2f9b",
|
sha256: "bc31ad12446d7db1bd9d0ac82dec9d7b5129b8b8dd6e44b571a83ac6010d2f9b",
|
||||||
destination: {
|
destination: {
|
||||||
unzip(DOWNLOADS_DIR, DOWNLOADS_DIR, "z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}.zip")
|
def name = "z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}"
|
||||||
copyDirectory(new File(DOWNLOADS_DIR, "z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}/bin/"), FLAT_REPO_DIR, new WildcardFileFilter("*.jar"))
|
unzip(DOWNLOADS_DIR, DOWNLOADS_DIR, "${name}.zip")
|
||||||
|
copyDirectory(new File(DOWNLOADS_DIR, "${name}/bin/"), file("${DEPS_DIR}/SymbolicSummaryZ3/os/linux_x86_64"), new WildcardFileFilter("libz3*.so"))
|
||||||
|
copyDirectory(new File(DOWNLOADS_DIR, "${name}/bin/"), FLAT_REPO_DIR, new WildcardFileFilter("*.jar"))
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
name: "z3-${Z3_VER}-arm64-osx-${Z3_ARM64_OSX_VER}.zip", // macOS on Apple silicon
|
name: "z3-${Z3_VER}-arm64-osx-${Z3_ARM64_OSX_VER}.zip", // macOS on Apple silicon
|
||||||
url: "https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VER}/z3-${Z3_VER}-arm64-osx-${Z3_ARM64_OSX_VER}.zip",
|
url: "https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VER}/z3-${Z3_VER}-arm64-osx-${Z3_ARM64_OSX_VER}.zip",
|
||||||
sha256: "e7cd325cb2210d3b241d0d5517a293677030f58c1771e196c4574ef99dc45168",
|
sha256: "e7cd325cb2210d3b241d0d5517a293677030f58c1771e196c4574ef99dc45168",
|
||||||
destination: file("${DEPS_DIR}/SymbolicSummaryZ3")
|
destination: {
|
||||||
],
|
unzip(DOWNLOADS_DIR, DOWNLOADS_DIR, "z3-${Z3_VER}-arm64-osx-${Z3_ARM64_OSX_VER}.zip")
|
||||||
[
|
copyDirectory(new File(DOWNLOADS_DIR, "z3-${Z3_VER}-arm64-osx-${Z3_ARM64_OSX_VER}/bin/"), file("${DEPS_DIR}/SymbolicSummaryZ3/os/mac_arm_64"), new WildcardFileFilter("libz3*.dylib"))
|
||||||
name: "z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}.zip", // Linux on 64-bit Intel
|
}
|
||||||
url: "https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VER}/z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}.zip",
|
|
||||||
sha256: "bc31ad12446d7db1bd9d0ac82dec9d7b5129b8b8dd6e44b571a83ac6010d2f9b",
|
|
||||||
destination: file("${DEPS_DIR}/SymbolicSummaryZ3")
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
name: "z3-${Z3_VER}-x64-osx-${Z3_X64_OSX_VER}.zip", // macOS on 64-bit Intel
|
name: "z3-${Z3_VER}-x64-osx-${Z3_X64_OSX_VER}.zip", // macOS on 64-bit Intel
|
||||||
url: "https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VER}/z3-${Z3_VER}-x64-osx-${Z3_X64_OSX_VER}.zip",
|
url: "https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VER}/z3-${Z3_VER}-x64-osx-${Z3_X64_OSX_VER}.zip",
|
||||||
sha256: "0c33d8574f7dcd041f1f4e7fe301840db6a527f866cb74b0b47518bf8053502d",
|
sha256: "0c33d8574f7dcd041f1f4e7fe301840db6a527f866cb74b0b47518bf8053502d",
|
||||||
destination: file("${DEPS_DIR}/SymbolicSummaryZ3")
|
destination: {
|
||||||
|
unzip(DOWNLOADS_DIR, DOWNLOADS_DIR, "z3-${Z3_VER}-x64-osx-${Z3_X64_OSX_VER}.zip")
|
||||||
|
copyDirectory(new File(DOWNLOADS_DIR, "z3-${Z3_VER}-x64-osx-${Z3_X64_OSX_VER}/bin/"), file("${DEPS_DIR}/SymbolicSummaryZ3/os/mac_x86_64"), new WildcardFileFilter("libz3*.dylib"))
|
||||||
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
name: "z3-${Z3_VER}-x64-win.zip", // Windows on 64-bit Intel
|
name: "z3-${Z3_VER}-x64-win.zip", // Windows on 64-bit Intel
|
||||||
url: "https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VER}/z3-${Z3_VER}-x64-win.zip",
|
url: "https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VER}/z3-${Z3_VER}-x64-win.zip",
|
||||||
sha256: "2bcd14b6849fddead3d0b3cb671cc9d134a8ef0b1d3eff3efd7d75a5bbf00dd3",
|
sha256: "2bcd14b6849fddead3d0b3cb671cc9d134a8ef0b1d3eff3efd7d75a5bbf00dd3",
|
||||||
destination: file("${DEPS_DIR}/SymbolicSummaryZ3")
|
destination: {
|
||||||
|
unzip(DOWNLOADS_DIR, DOWNLOADS_DIR, "z3-${Z3_VER}-x64-win.zip")
|
||||||
|
copyDirectory(new File(DOWNLOADS_DIR, "z3-${Z3_VER}-x64-win/bin/"), file("${DEPS_DIR}/SymbolicSummaryZ3/os/win_x86_64"), new WildcardFileFilter("libz3*.dll"))
|
||||||
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
name: "protobuf-6.31.0-py3-none-any.whl",
|
name: "protobuf-6.31.0-py3-none-any.whl",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue