deb-common.mk 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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_single_job
  29. _init_deb_single_job:
  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: init-deb
  40. init-deb:
  41. $(MAKE) --jobs=1 _init_deb_single_job
  42. .PHONY: lint-deb
  43. lint-deb:
  44. @if [ -d "$(DIR_DEBIAN_BUILD)" ]; then \
  45. find "$(DIR_DEBIAN_BUILD)" -type f -name "*.changes"; fi \
  46. | xargs --max-args=1 --no-run-if-empty lintian $(LINTIAN_ARGS)
  47. .PHONY: clean-deb-export
  48. clean-deb-export:
  49. $(RM) -r "$(DIR_DEBIAN_SIMPLIFIED_PACKAGE_FILES)"
  50. .PHONY: clean
  51. clean: clean-deb-export