Fix make find command (#10580)

Continuation of https://github.com/go-gitea/gitea/pull/10577

This version also includes an additional fix for Darwin and FreeBSD
which do not accept the `-regextype` option, but only `-E` and the
argument order is specifically required like this for `-E` to work.

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
This commit is contained in:
silverwind 2020-03-02 21:55:12 +01:00 committed by GitHub
parent 5e1438ba92
commit ac4f952f73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,14 +16,18 @@ endif
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
EXECUTABLE ?= gitea.exe EXECUTABLE ?= gitea.exe
FIND_PWD_REGEXP := find . -regextype posix-egrep
else else
EXECUTABLE ?= gitea EXECUTABLE ?= gitea
UNAME_S := $(shell uname -s) UNAME_S := $(shell uname -s)
FIND_PWD_REGEXP := find . -regextype posix-egrep
ifeq ($(UNAME_S),Darwin) ifeq ($(UNAME_S),Darwin)
SED_INPLACE := sed -i '' SED_INPLACE := sed -i ''
FIND_PWD_REGEXP := find -E .
endif endif
ifeq ($(UNAME_S),FreeBSD) ifeq ($(UNAME_S),FreeBSD)
SED_INPLACE := sed -i '' SED_INPLACE := sed -i ''
FIND_PWD_REGEXP := find -E .
endif endif
endif endif
@ -63,7 +67,7 @@ LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(G
PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell GO111MODULE=on $(GO) list -mod=vendor ./... | grep -v /vendor/))) PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell GO111MODULE=on $(GO) list -mod=vendor ./... | grep -v /vendor/)))
GO_SOURCES ?= $(shell find . -type d \( -path ./node_modules -o -path ./docs -o -path ./public -o -path ./options -o -path ./contrib -o -path ./data \) -prune -o -type f -name '*.go' -print) GO_SOURCES ?= $(shell $(FIND_PWD_REGEXP) -regex '\./(node_modules|docs|public|options|contrib|data)' -prune -o -name "*.go" -type f -print)
GO_SOURCES_OWN := $(filter-out ./vendor/% %/bindata.go, $(GO_SOURCES)) GO_SOURCES_OWN := $(filter-out ./vendor/% %/bindata.go, $(GO_SOURCES))
WEBPACK_SOURCES ?= $(shell find web_src/js web_src/less -type f) WEBPACK_SOURCES ?= $(shell find web_src/js web_src/less -type f)