source: trunk/m4/yat_svn_release.m4 @ 1350

Last change on this file since 1350 was 1350, checked in by Peter Johansson, 10 years ago

update macros from yat

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