When svnsync checks to see if the server supports partial replay,
[svn.git] / packages / rpm / redhat-8+ / Makefile
blobfa90a356c7b5fe1bcc2556142aa33cc222462854
1 ##########################################################################
2 # Build an RPM from the current spec file and subversion directory tree. #
3 # #
4 # Note: The RPM and Makefile are set up to GENERATE RPMS as a non-root #
5 # user in the user's home directory. Of course to INSTALL the resulting #
6 # binary RPM the user has to log in as root. #
7 ##########################################################################
9 SVN_TOP_DIR := $(shell pwd)/../../..
11 SPECFILE := subversion.spec
12 VERSION_FILE := $(SVN_TOP_DIR)/subversion/include/svn_version.h
14 RPMDIR := rpms
16 NAME := $(shell grep '^Name:' < $(SPECFILE) | sed -e 's/^Name: //')
17 SVN_VERSION_MAJOR := $(shell grep 'define SVN_VER_MAJOR' < $(VERSION_FILE) | (read one two three; echo $$three) )
18 SVN_VERSION_MINOR := $(shell grep 'define SVN_VER_MINOR' < $(VERSION_FILE) | (read one two three; echo $$three) )
19 SVN_VERSION_MICRO := $(shell grep 'define SVN_VER_PATCH' < $(VERSION_FILE) | (read one two three; echo $$three) )
20 VERSION := $(SVN_VERSION_MAJOR).$(SVN_VERSION_MINOR).$(SVN_VERSION_MICRO)
21 RELEASE := $(shell svn st -v $(SPECFILE) | cut -b 10- | ( read one two ; echo $$one ) )
22 OSREL := $(shell ./find-osrel | ( read one two ; echo $$one ))
23 ARCH := $(shell arch |(read one two; echo $$one))
25 SOURCE_RPM_DIR := $(HOME)/$(RPMDIR)/sources/$(NAME)-$(VERSION)-$(RELEASE)
27 RPMDIRS := \
28 $(HOME)/$(RPMDIR) \
29 $(HOME)/$(RPMDIR)/build \
30 $(HOME)/$(RPMDIR)/rpms \
31 $(HOME)/$(RPMDIR)/rpms/i386 \
32 $(HOME)/$(RPMDIR)/rpms/i486 \
33 $(HOME)/$(RPMDIR)/rpms/i586 \
34 $(HOME)/$(RPMDIR)/rpms/i686 \
35 $(HOME)/$(RPMDIR)/rpms/noarch \
36 $(HOME)/$(RPMDIR)/rpms/ppc \
37 $(HOME)/$(RPMDIR)/rpms/sparc \
38 $(HOME)/$(RPMDIR)/sources \
39 $(HOME)/$(RPMDIR)/srpms \
40 $(HOME)/$(RPMDIR)/tmp
42 all : rpm
44 subversion rpm : check_release build_srpm_files build_rpm_files brand_files
46 check_release :
47 @if [ "$(RELEASE)"x = "x" ]; \
48 then \
49 echo "Please specifiy RELEASE with 'make RELEASE=<number>'"; \
50 exit 1; \
51 else \
52 exit 0; \
54 @echo "Making $(NAME)-$(VERSION)-$(RELEASE) (S)RPM for $(OSREL) ..."
56 build_rpm_files : build_srpm_files
57 cd $(SOURCE_RPM_DIR); rpmbuild -ba $(SPECFILE)
59 brand_files :
60 cd $(SOURCE_RPM_DIR)/../../rpms/$(ARCH); for oldfile in *-$(VERSION)-$(RELEASE)*; do newfile=`echo $${oldfile} | sed -e "s/-$(VERSION)-$(RELEASE).$(ARCH).rpm/-$(VERSION)-$(RELEASE).$(OSREL).$(ARCH).rpm/"`; echo Moving $${oldfile} to $${newfile}; mv -f $${oldfile} $${newfile}; done
61 cd $(SOURCE_RPM_DIR)/../../srpms; for oldfile in *-$(VERSION)-$(RELEASE)*; do newfile=`echo $${oldfile} | sed -e "s/-$(VERSION)-$(RELEASE).src.rpm/-$(VERSION)-$(RELEASE).$(OSREL).src.rpm/"`; echo Moving $${oldfile} to $${newfile}; mv -f $${oldfile} $${newfile}; done
63 build_srpm_files : $(HOME)/.rpmmacros $(HOME)/$(RPMDIR) subversion.spec
64 rm -rf $(SOURCE_RPM_DIR)
65 mkdir -p $(SOURCE_RPM_DIR)
66 cp * $(SOURCE_RPM_DIR)
67 sed -e 's/@RELEASE@/$(RELEASE)/' \
68 -e 's/@VERSION@/$(VERSION)/' \
69 < $(SPECFILE) > $(SOURCE_RPM_DIR)/$(SPECFILE)
70 cd $(SOURCE_RPM_DIR); cp -r $(SVN_TOP_DIR) $(NAME)-$(VERSION); \
71 tar cfz $(NAME)-$(VERSION)-$(RELEASE).tar.gz $(NAME)-$(VERSION) --exclude=.svn; \
72 rm -rf $(NAME)-$(VERSION)
74 $(HOME)/.rpmmacros : .rpmmacros
75 @if [ ! -f $(HOME)/.rpmmacros ]; \
76 then \
77 echo "Creating $(HOME)/.rpmmacros"; \
78 sed -e 's;@RPMSDIR@;$(HOME)/$(RPMDIR);' < .rpmmacros > $(HOME)/.rpmmacros; \
81 $(HOME)/$(RPMDIR) :
82 @if [ ! -d $(HOME)/$(RPMDIR) ]; \
83 then \
84 for i in $(RPMDIRS); \
85 do \
86 echo "Making directory $$i"; \
87 mkdir -p $$i; \
88 done; \