From b109e8b16488f9bbfdc4aefe0e9b00c4f202e905 Mon Sep 17 00:00:00 2001 From: Etienne Dechamps Date: Sun, 29 Jun 2014 18:26:55 +0100 Subject: [PATCH] Use git describe to populate autoconf's VERSION. This uses the output of "git describe" directly in configure.ac to determine the version number to use, instead of hardcoding it. With this change, current version information is completely removed from the codebase itself, and is always fetched on-the-fly from git as the single source of truth. In order to ensure make dist always uses the current version number in the contents of the packaged configure script as well as the package name, a dependency is added to the dist target such that autoconf is always run before dist to regenerate the version number. If this wasn't the case, make dist would use the version number from when autoconf was originally run, not the version number that make dist is running from. That said, errors from that rule are ignored so that people can still run make dist without a working autoconf. In addition, the NEWS check is dropped, as it would then become annoying because it would force make dist users to always have a line for the current commit in the NEWS file. --- Makefile.am | 8 ++++++++ configure.ac | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0a4faef3..9c245616 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,6 +8,14 @@ ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = COPYING.README README.android +# If git describe works, force autoconf to run in order to make sure we have the +# current version number from git in the resulting configure script. +configure-version: + -git describe && autoconf --force + +# Triggering the README target means we are building a distribution (make dist). +README: configure-version + ChangeLog: git log > ChangeLog diff --git a/configure.ac b/configure.ac index 9a9bf019..2672e1c5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([tinc], [1.1pre11]) +AC_INIT([tinc], m4_esyscmd([echo -n "`git describe || echo UNKNOWN | sed 's/release-//'`"])) AC_CONFIG_SRCDIR([src/tincd.c]) AC_GNU_SOURCE -AM_INIT_AUTOMAKE([check-news std-options subdir-objects -Wall]) +AM_INIT_AUTOMAKE([std-options subdir-objects -Wall]) AC_CONFIG_HEADERS([config.h]) # Enable GNU extensions. -- 2.20.1