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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# This is the debhelper compatibility version to use.
USE_BRISTUFF=0
export HOTPLUG_FIRMWARE=1
-include /usr/share/quilt/quilt.make
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -g
endif
## MODULE-ASSISTANT STUFF
# prefix of the target package name
PREFIX:=dahdi
SKPG:=$(PREFIX)-source
PACKAGE:=$(PREFIX)-modules
PACKAGE_SRC:=$(PREFIX)-linux
# modifieable for experiments or debugging m-a
MA_DIR ?= /usr/share/modass
# load generic variable handling
-include $(MA_DIR)/include/generic.make
# load default rules
-include $(MA_DIR)/include/common-rules.make
DEBVERSION:=$(shell head -n 1 debian/changelog \
| sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
DEB_BASE_VERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9~.a-z]*$$//')
UPVERSION:=$(shell echo $(DEB_BASE_VERSION) | sed -e 's/[~+]dfsg\(~\|$$\)/\1/' -e 's/~\(rc\|beta\)/-\1/')
UPFILENAME := $(PACKAGE_SRC)_$(UPVERSION).orig.tar.gz
FILENAME := $(PACKAGE_SRC)_$(DEB_BASE_VERSION).orig.tar.gz
URL := http://downloads.asterisk.org/pub/telephony/$(PACKAGE_SRC)/releases/$(PACKAGE_SRC)-$(UPVERSION).tar.gz
# If the makefile was properly-writen, there was a good separation
# between kernel and userspace. As things stand now I'd like to work
# around problems with bilding stuff with HOSTCC by simply providing
# the generated headers as part of the source:
GENERATED_SOURCES := include/dahdi/version.h
EXTRA_MODS=opvxa1200
ifneq (,$(filter-out powerpc m68k armeb mips,$(shell dpkg-architecture -qDEB_HOST_ARCH)))
EXTRA_MODS += wcopenpci
endif
EXTRA_SUBDIRS += zaphfc ../staging/echo
EXTRA_MODS += dahdi_echocan_oslec
MOD_ARGS=MODULES_EXTRA="$(EXTRA_MODS)" SUBDIRS_EXTRA="$(EXTRA_SUBDIRS)"
kdist_clean: clean-unpatched
kdist_config: prep-deb-files
binary-modules: prep-deb-files
dh_testdir
dh_testroot
dh_prep
#cp -a $(CURDIR)/debian/generated/* .
make $(MOD_ARGS) modules KERNEL_SOURCES=$(KSRC) MODVERSIONS=detect KERNEL=linux-$(KVERS)
make $(MOD_ARGS) install-modules KERNELRELEASE=$(KVERS) DESTDIR=$(CURDIR)/debian/$(PKGNAME)
ifeq (2.6,$(shell echo $(KVERS) | cut -d. -f1-2))
# The 2.6 modules are way too big. This is only in kernel 2.6
find debian/$(PKGNAME)/lib/modules -name '*.ko' |xargs strip -g
$(RM) -f debian/$(PKGNAME)/lib/modules/$(KVERS)/modules.*
endif
dh_installmodules
dh_installdebconf
dh_installdocs
dh_installchangelogs
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol -- -v$(VERSION)
dh_md5sums
dh_builddeb --destdir=$(DEB_DESTDIR)
## END OF M-A SECTION
build: patch build-stamp
build-stamp:
dh_testdir
$(MAKE) docs
for mod in $(BRISTUFF_MODULES); do for i in c h; do \
ln -s $$mod/$$mod.$$i drivers/dahdi/$$mod.$$i; \
done; done
$(MAKE) $(GENERATED_SOURCES)
touch $@
clean: clean-unpatched unpatch
clean-unpatched:
dh_testdir
dh_testroot
rm -f *-stamp
# Delete the generated bristuff symlinks:
$(RM) -f $(BRISTUFF_MODULES:%=%.[ch])
# Add here commands to clean up after the build process.
rm -f $(GENERATED_SOURCES)
# * Makefile does not exist when running svn-buildpackage
# as the source tree is not there.
# FIXME: This will fail with an ugly warning on the clean of the
# modules build. However only fter the actuual clean.
rm -f dahdi/include/version.h
[ ! -f Makefile ] || $(MAKE) dist-clean || true
dh_clean
TARPARDIR=$(CURDIR)/debian/tmp
TARDIR=$(TARPARDIR)/modules/$(PREFIX)
install: build-stamp
dh_testdir
dh_testroot
dh_prep
dh_installdirs
$(MAKE) install-include DESTDIR=$(CURDIR)/debian/$(SKPG)
dh_install
# driver source code
mkdir -p $(TARDIR)/debian/generated
cp Makefile $(TARDIR)/
cp -p .version $(TARDIR)/
for dir in build_tools firmware include drivers; do \
if [ -d $$dir ]; then cp -r $$dir $(TARDIR); fi; \
done
# Packaging infrastructure
cp -r debian/rules debian/changelog debian/copyright\
debian/control debian/compat \
debian/control.modules.in \
$(TARDIR)/debian/
tar cjf debian/$(SKPG)/usr/src/$(PREFIX).tar.bz2 \
-C $(TARPARDIR) modules
dh_installudev --name=dahdi
# Build architecture-independent files here.
binary: install
dh_testdir
dh_testroot
dh_installdocs
dh_installchangelogs -i ChangeLog
dh_installexamples -i
dh_perl
dh_link
dh_compress
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
print-version:
@@echo "Debian version: $(DEBVERSION)"
@@echo "Upstream version: $(UPVERSION)"
# For the record: updating openvox drivers:
# wget 'http://www.openvox.cn/viewvc/dahdi/trunk/opvxa1200.c?view=co' \
# | sed -e '\r$//' >drivers/dahdi/opvxa1200.c
#
# Updating the zaphfc drivers:
# rm -rf old new
# mkdir -p old new/drivers/dahdi
# svn export http://zaphfc.googlecode.com/svn/branches/2.2/zaphfc/ new/drivers/dahdi/zaphfc
# diff -Npur --no-timestamps old new >debian/patches/zaphfc
# rm -rf old new
TARBALL_DIR=../tarballs/$(PACKAGE_SRC)-$(UPVERSION).tmp
get-orig-source:
@@dh_testdir
@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
@@echo Downloading $(UPFILENAME) from $(URL) ...
@@wget -nv -T10 -t3 --verbose -O ../tarballs/$(UPFILENAME) $(URL)
@@echo Repacking as DFSG-free...
@@mkdir -p $(TARBALL_DIR)/
@@cd $(TARBALL_DIR) ; \
tar xfz ../$(UPFILENAME)
@@rm -rf $(TARBALL_DIR)/$(PACKAGE_SRC)-$(UPVERSION)/drivers/dahdi/xpp/firmwares/*.hex
@@cd $(TARBALL_DIR) ; \
tar cfz ../$(FILENAME) *
@@echo Cleaning up...
@@$(RM) -rf $(TARBALL_DIR)/
@@$(RM) -f ../tarballs/$(UPFILENAME)
.PHONY: build clean binary install configure patch unpatch
|