]>
Commit | Line | Data |
---|---|---|
0ecb606c JJ |
1 | # Makefile for maintaining glibc fedora-branch and creating Fedora source RPMs. |
2 | ||
3 | glibc.spec: # The default target. | |
4 | ||
5 | tag-prefix := fedora- | |
6 | ||
7 | .PHONY: update commit-merge tag archive finish_archive srpm rpm | |
8 | ||
9 | snapshot-date-fmt := +'%Y-%m-%d %H:%M %Z' | |
10 | snapshot-name-fmt := +'%Y%m%dT%H%M' | |
11 | ||
12 | include branch.mk | |
13 | ||
14 | ||
15 | on-branch = $(filter-out HEAD,$(glibc-base)) | |
16 | ||
17 | snapshot-date := $($(glibc-branch)-sync-date) | |
18 | snapshot-name := $(shell date -u -d '$(snapshot-date)' $(snapshot-name-fmt)) | |
19 | ||
20 | tag-name := glibc$(patsubst glibc-%-branch,-%,\ | |
21 | $(filter-out HEAD,$(glibc-base))) | |
22 | tar-name := $(subst _,.,$(tag-name)) | |
23 | select-snapshot = -r '$($(glibc-branch)-sync-tag)' | |
24 | snapshot-id = $($(glibc-branch)-sync-tag) | |
25 | ||
26 | branch-name := $(patsubst %-$(patsubst glibc-%,%,$(tag-name)),%,\ | |
27 | $(glibc-branch)) | |
28 | ||
29 | branch.mk-vars = glibc-branch glibc-base DIST_BRANCH COLLECTION \ | |
30 | releases-url | |
31 | ||
32 | ifeq (,$(upstream-tag)) | |
33 | ifneq (,$(upstream)) | |
34 | upstream-tag := glibc-$(subst .,_,$(upstream)) | |
35 | endif | |
36 | endif | |
37 | ||
38 | update: | |
39 | now=`date -u $(snapshot-date-fmt)`; \ | |
40 | $(if $(upstream-tag),new='$(upstream-tag)';,\ | |
41 | name=`date -u -d "$$now" $(snapshot-name-fmt)`; \ | |
42 | new="$(tag-prefix)$(tag-name)-$$name"; \ | |
43 | cvs -Q rtag $(if $(on-branch),-r $(glibc-base),-D "$$now") $$new libc;\ | |
44 | )\ | |
45 | (echo '# This file is updated automatically by Makefile.'; \ | |
46 | $(foreach var,$(branch.mk-vars) $(if $(upstream-tag),upstream),\ | |
47 | $(if $($(var)),echo '$(var) := $($(var))';)) \ | |
48 | echo "$(glibc-branch)-sync-date := $$now"; \ | |
49 | echo "$(glibc-branch)-sync-tag := $$new"; \ | |
50 | ) > branch.mk; \ | |
51 | cd ..; (set -x; cvs -q update -d -P \ | |
52 | -j'$($(glibc-branch)-sync-tag)' -j"$$new") \ | |
53 | 2>&1 | tee fedora/update.log | |
54 | ||
55 | .PHONY: snapshot-time | |
56 | snapshot-time: branch.mk | |
57 | date -d '$(snapshot-date)' | |
58 | ||
59 | commit-merge: | |
60 | cd ..; cvs -Q commit -m"Updated to $(snapshot-id)" | |
61 | ||
62 | glibc.spec: glibc.spec.in ../version.h branch.mk | |
63 | (echo '%define glibcdate $(snapshot-name)'; \ | |
64 | echo '%define glibcname $(tar-name)'; \ | |
65 | echo '%define glibcsrcdir $(srcdir-name)'; \ | |
66 | echo '%define glibc_release_tarballs $(if $(upstream),1,0)'; \ | |
67 | sed -n '/VERSION/s/^.*"\([^"]*\)"$$/%define glibcversion \1/p' \ | |
68 | ../version.h; \ | |
69 | cat $<) > $@.new | |
70 | mv -f $@.new $@ | |
71 | ||
72 | ifeq (,$(wildcard glibc.spec)) | |
73 | Makefile: glibc.spec ; | |
74 | else | |
75 | ||
76 | spec-nvr := $(shell rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}\n' \ | |
77 | --specfile glibc.spec | sed 1q) | |
78 | spec-tag = $(subst .,_,$(spec-nvr)) | |
79 | ||
80 | ifeq ($(tagged),no) | |
81 | select-release = -r $(glibc-branch)-branch | |
82 | else | |
83 | select-release = -r $(tag-prefix)$(spec-tag) | |
84 | endif | |
85 | ||
86 | tag: glibc.spec | |
87 | cd ..; cvs -Q tag -c $(tag-prefix)$(spec-tag) | |
88 | ||
89 | force-tag: glibc.spec | |
90 | cd ..; cvs -Q tag -F -c $(tag-prefix)$(spec-tag) | |
91 | ||
92 | ifeq (,$(upstream)) | |
93 | srcdir-name = $(tar-name)-$(snapshot-name) | |
94 | else | |
95 | tar-name = glibc-$(upstream) | |
96 | srcdir-name = $(tar-name) | |
97 | ||
98 | ifneq ($($(glibc-branch)-sync-tag),$(upstream-tag)) | |
99 | define upstream-tag-check | |
100 | @echo Need to run make update upstream=$(upstream); exit 1 | |
101 | endef | |
102 | endif | |
103 | endif | |
104 | ||
105 | # Note this rule assumes that your working directory (..) is up to date. | |
106 | $(tar-name)-$(branch-name).patch: makepatch.awk glibc.spec \ | |
107 | ../ChangeLog ../*/ChangeLog | |
108 | $(upstream-tag-check) | |
109 | # Use -kk to suppress patches for $ Id $ differences between branches. | |
110 | (cd ..; cvs -q diff -kk -upN $(select-snapshot) $(select-release)) | \ | |
111 | awk -v OLDVER=$(srcdir-name) \ | |
112 | -v NEWVER=$(srcdir-name)-$(branch-name) \ | |
113 | -f $< > patch.tmp | |
114 | mv -f patch.tmp $@ | |
115 | ||
116 | # makepatch.awk omits these files from the patch; we put them in a tar file. | |
117 | outside-patch = fedora c_stubs rtkaio powerpc-cpu \ | |
118 | localedata/charmaps/GB18030 iconvdata/gb18030.c | |
119 | ||
120 | $(tar-name)-$(branch-name)-$(snapshot-name).tar.bz2: Makefile branch.mk \ | |
121 | ../ChangeLog \ | |
122 | ../*/ChangeLog | |
123 | $(upstream-tag-check) | |
124 | @rm -rf libc | |
125 | cvs -Q export $(select-release) $(addprefix libc/,$(outside-patch)) | |
126 | tar cf - -C libc $(outside-patch) | bzip2 -9 > $@.new | |
127 | rm -rf libc | |
128 | mv -f $@.new $@ | |
129 | ||
130 | glibc-tarballs = $(srcdir-name).tar.bz2 | |
131 | ifeq (,$(upstream)) | |
132 | $(srcdir-name).tar.bz2: Makefile branch.mk | |
133 | @rm -rf $(srcdir-name) | |
134 | cvs -Q export -d $(srcdir-name) $(select-snapshot) libc | |
135 | tar cf - $(srcdir-name) | bzip2 -9 > $@.new | |
136 | rm -rf $(srcdir-name) | |
137 | mv -f $@.new $@ | |
138 | else | |
139 | glibc-tarballs += $(srcdir-name:glibc-%=glibc-linuxthreads-%).tar.bz2 \ | |
140 | $(srcdir-name:glibc-%=glibc-libidn-%).tar.bz2 | |
141 | ||
142 | $(glibc-tarballs): | |
143 | curl -O $(releases-url)/$@ | |
144 | endif | |
145 | ||
146 | archives = $(glibc-tarballs) \ | |
147 | $(tar-name)-$(branch-name)-$(snapshot-name).tar.bz2 \ | |
148 | $(tar-name)-$(branch-name).patch | |
149 | ||
150 | finish_archive: $(archives) | |
151 | ||
152 | archive: glibc.spec | |
153 | $(MAKE) tag finish_archive | |
154 | ||
155 | rpm srpm: $(spec-nvr).src.rpm | |
156 | $(spec-nvr).src.rpm: glibc.spec $(archives) | |
157 | rpmbuild --define "_sourcedir `pwd`" \ | |
158 | --define "_specdir `pwd`" \ | |
159 | --define "_srcrpmdir `pwd`" \ | |
160 | --nodeps -bs $< | |
161 | ||
162 | ### | |
163 | # These rules are for dealing with the Fedora package repository | |
164 | # and the Red Hat internal build system. | |
165 | # | |
166 | # To use this, put in ~/.cvsdistrc at least a line: | |
167 | # DIST_COMMON = /some/checkout/of/dist/common | |
168 | # We will find cvs-import.sh there and use its CVS/Root for where to commit. | |
169 | ||
170 | .PHONY: dist-import | |
171 | ||
172 | -include ~/.cvsdistrc | |
173 | ||
174 | ifdef DIST_COMMON | |
175 | DIST_BRANCH ?= devel | |
176 | COLLECTION ?= dist-fc4 | |
177 | BHC_FLAGS ?= -n | |
178 | ||
179 | bhc-baseurl := cvs://cvs.devel.redhat.com/cvs/dist?rpms | |
180 | bhc-url = $(bhc-baseurl)/glibc/$(DIST_BRANCH)\#$(spec-tag) | |
181 | ||
182 | dist-import: $(spec-nvr).src.rpm | |
183 | $(DIST_COMMON)/cvs-import.sh -b $(DIST_BRANCH) $< | |
184 | rpm -qp $< --queryformat '[%{FILEMD5S} %{FILENAMES}\n]' > $@.new | |
185 | mv -f $@.new $@ | |
186 | ||
187 | dist-build: dist-import | |
188 | bhc $(BHC_FLAGS) $(COLLECTION) '$(bhc-url)' | |
189 | ||
190 | endif | |
191 | ### | |
192 | ||
193 | endif |