# -*- mode: makefile; coding: utf-8 -*- # Copyright © 2002,2003 Colin Walters # Copyright © 2009-2014, 2016 Jonas Smedegaard # Description: Uses Debhelper to implement the binary package building stage # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . #### # General variables implemented by this rule file: # # DEB_INSTALL_DIRS_ALL # Subdirectories to create in installation staging directory for every package # DEB_INSTALL_DIRS_ or DEB_INSTALL_DIRS_DEFAULT # Like the above, but for a particular package , and created in later rule. # DEB_INSTALL_DOCS_ALL and either ..._ or ..._DEFAULT # Files which should go in /usr/share/doc/ # DEB_INSTALL_CHANGELOGS_ALL and either ..._ or ..._DEFAULT # File which should be interpreted as upstream changelog # DEB_COMPRESS_EXCLUDE_ALL and either ..._ or ..._DEFAULT # Regular expressions matching files which should not be compressed. # DEB_FIXPERMS_EXCLUDE_ALL and either ..._ or ..._DEFAULT # Regular expressions matching files which should not have their permissions changed. # DEB_CLEAN_EXCLUDE # Regular expressions matching files which should not be cleaned. # DEB_DH_ALWAYS_EXCLUDE # Force builddeb to exclude files. See the DH_ALWAYS_EXCLUDE section # in debhelper(7) for more details. # DEB_SHLIBDEPS_LIBRARY_ # The name of the current library package # DEB_SHLIBDEPS_INCLUDE # A space-separated list of library paths to search for dependency info # DEB_SHLIBDEPS_INCLUDE_ # Like the above, but for a particular package. # DEB_PERL_INCLUDE # A space-separated list of paths to search for perl modules # DEB_PERL_INCLUDE_ # Like the above, but for a particular package. # DEB_UPDATE_RCD_PARAMS_ALL and either ..._ or ..._DEFAULT # Arguments to pass to update-rc.d in init scripts #### # Special variables used by this rule file: # # DEB_DH_GENCONTROL_ARGS_ALL # Arguments passed directly to dh_gencontrol, for all packages # DEB_DH_GENCONTROL_ARGS_ # Arguments passed directly to dh_gencontrol, for a particular package # DEB_DH_GENCONTROL_ARGS # Completely override argument passing to dh_gencontrol. # DEB_DH_MAKESHLIBS_ARGS_ALL # Arguments passed directly to dh_makeshlibs, for all packages # DEB_DH_MAKESHLIBS_ARGS_ # Arguments passed directly to dh_makeshlibs, for a particular package # DEB_DH_MAKESHLIBS_ARGS # Completely override argument passing to dh_makeshlibs. # DEB_DH_SHLIBDEPS_ARGS_ALL # Arguments passed directly to dh_shlibdeps, for all packages # DEB_DH_SHLIBDEPS_ARGS_ # Arguments passed directly to dh_shlibdeps, for a particular package # DEB_DH_SHLIBDEPS_ARGS # Completely override argument passing to dh_shlibdeps. # DEB_DH_PERL_ARGS # Completely override argument passing to dh_perl. #### ifndef _cdbs_rules_debhelper _cdbs_rules_debhelper = 1 include debian/buildcore.mk ifeq ($(DEB_VERBOSE_ALL), yes) DH_VERBOSE = 1 endif #DEB_INSTALL_DIRS_ALL = # TODO: Use package-default var for internal defaults (not global-addon DEB_INSTALL_CHANGELOGS_ALL) DEB_INSTALL_CHANGELOGS_ALL ?= $(if $(DEB_ISNATIVE),\ ,\ $(wildcard $(patsubst %,$(DEB_SRCDIR)/%,\ ChangeLog Changelog Changes CHANGES changelog CHANGELOG))) # TODO: Use package-default var for internal defaults (not global-addon DEB_INSTALL_DOCS_ALL) DEB_INSTALL_DOCS_ALL ?= $(filter-out $(DEB_INSTALL_CHANGELOGS_ALL),\ $(wildcard $(patsubst %,$(DEB_SRCDIR)/%,\ README NEWS TODO BUGS AUTHORS CONTRIBUTORS CREDITS THANKS))) cdbs_add_dashx = $(foreach i,$(1),$(patsubst %,-X %,$(i))) cdbs_strip_quotes = $(subst ',,$(subst ",,$(1))) # hello emacs ' # TODO: Use DEB_DH_GENCONTROL_ARGS as package-default var (not global override) DEB_DH_GENCONTROL_ARGS ?= $(DEB_DH_GENCONTROL_ARGS_ALL) $(DEB_DH_GENCONTROL_ARGS_$(cdbs_curpkg)) # TODO: Use DEB_DH_MAKESHLIBS_ARGS as package-default var (not global override) DEB_DH_MAKESHLIBS_ARGS ?= $(DEB_DH_MAKESHLIBS_ARGS_ALL) $(DEB_DH_MAKESHLIBS_ARGS_$(cdbs_curpkg)) # TODO: Use DEB_DH_SHLIBDEPS_ARGS as package-default var (not global override) # TODO: Use DEB_SHLIBDEPS_INCLUDE as package-default var (not global addon) DEB_DH_SHLIBDEPS_ARGS ?= $(strip \ $(if $(DEB_SHLIBDEPS_LIBRARY_$(cdbs_curpkg)),\ -L $(DEB_SHLIBDEPS_LIBRARY_$(cdbs_curpkg))) \ $(if $(DEB_SHLIBDEPS_INCLUDE_$(cdbs_curpkg))$(DEB_SHLIBDEPS_INCLUDE),\ -l $(subst $(space),:,$(strip \ $(DEB_SHLIBDEPS_INCLUDE_$(cdbs_curpkg)) \ $(DEB_SHLIBDEPS_INCLUDE)))) \ $(DEB_DH_SHLIBDEPS_ARGS_ALL) \ $(DEB_DH_SHLIBDEPS_ARGS_$(cdbs_curpkg))) DEB_DH_BUILDDEB_ENV ?= $(if $(DEB_DH_ALWAYS_EXCLUDE),\ DH_ALWAYS_EXCLUDE=$(DEB_DH_ALWAYS_EXCLUDE)) # TODO: Use DEB_PERL_INCLUDE as package-default var (not global addon) DEB_DH_PERL_ARGS ?= $(strip \ $(DEB_PERL_INCLUDE_$(cdbs_curpkg)) \ $(DEB_PERL_INCLUDE)) _cdbs_deprecated_vars += $(patsubst %,DEB_DH_INSTALL%_ARGS$(comma)0.4.85,\ _CRON INIT EMACSEN PAM CHANGELOGS UDEV MIME) _cdbs_deprecated_vars += $(patsubst %,DEB_DH_%_ARGS$(comma)0.4.85,\ INSTALL STRIP COMPRESS FIXPERMS MD5SUMS BUILDDEB) _cdbs_deprecated_vars += $(patsubst %,DEB_%$(comma)0.4.85,\ UPDATE_RCD_PARAMS STRIP_EXCLUDE COMPRESS_EXCLUDE FIXPERMS_EXCLUDE) DEB_DH_INSTALL_CRON_ARGS_DEFAULT ?= $(DEB_DH_INSTALL_CRON_ARGS) DEB_DH_INSTALLINIT_ARGS_DEFAULT ?= $(DEB_DH_INSTALLINIT_ARGS) DEB_DH_INSTALLEMACSEN_ARGS_DEFAULT ?= $(DEB_DH_INSTALLEMACSEN_ARGS) DEB_DH_INSTALLPAM_ARGS_DEFAULT ?= $(DEB_DH_INSTALLPAM_ARGS) DEB_DH_INSTALLCHANGELOGS_ARGS_DEFAULT ?= $(DEB_DH_INSTALLCHANGELOGS_ARGS) DEB_DH_INSTALLUDEV_ARGS_DEFAULT ?= $(DEB_DH_INSTALLUDEV_ARGS) DEB_DH_INSTALLMIME_ARGS_DEFAULT ?= $(DEB_DH_INSTALLMIME_ARGS) DEB_DH_INSTALL_ARGS_DEFAULT ?= $(DEB_DH_INSTALL_ARGS) DEB_DH_STRIP_ARGS_DEFAULT ?= $(DEB_DH_STRIP_ARGS) DEB_DH_STRIP_NONDETERMINISM_ARGS_DEFAULT ?= $(DEB_DH_STRIP_NONDETERMINISM_ARGS) DEB_DH_COMPRESS_ARGS_DEFAULT ?= $(DEB_DH_COMPRESS_ARGS) DEB_DH_FIXPERMS_ARGS_DEFAULT ?= $(DEB_DH_FIXPERMS_ARGS) DEB_DH_MD5SUMS_ARGS_DEFAULT ?= $(DEB_DH_MD5SUMS_ARGS) DEB_DH_BUILDDEB_ARGS_DEFAULT ?= $(DEB_DH_BUILDDEB_ARGS) DEB_UPDATE_RCD_PARAMS_DEFAULT ?= $(DEB_UPDATE_RCD_PARAMS) DEB_STRIP_EXCLUDE_DEFAULT ?= $(DEB_STRIP_EXCLUDE) DEB_COMPRESS_EXCLUDE_DEFAULT ?= $(DEB_COMPRESS_EXCLUDE) DEB_FIXPERMS_EXCLUDE_DEFAULT ?= $(DEB_FIXPERMS_EXCLUDE) pre-build:: clean:: dh_clean $(call cdbs_add_dashx,$(DEB_CLEAN_EXCLUDE)) common-install-prehook-arch common-install-prehook-indep:: common-install-prehook-impl common-install-prehook-impl:: dh_prep $(call cdbs_add_dashx,$(DEB_CLEAN_EXCLUDE)) dh_installdirs -A $(DEB_INSTALL_DIRS_ALL) $(patsubst %,install/%,$(DEB_ALL_PACKAGES)):: install/%: dh_installdirs -p$(cdbs_curpkg) \ $(or $(DEB_INSTALL_DIRS),$(DEB_INSTALL_DIRS_$(cdbs_curpkg))) # Create .debs as we see fit $(patsubst %,binary/%,$(DEB_ALL_PACKAGES)):: binary/%: binary-makedeb/% #### # General Debian package creation rules. #### # This rule is called once for each package. It does the work # of installing to debian/; this includes running # dh_install to split the source from debian/tmp, as well as installing # ChangeLogs and the like. $(patsubst %,binary-install/%,$(DEB_ALL_PACKAGES)):: binary-install/%: dh_installdocs -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_INSTALL_DOCS) dh_installexamples -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_INSTALL_EXAMPLES) dh_installman -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_INSTALL_MANPAGES) dh_installinfo -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_INSTALL_INFO) dh_installmenu -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_INSTALL_MENU_ARGS) dh_installcron -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_INSTALL_CRON_ARGS) dh_installinit -p$(cdbs_curpkg) $(strip \ $(if $(call cdbs_expand_curvar,DEB_UPDATE_RCD_PARAMS),\ --update-rcd-params="$(call cdbs_strip_quotes,$(call cdbs_expand_curvar,DEB_UPDATE_RCD_PARAMS))") \ $(call cdbs_expand_curvar,DEB_DH_INSTALLINIT_ARGS)) dh_installdebconf -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_INSTALLDEBCONF_ARGS) dh_installemacsen -p$(cdbs_curpkg) $(strip \ $(if $(DEB_EMACS_PRIORITY),\ --priority=$(DEB_EMACS_PRIORITY)) \ $(if $(DEB_EMACS_FLAVOR),\ --flavor=$(DEB_EMACS_FLAVOR)) \ $(call cdbs_expand_curvar,DEB_DH_INSTALLEMACSEN_ARGS)) dh_installcatalogs -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_INSTALLCATALOGS_ARGS) dh_installpam -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_INSTALLPAM_ARGS) dh_installlogrotate -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_INSTALLLOGROTATE_ARGS) dh_installlogcheck -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_INSTALLLOGCHECK_ARGS) dh_installchangelogs -p$(cdbs_curpkg) $(strip \ $(call cdbs_expand_curvar,DEB_DH_INSTALLCHANGELOGS_ARGS) \ $(call cdbs_expand_curvar,DEB_INSTALL_CHANGELOGS)) $(if $(wildcard /usr/bin/dh_installudev),\ dh_installudev -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_INSTALLUDEV_ARGS)) $(if $(wildcard /usr/bin/dh_lintian),\ dh_lintian -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_LINTIAN_ARGS)) $(if $(wildcard /usr/bin/dh_bugfiles),\ dh_bugfiles -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_BUGFILES_ARGS)) dh_install -p$(cdbs_curpkg) $(strip \ $(if $(DEB_DH_INSTALL_SOURCEDIR),\ --sourcedir=$(DEB_DH_INSTALL_SOURCEDIR)) \ $(call cdbs_expand_curvar,DEB_DH_INSTALL_ARGS)) # TODO: Use DEB_DH_LINK_ARGS as package-default var (not global addon) dh_link -p$(cdbs_curpkg) $(strip \ $(DEB_DH_LINK_ARGS) \ $(DEB_DH_LINK_$(cdbs_curpkg))) dh_installmime -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_INSTALLMIME_ARGS) $(if $(wildcard /usr/bin/dh_installgsettings),\ dh_installgsettings -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_INSTALLGSETTINGS_ARGS)) # This rule is called after all packages have been installed, and their # post-install hooks have been run. common-binary-post-install-arch:: $(patsubst %,binary-post-install/%,$(DEB_ARCH_PACKAGES)) common-binary-post-install-indep:: $(patsubst %,binary-post-install/%,$(DEB_INDEP_PACKAGES)) # This rule is called once for each package; it's a general hook # to do things like remove files, etc. $(patsubst %,binary-post-install/%,$(DEB_ALL_PACKAGES)):: binary-post-install/%: binary-install/% # This rule is called after installation and the post-install hooks, # to strip files. $(patsubst %,binary-strip/%,$(DEB_ARCH_PACKAGES)):: binary-strip/%: common-binary-post-install-arch binary-strip-IMPL/% $(patsubst %,binary-strip/%,$(DEB_INDEP_PACKAGES)):: binary-strip/%: common-binary-post-install-indep binary-strip-IMPL/% $(patsubst %,binary-strip-IMPL/%,$(DEB_ALL_PACKAGES)):: binary-strip-IMPL/%: dh_strip -p$(cdbs_curpkg) \ $(call cdbs_add_dashx,$(call cdbs_expand_curvar,DEB_STRIP_EXCLUDE)) \ $(call cdbs_expand_curvar,DEB_DH_STRIP_ARGS) $(if $(wildcard /usr/bin/dh_strip_nondeterminism),\ dh_strip_nondeterminism -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_STRIP_NONDETERMINISM_ARGS)) # This rule is called right before generating debs {post,pre}{inst,rm} and controls, deps, are calculated # for each package, but after the binary-fixup hooks have been run. # (necessary for dh_shlibdeps to work on our own dh_makeshlibs'ed libs) common-binary-fixup-arch:: $(patsubst %,binary-fixup/%,$(DEB_ARCH_PACKAGES)) common-binary-fixup-indep:: $(patsubst %,binary-fixup/%,$(DEB_INDEP_PACKAGES)) # This rule is called after stripping; it compresses, fixes permissions, # and sets up shared library information. $(patsubst %,binary-fixup/%,$(DEB_ALL_PACKAGES)):: binary-fixup/%: binary-strip/% dh_compress -p$(cdbs_curpkg) $(strip \ $(call cdbs_add_dashx,$(call cdbs_expand_curvar,DEB_COMPRESS_EXCLUDE)) \ $(call cdbs_expand_curvar,DEB_DH_COMPRESS_ARGS)) dh_fixperms -p$(cdbs_curpkg) $(strip \ $(call cdbs_add_dashx,$(call cdbs_expand_curvar,DEB_FIXPERMS_EXCLUDE)) \ $(call cdbs_expand_curvar,DEB_DH_FIXPERMS_ARGS)) # TODO: Use DEB_DH_MAKESHLIBS_ARGS as package-default (not global override) dh_makeshlibs -p$(cdbs_curpkg) $(DEB_DH_MAKESHLIBS_ARGS) # This rule is called right before building the binary .deb packages # for each package, but after the binary-predeb hooks have been run. common-binary-predeb-arch:: $(patsubst %,binary-predeb/%,$(DEB_ARCH_PACKAGES)) common-binary-predeb-indep:: $(patsubst %,binary-predeb/%,$(DEB_INDEP_PACKAGES)) # This rule is called right before a packages' .deb file is made. # It is a good place to make programs setuid, change the scripts in DEBIAN/, etc. $(patsubst %,binary-predeb/%,$(DEB_ARCH_PACKAGES)):: binary-predeb/%: common-binary-fixup-arch binary-predeb-IMPL/% $(patsubst %,binary-predeb/%,$(DEB_INDEP_PACKAGES)):: binary-predeb/%: common-binary-fixup-indep binary-predeb-IMPL/% $(patsubst %,binary-predeb-IMPL/%,$(DEB_ALL_PACKAGES)):: binary-predeb-IMPL/%: dh_installdeb -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_INSTALLDEB_ARGS) dh_perl -p$(cdbs_curpkg) $(DEB_DH_PERL_ARGS) # TODO: Use DEB_DH_SHLIBDEPS_ARGS as package-default (not global override) dh_shlibdeps -p$(cdbs_curpkg) $(DEB_DH_SHLIBDEPS_ARGS) $(if $(wildcard /usr/bin/dh_girepository),\ dh_girepository -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_GIREPOSITORY_ARGS)) # This rule is called to create a package. Generally it's not going to be # useful to hook things onto this rule. $(patsubst %,binary-makedeb/%,$(DEB_ARCH_PACKAGES)):: binary-makedeb/%: common-binary-predeb-arch binary-makedeb-IMPL/% $(patsubst %,binary-makedeb/%,$(DEB_INDEP_PACKAGES)):: binary-makedeb/%: common-binary-predeb-indep binary-makedeb-IMPL/% $(patsubst %,binary-makedeb-IMPL/%,$(DEB_ALL_PACKAGES)):: binary-makedeb-IMPL/%: # TODO: Use DEB_DH_GENCONTROL_ARGS as package-default (not global override) dh_gencontrol -p$(cdbs_curpkg) $(DEB_DH_GENCONTROL_ARGS) dh_md5sums -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_MD5SUMS_ARGS) $(DEB_DH_BUILDDEB_ENV) dh_builddeb -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_BUILDDEB_ARGS) ## Deprecated common-binary-post-install:: common-binary-post-install-arch common-binary-post-install-indep common-binary-predeb:: common-binary-predeb-arch common-binary-predeb-indep endif