Skip to content

Commit 4a278d3

Browse files
committed
build: Allow ./configure --version=X.Y.Z
1 parent 97849b8 commit 4a278d3

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

build/config.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ gen/vars.mk::
3838
@printf 'MKDIR := %s\n' "$$XMKDIR" >>$@
3939
@printf 'PKG_CONFIG := %s\n' "$$XPKG_CONFIG" >>$@
4040
@printf 'RM := %s\n' "$$XRM" >>$@
41+
@test -z "$$VERSION" || printf 'export VERSION=%s\n' "$$VERSION" >>$@
4142
${VCAT} $@
4243

4344
# Sets the build flags. This depends on vars.mk and uses a recursive make so

configure

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
set -eu
99

10+
# Get the relative path to the source tree based on how the script was run
11+
DIR=$(dirname -- "$0")
12+
1013
# Print the help message
1114
help() {
1215
cat <<EOF
@@ -57,6 +60,8 @@ Packaging:
5760
Set the installation prefix (default: /usr)
5861
--mandir=/path
5962
Set the man page directory (default: \$PREFIX/share/man)
63+
--version=X.Y.Z
64+
Set the version string (default: $("$DIR/build/version.sh"))
6065
6166
This script is a thin wrapper around a makefile-based configuration system.
6267
Any other arguments will be passed directly to the $MAKE invocation, e.g.
@@ -134,7 +139,7 @@ for arg; do
134139
printf 'warning: Treating "%s" like "%s"\n' "$old" "$arg" >&2
135140
;;
136141
esac
137-
;;
142+
;;
138143
esac
139144

140145
case "$arg" in
@@ -165,7 +170,7 @@ for arg; do
165170
esac
166171
;;
167172

168-
--prefix=*|--mandir=*)
173+
--prefix=*|--mandir=*|--version=*)
169174
set -- "$@" "$NAME=$value"
170175
;;
171176

@@ -188,9 +193,6 @@ for arg; do
188193
esac
189194
done
190195

191-
# Get the relative path to the source tree based on how the script was run
192-
DIR=$(dirname -- "$0")
193-
194196
# Set up symbolic links for out-of-tree builds
195197
for f in Makefile build completions docs src tests; do
196198
test -e "$f" || ln -s "$DIR/$f" "$f"

0 commit comments

Comments
 (0)