Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: basic support for linux riscv64 #12602

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changes/riscv-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'tauri-cli': 'minor:enhance'
'tauri-utils': 'minor:enhance'
'tauri-bundler': 'minor:enhance'
'@tauri-apps/cli': 'minor:enhance'
---

Add basic support for linux riscv64 platform.
9 changes: 9 additions & 0 deletions .github/workflows/publish-cli-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ jobs:
rustup target add aarch64-unknown-linux-musl
pnpm build --target aarch64-unknown-linux-musl
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
- host: ubuntu-22.04
architecture: x64
target: riscv64gc-unknown-linux-gnu
setup: |
sudo apt-get update
sudo apt-get install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu -y
build: |
pnpm build --target=riscv64gc-unknown-linux-gnu
riscv64-linux-gnu-strip *.node
name: stable - ${{ matrix.settings.target }} - node@20
runs-on: ${{ matrix.settings.host }}
steps:
Expand Down
2 changes: 2 additions & 0 deletions crates/tauri-bundler/src/bundle/linux/appimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
Arch::X86 => "i386",
Arch::AArch64 => "aarch64",
Arch::Armhf => "armhf",
Arch::Riscv64 => "riscv64",
target => {
return Err(crate::Error::ArchError(format!(
"Unsupported architecture: {:?}",
Expand Down Expand Up @@ -131,6 +132,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
Arch::X86 => "/usr/lib/i386-linux-gnu/",
Arch::AArch64 => "/usr/lib/aarch64-linux-gnu/",
Arch::Armhf => "/usr/lib/arm-linux-gnueabihf/",
Arch::Riscv64 => "/usr/lib/riscv64-linux-gnu/",
_ => unreachable!(),
},
"/usr/lib64",
Expand Down
1 change: 1 addition & 0 deletions crates/tauri-bundler/src/bundle/linux/debian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
Arch::AArch64 => "arm64",
Arch::Armhf => "armhf",
Arch::Armel => "armel",
Arch::Riscv64 => "riscv64",
target => {
return Err(crate::Error::ArchError(format!(
"Unsupported architecture: {:?}",
Expand Down
1 change: 1 addition & 0 deletions crates/tauri-bundler/src/bundle/linux/rpm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
Arch::AArch64 => "aarch64",
Arch::Armhf => "armhfp",
Arch::Armel => "armel",
Arch::Riscv64 => "riscv64",
target => {
return Err(crate::Error::ArchError(format!(
"Unsupported architecture: {:?}",
Expand Down
2 changes: 2 additions & 0 deletions crates/tauri-bundler/src/bundle/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pub fn target_triple() -> Result<String, crate::Error> {
"armv7".into()
} else if cfg!(target_arch = "aarch64") {
"aarch64".into()
} else if cfg!(target_arch = "riscv64") {
"riscv64".into()
} else {
return Err(crate::Error::ArchError(String::from(
"Unable to determine target-architecture",
Expand Down
4 changes: 4 additions & 0 deletions crates/tauri-bundler/src/bundle/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,8 @@ pub enum Arch {
Armhf,
/// For the AArch32 / ARM32 instruction sets with soft-float (32 bits).
Armel,
/// For the RISC-V instruction sets (64 bits).
Riscv64,
/// For universal macOS applications.
Universal,
}
Expand Down Expand Up @@ -900,6 +902,8 @@ impl Settings {
Arch::Armel
} else if self.target.starts_with("aarch64") {
Arch::AArch64
} else if self.target.starts_with("riscv64") {
Arch::Riscv64
} else if self.target.starts_with("universal") {
Arch::Universal
} else {
Expand Down
5 changes: 3 additions & 2 deletions crates/tauri-cli/src/interface/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,9 @@ impl AppSettings for RustAppSettings {
config: &Config,
features: &[String],
) -> crate::Result<BundleSettings> {
let arch64bits =
self.target_triple.starts_with("x86_64") || self.target_triple.starts_with("aarch64");
let arch64bits = self.target_triple.starts_with("x86_64")
|| self.target_triple.starts_with("aarch64")
|| self.target_triple.starts_with("riscv64");

let updater_enabled = config.bundle.create_updater_artifacts != Updater::Bool(false);
let v1_compatible = matches!(config.bundle.create_updater_artifacts, Updater::String(_));
Expand Down
2 changes: 2 additions & 0 deletions crates/tauri-utils/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ pub fn target_triple() -> crate::Result<String> {
"armv7"
} else if cfg!(target_arch = "aarch64") {
"aarch64"
} else if cfg!(target_arch = "riscv64") {
"riscv64"
} else {
return Err(crate::Error::Architecture);
};
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ rustflags = ["-C", "target-feature=-crt-static"]
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

[target.riscv64gc-unknown-linux-gnu]
linker = "riscv64-linux-gnu-gcc"

[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
[target.i686-pc-windows-msvc]
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/npm/linux-riscv64-gnu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `@tauri-apps/cli-linux-riscv64-gnu`

This is the **riscv64gc-unknown-linux-gnu** binary for `@tauri-apps/cli`
35 changes: 35 additions & 0 deletions packages/cli/npm/linux-riscv64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@tauri-apps/cli-linux-riscv64-gnu",
"version": "0.0.0",
"repository": {
"type": "git",
"url": "git+https://github.com/tauri-apps/tauri.git"
},
"homepage": "https://github.com/tauri-apps/tauri#readme",
"bugs": {
"url": "https://github.com/tauri-apps/tauri/issues"
},
"contributors": [
"Tauri Programme within The Commons Conservancy"
],
"license": "Apache-2.0 OR MIT",
"publishConfig": {
"access": "public"
},
"os": [
"linux"
],
"cpu": [
"riscv64"
],
"libc": [
"glibc"
],
"main": "cli.linux-riscv64-gnu.node",
"files": [
"cli.linux-riscv64-gnu.node"
],
"engines": {
"node": ">= 10"
}
}
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"aarch64-unknown-linux-musl",
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"riscv64gc-unknown-linux-gnu",
"i686-pc-windows-msvc",
"aarch64-pc-windows-msvc"
]
Expand Down
Loading