#!/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=1 export HOTPLUG_FIRMWARE=1 -include /usr/share/dpatch/dpatch.make ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) CFLAGS += -g endif ## MODULE-ASSISTANT STUFF # prefix of the target package name PREFIX:=zaptel SKPG:=$(PREFIX)-source PACKAGE:=$(PREFIX)-modules # 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/') UPVERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//' -e 's/~dfsg$$//') UPFILENAME := zaptel_$(UPVERSION).orig.tar.gz FILENAME := zaptel_$(UPVERSION)~dfsg.orig.tar.gz URL := http://ftp2.digium.com/pub/zaptel/releases/zaptel-$(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 := version.h radfw.h tor2fw.h EXTRA_MODS=ds1x1f opvxa1200 ifneq (,$(filter-out powerpc m68k armeb mips,$(shell dpkg-architecture -qDEB_HOST_ARCH))) EXTRA_MODS += wcopenpci endif BRISTUFF_MODULES=cwain qozap zaphfc ztgsm MOD_EXAMPLES_DIR:=modexamples ifeq (1,$(USE_BRISTUFF)) BRISTUFF_EXAMPLES:=$(MOD_EXAMPLES_DIR)/* # bristuff modules that are copied from a subdirectory to the current # directory. GENERATED_SOURCES+=$(BRISTUFF_MODULES:%=%.c) $(BRISTUFF_MODULES:%=%.h) EXTRA_MODS+=$(BRISTUFF_MODULES) EXTRA_SUBDIRS += vzaphfc endif ifeq ($(ECHO_CAN_NAME),OSLEC) EXTRA_SUBDIRS += oslec endif 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_clean -k cp -a $(CURDIR)/debian/generated/* . ./configure 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_installchangelogs dh_compress dh_fixperms dh_installdeb dh_gencontrol -- -v$(VERSION) dh_md5sums dh_builddeb --destdir=$(DEB_DESTDIR) ## END OF M-A SECTION tonezones.txt: zonedata.c echo >$@ "# A list of tonezones supported by this copy of zaptel and libtonezones:" grep '[[:space:]]\+{[[:space:]]\+[[:digit:]]\+,' zonedata.c \ | awk -F\" '{ print $$2"\t"$$4 }' \ >>$@ # A workaround for version incompatibility of asciidoc to fix Sarge build. # This is fixed properly upstream svn, but adding an autoconf patch is # just as much work. Remove this on Zaptel 1.4.6. debian/fake/asciidoc: mkdir -p $(@D) echo '#!/bin/sh' >$@ echo 'exec /usr/bin/asciidoc -b xhtml "$$@"' >>$@ chmod a+x $@ ASCIIDOC_6_TEST = asciidoc --version 2>&1 | grep -q 'asciidoc 6' ASCIIDOC_SET_PATH = if $(ASCIIDOC_6_TEST); then \ PATH=$(CURDIR)/debian/fake:$$PATH; export PATH; \ fi build: build-stamp build-stamp: patch-stamp tonezones.txt dh_testdir ./configure $(MAKE) $(GENERATED_SOURCES) $(ASCIIDOC_SET_PATH) ; \ $(MAKE) programs README.html xpp/README.Astribank.html touch $@ clean: clean-unpatched unpatch clean-unpatched: dh_testdir dh_testroot rm -f *-stamp # Add here commands to clean up after the build process. rm -rf $(MOD_EXAMPLES_DIR) rm -f tonezones.txt rm -f $(GENERATED_SOURCES) rm -rf debian/fake # * Makefile does not exist when running svn-buildpackage # as the source tree is not there. # * menuselect/ does not exist when building the -modules # packages - we only build kernel-space stuff there. [ ! -f Makefile ] || [ ! -d menuselect ] || $(MAKE) dist-clean #rm -f debian/manpage.links debian/manpage.refs debian/*.8 dh_clean install: install-arch install-indep install-arch: build-stamp dh_testdir dh_testroot dh_clean -k -a dh_installdirs -a # Add here commands to install the package into debian/tmp $(MAKE) install-programs DESTDIR=$(CURDIR)/debian/tmp $(MAKE) install-libs DESTDIR=$(CURDIR)/debian/tmp /sbin/ldconfig -n $(CURDIR)/debian/tmp/usr/lib install -D -m 644 tonezone.h $(CURDIR)/debian/tmp/usr/include/zaptel/tonezone.h dh_install -a --sourcedir=$(CURDIR)/debian/tmp cp debian/$(PREFIX).lintian \ $(CURDIR)/debian/$(PREFIX)/usr/share/lintian/overrides/$(PREFIX) TARPARDIR=$(CURDIR)/debian/tmp TARDIR=$(TARPARDIR)/modules/$(PREFIX) install-indep: build-stamp dh_testdir dh_testroot dh_clean -k -i dh_installdirs -i # driver source code mkdir -p $(TARDIR)/debian/generated cp Makefile Makefile.kernel26 configure install-sh makeopts.in .version *.c *.h *.rbt $(TARDIR)/ for dir in build_tools firmware include vzaphfc oct612x oslec \ wct4xxp wctc4xxp wctdm24xxp wcte12xp xpp; do \ if [ -d $$dir ]; then cp -r $$dir $(TARDIR); fi; \ done cp -a $(GENERATED_SOURCES) $(TARDIR)/debian/generated/ dh_install -i zaptel.h usr/include/zaptel/ dh_install -pzaptel-firmware xpp/firmwares/*.hex usr/share/zaptel/ # Packaging infrastructure cp -r debian/rules debian/changelog debian/copyright\ debian/control debian/compat \ debian/control.modules.in \ $(TARDIR)/debian/ tar cjf debian/$(PREFIX)-source/usr/src/$(PREFIX).tar.bz2 \ -C $(TARPARDIR) modules ifeq (1,$(USE_BRISTUFF)) set -e; for module in cwain qozap zaphfc ztgsm; do \ mkdir -p $(MOD_EXAMPLES_DIR)/$$module; \ cp -a $$module/*.conf* $(MOD_EXAMPLES_DIR)/$$module; \ done else mkdir -p $(MOD_EXAMPLES_DIR)/bristuff_stub endif # Build architecture-independent files here. binary-indep: build install-indep dh_testdir dh_testroot dh_installdocs -i dh_installchangelogs -i ChangeLog dh_installexamples -i $(BRISTUFF_EXAMPLES) dh_link -i dh_compress -i dh_fixperms -i dh_installdeb -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i # Build architecture-dependent files here. binary-arch: build install-arch dh_testdir dh_testroot #install -m644 debian/$(PREFIX).modprobe.d debian/$(PREFIX)/etc/modprobe.d/$(PREFIX) dh_installdocs -a # should be removed, eventually. Still left for compatibility dh_installinit --update-rcd-params="defaults 15 30" dh_installexamples -a zaptel.conf.sample \ oslec/oslec-ctrl-panel.sh #dh_installmodules -a dh_installchangelogs -a ChangeLog dh_link -a dh_strip -a dh_compress -a dh_fixperms -a dh_makeshlibs -a -V dh_installdeb -a dh_shlibdeps -a -ldebian/libtonezone1/usr/lib dh_gencontrol -a dh_md5sums -a dh_builddeb -a print-version: @@echo "Debian version: $(DEBVERSION)" @@echo "Upstream version: $(UPVERSION)" TARBALL_DIR=../tarballs/zaptel-$(UPVERSION).tmp get-orig-source: @@dh_testdir @@[ -d ../tarballs/. ]||mkdir -p ../tarballs @@echo Downloading $(UPFILENAME) from $(URL) ... @@wget -N -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)/zaptel-$(UPVERSION)/wct4xxp/OCT*.ima @@rm -rf $(TARBALL_DIR)/zaptel-$(UPVERSION)/wctc4xxp/*.bin @@rm -rf $(TARBALL_DIR)/zaptel-$(UPVERSION)/xpp/firmwares/*.hex @@cd $(TARBALL_DIR) ; \ tar cfz ../$(FILENAME) * @@echo Cleaning up... @@$(RM) -rf $(TARBALL_DIR)/ @@$(RM) -f ../tarballs/$(UPFILENAME) binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure patch unpatch