]> git.bitcoin.ninja Git - ldk-java/commitdiff
Some fixes for aarch64 macos
authorElias Rohrer <ero@tnull.de>
Fri, 20 May 2022 13:45:12 +0000 (15:45 +0200)
committerElias Rohrer <ero@tnull.de>
Fri, 20 May 2022 13:45:12 +0000 (15:45 +0200)
.github/workflows/build.yml
genbindings.sh

index 6b274534c8a50c6e77b1a7ba7396c9cf22ae5787..5bad5ef8b19234f9f956f45882aeb22f23cc5f18 100644 (file)
@@ -227,7 +227,6 @@ jobs:
           cd javatester
           mvn package
           java -ea -jar target/ldk-java-tests-1.0-SNAPSHOT-jar-with-dependencies.jar
-          cd ..
 
   android:
     runs-on: ubuntu-latest
@@ -362,15 +361,23 @@ jobs:
           export PATH=`pwd`/clang+llvm-14.0.1-x86_64-apple-darwin/bin:$PATH
           cd ldk-c-bindings
           CC=clang ./genbindings.sh ../rust-lightning true
-          cd ..
-      - name: Fetch OpenJDK 16
-        run: |
-          wget -O openjdk-16.0.1_osx-x64_bin.tar.gz https://download.java.net/java/GA/jdk16.0.1/7147401fd7354114ac51ef3e1328291f/9/GPL/openjdk-16.0.1_osx-x64_bin.tar.gz
-          if [ "$(shasum -a 256 openjdk-16.0.1_osx-x64_bin.tar.gz | awk '{ print $1 }')" != "6098f839954439d4916444757c542c1b8778a32461706812d41cc8bbefce7f2f" ]; then
-            echo "Bad hash"
-            exit 1
+      - name: Fetch OpenJDK 18
+        run: |
+          if [ "$(uname -m)" = "arm64" ]; then
+            wget -O openjdk-18.0.1.1_macos-aarch64_bin.tar.gz https://download.java.net/java/GA/jdk18.0.1.1/65ae32619e2f40f3a9af3af1851d6e19/2/GPL/openjdk-18.0.1.1_macos-aarch64_bin.tar.gz
+            if [ "$(shasum -a 256 openjdk-18.0.1.1_macos-aarch64_bin.tar.gz | awk '{ print $1 }')" != "29773ad68063bdad7fbaeb762cd873d3f243e86de380d3ac5335cdb929371fb5" ]; then
+              echo "Bad hash"
+              exit 1
+            fi
+            tar xvvf openjdk-18.0.1.1_macos-aarch64_bin.tar.gz
+          else
+            wget -O openjdk-18.0.1.1_macos-x64_bin.tar.gz https://download.java.net/java/GA/jdk18.0.1.1/65ae32619e2f40f3a9af3af1851d6e19/2/GPL/openjdk-18.0.1.1_macos-x64_bin.tar.gz
+            if [ "$(shasum -a 256 openjdk-18.0.1.1_macos-x64_bin.tar.gz | awk '{ print $1 }')" != "f02d17ec5a387555f8489abc352d973b6c10364409b597046025938e2266d72a" ]; then
+              echo "Bad hash"
+              exit 1
+            fi
+            tar xvvf openjdk-18.0.1.1_macos-x64_bin.tar.gz
           fi
-          tar xvvf openjdk-16.0.1_osx-x64_bin.tar.gz
       - name: Checkout latest Linux binaries
         run: |
           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
@@ -388,17 +395,20 @@ jobs:
       - name: Build Java Release Bindings
         run: |
           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
-          export JAVA_HOME=`pwd`/jdk-16.0.1.jdk/Contents/Home
+          export JAVA_HOME=`pwd`/jdk-18.0.1.1.jdk/Contents/Home
           export PATH=$JAVA_HOME/bin:$PATH
           export PATH=`pwd`/clang+llvm-14.0.1-x86_64-apple-darwin/bin:$PATH
           ./genbindings.sh ./ldk-c-bindings/ "-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin -isysroot$(xcrun --show-sdk-path)" false false
+
           if [ "${{ matrix.platform }}" = "macos-11" ]; then
             export CC="clang --target=aarch64-apple-darwin"
             export LDK_TARGET=aarch64-apple-darwin
             export LDK_TARGET_CPU=apple-a14
             ./genbindings.sh ./ldk-c-bindings/ "-I$JAVA_HOME/include/ -I$JAVA_HOME/include/darwin -isysroot$(xcrun --show-sdk-path)" false false
             cat src/main/resources/liblightningjni_MacOSX-aarch64.nativelib > /dev/null
+
           fi
+
       - name: Fetch Maven 3.8.4
         run: |
           # We don't bother using the upstream mirrors as they remove prior
@@ -413,7 +423,7 @@ jobs:
           export PATH=apache-maven-3.8.4/bin:$PATH
       - name: Run Java Tests against built jar
         run: |
-          export JAVA_HOME=`pwd`/jdk-16.0.1.jdk/Contents/Home
+          export JAVA_HOME=`pwd`/jdk-18.0.1.1.jdk/Contents/Home
           export PATH=$JAVA_HOME/bin:$PATH
           mvn -DskipTests=true package
           export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
@@ -422,7 +432,6 @@ jobs:
           cd javatester
           mvn -q -B package
           java -ea -jar target/ldk-java-tests-1.0-SNAPSHOT-jar-with-dependencies.jar
-          cd ..
       - name: Check latest release libs are in git
         run: |
           if [ "${{ matrix.platform }}" = "macos-11" ]; then
@@ -447,7 +456,7 @@ jobs:
         run: |
           if [ "${{ matrix.platform }}" != "macos-11" ]; then
             export LDK_GARBAGECOLLECTED_GIT_OVERRIDE="$(git describe --tag HEAD)"
-            export JAVA_HOME=`pwd`/jdk-16.0.1.jdk/Contents/Home
+            export JAVA_HOME=`pwd`/jdk-18.0.1.1.jdk/Contents/Home
             export PATH=$JAVA_HOME/bin:$PATH
             cp "ldk-java-bins/${LDK_GARBAGECOLLECTED_GIT_OVERRIDE}/"liblightningjni_MacOSX-{x86_64,aarch64}.nativelib src/main/resources/
             mvn clean
@@ -457,5 +466,4 @@ jobs:
             cd javatester
             mvn -q -B package
             java -ea -jar target/ldk-java-tests-1.0-SNAPSHOT-jar-with-dependencies.jar
-            cd ..
           fi
index e2a6ca7c75ec107ae403709410504ced37738932..253b8aad94abb4ba912df8f0ce3a0db85d37c685 100755 (executable)
@@ -29,7 +29,7 @@ if [ "$3" = "leaks" ]; then
 fi
 
 cp "$1/lightning-c-bindings/include/lightning.h" ./
-if [ "$(rustc --version --verbose | grep "host:")" = "host: x86_64-apple-darwin" ]; then
+if [ "$(rustc --version --verbose | grep "host:")" = "host: x86_64-apple-darwin" ] || [ "$(rustc --version --verbose | grep "host:")" = "host: aarch64-apple-darwin" ]; then
        # OSX sed is for some reason not compatible with GNU sed
        sed -i '' "s/TransactionOutputs/C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ/g" ./lightning.h
 else
@@ -60,6 +60,7 @@ if [ "$2" != "wasm" ]; then
                        LDK_JAR_TARGET=true
                        ;;
                "aarch64-apple-darwin"*)
+                       LDK_TARGET_CPU="apple-a14"
                        LDK_TARGET_SUFFIX="_MacOSX-aarch64"
                        LDK_JAR_TARGET=true
                        ;;
@@ -70,7 +71,7 @@ if [ "$2" != "wasm" ]; then
                LDK_TARGET_CPU="sandybridge"
        fi
 
-       if [ "$(rustc --version --verbose | grep "host:")" = "host: x86_64-apple-darwin" ]; then
+       if [ "$(rustc --version --verbose | grep "host:")" = "host: x86_64-apple-darwin" ] || [ "$(rustc --version --verbose | grep "host:")" = "host: aarch64-apple-darwin" ]; then
                # OSX sed is for some reason not compatible with GNU sed
                sed -i '' "s/^    <version>.*<\/version>/    <version>${LDK_GARBAGECOLLECTED_GIT_OVERRIDE:1:100}<\/version>/g" pom.xml
        else