2 # Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 # # Build an RPM package targeted to the OLPC http://www.laptop.org.
19 # olpc: dist-gzip $(srcdir)/packaging/redhat/gnash.spec
20 # cp -f $(srcdir)/packaging/redhat/gnash.spec /usr/src/redhat/SPECS/
21 # cp -f gnash-$(VERSION).tar.gz /usr/src/redhat/SOURCES/
22 # rpmbuild -rcfile=$(srcdir)/packaging/redhat/rpmrc:/usr/lib/rpm/rpmrc \
23 # -ba --target=geode-olpc /usr/src/redhat/SPECS/gnash.spec
25 RPMBUILD_FLAGS = # --clean --rmsource --rmspec
27 gnash.spec spec: $(srcdir)/packaging/redhat/gnash.spec
28 snapshot_version="$(SNAPSHOT_VERSION)"; \
29 snapshot_version=`echo $${snapshot_version}|tr "~" "_"`; \
30 distver=`cat /etc/redhat-release | cut -d ' ' -f 3`; \
31 echo "Editing the version in the spec file to be $${snapshot_version} for Distribution $${distver}..."; \
32 sed -e "s/Version.*/Version: $${snapshot_version}/" \
33 -e "s/Distribution:.*/Distribution: fc$${distver}/" $(srcdir)/packaging/redhat/gnash.spec > gnash.spec;
36 # Build an Redhat/Fedora .rpm package
37 # We do this by using the source snapshot that we know is 'distclean'.
38 # After copying the source tarball to where rpmbuild expects it,
39 # we can then build the binary package.
40 # older versions of Fedora used /usr/src/redhat/{SOURCES, BUILD} for
41 # everything, but the newer version appears to use one's home directory
42 # instead, so now you don't have to be root to build rpm packages.
44 # Do the entire process to build an RPM package
45 rpm: distdir spec setup-rpm rpm-gnash
47 # build everything in one pass using rpmbuild
49 rpmbuild -ba $(RPMBUILD_FLAGS) --sign gnash.spec
51 # configure the build directory, which we do by executing only the %prep stage,
52 # which doesn't actually run configure
54 rpmbuild -bp $(RPMBUILD_FLAGS) gnash.spec
56 # compile the build, which we do by executing only the %build stage, which
57 # runs configure as the first step.
59 rpmbuild -bc --short-circuit $(RPMBUILD_FLAGS) gnash.spec
61 # install the build, which we do by executing only the %install stage, which
62 # also builds the actual rpms
64 rpmbuild -bi --short-circuit $(RPMBUILD_FLAGS) gnash.spec
66 # After distdir is done, all we have is an empty subdirectory
67 # populated from the *_DIST variables used by Automake. RPM and Deb
68 # naming conventions are similar, but just different enough that the
69 # source directory and tarball names are subtely different, namely
70 # Debian uses a '~' character in their version names, which rpmbuild
71 # doesn't like, so for an RPM we convert it to a '_' instead. Then we
72 # have to rename the subdirectory to match the new version of the
73 # snapshot, and edit the configure* files to have the proper version
75 # Unlike creating a deb, which build their own source tarball, rpm
76 # requires we do it ourselves, and copy it to $HOME/rpmbuild/SOURCES
77 # before rpmbuild will work.
79 -snapshot_version="gnash-$(SNAPSHOT_VERSION)"; \
80 snapshot_version=`echo $${snapshot_version}|tr "~" "_"`; \
81 if test -d gnash-$(PACKAGE_VERSION); then \
82 mv gnash-$(PACKAGE_VERSION) $${snapshot_version}; \
83 if test ! -f $${snapshot_version}/configure.ac.orig; then \
84 mv -f $${snapshot_version}/configure.ac $${snapshot_version}/configure.ac.orig; \
85 sed -e "s/AC_INIT(gnash, master)/AC_INIT(gnash, $${snapshot_version})/" \
86 $${snapshot_version}/configure.ac.orig > $${snapshot_version}/configure.ac; \
89 tar zcf $${snapshot_version}.tar.gz \
90 --exclude=$${snapshot_version}/autom4te.cache \
91 --exclude=$${snapshot_version}/configure.ac.orig \
92 --exclude=$${snapshot_version}/configure.orig $${snapshot_version}; \
93 cp $${snapshot_version}.tar.gz $${HOME}/rpmbuild/SOURCES/
95 # this removes old builds from the maintainer's $HOME/rpmbuild directory.
97 rm -f ~/rpmbuild/SOURCES/gnash*
98 rm -fr ~/rpmbuild/BUILD/gnash*
99 rm -fr ~/rpmbuild/BUILDROOT/gnash*
100 rm -fr ~/rpmbuild/SRPMS/gnash*
101 rm -fr ~/rpmbuild/RPMS/i686/gnash*
103 .PHONY : rpm redhat spec rpm-configure rpm-install rpm-build setup-rpm rpmbuild-clean