build: Add release make target
[libgcrypt.git] / Makefile.am
1 ## Process this file with automake to produce Makefile.in
2 # Copyright (C) 1992, 1999, 2000, 2002 Free Software Foundation, Inc.
3 #
4 # This file is part of Libgcrypt.
5 #
6 # Libgcrypt is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU Lesser General Public License as
8 # published by the Free Software Foundation; either version 2.1 of
9 # the License, or (at your option) any later version.
10 #
11 # Libgcrypt is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this program; if not, see <http://www.gnu.org/licenses/>.
18 # SPDX-License-Identifier: LGPL-2.1-or-later
19
20 # Location of the released tarball archives.  Note that this is an
21 # internal archive and before uploading this to the public server,
22 # manual tests should be run and the git release tagged and pushed.
23 # Adjust as needed.
24 RELEASE_ARCHIVE_DIR  = wk@vigenere:tarballs/libgpg-error/
25 # The key used to sign the released sources.  Adjust as needed.
26 RELEASE_SIGNING_KEY  = D8692123C4065DEA5E0F3AB5249B39D24F25E3B6
27
28
29 ACLOCAL_AMFLAGS = -I m4
30 DISTCHECK_CONFIGURE_FLAGS = --disable-random-daemon --enable-doc \
31                             --enable-random=auto
32
33 # (A suitable gitlog-to-changelog script can be found in GnuPG master.)
34 GITLOG_TO_CHANGELOG=gitlog-to-changelog
35
36 if BUILD_DOC
37 doc = doc
38 else
39 doc =
40 endif
41
42
43 DIST_SUBDIRS = m4 compat mpi cipher random src doc tests
44 SUBDIRS =         compat mpi cipher random src $(doc) tests
45
46 EXTRA_DIST = autogen.sh autogen.rc README.GIT LICENSES                     \
47              ChangeLog-2011 build-aux/ChangeLog-2011 doc/ChangeLog-2011    \
48              m4/ChangeLog-2011 cipher/ChangeLog-2011 src/ChangeLog-2011    \
49              random/ChangeLog-2011 tests/ChangeLog-2011 mpi/ChangeLog-2011 \
50              build-aux/git-log-footer build-aux/git-log-fix VERSION
51
52 DISTCLEANFILES =
53
54
55 # Add all the files listed in "distfiles" files to the distribution
56 dist-hook: gen-ChangeLog
57         @set -e; \
58          for file in `cd $(top_srcdir); \
59               find mpi -type f -name distfiles`; do \
60             dir=`dirname $$file` ; $(mkinstalldirs) $(distdir)/$$dir ; \
61             for i in distfiles `cat $(top_srcdir)/$$file` ; do \
62                 ln $(top_srcdir)/$$dir/$$i $(distdir)/$$dir/$$i 2> /dev/null \
63                 || cp -p $(top_srcdir)/$$dir/$$i $(distdir)/$$dir/$$i; \
64             done ; \
65         done
66
67 distcheck-hook:
68         set -e; ( \
69         pref="#+macro: $$(echo $(PACKAGE_NAME)|tr '-' '_')_" ;\
70         reldate="$$(date -u +%Y-%m-%d)" ;\
71         echo "$${pref}ver  $(PACKAGE_VERSION)"  ;\
72         echo "$${pref}date $${reldate}" ;\
73         list='$(DIST_ARCHIVES)'; for i in $$list; do \
74           case "$$i" in *.tar.bz2) \
75             echo "$${pref}size $$(wc -c <$$i|awk '{print int($$1/1024)}')k" ;\
76             echo "$${pref}sha1 $$(sha1sum <$$i|cut -d' ' -f1)" ;\
77             echo "$${pref}sha2 $$(sha256sum <$$i|cut -d' ' -f1)" ;;\
78           esac;\
79         done ) | tee $(distdir).swdb
80
81
82
83 gen_start_date = 2011-12-01T14:00:00
84 .PHONY: gen-ChangeLog
85 gen-ChangeLog:
86         if test -e $(top_srcdir)/.git; then                             \
87           (cd $(top_srcdir) &&                                          \
88             $(GITLOG_TO_CHANGELOG) --append-dot --tear-off              \
89             --amend=build-aux/git-log-fix                               \
90             --since=$(gen_start_date) ) > $(distdir)/cl-t;              \
91           cat $(top_srcdir)/build-aux/git-log-footer >> $(distdir)/cl-t;\
92           rm -f $(distdir)/ChangeLog;                                   \
93           mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
94         fi
95
96
97
98 stowinstall:
99         $(MAKE) $(AM_MAKEFLAGS) install prefix=/usr/local/stow/libgcrypt
100
101 # Macro to help the release target.
102 RELEASE_NAME = $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
103
104 release:
105         +(set -e;\
106          if [ "$(abs_top_builddir)" = "$(abs_top_srcdir)" ]; then \
107            echo "error: build directory must not be the source directory" >&2;\
108            exit 2;\
109          fi ;\
110          echo "/* Build started at $$(date -uIseconds) */" ;\
111          cd $(top_srcdir); \
112          ./autogen.sh --force; \
113          cd $(abs_top_builddir); \
114          rm -rf dist; mkdir dist ; cd dist ; \
115          $(abs_top_srcdir)/configure --enable-maintainer-mode; \
116          $(MAKE) distcheck; \
117          echo "/* Build finished at $$(date -uIseconds) */" ;\
118          echo "/*" ;\
119          echo " * Please run the final step interactivly:" ;\
120          echo " *   make sign-release" ;\
121          echo " */" ;\
122         ) 2>&1 | tee "$(RELEASE_NAME).buildlog"
123
124 sign-release:
125          +(set -e; \
126           cd dist; \
127           files1="$(RELEASE_NAME).tar.bz2 \
128                   $(RELEASE_NAME).tar.gz" ; \
129           files2="$(RELEASE_NAME).tar.bz2.sig \
130                   $(RELEASE_NAME).tar.gz.sig  \
131                   $(RELEASE_NAME).swdb \
132                   $(RELEASE_NAME).buildlog" ;\
133           echo "/* Signing the source tarball ..." ;\
134           gpg -sbu $(RELEASE_SIGNING_KEY) $(RELEASE_NAME).tar.bz2 ;\
135           gpg -sbu $(RELEASE_SIGNING_KEY) $(RELEASE_NAME).tar.gz  ;\
136           cat $(RELEASE_NAME).swdb >swdb.snippet;\
137           echo >>swdb.snippet ;\
138           sha1sum $${files1} >>swdb.snippet ;\
139           cat "../$(RELEASE_NAME).buildlog" swdb.snippet \
140                | gzip >$(RELEASE_NAME).buildlog ;\
141           echo "Copying to local archive ..." ;\
142           scp -p $${files1} $${files2} $(RELEASE_ARCHIVE_DIR)/ || true;\
143           echo '/*' ;\
144           echo ' * All done; for checksums see dist/swdb.snippet' ;\
145           echo ' */' ;\
146          )