Browse Source

add native libraries for aarch64

terminal
Craig Raw 3 years ago
parent
commit
bf078b2ea0
  1. 10
      build.gradle
  2. 2
      drongo
  3. 9
      src/main/java/com/sparrowwallet/sparrow/io/Hwi.java
  4. 5
      src/main/java/com/sparrowwallet/sparrow/net/Bwt.java
  5. BIN
      src/main/resources/native/osx/aarch64/hwi-2.1.0-mac-aarch64-signed.zip
  6. BIN
      src/main/resources/native/osx/aarch64/libbwt_jni.dylib

10
build.gradle

@ -11,6 +11,12 @@ def osName = os.getFamilyName()
if(os.macOsX) { if(os.macOsX) {
osName = "osx" osName = "osx"
} }
def targetName = osName
def osArch = "x64"
if(System.getProperty("os.arch") == "aarch64") {
osArch = "aarch64"
targetName = osName + "-" + osArch
}
group "com.sparrowwallet" group "com.sparrowwallet"
version "${sparrowVersion}" version "${sparrowVersion}"
@ -118,7 +124,7 @@ compileJava {
processResources { processResources {
doLast { doLast {
delete fileTree("$buildDir/resources/main/native").matching { delete fileTree("$buildDir/resources/main/native").matching {
exclude "${osName}/**" exclude "${osName}/${osArch}/**"
} }
} }
} }
@ -550,7 +556,7 @@ extraJavaModuleInfo {
module('jcip-annotations-1.0.jar', 'net.jcip.annotations', '1.0') { module('jcip-annotations-1.0.jar', 'net.jcip.annotations', '1.0') {
exports('net.jcip.annotations') exports('net.jcip.annotations')
} }
module("netlayer-jpms-${osName}-0.6.8.jar", 'netlayer.jpms', '0.6.8') { module("netlayer-jpms-${targetName}-0.6.8.jar", 'netlayer.jpms', '0.6.8') {
exports('org.berndpruenster.netlayer.tor') exports('org.berndpruenster.netlayer.tor')
requires('com.github.ravn.jsocks') requires('com.github.ravn.jsocks')
requires('com.github.JesusMcCloud.jtorctl') requires('com.github.JesusMcCloud.jtorctl')

2
drongo

@ -1 +1 @@
Subproject commit 9cb95f2f8ca25c23021667f7be47ab9bd9846ce4 Subproject commit ba8692450335f2e5293ddd3951a394244315803f

9
src/main/java/com/sparrowwallet/sparrow/io/Hwi.java

@ -294,7 +294,14 @@ public class Hwi {
//The check will still happen on first invocation, but will not thereafter //The check will still happen on first invocation, but will not thereafter
//See https://github.com/bitcoin-core/HWI/issues/327 for details //See https://github.com/bitcoin-core/HWI/issues/327 for details
if(platform == Platform.OSX) { if(platform == Platform.OSX) {
InputStream inputStream = Hwi.class.getResourceAsStream("/native/osx/x64/" + HWI_VERSION_DIR + "-mac-amd64-signed.zip"); String osArch = System.getProperty("os.arch");
InputStream inputStream;
if(osArch.equals("aarch64")) {
inputStream = Hwi.class.getResourceAsStream("/native/osx/aarch64/" + HWI_VERSION_DIR + "-mac-aarch64-signed.zip");
} else {
inputStream = Hwi.class.getResourceAsStream("/native/osx/x64/" + HWI_VERSION_DIR + "-mac-amd64-signed.zip");
}
if(inputStream == null) { if(inputStream == null) {
throw new IllegalStateException("Cannot load " + HWI_VERSION_DIR + " from classpath"); throw new IllegalStateException("Cannot load " + HWI_VERSION_DIR + " from classpath");
} }

5
src/main/java/com/sparrowwallet/sparrow/net/Bwt.java

@ -41,7 +41,10 @@ public class Bwt {
if(!initialized) { if(!initialized) {
try { try {
org.controlsfx.tools.Platform platform = org.controlsfx.tools.Platform.getCurrent(); org.controlsfx.tools.Platform platform = org.controlsfx.tools.Platform.getCurrent();
if(platform == org.controlsfx.tools.Platform.OSX) { String osArch = System.getProperty("os.arch");
if(platform == org.controlsfx.tools.Platform.OSX && osArch.equals("aarch64")) {
NativeUtils.loadLibraryFromJar("/native/osx/aarch64/libbwt_jni.dylib");
} else if(platform == org.controlsfx.tools.Platform.OSX) {
NativeUtils.loadLibraryFromJar("/native/osx/x64/libbwt_jni.dylib"); NativeUtils.loadLibraryFromJar("/native/osx/x64/libbwt_jni.dylib");
} else if(platform == org.controlsfx.tools.Platform.WINDOWS) { } else if(platform == org.controlsfx.tools.Platform.WINDOWS) {
NativeUtils.loadLibraryFromJar("/native/windows/x64/bwt_jni.dll"); NativeUtils.loadLibraryFromJar("/native/windows/x64/bwt_jni.dll");

BIN
src/main/resources/native/osx/aarch64/hwi-2.1.0-mac-aarch64-signed.zip

Binary file not shown.

BIN
src/main/resources/native/osx/aarch64/libbwt_jni.dylib

Binary file not shown.
Loading…
Cancel
Save