summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: e636263d49f3b1c26e3bb86e6fd58c652d5fa182 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
DIST_SUBDIRS = pixman src test doc
SUBDIRS = pixman src doc

.PHONY: doc test
doc:
	-$(MAKE) -C doc doc
test: all
	-$(MAKE) -C test test
retest: all
	-$(MAKE) -C test retest
recheck: all
	-$(MAKE) -C test recheck

# libpng is required for our test programs
if CAIRO_HAS_PNG_FUNCTIONS
SUBDIRS += test
endif

EXTRA_DIST = \
	COPYING \
	COPYING-LGPL-2.1 \
	COPYING-MPL-1.1
DISTCLEANFILES = config.cache
MAINTAINERCLEANFILES = \
	$(srcdir)/aclocal.m4 \
	$(srcdir)/autoscan.log \
	$(srcdir)/compile \
	$(srcdir)/config.guess \
	$(srcdir)/config.h.in \
	$(srcdir)/config.sub \
	$(srcdir)/configure.scan \
	$(srcdir)/depcomp \
	$(srcdir)/install-sh \
	$(srcdir)/ltmain.sh \
	$(srcdir)/missing \
	$(srcdir)/mkinstalldirs \
	`find "$(srcdir)" -type f -name Makefile.in -print`

check-valgrind: all
	$(MAKE) -C test check-valgrind

DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc

# Creating ChangeLog files from git log:

# We always create a ChangeLog that contains the most recent changes, and
# multiple others for changes between major releases (other than the last such
# segment that we put in 'ChangeLog'.  The old ones are named
# ChangeLog.pre-X.Y where X.Y is the version number of the major release.

CURR_CHANGELOG_VERSION=$(CAIRO_VERSION_MAJOR).$$(echo "($(CAIRO_VERSION_MINOR)+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[.]\?$$/initial/;s/[.]$$/.0/')

CHANGELOGS = ChangeLog \
	`version=$(CURR_CHANGELOG_VERSION); \
	version=$(PREV_CHANGELOG_VERSION); \
	while test "x$$version" != xinitial; do \
		echo ChangeLog.pre-$$version; \
		version=$(PREV_CHANGELOG_VERSION); \
	done`

MAINTAINERCLEANFILES += $(srcdir)/ChangeLog $(srcdir)/ChangeLog.pre-*
DISTCLEANFILES += $(srcdir)/ChangeLog.cache-*

changelogs:
	@$(MAKE) $(CHANGELOGS)

dist-hook: changelogs
	changelogs="$(CHANGELOGS)"; \
	for changelog in $$changelogs; do \
		cp $(srcdir)/$$changelog $(distdir)/ 2>/dev/null || \
		cp $$changelog $(distdir)/; \
	done

ChangeLog%: $(srcdir)/ChangeLog%

$(srcdir)/ChangeLog $(srcdir)/ChangeLog.pre-%:
	@echo Creating $@
	@if test -d "$(srcdir)/.git"; then \
	  (cd "$(srcdir)" && \
	  version=$$(echo "$@" | sed 's/.*ChangeLog\([.].*-\)\?//'); \
	  to=$$version; \
	  test "x$$version" = x && version=$(CURR_CHANGELOG_VERSION); \
	  from=$(PREV_CHANGELOG_VERSION); \
	  test "x$$to" = x || version=$$version.0; \
	  test "x$$from" = xinitial || from=$$from.0; \
	  ./missing --run git-log --stat $$from..$$to) > $@.tmp \
	  && mv -f $@.tmp $@ \
	  || ($(RM) $@.tmp; \
	      echo Failed to generate $@, your $@ may be outdated >&2; \
	      (test -f $@ || echo git-log is required to generate this file >> $@)); \
	else \
	  test -f $@ || \
	  (echo A git checkout and git-log is required to generate $@ >&2 && \
	  echo A git checkout and git-log is required to generate this file >> $@); \
	fi

.PHONY: changelogs ChangeLog $(srcdir)/ChangeLog

# Some custom targets to make it easier to release things.
# Use either:
#		make release-check
# or		make release-publish

RELEASE_OR_SNAPSHOT = $$(if test "x$(CAIRO_VERSION_MINOR)" = "x$$(echo "$(CAIRO_VERSION_MINOR)/2*2" | bc)" ]; then echo release; else echo snapshot; fi)
RELEASE_UPLOAD_HOST =   cairographics.org
RELEASE_UPLOAD_BASE =	/srv/cairo.freedesktop.org/www
RELEASE_UPLOAD_DIR =	$(RELEASE_UPLOAD_BASE)/$(RELEASE_OR_SNAPSHOT)s
RELEASE_URL_BASE = 	http://cairographics.org/$(RELEASE_OR_SNAPSHOT)s
RELEASE_ANNOUNCE_LIST = cairo-announce@cairographics.org (and CC gnome-announce-list@gnome.org)

MANUAL_DATED =		cairo-manual-`date +%Y%m%d`
MANUAL_TAR_FILE = 	$(MANUAL_DATED).tar.gz
MANUAL_UPLOAD_DIR =	$(RELEASE_UPLOAD_BASE)

tar_file = $(PACKAGE)-$(VERSION).tar.gz
sha1_file = $(tar_file).sha1
gpg_file = $(sha1_file).asc

$(sha1_file): $(tar_file)
	sha1sum $^ > $@

$(gpg_file): $(sha1_file)
	@echo "Please enter your GPG password to sign the checksum."
	gpg --armor --sign $^ 

# Win32 package zipfiles
runtime_zip_file = /tmp/$(PACKAGE)-$(VERSION).zip
developer_zip_file = /tmp/$(PACKAGE)-dev-$(VERSION).zip

$(runtime_zip_file): install
	-$(RM) $@
	cd $(prefix); \
	zip $@ bin/libcairo-$(LT_CURRENT_MINUS_AGE).dll

$(developer_zip_file): install
	-$(RM) $@
	cd $(prefix); \
	zip -r $@ include/cairo lib/libcairo.dll.a lib/cairo.lib lib/pkgconfig/cairo.pc lib/pkgconfig/cairo-*.pc share/gtk-doc/html/cairo

zips: $(runtime_zip_file) $(developer_zip_file)

release-verify-soname-major:
	@echo -n "Checking that the cairo soname major number is 2..."
	@test "$(LT_CURRENT_MINUS_AGE)" = "2" \
		|| (echo "Ouch." && echo "The soname major number is $(LT_CURRENT_MINUS_AGE) instead of 2." \
		&& echo "The libtool shared library version numbers in configure.in must be incremented properly." \
		&& false)
	@echo "Good."

release-verify-even-micro:
	@echo -n "Checking that $(VERSION) has an even micro component..."
	@test "$(CAIRO_VERSION_MICRO)" = "`echo $(CAIRO_VERSION_MICRO)/2*2 | bc`" \
		|| (echo "Ouch." && echo "The version micro component '$(CAIRO_VERSION_MICRO)' is not an even number." \
		&& echo "The version in configure.in must be incremented before a new release." \
		&& false)
	@echo "Good."

release-verify-newer:
	@echo -n "Checking that no $(VERSION) release already exists..."
	@ssh $(RELEASE_UPLOAD_HOST) test ! -e $(RELEASE_UPLOAD_DIR)/$(tar_file) \
		|| (echo "Ouch." && echo "Found: $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR)/$(tar_file)" \
		&& echo "Are you sure you have an updated checkout?" \
		&& echo "This should never happen." \
		&& false)
	@echo "Good."

release-remove-old:
	$(RM) $(tar_file) $(sha1_file) $(gpg_file)

# Maybe it's just my system, but somehow group sticky bits keep
# getting set and this causes failures in un-tarring on some systems.
# Until I figure out where the sticky bit is coming from, just clean
# these up before building a release.
release-cleanup-group-sticky:
	find . -type f | xargs chmod g-s

release-check: release-verify-soname-major release-verify-even-micro release-verify-newer release-remove-old release-cleanup-group-sticky distcheck

release-upload: release-check $(tar_file) $(sha1_file) $(gpg_file)
	mkdir -p releases
	scp $(tar_file) $(sha1_file) $(gpg_file) $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR)
	mv $(tar_file) $(sha1_file) $(gpg_file) releases
	ssh $(RELEASE_UPLOAD_HOST) "rm -f $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-[0-9]* && ln -s $(tar_file) $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-$(VERSION)"
	git tag -s $(CAIRO_VERSION_MAJOR).$(CAIRO_VERSION_MINOR).$(CAIRO_VERSION_MICRO)

release-publish-message: releases/$(sha1_file)
	@echo "Pleas push the new tag with a command such as:"
	@echo ""
	@echo "	git push master $(VERSION)"
	@echo ""
	@echo "Please send an announcement to $(RELEASE_ANNOUNCE_LIST)"
	@echo "including the following:"
	@echo ""
	@echo "Subject: $(PACKAGE) $(RELEASE_OR_SNAPSHOT) $(VERSION) now available"
	@echo ""
	@echo "============================== CUT HERE =============================="
	@echo "A new $(PACKAGE) $(RELEASE_OR_SNAPSHOT) $(VERSION) is now available from:"
	@echo ""
	@echo "	$(RELEASE_URL_BASE)/$(tar_file)"
	@echo ""
	@echo "    which can be verified with:"
	@echo ""
	@echo "	$(RELEASE_URL_BASE)/$(sha1_file)"
	@echo -n "	"
	@cat releases/$(sha1_file)
	@echo ""
	@echo "	$(RELEASE_URL_BASE)/$(gpg_file)"
	@echo "	(signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)"
	@echo "  Additionally, a git clone of the source tree:"
	@echo ""
	@echo "	git clone git://git.cairographics.org/git/cairo"
	@echo ""
	@echo "    will include a signed $(VERSION) tag which points to a commit named:"
	@echo "	`git cat-file tag $(VERSION) | grep ^object | sed -e 's,object ,,'`"
	@echo ""
	@echo "    which can be verified with:"
	@echo "	git verify-tag $(VERSION)"
	@echo ""
	@echo "    and can be checked out with a command such as:"
	@echo "	git checkout -b build $(VERSION)"
	@echo ""
	@echo "============================== CUT HERE =============================="
	@echo "Also, please add the new entries from the NEWS file as well as the detailed"
	@echo "change log sent to the cairo-announce list when the tag is pushed."
	@echo ""
	@echo "The same NEWS entries should be posted on the cairographics.org wiki as well."
	@echo ""
	@echo "Last but not least, do not forget to bump up the micro"
	@echo "version component to the next (odd) number and commit."

release-publish: release-upload release-publish-message

# XXX: Depending on all here is rather overkill. We don't really need
# the library built in order to create the documentation.
docs-publish: all
	cp -a doc/public/html $(MANUAL_DATED)
	tar czf $(MANUAL_TAR_FILE) $(MANUAL_DATED)
	scp $(MANUAL_TAR_FILE) $(RELEASE_UPLOAD_HOST):$(MANUAL_UPLOAD_DIR)
	ssh $(RELEASE_UPLOAD_HOST) "cd $(MANUAL_UPLOAD_DIR) && tar xzf $(MANUAL_TAR_FILE) && rm -f manual && ln -s $(MANUAL_DATED) manual && ln -sf $(MANUAL_TAR_FILE) cairo-manual.tar.gz"

.PHONY: release-verify-even-micro release-verify-newer release-remove-old release-cleanup-group-sticky release-check release-upload release-publish docs-publish test retest recheck