Skip to content

Out-of-the-box tool that cross compiles a rust tauri project for raspberry pi target.

License

Notifications You must be signed in to change notification settings

Shiritai/xc-tauri-rasp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Tauri ❤️ Raspberry Pi

English | 繁體中文

Out-of-the-box tool that cross compile a rust tauri project for raspberry pi target.

Usage

One can run xcompile.sh -h and see:

Cross compile a rust tauri application to debian package for raspberry pi (armhf/arm64).

Syntax: ./xcompile.sh [-c|h] [-e|n|p|t|a ARG]

Option:
  -e <DEBIAN_VERSION>
          to set debian version of compilation environment
          available versions are bookworm (debian 12, default) and bullseye (debian 11)
  -n <PROJECT_NAME>
          to set compilation target project
          default value is project
  -p <PROJECT_PATH>
          to set path of compilation target project
          default value is ./project
  -a <RASP_ARCH>
          to set architecture of raspberry pi
          default value: arm64
  -t <TARGET_PATH>
          to set path of compilation target path
          default value is .
  -c      clean up all compilation targets before cross compile
          default not to clean up
  -h      show the help message

Configuration

You can create a .xcompile file in the same directory of xcompile.sh to configure the default values. A template with default values is provided in .xcompile.example.

cp .xcompile.example .xcompile
# Edit .xcompile with your preferences

The file is sourced by the script, so you can use shell variables.

# Example .xcompile
DEBIAN_VER="bullseye"
RASP_ARCH="arm64" # arm64 or armhf
PROJECT_PATH="../my-project"
PROJECT="app"
TARGET_PATH="./dist"
DO_CLEANUP="true" # Set to "true" to enable cargo clean

CLI arguments will always override the values in .xcompile.

Example

Situation:

  • Project name: my_project
  • Project path: /path/to/my_project
  • Raspberry pi architecture: arm64 (ARMv8), e.g. Raspberry pi 4b
  • Base of Raspberry Pi OS, a.k.a. debian version: bookworm (debian 12)
  • Path to get compilation result: .. (parent directory of shell)

One can cross compile a tauri app by running:

./xcompile.sh -e bookworm -n my_project -p /path/to/my_project -a arm64 -t ..

Prerequisite

  • docker installed and dockerd is running

Tested environment

status hardware os
Raspberry Pi 4 Model B Raspberry Pi OS - Debian 11 (bullseye) aarch64
Raspberry Pi Zero 2 w Raspberry Pi OS Lite - Debian 12 (bookworm) aarch64

CI/CD Integration

If you are looking for a GitHub Action to automate the build process, check out xc-tauri-rasp-action.

Contribute

We welcome any kinds of contribution, feel free to post issues and pull requests :)

About

Out-of-the-box tool that cross compiles a rust tauri project for raspberry pi target.

Topics

Resources

License

Stars

Watchers

Forks