1 ##########################################################################
2 # Build an RPM from the current spec file and subversion directory tree. #
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
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
)
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 \
44 subversion rpm
: check_release build_srpm_files build_rpm_files brand_files
47 @if
[ "$(RELEASE)"x
= "x" ]; \
49 echo
"Please specifiy RELEASE with 'make RELEASE=<number>'"; \
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
)
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
]; \
77 echo
"Creating $(HOME)/.rpmmacros"; \
78 sed
-e
's;@RPMSDIR@;$(HOME)/$(RPMDIR);' < .rpmmacros
> $(HOME
)/.rpmmacros
; \
82 @if
[ ! -d
$(HOME
)/$(RPMDIR
) ]; \
84 for i in
$(RPMDIRS
); \
86 echo
"Making directory $$i"; \