[PATCH 3/6] debian/rules: rewrite as a minimal debian/rules file (using dh)
Jonathan Nieder
jrnieder at gmail.com
Sun Apr 4 23:42:07 EDT 2010
This makes the packaging easier to read and modify.
Features added:
* runs ‘make’ with the -j option for a tiny speedup
* uses appropriate compiler flags even when run directly instead of
through dpkg-buildpackage
* after interrupting a partial build, there is no need any more
for (fake) root privileges to clean up
* after interrupting a partial build, ‘debian/rules clean’ will
work without running autoreconf again.
Features retained:
* ‘debian/rules -n <target>’ provides the list of commands used
to make that target.
Signed-off-by: Jonathan Nieder <jrnieder at gmail.com>
---
usbboot/debian/changelog | 9 +++
usbboot/debian/clean.sh | 109 ++++++++++++++++++++++++++++++++++++++++
usbboot/debian/control | 7 ++-
usbboot/debian/rules | 124 ++++++++-------------------------------------
4 files changed, 145 insertions(+), 104 deletions(-)
create mode 100644 usbboot/debian/clean.sh
diff --git a/usbboot/debian/changelog b/usbboot/debian/changelog
index f756dd2..fe389ae 100644
--- a/usbboot/debian/changelog
+++ b/usbboot/debian/changelog
@@ -1,3 +1,12 @@
+xburst-tools (0.0+201002-1.1) local; urgency=low
+
+ * debian/rules: rewrite as a minimal rules file using dh
+ + Build-Depends: debhelper (>= 7.4.10), for the --parallel option.
+ * Standards-Version: 3.8.4
+ * Build-Conflicts: automake1.4
+
+ -- Jonathan Nieder <jrnieder at gmail.com> Sun, 04 Apr 2010 20:19:16 -0500
+
xburst-tools (0.0+201002-1) unstable; urgency=low
* work with software usbboot
diff --git a/usbboot/debian/clean.sh b/usbboot/debian/clean.sh
new file mode 100644
index 0000000..8834847
--- /dev/null
+++ b/usbboot/debian/clean.sh
@@ -0,0 +1,109 @@
+#!/bin/sh
+# Clean up after a failed build.
+#
+# Requires access to .gitignore files excluding _all_ modified files.
+#
+# Requires a working /dev/fd (with more than just /dev/fd/0 and 1)
+# or gawk.
+
+set -e
+
+splitgitignore='#!/usr/bin/awk
+!/^#/ && !/^$/ {
+ glob = /[[*?]/;
+ directory = /\/$/;
+ sub(/\/$/, "");
+ anchored = /\//;
+ sub(/^\//, "");
+
+ output = "nonexistent/nonsense";
+ if (anchored) {
+ if (!directory && !glob)
+ output = "/dev/fd/1";
+ else if (directory && !glob)
+ output = "/dev/fd/3";
+ else if (!directory && glob)
+ output = "/dev/fd/4";
+ else if (directory && glob)
+ output = "/dev/fd/5";
+ } else {
+ if (!directory)
+ output = "/dev/fd/6";
+ else
+ output = "/dev/fd/7";
+ }
+ print >> output;
+}
+'
+
+gitdir="-type d -name '.*' -prune"
+debiandir="-type d -name debian -prune"
+
+remove_file_globs() {
+ while read glob
+ do
+ eval "rm -f $glob"
+ done
+}
+
+remove_directory_globs() {
+ while read glob
+ do
+ eval "rm -fr $glob"
+ done
+}
+
+remove_file_findpatterns() {
+ while read pat
+ do
+ find . $gitdir -o \
+ '(' -name "$pat" -execdir rm -f '{}' + ')'
+ done
+}
+
+remove_directory_findpatterns() {
+ while read pat
+ do
+ find . $gitdir -o \
+ '(' -type d -name "$pat" -execdir rm -fr '{}' + ')'
+ done
+}
+
+find . $gitdir -o $debiandir -o '(' -name .gitignore -print ')' |
+while read file
+do
+ (
+ cd "$(dirname "$file")"
+ # Dispatch using pipes. Yuck.
+ { { { { {
+ awk "$splitgitignore" |
+ {
+ # anchored files (globless)
+ xargs -d '\n' rm -f
+ }
+ } 3>&1 >&2 |
+ {
+ # anchored directories (globless)
+ xargs -d '\n' rm -fr
+ }
+ } 4>&1 >&2 |
+ {
+ # anchored files
+ remove_file_globs
+ }
+ } 5>&1 >&2 |
+ {
+ # anchored directories
+ remove_directory_globs
+ }
+ } 6>&1 >&2 |
+ {
+ # unanchored files
+ remove_file_findpatterns
+ }
+ } 7>&1 >&2 |
+ {
+ remove_directory_findpatterns
+ } >&2
+ ) < "$file"
+done
diff --git a/usbboot/debian/control b/usbboot/debian/control
index da36cb2..22c13a3 100644
--- a/usbboot/debian/control
+++ b/usbboot/debian/control
@@ -2,8 +2,11 @@ Source: xburst-tools
Section: misc
Priority: extra
Maintainer: Xiangfu Liu <xiangfu at qi-hardware.com>
-Build-Depends: debhelper (>= 7), pkg-config, autoconf, automake, libusb-dev, libconfuse-dev
-Standards-Version: 3.8.2
+Build-Depends: debhelper (>= 7.4.10),
+ pkg-config, autoconf, automake,
+ libusb-dev, libconfuse-dev
+Build-Conflicts: automake1.4
+Standards-Version: 3.8.4
Homepage: http://projects.qi-hardware.com/index.php/p/xburst-tools/
Package: xburst-tools
diff --git a/usbboot/debian/rules b/usbboot/debian/rules
index 7ed5fa5..ccaff2d 100755
--- a/usbboot/debian/rules
+++ b/usbboot/debian/rules
@@ -1,111 +1,31 @@
#!/usr/bin/make -f
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
+# This file is in the public domain.
+# You may freely use, modify, distribute, and relicense it.
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+build clean install binary-arch binary-indep binary:
+ +dh --parallel $(opt_no_act) $@
+override_dh_auto_clean:
+ dh_auto_clean
+ sh debian/clean.sh
-# These are used for cross-compiling and for saving the configure script
-# from having to guess our platform (since we know it already)
-DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
-CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
-else
-CROSS= --build $(DEB_BUILD_GNU_TYPE)
-endif
-
+override_dh_auto_configure:
+ AUTOMAKE="automake --foreign" autoreconf -is
+ dh_auto_configure -- $(opt_optimize) $(opt_quiet) LDFLAGS=-Wl,-z,defs
-configure:
- ./autogen.sh
+opt_optimize = CFLAGS="-g -O2"
+opt_no_act =
+opt_quiet =
-config.status: configure
- dh_testdir
- # Add here commands to configure the package.
-ifneq "$(wildcard /usr/share/misc/config.sub)" ""
- cp -f /usr/share/misc/config.sub config.sub
-endif
-ifneq "$(wildcard /usr/share/misc/config.guess)" ""
- cp -f /usr/share/misc/config.guess config.guess
+ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
+ opt_optimize = CFLAGS="-g -O0"
endif
- ./configure $(CROSS) --prefix=/usr --sysconfdir=/etc --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
-
-
-build: build-stamp
-
-build-stamp: config.status
- dh_testdir
-
- # Add here commands to compile the package.
- $(MAKE)
- #docbook-to-man debian/usbboot.sgml > usbboot.1
-
- touch $@
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp
- rm -f debian/stamp-autothings-update
- @# Delete generated files, we don't want them in the diff.
- rm -f aclocal.m4 config.h.in configure Makefile.in m4/install-sh
- rm -f m4/missing m4/depcomp src/Makefile.in src/xburst-tools_version.h
-
- # Add here commands to clean up after the build process.
- [ ! -f Makefile ] || $(MAKE) distclean
- rm -f config.sub config.guess
-
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_prep
- dh_installdirs
-
- # Add here commands to install the package into debian/xburst-tools.
- $(MAKE) DESTDIR=$(CURDIR)/debian/xburst-tools install
-
-# Build architecture-independent files here.
-binary-indep: install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: install
- dh_testdir
- dh_testroot
- dh_installchangelogs ChangeLog
- dh_installdocs
-# dh_installexamples
-# dh_install
-# dh_installmenu
-# dh_installdebconf
-# dh_installlogrotate
-# dh_installemacsen
-# dh_installpam
-# dh_installmime
-# dh_python
-# dh_installinit
-# dh_installcron
-# dh_installinfo
- dh_installman
- dh_link
- dh_strip
- dh_compress
- dh_fixperms
-# dh_perl
-# dh_makeshlibs
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
+ifneq (,$(findstring n,$(MAKEFLAGS)))
+ opt_no_act = --no-act
+endif
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+ifneq (,$(filter quiet,$(DEB_BUILD_OPTIONS)))
+ opt_quiet = --quiet
+ MAKEFLAGS += --quiet
+endif
--
debian.1.7.0.3.1.469.g398f8
More information about the discussion
mailing list