1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
|
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2002,2003 Colin Walters <walters@debian.org>
# Copyright © 2009-2014, 2016 Jonas Smedegaard <dr@jones.dk>
# 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 <http://www.gnu.org/licenses/>.
####
# General variables implemented by this rule file:
#
# DEB_INSTALL_DIRS_ALL
# Subdirectories to create in installation staging directory for every package
# DEB_INSTALL_DIRS_<package> or DEB_INSTALL_DIRS_DEFAULT
# Like the above, but for a particular package <package>, and created in later rule.
# DEB_INSTALL_DOCS_ALL and either ..._<package> or ..._DEFAULT
# Files which should go in /usr/share/doc/<package>
# DEB_INSTALL_CHANGELOGS_ALL and either ..._<package> or ..._DEFAULT
# File which should be interpreted as upstream changelog
# DEB_COMPRESS_EXCLUDE_ALL and either ..._<package> or ..._DEFAULT
# Regular expressions matching files which should not be compressed.
# DEB_FIXPERMS_EXCLUDE_ALL and either ..._<package> 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_<package>
# 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_<package>
# 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_<package>
# Like the above, but for a particular package.
# DEB_UPDATE_RCD_PARAMS_ALL and either ..._<package> 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_<package>
# Arguments passed directly to dh_gencontrol, for a particular package <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_<package>
# Arguments passed directly to dh_makeshlibs, for a particular package <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_<package>
# Arguments passed directly to dh_shlibdeps, for a particular package <package>
# DEB_DH_SHLIBDEPS_ARGS
# Completely override argument passing to dh_shlibdeps.
# DEB_DH_PERL_ARGS
# Completely override argument passing to dh_perl.
####
#PATH_RULES#
ifndef _cdbs_rules_debhelper
_cdbs_rules_debhelper = 1
include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
DH_COMPAT ?= $(shell cat debian/compat 2>/dev/null)
ifeq (,$(DH_COMPAT))
DH_COMPAT = 7
endif
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_SYSTEMD_ENABLE_ARGS_DEFAULT ?= $(DEB_DH_SYSTEMD_ENABLE_ARGS)
DEB_DH_INSTALLINIT_ARGS_DEFAULT ?= $(DEB_DH_INSTALLINIT_ARGS)
DEB_DH_SYSTEMD_START_ARGS_DEFAULT ?= $(DEB_DH_SYSTEMD_START_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:: debian/compat
debian/compat:
$(if $(DEB_DH_COMPAT_DISABLE),,echo $(DH_COMPAT) >$@)
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/<packagename>; 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)
$(if $(wildcard /usr/bin/dh_systemd_enable),\
dh_systemd_enable -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_SYSTEMD_ENABLE_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))
$(if $(wildcard /usr/bin/dh_systemd_start),\
dh_systemd_start -p$(cdbs_curpkg) $(call cdbs_expand_curvar,DEB_DH_SYSTEMD_START_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
|