Detect version of sed in Makefile (#12319)
* Detect version of sed in Makefile It's possible to install GNU sed on Darwin or FreeBSD so it's better to not assume BSD sed on those platforms but to instead perform version detection for the `GNU` string and only use BSD syntax if absent. * silence stderr Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
e67c042511
commit
8d6fa00da0
1 changed files with 6 additions and 9 deletions
11
Makefile
11
Makefile
|
@ -21,7 +21,6 @@ IMPORT := code.gitea.io/gitea
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
|
|
||||||
GO ?= go
|
GO ?= go
|
||||||
SED_INPLACE := sed -i
|
|
||||||
SHASUM ?= shasum -a 256
|
SHASUM ?= shasum -a 256
|
||||||
HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO" )
|
HAS_GO = $(shell hash $(GO) > /dev/null 2>&1 && echo "GO" || echo "NOGO" )
|
||||||
COMMA := ,
|
COMMA := ,
|
||||||
|
@ -42,19 +41,17 @@ ifeq ($(HAS_GO), GO)
|
||||||
CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS)
|
CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(OS), Windows_NT)
|
ifeq ($(OS), Windows_NT)
|
||||||
EXECUTABLE ?= gitea.exe
|
EXECUTABLE ?= gitea.exe
|
||||||
else
|
else
|
||||||
EXECUTABLE ?= gitea
|
EXECUTABLE ?= gitea
|
||||||
UNAME_S := $(shell uname -s)
|
|
||||||
ifeq ($(UNAME_S),Darwin)
|
|
||||||
SED_INPLACE := sed -i ''
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(UNAME_S),FreeBSD)
|
|
||||||
|
ifeq ($(shell sed --version 2>/dev/null | grep -q GNU && echo gnu),gnu)
|
||||||
|
SED_INPLACE := sed -i
|
||||||
|
else
|
||||||
SED_INPLACE := sed -i ''
|
SED_INPLACE := sed -i ''
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
GOFMT ?= gofmt -s
|
GOFMT ?= gofmt -s
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue