1 # Makefile for maintaining glibc fedora-branch and creating Fedora source RPMs.
3 glibc.spec
: # The default target.
7 .PHONY
: update commit-merge 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'
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
)),%,\
29 branch.mk-vars
= glibc-branch glibc-base DIST_BRANCH COLLECTION \
32 ifeq (,$(upstream-tag
))
34 upstream-tag
:= glibc-
$(subst .
,_
,$(upstream
))
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
;\
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"; \
51 cd ..
; (set
-x
; cvs
-q update
-d
-P \
52 -j
'$($(glibc-branch)-sync-tag)' -j
"$$new") \
53 2>&1 | tee fedora
/update.log
56 snapshot-time
: branch.mk
57 date
-d
'$(snapshot-date)'
60 cd ..
; cvs
-Q commit
-m
"Updated to $(snapshot-id)"
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
-e
$$( sed
-n
'/VERSION/s/^.*"\([^"]*\)"$$/s,@glibcversion@,\1,/p' \
72 ifeq (,$(wildcard glibc.spec
))
73 Makefile
: glibc.spec
;
76 spec-nvr
:= $(shell rpm
-q
--qf
'%{NAME}-%{VERSION}-%{RELEASE}\n' \
77 --specfile glibc.spec | sed
1q
)
78 spec-tag
= $(subst .
,_
,$(spec-nvr
))
81 select-release
= -r
$(glibc-branch
)-branch
83 select-release
= -r
$(tag-prefix
)$(spec-tag
)
87 cd ..
; cvs
-Q tag
-c
$(tag-prefix
)$(spec-tag
)
90 cd ..
; cvs
-Q tag
-F
-c
$(tag-prefix
)$(spec-tag
)
93 srcdir-name
= $(tar-name
)-$(snapshot-name
)
95 tar-name
= glibc-
$(upstream
)
96 srcdir-name
= $(tar-name
)
98 ifneq ($($(glibc-branch
)-sync-tag
),$(upstream-tag
))
99 define upstream-tag-check
100 @echo Need to run make update upstream
=$(upstream
); exit
1
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
) \
116 # makepatch.awk omits these files from the patch; we put them in a tar file.
117 outside-patch
= fedora c_stubs rtkaio \
118 localedata
/charmaps
/GB18030 iconvdata
/gb18030.c
120 $(tar-name
)-$(branch-name
)-$(snapshot-name
).
tar.bz2
: Makefile branch.mk \
123 $(upstream-tag-check
)
125 cvs
-Q
export $(select-release
) $(addprefix libc
/,$(outside-patch
))
126 tar cf
- -C libc
$(outside-patch
) | bzip2
-9 > $@.new
130 glibc-tarballs
= $(srcdir-name
).
tar.bz2
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
)
139 glibc-tarballs
+= $(srcdir-name
:glibc-
%=glibc-linuxthreads-
%).
tar.bz2 \
140 $(srcdir-name
:glibc-
%=glibc-libidn-
%).
tar.bz2
143 curl
-O
$(releases-url
)/$@
146 archives
= $(glibc-tarballs
) \
147 $(tar-name
)-$(branch-name
)-$(snapshot-name
).
tar.bz2 \
148 $(tar-name
)-$(branch-name
).patch
150 finish_archive
: $(archives
)
153 $(MAKE
) tag finish_archive
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`" \
163 # These rules are for dealing with the Fedora package repository
166 # To use this, put in ~/.cvspkgsrc at least a line:
167 # COMMON_DIR ?= /some/checkout/of/pkgs/common
168 # We will find cvs-import.sh there and use its CVS/Root for where to commit.
172 -include ~
/.cvspkgsrc
176 COLLECTION ?
= dist-f8
178 pkgs-baseurl
:= cvs
://cvs.fedoraproject.org
/cvs
/pkgs?rpms
179 pkgs-url
= $(pkgs-baseurl
)/glibc
/$(DIST_BRANCH
)\
#$(spec-tag)
181 pkgs-import
: $(spec-nvr
).src.rpm
182 $(COMMON_DIR
)/cvs-import.sh
-b
$(DIST_BRANCH
) $<
183 rpm
-qp
$< --queryformat
'[%{FILEMD5S} %{FILENAMES}\n]' > $@.new
187 koji build
$(BUILD_FLAGS
) $(COLLECTION
) '$(pkgs-url)'