build: derive the release version from configure.ac
build.sh hardcoded VERSION="1.0.3" while configure.ac had been at 1.1.0 since
660678f9b. package_release() uses it to name the output directory, so
`./build.sh --all-release` from dev would have emitted
release/dragonx-1.0.3-<platform>/ containing binaries that report 1.1.0 --
mislabelled artifacts, from the one place where the label is what users see.
Read the four _CLIENT_VERSION_* defines out of configure.ac instead, applying the
same suffix rule its _CLIENT_VERSION_SUFFIX m4 uses (build < 25 -> beta, < 50 ->
rc, == 50 -> plain, > 50 -> point release), and abort if any of them cannot be
parsed rather than naming a release directory after an empty string.
SCRIPT_DIR moves above the version block because the lookup needs it.
Verified: derives 1.1.0 from the current tree, and a deliberately unparseable
configure.ac makes it exit 1 with a message instead of guessing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
26
build.sh
26
build.sh
@@ -6,10 +6,34 @@
|
|||||||
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
VERSION="1.0.3"
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
RELEASE_DIR="$SCRIPT_DIR/release"
|
RELEASE_DIR="$SCRIPT_DIR/release"
|
||||||
|
|
||||||
|
# Derive the release version from configure.ac instead of hardcoding it here.
|
||||||
|
# A stale literal names the release directories after the wrong version while the
|
||||||
|
# binaries inside report the real one: this said 1.0.3 while the tree was already
|
||||||
|
# 1.1.0, so `./build.sh --all-release` would have produced
|
||||||
|
# release/dragonx-1.0.3-<platform>/ full of binaries announcing 1.1.0.
|
||||||
|
# Mirrors configure.ac's _CLIENT_VERSION_SUFFIX m4 exactly:
|
||||||
|
# build < 25 -> beta(build+1) build < 50 -> rc(build-24)
|
||||||
|
# build == 50 -> plain release build > 50 -> point release (build-50)
|
||||||
|
_acdef() { sed -n "s/^define(_CLIENT_VERSION_$1, *\([0-9]\{1,\}\))/\1/p" "$SCRIPT_DIR/configure.ac"; }
|
||||||
|
_V_MAJOR="$(_acdef MAJOR)"
|
||||||
|
_V_MINOR="$(_acdef MINOR)"
|
||||||
|
_V_REVISION="$(_acdef REVISION)"
|
||||||
|
_V_BUILD="$(_acdef BUILD)"
|
||||||
|
if [ -z "$_V_MAJOR" ] || [ -z "$_V_MINOR" ] || [ -z "$_V_REVISION" ] || [ -z "$_V_BUILD" ]; then
|
||||||
|
echo "ERROR: could not read the version from $SCRIPT_DIR/configure.ac" >&2
|
||||||
|
echo " refusing to build a release whose directory name would be wrong." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "$_V_BUILD" -lt 25 ]; then _V_SUFFIX="$_V_REVISION-beta$((_V_BUILD + 1))"
|
||||||
|
elif [ "$_V_BUILD" -lt 50 ]; then _V_SUFFIX="$_V_REVISION-rc$((_V_BUILD - 24))"
|
||||||
|
elif [ "$_V_BUILD" -eq 50 ]; then _V_SUFFIX="$_V_REVISION"
|
||||||
|
else _V_SUFFIX="$_V_REVISION-$((_V_BUILD - 50))"
|
||||||
|
fi
|
||||||
|
VERSION="$_V_MAJOR.$_V_MINOR.$_V_SUFFIX"
|
||||||
|
|
||||||
# Parse release flags
|
# Parse release flags
|
||||||
BUILD_LINUX_RELEASE=0
|
BUILD_LINUX_RELEASE=0
|
||||||
BUILD_WIN_RELEASE=0
|
BUILD_WIN_RELEASE=0
|
||||||
|
|||||||
Reference in New Issue
Block a user