mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 13:04:37 +03:00
Update Build_MacOS.md
This commit is contained in:
@@ -6,42 +6,18 @@
|
|||||||
git clone https://github.com/MatsuriDayo/nekoray.git --recursive
|
git clone https://github.com/MatsuriDayo/nekoray.git --recursive
|
||||||
```
|
```
|
||||||
|
|
||||||
## 全部依赖:
|
## 先决条件
|
||||||
1. C++ 依赖:`protobuf yaml-cpp zxing-cpp` 已用包管理器安装,并符合版本要求。
|
1. 安装 `CMake` `Ninja` `npm`
|
||||||
2. 已安装 `qtbase` `qtsvg` `qttools` `qtx11extras`。
|
2. 安装 Qt `5.15.x` 编译环境,并设置好有关环境变量,以免 CMake 找不到 Qt。 (`qtbase` `qtsvg` `qttools`)
|
||||||
3. 已安装 Qt `5.12.x` 或 `5.15.x`,并设置好有关环境变量。
|
3. 安装 `appdmg` (`sudo npm install -g appdmg`)
|
||||||
4. 安装`appdmg`(可以来自包管理器`npm`)
|
|
||||||
|
|
||||||
|
## CMake 参数
|
||||||
|
|
||||||
## 复杂编译法
|
同 Build_Linux
|
||||||
|
|
||||||
### CMake 参数
|
## C++ 部分
|
||||||
|
|
||||||
| CMake 参数 | 默认值 | 含义 |
|
### 编译安装 C/C++ 依赖
|
||||||
|-------------------|-------------------|-----------------------|
|
|
||||||
| QT_VERSION_MAJOR | 5 | QT版本 |
|
|
||||||
| NKR_NO_EXTERNAL | | 不包含外部 C/C++ 依赖 (以下所有) |
|
|
||||||
| NKR_NO_YAML | | 不包含 yaml-cpp |
|
|
||||||
| NKR_NO_QHOTKEY | | 不包含 qhotkey |
|
|
||||||
| NKR_NO_ZXING | | 不包含 zxing |
|
|
||||||
| NKR_NO_GRPC | | 不包含 gRPC |
|
|
||||||
| NKR_NO_QUICKJS | | 不包含 quickjs |
|
|
||||||
| NKR_PACKAGE | | 编译 package 版本 (aur) |
|
|
||||||
| NKR_PACKAGE_MACOS | | 编译 macos 版本 |
|
|
||||||
| NKR_LIBS | ./libs/deps/built | 依赖搜索目录 |
|
|
||||||
| NKR_DISABLE_LIBS | | 禁用 NKR_LIBS |
|
|
||||||
|
|
||||||
1. `NKR_LIBS` 的值会被追加到 `CMAKE_PREFIX_PATH`
|
|
||||||
2. `NKR_PACKAGE` 打开后,`NKR_LIBS` 的默认值为 `./libs/deps/package` ,具体依赖请看 `build_deps_all.sh`
|
|
||||||
3. `NKR_PACKAGE_MACOS` 或 `NKR_PACKAGE` 打开后,应用将使用 appdata 目录存放配置,自动更新等功能将被禁用。
|
|
||||||
|
|
||||||
### C++ 部分
|
|
||||||
|
|
||||||
当您的没有上面几个 C++ 依赖包,或者版本不符合要求时,可以参考 `build_deps_all.sh` 编译脚本自行编译。
|
|
||||||
|
|
||||||
条件: 已安装 Qt `5.12.x` 或 `5.15.x`
|
|
||||||
|
|
||||||
#### 编译安装 C/C++ 依赖
|
|
||||||
|
|
||||||
(这一步可能要挂梯)
|
(这一步可能要挂梯)
|
||||||
|
|
||||||
@@ -49,7 +25,7 @@ git clone https://github.com/MatsuriDayo/nekoray.git --recursive
|
|||||||
./libs/build_deps_all.sh
|
./libs/build_deps_all.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 编译本体
|
### 编译本体
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
mkdir build
|
mkdir build
|
||||||
@@ -58,36 +34,30 @@ cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DNKR_PACKAGE_MACOS=1 ..
|
|||||||
ninja
|
ninja
|
||||||
```
|
```
|
||||||
|
|
||||||
编译完成后得到 `nekoray`
|
## Go 部分
|
||||||
|
|
||||||
### Go 部分
|
同 Build_Linux
|
||||||
|
|
||||||
1. 把 `Matsuridayo/Matsuri` `Matsuridayo/v2ray-core` 置于 `../`
|
## 打包
|
||||||
2. 进入 `go/cmd/nekoray_core` 文件夹 `go build` 得到 `nekoray_core`。
|
|
||||||
3. 进入 `go/cmd/nekobox_core` 文件夹 `go build` 得到 `nekobox_core`。
|
|
||||||
|
|
||||||
非官方构建无需编译 `updater` `launcher`
|
如有疑问,请参考[这个脚本](https://github.com/MatsuriDayo/nekoray/blob/main/libs/deploy_macos.sh)
|
||||||
|
|
||||||
### 打包
|
### 准备core
|
||||||
|
|
||||||
|
将 编译得到的 `nekoray_core` `nekobox_core` 放入 `build/nekoray.app/Contents/MacOS`
|
||||||
|
|
||||||
|
### 准备geo文件(可选)
|
||||||
|
|
||||||
安装`appdmg`
|
|
||||||
```shell
|
```shell
|
||||||
sudo npm install -g appdmg
|
curl -Lso build/nekoray.app/Contents/MacOS/geoip.dat "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat"
|
||||||
|
curl -Lso build/nekoray.app/Contents/MacOS/geosite.dat "https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat"
|
||||||
|
curl -Lso build/nekoray.app/Contents/MacOS/geoip.db "https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db"
|
||||||
|
curl -Lso build/nekoray.app/Contents/MacOS/geosite.db "https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db"
|
||||||
```
|
```
|
||||||
|
|
||||||
然后在nekoray目录下打包
|
如果打包时没有包含geo文件,可在应用内设置 `v2ray资源路径` 代替。
|
||||||
|
|
||||||
|
### 在nekoray目录下打包
|
||||||
```shell
|
```shell
|
||||||
appdmg appdmg.json /path/to/nekoray.dmg
|
appdmg appdmg.json /path/to/nekoray.dmg
|
||||||
```
|
```
|
||||||
|
|
||||||
### 使用
|
|
||||||
|
|
||||||
右键nekoray,选择"显示包内容",将core和geo文件放在`Contents/MacOS/`中。
|
|
||||||
|
|
||||||
#### geo*
|
|
||||||
```shell
|
|
||||||
curl -Lso /Applications/nekoray.app/Contents/MacOS/geoip.dat "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat"
|
|
||||||
curl -Lso /Applications/nekoray.app/Contents/MacOS/geosite.dat "https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat"
|
|
||||||
curl -Lso /Applications/nekoray.app/Contents/MacOS/geoip.db "https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db"
|
|
||||||
curl -Lso /Applications/nekoray.app/Contents/MacOS/geosite.db "https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db"
|
|
||||||
```
|
|
||||||
|
|||||||
Reference in New Issue
Block a user