emit glibcname in glibc.spec
[glibc.git] / fedora / Makefile
blob6a6cc189bb2523af5f1773974ef832e624cf33eb
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)
27 branch.mk-vars = glibc-branch glibc-base DIST_BRANCH COLLECTION
29 update:
30 now=`date -u $(snapshot-date-fmt)`; \
31 name=`date -u -d "$$now" $(snapshot-name-fmt)`; \
32 new="$(tag-prefix)$(tag-name)-$$name"; \
33 cvs -Q rtag $(if $(on-branch),-r $(glibc-base),-D "$$now") $$new libc;\
34 (echo '# This file is updated automatically by Makefile.'; \
35 $(foreach var,$(branch.mk-vars),\
36 $(if $($(var)),echo '$(var) := $($(var))';)) \
37 echo "$(glibc-branch)-sync-date := $$now"; \
38 echo "$(glibc-branch)-sync-tag := $$new"; \
39 ) > branch.mk; \
40 cd ..; (set -x; cvs -q update -d -P \
41 -j'$($(glibc-branch)-sync-tag)' -j"$$new") \
42 2>&1 | tee fedora/update.log
44 .PHONY: snapshot-time
45 snapshot-time: branch.mk
46 date -d '$(snapshot-date)'
48 commit-merge:
49 cd ..; cvs -Q commit -m"Updated to $(snapshot-id)"
51 glibc.spec: glibc.spec.in ../version.h branch.mk Makefile
52 (echo '%define glibcdate $(snapshot-name)'; \
53 echo '%define glibcname $(tar-name)'; \
54 sed -n '/VERSION/s/^.*"\([^"]*\)"$$/%define glibcversion \1/p' \
55 ../version.h; \
56 cat $<) > $@.new
57 mv -f $@.new $@
59 ifeq (,$(wildcard glibc.spec))
60 Makefile: glibc.spec ;
61 else
63 spec-nvr := $(shell rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}\n' \
64 --specfile glibc.spec | sed 1q)
65 spec-tag = $(subst .,_,$(spec-nvr))
67 ifeq ($(tagged),no)
68 select-release = -r $(glibc-branch)-branch
69 else
70 select-release = -r $(tag-prefix)$(spec-tag)
71 endif
73 tag: glibc.spec
74 cd ..; cvs -Q tag -c $(tag-prefix)$(spec-tag)
76 force-tag: glibc.spec
77 cd ..; cvs -Q tag -F -c $(tag-prefix)$(spec-tag)
79 # Note this rule assumes that your working directory (..) is up to date.
80 $(tar-name)-$(glibc-branch).patch: makepatch.awk glibc.spec \
81 ../ChangeLog ../*/ChangeLog
82 (cd ..; cvs -q diff -upN $(select-snapshot) $(select-release)) | \
83 awk -v OLDVER=$(tar-name)-$(snapshot-name) \
84 -v NEWVER=$(tar-name)-$(snapshot-name)-$(glibc-branch) \
85 -f $< > patch.tmp
86 mv -f patch.tmp $@
88 # makepatch.awk omits these files from the patch; we put them in a tar file.
89 outside-patch = fedora c_stubs rtkaio glibc-compat \
90 localedata/charmaps/GB18030 iconvdata/gb18030.c
92 $(tar-name)-$(glibc-branch)-$(snapshot-name).tar.bz2: Makefile branch.mk \
93 ../ChangeLog \
94 ../*/ChangeLog
95 @rm -rf libc
96 cvs -Q export $(select-release) $(addprefix libc/,$(outside-patch))
97 tar cf - -C libc $(outside-patch) | bzip2 -9 > $@.new
98 rm -rf libc
99 mv -f $@.new $@
101 $(tar-name)-$(snapshot-name).tar.bz2: Makefile branch.mk
102 @rm -rf $(tar-name)-$(snapshot-name)
103 cvs -Q export -d $(tar-name)-$(snapshot-name) $(select-snapshot) libc
104 tar cf - $(tar-name)-$(snapshot-name) | bzip2 -9 > $@.new
105 rm -rf $(tar-name)-$(snapshot-name)
106 mv -f $@.new $@
108 archives = $(tar-name)-$(snapshot-name).tar.bz2 \
109 $(tar-name)-$(glibc-branch)-$(snapshot-name).tar.bz2 \
110 $(tar-name)-$(glibc-branch).patch
111 finish_archive: $(archives)
113 archive: glibc.spec
114 $(MAKE) tag finish_archive
116 rpm srpm: $(spec-nvr).src.rpm
117 $(spec-nvr).src.rpm: glibc.spec $(archives)
118 rpmbuild --define "_sourcedir `pwd`" \
119 --define "_specdir `pwd`" \
120 --define "_srcrpmdir `pwd`" \
121 --nodeps -bs $<
124 # These rules are for dealing with the Fedora package repository
125 # and the Red Hat internal build system.
127 # To use this, put in ~/.cvsdistrc at least a line:
128 # DIST_COMMON = /some/checkout/of/dist/common
129 # We will find cvs-import.sh there and use its CVS/Root for where to commit.
131 .PHONY: dist-import
133 -include ~/.cvsdistrc
135 ifdef DIST_COMMON
136 DIST_BRANCH ?= devel
137 COLLECTION ?= dist-fc3
138 BHC_FLAGS ?= -n
140 bhc-baseurl := cvs://cvs.devel.redhat.com/cvs/dist?rpms
141 bhc-url = $(bhc-baseurl)/glibc/$(DIST_BRANCH)#$(spec-tag)
143 dist-import: $(spec-nvr).src.rpm
144 $(DIST_COMMON)/cvs-import.sh -b $(DIST_BRANCH) $<
145 ls -l $< > $@
147 dist-build: dist-import
148 bhc $(BHC_FLAGS) $(COLLECTION) '$(bhc-url)'
150 endif
153 endif