1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
DEB_SOURCE := $(shell dpkg-parsechangelog | grep Source: | sed -e 's/Source: //')
DEB_VERSION := $(shell dpkg-parsechangelog | grep Version: | sed -e 's/Version: //')
DEB_UPSTREAM_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/-[^-]*$$//')
BUILD_DATE := $(shell dpkg-parsechangelog --show-field Date)
SVN_URL = http://scholarzhang.googlecode.com/svn/trunk/west-chamber
# package version
pver:=$(shell dpkg-parsechangelog | grep Version: | sed -e 's/Version: //' | sed -e 's/-[^-]*$$//')
# The short upstream name, used for the module source directory
dkmssname := west-chamber-$(pver)
# Name of the DKMS package
dkmssource:=west-chamber-dkms
# some default definitions, important!
# Name of the source package
psource:=west-chamber-source
# The short upstream name, used for the module source directory
sname:=west-chamber
# The name of the common userspace package
cname:=west-chamber-common
%:
dh $@ --with dkms
override_dh_auto_configure:
./autogen.sh
dh_auto_configure
override_dh_auto_build:
dh_auto_build -- -C extensions user-all-local
override_dh_auto_clean:
dh_auto_clean
dh_auto_clean -- distclean
override_dh_auto_install:
# Create the directories to install the source into
mkdir -p $(CURDIR)/debian/$(psource)/usr/src/modules/$(sname)/debian
mkdir -p $(CURDIR)/debian/$(psource)/usr/src/modules/$(sname)/extensions
mkdir -p $(CURDIR)/debian/$(psource)/usr/src/modules/$(sname)/m4
# Copy only the driver source to the proper location
cp extensions/*.c extensions/Makefile.am \
extensions/?build \
debian/$(psource)/usr/src/modules/$(sname)/extensions
cp Makefile.am Makefile.extra Makefile.iptrules.in Makefile.mans.in \
autogen.sh configure.ac mconfig west-chamber.8.in \
debian/$(psource)/usr/src/modules/$(sname)
# Copy the needed debian/ pieces to the proper location
cp debian/*modules.in* \
debian/$(psource)/usr/src/modules/$(sname)/debian
cp debian/changelog debian/copyright debian/clean \
debian/compat debian/control \
debian/$(psource)/usr/src/modules/$(sname)/debian/
cp debian/rules.modules \
debian/$(psource)/usr/src/modules/$(sname)/debian/rules
cd debian/$(psource)/usr/src && tar c --mtime="$(BUILD_DATE)" \
--sort=name \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
modules | bzip2 -9 > $(sname).tar.bz2 && rm -rf modules
# DKMS
# DKMS: Create the directories to install the source into
mkdir -p $(CURDIR)/debian/$(dkmssource)/usr/src/$(dkmssname)/extensions
# DKMS: Copy only the driver source to the proper location
cp extensions/*.c debian/$(dkmssource)/usr/src/$(dkmssname)/extensions
cp extensions/Kbuild extensions/Makefile.in debian/$(dkmssource)/usr/src/$(dkmssname)/extensions
cp Makefile.* \
mconfig \
debian/$(dkmssource)/usr/src/$(dkmssname)
find debian/$(dkmssource)/usr/src -name ".gitignore" -o -name Makefile.iptrules -delete
#sed 's/compat_xtables.o//' extensions/Kbuild > debian/$(dkmssource)/usr/src/$(dkmssname)/Kbuild
echo 'ccflags-y += -I$${XTABLESDIR}/extensions -I.' >> debian/$(dkmssource)/usr/src/$(dkmssname)/extensions/Kbuild
# Add here commands to install the package into debian/west-chamber.
#dh_auto_install
override_dh_auto_test:
get-orig-source:
set -e; if echo $(DEB_VERSION) | grep -c "svn"; \
then \
svn_version=`echo $(DEB_VERSION) | sed -e 's/^.*svn\([0-9]*\)*\.\(.*\)-.*$$/\2/g'`; \
else \
svn_version=$(DEB_UPSTREAM_VERSION); \
fi; \
tmpdir=`mktemp -d -t`; \
cd $$tmpdir; \
echo "checkout upstream repository ..."; \
svn checkout -r $$svn_version $(SVN_URL) west-chamber; echo "getting specific upstream revision/tag: $$svn_version"; \
tar --exclude=.svn -cjvf $(CURDIR)/$(DEB_SOURCE)_$(DEB_UPSTREAM_VERSION).orig.tar.bz2 `ls | head -n 1`; \
cd $(CURDIR); \
rm -rf $$tmpdir
.PHONY: get-orig-source
|