rules 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/make -f
  2. DIR:=$(shell pwd)
  3. arch=$(shell dpkg --print-architecture)
  4. cidir=debian/tmp/DEBIAN
  5. build:
  6. $(checkdir)
  7. ./configure --prefix=/usr
  8. $(MAKE)
  9. touch build
  10. clean:
  11. $(checkdir)
  12. -rm -f build
  13. -$(MAKE) -i distclean || $(MAKE) -f Makefile.in -i distclean
  14. -rm -rf debian/tmp* *~ *.orig ./#*# tmp.* debian/files*
  15. -rm -f config.cache config.status config.h install config.log
  16. find -name '*~' -print0 | xargs -r0 rm --
  17. binary: checkroot build
  18. -rm -rf debian/tmp
  19. install -d debian/tmp debian/tmp/DEBIAN
  20. install -d debian/tmp/usr/doc/{copyright,dpkg}
  21. set -e; if [ $(arch) = i386 ]; then \
  22. dpkg-gencontrol -Vlibcver=' (>= 5.2.18-2)' >$(cidir)/control ; \
  23. sed -e 's/^# i386elf: //' <debian/preinst >$(cidir)/preinst ; \
  24. else \
  25. dpkg-gencontrol -Vlibcver='' >$(cidir)/control ; \
  26. sed -e '/^# i386elf: /d' debian/preinst >$(cidir)/preinst ; \
  27. fi
  28. cp debian/{prerm,postinst} debian/tmp/DEBIAN/.
  29. chmod +x debian/tmp/DEBIAN/{postinst,prerm,preinst}
  30. $(MAKE) prefix=$(DIR)/debian/tmp/usr \
  31. datadir=$(DIR)/debian/tmp/var/lib/dpkg \
  32. etcdir=$(DIR)/debian/tmp/etc \
  33. install
  34. cp debian/copyright debian/tmp/usr/doc/copyright/dpkg
  35. cp TODO debian/tmp/usr/doc/dpkg/WISHLIST
  36. touch debian/tmp/var/lib/dpkg/{status,available}
  37. chown -R root.root debian/tmp
  38. chmod -R g-ws debian/tmp
  39. set -e; cd debian/tmp; \
  40. version=`sed -n 's/^Version: //p' DEBIAN/control`; \
  41. file=dpkg_$${version}_$(arch).nondebbin.tar; \
  42. tar cf ../../../$${file} usr var && gzip -9vf ../../../$${file}; \
  43. cd ../..; dpkg-distaddfile $${file}.gz byhand -
  44. mv debian/tmp/usr/bin/dpkg-deb{,.dist}
  45. rm debian/tmp/var/lib/dpkg/{status,available}
  46. dpkg-deb --build debian/tmp ..
  47. define checkdir
  48. test -f include/dpkg.h
  49. endef
  50. checkroot:
  51. $(checkdir)
  52. test root = "`whoami`"
  53. .PHONY: binary source diff clean checkroot