Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2022-12-08 00:22:38 +0300
committerCorinna Vinschen <corinna@vinschen.de>2022-12-11 13:25:04 +0300
commitbfaae2d2349f2ab1a65b6828e01c335851924f0e (patch)
treeac7ea3866333a017b0b46670afc6bcced3415138
parentea0a84424c0870dc9a3f7ef3bffb0f17b9b79c1e (diff)
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>
-rw-r--r--winsup/cygwin/Makefile.am5
-rw-r--r--winsup/cygwin/uname.cc12
2 files changed, 14 insertions, 3 deletions
diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am
index b1849d5a6..e61f72716 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 d2f93304e..dd4160189 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 */