Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fail to run make deps on macOS #3718

Merged
merged 9 commits into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
tokers marked this conversation as resolved.
Show resolved Hide resolved
OPENSSL_PREFIX=/usr/local/opt/openresty-openssl111
endif
endif

SHELL := /bin/bash -o pipefail

VERSION ?= latest
Expand Down Expand Up @@ -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 = {"
Expand Down
4 changes: 2 additions & 2 deletions docs/en/latest/install-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/latest/install-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down