From 47c4f37dacb180564b5b44b8bd3ad58efe9a08bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=B7=E6=B8=A1?= Date: Fri, 15 Nov 2024 12:43:02 +0800 Subject: [PATCH 1/6] add suport for linux aarch64 --- install.sh | 1 + src/commands/install.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 35cd5aa..b28c2a0 100755 --- a/install.sh +++ b/install.sh @@ -17,6 +17,7 @@ else "Darwin x86_64") target="x86_64-apple-darwin" ;; "Darwin arm64") target="aarch64-apple-darwin" ;; "Linux x86_64") target="x86_64-unknown-linux-gnu" ;; + "Linux aarch64") target="aarch64-unknown-linux-gnu.zip" ;; *) echo "Unsupported OS + CPU combination: $(uname -sm)"; exit 1 ;; esac fi diff --git a/src/commands/install.rs b/src/commands/install.rs index 72e470e..173ac6b 100644 --- a/src/commands/install.rs +++ b/src/commands/install.rs @@ -24,8 +24,10 @@ cfg_if! { const ARCHIVE_NAME: &str = "deno-aarch64-apple-darwin.zip"; } else if #[cfg(all(target_os = "macos", target_arch = "x86_64"))] { const ARCHIVE_NAME: &str = "deno-x86_64-apple-darwin.zip"; - } else if #[cfg(target_os = "linux")] { + } else if #[cfg(all(target_os = "linux", target_arch = "x86_64"))] { const ARCHIVE_NAME: &str = "deno-x86_64-unknown-linux-gnu.zip"; + } else if #[cfg(all(target_os = "linux", target_arch = "aarch64"))] { + const ARCHIVE_NAME: &str = "deno-aarch64-unknown-linux-gnu.zip"; } } From 44865455b20b7812ad21cfa3db026bc64384edb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=B7=E6=B8=A1?= Date: Fri, 15 Nov 2024 12:53:02 +0800 Subject: [PATCH 2/6] ci: cross compile on linux aarch64 --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0e66f1..8a0133a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,14 +67,20 @@ jobs: - name: Build release run: cargo build --release --locked + - name: Run cargo test + run: cargo test --locked + - name: Build release(aarch64-apple-darwin) if: startsWith(matrix.os, 'macOS') run: | rustup target add aarch64-apple-darwin cargo build --release --target aarch64-apple-darwin --locked - - name: Run cargo test - run: cargo test --locked + - name: Build release(aarch64-unknown-linux-gnu) + if: startsWith(matrix.os, 'ubuntu') + run: | + rustup target add aarch64-unknown-linux-gnu + cargo build --release --target aarch64-unknown-linux-gnu --locked - name: Test install from local file (bash) if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macOS') @@ -85,12 +91,17 @@ jobs: run: zip -r dvm-x86_64-unknown-linux-gnu.zip dvm working-directory: target/release + - name: Pre-release (linux-aarch64) + if: startsWith(matrix.os, 'ubuntu') + run: zip -r dvm-aarch64-unknown-linux-gnu.zip dvm + working-directory: target/aarch64-unknown-linux-gnu/release + - name: Pre-release (mac) if: startsWith(matrix.os, 'macOS') run: zip -r dvm-x86_64-apple-darwin.zip dvm working-directory: target/release - - name: Pre-release (mac-aarch64) + - name: Pre-release (aarch64-apple-darwin) if: startsWith(matrix.os, 'macOS') run: zip -r dvm-aarch64-apple-darwin.zip dvm working-directory: target/aarch64-apple-darwin/release @@ -113,6 +124,7 @@ jobs: target/release/dvm-x86_64-unknown-linux-gnu.zip target/release/dvm-x86_64-apple-darwin.zip target/aarch64-apple-darwin/release/dvm-aarch64-apple-darwin.zip + target/aarch64-unknown-linux-gnu/release/dvm-aarch64-unknown-linux-gnu.zip draft: true - name: Release DVM @@ -128,7 +140,7 @@ jobs: target/release/dvm-x86_64-unknown-linux-gnu.zip target/release/dvm-x86_64-apple-darwin.zip - - name: Release DVM(aarch64) + - name: Release DVM(aarch64-apple-darwin) uses: justjavac/action-dvm-release@v1 if: | startsWith(github.repository, 'justjavac') && @@ -139,6 +151,17 @@ jobs: files: | target/aarch64-apple-darwin/release/dvm-aarch64-apple-darwin.zip + - name: Release DVM(aarch64-unknown-linux-gnu) + uses: justjavac/action-dvm-release@v1 + if: | + startsWith(github.repository, 'justjavac') && + startsWith(github.ref, 'refs/tags/') + env: + GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + with: + files: | + target/aarch64-unknown-linux-gnu/release/dvm-aarch64-unknown-linux-gnu.zip + - name: Publish if: | startsWith(matrix.os, 'ubuntu') && From a20c64012900bfcb4f87b98c0ee3b381383bc9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=B7=E6=B8=A1?= Date: Fri, 15 Nov 2024 13:06:12 +0800 Subject: [PATCH 3/6] try to fix ' aarch64-linux-gnu-gcc: not found' --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a0133a..f0c7d5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,6 +79,7 @@ jobs: - name: Build release(aarch64-unknown-linux-gnu) if: startsWith(matrix.os, 'ubuntu') run: | + apt install -y crossbuild-essential-arm64 gcc-multilib rustup target add aarch64-unknown-linux-gnu cargo build --release --target aarch64-unknown-linux-gnu --locked From f9d3470a7943a11a61ab7893bb989672dde6f8d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=B7=E6=B8=A1?= Date: Fri, 15 Nov 2024 13:14:21 +0800 Subject: [PATCH 4/6] add 'sudo' --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0c7d5d..3f20e31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,7 +79,7 @@ jobs: - name: Build release(aarch64-unknown-linux-gnu) if: startsWith(matrix.os, 'ubuntu') run: | - apt install -y crossbuild-essential-arm64 gcc-multilib + sudo apt install -y crossbuild-essential-arm64 gcc-multilib rustup target add aarch64-unknown-linux-gnu cargo build --release --target aarch64-unknown-linux-gnu --locked From c6b37f72943adede15888b78a1bd7315094bb9ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=B7=E6=B8=A1?= Date: Fri, 15 Nov 2024 13:23:42 +0800 Subject: [PATCH 5/6] fix 'gcc-multilib : Conflicts' --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f20e31..92b21a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,7 +79,7 @@ jobs: - name: Build release(aarch64-unknown-linux-gnu) if: startsWith(matrix.os, 'ubuntu') run: | - sudo apt install -y crossbuild-essential-arm64 gcc-multilib + sudo apt-get update && sudo apt-get install -y crossbuild-essential-arm64 rustup target add aarch64-unknown-linux-gnu cargo build --release --target aarch64-unknown-linux-gnu --locked From 8c8a2eadf80a1fc4f838ae5e9f373297c233611f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=B7=E6=B8=A1?= Date: Fri, 15 Nov 2024 17:12:54 +0800 Subject: [PATCH 6/6] fix aarch64 linux link --- .cargo/config.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.cargo/config.toml b/.cargo/config.toml index 26988f1..1d09de5 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,6 +1,9 @@ [target.x86_64-pc-windows-msvc] rustflags = ["-C", "target-feature=+crt-static"] +[target.aarch64-unknown-linux-gnu] +linker = "aarch64-linux-gnu-gcc" + [alias] lint = "clippy -- -D warnings" r = "run"