mirror of https://github.com/nirenjan/libx52.git
Add Version file and associated scripts
When building from source, it is desired that we embed the version string into the resulting binaries so that we can determine exactly what version of the sources were used. This change adds a Version file, which always holds the latest release version, and a configure.version script, which tries to get the version information from Git, before falling back to using the version embedded in the above file. The generated configure script will then have the version embedded within it, which will then create the BUILD_VERSION definition in config.h. Applications can then use this definition as needed.reverse-scroll
parent
5f21ccd2e9
commit
ba936df6f8
|
@ -83,6 +83,8 @@ EXTRA_DIST += \
|
||||||
LICENSE \
|
LICENSE \
|
||||||
README.md \
|
README.md \
|
||||||
config.rpath \
|
config.rpath \
|
||||||
|
configure.version \
|
||||||
|
Version \
|
||||||
gettext.h \
|
gettext.h \
|
||||||
usb-ids.h \
|
usb-ids.h \
|
||||||
po/README.md
|
po/README.md
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0
|
# SPDX-License-Identifier: GPL-2.0-only WITH Classpath-exception-2.0
|
||||||
|
|
||||||
AC_INIT([x52pro-linux], [0.2.3], [nirenjan@gmail.com])
|
AC_INIT([x52pro-linux], [m4_esyscmd_s([cat ./Version])], [nirenjan@gmail.com])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
|
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
|
||||||
AC_REQUIRE_AUX_FILE([tap-driver.sh])
|
AC_REQUIRE_AUX_FILE([tap-driver.sh])
|
||||||
|
@ -26,6 +26,8 @@ AX_GCC_FUNC_ATTRIBUTE([format])
|
||||||
AX_GCC_FUNC_ATTRIBUTE([noreturn])
|
AX_GCC_FUNC_ATTRIBUTE([noreturn])
|
||||||
AC_C_TYPEOF
|
AC_C_TYPEOF
|
||||||
|
|
||||||
|
AC_DEFINE([BUILD_VERSION], ["m4_esyscmd([./configure.version])"], [Build version])
|
||||||
|
|
||||||
AC_MSG_NOTICE([Detected host OS is ${host_os}])
|
AC_MSG_NOTICE([Detected host OS is ${host_os}])
|
||||||
build_linux=no
|
build_linux=no
|
||||||
# Detect target system
|
# Detect target system
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Use the Git version if Git is available, otherwise fallback to Version
|
||||||
|
|
||||||
|
top_srcdir="${1-.}"
|
||||||
|
test -d "${top_srcdir}" || { \
|
||||||
|
echo "FATAL: Could not change to top_srcdir '$1'" >&2 ; \
|
||||||
|
exit 1 ; \
|
||||||
|
}
|
||||||
|
|
||||||
|
version="${top_srcdir}/Version"
|
||||||
|
|
||||||
|
# Use GIT_DIR if set
|
||||||
|
if ! test -n "${GIT_DIR}"
|
||||||
|
then
|
||||||
|
GIT_DIR="${top_srcdir}/.git"
|
||||||
|
export GIT_DIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -d "${GIT_DIR}"
|
||||||
|
then
|
||||||
|
# Change tags like vX.Y.Z to X.Y.Z
|
||||||
|
DESCRIBE=$(git describe --dirty 2>/dev/null)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test ! -n "${DESCRIBE}"
|
||||||
|
then
|
||||||
|
DESCRIBE="unknown-version"
|
||||||
|
if test -f "${version}"
|
||||||
|
then
|
||||||
|
DESCRIBE="v$(cat "${version}")"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "%s" "${DESCRIBE}"
|
Loading…
Reference in New Issue