source: trunk/m4/yat_svn_release.m4 @ 2301

Last change on this file since 2301 was 2301, checked in by Peter, 12 years ago

allow hook in make release that is called after tarball (and md5 file) is created

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Date
File size: 3.4 KB
Line 
1## $Id: yat_svn_release.m4 2301 2010-07-24 01:12:27Z peter $
2
3# serial 3 (yat 0.7)
4
5# SYNOPSIS
6#
7#   YAT_SVN_RELEASE
8#
9# DESCRIPTION
10#
11#   Creates a few make rules useful for maintainer. You need to add
12#
13#     include $(srcdir)/maintainer.am
14#
15#   to your top Makefile.am.
16#
17# COPYLEFT
18m4_define([yat_svn_release_copyright], [
19#
20#   Copyright (C) 2009, 2010 Peter Johansson
21#
22#   This file is part of the yat library, http://dev.thep.lu.se/yat
23#
24#   The yat library is free software; you can redistribute it and/or
25#   modify it under the terms of the GNU General Public License as
26#   published by the Free Software Foundation; either version 3 of the
27#   License, or (at your option) any later version.
28#
29#   The yat library is distributed in the hope that it will be useful,
30#   but WITHOUT ANY WARRANTY; without even the implied warranty of
31#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
32#   General Public License for more details.
33#
34#   You should have received a copy of the GNU General Public License
35#   along with yat. If not, see <http://www.gnu.org/licenses/>.
36#
37])
38
39AC_DEFUN([YAT_SVN_RELEASE],
40[
41  AC_REQUIRE([AC_PROG_SED])       
42  AC_REQUIRE([AC_PROG_EGREP])       
43  AC_CHECK_PROGS([MD5], [md5sum gmd5sum md5 md5deep], [no])
44  m4_pushdef([YAT_OUTPUTFILE], [m4_default([$1], [maintainer.am])])
45
46  AX_AC_PRINT_TO_FILE(YAT_OUTPUTFILE,
47[#  ]YAT_OUTPUTFILE[ generated by autoconf from $0
48]yat_svn_release_copyright[
49.PHONY: check-svn-diff check-news check-news-date check-version \\
50        check-release-tools maintainer-check release
51
52# stub rule to work around bug in Automake
53\$(srcdir)/]YAT_OUTPUTFILE[:
54
55check-svn-diff:
56  @str=\`svn diff -rHEAD \$(srcdir)\`; \\
57  if test -n \"\$\$str\"; then \\
58    echo \"\$\$str\" 1>&2;\\
59    exit 1;\\
60  fi
61
62check-news:
63  @case \`sed 15q \$(srcdir)/NEWS\` in \\
64  *\"\$(VERSION)\"*);; \\
65  *) \\
66    echo \"NEWS not updated\" 1>&2; \\
67    exit 1;; \\
68  esac
69
70check-news-date:
71  @today=\`date -u \"+%%e %%B %%Y\"\`; \\
72  case \`sed 15q \$(srcdir)/NEWS\` in \\
73  *\"\$\$today\"*);; \\
74  *) \\
75    echo \"NEWS: release date incorrect; expected '\$\$today'\" 1>&2;\\
76    exit 1;; \\
77  esac
78
79check-version:
80  @echo \$(VERSION) | \$(EGREP) '^[0-9]+(\\.[0-9]+)+\$\$' > /dev/null || \\
81  { echo \"invalid version string: \$(VERSION)\" 1>&2; exit 1; }
82
83check-release-tools:
84  @test \"x\$(MD5)\" != \"xno\" || \\
85  (echo \"no tool to calculate MD5 checksum available\" 1>&2 && exit 1)
86
87mc_exportdir=_exported
88
89maintainer-check:
90  rm -rf \$(mc_exportdir)
91  svn export \$(srcdir) \$(mc_exportdir)
92  mkdir \$(mc_exportdir)/_build
93  @cd \$(mc_exportdir) \\
94  && echo \"./bootstrap\" \\
95  && ./bootstrap \\
96  && cd _build \\
97  && ../configure --srcdir=.. \$(DISTCHECK_CONFIGURE_FLAGS) \\
98  && ( test -z \"\$(MAINTAINER_CHECK_LOCAL)\" || \\
99        \$(MAKE) \$(AM_MAKEFLAGS) \$(MAINTAINER_CHECK_LOCAL) ) \\
100  && \$(MAKE) \$(AM_MAKEFLAGS) dist \\
101  && rm -rf \$(mc_exportdir)
102
103release:
104  \$(MAKE) \$(AM_MAKEFLAGS) check-release-tools
105  @test -z \"\$(RELEASE_LOCAL)\" || \$(MAKE) \$(AM_MAKEFLAGS) \$(RELEASE_LOCAL)
106  \$(MAKE) \$(AM_MAKEFLAGS) check-version
107  \$(MAKE) \$(AM_MAKEFLAGS) check-news
108  \$(MAKE) \$(AM_MAKEFLAGS) check-news-date
109  \$(MAKE) \$(AM_MAKEFLAGS) check-svn-diff
110  \$(MAKE) \$(AM_MAKEFLAGS) maintainer-check
111  \$(MAKE) \$(AM_MAKEFLAGS) distcheck
112  @for a in \$(DIST_ARCHIVES); do \\
113    \$(MD5) \$\$a > \$\$a.MD5; \\
114  done;
115  @test -z \"\$(RELEASE_HOOK)\" || \$(MAKE) \$(AM_MAKEFLAGS) \$(RELEASE_HOOK)
116])
117  m4_popdef([YAT_OUTPUTFILE])
118
119]) # YAT_SVN_RELEASE
120
Note: See TracBrowser for help on using the repository browser.