Updated version of openvswitch and integrated with build system
Sapan Bhatia [Mon, 30 Jan 2012 16:37:03 +0000 (11:37 -0500)]
Makefile [new file with mode: 0644]
openvswitch.spec

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..5a87e24
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,62 @@
+# $Id$
+# $URL$
+#
+WEBFETCH               := wget
+SHA1SUM                        := sha1sum
+
+ALL                    += openvswitch
+openvswitch-URL                := http://openvswitch.org/releases/openvswitch-1.3.0.tar.gz
+openvswitch-SHA1SUM    := 9e42a66386851272eb247460d3cedd5ec92473a7
+openvswitch            := $(notdir $(openvswitch-URL))
+
+all: $(ALL)
+.PHONY: all
+
+##############################
+define download_target
+$(1): $($(1))
+.PHONY: $($(1))
+$($(1)): 
+       @if [ ! -e "$($(1))" ] ; then echo "$(WEBFETCH) $($(1)-URL)" ; $(WEBFETCH) $($(1)-URL) ; fi
+       @if [ ! -e "$($(1))" ] ; then echo "Could not download source file: $($(1)) does not exist" ; exit 1 ; fi
+       @if test "$$$$($(SHA1SUM) $($(1)) | awk '{print $$$$1}')" != "$($(1)-SHA1SUM)" ; then \
+           echo "sha1sum of the downloaded $($(1)) does not match the one from 'Makefile'" ; \
+           echo "Local copy: $$$$($(SHA1SUM) $($(1)))" ; \
+           echo "In Makefile: $($(1)-SHA1SUM)" ; \
+           false ; \
+       else \
+           ls -l $($(1)) ; \
+       fi
+endef
+
+$(eval $(call download_target,openvswitch))
+
+sources: $(ALL) 
+.PHONY: sources
+
+####################
+# default - overridden by the build
+SPECFILE = openvswitch.spec
+
+PWD=$(shell pwd)
+PREPARCH ?= noarch
+RPMDIRDEFS = --define "_sourcedir $(PWD)" --define "_builddir $(PWD)" --define "_srcrpmdir $(PWD)" --define "_rpmdir $(PWD)"
+trees: sources
+       rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bp --target $(PREPARCH) $(SPECFILE)
+
+srpm: sources
+       rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps -bs $(SPECFILE)
+
+TARGET ?= $(shell uname -m)
+rpm: sources
+       rpmbuild $(RPMDIRDEFS) $(RPMDEFS) --nodeps --target $(TARGET) -bb $(SPECFILE)
+
+clean:
+       rm -f *.rpm *.tgz *.bz2 *.gz
+
+++%: varname=$(subst +,,$@)
+++%:
+       @echo "$(varname)=$($(varname))"
++%: varname=$(subst +,,$@)
++%:
+       @echo "$($(varname))"
index 8aa41f6..92530a2 100644 (file)
@@ -1,7 +1,7 @@
 %define url $URL$
 
 %define name openvswitch
-%define version 1.1.0pre2
+%define version 1.3.0
 %define taglevel 1
 
 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
@@ -34,7 +34,7 @@ tar xvfz openvswitch-%{version}.tar.gz --strip=1
 
 %build
 KVER=`ls -l /usr/src/kernels | awk '{printf $9;}'`
-./configure --with-l26=/usr/src/kernels/$KVER
+./configure --with-linux=/usr/src/kernels/$KVER
 make -j17
 
 %install
@@ -46,7 +46,7 @@ mkdir -p $RPM_BUILD_ROOT/var
 mkdir -p $RPM_BUILD_ROOT/lib/modules/$KVER/kernel/drivers/net
 
 make install DESTDIR=$RPM_BUILD_ROOT
-cp -R datapath/linux-2.6/*.ko $RPM_BUILD_ROOT/lib/modules/$KVER/kernel/drivers/net
+cp -R datapath/linux/*.ko $RPM_BUILD_ROOT/lib/modules/$KVER/kernel/drivers/net
 
 %clean
 rm -rf $RPM_BUILD_ROOT