diff --git a/Makefile b/Makefile index b58510b20edd..44888e4a2a7f 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,7 @@ INST_BINDIR ?= /usr/bin INSTALL ?= install UNAME ?= $(shell uname) OR_EXEC ?= $(shell which openresty || which nginx) +LUAROCKS ?= luarocks LUAROCKS_VER ?= $(shell luarocks --version | grep -E -o "luarocks [0-9]+.") OR_PREFIX ?= $(shell $(OR_EXEC) -V 2>&1 | grep -Eo 'prefix=(.*)/nginx\s+' | grep -Eo '/.*/') OPENSSL_PREFIX ?= $(addprefix $(OR_PREFIX), openssl) @@ -31,6 +32,16 @@ ifeq ($(shell test -d $(addprefix $(OR_PREFIX), openssl111) && echo -n yes), yes OPENSSL_PREFIX=$(addprefix $(OR_PREFIX), openssl111) endif +ifeq ($(UNAME), Darwin) +LUAROCKS=luarocks --lua-dir=/usr/local/opt/lua@5.1 +ifeq ($(shell test -d /usr/local/opt/openresty-openssl && echo yes), yes) + OPENSSL_PREFIX=/usr/local/opt/openresty-openssl +endif +ifeq ($(shell test -d /usr/local/opt/openresty-openssl111 && echo yes), yes) + OPENSSL_PREFIX=/usr/local/opt/openresty-openssl111 +endif +endif + SHELL := /bin/bash -o pipefail VERSION ?= latest @@ -63,13 +74,13 @@ deps: default ifeq ($(LUAROCKS_VER),luarocks 3.) mkdir -p ~/.luarocks ifeq ($(shell whoami),root) - luarocks config variables.OPENSSL_LIBDIR $(addprefix $(OPENSSL_PREFIX), /lib) - luarocks config variables.OPENSSL_INCDIR $(addprefix $(OPENSSL_PREFIX), /include) + $(LUAROCKS) config variables.OPENSSL_LIBDIR $(addprefix $(OPENSSL_PREFIX), /lib) + $(LUAROCKS) config variables.OPENSSL_INCDIR $(addprefix $(OPENSSL_PREFIX), /include) else - luarocks config --local variables.OPENSSL_LIBDIR $(addprefix $(OPENSSL_PREFIX), /lib) - luarocks config --local variables.OPENSSL_INCDIR $(addprefix $(OPENSSL_PREFIX), /include) + $(LUAROCKS) config --local variables.OPENSSL_LIBDIR $(addprefix $(OPENSSL_PREFIX), /lib) + $(LUAROCKS) config --local variables.OPENSSL_INCDIR $(addprefix $(OPENSSL_PREFIX), /include) endif - luarocks install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local + $(LUAROCKS) install rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local else @echo "WARN: You're not using LuaRocks 3.x, please add the following items to your LuaRocks config file:" @echo "variables = {" diff --git a/docs/en/latest/install-dependencies.md b/docs/en/latest/install-dependencies.md index fc294a861290..4f344aa6fb60 100644 --- a/docs/en/latest/install-dependencies.md +++ b/docs/en/latest/install-dependencies.md @@ -149,10 +149,10 @@ nohup etcd & ```shell # install OpenResty, etcd and some compilation tools -brew install openresty/brew/openresty etcd luarocks curl git +brew install openresty/brew/openresty luarocks lua@5.1 etcd curl git # start etcd server -etcd & +brew services start etcd # enable TLS for etcd server etcd --cert-file=/path/to/cert --key-file=/path/to/pkey --advertise-client-urls https://127.0.0.1:2379 diff --git a/docs/zh/latest/install-dependencies.md b/docs/zh/latest/install-dependencies.md index 3e7e5c1d9077..5fa765beb7f2 100644 --- a/docs/zh/latest/install-dependencies.md +++ b/docs/zh/latest/install-dependencies.md @@ -149,10 +149,10 @@ nohup etcd & ```shell # 安装 OpenResty, etcd 和 编译工具 -brew install openresty/brew/openresty etcd luarocks curl git +brew install openresty/brew/openresty luarocks lua@5.1 etcd curl git # 开启 etcd server -etcd & +brew services start etcd # 为 etcd 服务启用 TLS etcd --cert-file=/path/to/cert --key-file=/path/to/pkey --advertise-client-urls https://127.0.0.1:2379