-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Remove .exe suffix when cross-compiling on Windows #27448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
That's not right. What if I want to compile for Windows on Linux? Maybe we should check |
@lng2020 Thanks, I haven't thought of the reverse situation for some reason. Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, Is there a certain reason to replace findstring Windows
with Windows_NT
? I did the search and those two ways seem the same.
I guess the previous exact match is still better, even if the name is not accurate. I was unable to find any docs on this |
It is defined by default on Windows by the system. I couldn't find any docs for this on MSDN, but it's mentioned in a Wikipedia article here
It seems that it should be safe to just check for equality with Update: Checked it on Cygwin/MSYS - same value there. |
Looks like it returns |
In this case the |
Makefile
Outdated
else ifeq ($(OS), Windows) | ||
ifeq ($(GOOS),windows) | ||
IS_WINDOWS := yes | ||
else ifeq ($(findstring Windows,$(OS)),Windows) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else ifeq ($(findstring Windows,$(OS)),Windows) | |
else ifeq ($(patsubst Windows%,,$(OS)),) |
Test with this:
OS := Windows_NT
all:
ifeq ($(patsubst Windows%,,$(OS)),)
@echo "$(OS) starts with Windows"
else
@echo "$(OS) doesn't start with Windows"
endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, this is better. Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this doesn't work when OS
is empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit of a hack but this works with empty as well:
ifeq ($(patsubst Windows%,x,$(OS)),x)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is clearer:
ifeq ($(patsubst Windows%,Windows,$(OS)),Windows)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand it fails with spaces OS = Windows NT
. Let's keep the current version.
Head branch was pushed to by a user without write access
* giteaoffical/main: (79 commits) Pre-register OAuth application for tea (go-gitea#27509) Fix mermaid flowchart margin issue (go-gitea#27503) add a shortcut to user's profile page to admin user details (go-gitea#27299) Fix actionlint (go-gitea#27513) [skip ci] Updated translations via Crowdin Update JS and PY dependencies (go-gitea#27501) Improve feed icons and feed merge text color (go-gitea#27498) Downgrade `go-co-op/gocron` to v1.31.1 (go-gitea#27511) Enable markdownlint `no-duplicate-header` (go-gitea#27500) bump go-deps (go-gitea#27489) Apply to became a maintainer (go-gitea#27491) change runner for binary [skip ci] Updated translations via Crowdin Remove .exe suffix when cross-compiling on Windows (go-gitea#27448) move re-useable workflow add checkout to disk-clean use hosted runners for nightly actions (go-gitea#27485) Avoid run change title process when the title is same (go-gitea#27467) Fix panic in storageHandler (go-gitea#27446) Rename the default themes to gitea-light, gitea-dark, gitea-auto (go-gitea#27419) ...
When compiling GItea for Linux on Windows, you get a
gitea.exe
file as output, but because it's a Linux executable, the.exe
extension is unnecessary.This PR adds a check for
GOOS
environment variable in addition toOS
.