build: Let configure create the VERSION file.

* autogen.sh: Update from libgpg-error.
* configure.ac: Use mym4_version to create VERSION file.
* Makefile.am (dist-hook): Do not create VERSION.
(EXTRA_DIST): Add VERSION.

--

GnuPG-bug-id: 3283
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2018-10-10 13:39:42 +09:00
parent c565cf42a3
commit 85dd0fa4b5
4 changed files with 83 additions and 65 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@
/conf/config.h.in /conf/config.h.in
/conf/config.h /conf/config.h
/libtool /libtool
/VERSION
Makefile.in Makefile.in
Makefile Makefile
stamp-h1 stamp-h1

View File

@ -35,7 +35,7 @@ DISTCHECK_CONFIGURE_FLAGS =
EXTRA_DIST = autogen.sh autogen.rc gpgme.spec.in \ EXTRA_DIST = autogen.sh autogen.rc gpgme.spec.in \
ChangeLog-2011 m4/ChangeLog-2011 contrib/ChangeLog-2011 \ ChangeLog-2011 m4/ChangeLog-2011 contrib/ChangeLog-2011 \
conf/whatisthis conf/whatisthis VERSION
if RUN_GPG_TESTS if RUN_GPG_TESTS
@ -46,13 +46,11 @@ endif
SUBDIRS = src ${tests} doc lang SUBDIRS = src ${tests} doc lang
# Fix the version of the spec file and create a file named VERSION # Fix the version of the spec file.
# to be used for patch's Prereq: feature.
dist-hook: gen-ChangeLog dist-hook: gen-ChangeLog
@set -e; \ @set -e; \
sed -e 's/@pkg_version@/$(PACKAGE_VERSION)/g' \ sed -e 's/@pkg_version@/$(PACKAGE_VERSION)/g' \
$(top_srcdir)/gpgme.spec.in > $(distdir)/gpgme.spec $(top_srcdir)/gpgme.spec.in > $(distdir)/gpgme.spec
echo "$(PACKAGE_VERSION)" > $(distdir)/VERSION
distcheck-hook: distcheck-hook:
set -e; ( \ set -e; ( \

View File

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# autogen.sh # autogen.sh
# Copyright (C) 2003, 2014, 2017 g10 Code GmbH # Copyright (C) 2003, 2014, 2017, 2018 g10 Code GmbH
# #
# This file is free software; as a special exception the author gives # This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without # unlimited permission to copy and/or distribute it, with or without
@ -15,7 +15,7 @@
# configure it for the respective package. It is maintained as part of # configure it for the respective package. It is maintained as part of
# GnuPG and source copied by other packages. # GnuPG and source copied by other packages.
# #
# Version: 2017-01-17 # Version: 2018-07-10
configure_ac="configure.ac" configure_ac="configure.ac"
@ -74,7 +74,6 @@ PRINT_HOST=no
PRINT_BUILD=no PRINT_BUILD=no
tmp=$(dirname "$0") tmp=$(dirname "$0")
tsdir=$(cd "${tmp}"; pwd) tsdir=$(cd "${tmp}"; pwd)
version_parts=3
if [ -n "${AUTOGEN_SH_SILENT}" ]; then if [ -n "${AUTOGEN_SH_SILENT}" ]; then
SILENT=" --silent" SILENT=" --silent"
@ -85,9 +84,10 @@ if test x"$1" = x"--help"; then
echo " --silent Silent operation" echo " --silent Silent operation"
echo " --force Pass --force to autoconf" echo " --force Pass --force to autoconf"
echo " --find-version Helper for configure.ac" echo " --find-version Helper for configure.ac"
echo " --build-TYPE Configure to cross build for TYPE" echo " --git-build Run all commands to build from a Git"
echo " --print-host Print only the host triplet" echo " --print-host Print only the host triplet"
echo " --print-build Print only the build platform triplet" echo " --print-build Print only the build platform triplet"
echo " --build-TYPE Configure to cross build for TYPE"
echo "" echo ""
echo " ARGS are passed to configure in --build-TYPE mode." echo " ARGS are passed to configure in --build-TYPE mode."
echo " Configuration for this script is expected in autogen.rc" echo " Configuration for this script is expected in autogen.rc"
@ -159,6 +159,10 @@ case "$1" in
SILENT=" --silent" SILENT=" --silent"
shift shift
;; ;;
--git-build)
myhost="git-build"
shift
;;
--build-w32) --build-w32)
myhost="w32" myhost="w32"
shift shift
@ -187,6 +191,25 @@ esac
die_p die_p
# **** GIT BUILD ****
# This is a helper to build from git.
if [ "$myhost" = "git-build" ]; then
tmp="$(pwd)"
cd "$tsdir" || fatal "error cd-ing to $tsdir"
./autogen.sh || fatal "error running ./autogen.sh"
cd "$tmp" || fatal "error cd-ing back to $tmp"
die_p
"$tsdir"/configure || fatal "error running $tsdir/configure"
die_p
make || fatal "error running make"
die_p
make check || fatal "error running male check"
die_p
exit 0
fi
# **** end GIT BUILD ****
# Source our configuration # Source our configuration
if [ -f "${tsdir}/autogen.rc" ]; then if [ -f "${tsdir}/autogen.rc" ]; then
. "${tsdir}/autogen.rc" . "${tsdir}/autogen.rc"
@ -215,18 +238,15 @@ if [ "$myhost" = "find-version" ]; then
exit 1 exit 1
fi fi
case "$version_parts" in if [ -z "$micro" ]; then
2)
matchstr1="$package-$major.[0-9]*" matchstr1="$package-$major.[0-9]*"
matchstr2="$package-$major-base" matchstr2="$package-$major-base"
vers="$major.$minor" vers="$major.$minor"
;; else
*)
matchstr1="$package-$major.$minor.[0-9]*" matchstr1="$package-$major.$minor.[0-9]*"
matchstr2="$package-$major.$minor-base" matchstr2="$package-$major.$minor-base"
vers="$major.$minor.$micro" vers="$major.$minor.$micro"
;; fi
esac
beta=no beta=no
if [ -e .git ]; then if [ -e .git ]; then
@ -467,6 +487,10 @@ EOF
EOF EOF
$CP build-aux/git-hooks/commit-msg .git/hooks/commit-msg $CP build-aux/git-hooks/commit-msg .git/hooks/commit-msg
chmod +x .git/hooks/commit-msg chmod +x .git/hooks/commit-msg
if [ x"${display_name}" != x ]; then
git config format.subjectPrefix "PATCH ${display_name}"
git config sendemail.to "${patches_to}"
fi
fi fi
fi fi

View File

@ -26,33 +26,29 @@ min_automake_version="1.14"
# bump the version number immediately after the release and do another # bump the version number immediately after the release and do another
# commit and push so that the git magic is able to work. See below # commit and push so that the git magic is able to work. See below
# for the LT versions. # for the LT versions.
m4_define(mym4_version_major, [1]) m4_define([mym4_package],[gpgme])
m4_define(mym4_version_minor, [12]) m4_define([mym4_major], [1])
m4_define(mym4_version_micro, [1]) m4_define([mym4_minor], [12])
m4_define([mym4_micro], [1])
# Below is m4 magic to extract and compute the revision number, the # Below is m4 magic to extract and compute the git revision number,
# decimalized short revision number, a beta version string, and a flag # the decimalized short revision number, a beta version string and a
# indicating a development version (mym4_isgit). Note that the m4 # flag indicating a development version (mym4_isbeta). Note that the
# processing is done by autoconf and not during the configure run. # m4 processing is done by autoconf and not during the configure run.
m4_define(mym4_version, m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \
[mym4_version_major.mym4_version_minor.mym4_version_micro]) mym4_package mym4_major mym4_minor mym4_micro),[:]))
m4_define([mym4_revision], m4_define([mym4_isbeta], m4_argn(2, mym4_verslist))
m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r'])) m4_define([mym4_version], m4_argn(4, mym4_verslist))
m4_define([mym4_revision_dec], m4_define([mym4_revision], m4_argn(7, mym4_verslist))
m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))])) m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist))
m4_define([mym4_betastring], m4_esyscmd([echo ]mym4_version[>VERSION])
m4_esyscmd_s([git describe --match 'gpgme-[0-9].*[0-9]' --long|\ AC_INIT([mym4_package],[mym4_version], [https://bugs.gnupg.org])
awk -F- '$3!=0{print"-beta"$3}']))
m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
AC_INIT([gpgme],[mym4_full_version],[http://bugs.gnupg.org])
# LT Version numbers, remember to change them just *before* a release. # LT Version numbers, remember to change them just *before* a release.
# (Code changed: REVISION++) # (Code changed: REVISION++)
# (Interfaces added/removed/changed: CURRENT++, REVISION=0) # (Interfaces added/removed/changed: CURRENT++, REVISION=0)
# (Interfaces added: AGE++) # (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0) # (Interfaces removed: AGE=0)
# #
LIBGPGME_LT_CURRENT=32 LIBGPGME_LT_CURRENT=32
LIBGPGME_LT_AGE=21 LIBGPGME_LT_AGE=21
@ -68,6 +64,19 @@ LIBGPGMEPP_LT_REVISION=0
LIBQGPGME_LT_CURRENT=10 LIBQGPGME_LT_CURRENT=10
LIBQGPGME_LT_AGE=3 LIBQGPGME_LT_AGE=3
LIBQGPGME_LT_REVISION=2 LIBQGPGME_LT_REVISION=2
################################################
AC_SUBST(LIBGPGME_LT_CURRENT)
AC_SUBST(LIBGPGME_LT_AGE)
AC_SUBST(LIBGPGME_LT_REVISION)
AC_SUBST(LIBGPGMEPP_LT_CURRENT)
AC_SUBST(LIBGPGMEPP_LT_AGE)
AC_SUBST(LIBGPGMEPP_LT_REVISION)
AC_SUBST(LIBQGPGME_LT_CURRENT)
AC_SUBST(LIBQGPGME_LT_AGE)
AC_SUBST(LIBQGPGME_LT_REVISION)
# If the API is changed in an incompatible way: increment the next counter. # If the API is changed in an incompatible way: increment the next counter.
GPGME_CONFIG_API_VERSION=1 GPGME_CONFIG_API_VERSION=1
@ -78,12 +87,9 @@ NEED_LIBASSUAN_API=2
NEED_LIBASSUAN_VERSION=2.4.2 NEED_LIBASSUAN_VERSION=2.4.2
PACKAGE=$PACKAGE_NAME VERSION_MAJOR=mym4_major
VERSION=$PACKAGE_VERSION VERSION_MINOR=mym4_minor
VERSION_MICRO=mym4_micro
VERSION_MAJOR=mym4_version_major
VERSION_MINOR=mym4_version_minor
VERSION_MICRO=mym4_version_micro
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
@ -114,25 +120,12 @@ AC_PROG_CXX
# Note: A suitable gitlog-to-changelog script can be found in GnuPG master. # Note: A suitable gitlog-to-changelog script can be found in GnuPG master.
AC_CHECK_PROGS(GITLOG_TO_CHANGELOG, gitlog-to-changelog, [gitlog-to-changelog]) AC_CHECK_PROGS(GITLOG_TO_CHANGELOG, gitlog-to-changelog, [gitlog-to-changelog])
AC_SUBST(LIBGPGME_LT_CURRENT)
AC_SUBST(LIBGPGME_LT_AGE)
AC_SUBST(LIBGPGME_LT_REVISION)
AC_SUBST(LIBGPGMEPP_LT_CURRENT)
AC_SUBST(LIBGPGMEPP_LT_AGE)
AC_SUBST(LIBGPGMEPP_LT_REVISION)
AC_SUBST(LIBQGPGME_LT_CURRENT)
AC_SUBST(LIBQGPGME_LT_AGE)
AC_SUBST(LIBQGPGME_LT_REVISION)
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(VERSION_MAJOR) AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR) AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_MICRO) AC_SUBST(VERSION_MICRO)
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package]) VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_major \
VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_version_major \ mym4_minor mym4_micro)
mym4_version_minor mym4_version_micro)
AC_SUBST(VERSION_NUMBER) AC_SUBST(VERSION_NUMBER)
# We need to compile and run a program on the build machine. A # We need to compile and run a program on the build machine. A
@ -488,9 +481,11 @@ AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
[GIT commit id revision used to build this package]) [GIT commit id revision used to build this package])
changequote(,)dnl changequote(,)dnl
BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'` BUILD_VERSION=`echo "$PACKAGE_VERSION" | sed 's/\([0-9.]*\).*/\1./'`
changequote([,])dnl changequote([,])dnl
BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec" BUILD_VERSION="${BUILD_VERSION}mym4_revision_dec"
BUILD_FILEVERSION=`echo "${BUILD_VERSION}" | tr . ,`
AC_SUBST(BUILD_VERSION)
AC_SUBST(BUILD_FILEVERSION) AC_SUBST(BUILD_FILEVERSION)
AC_ARG_ENABLE([build-timestamp], AC_ARG_ENABLE([build-timestamp],