Skip to content

Commit bec3d60

Browse files
committed
uname: report msys2-runtime commit hash, too
Having just Cygwin's version in the output of `uname` is not helpful as both MSYS2 as well as Git for Windows release intermediate versions of the MSYS2 runtime much more often than Cygwin runtime versions are released. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent f5f594c commit bec3d60

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

winsup/configure.ac

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,30 @@ AC_ARG_WITH([msys2-runtime-commit],
6565
case "$MSYS2_RUNTIME_COMMIT" in
6666
no)
6767
MSYS2_RUNTIME_COMMIT=
68+
MSYS2_RUNTIME_COMMIT_SHORT=
6869
MSYS2_RUNTIME_COMMIT_HEX=0
6970
;;
7071
yes|auto)
7172
if MSYS2_RUNTIME_COMMIT="$(git --git-dir="$srcdir/../.git" rev-parse HEAD)"
7273
then
73-
MSYS2_RUNTIME_COMMIT_HEX="0x$(expr "$MSYS2_RUNTIME_COMMIT" : '\(.\{,8\}\)')ull"
74+
MSYS2_RUNTIME_COMMIT_SHORT="$(expr "$MSYS2_RUNTIME_COMMIT" : '\(.\{,8\}\)')"
75+
MSYS2_RUNTIME_COMMIT_HEX="0x${MSYS2_RUNTIME_COMMIT_SHORT}ul"
7476
else
7577
AC_MSG_WARN([Could not determine msys2-runtime commit"])
7678
MSYS2_RUNTIME_COMMIT=
79+
MSYS2_RUNTIME_COMMIT_SHORT=
7780
MSYS2_RUNTIME_COMMIT_HEX=0
7881
fi
7982
;;
8083
*)
8184
expr "$MSYS2_RUNTIME_COMMIT" : '@<:@0-9a-f@:>@\{6,64\}$' ||
8285
AC_MSG_ERROR([Invalid commit name: "$MSYS2_RUNTIME_COMMIT"])
83-
MSYS2_RUNTIME_COMMIT_HEX="0x$(expr "$MSYS2_RUNTIME_COMMIT" : '\(.\{,8\}\)')ull"
86+
MSYS2_RUNTIME_COMMIT_SHORT="$(expr "$MSYS2_RUNTIME_COMMIT" : '\(.\{,8\}\)')"
87+
MSYS2_RUNTIME_COMMIT_HEX="0x${MSYS2_RUNTIME_COMMIT_SHORT}ul"
8488
;;
8589
esac
90+
AC_SUBST(MSYS2_RUNTIME_COMMIT)
91+
AC_SUBST(MSYS2_RUNTIME_COMMIT_SHORT)
8692
AC_SUBST(MSYS2_RUNTIME_COMMIT_HEX)
8793

8894
AC_ARG_ENABLE(debugging,

winsup/cygwin/Makefile.am

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ if TARGET_X86_64
1717
COMMON_CFLAGS+=-mcmodel=small
1818
endif
1919

20-
VERSION_CFLAGS = -DMSYS2_RUNTIME_COMMIT_HEX="@MSYS2_RUNTIME_COMMIT_HEX@"
20+
VERSION_CFLAGS = -DMSYS2_RUNTIME_COMMIT="\"@MSYS2_RUNTIME_COMMIT@\""
21+
VERSION_CFLAGS += -DMSYS2_RUNTIME_COMMIT_SHORT="\"@MSYS2_RUNTIME_COMMIT_SHORT@\""
22+
VERSION_CFLAGS += -DMSYS2_RUNTIME_COMMIT_HEX="@MSYS2_RUNTIME_COMMIT_HEX@"
2123
COMMON_CFLAGS += $(VERSION_CFLAGS)
2224

2325
AM_CFLAGS=$(cflags_common) $(COMMON_CFLAGS)
@@ -408,7 +410,7 @@ src_files := $(foreach dir,$(dirs),$(find_src_files))
408410
version.cc: mkvers.sh include/cygwin/version.h winver.rc $(src_files)
409411
@echo "Making version.cc and winver.o";\
410412
export CC="$(CC)";\
411-
/bin/sh $(word 1,$^) $(word 2,$^) $(word 3,$^) $(WINDRES) $(CFLAGS)
413+
/bin/sh $(word 1,$^) $(word 2,$^) $(word 3,$^) $(WINDRES) $(CFLAGS) $(VERSION_CFLAGS)
412414

413415
winver.o: version.cc
414416

winsup/cygwin/mkvers.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ incfile="$1"; shift
1616
rcfile="$1"; shift
1717
windres="$1"; shift
1818
iflags=
19+
msys2_runtime_commit=
1920
# Find header file locations
2021
while [ -n "$*" ]; do
2122
case "$1" in
@@ -26,6 +27,9 @@ while [ -n "$*" ]; do
2627
shift
2728
iflags="$iflags -I$1"
2829
;;
30+
-DMSYS2_RUNTIME_COMMIT=*)
31+
msys2_runtime_commit="${1#*=}"
32+
;;
2933
esac
3034
shift
3135
done
@@ -185,6 +189,10 @@ then
185189
cvs_tag="$(echo $wv_cvs_tag | sed -e 's/-branch.*//')"
186190
cygwin_ver="$cygwin_ver-$cvs_tag"
187191
fi
192+
if [ -n "$msys2_runtime_commit" ]
193+
then
194+
cygwin_ver="$cygwin_ver-$msys2_runtime_commit"
195+
fi
188196

189197
echo "Version $cygwin_ver"
190198
set -$- $builddate

winsup/cygwin/uname.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ uname_x (struct utsname *name)
6464
cygwin_gethostname (buf, sizeof buf - 1);
6565
strncat (name->nodename, buf, sizeof (name->nodename) - 1);
6666
/* release */
67-
__small_sprintf (name->release, "%d.%d.%d-%d.",
67+
__small_sprintf (name->release, "%d.%d.%d-%s-%d.",
6868
cygwin_version.dll_major / 1000,
6969
cygwin_version.dll_major % 1000,
7070
cygwin_version.dll_minor,
71+
MSYS2_RUNTIME_COMMIT_SHORT,
7172
cygwin_version.api_minor);
7273
/* version */
7374
stpcpy (name->version, cygwin_version.dll_build_date);

0 commit comments

Comments
 (0)