Skip to content

Commit 3fa19d2

Browse files
docs: 添加构建指南
1 parent 74bb029 commit 3fa19d2

File tree

4 files changed

+156
-0
lines changed

4 files changed

+156
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ RestLite是适用于Windows与Linux平台的文件备份工具,提供简单直
7979
Linux:
8080
`~/.local/share/io.github.rest-lite`
8181

82+
## 🛠️ 构建指南
83+
84+
[构建指南](doc/how_to_build.zh.md)
85+
8286
## 📝 问题反馈
8387

8488
请至[Issues](https://github.com/rest-lite/RestLite/issues)页面提交问题或功能请求

doc/README.en.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ In addition to removing the application and backup repository, you should also d
7878
Linux:
7979
`~/.local/share/io.github.rest-lite`
8080

81+
## 🛠️ Build Guide
82+
83+
[Build Guide](how_to_build.en.md)
84+
8185
## 📝 Issue Reporting
8286

8387
Please submit issues or feature requests on the [Issues](https://github.com/rest-lite/RestLite/issues) page.

doc/how_to_build.en.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# 🛠️ Build Guide
2+
3+
## 📦 Prerequisites
4+
5+
Flutter Desktop requires that the build environment matches the target platform. That is, to build for **Windows**, you must compile on **Windows**; to build for **Linux**, you must compile on **Linux**.
6+
7+
> 📌 This guide is based on **Windows 11** and **Ubuntu 24.04 LTS**.
8+
9+
## ⚙️ Environment Setup
10+
11+
This project depends on Flutter, Rust, and flutter rust bridge.
12+
13+
Please refer to the official documentation for installing Flutter and Rust:
14+
15+
* [Install Flutter](https://docs.flutter.dev/get-started/install)
16+
* [Install Rust](https://www.rust-lang.org/tools/install)
17+
18+
To install flutter rust bridge using Cargo:
19+
20+
```shell
21+
# Install flutter rust bridge
22+
cargo install flutter_rust_bridge_codegen
23+
```
24+
25+
### 🐧 Additional Steps for Linux
26+
27+
Due to [tray_manager requirements](https://github.com/leanflutter/tray_manager?tab=readme-ov-file#quick-start), you need to install the following package on Linux:
28+
29+
```shell
30+
sudo apt-get install libayatana-appindicator3-dev
31+
```
32+
33+
## 🧱 Code Generation
34+
35+
The scaffolded code generated by flutter rust bridge is excluded from version control, so it must be generated manually:
36+
37+
```shell
38+
# Generate flutter rust bridge code
39+
flutter_rust_bridge_codegen generate
40+
```
41+
42+
## 🏗️ Build Application
43+
44+
```shell
45+
# Windows
46+
flutter build windows --release
47+
48+
# Linux
49+
flutter build linux --release
50+
```
51+
52+
> 💡 **Tip:** If you attempt to build without generating code first, you may encounter a permission error on Linux. Run `flutter clean` before building to resolve this.
53+
54+
## 📁 Add restic Executable
55+
56+
The application expects the `restic` binary to be located in the `bin` directory. Please create a `bin` folder and place the appropriate version of `restic` for your system inside it.
57+
58+
Download restic from:
59+
[Restic Releases](https://github.com/restic/restic/releases)
60+
61+
Example directory structure:
62+
63+
```shell
64+
project_root/
65+
├── bin/
66+
│ └── restic # The restic binary for your platform
67+
├── data/
68+
├── RestLite
69+
└── ...
70+
```
71+
72+
## 📝 Feedback & Issues
73+
74+
If you encounter any issues during the build process, please submit a ticket on the [Issues](https://github.com/rest-lite/RestLite/issues) page or refer to the [GitHub Action build script](../.github/workflows/flutter-build.yml).

doc/how_to_build.zh.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# 🛠️ 构建指南
2+
3+
## 📦 前置条件
4+
5+
flutter desktop要求编译环境必须与目标平台相同,即目标平台为Windows必须在Windows中编译,目标平台为Linux必须在Linux中编译。
6+
7+
> 📌本指南基于**Windows 11****Ubuntu 24 TLS**
8+
9+
## ⚙️ 环境配置
10+
11+
本项目依赖Flutter、Rust与flutter rust bridge。
12+
13+
Flutter与Rust的安装请参考官方文档:
14+
15+
- [Install Flutter](https://docs.flutter.dev/get-started/install)
16+
- [Install Rust](https://www.rust-lang.org/tools/install)
17+
18+
flutter rust bridge的安装使用cargo:
19+
20+
```shell
21+
# 安装 flutter rust bridge
22+
cargo install flutter_rust_bridge_codegen
23+
```
24+
25+
### 🐧 Linux的额外步骤
26+
27+
Linux中因为[tray_manager的要求](https://github.com/leanflutter/tray_manager?tab=readme-ov-file#quick-start),需要额外安装`libayatana-appindicator3-dev`
28+
29+
```shell
30+
sudo apt-get install libayatana-appindicator3-dev
31+
```
32+
33+
## 🧱 生成代码
34+
35+
flutter rust bridge的脚手架代码被排除在版本控制之外,所以需要先生成代码
36+
37+
```shell
38+
# 生成frb代码
39+
flutter_rust_bridge_codegen generate
40+
```
41+
42+
## 🏗️ 构建应用
43+
44+
```shell
45+
# Windows
46+
flutter build windows --release
47+
48+
#Linux
49+
flutter build linux --release
50+
```
51+
52+
> 💡 **Tip:** 如果没有进行代码生成就直接进行编译,linux会报错提示没有权限,建议运行一次`flutter clean`清理缓存再进行编译。
53+
54+
## 📁 添加restic可执行文件
55+
56+
程序默认调用 `bin` 目录下的 `restic` 二进制文件,请手动创建 `bin` 文件夹,并放入对应平台的 `restic` 执行文件:
57+
58+
restic下载地址:
59+
[Restic Releases](https://github.com/restic/restic/releases)
60+
61+
示例目录结构:
62+
63+
```shell
64+
project_root/
65+
├── bin/
66+
│ └── restic # 放入你系统对应的 restic 可执行文件
67+
├── data/
68+
├── RestLite
69+
└── ...
70+
```
71+
72+
## 📝 问题反馈
73+
74+
对构建过程有疑问可以至[Issues](https://github.com/rest-lite/RestLite/issues)页面提交问题,或者参考[github action 构建文件](../.github/workflows/flutter-build.yml)

0 commit comments

Comments
 (0)