| 1 |
|
| 2 |
> |
| 3 |
> |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
ifndef _cdbs_rules_buildcore |
| 20 |
_cdbs_rules_buildcore = 1 |
| 21 |
|
| 22 |
include debian/buildvars.mk$(_cdbs_makefile_suffix) |
| 23 |
|
| 24 |
export SOURCE_DATE_EPOCH |
| 25 |
|
| 26 |
testdir: debian/control |
| 27 |
test -x debian/rules |
| 28 |
|
| 29 |
testroot: |
| 30 |
$(if $(_cdbs_rules_debhelper),dh_testroot,test "`id -u`" = 0) |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
$(patsubst %,testsanity/%,$(DEB_ALL_PACKAGES)):: testsanity/%: |
| 35 |
testsanity:: $(patsubst %,testsanity/%,$(DEB_ALL_PACKAGES)) |
| 36 |
|
| 37 |
$(patsubst %,makebuilddir/%,$(DEB_ALL_PACKAGES)):: makebuilddir/%: |
| 38 |
$(if $(DEB_BUILDDIR_$(cdbs_curpkg)),\ |
| 39 |
mkdir -p "$(DEB_BUILDDIR_$(cdbs_curpkg))") |
| 40 |
|
| 41 |
makebuilddir:: $(patsubst %,makebuilddir/%,$(DEB_ALL_PACKAGES)) |
| 42 |
mkdir -p "$(DEB_BUILDDIR)" |
| 43 |
|
| 44 |
cleanbuilddir:: $(patsubst %,cleanbuilddir/%,$(DEB_ALL_PACKAGES)) |
| 45 |
-$(if $(call cdbs_streq,$(DEB_BUILDDIR),$(DEB_SRCDIR)),\ |
| 46 |
,\ |
| 47 |
rmdir $(DEB_BUILDDIR)) |
| 48 |
|
| 49 |
$(patsubst %,cleanbuilddir/%,$(DEB_ALL_PACKAGES)):: cleanbuilddir/%: |
| 50 |
-$(if $(DEB_BUILDDIR_$(cdbs_curpkg)),\ |
| 51 |
$(if $(call cdbs_streq,$(DEB_BUILDDIR_$(cdbs_curpkg)),$(DEB_SRCDIR)),\ |
| 52 |
,\ |
| 53 |
rmdir "$(DEB_BUILDDIR_$(cdbs_curpkg))")) |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
config_guess := $(shell find $(DEB_SRCDIR) \( -type f -or -type l \) -name config.guess) |
| 58 |
config_sub := $(shell find $(DEB_SRCDIR) \( -type f -or -type l \) -name config.sub) |
| 59 |
config_rpath := $(shell find $(DEB_SRCDIR) \( -type f -or -type l \) -name config.rpath) |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
pre-build:: testdir testsanity makebuilddir |
| 67 |
$(foreach x,$(_cdbs_deprecated_vars),\ |
| 68 |
$(eval y=$(subst $(comma), ,$x))\ |
| 69 |
$(eval z=$(firstword $y))\ |
| 70 |
$(if $(call cdbs_streq,$($z),$(_cdbs_deprecated_$z_default)),\ |
| 71 |
,\ |
| 72 |
$(call cdbs_warn_deprecated,\ |
| 73 |
$z,$(word 2,$y),$(wordlist 3,$(words $y),$y)))) |
| 74 |
|
| 75 |
|
| 76 |
post-patches:: pre-build apply-patches update-config |
| 77 |
update-config:: |
| 78 |
$(if $(and $(config_guess),$(wildcard /usr/share/misc/config.guess)),\ |
| 79 |
set -e; \ |
| 80 |
$(foreach file,$(config_guess),\ |
| 81 |
$(if $(wildcard $(file)),$(if $(wildcard $(file).cdbs-orig),\ |
| 82 |
,\ |
| 83 |
mv $(file) $(file).cdbs-orig; \ |
| 84 |
cp --remove-destination \ |
| 85 |
/usr/share/misc/config.guess $(file);)))) |
| 86 |
$(if $(and $(config_sub),$(wildcard /usr/share/misc/config.sub)),\ |
| 87 |
set -e; \ |
| 88 |
$(foreach file,$(config_sub),\ |
| 89 |
$(if $(wildcard $(file)),$(if $(wildcard $(file).cdbs-orig),\ |
| 90 |
,\ |
| 91 |
mv $(file) $(file).cdbs-orig; \ |
| 92 |
cp --remove-destination \ |
| 93 |
/usr/share/misc/config.sub $(file);)))) |
| 94 |
$(if $(and $(config_rpath),$(wildcard /usr/share/gnulib/build-aux/config.rpath)), \ |
| 95 |
set -e; \ |
| 96 |
$(foreach file,$(config_rpath),\ |
| 97 |
$(if $(wildcard $(file)),$(if $(wildcard $(file).cdbs-orig),\ |
| 98 |
,\ |
| 99 |
mv $(file) $(file).cdbs-orig; \ |
| 100 |
cp --remove-destination \ |
| 101 |
/usr/share/gnulib/build-aux/config.rpath $(file);)))) |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
common-configure-arch:: post-patches |
| 106 |
common-configure-indep:: post-patches |
| 107 |
$(patsubst %,configure/%,$(DEB_ARCH_PACKAGES)):: configure/%: common-configure-arch |
| 108 |
$(patsubst %,configure/%,$(DEB_INDEP_PACKAGES)):: configure/%: common-configure-indep |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
9. |
| 117 |
|
| 118 |
|
| 119 |
DEB_BUILD_DEPENDENCIES ?= build-arch build-indep |
| 120 |
build: $(DEB_BUILD_DEPENDENCIES) |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
common-build-arch:: testdir $(patsubst %,configure/%,$(DEB_ARCH_PACKAGES)) |
| 125 |
common-build-indep:: testdir $(patsubst %,configure/%,$(DEB_INDEP_PACKAGES)) |
| 126 |
$(patsubst %,build/%,$(DEB_ARCH_PACKAGES)):: build/%: common-build-arch configure/% |
| 127 |
$(patsubst %,build/%,$(DEB_INDEP_PACKAGES)):: build/%: common-build-indep configure/% |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
common-post-build-arch:: common-build-arch $(patsubst %,build/%,$(DEB_ARCH_PACKAGES)) |
| 133 |
common-post-build-indep:: common-build-indep $(patsubst %,build/%,$(DEB_INDEP_PACKAGES)) |
| 134 |
|
| 135 |
|
| 136 |
build-arch: $(patsubst %,build/%,$(DEB_ARCH_PACKAGES)) |
| 137 |
build-indep: $(patsubst %,build/%,$(DEB_INDEP_PACKAGES)) |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
clean:: testdir cleanbuilddir reverse-config testsanity |
| 144 |
reverse-config:: |
| 145 |
$(if $(config_guess)$(config_sub)$(config_rpath),\ |
| 146 |
set -e;\ |
| 147 |
$(foreach file,$(config_guess) $(config_sub) $(config_rpath),\ |
| 148 |
$(if $(wildcard $(file).cdbs-orig),\ |
| 149 |
mv $(file).cdbs-orig $(file);))) |
| 150 |
|
| 151 |
|
| 152 |
) |
| 153 |
|
| 154 |
CDBS_BUILD_DEPENDS_DELIMITER ?= ,\n$(space) |
| 155 |
|
| 156 |
cdbs_re_squash_extended_space = s/[ \t\n]+/ /g |
| 157 |
|
| 158 |
cdbs_pkgrel_varnames = $(patsubst %,CDBS_%,DEPENDS PREDEPENDS RECOMMENDS SUGGESTS BREAKS PROVIDES REPLACES CONFLICTS ENHANCES) |
| 159 |
cdbs_pkgrel_allvars = $(call cdbs_expand_allvars,$(cdbs_pkgrel_varnames)) |
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
common-install-prehook-arch:: |
| 164 |
common-install-prehook-indep:: |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
common-install-arch:: testdir common-install-prehook-arch common-post-build-arch |
| 169 |
common-install-indep:: testdir common-install-prehook-indep common-post-build-indep |
| 170 |
|
| 171 |
|
| 172 |
install-arch: $(patsubst %,install/%,$(DEB_ARCH_PACKAGES)) |
| 173 |
install-indep: $(patsubst %,install/%,$(DEB_INDEP_PACKAGES)) |
| 174 |
|
| 175 |
|
| 176 |
$(patsubst %,install/%,$(DEB_ARCH_PACKAGES)):: install/%: testdir testroot common-install-arch build/% |
| 177 |
$(patsubst %,install/%,$(DEB_INDEP_PACKAGES)):: install/%: testdir testroot common-install-indep build/% |
| 178 |
|
| 179 |
_cdbs_deprecated_vars += $(patsubst %,CDBS_%$(comma)0.4.85,\ |
| 180 |
DEPENDS PREDEPENDS RECOMMENDS SUGGESTS BREAKS PROVIDES REPLACES \ |
| 181 |
CONFLICTS ENHANCES) |
| 182 |
CDBS_DEPENDS_DEFAULT ?= $(CDBS_DEPENDS) |
| 183 |
CDBS_PREDEPENDS_DEFAULT ?= $(CDBS_PREDEPENDS) |
| 184 |
CDBS_RECOMMENDS_DEFAULT ?= $(CDBS_RECOMMENDS) |
| 185 |
CDBS_SUGGESTS_DEFAULT ?= $(CDBS_SUGGESTS) |
| 186 |
CDBS_BREAKS_DEFAULT ?= $(CDBS_BREAKS) |
| 187 |
CDBS_PROVIDES_DEFAULT ?= $(CDBS_PROVIDES) |
| 188 |
CDBS_REPLACES_DEFAULT ?= $(CDBS_REPLACES) |
| 189 |
CDBS_CONFLICTS_DEFAULT ?= $(CDBS_CONFLICTS) |
| 190 |
CDBS_ENHANCES_DEFAULT ?= $(CDBS_ENHANCES) |
| 191 |
|
| 192 |
|
| 193 |
$(patsubst %,install/%,$(DEB_ALL_PACKAGES)) :: install/%: |
| 194 |
@echo 'Adding cdbs dependencies to debian/$(cdbs_curpkg).substvars' |
| 195 |
@echo '$(call cdbs_expand_curvar,CDBS_DEPENDS,$(comma) )' \ |
| 196 |
| perl -0 -n \ |
| 197 |
-e '$(cdbs_re_squash_extended_space);' \ |
| 198 |
-e '$(re_squash_commas_and_spaces);' \ |
| 199 |
-e '/\w/ and print "cdbs:Depends=$$_\n"' \ |
| 200 |
>> debian/$(cdbs_curpkg).substvars |
| 201 |
@echo '$(call cdbs_expand_curvar,CDBS_PREDEPENDS,$(comma) )' \ |
| 202 |
| perl -0 -n \ |
| 203 |
-e '$(cdbs_re_squash_extended_space);' \ |
| 204 |
-e '$(re_squash_commas_and_spaces);' \ |
| 205 |
-e '/\w/ and print "cdbs:Pre-Depends=$$_\n"' \ |
| 206 |
>> debian/$(cdbs_curpkg).substvars |
| 207 |
@echo '$(call cdbs_expand_curvar,CDBS_RECOMMENDS,$(comma) )' \ |
| 208 |
| perl -0 -n \ |
| 209 |
-e '$(cdbs_re_squash_extended_space);' \ |
| 210 |
-e '$(re_squash_commas_and_spaces);' \ |
| 211 |
-e '/\w/ and print "cdbs:Recommends=$$_\n"' \ |
| 212 |
>> debian/$(cdbs_curpkg).substvars |
| 213 |
@echo '$(call cdbs_expand_curvar,CDBS_SUGGESTS,$(comma) )' \ |
| 214 |
| perl -0 -n \ |
| 215 |
-e '$(cdbs_re_squash_extended_space);' \ |
| 216 |
-e '$(re_squash_commas_and_spaces);' \ |
| 217 |
-e '/\w/ and print "cdbs:Suggests=$$_\n"' \ |
| 218 |
>> debian/$(cdbs_curpkg).substvars |
| 219 |
@echo '$(call cdbs_expand_curvar,CDBS_BREAKS,$(comma) )' \ |
| 220 |
| perl -0 -n \ |
| 221 |
-e '$(cdbs_re_squash_extended_space);' \ |
| 222 |
-e '$(re_squash_commas_and_spaces);' \ |
| 223 |
-e '/\w/ and print "cdbs:Breaks=$$_\n"' \ |
| 224 |
>> debian/$(cdbs_curpkg).substvars |
| 225 |
@echo '$(call cdbs_expand_curvar,CDBS_PROVIDES,$(comma) )' \ |
| 226 |
| perl -0 -n \ |
| 227 |
-e '$(cdbs_re_squash_extended_space);' \ |
| 228 |
-e '$(re_squash_commas_and_spaces);' \ |
| 229 |
-e '/\w/ and print "cdbs:Provides=$$_\n"' \ |
| 230 |
>> debian/$(cdbs_curpkg).substvars |
| 231 |
@echo '$(call cdbs_expand_curvar,CDBS_REPLACES,$(comma) )' \ |
| 232 |
| perl -0 -n \ |
| 233 |
-e '$(cdbs_re_squash_extended_space);' \ |
| 234 |
-e '$(re_squash_commas_and_spaces);' \ |
| 235 |
-e '/\w/ and print "cdbs:Replaces=$$_\n"' \ |
| 236 |
>> debian/$(cdbs_curpkg).substvars |
| 237 |
@echo '$(call cdbs_expand_curvar,CDBS_CONFLICTS,$(comma) )' \ |
| 238 |
| perl -0 -n \ |
| 239 |
-e '$(cdbs_re_squash_extended_space);' \ |
| 240 |
-e '$(re_squash_commas_and_spaces);' \ |
| 241 |
-e '/\w/ and print "cdbs:Conflicts=$$_\n"' \ |
| 242 |
>> debian/$(cdbs_curpkg).substvars |
| 243 |
@echo '$(call cdbs_expand_curvar,CDBS_ENHANCES,$(comma) )' \ |
| 244 |
| perl -0 -n \ |
| 245 |
-e '$(cdbs_re_squash_extended_space);' \ |
| 246 |
-e '$(re_squash_commas_and_spaces);' \ |
| 247 |
-e '/\w/ and print "cdbs:Enhances=$$_\n"' \ |
| 248 |
>> debian/$(cdbs_curpkg).substvars |
| 249 |
|
| 250 |
# This rule is called after all packages are installed. |
| 251 |
common-binary-arch:: testdir testroot $(patsubst %,install/%,$(DEB_ARCH_PACKAGES)) |
| 252 |
common-binary-indep:: testdir testroot $(patsubst %,install/%,$(DEB_INDEP_PACKAGES)) |
| 253 |
|
| 254 |
# Required Debian targets |
| 255 |
binary-indep: $(patsubst %,binary/%,$(DEB_INDEP_PACKAGES)) |
| 256 |
binary-arch: $(patsubst %,binary/%,$(DEB_ARCH_PACKAGES)) |
| 257 |
|
| 258 |
# These rules should do all the work of actually creating a .deb from the staging |
| 259 |
# directory. |
| 260 |
$(patsubst %,binary/%,$(DEB_ARCH_PACKAGES)):: binary/%: testdir testroot common-binary-arch install/% |
| 261 |
$(patsubst %,binary/%,$(DEB_INDEP_PACKAGES)):: binary/%: testdir testroot common-binary-indep install/% |
| 262 |
|
| 263 |
# Required Debian target |
| 264 |
binary: binary-indep binary-arch |
| 265 |
|
| 266 |
## |
| 267 |
# Deprecated targets. You should use the -arch and -indep targets instead. |
| 268 |
## |
| 269 |
common-configure:: common-configure-arch common-configure-indep |
| 270 |
common-build:: common-build-arch common-build-indep |
| 271 |
common-post-build:: common-post-build-arch common-post-build-indep |
| 272 |
common-install-prehook:: common-install-prehook-arch common-install-prehook-indep |
| 273 |
common-install:: common-install-arch common-install-indep |
| 274 |
common-binary:: common-binary-arch common-binary-indep |
| 275 |
|
| 276 |
.PHONY: pre-build testsanity $(patsubst %,testsanity/%,$(DEB_ALL_PACKAGES)) apply-patches post-patches common-configure-arch common-configure-indep $(patsubst %,configure/%,$(DEB_ALL_PACKAGES)) build common-build-arch common-build-indep $(patsubst %,build/%,$(DEB_ALL_PACKAGES)) build-arch build-indep clean common-install-arch common-install-indep install-arch install-indep $(patsubst %,install/%,$(DEB_ALL_PACKAGES)) common-binary-arch common-binary-indep $(patsubst %,binary/%,$(DEB_ALL_PACKAGES)) binary-indep binary-arch binary $(DEB_PHONY_RULES) |
| 277 |
|
| 278 |
# Parallel execution of the cdbs makefile fragments will fail, but |
| 279 |
# this way you can call dpkg-buildpackage with MAKEFLAGS=-j in the |
| 280 |
|
| 281 |
.NOTPARALLEL: |
| 282 |
|
| 283 |
endif |