diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml
index b92086e..5f2b34a 100644
--- a/.github/workflows/build-and-release.yml
+++ b/.github/workflows/build-and-release.yml
@@ -29,12 +29,6 @@ jobs:
cmake_args: '-DCMAKE_BUILD_TYPE=Release -DARCH=native -DBUILD_SHARED_LIBS=ON'
artifact_name: 'librandomx_macos_x86_64.dylib'
output_lib: 'librandomx_macos_x86_64.dylib'
- # macOS - aarch64
- - os: macos-latest
- arch: aarch64
- cmake_args: '-DCMAKE_BUILD_TYPE=Release -DARCH=native -DBUILD_SHARED_LIBS=ON'
- artifact_name: 'librandomx_macos_aarch64.dylib'
- output_lib: 'librandomx_macos_aarch64.dylib'
# Windows - x86_64
- os: windows-latest
arch: x86_64
@@ -49,6 +43,9 @@ jobs:
arch: amd64
- os: macos-latest
arch: amd64
+ # Exclude macOS-aarch64 from GitHub Actions build
+ - os: macos-latest
+ arch: aarch64
- os: windows-latest
arch: aarch64
- os: windows-latest
@@ -75,15 +72,34 @@ jobs:
run: |
cd randomx
mkdir build && cd build
+
+ echo "Configuring for native compilation"
cmake .. ${{ matrix.cmake_args }}
+
make -j4
mkdir -p ../../src/main/resources/native
+
+ # Platform-specific copy commands with verification
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
- cp *.so ../../src/main/resources/native/${{ matrix.output_lib }}
+ cp -v librandomx.so ../../src/main/resources/native/${{ matrix.output_lib }}
+ ls -la ../../src/main/resources/native/
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
- cp *.dylib ../../src/main/resources/native/${{ matrix.output_lib }}
+ cp -v librandomx.dylib ../../src/main/resources/native/${{ matrix.output_lib }}
+ ls -la ../../src/main/resources/native/
elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then
- cp *.dll ../../src/main/resources/native/${{ matrix.output_lib }}
+ cp -v librandomx.dll ../../src/main/resources/native/${{ matrix.output_lib }}
+ ls -la ../../src/main/resources/native/
+ fi
+ shell: bash
+
+ - name: Verify library file
+ run: |
+ echo "Verifying library file in native resources directory"
+ if [ -f "src/main/resources/native/${{ matrix.output_lib }}" ]; then
+ echo "✅ Library file ${{ matrix.output_lib }} exists"
+ else
+ echo "❌ Library file ${{ matrix.output_lib }} is missing"
+ exit 1
fi
shell: bash
@@ -100,12 +116,29 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- - name: Download Dynamic Link Library Artifacts
+ - name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: src/main/resources/native/
- pattern: librandomx-*
- - run: ls src/main/resources/native/
+ merge-multiple: true
+
+ - name: Check for Apple Silicon Library
+ run: |
+ echo "Checking for macOS ARM64 library (should be precompiled locally)"
+ if [ -f "src/main/resources/native/librandomx_macos_aarch64.dylib" ]; then
+ echo "✅ Found precompiled Apple Silicon library"
+ else
+ echo "⚠️ WARNING: Apple Silicon library (librandomx_macos_aarch64.dylib) not found!"
+ echo "⚠️ Please compile this library locally on an Apple Silicon Mac and commit it to the repository."
+ echo "⚠️ Build will continue but the final JAR will not support Apple Silicon Macs."
+ fi
+ shell: bash
+
+ - name: List downloaded artifacts
+ run: |
+ echo "Contents of native resources directory:"
+ ls -la src/main/resources/native/
+ shell: bash
- name: Set up JDK
uses: actions/setup-java@v4
@@ -126,6 +159,8 @@ jobs:
release:
runs-on: ubuntu-latest
needs: build-java
+ # Only run release job on master branch
+ if: github.ref == 'refs/heads/master'
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -149,34 +184,52 @@ jobs:
- name: Find Main JAR File
id: find_jar
run: |
- JAR_FILE=$(find target/ -type f -name "xdagj-native-randomx-*.jar" | head -n 1)
+ JAR_FILE=$(find target/ -type f -name "xdagj-native-randomx-*.jar" ! -name "*-sources.jar" ! -name "*-javadoc.jar" | head -n 1)
if [ -z "$JAR_FILE" ]; then
echo "Error: No main JAR file found!"
exit 1
fi
echo "Found JAR file: $JAR_FILE"
echo "jar_file=$JAR_FILE" >> $GITHUB_ENV
+ # Also set the JAR filename without path for easier use
+ JAR_BASENAME=$(basename "$JAR_FILE")
+ echo "jar_basename=$JAR_BASENAME" >> $GITHUB_ENV
- name: Generate Release Notes
+ if: github.ref == 'refs/heads/master' # Only on master branch
run: |
- echo "### Changelog" > RELEASE_NOTES.md
+ echo "# xdagj-native-randomx v${{ env.VERSION }}" > RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
- echo "$(git log --pretty=format:"* %s (%h)" --no-merges $(git rev-list --tags --max-count=1)..HEAD)" >> RELEASE_NOTES.md
+ echo "## Changes" >> RELEASE_NOTES.md
+ echo "- Updated RandomX native libraries" >> RELEASE_NOTES.md
+ echo "- Improved build process" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md
- echo "### Additional Notes" >> RELEASE_NOTES.md
- echo "- Build improvements." >> RELEASE_NOTES.md
+ echo "## Native libraries included" >> RELEASE_NOTES.md
+ echo "- Linux: x86_64" >> RELEASE_NOTES.md
+ echo "- Windows: x86_64" >> RELEASE_NOTES.md
+ echo "- macOS: x86_64, aarch64 (Apple Silicon)" >> RELEASE_NOTES.md
+ echo "" >> RELEASE_NOTES.md
+ echo "## System requirements" >> RELEASE_NOTES.md
+ echo "- JDK 17 or later" >> RELEASE_NOTES.md
+ echo "" >> RELEASE_NOTES.md
+ echo "## Known issues" >> RELEASE_NOTES.md
echo "- Known issues: None." >> RELEASE_NOTES.md
- name: Create Release using gh CLI
+ if: github.ref == 'refs/heads/master' # Only on master branch
run: |
gh release create "v${{ env.VERSION }}" --title "xdagj-native-randomx v${{ env.VERSION }}" --notes-file RELEASE_NOTES.md
env:
GH_TOKEN: ${{ github.token }} # Use the token automatically generated by GitHub
- name: Rename output file
- run: mv "target/xdagj-native-randomx-${{ env.VERSION }}.jar" "target/xdagj-native-randomx.jar"
+ run: |
+ echo "Original JAR path: ${{ env.jar_file }}"
+ cp "${{ env.jar_file }}" "target/xdagj-native-randomx.jar"
+ echo "✅ Renamed JAR file created at target/xdagj-native-randomx.jar"
- name: Upload JAR using gh CLI
+ if: github.ref == 'refs/heads/master' # Only on master branch
run: |
gh release upload "v${{ env.VERSION }}" target/xdagj-native-randomx.jar --clobber
env:
diff --git a/.gitignore b/.gitignore
index c836fce..cd9b1f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,5 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target/
+
+.DS_Store
diff --git a/README.md b/README.md
index e773903..e914ea5 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,8 @@ Support the project with XDAG donations:
- **JDK**: v17 or later
- **Maven**: v3.9.9 or later
+- **CMake**: v3.5 or later
+- **GCC/Compiler**: GCC v4.8 or later (v7+ recommended for best performance)
### **2. Build Steps**
@@ -73,12 +75,19 @@ make -j4
cp -i librandomx.dylib ../../src/main/resources/native/librandomx_macos_x86_64.dylib
```
-##### **macOS aarch64**
+##### **macOS aarch64 (Apple Silicon)**
+For Apple Silicon Macs (M1, M2, M3), use the provided script:
+```bash
+# Run from the project root
+./scripts/build-macos-arm64.sh
+```
+
+Or manually:
```bash
cd randomx
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DARCH=native -DBUILD_SHARED_LIBS=ON
-make -j4
+make -j$(sysctl -n hw.ncpu)
cp -i librandomx.dylib ../../src/main/resources/native/librandomx_macos_aarch64.dylib
```
@@ -90,6 +99,7 @@ cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DARCH=native -DBUILD_S
make -j4
cp -i randomx.dll ../../src/main/resources/native/librandomx_windows_x86_64.dll
```
+You can also compile using Visual Studio, as the official RandomX repository provides solution files.
#### **2.3 Compile Java Library**
```bash
@@ -204,6 +214,18 @@ JIT flag will cause jvm to crash in MacOS
We welcome contributions to improve the project! Please feel free to submit issues or pull requests.
+### **Contributing to the library**
+
+If you're submitting changes that might affect the native libraries:
+
+1. For platform-specific changes, compile the native library for your platform:
+ * Linux x86_64, macOS x86_64, or Windows x86_64: Follow the compilation steps above.
+ * macOS aarch64 (Apple Silicon): Must be compiled on an Apple Silicon Mac using provided script.
+
+2. Commit both your code changes and the updated native library files.
+
+3. GitHub Actions will build for other platforms and generate a complete multi-platform JAR.
+
For discussions or questions, contact the [xdagj community](https://github.com/XDagger/xdagj).
---
diff --git a/pom.xml b/pom.xml
index c422e17..460c9fc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
io.xdag
xdagj-native-randomx
- 0.2.1
+ 0.2.2
xdagj-native-randomx
A Java RandomX Library For XDAGJ
@@ -22,10 +22,10 @@
3.17.0
- 5.15.0
- 1.18.34
- 2.0.16
- 5.10.3
+ 5.17.0
+ 1.18.38
+ 2.0.17
+ 5.12.2
1.37
diff --git a/randomx b/randomx
index 7bf186b..cb29ec5 160000
--- a/randomx
+++ b/randomx
@@ -1 +1 @@
-Subproject commit 7bf186bcc97d4c6460108031d8af5c9d2c6e1610
+Subproject commit cb29ec5690c90a1358ec4ef67a969083bdf18864
diff --git a/scripts/build-macos-arm64.sh b/scripts/build-macos-arm64.sh
new file mode 100755
index 0000000..501c127
--- /dev/null
+++ b/scripts/build-macos-arm64.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# Script to build RandomX for Apple Silicon (M series chips)
+# This script should be run on an Apple Silicon Mac
+
+# Check if running on ARM Mac
+if [[ $(uname -m) != "arm64" ]]; then
+ echo "❌ This script must be run on an Apple Silicon Mac (M1/M2/M3)"
+ exit 1
+fi
+
+echo "🔍 Building RandomX library for Apple Silicon (ARM64)..."
+
+# Navigate to randomx directory
+cd "$(dirname "$0")/../randomx" || exit 1
+
+# Create build directory if it doesn't exist
+mkdir -p build
+cd build || exit 1
+
+echo "🔧 Running CMake..."
+cmake .. -DCMAKE_BUILD_TYPE=Release -DARCH=native -DBUILD_SHARED_LIBS=ON
+
+echo "🔨 Compiling RandomX..."
+make -j$(sysctl -n hw.ncpu)
+
+# Create native resources directory if it doesn't exist
+mkdir -p ../../src/main/resources/native
+
+echo "📦 Copying library to resources directory..."
+cp -vf librandomx.dylib ../../src/main/resources/native/librandomx_macos_aarch64.dylib
+
+echo "✅ Build complete!"
+echo "Library location: src/main/resources/native/librandomx_macos_aarch64.dylib"
+echo ""
+echo "Please commit this file to your repository before pushing to GitHub."
+echo "This will allow GitHub Actions to package it with the other platform libraries."
\ No newline at end of file
diff --git a/src/main/resources/native/librandomx_macos_aarch64.dylib b/src/main/resources/native/librandomx_macos_aarch64.dylib
old mode 100644
new mode 100755
index 83eb391..da6fb15
Binary files a/src/main/resources/native/librandomx_macos_aarch64.dylib and b/src/main/resources/native/librandomx_macos_aarch64.dylib differ