For SNAT, don't store the pre-fragment L2 header before actions are applied.
[sliver-openvswitch.git] / debian / rules
index ab44b77..539c8f3 100755 (executable)
@@ -25,12 +25,24 @@ MA_DIR ?= /usr/share/modass
 # load default rules
 -include $(MA_DIR)/include/common-rules.make
 
+-include debian/rules.ext
+
+DATAPATH_CONFIGURE_OPTS = --enable-snat
+
+# Official build number.  Leave set to 0 if not an official build.
+BUILD_NUMBER = 0
+
 configure: configure-stamp
 configure-stamp:
        dh_testdir
        test -e configure || ./boot.sh
-       test -e Makefile || \
-               ./configure --prefix=/usr --localstatedir=/var --enable-ssl
+       test -d _debian || mkdir _debian
+       cd _debian && ( \
+               test -e Makefile || \
+               ../configure --prefix=/usr --localstatedir=/var --enable-ssl \
+                       --with-build-number=$(BUILD_NUMBER) \
+                       $(DATAPATH_CONFIGURE_OPTS))
+       $(ext_configure)
        touch configure-stamp
 
 #Architecture 
@@ -38,19 +50,23 @@ build: build-arch build-indep
 
 build-arch: build-arch-stamp
 build-arch-stamp: configure-stamp 
-       $(MAKE)
+       $(MAKE) -C _debian
+       $(ext_build_arch)
        touch $@
 
 build-indep: build-indep-stamp
 build-indep-stamp: configure-stamp 
-       $(MAKE) dist distdir=openflow
+       $(MAKE) -C _debian dist distdir=openflow
+       $(ext_build_indep)
        touch $@
 
 clean:
        dh_testdir
        dh_testroot
        rm -f build-arch-stamp build-indep-stamp configure-stamp
+       rm -rf _debian
        [ ! -f Makefile ] || $(MAKE) distclean
+       $(ext_clean)
        dh_clean 
        debconf-updatepo
 
@@ -67,7 +83,7 @@ endif
 
 kdist_clean:
        dh_clean
-       make KERNELDIR=$(KSRC) KVERREL=$(KVERS) clean
+       rm -rf openflow
 
 kdist_config: prep-deb-files
 
@@ -77,7 +93,7 @@ binary-modules: prep-deb-files
        dh_testroot
        dh_clean -k
        tar xzf openflow.tar.gz
-       cd openflow && ./configure --with-$(l2x)=$(KSRC)
+       cd openflow && ./configure --with-$(l2x)=$(KSRC) $(DATAPATH_CONFIGURE_OPTS) --with-build-number=$(BUILD_NUMBER)
        cd openflow && $(MAKE) -C $(dpdir)
        install -d -m755 $(DSTDIR)
        install -m644 openflow/$(dpdir)/*_mod.$(KO)o $(DSTDIR)/
@@ -86,31 +102,32 @@ binary-modules: prep-deb-files
        dh_compress
        dh_fixperms
        dh_installdeb
-       dh_gencontrol -- -v$(VERSION)
+       dh_gencontrol
        dh_md5sums
        dh_builddeb --destdir=$(DEB_DESTDIR)
 
 install: install-indep install-arch
-install-indep: MODDIR = $(CURDIR)/debian/openflow-datapath-source/usr/src/modules/openflow-datapath
 install-indep: build-indep
        dh_testdir
        dh_testroot
        dh_clean -k -i 
        dh_installdirs -i
-       cp openflow.tar.gz $(MODDIR)
-       cd debian; cp changelog control compat *.modules.in rules $(MODDIR)/debian
-       cd debian/openflow-datapath-source/usr/src && tar -c modules | bzip2 -9 > openflow-datapath.tar.bz2 && rm -rf modules
-       install -m644 debian/openflow-pki.apache2 debian/openflow-pki/etc/apache2/sites-available/openflow-pki
        dh_install -i
+       cd debian/openflow-datapath-source/usr/src && tar -c modules | bzip2 -9 > openflow-datapath.tar.bz2 && rm -rf modules
+       install -m644 debian/openflow-pki-server.apache2 debian/openflow-pki-server/etc/apache2/sites-available/openflow-pki
+       install -m1777 -d debian/corekeeper/var/log/core
+       $(ext_install_indep)
 
 install-arch: build-arch
        dh_testdir
        dh_testroot
        dh_clean -k -s 
        dh_installdirs -s
-       $(MAKE) DESTDIR=$(CURDIR)/debian/openflow install
-       cp debian/openflow-switch.overrides debian/openflow-switch/usr/share/lintian/overrides/openflow-switch
+       $(MAKE) -C _debian DESTDIR=$(CURDIR)/debian/openflow install
+       cp debian/openflow-switch-config.overrides debian/openflow-switch-config/usr/share/lintian/overrides/openflow-switch-config
+       cp debian/openflow-switch.template debian/openflow-switch/usr/share/openflow/switch/default.template
        dh_install -s
+       $(ext_install_arch)
 
 # Must not depend on anything. This is to be called by
 # binary-arch/binary-indep
@@ -122,13 +139,14 @@ binary-common:
        dh_installdocs
        dh_installexamples
        dh_installdebconf
-#      dh_installlogrotate
+       dh_installlogrotate
        dh_installinit
+       dh_installcron
        dh_installman
        dh_link
-       dh_strip
+       dh_strip --dbg-package=openflow-dbg
        dh_compress 
-       dh_fixperms
+       dh_fixperms -X var/log/core
        dh_perl
        dh_makeshlibs
        dh_installdeb