]> git.ipfire.org Git - thirdparty/glibc.git/blame - fedora/Makefile
2.5-18.1
[thirdparty/glibc.git] / fedora / Makefile
CommitLineData
0ecb606c
JJ
1# Makefile for maintaining glibc fedora-branch and creating Fedora source RPMs.
2
3glibc.spec: # The default target.
4
5tag-prefix := fedora-
6
7.PHONY: update commit-merge tag archive finish_archive srpm rpm
8
9snapshot-date-fmt := +'%Y-%m-%d %H:%M %Z'
10snapshot-name-fmt := +'%Y%m%dT%H%M'
11
12include branch.mk
13
14
15on-branch = $(filter-out HEAD,$(glibc-base))
16
17snapshot-date := $($(glibc-branch)-sync-date)
18snapshot-name := $(shell date -u -d '$(snapshot-date)' $(snapshot-name-fmt))
19
20tag-name := glibc$(patsubst glibc-%-branch,-%,\
21 $(filter-out HEAD,$(glibc-base)))
22tar-name := $(subst _,.,$(tag-name))
23select-snapshot = -r '$($(glibc-branch)-sync-tag)'
24snapshot-id = $($(glibc-branch)-sync-tag)
25
26branch-name := $(patsubst %-$(patsubst glibc-%,%,$(tag-name)),%,\
27 $(glibc-branch))
28
29branch.mk-vars = glibc-branch glibc-base DIST_BRANCH COLLECTION \
30 releases-url
31
32ifeq (,$(upstream-tag))
33ifneq (,$(upstream))
34upstream-tag := glibc-$(subst .,_,$(upstream))
35endif
36endif
37
38update:
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
56snapshot-time: branch.mk
57 date -d '$(snapshot-date)'
58
59commit-merge:
60 cd ..; cvs -Q commit -m"Updated to $(snapshot-id)"
61
62glibc.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
72ifeq (,$(wildcard glibc.spec))
73Makefile: glibc.spec ;
74else
75
76spec-nvr := $(shell rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}\n' \
77 --specfile glibc.spec | sed 1q)
78spec-tag = $(subst .,_,$(spec-nvr))
79
80ifeq ($(tagged),no)
81select-release = -r $(glibc-branch)-branch
82else
83select-release = -r $(tag-prefix)$(spec-tag)
84endif
85
86tag: glibc.spec
87 cd ..; cvs -Q tag -c $(tag-prefix)$(spec-tag)
88
89force-tag: glibc.spec
90 cd ..; cvs -Q tag -F -c $(tag-prefix)$(spec-tag)
91
92ifeq (,$(upstream))
93srcdir-name = $(tar-name)-$(snapshot-name)
94else
95tar-name = glibc-$(upstream)
96srcdir-name = $(tar-name)
97
98ifneq ($($(glibc-branch)-sync-tag),$(upstream-tag))
99define upstream-tag-check
100 @echo Need to run make update upstream=$(upstream); exit 1
101endef
102endif
103endif
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.
117outside-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
130glibc-tarballs = $(srcdir-name).tar.bz2
131ifeq (,$(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 $@
138else
139glibc-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)/$@
144endif
145
146archives = $(glibc-tarballs) \
147 $(tar-name)-$(branch-name)-$(snapshot-name).tar.bz2 \
148 $(tar-name)-$(branch-name).patch
149
150finish_archive: $(archives)
151
152archive: glibc.spec
153 $(MAKE) tag finish_archive
154
155rpm 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
174ifdef DIST_COMMON
175DIST_BRANCH ?= devel
176COLLECTION ?= dist-fc4
177BHC_FLAGS ?= -n
178
179bhc-baseurl := cvs://cvs.devel.redhat.com/cvs/dist?rpms
180bhc-url = $(bhc-baseurl)/glibc/$(DIST_BRANCH)\#$(spec-tag)
181
182dist-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
187dist-build: dist-import
188 bhc $(BHC_FLAGS) $(COLLECTION) '$(bhc-url)'
189
190endif
191###
192
193endif