[Cbe-oss-dev] [PATCH] libspe2: build tarball as make target
stenzel at de.ibm.com
stenzel at de.ibm.com
Wed Apr 25 01:49:41 EST 2007
The following patch redefines the "dist" target to create a tarball,
which then can be used to build a fedora rpm or packages for
other distros. This is based on a proposal from Jeremy Kerr.
The release number is currently hardcoded in the Makefile. This
should be changed such that it is updated by subversion.
Signed-off-by: Gerhard Stenzel <stenzel at de.ibm.com>
===================================================================
Index: libspe2/libspe2.spec
===================================================================
--- libspe2/libspe2.spec (revision 31)
+++ libspe2/libspe2.spec (working copy)
@@ -1,11 +1,11 @@
-%define release 0
+%define release %{_version}
Name: libspe2
Version: 2.1.0
Release: %{release}
License: LGPL
Group: System Environment/Base
URL: http://www.bsc.es/projects/deepcomputing/linuxoncell
-Source: http://www.bsc.es/projects/deepcomputing/linuxoncell/development/release2.0/libspe/%{name}-%{version}.tar.gz
+Source: http://www.bsc.es/projects/deepcomputing/linuxoncell/development/release2.0/libspe/%{name}-%{version}-%{release}.tar.gz
Buildroot: %{_tmppath}/libspe
Exclusivearch: ppc ppc64 noarch
Summary: SPE Runtime Management Library
Index: libspe2/Makefile
===================================================================
--- libspe2/Makefile (revision 31)
+++ libspe2/Makefile (working copy)
@@ -26,10 +26,17 @@ libspe2_OBJS := libspe2.o
CFLAGS += -I$(TOP)/spebase
CFLAGS += -I$(TOP)/speevent
+PACKAGE := libspe2
+VERSION := $(MAJOR_VERSION).$(MINOR_VERSION)
+RELEASE := 31
+FULLNAME := $(PACKAGE)-$(VERSION)
+PACKAGE_VER := $(FULLNAME)-$(RELEASE)
+TARBALL := $(SOURCES)$(PACKAGE_VER).tar.gz
+SOURCEFILES := $(TARBALL)
all: $(libspe2_SO) $(libspe2_A) libspe12-all
-dist: pushall all
+dist: $(TARBALL)
pushall:
quilt push -a ; true
@@ -83,10 +90,6 @@ $(libspe2_A): $(libspe2_OBJS) base-all
$(CROSS)ar -r $(libspe2_A) $(libspe2_OBJS) spebase/*.o speevent/*.o $(libspe2_OBJS)
-PACKAGE = libspe2
-FULLNAME = $(PACKAGE)-$(MAJOR_VERSION).$(MINOR_VERSION)
-TARBALL = $(SOURCES)$(FULLNAME).tar.gz
-SOURCEFILES = $(TARBALL)
PATCHES := `cat series | grep -v ^\#`
#RPMBUILD = ppc32 rpmbuild --target=ppc
RPMBUILD = rpmbuild
@@ -110,15 +113,15 @@ checkenv:
$(PWD)/.rpmmacros:
mkdir -p $(SOURCES) $(RPMS) $(SRPMS) $(BUILD)
- echo -e \%_topdir $(RPM)\\n\%_sourcedir $(PWD)\\n\%_tmppath %_topdir/tmp > $@
+ echo -e \%_topdir $(RPM)\\n\%_sourcedir $(PWD)\\n\%_tmppath %_topdir/tmp\\n\%_version $(RELEASE) > $@
-rpm: checkenv $(RPM)/$(PACKAGE)-stamp
+rpm: dist checkenv $(RPM)/$(PACKAGE)-stamp
$(RPM)/$(PACKAGE)-stamp: $(PWD)/.rpmmacros $(SOURCEFILES) $(SPEC)
HOME=$(PWD) $(RPMBUILD) -ba $(SPEC) $(RPMFLAGS)
touch $@
-crossrpm: checkenv $(RPM)/$(PACKAGE)-cross-stamp
+crossrpm: dist checkenv $(RPM)/$(PACKAGE)-cross-stamp
$(RPM)/$(PACKAGE)-cross-stamp: $(PWD)/.rpmmacros $(SOURCEFILES) $(SPEC)
HOME=$(PWD) $(RPMBUILD) -ba $(SPEC) --target=noarch $(RPMFLAGS)
@@ -134,21 +137,18 @@ rpm32:
rpm64:
HOME=$(PWD) $(RPMBUILD) --target=ppc64 -ba $(SPEC) $(RPMFLAGS)
-
-
-tarball: $(TARBALL)
-
-$(TARBALL): $(SOURCES)
-# cd patches; cp $(PATCHES) ..
- rm -f $(FULLNAME)
+$(TARBALL): clean
ln -s . $(FULLNAME)
- tar czf $@ --exclude=$(FULLNAME).tar.gz \
- --exclude=$(FULLNAME)/$(FULLNAME) \
- --exclude=$(FULLNAME)/spegang \
- --exclude=$(FULLNAME)/spethread \
- --exclude=$(FULLNAME)/tests_hidden \
- --exclude=$(FULLNAME)/patches \
- --exclude=CVS $(FULLNAME)/*
+ tar -czhf $@ --exclude=$(PACKAGE_VER).tar.gz \
+ --exclude=$(FULLNAME)/$(FULLNAME) \
+ --exclude=CVS --exclude .pc --exclude '.*.swp' --exclude '*~' --exclude '.#*' \
+ --exclude=$(FULLNAME)/spegang \
+ --exclude=$(FULLNAME)/spethread \
+ --exclude=$(FULLNAME)/tests_hidden \
+ --exclude=$(FULLNAME)/patches \
+ --exclude=.svn CVS $(FULLNAME)/* \
+ $(FULLNAME)
+ rm $(FULLNAME)
doc: text pdf
@@ -177,6 +177,7 @@ clean: base-clean event-clean elfspe-cle
rm *.diff ; true
rm -rf $(libspe2_A) $(libspe2_SO) $(libspe2_OBJS)
rm -f $(TARBALL)
+ rm -f $(FULLNAME)
rm -f doc/*.pdf
rm -f doc/functions.txt
rm -rf xml
===================================================================
Best regards,
Gerhard Stenzel, Linux on Cell Development, LTC
-------------------------------------------------------------------------------------
IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Johann Weihen | Geschaeftsfuehrung: Herbert Kircher
Sitz der Gesellschaft: Boeblingen | Registergericht: Amtsgericht Stuttgart, HRB 243294
More information about the cbe-oss-dev
mailing list