X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=debian%2Frules;fp=debian%2Frules;h=db69878a501182f34119d5ff8226cb43dd60db42;hb=74e64be8b45a7ff22f994552a95c797575dbe384;hp=0000000000000000000000000000000000000000;hpb=2ae34928adb5da51a66170a52678bb4a7d2d212a;p=cp210x.git diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..db69878 --- /dev/null +++ b/debian/rules @@ -0,0 +1,123 @@ +#!/usr/bin/make -f +# debian/rules file - for cp210x-module-dkms +# Based on sample debian/rules file - for GNU Hello (1.3). +# Copyright 1994,1995 by Ian Jackson. +# Copyright 1998-2007 James Troup +# I hereby give you perpetual unlimited permission to copy, +# modify and relicense this file, provided that you do not remove +# my name from the file itself. (I assert my moral right of +# paternity under the Copyright, Designs and Patents Act 1988.) +# This file may have to be extensively modified + +package = $(shell dpkg-parsechangelog --show-field Source) +version = $(shell dpkg-parsechangelog --show-field Version) +module = $(shell echo "$(package)" | sed -e 's|-module-dkms||g') +distribution = $(shell dpkg-parsechangelog --show-field Distribution) +repoid = $(git describe --tags --always --long --dirty) +inst_dir = debian/tmp/usr/src/$(package)-$(version) + +install_dir = install -d -m 755 +install_file = install -m 644 +install_script = install -m 755 +install_binary = install -m 755 -s + + +configure: configure-stamp +configure-stamp: + @find . -name "*.in" | while read file; do \ + t=$$(dirname $$file)/$$(basename $$file .in); \ + echo "Preprocessing $$t ..."; \ + cp -a $$file $$t; \ + perl -i -pe 's/xxPACKAGExx/$(package)/g' $$t; \ + perl -i -pe 's/xxDEBVERxx/$(version)/g' $$t; \ + perl -i -pe 's/xxMODULExx/$(module)/g' $$t; \ + perl -i -pe 's/xxREPOIDxx/$(repoid)/g' $$t; \ + done + touch $@ + + +build: build-stamp +build-stamp: configure-stamp + $(checkdir) + touch $@ + + +install: install-stamp +install-stamp: checkroot build-stamp + $(checkdir) + : # install dkms configuration + rm -rf debian/tmp + $(install_dir) $(inst_dir) + $(install_file) dkms.conf Makefile.dkms $(inst_dir)/ + : # install source files (configure must be executable) + cp -a src/* $(inst_dir)/ + rm -rf $(inst_dir)/Docs + rm -rf $(inst_dir)/examples + rm -rf $(inst_dir)/rpm + : # Include file to shared path + $(install_dir) debian/tmp/usr/include + cp -a $(inst_dir)/cp210x.h debian/tmp/usr/include/ + : # install module configuration (blacklist) + $(install_dir) debian/tmp/etc/modprobe.d + echo "blacklist cp2101" > debian/tmp/etc/modprobe.d/$(package).conf + touch $@ + + +binary-indep: checkroot build install + : # Nothing to do + + +binary-arch: checkroot build install + $(checkdir) + : # install maintainer scripts + $(install_dir) debian/tmp/DEBIAN + $(install_script) debian/postinst debian/tmp/DEBIAN/postinst + $(install_script) debian/prerm debian/tmp/DEBIAN/prerm + $(install_script) debian/postrm debian/tmp/DEBIAN/postrm + : # install docs + $(install_dir) debian/tmp/usr/share/doc/$(package)/ + $(install_file) debian/changelog \ + debian/tmp/usr/share/doc/$(package)/changelog.Debian + $(install_file) debian/copyright debian/tmp/usr/share/doc/$(package)/ + : # Compress stuff that needs it + find debian/tmp/usr/share/doc/$(package)/ -type f ! -name copyright | \ + xargs gzip -9 + : # install examples (after compression) + $(install_dir) debian/tmp/usr/share/doc/$(package)/examples + for i in src/examples/*; do \ + $(install_file) $$i debian/tmp/usr/share/doc/$(package)/examples/; \ + done + : # Finish it all up + dpkg-gencontrol -isp $(CONFLICTS) + chown -R root:root debian/tmp + chmod -R go=rX debian/tmp + dpkg --build debian/tmp .. + + +binary: binary-indep binary-arch + + +clean: + $(checkdir) + -rm -rf debian/tmp + -rm -fr debian/patched debian/files* debian/substvars + : # Clean all but debian/control, since git-buildpackage cleans after + : # prebuild just before building + find . -name "*.in" | while read file; do \ + t=$$(dirname $$file)/$$(basename $$file .in); \ + [ "$$t" != "./debian/control" ] && rm -f $$t; \ + done + -rm -f *-stamp + + +define checkdir + test -f debian/rules +endef + + +checkroot: + $(checkdir) + test root = "`whoami`" + + +.PHONY: binary clean checkroot