Use -kk to suppress patches for $Id$ differences between branches.
[glibc.git] / fedora / Makefile
blob9bde561c00a16f66e7030f823c4482776ba60a1b
1 # Makefile for maintaining glibc fedora-branch and creating Fedora source RPMs.
3 glibc.spec: # The default target.
5 tag-prefix := fedora-
7 .PHONY: update commit-merge commit patch tag archive finish_archive srpm rpm
9 snapshot-date-fmt := +'%Y-%m-%d %H:%M %Z'
10 snapshot-name-fmt := +'%Y%m%dT%H%M'
12 include branch.mk
15 on-branch = $(filter-out HEAD,$(glibc-base))
17 snapshot-date := $($(glibc-branch)-sync-date)
18 snapshot-name := $(shell date -u -d '$(snapshot-date)' $(snapshot-name-fmt))
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)
26 branch-name := $(patsubst %-$(patsubst glibc-%,%,$(tag-name)),%,\
27 $(glibc-branch))
29 branch.mk-vars = glibc-branch glibc-base DIST_BRANCH COLLECTION
31 update:
32 now=`date -u $(snapshot-date-fmt)`; \
33 name=`date -u -d "$$now" $(snapshot-name-fmt)`; \
34 new="$(tag-prefix)$(tag-name)-$$name"; \
35 cvs -Q rtag $(if $(on-branch),-r $(glibc-base),-D "$$now") $$new libc;\
36 (echo '# This file is updated automatically by Makefile.'; \
37 $(foreach var,$(branch.mk-vars),\
38 $(if $($(var)),echo '$(var) := $($(var))';)) \
39 echo "$(glibc-branch)-sync-date := $$now"; \
40 echo "$(glibc-branch)-sync-tag := $$new"; \
41 ) > branch.mk; \
42 cd ..; (set -x; cvs -q update -d -P \
43 -j'$($(glibc-branch)-sync-tag)' -j"$$new") \
44 2>&1 | tee fedora/update.log
46 .PHONY: snapshot-time
47 snapshot-time: branch.mk
48 date -d '$(snapshot-date)'
50 commit-merge:
51 cd ..; cvs -Q commit -m"Updated to $(snapshot-id)"
53 glibc.spec: glibc.spec.in ../version.h branch.mk
54 (echo '%define glibcdate $(snapshot-name)'; \
55 echo '%define glibcname $(tar-name)'; \
56 sed -n '/VERSION/s/^.*"\([^"]*\)"$$/%define glibcversion \1/p' \
57 ../version.h; \
58 cat $<) > $@.new
59 mv -f $@.new $@
61 ifeq (,$(wildcard glibc.spec))
62 Makefile: glibc.spec ;
63 else
65 spec-nvr := $(shell rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}\n' \
66 --specfile glibc.spec | sed 1q)
67 spec-tag = $(subst .,_,$(spec-nvr))
69 ifeq ($(tagged),no)
70 select-release = -r $(glibc-branch)-branch
71 else
72 select-release = -r $(tag-prefix)$(spec-tag)
73 endif
75 tag: glibc.spec
76 cd ..; cvs -Q tag -c $(tag-prefix)$(spec-tag)
78 force-tag: glibc.spec
79 cd ..; cvs -Q tag -F -c $(tag-prefix)$(spec-tag)
81 # Note this rule assumes that your working directory (..) is up to date.
82 $(tar-name)-$(branch-name).patch: makepatch.awk glibc.spec \
83 ../ChangeLog ../*/ChangeLog
84 # Use -kk to suppress patches for $Id$ differences between branches.
85 (cd ..; cvs -q diff -kk -upN $(select-snapshot) $(select-release)) | \
86 awk -v OLDVER=$(tar-name)-$(snapshot-name) \
87 -v NEWVER=$(tar-name)-$(snapshot-name)-$(branch-name) \
88 -f $< > patch.tmp
89 mv -f patch.tmp $@
91 # makepatch.awk omits these files from the patch; we put them in a tar file.
92 outside-patch = fedora c_stubs rtkaio glibc-compat \
93 localedata/charmaps/GB18030 iconvdata/gb18030.c
95 $(tar-name)-$(branch-name)-$(snapshot-name).tar.bz2: Makefile branch.mk \
96 ../ChangeLog \
97 ../*/ChangeLog
98 @rm -rf libc
99 cvs -Q export $(select-release) $(addprefix libc/,$(outside-patch))
100 tar cf - -C libc $(outside-patch) | bzip2 -9 > $@.new
101 rm -rf libc
102 mv -f $@.new $@
104 $(tar-name)-$(snapshot-name).tar.bz2: Makefile branch.mk
105 @rm -rf $(tar-name)-$(snapshot-name)
106 cvs -Q export -d $(tar-name)-$(snapshot-name) $(select-snapshot) libc
107 tar cf - $(tar-name)-$(snapshot-name) | bzip2 -9 > $@.new
108 rm -rf $(tar-name)-$(snapshot-name)
109 mv -f $@.new $@
111 archives = $(tar-name)-$(snapshot-name).tar.bz2 \
112 $(tar-name)-$(branch-name)-$(snapshot-name).tar.bz2 \
113 $(tar-name)-$(branch-name).patch
114 finish_archive: $(archives)
116 archive: glibc.spec
117 $(MAKE) tag finish_archive
119 rpm srpm: $(spec-nvr).src.rpm
120 $(spec-nvr).src.rpm: glibc.spec $(archives)
121 rpmbuild --define "_sourcedir `pwd`" \
122 --define "_specdir `pwd`" \
123 --define "_srcrpmdir `pwd`" \
124 --nodeps -bs $<
127 # These rules are for dealing with the Fedora package repository
128 # and the Red Hat internal build system.
130 # To use this, put in ~/.cvsdistrc at least a line:
131 # DIST_COMMON = /some/checkout/of/dist/common
132 # We will find cvs-import.sh there and use its CVS/Root for where to commit.
134 .PHONY: dist-import
136 -include ~/.cvsdistrc
138 ifdef DIST_COMMON
139 DIST_BRANCH ?= devel
140 COLLECTION ?= dist-fc3
141 BHC_FLAGS ?= -n
143 bhc-baseurl := cvs://cvs.devel.redhat.com/cvs/dist?rpms
144 bhc-url = $(bhc-baseurl)/glibc/$(DIST_BRANCH)\#$(spec-tag)
146 dist-import: $(spec-nvr).src.rpm
147 $(DIST_COMMON)/cvs-import.sh -b $(DIST_BRANCH) $<
148 rpm -qp $< --queryformat '[%{FILEMD5S} %{FILENAMES}\n]' > $@.new
149 mv -f $@.new $@
151 dist-build: dist-import
152 bhc $(BHC_FLAGS) $(COLLECTION) '$(bhc-url)'
154 endif
157 endif