leslie-tsang opened a new issue #6104:
URL: https://github.com/apache/apisix/issues/6104


   ### Issue description
   
   The [Makefile](https://github.com/apache/apisix/blob/master/Makefile) for 
the current master branch does not support mawk yet, ref to [Makefile 
tips](https://github.com/apache/apisix/blob/master/Makefile#L133-L137)
   
   ## Solution 
   Add a patch for Makefile
   
   ```diff
   diff --git a/Makefile b/Makefile
   index 2b25defc..50ce54bd 100644
   --- a/Makefile
   +++ b/Makefile
   @@ -46,6 +46,7 @@ ENV_INST_PREFIX        ?= /usr
    ENV_INST_LUADIR        ?= $(ENV_INST_PREFIX)/share/lua/5.1
    ENV_INST_BINDIR        ?= $(ENV_INST_PREFIX)/bin
    ENV_HOMEBREW_PREFIX    ?= /usr/local
   +ENV_HELP_PREFIX_SIZE   ?= 15
    
    ifneq ($(shell whoami), root)
        ENV_LUAROCKS_FLAG_LOCAL := --local
   @@ -64,6 +65,13 @@ ifneq ($(ENV_NGINX_EXEC), )
        endif
    endif
    
   +# AWK patch for mawk
   +ifneq ($(shell command -v gawk),)
   +    ENV_HELP_AWK_RULE ?= '{ if(match($$0, 
/^\s*\#{3}\s*([^:]+)\s*:\s*(.*)$$/, res)){ printf("    make 
%-$(ENV_HELP_PREFIX_SIZE)s : %-10s\n", res[1], res[2]) } }'
   +else
   +    ENV_HELP_AWK_RULE := '{ if(match($$0, /^\#\#\#([^:]+):(.*)$$/)){ 
split($$0, res, ":"); gsub(/^\#\#\#[ ]*/, "", res[1]); _desc=$$0; 
gsub(/^\#\#\#([^:]+):[ \t]*/, "", _desc); printf("    make 
%-$(ENV_HELP_PREFIX_SIZE)s : %-10s\n", res[1], _desc) } }'
   +endif
   +
    # ENV patch for darwin
    ifeq ($(ENV_OS_NAME), darwin)
        ifeq ($(ENV_OS_ARCH), arm64)
   @@ -73,6 +81,7 @@ ifeq ($(ENV_OS_NAME), darwin)
        # OSX archive `._` cache file
        ENV_TAR      := COPYFILE_DISABLE=1 $(ENV_TAR)
        ENV_LUAROCKS := $(ENV_LUAROCKS) 
--lua-dir=$(ENV_HOMEBREW_PREFIX)/opt/[email protected]
   +    ENV_HELP_AWK_RULE := '{ if(match($$0, /^\#{3}([^:]+):(.*)$$/)){ 
split($$0, res, ":"); gsub(/^\#{3}[ ]*/, "", res[1]); _desc=$$0; 
gsub(/^\#{3}([^:]+):[ \t]*/, "", _desc); printf("    make 
%-$(ENV_HELP_PREFIX_SIZE)s : %-10s\n", res[1], _desc) } }'
    
        ifeq ($(shell test -d $(ENV_HOMEBREW_PREFIX)/opt/openresty-openssl && 
echo -n yes), yes)
                ENV_OPENSSL_PREFIX := 
$(ENV_HOMEBREW_PREFIX)/opt/openresty-openssl
   @@ -131,17 +140,11 @@ endif
    
    
    ### help : Show Makefile rules
   -###         If there're awk failures, please make sure
   -###         you are using awk or gawk
    .PHONY: help
    help:
        @$(call func_echo_success_status, "Makefile rules:")
        @echo
   -    @if [ '$(ENV_OS_NAME)' = 'darwin' ]; then \
   -            awk '{ if(match($$0, /^#{3}([^:]+):(.*)$$/)){ split($$0, res, 
":"); gsub(/^#{3}[ ]*/, "", res[1]); _desc=$$0; gsub(/^#{3}([^:]+):[ \t]*/, "", 
_desc); printf("    make %-15s : %-10s\n", res[1], _desc) } }' Makefile; \
   -    else \
   -            awk '{ if(match($$0, /^\s*#{3}\s*([^:]+)\s*:\s*(.*)$$/, res)){ 
printf("    make %-15s : %-10s\n", res[1], res[2]) } }' Makefile; \
   -    fi
   +    @awk $(ENV_HELP_AWK_RULE) Makefile
        @echo
   
   ```
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):
   - OS (cmd: `uname -a`):
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   - etcd version, if have (cmd: run `curl 
http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   - apisix-dashboard version, if have:
   - the plugin runner version, if the issue is about a plugin runner (cmd: 
depended on the kind of runner):
   - luarocks version, if the issue is about installation (cmd: `luarocks 
--version`):
   


-- 
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