2008-08-02

Minimal debian/rules for dh7+dpatch

I got a new package to start from scratch (amule-emc, ITP) so I wanted to try debhelper 7. In need of patching upstream source code, I used my old friend dpatch, but then started to have some problems putting things together; so, here below is the minimal debian/rules to use dh7+dpatch:


#!/usr/bin/make -f
include /usr/share/dpatch/dpatch.make

build: build-stamp
build-stamp: patch-stamp
dh build
touch $@

clean:
dh clean

%:
dh $@

Thanks to jcristau and noshadow from #debian-devel@OFTC for opening my eyes ;)

Edited: thanks to Joey's comment, I was able to reduce it again down to:


#!/usr/bin/make -f

include /usr/share/dpatch/dpatch.make

build: patch-stamp
dh build

clean: unpatch
dh clean

%:
dh $@

4 comments:

Unknown said...
This comment has been removed by the author.
Anonymous said...

AFAICS, the explicit clean target is not needed.

Since the patch target has its own patch-stamp, there's really no need to use a build-stamp (dh build will avoid re-reunning any build commands if the build target is called multiple times).

Arn't you missing a call to the unpatch target? Maybe the clean target is actually needed, to depend on unpatch?

Sandro Tosi said...

thanks Joey for the comment! The explicit clean target is because I need an unpatch dep (missing, you spotted it) and since dh build is smarter than my, I was able to reduce the debian/rules down to (editing the original post):

#!/usr/bin/make -f

include /usr/share/dpatch/dpatch.make

build: patch-stamp
dh build

clean: unpatch
dh clean

%:
dh $@

tyler said...

Actually, you should be able to reduce that to:
---
#!/usr/bin/make -f
%:
dh $@

include /usr/share/dpatch/dpatch.make
build: patch-stamp
clean: unpatch
---
and get the same results.