deb-common.mk 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # common targets and definitions for debian packaging (simple deb packaging and pypi2deb)
  2. # "simplified" deb package files follow s simple filename pattern (e.g. "python3-foo.deb") without
  3. # any version numbers or architectures. They are useful for build artifact uploads.
  4. DIR_DEBIAN_SIMPLIFIED_PACKAGE_FILES ?= $(DIR_DEBIAN_BUILD)/export
  5. # "wildcard" resolves the home directory
  6. DEB_DPUT_CONFIG ?= $(wildcard ~/.dput.cf)
  7. DEBIAN_BUILD_ARCH := $(shell dpkg-architecture -q DEB_BUILD_ARCH 2>/dev/null || echo "unknown")
  8. # should be overwritten
  9. DEBIAN_UPLOAD_TARGET := custom
  10. LINTIAN_ARGS ?=
  11. .PHONY: help
  12. help: help-deb-common
  13. .PHONY: help-deb-common
  14. help-deb-common:
  15. @echo "deb-related targets common for all packaging methods:"
  16. @echo " check-dput-config"
  17. @echo " clean-deb-export"
  18. @echo " dist-deb-packages-directory"
  19. @echo " init-deb - prepare a deb package skeleton directory (by using 'dh_make')"
  20. @echo " lint-deb - run lintian for the deb package"
  21. @echo
  22. .PHONY: check-dput-config
  23. check-dput-config:
  24. @[ -e "$(DEB_DPUT_CONFIG)" ] || { \
  25. echo "Failed to find 'dput.cf' file ($(DEB_DPUT_CONFIG))."; \
  26. echo "You should provide this file or override its location (DEB_DPUT_CONFIG)."; \
  27. exit 1; } >&2
  28. .PHONY: init-deb
  29. init-deb:
  30. @if [ -d debian ]; then \
  31. echo >&2 "ERROR: cowardly refusing to run 'dh_make' while 'debian/' exists"; \
  32. exit 1; fi
  33. dh_make --copyright gpl3 --createorig \
  34. --packagename "$(notdir $(shell pwd))_$(call get_current_version)"
  35. @echo "An example 'debian/' directory was created. You should verify its content."
  36. @echo "Afterwards you may want to remove all debian/*.ex files (examples)."
  37. @echo "Read the Debian New Maintainer's Guide for more details:"
  38. @echo " https://www.debian.org/doc/manuals/maint-guide"
  39. .PHONY: lint-deb
  40. lint-deb:
  41. @if [ -d "$(DIR_DEBIAN_BUILD)" ]; then \
  42. find "$(DIR_DEBIAN_BUILD)" -type f -name "*.changes"; fi \
  43. | xargs --max-args=1 --no-run-if-empty lintian $(LINTIAN_ARGS)
  44. .PHONY: clean-deb-export
  45. clean-deb-export:
  46. $(RM) -r "$(DIR_DEBIAN_SIMPLIFIED_PACKAGE_FILES)"
  47. .PHONY: clean
  48. clean: clean-deb-export