diff --git a/debian/rules b/debian/rules index 84e41c3f4..416e05489 100755 --- a/debian/rules +++ b/debian/rules @@ -218,18 +218,39 @@ binary: binary-indep binary-arch # Makes the master debian/control file by substituting # variable values into the template. # +archs := $(shell find debian/arch/ -mindepth 1 -maxdepth 1 -type d ! -name '.svn' -printf '%f\n') debian/control: debian/templates/control.main.in - cat debian/templates/control.source.in \ - debian/templates/control.main.in \ - `find debian/arch -name control.in` | \ - sed -e 's/@version@/$(version)/g' \ - -e 's/@major@/$(major)/g' \ - -e 's/@ltver@/$(ltver)/g' \ - -e 's/@srcver@/$(srcver)/g' \ - -e 's/@lt_depends@/$(lt_depends)/g' \ - -e 's/@lt_provides@/$(lt_provides)/g' \ - -e 's/@abiname@/$(abiname)/g' | \ - sed '/^[[:space:]]*$$/d' | \ - sed 's/^Package:/\n&/g' > debian/control + rm -f control.tmp 2>/dev/null + substitute() { \ + cat debian/templates/control.$$1 | \ + sed -e 's/@version@/$(version)/g' \ + -e 's/@major@/$(major)/g' \ + -e "s/@arch@/$$2/g" \ + -e 's/@subarch@//g' \ + -e "s/@flavour@/$$3/g" \ + -e 's/@ltver@/$(ltver)/g' \ + -e 's/@srcver@/$(srcver)/g' \ + -e 's/@lt_depends@/$(lt_depends)/g' \ + -e 's/@lt_provides@/$(lt_provides)/g' \ + -e 's/@abiname@/$(abiname)/g' | \ + sed '/^[[:space:]]*$$/d' | \ + sed 's/^Package:/\n&/g'; \ + }; \ + list_flavours() { \ + find debian/arch/$$1/ -name 'config.*' \ + ! -name '*.svn*' -printf '%f\n' | \ + sed 's/^config\.//'; \ + }; \ + substitute source.in "" "" >> control.tmp; \ + substitute main.in "" "" >> control.tmp; \ + substitute headers.in "" "" >> control.tmp; \ + for a in $(archs); do \ + substitute headers.arch.in $$a "" >> control.tmp; \ + for f in $$(list_flavours $$a); do \ + substitute headers.flavour.in $$a $$f >> control.tmp; \ + substitute image.in $$a $$f >> control.tmp; \ + done; \ + done + mv control.tmp debian/control .PHONY: clean build unpack binary-indep binary-arch binary patch unpatch source tree