]> git.cworth.org Git - fips/blob - Makefile.release
Add explicit link to libpthread, to work around debugging issues
[fips] / Makefile.release
1 # Here's the (hopefully simple) versioning scheme.
2 #
3 # Releases of fips have a two-digit version (0.1, 0.2, etc.). We
4 # increment the second digit for each release and increment the first
5 # digit when we reach particularly major milestones of usability.
6 #
7 # Between releases, (such as when compiling fips from the git
8 # repository), we let git append identification of the actual commit.
9 PACKAGE=fips
10
11 IS_GIT=$(shell if [ -d .git ] ; then echo yes ; else echo no; fi)
12
13 ifeq ($(IS_GIT),yes)
14 DATE:=$(shell git log --date=short -1 --pretty=format:%cd)
15 else
16 DATE:=$(shell date +%F)
17 endif
18
19 VERSION:=$(shell cat ${srcdir}/version)
20 ifeq ($(filter release release-message pre-release, $(MAKECMDGOALS)),)
21 ifeq ($(IS_GIT),yes)
22 VERSION:=$(shell git describe --match '[0-9.]*' 2>/dev/null | sed -e s/_/~/ -e s/-/+/ -e s/-/~/)
23 endif
24 endif
25
26 UPSTREAM_TAG=$(subst ~,_,$(VERSION))
27 DEB_TAG=debian/$(UPSTREAM_TAG)-1
28
29 RELEASE_HOST=cworth.org
30 RELEASE_DIR=/home/cworth/public_html/fips/releases
31 RELEASE_URL=http://cworth.org/fips/releases
32 TAR_FILE=$(PACKAGE)-$(VERSION).tar.gz
33 DEB_TAR_FILE=$(PACKAGE)_$(VERSION).orig.tar.gz
34 SHA1_FILE=$(TAR_FILE).sha1
35 GPG_FILE=$(SHA1_FILE).asc
36
37 $(TAR_FILE):
38         if git tag -v $(VERSION) >/dev/null 2>&1; then \
39            ref=$(VERSION); \
40         else \
41            ref="HEAD" ; \
42            echo "Warning: No signed tag for $(VERSION)"; \
43         fi ; \
44         git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ $$ref > $(TAR_FILE).tmp
45         echo $(VERSION) > version.tmp
46         tar --append -f $(TAR_FILE).tmp --transform s_^_$(PACKAGE)-$(VERSION)/_  --transform 's_.tmp$$__' version.tmp
47         rm version.tmp
48         gzip < $(TAR_FILE).tmp > $(TAR_FILE)
49         @echo "Source is ready for release in $(TAR_FILE)"
50
51 $(SHA1_FILE): $(TAR_FILE)
52         sha1sum $^ > $@
53
54 $(GPG_FILE): $(SHA1_FILE)
55         @echo "Please enter your GPG password to sign the checksum."
56         gpg --armor --sign $^ 
57
58 .PHONY: dist
59 dist: $(TAR_FILE)
60
61 # We invoke make recursively only to force ordering of our phony
62 # targets in the case of parallel invocation of make (-j).
63 #
64 # We carefully ensure that our VERSION variable is passed down to any
65 # sub-ordinate make invocations (which won't otherwise know that they
66 # are part of the release and need to take the version from the
67 # version file).
68 .PHONY: release
69 release: verify-source-tree-and-version
70         $(MAKE) VERSION=$(VERSION) verify-newer
71         $(MAKE) VERSION=$(VERSION) clean
72         $(MAKE) VERSION=$(VERSION) test
73         git tag -s -m "$(PACKAGE) $(VERSION) release" $(UPSTREAM_TAG)
74         $(MAKE) VERSION=$(VERSION) $(GPG_FILE)
75         ln -sf $(TAR_FILE) $(DEB_TAR_FILE)
76         pristine-tar commit $(DEB_TAR_FILE) $(UPSTREAM_TAG)
77         git tag -s -m "$(PACKAGE) Debian $(VERSION)-1 upload (same as $(VERSION))" $(DEB_TAG)
78         mkdir -p releases
79         mv $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) releases
80         $(MAKE) VERSION=$(VERSION) release-message > $(PACKAGE)-$(VERSION).announce
81 ifeq ($(REALLY_UPLOAD),yes)
82         git push origin $(VERSION)
83         cd releases && scp $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) $(RELEASE_HOST):$(RELEASE_DIR)
84         ssh $(RELEASE_HOST) "rm -f $(RELEASE_DIR)/LATEST-$(PACKAGE)-* ; ln -s $(TAR_FILE) $(RELEASE_DIR)/LATEST-$(TAR_FILE)"
85 endif
86         @echo "Please send a release announcement using $(PACKAGE)-$(VERSION).announce as a template."
87
88 .PHONY: pre-release
89 pre-release:
90         $(MAKE) VERSION=$(VERSION) clean
91         $(MAKE) VERSION=$(VERSION) test
92         git tag -s -m "$(PACKAGE) $(VERSION) release" $(UPSTREAM_TAG)
93         git tag -s -m "$(PACKAGE) Debian $(VERSION)-1 upload (same as $(VERSION))" $(DEB_TAG)
94         $(MAKE) VERSION=$(VERSION) $(TAR_FILE)
95         ln -sf $(TAR_FILE) $(DEB_TAR_FILE)
96         pristine-tar commit $(DEB_TAR_FILE) $(UPSTREAM_TAG)
97         mkdir -p releases
98         mv $(TAR_FILE) $(DEB_TAR_FILE) releases
99
100 .PHONY: debian-snapshot
101 debian-snapshot:
102         make VERSION=$(VERSION) clean
103         TMPFILE=$$(mktemp /tmp/fips.XXXXXX);            \
104           cp debian/changelog $${TMPFILE};              \
105           EDITOR=/bin/true dch -b -v $(VERSION)+1       \
106             -D UNRELEASED 'test build, not for upload'; \
107           echo '3.0 (native)' > debian/source/format;   \
108           debuild -us -uc;                              \
109           mv -f $${TMPFILE} debian/changelog;           \
110           echo '3.0 (quilt)' > debian/source/format
111
112 .PHONY: release-message
113 release-message:
114         @echo "To: XXX"
115         @echo "Subject: $(PACKAGE) release $(VERSION) now available"
116         @echo ""
117         @echo "Where to obtain fips $(VERSION)"
118         @echo "==========================="
119         @echo "  $(RELEASE_URL)/$(TAR_FILE)"
120         @echo ""
121         @echo "Which can be verified with:"
122         @echo ""
123         @echo "  $(RELEASE_URL)/$(SHA1_FILE)"
124         @echo -n "  "
125         @cat releases/$(SHA1_FILE)
126         @echo ""
127         @echo "  $(RELEASE_URL)/$(GPG_FILE)"
128         @echo "  (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)"
129         @echo ""
130         @echo "What's new in fips $(VERSION)"
131         @echo "========================="
132         @sed -ne '/^[Ff]ips $(VERSION)/{n;n;b NEWS}; d; :NEWS /^===/q; {p;n;b NEWS}' < NEWS | head -n -2
133         @echo ""
134         @echo "What is fips"
135         @echo "============"
136         @echo "Fips is a program for monitoring performance of OpenGL applications"
137
138 # This is a chain of dependencies rather than a simple list simply to
139 # avoid the messages getting interleaved in the case of a parallel
140 # make invocation.
141 .PHONY: verify-source-tree-and-version
142 verify-source-tree-and-version: verify-no-dirty-code
143
144 .PHONY: verify-no-dirty-code
145 verify-no-dirty-code:
146 ifeq ($(IS_GIT),yes)
147         @printf "Checking that source tree is clean..."
148 ifneq ($(shell git ls-files -m),)
149         @echo "No"
150         @echo "The following files have been modified since the most recent git commit:"
151         @echo ""
152         @git ls-files -m
153         @echo ""
154         @echo "The release will be made from the committed state, but perhaps you meant"
155         @echo "to commit this code first? Please clean this up to make it more clear."
156         @false
157 else
158         @echo "Good"
159 endif
160 endif
161
162 .PHONY: verify-newer
163 verify-newer:
164         @echo -n "Checking that no $(VERSION) release already exists..."
165         @wget -q -O /dev/null $(RELEASE_URL)/$(TAR_FILE) ; \
166         case $$? in \
167           8) echo "Good." ;; \
168           0) echo "Ouch."; \
169              echo "Found: $(RELEASE_URL)/$(TAR_FILE)"; \
170              echo "Refusing to replace an existing release."; \
171              echo "Don't forget to update \"version\" as described in RELEASING before release." ; \
172              false ;; \
173           *) echo "An unexpected error occured"; \
174              false;; esac