Skip to content

Commit

Permalink
Merge remote-tracking branch
Browse files Browse the repository at this point in the history
'origin/GP-1106_ryanmkurtz_PR-3197_ryanmkurtz_platforms' (Closes NationalSecurityAgency#3197)
  • Loading branch information
ryanmkurtz committed Aug 31, 2021
2 parents 977fa00 + 00533b2 commit 5ef6ac9
Show file tree
Hide file tree
Showing 43 changed files with 522 additions and 460 deletions.
8 changes: 5 additions & 3 deletions DevGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,23 +270,25 @@ Now build using Gradle:
On Linux:

```bash
gradle buildNatives_linux64
gradle buildNatives_linux_x86_64
```

On macOS:

```bash
gradle buildNatives_osx64
gradle buildNatives_mac_x86_64
```

On Windows:

```bash
gradle buildNatives_win64
gradle buildNatives_win_x86_64
```

This will build the decompiler, the demangler for GNU toolchains, the sleigh compiler, and (on Windows only) the PDB parser.

**NOTE:** `buildNatives_linux_arm_64` and `buildNatives_mac_arm_64` are also supported.

### Pre-compile Language Modules (optional)

Optionally, to pre-compile all the language modules, you may also execute:
Expand Down
1 change: 0 additions & 1 deletion GPL/DMG/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* ###
* IP: Public Domain
*/
apply from: file("../gpl.gradle").getCanonicalPath()

if (findProject(':Generic') != null) {
apply from: "$rootProject.projectDir/gradle/javaProject.gradle"
Expand Down
12 changes: 6 additions & 6 deletions GPL/DMG/certification.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ data/lib/hfsexplorer-0_21-src.zip||GPL 3||||END|
data/lib/hfsx.jar||GPL 3||||END|
data/lib/hfsx_dmglib.jar||GPL 3||||END|
data/lib/iharder-base64.jar||GPL 3||||END|
data/os/win32/llio_amd64.dll||GPL 3||||END|
data/os/win32/llio_i386.dll||GPL 3||||END|
data/os/win32/llio_ia64.dll||GPL 3||||END|
data/os/win64/llio_amd64.dll||GPL 3||||END|
data/os/win64/llio_i386.dll||GPL 3||||END|
data/os/win64/llio_ia64.dll||GPL 3||||END|
data/os/win_x86_32/llio_amd64.dll||GPL 3||||END|
data/os/win_x86_32/llio_i386.dll||GPL 3||||END|
data/os/win_x86_32/llio_ia64.dll||GPL 3||||END|
data/os/win_x86_64/llio_amd64.dll||GPL 3||||END|
data/os/win_x86_64/llio_i386.dll||GPL 3||||END|
data/os/win_x86_64/llio_ia64.dll||GPL 3||||END|
data/server_memory.cfg||Public Domain||||END|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
43 changes: 12 additions & 31 deletions GPL/DemanglerGnu/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/* ###
* IP: Public Domain
*/
apply from: file("../gpl.gradle").getCanonicalPath()

if (findProject(':Generic') != null) {
apply from: "$rootProject.projectDir/gradle/nativeProject.gradle"
apply from: "$rootProject.projectDir/gradle/distributableGPLModule.gradle"
}
else {
apply from: "../utils.gradle"
apply from: "../nativePlatforms.gradle"
apply from: "../nativeBuildProperties.gradle"
}

Expand All @@ -21,30 +22,6 @@ def v24 = "demangler_gnu_v2_24"
def srcVersion33_1 = "src/demangler_gnu_v2_33_1"
def srcVersion24 = "src/demangler_gnu_v2_24"

/****************************************************************************
* Defines the platforms we have to support in Ghidra. This model is used
* for all native builds and should be extended by each module as-needed.
****************************************************************************/
model {

// define the platforms that we support in ghidra
platforms {
win64 {
architecture 'x86_64'
operatingSystem 'windows'
}
linux64 {
architecture 'x86_64'
operatingSystem 'linux'
}
osx64 {
architecture 'x86_64'
operatingSystem 'osx'
}
}
}


/**
* This project has some native 'c' code we need to include in the zip for licensing
* and build reasons. So include them here, but we have to do something special: the
Expand Down Expand Up @@ -100,9 +77,11 @@ model {
//
components {
demangler_gnu_v2_33_1(NativeExecutableSpec) {
targetPlatform "win64"
targetPlatform "linux64"
targetPlatform "osx64"
targetPlatform "win_x86_64"
targetPlatform "linux_x86_64"
targetPlatform "linux_arm_64"
targetPlatform "mac_x86_64"
targetPlatform "mac_arm_64"
sources {
c {
source {
Expand All @@ -119,9 +98,11 @@ model {
// Version 2.24
//
demangler_gnu_v2_24(NativeExecutableSpec) {
targetPlatform "win64"
targetPlatform "linux64"
targetPlatform "osx64"
targetPlatform "win_x86_64"
targetPlatform "linux_x86_64"
targetPlatform "linux_arm_64"
targetPlatform "mac_x86_64"
targetPlatform "mac_arm_64"
sources {
c {
source {
Expand Down
7 changes: 4 additions & 3 deletions GPL/GnuDisassembler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ ext.binutilsDistro = "${binutils}.tar.bz2"

// Find the GPL dir
def gplDir = null;
if (file("../gpl.gradle").exists()) {
if (file("../utils.gradle").exists()) {
gplDir = file("..").getCanonicalPath()
}
else {
// Module lives disconnected from the GPL directory, which it will need to build.
// Find a Ghidra installation directory and use its GPL directory.
if (file("../../Extensions").exists() && file("../../../GPL/gpl.gradle").exists()) {
if (file("../../Extensions").exists() && file("../../../GPL/utils.gradle").exists()) {
// Module is installed within a Ghidra installation (i.e, ghidra/Ghidra/Extensions)
gplDir = file("../../../GPL").getCanonicalPath()
}
Expand Down Expand Up @@ -76,7 +76,8 @@ if (findProject(':Generic') != null) {
}
else {
// Build GPL extension (gdis)
apply from: "${gplDir}/gpl.gradle"
apply from: "${gplDir}/utils.gradle"
apply from: "${gplDir}/nativePlatforms.gradle"
apply from: "${gplDir}/nativeBuildProperties.gradle"
apply from: "buildGdis.gradle"
}
Expand Down
27 changes: 11 additions & 16 deletions GPL/GnuDisassembler/buildGdis.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

defaultTasks 'assemble'

ext.supportedPlatforms = ['osx64', 'linux64']
ext.supportedPlatforms = ['mac_x86_64', 'mac_arm_64', 'linux_x86_64', 'linux_arm_64']

ext.binutilsResource = new File("${projectDir}/${binutils}.tar.bz2")

Expand All @@ -18,17 +18,6 @@ def binutilsUnpackDir = file("${project.buildDir}/${binutils}/")
******************************************************************************************/

model {
platforms {
linux64 {
architecture 'x86_64'
operatingSystem 'linux'
}
osx64 {
architecture 'x86_64'
operatingSystem 'osx'
}
}

components {

gdis(NativeExecutableSpec) {
Expand Down Expand Up @@ -56,11 +45,17 @@ model {
}
}

tasks.compileGdisOsx64ExecutableGdisC {
dependsOn 'copyBinutilsArtifcats_osx64'
tasks.compileGdisMac_x86_64ExecutableGdisC {
dependsOn 'copyBinutilsArtifcats_mac_x86_64'
}
tasks.compileGdisLinux_x86_64ExecutableGdisC {
dependsOn 'copyBinutilsArtifcats_linux_x86_64'
}
tasks.compileGdisMac_arm_64ExecutableGdisC {
dependsOn 'copyBinutilsArtifcats_mac_arm_64'
}
tasks.compileGdisLinux64ExecutableGdisC {
dependsOn 'copyBinutilsArtifcats_linux64'
tasks.compileGdisLinux_arm_64ExecutableGdisC {
dependsOn 'copyBinutilsArtifcats_linux_arm_64'
}

}
Expand Down
90 changes: 0 additions & 90 deletions GPL/gpl.gradle

This file was deleted.

46 changes: 28 additions & 18 deletions GPL/nativeBuildProperties.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,35 @@ apply plugin: 'c'
****************************************************************************/
model {

// define the platforms that we support in ghidra
// Use the PLATFORMS list to create the platforms that Ghidra supports.
platforms {
win32 {
architecture 'x86'
operatingSystem 'windows'
}
win64 {
architecture 'x86_64'
operatingSystem 'windows'
project.PLATFORMS.each { platform ->
"${platform.name}" {
architecture platform.arch
operatingSystem platform.os
}
}
linux64 {
architecture 'x86_64'
operatingSystem 'linux'
}

// The toolChains block is needed because Gradle doesn't find gcc/clang on ARM-based Linux
// and macOS platforms without explicitly declaring their targets. Might be a bug in the
// native Gradle plugin.
toolChains {
if (isCurrentLinux()) {
gcc(Gcc) {
if (isCurrentArm_64()) {
target("linux_arm_64")
}
}
}
osx64 {
architecture 'x86_64'
operatingSystem 'osx'
if (isCurrentMac()) {
clang(Clang) {
if (isCurrentArm_64()) {
target("mac_arm_64")
}
}
}
}
}
}

/*******************************************************************************************
Expand All @@ -51,7 +61,7 @@ model {
task CheckToolChain {
// Native C/Cpp plugins will trigger failure if no tool chain found
doFirst {
if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
if (isCurrentWindows()) {
// ensure that required MS Visual Studio is installed
if (!VISUAL_STUDIO_INSTALL_DIR) {
throw new GradleException("Visual Studio not found!");
Expand Down Expand Up @@ -100,7 +110,7 @@ def shouldSkipNative(task) {
/*******************************************************************************************
* Task Rule : builds all the natives in this module for a given platform.
*
* Example : gradle buildNatives_win64 will build all win64 native executables and shared libraries.
* Example : gradle buildNatives_win_x86_64 will build all win_x86_64 native executables and shared libraries.
*
* NOTE: you must be on the appropriate platform for this to work.
*
Expand Down Expand Up @@ -151,7 +161,7 @@ tasks.addRule("Pattern: buildNatives_<platform name>]: build all natives for giv
* Task Rule : builds all the natives in this module for a given platform and copies the
* results to the bin repo.
*
* Example : gradle prebuildNatives_win64 will build all win64 native executables and shared
* Example : gradle prebuildNatives_win_x86_64 will build all win_x86_64 native executables and shared
* libraries and copy the results to the appropriate project/os directory in the bin
* repo.
*
Expand Down
Loading

0 comments on commit 5ef6ac9

Please sign in to comment.