Cygwin: uname: fix building in non-git source dir
commit97eb64b909
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:97eb64b909
("Cygwin: uname: generate default release string from git as well" Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
97eb64b909
commit
4949a82cde
|
@ -421,7 +421,10 @@ src_files := $(foreach dir,$(dirs),$(find_src_files))
|
||||||
|
|
||||||
uname_version.c: .FORCE
|
uname_version.c: .FORCE
|
||||||
$(AM_V_GEN)cd $(srcdir) && \
|
$(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:
|
.FORCE:
|
||||||
|
|
||||||
# mkvers.sh creates version.cc in the first place, winver.o always
|
# mkvers.sh creates version.cc in the first place, winver.o always
|
||||||
|
|
|
@ -60,8 +60,16 @@ uname_x (struct utsname *name)
|
||||||
__XSTRING (CYGPORT_RELEASE_INFO), name->machine);
|
__XSTRING (CYGPORT_RELEASE_INFO), name->machine);
|
||||||
#else
|
#else
|
||||||
extern const char *uname_dev_version;
|
extern const char *uname_dev_version;
|
||||||
snprintf (name->release, _UTSNAME_LENGTH, "%s.%s",
|
if (uname_dev_version && uname_dev_version[0])
|
||||||
uname_dev_version, name->machine);
|
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
|
#endif
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
/* version */
|
/* version */
|
||||||
|
|
Loading…
Reference in New Issue