From 756b088d7859cbc60eefd24fbc774d9d197aaf48 Mon Sep 17 00:00:00 2001 From: Sergey Zolotarev Date: Thu, 5 Oct 2023 22:36:50 +0600 Subject: [PATCH 1/2] Remove .exe suffix when cross-compiling on Windows --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index cbf3aff8eb102..d1cdbff1c13da 100644 --- a/Makefile +++ b/Makefile @@ -49,10 +49,14 @@ ifeq ($(HAS_GO), yes) CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS) endif -ifeq ($(OS), Windows_NT) - GOFLAGS := -v -buildmode=exe - EXECUTABLE ?= gitea.exe -else ifeq ($(OS), Windows) +ifeq ($(GOOS),windows) + IS_WINDOWS := yes +else ifeq ($(findstring Windows,$(OS)),Windows) + ifeq ($(GOOS),) + IS_WINDOWS := yes + endif +endif +ifeq ($(IS_WINDOWS),yes) GOFLAGS := -v -buildmode=exe EXECUTABLE ?= gitea.exe else From f0adbb7c6820a054d47c3381e8796dc3b47c2782 Mon Sep 17 00:00:00 2001 From: Sergey Zolotarev Date: Sat, 7 Oct 2023 00:05:43 +0600 Subject: [PATCH 2/2] Make Windows OS detection in Makefile less loose --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d1cdbff1c13da..0662da5536fb7 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ endif ifeq ($(GOOS),windows) IS_WINDOWS := yes -else ifeq ($(findstring Windows,$(OS)),Windows) +else ifeq ($(patsubst Windows%,Windows,$(OS)),Windows) ifeq ($(GOOS),) IS_WINDOWS := yes endif