~svn/ubuntu/raring/subversion/ppa

« back to all changes in this revision

Viewing changes to packages/rpm/redhat-7.x/Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:26:14 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205012614-qom4xfypgtsqc2xq
Tags: 1.2.3dfsg1-3ubuntu1
Merge with the final Debian release of 1.2.3dfsg1-3, bringing in
fixes to the clean target, better documentation of the libdb4.3
upgrade and build fixes to work with swig1.3_1.3.27.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
##########################################################################
 
8
 
 
9
SVN_TOP_DIR := $(shell pwd)/../../..
 
10
 
 
11
SPECFILE := subversion.spec
 
12
VERSION_FILE := $(SVN_TOP_DIR)/subversion/include/svn_version.h
 
13
 
 
14
RPMDIR := rpms
 
15
 
 
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
 
 
24
SOURCE_RPM_DIR := $(HOME)/$(RPMDIR)/sources/$(NAME)-$(VERSION)-$(RELEASE)
 
25
 
 
26
RPMDIRS := \
 
27
        $(HOME)/$(RPMDIR) \
 
28
        $(HOME)/$(RPMDIR)/build \
 
29
        $(HOME)/$(RPMDIR)/rpms \
 
30
        $(HOME)/$(RPMDIR)/rpms/i386 \
 
31
        $(HOME)/$(RPMDIR)/rpms/i486 \
 
32
        $(HOME)/$(RPMDIR)/rpms/i586 \
 
33
        $(HOME)/$(RPMDIR)/rpms/i686 \
 
34
        $(HOME)/$(RPMDIR)/rpms/noarch \
 
35
        $(HOME)/$(RPMDIR)/rpms/ppc \
 
36
        $(HOME)/$(RPMDIR)/rpms/sparc \
 
37
        $(HOME)/$(RPMDIR)/sources \
 
38
        $(HOME)/$(RPMDIR)/srpms \
 
39
        $(HOME)/$(RPMDIR)/tmp
 
40
 
 
41
all : rpm
 
42
 
 
43
subversion rpm : check_release build_srpm_files build_rpm_files brand_files
 
44
 
 
45
check_release :
 
46
        @if [ "$(RELEASE)"x = "x" ]; \
 
47
           then \
 
48
                echo "Please specifiy RELEASE with 'make RELEASE=<number>'"; \
 
49
                exit 1; \
 
50
            else \
 
51
                exit 0; \
 
52
        fi
 
53
        @echo "Making $(NAME)-$(VERSION)-$(RELEASE) (S)RPM for $(OSREL)  ..."
 
54
 
 
55
build_rpm_files : build_srpm_files
 
56
        cd $(SOURCE_RPM_DIR); rpmbuild -ba $(SPECFILE)
 
57
 
 
58
brand_files :
 
59
        cd $(SOURCE_RPM_DIR)/../../rpms/i386; for oldfile in *$(RELEASE)*; do newfile=`echo $${oldfile} | sed -e "s/-$(VERSION)-$(RELEASE).i386.rpm/-$(VERSION)-$(RELEASE).$(OSREL).i386.rpm/"`; echo Moving $${oldfile} to $${newfile}; mv -f $${oldfile} $${newfile}; done
 
60
        cd $(SOURCE_RPM_DIR)/../../srpms; for oldfile in *$(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
 
61
 
 
62
build_srpm_files : $(HOME)/.rpmmacros $(HOME)/$(RPMDIR) subversion.spec
 
63
        rm -rf $(SOURCE_RPM_DIR)
 
64
        mkdir -p $(SOURCE_RPM_DIR)
 
65
        cp * $(SOURCE_RPM_DIR)
 
66
        sed -e 's/@RELEASE@/$(RELEASE)/' \
 
67
                -e 's/@VERSION@/$(VERSION)/' \
 
68
                < $(SPECFILE) > $(SOURCE_RPM_DIR)/$(SPECFILE)
 
69
        cd $(SOURCE_RPM_DIR); cp -r $(SVN_TOP_DIR) $(NAME)-$(VERSION); \
 
70
           tar cfz $(NAME)-$(VERSION)-$(RELEASE).tar.gz $(NAME)-$(VERSION) --exclude=.svn; \
 
71
           rm -rf $(NAME)-$(VERSION)
 
72
 
 
73
$(HOME)/.rpmmacros : .rpmmacros
 
74
        @if [ ! -f $(HOME)/.rpmmacros ]; \
 
75
           then \
 
76
           echo "Creating $(HOME)/.rpmmacros"; \
 
77
           sed -e 's;@RPMSDIR@;$(HOME)/$(RPMDIR);' < .rpmmacros > $(HOME)/.rpmmacros; \
 
78
           fi
 
79
 
 
80
$(HOME)/$(RPMDIR) :
 
81
        @if [ ! -d $(HOME)/$(RPMDIR) ]; \
 
82
                then \
 
83
                for i in $(RPMDIRS); \
 
84
                        do \
 
85
                        echo "Making directory $$i"; \
 
86
                        mkdir -p $$i; \
 
87
                        done; \
 
88
           fi