Skip to content

MacOS

如果依赖项未准备好,请参考入门指南

构建第三方库

构建 BoringSSL

要编译 BoringSSL,需要提前安装 golang

然后运行以下命令来获取 BoringSSL 源码并做好编译准备:

bash
git clone https://github.com/google/boringssl.git ./third_party/boringssl
cd ./third_party/boringssl
mkdir -p build && cd build
cmake -DBUILD_SHARED_LIBS=0 -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC" ..
make ssl crypto
cd ..
SSL_TYPE_STR="boringssl"
SSL_PATH_STR="${PWD}"
cd ../..

使用 BabaSSL(Tongsuo)构建

bash
git clone -b 8.3-stable https://github.com/Tongsuo-Project/Tongsuo.git ./third_party/babassl
cd ./third_party/babassl/
./config --prefix=/usr/local/babassl
make -j
SSL_TYPE_STR="babassl"
SSL_PATH_STR="${PWD}"
cd -

构建 XQUIC

接下来,使用 cmake 变量 -DPLATFORM=mac 可以让你在 macOS 上构建 XQUIC:

bash
mkdir -p build; cd build

cmake -DPLATFORM=mac -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=0 -DXQC_ENABLE_EVENT_LOG=1 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} ..

make -j