public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: uname: fix building in non-git source dir Date: Wed, 7 Dec 2022 21:22:47 +0000 (GMT) [thread overview] Message-ID: <20221207212247.F37C73854572@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=4949a82cde98886a79a962bf583cdbe9a2186078 commit 4949a82cde98886a79a962bf583cdbe9a2186078 Author: Corinna Vinschen <corinna@vinschen.de> AuthorDate: Wed Dec 7 22:22:38 2022 +0100 Commit: Corinna Vinschen <corinna@vinschen.de> CommitDate: Wed Dec 7 22:22:38 2022 +0100 Cygwin: uname: fix building in non-git source dir commit 97eb64b909bc broke building outside of a git dir, because the git describe command would fail. Fix this by checking if we're in a git tree at all and just generate an empty string as version string. Use this in uname_x to generate a fallback version. Fixes: 97eb64b909bc ("Cygwin: uname: generate default release string from git as well" Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Diff: --- winsup/cygwin/Makefile.am | 5 ++++- winsup/cygwin/uname.cc | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am index b1849d5a6737..e61f72716e10 100644 --- a/winsup/cygwin/Makefile.am +++ b/winsup/cygwin/Makefile.am @@ -421,7 +421,10 @@ src_files := $(foreach dir,$(dirs),$(find_src_files)) uname_version.c: .FORCE $(AM_V_GEN)cd $(srcdir) && \ - echo "const char *uname_dev_version = \"$$(git describe --dirty | sed -e 's/cygwin-//')\";" > $(abs_builddir)/uname_version.c + echo "const char *uname_dev_version = \ + \"$$(git rev-parse --git-dir >/dev/null 2>&1 && \ + git describe --dirty | sed -e 's/cygwin-//')\";" \ + > $(abs_builddir)/uname_version.c .FORCE: # mkvers.sh creates version.cc in the first place, winver.o always diff --git a/winsup/cygwin/uname.cc b/winsup/cygwin/uname.cc index d2f93304e494..dd4160189c3a 100644 --- a/winsup/cygwin/uname.cc +++ b/winsup/cygwin/uname.cc @@ -60,8 +60,16 @@ uname_x (struct utsname *name) __XSTRING (CYGPORT_RELEASE_INFO), name->machine); #else extern const char *uname_dev_version; - snprintf (name->release, _UTSNAME_LENGTH, "%s.%s", - uname_dev_version, name->machine); + if (uname_dev_version && uname_dev_version[0]) + snprintf (name->release, _UTSNAME_LENGTH, "%s.%s", + uname_dev_version, name->machine); + else + __small_sprintf (name->release, "%d.%d.%d-api-%d.%s", + cygwin_version.dll_major / 1000, + cygwin_version.dll_major % 1000, + cygwin_version.dll_minor, + cygwin_version.api_minor, + name->machine); #endif #pragma GCC diagnostic pop /* version */
reply other threads:[~2022-12-07 21:22 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221207212247.F37C73854572@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).