X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=m4%2Fpandora_vc_build.m4;h=5e7ed652bfd553020cb0a444e8263f9f1392a723;hb=b95b86ccfcaf1491760cf84723c48be9f13df49b;hp=fa54986af4cdfcf0230ed3826610036662b52330;hpb=8da27d02e98f265f1c2c0a7ac905f8abf48100a5;p=m6w6%2Flibmemcached diff --git a/m4/pandora_vc_build.m4 b/m4/pandora_vc_build.m4 index fa54986a..5e7ed652 100644 --- a/m4/pandora_vc_build.m4 +++ b/m4/pandora_vc_build.m4 @@ -1,57 +1,142 @@ -dnl Copyright (C) 2009 Sun Microsystems -dnl This file is free software; Sun Microsystems +dnl Copyright (C) 2009 Sun Microsystems, Inc. +dnl This file is free software; Sun Microsystems, Inc. dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. -AC_DEFUN([PANDORA_BUILDING_FROM_VC],[ +AC_DEFUN([PANDORA_TEST_VC_DIR],[ + pandora_building_from_vc=no - ac_cv_building_from_vc=no + if test -d ".bzr" ; then + pandora_building_from_bzr=yes + pandora_building_from_vc=yes + else + pandora_building_from_bzr=no + fi - AS_IF([test -d "${srcdir}/.bzr"],[ - ac_cv_building_from_bzr=yes - ac_cv_building_from_vc=yes - ],[ - ac_cv_building_from_bzr=no - ]) + if test -d ".svn" ; then + pandora_building_from_svn=yes + pandora_building_from_vc=yes + else + pandora_building_from_svn=no + fi - AS_IF([test -d "${srcdir}/.svn"],[ - ac_cv_building_from_svn=yes - ac_cv_building_from_vc=yes - ],[ - ac_cv_building_from_svn=no - ]) + if test -d ".hg" ; then + pandora_building_from_hg=yes + pandora_building_from_vc=yes + else + pandora_building_from_hg=no + fi - AS_IF([test -d "${srcdir}/.hg"],[ - ac_cv_building_from_hg=yes - ac_cv_building_from_vc=yes - ],[ - ac_cv_building_from_hg=no - ]) + if test -d ".git" ; then + pandora_building_from_git=yes + pandora_building_from_vc=yes + else + pandora_building_from_git=no + fi +]) - AS_IF([test -d "${srcdir}/.git"],[ - ac_cv_building_from_git=yes - ac_cv_building_from_vc=yes - ],[ - ac_cv_building_from_git=no - ]) +AC_DEFUN([PANDORA_BUILDING_FROM_VC],[ + m4_syscmd(PANDORA_TEST_VC_DIR + m4_if(PCT_NO_VC_CHANGELOG,yes,[ + vc_changelog=no + ],[ + vc_changelog=yes + ]) + + [ + + PANDORA_RELEASE_DATE=`date +%Y.%m` + PANDORA_RELEASE_NODOTS_DATE=`date +%Y%m` + + # Set some defaults + PANDORA_VC_REVNO="0" + PANDORA_VC_REVID="unknown" + PANDORA_VC_BRANCH="bzr-export" + if test "${pandora_building_from_bzr}" = "yes"; then + echo "# Grabbing changelog and version information from bzr" + PANDORA_BZR_REVNO=`bzr revno` + if test "x$PANDORA_BZR_REVNO" != "x${PANDORA_VC_REVNO}" ; then + PANDORA_VC_REVNO="${PANDORA_BZR_REVNO}" + PANDORA_VC_REVID=`bzr log -r-1 --show-ids | grep revision-id | cut -f2 -d' ' | head -1` + PANDORA_VC_BRANCH=`bzr nick` + if test "x${vc_changelog}" = "xyes"; then + bzr log --gnu > ChangeLog + fi + fi + fi + if ! test -d config ; then + mkdir -p config + fi + + if test "${pandora_building_from_bzr}" = "yes" -o ! -f config/pandora_vc_revinfo ; then + cat > config/pandora_vc_revinfo.tmp </dev/null 2>&1 ; then + mv config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo + fi + rm -f config/pandora_vc_revinfo.tmp + fi + ]) ]) -dnl Takes one argument which is the prefix to append -AC_DEFUN([PANDORA_EXPORT_BZR_INFO],[ - m4_ifnblank($1,[ - m4_define([PEBI_PREFIX],m4_toupper(m4_normalize($1))[_]) +AC_DEFUN([_PANDORA_READ_FROM_FILE],[ + $1=`grep $1 $2 | cut -f2 -d=` +]) + +AC_DEFUN([PANDORA_VC_VERSION],[ + AC_REQUIRE([PANDORA_BUILDING_FROM_VC]) + + PANDORA_TEST_VC_DIR + + AS_IF([test -f ${srcdir}/config/pandora_vc_revinfo],[ + _PANDORA_READ_FROM_FILE([PANDORA_VC_REVNO],${srcdir}/config/pandora_vc_revinfo) + _PANDORA_READ_FROM_FILE([PANDORA_VC_REVID],${srcdir}/config/pandora_vc_revinfo) + _PANDORA_READ_FROM_FILE([PANDORA_VC_BRANCH], + ${srcdir}/config/pandora_vc_revinfo) + _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_DATE], + ${srcdir}/config/pandora_vc_revinfo) + _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_NODOTS_DATE], + ${srcdir}/config/pandora_vc_revinfo) + ]) + AS_IF([test "x${PANDORA_VC_BRANCH}" != x"${PACKAGE}"],[ + PANDORA_RELEASE_COMMENT="${PANDORA_VC_BRANCH}" ],[ - m4_define([PEBI_PREFIX],[]) + PANDORA_RELEASE_COMMENT="trunk" ]) + + PANDORA_RELEASE_VERSION="${PANDORA_RELEASE_DATE}.${PANDORA_VC_REVNO}" + PANDORA_RELEASE_ID="${PANDORA_RELEASE_NODOTS_DATE}${PANDORA_VC_REVNO}" - AC_DEFINE(PEBI_PREFIX[BZR_REVID], ["BZR_REVID"], [bzr revision ID]) - AC_DEFINE(PEBI_PREFIX[BZR_BRANCH], ["BZR_BRANCH"], [bzr branch name]) - AC_DEFINE(PEBI_PREFIX[RELEASE_DATE], ["RELEASE_DATE"], [Release date based on the date of the repo checkout]) - AC_DEFINE(PEBI_PREFIX[RELEASE_VERSION], ["RELEASE_VERSION"], [$1 version number formatted for display]) - AC_DEFINE(PEBI_PREFIX[RELEASE_COMMENT], ["RELEASE_COMMENT"], [Set to trunk if the branch is the main $1 branch]) - AC_DEFINE(PEBI_PREFIX[RELEASE_ID], [RELEASE_ID], [$1 version number formatted for numerical comparison]) - + VERSION="${PANDORA_RELEASE_VERSION}" + AC_DEFINE_UNQUOTED([PANDORA_RELEASE_VERSION],["${PANDORA_RELEASE_VERSION}"], + [The real version of the software]) + AC_SUBST(PANDORA_VC_REVNO) + AC_SUBST(PANDORA_VC_REVID) + AC_SUBST(PANDORA_VC_BRANCH) + AC_SUBST(PANDORA_RELEASE_DATE) + AC_SUBST(PANDORA_RELEASE_NODOTS_DATE) + AC_SUBST(PANDORA_RELEASE_COMMENT) + AC_SUBST(PANDORA_RELEASE_VERSION) + AC_SUBST(PANDORA_RELEASE_ID) ]) +AC_DEFUN([PANDORA_VC_INFO_HEADER],[ + AC_REQUIRE([PANDORA_VC_VERSION]) + m4_define([PANDORA_VC_PREFIX],m4_toupper(m4_normalize(AC_PACKAGE_NAME))[_]) + + AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_REVNO], [$PANDORA_VC_REVNO], [Version control revision number]) + AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_REVID], ["$PANDORA_VC_REVID"], [Version control revision ID]) + AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_BRANCH], ["$PANDORA_VC_BRANCH"], [Version control branch name]) + AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_DATE], ["$PANDORA_RELEASE_DATE"], [Release date of version control checkout]) + AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_NODOTS_DATE], [$PANDORA_RELEASE_NODOTS_DATE], [Numeric formatted release date of checkout]) + AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_COMMENT], ["$PANDORA_RELEASE_COMMENT"], [Set to trunk if the branch is the main $PACKAGE branch]) + AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_VERSION], ["$PANDORA_RELEASE_VERSION"], [Release date and revision number of checkout]) + AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_ID], [$PANDORA_RELEASE_ID], [Numeric formatted release date and revision number of checkout]) +])