mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
Merge remote-tracking branch 'origin/GP-0_ryanmkurtz_z3'
This commit is contained in:
commit
d4758498ac
2 changed files with 33 additions and 99 deletions
|
@ -21,16 +21,9 @@ apply from: "$rootProject.projectDir/gradle/distributableGhidraExtension.gradle"
|
|||
apply plugin: 'eclipse'
|
||||
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 {
|
||||
api project(':Debugger')
|
||||
api project(':SystemEmulation')
|
||||
//api "com.microsoft.z3:java-jar:${Z3_VER}"
|
||||
api ":com.microsoft.z3:"
|
||||
|
||||
// Oof. Apparently, this doesn't work transitively....
|
||||
|
@ -41,94 +34,30 @@ dependencies {
|
|||
testImplementation project(path: ':Debugger', configuration: 'testArtifacts')
|
||||
}
|
||||
|
||||
ext.PLATFORM_BINDINGS = [
|
||||
[
|
||||
name: "mac_arm_64",
|
||||
zip: "z3-${Z3_VER}-arm64-osx-${Z3_ARM64_OSX_VER}.zip",
|
||||
files: [
|
||||
"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}")
|
||||
}
|
||||
CopySpec z3LibsCopySpec = copySpec {
|
||||
File depsDir = file("${DEPS_DIR}/SymbolicSummaryZ3/os")
|
||||
File binRepoDir = file("${BIN_REPO}/Ghidra/Extensions/SymbolicSummaryZ3/os")
|
||||
from(depsDir.exists() ? depsDir : binRepoDir) {
|
||||
into("os")
|
||||
}
|
||||
}
|
||||
|
||||
task z3DevUnpackPlatforms(type: Copy) {
|
||||
task z3DevLibsCopy(type: Copy) {
|
||||
description "Unpack Z3 archives for development use"
|
||||
group = "Development Preparation"
|
||||
|
||||
with z3CopySpec
|
||||
destinationDir file("build/os")
|
||||
onlyIf {
|
||||
// Only need to do this if using dependencies directory
|
||||
file("${DEPS_DIR}/SymbolicSummaryZ3/os").exists()
|
||||
}
|
||||
|
||||
with z3LibsCopySpec
|
||||
destinationDir file("build")
|
||||
}
|
||||
|
||||
zipExtensions {
|
||||
into(getBaseProjectName(this.project) + "/os") {
|
||||
with z3CopySpec
|
||||
into(getBaseProjectName(this.project)) {
|
||||
with z3LibsCopySpec
|
||||
}
|
||||
into(getBaseProjectName(this.project)) {
|
||||
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
|
||||
],
|
||||
[
|
||||
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",
|
||||
sha256: "bc31ad12446d7db1bd9d0ac82dec9d7b5129b8b8dd6e44b571a83ac6010d2f9b",
|
||||
destination: {
|
||||
unzip(DOWNLOADS_DIR, DOWNLOADS_DIR, "z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}.zip")
|
||||
copyDirectory(new File(DOWNLOADS_DIR, "z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}/bin/"), FLAT_REPO_DIR, new WildcardFileFilter("*.jar"))
|
||||
def name = "z3-${Z3_VER}-x64-glibc-${Z3_X64_GLIBC_VER}"
|
||||
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
|
||||
url: "https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VER}/z3-${Z3_VER}-arm64-osx-${Z3_ARM64_OSX_VER}.zip",
|
||||
sha256: "e7cd325cb2210d3b241d0d5517a293677030f58c1771e196c4574ef99dc45168",
|
||||
destination: file("${DEPS_DIR}/SymbolicSummaryZ3")
|
||||
],
|
||||
[
|
||||
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")
|
||||
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-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",
|
||||
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
|
||||
url: "https://github.com/Z3Prover/z3/releases/download/z3-${Z3_VER}/z3-${Z3_VER}-x64-win.zip",
|
||||
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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue