MacOS下的openresty编译过程

2023-10-31 08:22:41 浏览数 (2)

其实还是比较简单的,毕竟homebrew已经很方便的安装了依赖,还是记录一下

基本依赖

我本地的brew是更新过了的,从github下载的最新release

代码语言:javascript复制
brew update                            
brew install pcre openssl

configure

Linux:

代码语言:javascript复制
./configure                           
   --with-cc-opt="-I/usr/local/opt/openssl/include/ -I/usr/local/opt/pcre/include/" 
   --with-ld-opt="-L/usr/local/opt/openssl/lib/ -L/usr/local/opt/pcre/lib/" 
   -j8

MacOS:

代码语言:javascript复制
./configure                      
   --with-cc-opt="-I/opt/homebrew/include/openssl/ -I/opt/homebrew/include/" 
   --with-ld-opt="-L/opt/homebrew/lib/" 
   -j8

这里的路径是我自己找的,brew应该都一样,但是看到别的文章和我的不一样,所以应该先检查include和lib的路径

brotli

Brotli比我当年编译的简单多了:

代码语言:javascript复制
git clone https://github.com/google/ngx_brotli.git`
cd ngx_brotli/deps/brotli
git clone https://github.com/google/brotli.git
cd ..
./configure                       
   --with-cc-opt="-I/opt/homebrew/include/openssl/ -I/opt/homebrew/include/" 
   --with-ld-opt="-L/opt/homebrew/lib/ --add-module=/路径/ngx_brotli" 
   -j8

然后make -j8 && make install 就到了/usr/local/openresty下了

0 人点赞