build: Generate per-cycle ChangeLog files

We should generate a ChangeLog for each minor version cycle, starting
from the Git import date (since before that we used ChangeLog-style
commit messages that don't really look good with the Git ones).

For this reason we can take Cairo's Makefile.am.changelog file and,
after tweaking it to fit our use case, let it generate the correct
ChangeLogs on dist.
This commit is contained in:
Emmanuele Bassi 2009-11-18 14:21:08 +00:00
parent 18e9d0db6f
commit d11343532d
4 changed files with 82 additions and 25 deletions

View File

@ -1,5 +0,0 @@
2008-12-08 Emmanuele Bassi <ebassi@linux.intel.com>
* *: Clutter moved from Subversion to Git. If you are reading
this then you should use `git log` to read the changes from
the commit messages.

View File

@ -1,5 +1,4 @@
include $(top_srcdir)/build/autotools/Makefile.am.silent
include $(top_srcdir)/build/autotools/Makefile.am.changelog
NULL =
@ -61,3 +60,5 @@ MAINTAINERCLEANFILES = \
Makefile.in \
missing \
$(NULL)
include $(top_srcdir)/build/autotools/Makefile.am.changelog

View File

@ -1,19 +1,78 @@
PREV_RELEASE=git-import
# Taken from Cairo - build/Makefile.am.changelog
# Modified to fit the Clutter build environment
changelog:
@if test -d "$(srcdir)/.git"; \
then \
to=""; \
from="$(PREV_RELEASE)"; \
echo Creating ChangeLog && \
( cd "$(top_srcdir)" && \
echo '# Generated by configure. Do no edit.'; echo; \
$(top_srcdir)/missing --run perl $(top_srcdir)/build/gen-changelog.pl $$from..$$to ) > ChangeLog.tmp \
&& mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
|| ( rm -f ChangeLog.tmp ; \
echo Failed to generate ChangeLog >&2 ); \
CURR_CHANGELOG_VERSION=$(CLUTTER_MAJOR_VERSION).$$(echo "($(CLUTTER_MINOR_VERSION)+1)/2*2" | bc)
# examines $version
PREV_CHANGELOG_VERSION=$$(if test "x$$(echo "($$version-0.1)*2/2"|bc)" = "x$$(echo "$$version*2/2"|bc)"; \
then echo "$$version-$$(echo "$$version" | sed 's/[0-9]/0/g;s/[0-9]$$/2/')"; \
else echo "$$version-1.0"; \
fi | bc | sed 's/[.]0*/./;s/^0[.]\?$$/git-import/;s/[.]$$/.0/')
CHANGELOGS = ChangeLog \
`version=$(CURR_CHANGELOG_VERSION); \
version=$(PREV_CHANGELOG_VERSION); \
while test "x$$version" != xgit-import; do \
echo ChangeLog.pre-$$version; \
version=$(PREV_CHANGELOG_VERSION); \
done`
MAINTAINERCLEANFILES += $(srcdir)/ChangeLog $(srcdir)/ChangeLog.pre-*
CLEANFILES += $(srcdir)/ChangeLog.cache-*
changelogs:
@$(MAKE) $(AM_MAKEFLAGS) $(CHANGELOGS)
dist-hook: changelogs
changelogs="$(CHANGELOGS)"; \
for changelog in $$changelogs; do \
cp $(srcdir)/$$changelog $(distdir)/ 2>/dev/null || \
cp $$changelog $(distdir)/; \
done
$(srcdir)/ChangeLog:
@if test -d "$(srcdir)/.git"; then \
version=$(CURR_CHANGELOG_VERSION); \
prev=$(PREV_CHANGELOG_VERSION).0; \
nearest_tag=`git describe | sed 's/-.*//'`; \
before=$(srcdir)/ChangeLog.cache-$$prev..$$nearest_tag; \
after=$(srcdir)/ChangeLog.cache-$$nearest_tag..; \
$(MAKE) $(AM_MAKEFLAGS) $$before $$after && \
echo Creating $@ && \
{ echo '# Generated by configure. Do not edit.'; echo; \
cat $$after; echo; cat $$before; } > $@; \
else \
echo A git checkout is required to generate a ChangeLog >&2; \
test -f $@ || \
(echo A git checkout is required to generate $@ >&2 && \
echo A git checkout is required to generate this file >> $@); \
fi
dist-hook: changelog
DISTCLEANFILES += ChangeLog.cache-*
ChangeLog.cache-*..: .git
ChangeLog%: $(srcdir)/ChangeLog%
$(srcdir)/ChangeLog.cache-% $(srcdir)/ChangeLog.pre-%:
@echo Creating $@
@if test -d "$(srcdir)/.git"; then \
(cd "$(srcdir)" && \
version=$$(echo "$@" | sed 's/.*ChangeLog\([.].*-\)\?//'); \
if echo "$@" | grep -q '^ChangeLog[.]cache'; then \
spec=$$version; \
else \
to=$$version; \
test "x$$version" = x && version=$(CURR_CHANGELOG_VERSION); \
from=$(PREV_CHANGELOG_VERSION); \
test "x$$to" = x || to=$$to.0; \
test "x$$from" = xgit-import || from=$$from.0; \
spec=$$from..$$to; \
fi; \
$(top_srcdir)/build/missing --run git log --stat "$$spec") > $@.tmp \
&& mv -f $@.tmp $@ \
|| ($(RM) $@.tmp; \
echo Failed to generate $@, your $@ may be outdated >&2); \
else \
echo A git checkout is required to generate $@ >&2; \
fi
.PHONY: changelogs ChangeLog $(srcdir)/ChangeLog

View File

@ -50,11 +50,13 @@ AC_PREREQ([2.59])
AC_INIT([clutter],
[clutter_version],
[http://bugzilla.o-hand.com/enter_bug.cgi?product=Clutter])
AC_CONFIG_MACRO_DIR([build/autotools])
AC_CONFIG_SRCDIR([clutter/clutter.h])
AM_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([1.9])
AC_CONFIG_SRCDIR([clutter/clutter.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([build/autotools])
AM_INIT_AUTOMAKE([1.9.6 foreign])
CLUTTER_MAJOR_VERSION=clutter_major_version
CLUTTER_MINOR_VERSION=clutter_minor_version