mirror of
https://github.com/ARMSX2/ARMSX3.git
synced 2026-08-24 16:58:52 -07:00
Builds were reporting whichever commit cmake last configured against, not the one being built. rpcs3/git-version.h is generated at CONFIGURE time, and build-variants.sh deliberately skips reconfiguring an already-correct build dir because re-running cmake regenerates LLVM's headers and costs a full rebuild. So the stamp froze, and every build after that lied about itself. The gap was wide. HEAD is 20120-da26a455; the header on disk still said 19985-91952ae4, a commit from before 0.9.2. This is not cosmetic. A tester running 0.9.3 reported that older commit in their log, which sent an investigation hunting for a regression among upstream ISO changes their build did not contain, and very nearly had a fix built and sent for a version they were not running. A build that misreports itself makes every report from it ambiguous. stamp-git-version.sh writes the header from HEAD and is called by both build entry points before anything compiles. It only writes when the contents differ, so an unchanged HEAD does not force a rebuild, and ninja rebuilds just the translation units that include it.
41 lines
1.5 KiB
Bash
Executable File
41 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Refresh rpcs3/git-version.h from the current HEAD.
|
|
#
|
|
# cmake generates this header, but only when it CONFIGURES, and build-variants.sh deliberately
|
|
# skips reconfiguring an already-correct build dir because re-running cmake regenerates LLVM's
|
|
# generated headers and costs a full rebuild. So the version stamp froze at whenever cmake last
|
|
# ran, and every build after that reported an old commit.
|
|
#
|
|
# That is not cosmetic. A tester on 0.9.3 reported a 0.9.1-era commit in their log, which sent
|
|
# an investigation looking for a regression in commits their build did not contain. A build that
|
|
# misreports itself makes every bug report ambiguous.
|
|
#
|
|
# Writing the header directly is enough: ninja sees it change and rebuilds only what includes it.
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
OUT="$ROOT/rpcs3/git-version.h"
|
|
|
|
cd "$ROOT"
|
|
COUNT="$(git rev-list HEAD --count)"
|
|
SHA="$(git rev-parse --short=8 HEAD)"
|
|
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
|
|
|
NEW="// This is a generated file.
|
|
|
|
#define RPCS3_GIT_VERSION \"${COUNT}-${SHA}\"
|
|
#define RPCS3_GIT_BRANCH \"${BRANCH}\"
|
|
#define RPCS3_GIT_FULL_BRANCH \"local_build\"
|
|
|
|
// If you don't want this file to update/recompile, change to 1.
|
|
#define RPCS3_GIT_VERSION_NO_UPDATE 0"
|
|
|
|
# Only write when it differs, so an unchanged HEAD does not force a rebuild.
|
|
if [ ! -f "$OUT" ] || [ "$(cat "$OUT")" != "$NEW" ]; then
|
|
printf '%s' "$NEW" > "$OUT"
|
|
echo "==> git-version.h: ${COUNT}-${SHA} (${BRANCH})"
|
|
else
|
|
echo "==> git-version.h already current: ${COUNT}-${SHA}"
|
|
fi
|