Files
nekoray/docs/Build_MacOS.md
2023-03-02 14:45:02 +09:00

66 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

在 macOS 下编译 Nekoray
## git clone 源码
```
git clone https://github.com/MatsuriDayo/nekoray.git --recursive
```
## 先决条件
1. 安装 `CMake` `Ninja` `npm`
2. 安装 Qt `5.15.x` 编译环境,并设置好有关环境变量,以免 CMake 找不到 Qt。 (`qtbase` `qtsvg` `qttools`)
3. 安装 `appdmg` (`sudo npm install -g appdmg`)
## CMake 参数
同 Build_Linux
## C++ 部分
### 编译安装 C/C++ 依赖
(这一步可能要挂梯)
```shell
./libs/build_deps_all.sh
```
### 编译本体
```shell
mkdir build
cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DNKR_PACKAGE_MACOS=1 ..
ninja
```
### Go 部分编译
请看 [Build_Core.md](./Build_Core.md)
## 打包
如有疑问,请参考[这个脚本](https://github.com/MatsuriDayo/nekoray/blob/main/libs/deploy_macos.sh)
### 准备core
将 编译得到的 `nekoray_core` `nekobox_core` 放入 `build/nekoray.app/Contents/MacOS`
### 准备geo文件可选
```shell
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"
```
如果打包时没有包含geo文件可在应用内设置 `v2ray资源路径` 代替。
### 在nekoray目录下打包
```shell
appdmg appdmg.json /path/to/nekoray.dmg
```