leslie-tsang commented on a change in pull request #5248:
URL: https://github.com/apache/apisix/pull/5248#discussion_r731011693



##########
File path: Makefile
##########
@@ -147,23 +141,21 @@ help:
 ### deps : Installation dependencies
 .PHONY: deps
 deps: runtime
-ifeq ($(LUAROCKS_VER),luarocks 3.)
+ifeq ($(shell $(ENV_LUAROCKS) --version | grep -E -o "luarocks 
[0-9]+."),luarocks 3.)

Review comment:
       TODO: use shell syntax instead of makefile syntax to reduce calculations

##########
File path: Makefile
##########
@@ -249,88 +241,88 @@ reload: runtime
 ### install : Install the apisix (only for luarocks)
 .PHONY: install
 install: runtime
-       $(INSTALL) -d /usr/local/apisix/
-       $(INSTALL) -d /usr/local/apisix/logs/
-       $(INSTALL) -d /usr/local/apisix/conf/cert
-       $(INSTALL) conf/mime.types /usr/local/apisix/conf/mime.types
-       $(INSTALL) conf/config.yaml /usr/local/apisix/conf/config.yaml
-       $(INSTALL) conf/config-default.yaml 
/usr/local/apisix/conf/config-default.yaml
-       $(INSTALL) conf/debug.yaml /usr/local/apisix/conf/debug.yaml
-       $(INSTALL) conf/cert/* /usr/local/apisix/conf/cert/
+       $(ENV_INSTALL) -d /usr/local/apisix/
+       $(ENV_INSTALL) -d /usr/local/apisix/logs/
+       $(ENV_INSTALL) -d /usr/local/apisix/conf/cert
+       $(ENV_INSTALL) conf/mime.types /usr/local/apisix/conf/mime.types
+       $(ENV_INSTALL) conf/config.yaml /usr/local/apisix/conf/config.yaml
+       $(ENV_INSTALL) conf/config-default.yaml 
/usr/local/apisix/conf/config-default.yaml
+       $(ENV_INSTALL) conf/debug.yaml /usr/local/apisix/conf/debug.yaml
+       $(ENV_INSTALL) conf/cert/* /usr/local/apisix/conf/cert/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix
-       $(INSTALL) apisix/*.lua $(INST_LUADIR)/apisix/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix
+       $(ENV_INSTALL) apisix/*.lua $(ENV_INST_LUADIR)/apisix/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/admin
-       $(INSTALL) apisix/admin/*.lua $(INST_LUADIR)/apisix/admin/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/admin
+       $(ENV_INSTALL) apisix/admin/*.lua $(ENV_INST_LUADIR)/apisix/admin/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/balancer
-       $(INSTALL) apisix/balancer/*.lua $(INST_LUADIR)/apisix/balancer/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/balancer
+       $(ENV_INSTALL) apisix/balancer/*.lua $(ENV_INST_LUADIR)/apisix/balancer/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/control
-       $(INSTALL) apisix/control/*.lua $(INST_LUADIR)/apisix/control/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/control
+       $(ENV_INSTALL) apisix/control/*.lua $(ENV_INST_LUADIR)/apisix/control/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/core
-       $(INSTALL) apisix/core/*.lua $(INST_LUADIR)/apisix/core/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/core
+       $(ENV_INSTALL) apisix/core/*.lua $(ENV_INST_LUADIR)/apisix/core/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/core/dns
-       $(INSTALL) apisix/core/dns/*.lua $(INST_LUADIR)/apisix/core/dns
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/core/dns
+       $(ENV_INSTALL) apisix/core/dns/*.lua $(ENV_INST_LUADIR)/apisix/core/dns
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/cli
-       $(INSTALL) apisix/cli/*.lua $(INST_LUADIR)/apisix/cli/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/cli
+       $(ENV_INSTALL) apisix/cli/*.lua $(ENV_INST_LUADIR)/apisix/cli/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/discovery
-       $(INSTALL) apisix/discovery/*.lua $(INST_LUADIR)/apisix/discovery/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/discovery
+       $(ENV_INSTALL) apisix/discovery/*.lua 
$(ENV_INST_LUADIR)/apisix/discovery/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/http
-       $(INSTALL) apisix/http/*.lua $(INST_LUADIR)/apisix/http/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/http
+       $(ENV_INSTALL) apisix/http/*.lua $(ENV_INST_LUADIR)/apisix/http/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/http/router
-       $(INSTALL) apisix/http/router/*.lua $(INST_LUADIR)/apisix/http/router/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/http/router
+       $(ENV_INSTALL) apisix/http/router/*.lua 
$(ENV_INST_LUADIR)/apisix/http/router/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/plugins
-       $(INSTALL) apisix/plugins/*.lua $(INST_LUADIR)/apisix/plugins/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins
+       $(ENV_INSTALL) apisix/plugins/*.lua $(ENV_INST_LUADIR)/apisix/plugins/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/ext-plugin
-       $(INSTALL) apisix/plugins/ext-plugin/*.lua 
$(INST_LUADIR)/apisix/plugins/ext-plugin/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/ext-plugin
+       $(ENV_INSTALL) apisix/plugins/ext-plugin/*.lua 
$(ENV_INST_LUADIR)/apisix/plugins/ext-plugin/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/grpc-transcode
-       $(INSTALL) apisix/plugins/grpc-transcode/*.lua 
$(INST_LUADIR)/apisix/plugins/grpc-transcode/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/grpc-transcode
+       $(ENV_INSTALL) apisix/plugins/grpc-transcode/*.lua 
$(ENV_INST_LUADIR)/apisix/plugins/grpc-transcode/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/ip-restriction
-       $(INSTALL) apisix/plugins/ip-restriction/*.lua 
$(INST_LUADIR)/apisix/plugins/ip-restriction/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/ip-restriction
+       $(ENV_INSTALL) apisix/plugins/ip-restriction/*.lua 
$(ENV_INST_LUADIR)/apisix/plugins/ip-restriction/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/limit-conn
-       $(INSTALL) apisix/plugins/limit-conn/*.lua 
$(INST_LUADIR)/apisix/plugins/limit-conn/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/limit-conn
+       $(ENV_INSTALL) apisix/plugins/limit-conn/*.lua 
$(ENV_INST_LUADIR)/apisix/plugins/limit-conn/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/limit-count
-       $(INSTALL) apisix/plugins/limit-count/*.lua 
$(INST_LUADIR)/apisix/plugins/limit-count/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/limit-count
+       $(ENV_INSTALL) apisix/plugins/limit-count/*.lua 
$(ENV_INST_LUADIR)/apisix/plugins/limit-count/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/prometheus
-       $(INSTALL) apisix/plugins/prometheus/*.lua 
$(INST_LUADIR)/apisix/plugins/prometheus/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/prometheus
+       $(ENV_INSTALL) apisix/plugins/prometheus/*.lua 
$(ENV_INST_LUADIR)/apisix/plugins/prometheus/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/serverless
-       $(INSTALL) apisix/plugins/serverless/*.lua 
$(INST_LUADIR)/apisix/plugins/serverless/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/serverless
+       $(ENV_INSTALL) apisix/plugins/serverless/*.lua 
$(ENV_INST_LUADIR)/apisix/plugins/serverless/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/plugins/zipkin
-       $(INSTALL) apisix/plugins/zipkin/*.lua 
$(INST_LUADIR)/apisix/plugins/zipkin/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/plugins/zipkin
+       $(ENV_INSTALL) apisix/plugins/zipkin/*.lua 
$(ENV_INST_LUADIR)/apisix/plugins/zipkin/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/ssl/router
-       $(INSTALL) apisix/ssl/router/*.lua $(INST_LUADIR)/apisix/ssl/router/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/ssl/router
+       $(ENV_INSTALL) apisix/ssl/router/*.lua 
$(ENV_INST_LUADIR)/apisix/ssl/router/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/stream/plugins
-       $(INSTALL) apisix/stream/plugins/*.lua 
$(INST_LUADIR)/apisix/stream/plugins/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/stream/plugins
+       $(ENV_INSTALL) apisix/stream/plugins/*.lua 
$(ENV_INST_LUADIR)/apisix/stream/plugins/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/stream/router
-       $(INSTALL) apisix/stream/router/*.lua 
$(INST_LUADIR)/apisix/stream/router/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/stream/router
+       $(ENV_INSTALL) apisix/stream/router/*.lua 
$(ENV_INST_LUADIR)/apisix/stream/router/
 
-       $(INSTALL) -d $(INST_LUADIR)/apisix/utils
-       $(INSTALL) apisix/utils/*.lua $(INST_LUADIR)/apisix/utils/
+       $(ENV_INSTALL) -d $(ENV_INST_LUADIR)/apisix/utils
+       $(ENV_INSTALL) apisix/utils/*.lua $(ENV_INST_LUADIR)/apisix/utils/
 
-       $(INSTALL) bin/apisix $(INST_BINDIR)/apisix

Review comment:
       @spacewander Do we need to restore the installation of readme.md ? ref 
to [here](https://github.com/apache/apisix/issues/5228#issuecomment-945032524)

##########
File path: Makefile
##########
@@ -18,7 +18,7 @@
 # Makefile basic env setting
 .DEFAULT_GOAL := help
 # add pipefail support for default shell
-SHELL := /bin/bash -o pipefail
+SHELL := /bin/bash -o pipefail -x

Review comment:
       flag `-x` used for debug, need to be remove before merge.

##########
File path: Makefile
##########
@@ -33,55 +33,48 @@ ENV_OS_NAME            ?= $(shell uname -s | tr '[:upper:]' 
'[:lower:]')
 ENV_OS_ARCH            ?= $(shell uname -m | tr '[:upper:]' '[:lower:]')
 ENV_APISIX             ?= $(CURDIR)/bin/apisix
 ENV_GIT                ?= git
+ENV_TAR                ?= tar
+ENV_INSTALL            ?= install
 ENV_DOCKER             ?= docker
 ENV_DOCKER_COMPOSE     ?= docker-compose --project-directory $(CURDIR) -p 
$(project_name) -f $(project_compose_ci)
-ENV_NGINX              ?= nginx -p $(CURDIR) -c $(CURDIR)/conf/nginx.conf
-
-
-# OSX archive `._` cache file
-ifeq ($(ENV_OS_NAME), darwin)
-       ENV_TAR ?= COPYFILE_DISABLE=1 tar
-else
-       ENV_TAR ?= tar
+ENV_NGINX              ?= $(ENV_NGINX_EXEC) -p $(CURDIR) -c 
$(CURDIR)/conf/nginx.conf
+ENV_NGINX_EXEC         ?= $(shell which openresty 2>/dev/null || which nginx 
2>/dev/null)

Review comment:
       The changes in makefile are fragmented, `ENV_NGINX_EXEC` is a new var to 
replace old one `OR_EXEC` in **`OLD VAR`** section. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to