Update README.md

This commit is contained in:
niuhuan 2022-04-12 13:15:29 +08:00 committed by GitHub
parent ef40c60d42
commit 32b0cc0550
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 105 deletions

105
README.md
View File

@ -63,111 +63,6 @@ VPN->代理->分流, 这三个功能如果同时设置, 您会在您手机的VPN
- 在 macos 数据文件将会"~/Library/Application Support/pikapika"
- 在 linux 数据文件将会"~/.pikapika"
## 运行 / 构建
这个应用程序使用golang和dart(flutter)作为主要语言, 可以兼容Windows, linux, MacOS, Android, IOS
使用了不同的框架桥接到桌面和移动平台上
- go-flutter => Windows / MacOS / Linux
- gomobile => Android / IOS
![平台](images/platforms.png)
### 开发环境准备
- [golang](https://golang.org/) (1.16以上版本)
- [flutter](https://flutter.dev/) (stable-2.10.3)
### 环境配置
- 将~/go/bin ($GoPath/bin) 设置到PATH环境变量内
- golang开启模块化
- 设置GoProxy (可选,在中国大陆网络建议设置)
- 参考地址 [https://goproxy.cn/](https://goproxy.cn/)
### 桌面平台 (go-flutter)
- [安装hover(go-flutter编译脚手架)](https://github.com/go-flutter-desktop/hover)
```shell
GO111MODULE=on go get -u -a github.com/go-flutter-desktop/hover
# 或
go install github.com/go-flutter-desktop/hover@latest
```
您也可以使用非官方的hover, 将上面的mod名称改为github.com/niuhuan/hover, 支持使用代理下载flutter引擎
```shell
export GHPROXY=true
hover build
```
- 安装gcc (桌面端使用CGO调用flutter引擎)
```shell
# Windows需要安装MSYS(mingw-w64-x86_64-gcc), 并将gcc路径设置到PATH环境变量内
# MacOS需要安装XCode
# Linux使用命令行安装gcc
```
- 执行编译命令 ($system替换为windows/darwin等)
```shell
hover run
hover build $system
```
### Linux的附加说明
- linux编译可能会遇到的问题
```shell
# No package 'gl' found
sudo apt install libgl1-mesa-dev
# X11/Xlib.h: No such file or directory
# 或者更多x11的头找不到等
sudo apt install xorg-dev
```
- 字体不显示
```shell
# 将字体文件复制到项目目录下
mkdir -p fonts
cp -f /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf fonts/
```
```yaml
# 编辑 pubspec.yaml
fonts:
- family: Roboto
fonts:
- asset: fonts/DroidSansFallbackFull.ttf
```
### 移动端 (gomobile)
- 编译环境
```shell
# 安卓环境需要安装AndroidSDK, 并且安装platforms以及ndk, 配置 ANDROID_HOME
# IOS需要安装xcode以及CocoaPods
gem install cocoapods
```
- [安装gomobile](https://github.com/golang/mobile)
```shell
go install golang.org/x/mobile/cmd/gomobile@latest
```
- 先编译golang库, 再打包flutter
```shell
# android
cd go/mobile
go get golang.org/x/mobile/cmd/gobind
gomobile bind -target=android -o lib/Mobile.aar ./
cd ../..
flutter build apk
# ios
cd go/mobile
go get golang.org/x/mobile/cmd/gobind
gomobile bind -target=ios -o lib/Mobile.xcframework ./
cd ../..
flutter build ipa
```
## 请您遵守使用规则
本软件或本软件的拓展, 个人或企业不可用于商业用途, 不可上架任何商店