From 85dd0fa4b5f026a13da842bf64ab8a37a68918d4 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 10 Oct 2018 13:39:42 +0900 Subject: [PATCH] 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 --- .gitignore | 1 + Makefile.am | 6 ++-- autogen.sh | 56 ++++++++++++++++++++++++---------- configure.ac | 85 +++++++++++++++++++++++++--------------------------- 4 files changed, 83 insertions(+), 65 deletions(-) diff --git a/.gitignore b/.gitignore index cef37ad9..59ca6d2e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /conf/config.h.in /conf/config.h /libtool +/VERSION Makefile.in Makefile stamp-h1 diff --git a/Makefile.am b/Makefile.am index 829cf14e..1264618f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ DISTCHECK_CONFIGURE_FLAGS = EXTRA_DIST = autogen.sh autogen.rc gpgme.spec.in \ ChangeLog-2011 m4/ChangeLog-2011 contrib/ChangeLog-2011 \ - conf/whatisthis + conf/whatisthis VERSION if RUN_GPG_TESTS @@ -46,13 +46,11 @@ endif SUBDIRS = src ${tests} doc lang -# Fix the version of the spec file and create a file named VERSION -# to be used for patch's Prereq: feature. +# Fix the version of the spec file. dist-hook: gen-ChangeLog @set -e; \ sed -e 's/@pkg_version@/$(PACKAGE_VERSION)/g' \ $(top_srcdir)/gpgme.spec.in > $(distdir)/gpgme.spec - echo "$(PACKAGE_VERSION)" > $(distdir)/VERSION distcheck-hook: set -e; ( \ diff --git a/autogen.sh b/autogen.sh index e5ba5bf0..9b361581 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,6 +1,6 @@ #! /bin/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 # 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 # GnuPG and source copied by other packages. # -# Version: 2017-01-17 +# Version: 2018-07-10 configure_ac="configure.ac" @@ -74,7 +74,6 @@ PRINT_HOST=no PRINT_BUILD=no tmp=$(dirname "$0") tsdir=$(cd "${tmp}"; pwd) -version_parts=3 if [ -n "${AUTOGEN_SH_SILENT}" ]; then SILENT=" --silent" @@ -85,9 +84,10 @@ if test x"$1" = x"--help"; then echo " --silent Silent operation" echo " --force Pass --force to autoconf" 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-build Print only the build platform triplet" + echo " --build-TYPE Configure to cross build for TYPE" echo "" echo " ARGS are passed to configure in --build-TYPE mode." echo " Configuration for this script is expected in autogen.rc" @@ -159,6 +159,10 @@ case "$1" in SILENT=" --silent" shift ;; + --git-build) + myhost="git-build" + shift + ;; --build-w32) myhost="w32" shift @@ -187,6 +191,25 @@ esac 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 if [ -f "${tsdir}/autogen.rc" ]; then . "${tsdir}/autogen.rc" @@ -215,18 +238,15 @@ if [ "$myhost" = "find-version" ]; then exit 1 fi - case "$version_parts" in - 2) - matchstr1="$package-$major.[0-9]*" - matchstr2="$package-$major-base" - vers="$major.$minor" - ;; - *) - matchstr1="$package-$major.$minor.[0-9]*" - matchstr2="$package-$major.$minor-base" - vers="$major.$minor.$micro" - ;; - esac + if [ -z "$micro" ]; then + matchstr1="$package-$major.[0-9]*" + matchstr2="$package-$major-base" + vers="$major.$minor" + else + matchstr1="$package-$major.$minor.[0-9]*" + matchstr2="$package-$major.$minor-base" + vers="$major.$minor.$micro" + fi beta=no if [ -e .git ]; then @@ -467,6 +487,10 @@ EOF EOF $CP build-aux/git-hooks/commit-msg .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 diff --git a/configure.ac b/configure.ac index 0d90e2bb..e0823f5f 100644 --- a/configure.ac +++ b/configure.ac @@ -26,33 +26,29 @@ min_automake_version="1.14" # 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 # for the LT versions. -m4_define(mym4_version_major, [1]) -m4_define(mym4_version_minor, [12]) -m4_define(mym4_version_micro, [1]) +m4_define([mym4_package],[gpgme]) +m4_define([mym4_major], [1]) +m4_define([mym4_minor], [12]) +m4_define([mym4_micro], [1]) -# Below is m4 magic to extract and compute the revision number, the -# decimalized short revision number, a beta version string, and a flag -# indicating a development version (mym4_isgit). Note that the m4 -# processing is done by autoconf and not during the configure run. -m4_define(mym4_version, - [mym4_version_major.mym4_version_minor.mym4_version_micro]) -m4_define([mym4_revision], - m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r'])) -m4_define([mym4_revision_dec], - m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))])) -m4_define([mym4_betastring], - m4_esyscmd_s([git describe --match 'gpgme-[0-9].*[0-9]' --long|\ - 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]) +# Below is m4 magic to extract and compute the git revision number, +# the decimalized short revision number, a beta version string and a +# flag indicating a development version (mym4_isbeta). Note that the +# m4 processing is done by autoconf and not during the configure run. +m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \ + mym4_package mym4_major mym4_minor mym4_micro),[:])) +m4_define([mym4_isbeta], m4_argn(2, mym4_verslist)) +m4_define([mym4_version], m4_argn(4, mym4_verslist)) +m4_define([mym4_revision], m4_argn(7, mym4_verslist)) +m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist)) +m4_esyscmd([echo ]mym4_version[>VERSION]) +AC_INIT([mym4_package],[mym4_version], [https://bugs.gnupg.org]) # LT Version numbers, remember to change them just *before* a release. # (Code changed: REVISION++) # (Interfaces added/removed/changed: CURRENT++, REVISION=0) # (Interfaces added: AGE++) -# (Interfaces removed/changed: AGE=0) +# (Interfaces removed: AGE=0) # LIBGPGME_LT_CURRENT=32 LIBGPGME_LT_AGE=21 @@ -68,6 +64,19 @@ LIBGPGMEPP_LT_REVISION=0 LIBQGPGME_LT_CURRENT=10 LIBQGPGME_LT_AGE=3 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. GPGME_CONFIG_API_VERSION=1 @@ -78,12 +87,9 @@ NEED_LIBASSUAN_API=2 NEED_LIBASSUAN_VERSION=2.4.2 -PACKAGE=$PACKAGE_NAME -VERSION=$PACKAGE_VERSION - -VERSION_MAJOR=mym4_version_major -VERSION_MINOR=mym4_version_minor -VERSION_MICRO=mym4_version_micro +VERSION_MAJOR=mym4_major +VERSION_MINOR=mym4_minor +VERSION_MICRO=mym4_micro AC_CONFIG_AUX_DIR([build-aux]) 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. 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_MINOR) 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_version_major \ - mym4_version_minor mym4_version_micro) + +VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_major \ + mym4_minor mym4_micro) AC_SUBST(VERSION_NUMBER) # 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]) 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 -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_ARG_ENABLE([build-timestamp],