mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-09 13:02:01 +03:00
Merge commit 'origin/403_versioning_cleanup'
* commit 'origin/403_versioning_cleanup': version.sh: pregenerate version.h to avoid running ./configure twice in clean environment version.sh: unbreak version.h generation (--git-dir needs path to bare repo) version.sh: fix typo version.sh: more elegant extraction of old version version.sh: fix bashisms version.sh: don't suppress error messages from git availability check
This commit is contained in:
commit
22ca1a9263
@ -84,6 +84,8 @@ test -f configure || \
|
||||
{ echo "autoconf failed to generate vfs/samba/configure" >&2; exit 1; }
|
||||
) || exit 1
|
||||
|
||||
$srcdir/maint/version.sh "$srcdir"
|
||||
|
||||
if test -x $srcdir/configure.mc; then
|
||||
$srcdir/configure.mc "$@"
|
||||
fi
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
git --version &>/dev/null || exit
|
||||
git --version >/dev/null || exit
|
||||
|
||||
curr_dir=$(pwd)
|
||||
|
||||
@ -21,24 +21,22 @@ src_top_dir=
|
||||
|
||||
VERSION_FILE=${src_top_dir}/version.h
|
||||
|
||||
pushd ${src_top_dir} &>/dev/null
|
||||
git_head=$(git rev-parse --verify HEAD 2>/dev/null)
|
||||
git_head=$(git --git-dir "${src_top_dir}/.git" rev-parse --verify HEAD 2>/dev/null)
|
||||
[ -z "${git_head}" ] && exit
|
||||
|
||||
new_version="$(git describe 2>/dev/null)"
|
||||
new_version="$(git --git-dir "${src_top_dir}/.git" describe 2>/dev/null)"
|
||||
[ -z "${new_version}" ] && exit
|
||||
popd &>/dev/null
|
||||
|
||||
|
||||
saved_version=
|
||||
[ -r ${VERSION_FILE} ] && {
|
||||
saved_version=$(grep '^#define MC_CURRENT_VERSION' ${VERSION_FILE}| sed -r 's/.*"(.*)"$/\1/')
|
||||
saved_version=$(sed -rn 's/^#define MC_CURRENT_VERSION "(.*)"$/\1/p' ${VERSION_FILE})
|
||||
}
|
||||
|
||||
[ -z "${saved_version}" -o "${saved_version}" != "${new_version}" ] && {
|
||||
cat >${VERSION_FILE} <<EOF
|
||||
#ifndef MC_CURRENT_VERSION
|
||||
/* This is autogenerated file. Don't edit! */
|
||||
/* This is an autogenerated file. Don't edit! */
|
||||
#define MC_CURRENT_VERSION "${new_version}"
|
||||
#endif
|
||||
EOF
|
||||
|
Loading…
Reference in New Issue
Block a user