mirror of https://github.com/MidnightCommander/mc
Version of project now formed automatically from current git-describe output
* File version.h will be created (or changed) automatically * Fixed versions for rpm packages - all '-' changed to '.' in RPM_VERSION variable * when version.h is changed (or deleted) ./configure script will be invoked Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
089cb8f65d
commit
f606e64861
|
@ -34,3 +34,4 @@ tmpout
|
|||
debug
|
||||
Doxyfile
|
||||
mc.kdevelop
|
||||
version.h
|
||||
|
|
15
Makefile.am
15
Makefile.am
|
@ -1,5 +1,4 @@
|
|||
## Process this file with automake to create Makefile.in.
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.5
|
||||
|
||||
SUBDIRS = intl po vfs edit src doc syntax contrib misc
|
||||
|
@ -8,5 +7,19 @@ EXTRA_DIST =
|
|||
|
||||
dist_noinst_SCRIPTS = build-glib2.sh
|
||||
|
||||
dist_noinst_HEADERS = $(top_srcdir)/version.h
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
CONFIG_STATUS_DEPENDENCIES = $(top_srcdir)/version.h
|
||||
|
||||
.PHONY: update-version
|
||||
|
||||
update-version:
|
||||
@if test -x $(top_srcdir)/maint/version.sh; then \
|
||||
$(top_srcdir)/maint/version.sh "$(top_srcdir)" 2>&1 >/dev/null; \
|
||||
else \
|
||||
echo "File not found: $(top_srcdir)/maint/version.sh"; \
|
||||
fi
|
||||
|
||||
$(top_srcdir)/version.h: update-version
|
||||
|
|
|
@ -6,3 +6,4 @@ m4_include([m4.include/mc-use-termcap.m4])
|
|||
m4_include([m4.include/mc-with-screen.m4])
|
||||
m4_include([m4.include/ac-g-module-supported.m4])
|
||||
m4_include([m4.include/mc-vfs.m4])
|
||||
m4_include([m4.include/mc-version.m4])
|
||||
|
|
|
@ -7,7 +7,8 @@ AC_PREREQ(2.60)
|
|||
m4_pattern_forbid(MC_)
|
||||
AC_CONFIG_SRCDIR(src/main.c)
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
AM_INIT_AUTOMAKE(mc, 4.6.2)
|
||||
MC_VERSION
|
||||
AM_INIT_AUTOMAKE(mc, ${VERSION} )
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_MAINTAINER_MODE
|
||||
|
@ -531,7 +532,7 @@ dnl Libraries used only when building the mc binary
|
|||
AC_SUBST(MCLIBS)
|
||||
|
||||
dnl Version for the RedHat package, without dashes
|
||||
RPM_VERSION=`echo $VERSION | sed 's/-//g'`
|
||||
RPM_VERSION=`echo $VERSION | sed 's/-/./g'`
|
||||
AC_SUBST(RPM_VERSION)
|
||||
|
||||
if test -n "$use_smbfs"; then
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
dnl @synopsis MC_VERSION
|
||||
dnl
|
||||
dnl get current version of Midnight Commander from git tags
|
||||
dnl
|
||||
dnl @author Slava Zanko <slavazanko@gmail.com>
|
||||
dnl @version 2009-06-02
|
||||
dnl @license GPL
|
||||
dnl @copyright Free Software Foundation, Inc.
|
||||
|
||||
AC_DEFUN([MC_VERSION],[
|
||||
if test ! -f ${srcdir}/version.h; then
|
||||
${srcdir}/maint/version.sh ${srcdir}
|
||||
fi
|
||||
if test -f ${srcdir}/version.h; then
|
||||
VERSION=$(cat ${srcdir}/version.h| grep '^#define MC_CURRENT_VERSION'| sed -r 's/.*"(.*)"$/\1/')
|
||||
else
|
||||
VERSION="unknown"
|
||||
fi
|
||||
AC_SUBST(VERSION)
|
||||
])
|
|
@ -0,0 +1,46 @@
|
|||
#!/bin/sh
|
||||
|
||||
git --version &>/dev/null || exit
|
||||
|
||||
curr_dir=$(pwd)
|
||||
|
||||
src_top_dir=
|
||||
[ -d ${curr_dir}/.git ] && {
|
||||
src_top_dir=${curr_dir}
|
||||
} || {
|
||||
curr_dir=$(dirname ${curr_dir})
|
||||
[ -d ${curr_dir}/.git ] && {
|
||||
src_top_dir=${curr_dir}
|
||||
} || {
|
||||
[ -z "$1" ] && exit
|
||||
src_top_dir=$1
|
||||
}
|
||||
}
|
||||
[ -z "${src_top_dir}" ] && exit
|
||||
|
||||
|
||||
VERSION_FILE=${src_top_dir}/version.h
|
||||
|
||||
pushd ${src_top_dir} &>/dev/null
|
||||
git_head=$(git rev-parse --verify HEAD 2>/dev/null)
|
||||
[ -z "${git_head}" ] && exit
|
||||
|
||||
new_version="$(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/')
|
||||
}
|
||||
|
||||
[ -z "${saved_version}" -o "${saved_version}" != "${new_version}" ] && {
|
||||
cat >${VERSION_FILE} <<EOF
|
||||
#ifndef MC_CURRENT_VERSION
|
||||
/* This is autogenerated file. Don't edit! */
|
||||
#define MC_CURRENT_VERSION "${new_version}"
|
||||
#endif
|
||||
EOF
|
||||
}
|
||||
exit 0
|
|
@ -2,7 +2,7 @@
|
|||
noinst_LTLIBRARIES = libmcconfig.la
|
||||
|
||||
libmcconfig_la_SOURCES = \
|
||||
../mcconfig.h \
|
||||
mcconfig.h \
|
||||
common.c \
|
||||
get.c \
|
||||
set.c
|
||||
|
|
Loading…
Reference in New Issue