1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-22 12:36:17 +02:00

debian/rules: rewrite as a minimal debian/rules file (using dh)

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@gmail.com>
This commit is contained in:
Jonathan Nieder 2010-04-04 22:42:07 -05:00 committed by Xiangfu Liu
parent da4424df4b
commit 3d82483481
4 changed files with 146 additions and 105 deletions

View File

@ -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@gmail.com> Sun, 04 Apr 2010 20:19:16 -0500
xburst-tools (0.0+201002-1) unstable; urgency=low
* work with software usbboot

109
usbboot/debian/clean.sh Normal file
View File

@ -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

View File

@ -2,8 +2,11 @@ Source: xburst-tools
Section: misc
Priority: extra
Maintainer: Xiangfu Liu <xiangfu@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

View File

@ -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)
override_dh_auto_configure:
AUTOMAKE="automake --foreign" autoreconf -is
dh_auto_configure -- $(opt_optimize) $(opt_quiet) LDFLAGS=-Wl,-z,defs
opt_optimize = CFLAGS="-g -O2"
opt_no_act =
opt_quiet =
ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
opt_optimize = CFLAGS="-g -O0"
endif
configure:
./autogen.sh
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
ifneq (,$(findstring n,$(MAKEFLAGS)))
opt_no_act = --no-act
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
cp -f /usr/share/misc/config.guess config.guess
ifneq (,$(filter quiet,$(DEB_BUILD_OPTIONS)))
opt_quiet = --quiet
MAKEFLAGS += --quiet
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
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install