Debian Codegraph @

debian/rules

raw symbols SCIP
1 #!/usr/bin/make -f
2
3 , := ,
4 space := $(EMPTY) $(EMPTY)
5
6 NJOBS =
7 # Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
8 ifneq (,$(filter parallel=%,$(subst $(,), ,$(DEB_BUILD_OPTIONS))))
9 NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(,),$(space),$(DEB_BUILD_OPTIONS))))
10 endif
11
12 vendor := $(shell if dpkg-vendor --derives-from Ubuntu; then echo Ubuntu; else echo Debian; fi)
13 distrelease := $(shell lsb_release -cs)
14
15 GCC_VER := $(shell dpkg-parsechangelog |egrep ^Source:|cut -f2 -d' '|cut -f2 -d'-')
16
17 ifeq ($(GCC_VER),16)
18 MIN_VER_GCC := 16.1.0-1~
19 PPA_VER_GCC := 16.1.0-1~
20 endif
21
22 ifndef MIN_VER_GCC
23 MIN_VER_GCC := ${GCC_VER}.0.1-0~
24 #MIN_VER_GCC := ${GCC_VER}-20160225-0~
25 endif
26
27 DEB_NAME_ACT := $(shell dpkg-parsechangelog| sed -n 's/-*//; s/^Source: \(.*\)/\1/p')
28 DEB_SVER_ACT := $(shell dpkg-parsechangelog| sed -n 's/-*//; s/^Version: \(.*\)/\1/p')
29 ifeq ($(DEB_NAME_ACT),gcc-$(GCC_VER)-cross-mipsen)
30 DEB_VER_ACT := $(shell /bin/sh debian/new_cross_version.sh mipsr6el)
31 else
32 DEB_VER_ACT := $(shell /bin/sh debian/new_cross_version.sh $(if $(filter $(DEB_NAME_ACT), gcc-$(GCC_VER)-cross),arm64,ppc64))
33 endif
34 CROSS_EXT := cross$(DEB_VER_ACT)
35
36 ifeq ($(CROSS_EXT),cross)
37 $(error macros CROSS_EXT and DEB_VER_ACT are not correctly set ($(CROSS_EXT)/$(DEB_VER_ACT)))
38 endif
39
40 VER_GCC := $(shell dpkg-parsechangelog -l/usr/src/gcc-${GCC_VER}/debian/changelog | awk '/^Version:/ {print $$2}' | sed 's/-[^-]*$$//')
41 GCC_DIR := /usr/src/gcc-${GCC_VER}
42 GCC_TARBALL := $(wildcard $(GCC_DIR)/gcc-*.xz)
43 VER_BINUTILS := 2.45-5
44 MIN_VER_BINUTILS := 2.45-5
45 VER_ISL := 0.26-3~
46 MIN_VER_GLIBC := 2.37
47
48 DEB_VER_GCC := $(shell dpkg-parsechangelog -l${GCC_DIR}/debian/changelog | egrep '^Version:' | cut -f 2 -d ' ')
49
50 CROSS_BIARCH_armhf:=armel
51 CROSS_BIARCH_armel:=armhf
52 CROSS_BIARCH_powerpc:=ppc64
53 CROSS_BIARCH_s390x:=s390
54
55 HOST_ARCHS_alpha = amd64 arm64 i386 ppc64el x32
56 # FIXME: adding amd64 in HOST_ARCHS_amd64 hard codes the indep build
57 # to amd64 buildds ...
58 HOST_ARCHS_amd64 = amd64 arm64 i386 ppc64el s390x x32
59 HOST_ARCHS_arc = amd64 arm64 i386 ppc64el x32
60 HOST_ARCHS_armhf = amd64 i386 x32 arm64 ppc64el s390x
61 HOST_ARCHS_armel = amd64 i386 x32 arm64 ppc64el
62 HOST_ARCHS_arm64 = amd64 i386 x32 ppc64el s390x
63 HOST_ARCHS_hppa = amd64 arm64 i386 ppc64el x32
64 HOST_ARCHS_i386 = amd64 arm64 ppc64el s390x x32
65 HOST_ARCHS_loong64 = amd64 arm64 i386 ppc64el x32
66 HOST_ARCHS_m68k = amd64 arm64 i386 ppc64el x32
67 HOST_ARCHS_powerpc = amd64 arm64 i386 ppc64el s390x x32
68 HOST_ARCHS_ppc64 = amd64 i386 ppc64el s390x x32
69 HOST_ARCHS_ppc64el = amd64 arm64 i386 ppc64 s390x x32
70 HOST_ARCHS_riscv64 = amd64 arm64 i386 ppc64el s390x x32
71 HOST_ARCHS_s390x = amd64 i386 x32 arm64 ppc64el
72 HOST_ARCHS_sh4 = amd64 arm64 i386 ppc64el x32
73 HOST_ARCHS_sparc64 = amd64 arm64 i386 ppc64el x32
74 HOST_ARCHS_x32 = amd64 arm64 i386 ppc64el
75
76 all_archs_mips = mips mipsel mipsn32 mipsn32el mips64 mips64el mipsr6 mipsr6el mipsn32r6 mipsn32r6el mips64r6 mips64r6el
77 mipsen_archs = amd64 i386 x32 mips64el mipsel mips64r6el arm64 ppc64el
78 $(foreach a, $(all_archs_mips), \
79 $(eval HOST_ARCHS_$(a) = $(filter-out $(a), $(mipsen_archs))) \
80 )
81
82 HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
83 HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
84 HOST_ARCH_EXT := $(if $(DEB_HOST_ARCH_VARIANT),$(DEB_HOST_ARCH_VARIANT),$(HOST_ARCH))
85 stamp := stamp-dir/
86
87 # package metadata information
88 ifeq (,$(ELF_PACKAGE_METADATA))
89 ELF_PACKAGE_METADATA := $(subst $(space),,{ \
90 "type":"deb", \
91 "os":"$(shell awk -F= '/^ID=/ {print $$2}' /etc/os-release)", \
92 "name":"$(DEB_NAME_ACT)", \
93 "version":"$(DEB_SVER_ACT)", \
94 "architecture":"$(HOST_ARCH)" \
95 $(if $(DEB_BUILD_DEBUG_INFO_URL),$(,)"debugInfoUrl":"$(DEB_BUILD_DEBUG_INFO_URL)") \
96 })
97 export ELF_PACKAGE_METADATA
98 endif
99
100 ifeq (,$(CROSS_ARCHS))
101 ifeq ($(DEB_NAME_ACT),gcc-16-cross)
102 ifneq (,$(filter $(HOST_ARCH),amd64 i386 x32))
103 CROSS_ARCHS ?= amd64 arm64 s390x ppc64el armhf riscv64 \
104 $(if $(filter $(vendor), Ubuntu), powerpc) \
105 $(if $(filter $(HOST_ARCH), amd64 x32), i386)
106 else ifeq ($(HOST_ARCH),arm64)
107 CROSS_ARCHS ?= amd64 armhf i386 ppc64el riscv64 s390x \
108 $(if $(filter $(vendor), Ubuntu), powerpc)
109 else ifeq ($(HOST_ARCH),ppc64)
110 CROSS_ARCHS ?= ppc64el
111 else ifeq ($(HOST_ARCH),ppc64el)
112 CROSS_ARCHS ?= amd64 arm64 armhf i386 riscv64 s390x \
113 $(if $(filter $(vendor), Ubuntu), powerpc)
114 else ifeq ($(HOST_ARCH),s390x)
115 CROSS_ARCHS ?= amd64 arm64 armhf i386 ppc64el riscv64 \
116 $(if $(filter $(vendor), Ubuntu), powerpc)
117 else
118 CROSS_ARCHS =
119 endif
120 GCC_PORTS_BUILD=
121 else ifeq ($(DEB_NAME_ACT),gcc-16-cross-ports)
122 ifneq (,$(filter $(HOST_ARCH),amd64 i386 x32))
123 CROSS_ARCHS ?= alpha arc armel hppa loong64 m68k ppc64 sh4 sparc64 \
124 $(if $(filter $(vendor), Ubuntu),, powerpc) \
125 $(if $(filter $(HOST_ARCH), amd64 i386), x32)
126 else ifeq ($(HOST_ARCH),arm64)
127 CROSS_ARCHS ?= alpha arc armel hppa loong64 m68k sh4 sparc64 x32 \
128 $(if $(filter $(vendor), Ubuntu),, powerpc)
129 else ifeq ($(HOST_ARCH),ppc64el)
130 CROSS_ARCHS ?= alpha arc armel hppa loong64 m68k sh4 sparc64 x32 \
131 $(if $(filter $(vendor), Ubuntu),, powerpc) ppc64
132 else ifeq ($(HOST_ARCH),s390x)
133 CROSS_ARCHS ?= ppc64 \
134 $(if $(filter $(vendor), Ubuntu),, powerpc)
135 else
136 CROSS_ARCHS =
137 endif
138 GCC_PORTS_BUILD=-ports
139 else ifeq ($(DEB_NAME_ACT),gcc-16-cross-mipsen)
140 ifneq (,$(filter $(HOST_ARCH),$(mipsen_archs)))
141 CROSS_ARCHS ?= mips mipsel mips64el mips64 \
142 mipsr6 mipsr6el mips64r6 mips64r6el
143 # n32: mipsn32 mipsn32el mipsn32r6 mipsn32r6el
144 # have problem on ada
145 endif
146 GCC_PORTS_BUILD=-mipsen
147 else
148 $(error Unknown source package $(DEB_NAME_ACT))
149 endif
150 endif
151
152 CROSS_ARCH = $(subst .,,$(suffix $@))
153 KERNEL_ARCH = $(KERNEL_ARCH_$(CROSS_ARCH))
154 CROSS_BIARCH = $(CROSS_BIARCH_$(CROSS_ARCH))
155 _gnu_type = $(shell dpkg-architecture -a$(1) -qDEB_HOST_GNU_TYPE -f)
156 _pkg_gnu_type = $(shell dpkg-architecture -a$(1) -qDEB_HOST_GNU_TYPE -f | tr _ -)
157 CROSS_GNU_TYPE = $(call _gnu_type,${CROSS_ARCH})
158 CROSS_PKG_GNU_TYPE = $(subst _,-,$(call _gnu_type,${CROSS_ARCH}))
159 HOST_ARCHS = $(HOST_ARCH_$(CROSS_ARCH))
160 ADA_HOST_ARCHS = $(HOST_ARCH_$(CROSS_ARCH))
161 ADA64_HOST_ARCHS = $(filter-out i386,$(HOST_ARCH_$(CROSS_ARCH)))
162
163 ARM32_MULTILIBS :=
164 ifeq ($(vendor),Ubuntu)
165 ifneq (,$(filter $(distrelease), precise trusty xenial bionic focal groovy hirsute))
166 ARM32_MULTILIBS := yes
167 endif
168 endif
169
170 ifeq ($(vendor),Debian)
171 skip_dbg_packages = yes
172 else ifeq ($(vendor),Ubuntu)
173 endif
174
175 libgcc_source := $(shell apt-cache show --no-all-versions libgcc-s1-arm64-cross | awk '/^Source:/ { print $$2 }')
176 #ifneq ($(DEB_NAME_ACT),$(libgcc_source))
177 # skip_common_packages = yes
178 #endif
179
180 BINUTILS_BUILD_DEPS = $(foreach a,$(CROSS_ARCHS),binutils-$(call _pkg_gnu_type,$(a)) (>= $(MIN_VER_BINUTILS)) [$(HOST_ARCHS_$(a))]$(,))
181 GLIBC_BUILD_DEPS = $(foreach a,$(CROSS_ARCHS),libc6$(if $(filter $(a),alpha ia64),.1)-dev-$(a)-cross (>= $(MIN_VER_GLIBC)) [$(HOST_ARCHS_$(a))]$(,))
182 LINUX_BUILD_DEPS = $(foreach a,$(CROSS_ARCHS),linux-libc-dev-$(a)-cross [$(HOST_ARCHS_$(a))]$(,))
183
184 # build multilib cross compilers
185 ifeq ($(ARM32_MULTILIBS),yes)
186 ifneq (,$(filter armel, $(CROSS_ARCHS)))
187 EXTRA_BUILD_DEPS += libc6-dev-armhf-cross [$(HOST_ARCHS_armel)],
188 ifeq ($(skip_common_packages),yes)
189 GCC_BUILD_DEPS += libhfgcc-s1-armel-cross [$(HOST_ARCHS_armel)],
190 endif
191 endif
192
193 ifneq (,$(filter armhf, $(CROSS_ARCHS)))
194 EXTRA_BUILD_DEPS += libc6-dev-armel-cross [$(HOST_ARCHS_armhf)],
195 ifeq ($(skip_common_packages),yes)
196 GCC_BUILD_DEPS += libsfgcc-s1-armhf-cross [$(HOST_ARCHS_armhf)],
197 endif
198 endif
199 endif
200
201 ifneq (,$(filter amd64, $(CROSS_ARCHS)))
202 EXTRA_BUILD_DEPS += libc6-dev-i386-amd64-cross [$(HOST_ARCHS_amd64)],
203 EXTRA_BUILD_DEPS += libc6-dev-x32-amd64-cross [$(HOST_ARCHS_amd64)],
204 ifeq ($(skip_common_packages),yes)
205 GCC_BUILD_DEPS += lib32gcc-s1-amd64-cross [$(HOST_ARCHS_amd64)],
206 GCC_BUILD_DEPS += libx32gcc-s1-amd64-cross [$(HOST_ARCHS_amd64)],
207 endif
208 endif
209
210 ifneq (,$(filter i386, $(CROSS_ARCHS)))
211 EXTRA_BUILD_DEPS += libc6-dev-amd64-i386-cross [$(HOST_ARCHS_i386)],
212 EXTRA_BUILD_DEPS += libc6-dev-x32-i386-cross [$(HOST_ARCHS_i386)],
213 ifeq ($(skip_common_packages),yes)
214 GCC_BUILD_DEPS += lib64gcc-s1-i386-cross [$(HOST_ARCHS_i386)],
215 GCC_BUILD_DEPS += libx32gcc-s1-i386-cross [$(HOST_ARCHS_i386)],
216 endif
217 endif
218
219 ifneq (,$(filter x32, $(CROSS_ARCHS)))
220 EXTRA_BUILD_DEPS += libc6-dev-i386-x32-cross [$(HOST_ARCHS_x32)],
221 EXTRA_BUILD_DEPS += libc6-dev-amd64-x32-cross [$(HOST_ARCHS_x32)],
222 ifeq ($(skip_common_packages),yes)
223 GCC_BUILD_DEPS += lib32gcc-s1-x32-cross [$(HOST_ARCHS_x32)],
224 GCC_BUILD_DEPS += lib64gcc-s1-x32-cross [$(HOST_ARCHS_x32)],
225 endif
226 endif
227
228 ifneq (,$(filter ppc64, $(CROSS_ARCHS)))
229 EXTRA_BUILD_DEPS += libc6-dev-powerpc-ppc64-cross [$(HOST_ARCHS_ppc64)],
230 ifeq ($(skip_common_packages),yes)
231 GCC_BUILD_DEPS += lib32gcc-s1-ppc64-cross [$(HOST_ARCHS_ppc64)],
232 endif
233 endif
234
235 ifneq (,$(filter sparc64, $(CROSS_ARCHS)))
236 EXTRA_BUILD_DEPS += libc6-dev-sparc-sparc64-cross [$(HOST_ARCHS_sparc64)],
237 ifeq ($(skip_common_packages),yes)
238 GCC_BUILD_DEPS += lib32gcc-s1-sparc64-cross [$(HOST_ARCHS_sparc64)],
239 endif
240 endif
241
242 ifneq (,$(filter powerpc, $(CROSS_ARCHS)))
243 EXTRA_BUILD_DEPS += libc6-dev-ppc64-powerpc-cross [$(HOST_ARCHS_powerpc)],
244 ifeq ($(skip_common_packages),yes)
245 GCC_BUILD_DEPS += lib64gcc-s1-powerpc-cross [$(HOST_ARCHS_powerpc)],
246 endif
247 endif
248
249 ifneq (,$(filter mips, $(CROSS_ARCHS)))
250 EXTRA_BUILD_DEPS += libc6-dev-mips64-mips-cross [$(HOST_ARCHS_mips)],
251 EXTRA_BUILD_DEPS += libc6-dev-mipsn32-mips-cross [$(HOST_ARCHS_mips)],
252 ifeq ($(skip_common_packages),yes)
253 GCC_BUILD_DEPS += lib64gcc-s1-mips-cross [$(HOST_ARCHS_mips)],
254 GCC_BUILD_DEPS += libn32gcc-s1-mips-cross [$(HOST_ARCHS_mips)],
255 endif
256 endif
257
258 ifneq (,$(filter mipsel, $(CROSS_ARCHS)))
259 EXTRA_BUILD_DEPS += libc6-dev-mips64-mipsel-cross [$(HOST_ARCHS_mipsel)],
260 EXTRA_BUILD_DEPS += libc6-dev-mipsn32-mipsel-cross [$(HOST_ARCHS_mipsel)],
261 ifeq ($(skip_common_packages),yes)
262 GCC_BUILD_DEPS += lib64gcc-s1-mipsel-cross [$(HOST_ARCHS_mipsel)],
263 GCC_BUILD_DEPS += libn32gcc-s1-mipsel-cross [$(HOST_ARCHS_mipsel)],
264 endif
265 endif
266
267 ifneq (,$(filter mipsn32, $(CROSS_ARCHS)))
268 EXTRA_BUILD_DEPS += libc6-dev-mips32-mipsn32-cross [$(HOST_ARCHS_mipsn32)],
269 EXTRA_BUILD_DEPS += libc6-dev-mips64-mipsn32-cross [$(HOST_ARCHS_mipsn32)],
270 ifeq ($(skip_common_packages),yes)
271 GCC_BUILD_DEPS += lib32gcc-s1-mipsn32-cross [$(HOST_ARCHS_mipsn32)],
272 GCC_BUILD_DEPS += lib64gcc-s1-mipsn32-cross [$(HOST_ARCHS_mipsn32)],
273 endif
274 endif
275
276 ifneq (,$(filter mipsn32el, $(CROSS_ARCHS)))
277 EXTRA_BUILD_DEPS += libc6-dev-mips32-mipsn32el-cross [$(HOST_ARCHS_mipsn32el)],
278 EXTRA_BUILD_DEPS += libc6-dev-mips64-mipsn32el-cross [$(HOST_ARCHS_mipsn32el)],
279 ifeq ($(skip_common_packages),yes)
280 GCC_BUILD_DEPS += lib32gcc-s1-mipsn32el-cross [$(HOST_ARCHS_mipsn32el)],
281 GCC_BUILD_DEPS += lib64gcc-s1-mipsn32el-cross [$(HOST_ARCHS_mipsn32el)],
282 endif
283 endif
284
285 ifneq (,$(filter mips64, $(CROSS_ARCHS)))
286 EXTRA_BUILD_DEPS += libc6-dev-mips32-mips64-cross [$(HOST_ARCHS_mips64)],
287 EXTRA_BUILD_DEPS += libc6-dev-mipsn32-mips64-cross [$(HOST_ARCHS_mips64)],
288 ifeq ($(skip_common_packages),yes)
289 GCC_BUILD_DEPS += lib32gcc-s1-mips64-cross [$(HOST_ARCHS_mips64)],
290 GCC_BUILD_DEPS += libn32gcc-s1-mips64-cross [$(HOST_ARCHS_mips64)],
291 endif
292 endif
293
294 ifneq (,$(filter mips64el, $(CROSS_ARCHS)))
295 EXTRA_BUILD_DEPS += libc6-dev-mips32-mips64el-cross [$(HOST_ARCHS_mips64el)],
296 EXTRA_BUILD_DEPS += libc6-dev-mipsn32-mips64el-cross [$(HOST_ARCHS_mips64el)],
297 ifeq ($(skip_common_packages),yes)
298 GCC_BUILD_DEPS += lib32gcc-s1-mips64el-cross [$(HOST_ARCHS_mips64el)],
299 GCC_BUILD_DEPS += libn32gcc-s1-mips64el-cross [$(HOST_ARCHS_mips64el)],
300 endif
301 endif
302
303 ifneq (,$(filter mipsr6, $(CROSS_ARCHS)))
304 EXTRA_BUILD_DEPS += libc6-dev-mips64-mipsr6-cross [$(HOST_ARCHS_mipsr6)],
305 EXTRA_BUILD_DEPS += libc6-dev-mipsn32-mipsr6-cross [$(HOST_ARCHS_mipsr6)],
306 ifeq ($(skip_common_packages),yes)
307 GCC_BUILD_DEPS += lib64gcc-s1-mipsr6-cross [$(HOST_ARCHS_mipsr6)],
308 GCC_BUILD_DEPS += libn32gcc-s1-mipsr6-cross [$(HOST_ARCHS_mipsr6)],
309 endif
310 endif
311
312 ifneq (,$(filter mipsr6el, $(CROSS_ARCHS)))
313 EXTRA_BUILD_DEPS += libc6-dev-mips64-mipsr6el-cross [$(HOST_ARCHS_mipsr6el)],
314 EXTRA_BUILD_DEPS += libc6-dev-mipsn32-mipsr6el-cross [$(HOST_ARCHS_mipsr6el)],
315 ifeq ($(skip_common_packages),yes)
316 GCC_BUILD_DEPS += lib64gcc-s1-mipsr6el-cross [$(HOST_ARCHS_mipsr6el)],
317 GCC_BUILD_DEPS += libn32gcc-s1-mipsr6el-cross [$(HOST_ARCHS_mipsr6el)],
318 endif
319 endif
320
321 ifneq (,$(filter mipsn32r6, $(CROSS_ARCHS)))
322 EXTRA_BUILD_DEPS += libc6-dev-mips32-mipsn32r6-cross [$(HOST_ARCHS_mipsn32r6)],
323 EXTRA_BUILD_DEPS += libc6-dev-mips64-mipsn32r6-cross [$(HOST_ARCHS_mipsn32r6)],
324 ifeq ($(skip_common_packages),yes)
325 GCC_BUILD_DEPS += lib32gcc-s1-mipsn32r6-cross [$(HOST_ARCHS_mipsn32r6)],
326 GCC_BUILD_DEPS += lib64gcc-s1-mipsn32r6-cross [$(HOST_ARCHS_mipsn32r6)],
327 endif
328 endif
329
330 ifneq (,$(filter mipsn32r6el, $(CROSS_ARCHS)))
331 EXTRA_BUILD_DEPS += libc6-dev-mips32-mipsn32r6el-cross [$(HOST_ARCHS_mipsn32r6el)],
332 EXTRA_BUILD_DEPS += libc6-dev-mips64-mipsn32r6el-cross [$(HOST_ARCHS_mipsn32r6el)],
333 ifeq ($(skip_common_packages),yes)
334 GCC_BUILD_DEPS += lib32gcc-s1-mipsn32r6el-cross [$(HOST_ARCHS_mipsn32r6el)],
335 GCC_BUILD_DEPS += lib64gcc-s1-mipsn32r6el-cross [$(HOST_ARCHS_mipsn32r6el)],
336 endif
337 endif
338
339 ifneq (,$(filter mips64r6, $(CROSS_ARCHS)))
340 EXTRA_BUILD_DEPS += libc6-dev-mips32-mips64r6-cross [$(HOST_ARCHS_mips64r6)],
341 EXTRA_BUILD_DEPS += libc6-dev-mipsn32-mips64r6-cross [$(HOST_ARCHS_mips64r6)],
342 ifeq ($(skip_common_packages),yes)
343 GCC_BUILD_DEPS += lib32gcc-s1-mips64r6-cross [$(HOST_ARCHS_mips64r6)],
344 GCC_BUILD_DEPS += libn32gcc-s1-mips64r6-cross [$(HOST_ARCHS_mips64r6)],
345 endif
346 endif
347
348 ifneq (,$(filter mips64r6el, $(CROSS_ARCHS)))
349 EXTRA_BUILD_DEPS += libc6-dev-mips32-mips64r6el-cross [$(HOST_ARCHS_mips64r6el)],
350 EXTRA_BUILD_DEPS += libc6-dev-mipsn32-mips64r6el-cross [$(HOST_ARCHS_mips64r6el)],
351 ifeq ($(skip_common_packages),yes)
352 GCC_BUILD_DEPS += lib32gcc-s1-mips64r6el-cross [$(HOST_ARCHS_mips64r6el)],
353 GCC_BUILD_DEPS += libn32gcc-s1-mips64r6el-cross [$(HOST_ARCHS_mips64r6el)],
354 endif
355 endif
356
357 COBOL_ARCHS = amd64 arm64 ppc64el riscv64
358
359 PHOBOS_ARCHS = amd64 armel armhf arm64 i386 x32 kfreebsd-amd64 kfreebsd-i386 \
360 hppa ppc64el riscv64 s390x sparc64 \
361 mips mips64 mipsel mips64el mipsn32 mipsn32el \
362 mipsr6 mipsr6el mipsn32r6 mipsn32r6el mips64r6 mips64r6el
363
364 PHOBOS_DEP = libgphobos-GCC_VER-dev-CROSS_ARCH-cross (= $${gcc:Version}),
365 # FIXME: Set correctly ...
366 PHOBOS_ML_DEP = libgphobos-GCC_VER-dev-CROSS_ARCH-cross (= $${gcc:Version}),
367
368
369 info:
370 @echo "Package name: ${DEB_NAME_ACT} ${DEB_VER_ACT}"
371 @echo 'Package metadata: $(ELF_PACKAGE_METADATA)'
372 @echo
373 @echo "GCC ${GCC_VER} version: ${VER_GCC} ${DEB_VER_GCC}"
374 @echo
375 @echo "Target architecture: ${CROSS_ARCH}"
376 @echo "Target GNU type: ${CROSS_GNU_TYPE}"
377 @echo "Host architecture: ${HOST_ARCH}"
378 @echo "Host GNU type: ${HOST_GNU_TYPE}"
379 @echo "skips (debug/common): $(skip_dbg_packages)/$(skip_common_packages)"
380
381 $(stamp)init-gcc:
382 @echo START $@
383 rm -rf bin
384 mkdir -p bin
385 ln -s /usr/bin/gcc-$(GCC_VER) bin/gcc
386 ln -s /usr/bin/g++-$(GCC_VER) bin/g++
387 ln -s /usr/bin/gnatbind-$(GCC_VER) bin/gnatbind
388 ln -s /usr/bin/gnatmake-$(GCC_VER) bin/gnatmake
389 ln -s /usr/bin/gnatlink-$(GCC_VER) bin/gnatlink
390 ln -s /usr/bin/gnatls-$(GCC_VER) bin/gnatls
391 mkdir -p gcc
392 set -ex; \
393 cd gcc ; \
394 ln -sf $(GCC_TARBALL) $(notdir $(GCC_TARBALL)) ;\
395 cp -a $(GCC_DIR)/debian/ . ; \
396 if [ -n "$$(grep -v '^\#' $(CURDIR)/debian/patches/gcc/series)" ]; then \
397 QUILT_PATCHES=$(CURDIR)/debian/patches/gcc quilt push --quiltrc /dev/null -a ; \
398 fi
399 ifeq (1,1)
400 set -ex; \
401 if dpkg --compare-versions $(DEB_VER_GCC) lt 16-20260424-1; then \
402 cd gcc; \
403 patch -p1 < ../debian/patches/gcc/updates.diff; \
404 fi
405 endif
406 touch $@
407
408 $(stamp)build-stage0-gcc.%: $(stamp)init-gcc
409 @echo 'START $@ ($(CROSS_ARCH))'
410 @if [ "$(HOST_ARCH)" = "$(CROSS_ARCH)" ]; then \
411 echo "Skipping stage0 build for $(CROSS_ARCH)"; \
412 else \
413 set -x; \
414 echo ${CROSS_ARCH} >gcc/debian/target; \
415 cd gcc && \
416 PATH=$(CURDIR)/bin:$$PATH \
417 WITH_SYSROOT=/ \
418 PKG_IGNORE_CURRENTLY_BUILDING=1 \
419 BACKPORT=false \
420 WITHOUT_LANG="hppa64 jit nvptx gcn" \
421 DEB_BUILD_OPTIONS="$(DEB_BUILD_OPTIONS) nolang=ada,algol68,cobol,d,fortran,go,m2,objc,obj-c++,m2,rust" \
422 $(if $(filter $(HOST_ARCH),$(CROSS_ARCH)),FORCE_CROSS_LAYOUT=yes WITH_BOOTSTRAP=off) \
423 GCC_PORTS_BUILD=$(GCC_PORTS_BUILD) \
424 dpkg-buildpackage -b -uc -us -d; \
425 fi
426 touch $@
427
428 $(stamp)install-stage0-gcc.%: $(stamp)build-stage0-gcc.%
429 rm -rf debian/tmp.$(CROSS_ARCH)
430 if [ "$(HOST_ARCH)" = "$(CROSS_ARCH)" ]; then \
431 echo 'Skipping installation of "native" compiler'; \
432 else \
433 dpkg-deb -x gcc-${GCC_VER}-${CROSS_PKG_GNU_TYPE}_${DEB_VER_GCC}_${HOST_ARCH_EXT}.deb debian/tmp.${CROSS_ARCH}; \
434 dpkg-deb -x cpp-${GCC_VER}-${CROSS_PKG_GNU_TYPE}_${DEB_VER_GCC}_${HOST_ARCH_EXT}.deb debian/tmp.${CROSS_ARCH}; \
435 dpkg-deb -x libgcc-${GCC_VER}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb debian/tmp.${CROSS_ARCH}; \
436 dpkg-deb -x libgcc-s[124]-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
437 debian/tmp.${CROSS_ARCH}; \
438 fi
439
440 if [ "$(HOST_ARCH)" = "$(CROSS_ARCH)" ]; then \
441 mkdir -p debian/tmp.${CROSS_ARCH}/usr/bin; \
442 cd debian/tmp.${CROSS_ARCH}/usr/bin/ && \
443 ln -sf /usr/bin/${CROSS_GNU_TYPE}-gcc-${GCC_VER} ${CROSS_GNU_TYPE}-gcc && \
444 ln -sf /usr/bin/${CROSS_GNU_TYPE}-cpp-${GCC_VER} ${CROSS_GNU_TYPE}-cpp && \
445 ln -sf /usr/bin/${CROSS_GNU_TYPE}-gcov-${GCC_VER} ${CROSS_GNU_TYPE}-gcov; \
446 else \
447 cd debian/tmp.${CROSS_ARCH}/usr/bin/ && \
448 ln -sf ${CROSS_GNU_TYPE}-gcc-${GCC_VER} ${CROSS_GNU_TYPE}-gcc && \
449 ln -sf ${CROSS_GNU_TYPE}-cpp-${GCC_VER} ${CROSS_GNU_TYPE}-cpp && \
450 ln -sf ${CROSS_GNU_TYPE}-gcov-${GCC_VER} ${CROSS_GNU_TYPE}-gcov; \
451 fi
452
453 if [ "$(HOST_ARCH)" = "$(CROSS_ARCH)" ]; then \
454 echo "no as/ld adjustments needed"; \
455 else \
456 (cd debian/tmp.${CROSS_ARCH}/usr/bin/ && \
457 ln -sf /usr/bin/${CROSS_GNU_TYPE}-as ${CROSS_GNU_TYPE}-as && \
458 ln -sf /usr/bin/${CROSS_GNU_TYPE}-ld ${CROSS_GNU_TYPE}-ld ); \
459 (cd debian/tmp.${CROSS_ARCH}/usr/libexec/gcc-cross/$(CROSS_GNU_TYPE)/$(GCC_VER)/ && \
460 ln -sf /usr/bin/${CROSS_GNU_TYPE}-as as && \
461 ln -sf /usr/bin/${CROSS_GNU_TYPE}-ld ld ); \
462 tar -C /usr/$(CROSS_GNU_TYPE)/lib -c -f - . \
463 | tar -C debian/tmp.$(CROSS_ARCH)/usr/lib/gcc-cross/$(CROSS_GNU_TYPE)/$(GCC_VER) -x -f -; \
464 fi
465 touch $@
466
467 $(stamp)build-libxml2.%: $(stamp)install-stage0-gcc.%
468 @echo 'START $@ ($(CROSS_ARCH))'
469 rm -rf libxml2
470 tar xf /usr/src/libxml2/libxml2*.tar.*
471 mv libxml2-2.* libxml2
472 cd libxml2 && \
473 PATH=/usr/$(CROSS_GNU_TYPE)/bin:${CURDIR}/debian/tmp.${CROSS_ARCH}/usr/bin:${PATH} \
474 LD_LIBRARY_PATH=${CURDIR}/debian/tmp.${CROSS_ARCH}/usr/lib:${CURDIR}/debian/tmp.${CROSS_ARCH}/lib \
475 CFPPLAGS='$(shell unset DEB_HOST_ARCH_VARIANT; DEB_HOST_ARCH=$(CROSS_ARCH) dpkg-buildflags --get CPPFLAGS)' \
476 CFLAGS='-I/usr/$(CROSS_GNU_TYPE)/include -fPIC $(shell unset DEB_HOST_ARCH_VARIANT; DEB_HOST_ARCH=$(CROSS_ARCH) dpkg-buildflags --get CFLAGS)' \
477 LDFLAGS='$(shell unset DEB_HOST_ARCH_VARIANT; DEB_HOST_ARCH=$(CROSS_ARCH) dpkg-buildflags --get LDFLAGS)' \
478 ./configure \
479 --disable-silent-rules \
480 --without-modules \
481 --without-python \
482 --enable-static --disable-shared \
483 --build=$(DEB_BUILD_GNU_TYPE) \
484 --host=${CROSS_GNU_TYPE} \
485 --prefix=${CURDIR}/debian/tmp.${CROSS_ARCH}/usr
486
487 PATH=/usr/$(CROSS_GNU_TYPE)/bin:${CURDIR}/debian/tmp.${CROSS_ARCH}/usr/bin:${PATH} \
488 $(MAKE) $(NJOBS) -C libxml2
489
490 touch $@
491
492 $(stamp)install-libxml2.%: $(stamp)build-libxml2.%
493 @echo 'START $@ ($(CROSS_ARCH))'
494 PATH=/usr/$(CROSS_GNU_TYPE)/bin:${CURDIR}/debian/tmp.${CROSS_ARCH}/usr/bin:${PATH} \
495 $(MAKE) -C libxml2 install
496 touch $@
497
498 $(stamp)build-gcc.%: $(stamp)init-gcc
499 #$(stamp)build-gcc.%: $(if $(filter $(CROSS_ARCH),$(COBOL_ARCHS)),$(stamp)build-libxml2.%) $(stamp)init-gcc
500
501 $(if $(filter $(CROSS_ARCH),$(COBOL_ARCHS)), \
502 $(MAKE) $(NJOBS) -f debian/rules $(stamp)install-libxml2.$(CROSS_ARCH) dbp_flag=$(dbp_flag) \
503 )
504
505 @echo 'START $@ ($(CROSS_ARCH))'
506 @if [ "$(HOST_ARCH)" = "$(CROSS_ARCH)" ] && [ "X$(dbp_flag)" = X-B ]; then \
507 echo "Skipping binary-arch build for $(CROSS_ARCH)"; \
508 else \
509 set -x; \
510 echo ${CROSS_ARCH} >gcc/debian/target; \
511 cd gcc; \
512 debian/rules control; \
513 PATH=$(CURDIR)/bin:$$PATH \
514 WITH_SYSROOT=/ \
515 PKG_IGNORE_CURRENTLY_BUILDING=1 \
516 BACKPORT=false \
517 WITHOUT_LANG="hppa64 jit nvptx" \
518 GNATMAKE=gnatmake-$(GCC_VER) \
519 GNATBIND=gnatbind-$(GCC_VER) \
520 $(if $(filter $(HOST_ARCH),$(CROSS_ARCH)),FORCE_CROSS_LAYOUT=yes WITH_BOOTSTRAP=off) \
521 GCC_PORTS_BUILD=$(GCC_PORTS_BUILD) \
522 $(if $(filter $(CROSS_ARCH),$(COBOL_ARCHS)), \
523 LIBXML2_INCLUDEDIR=$(CURDIR)/debian/tmp.${CROSS_ARCH}/usr/include/libxml2 \
524 LIBXML2_LIBDIR=$(CURDIR)/debian/tmp.${CROSS_ARCH}/usr/lib ) \
525 dpkg-buildpackage $(if $(filter $(HOST_ARCH),$(CROSS_ARCH)),$(subst -b,-A,$(dbp_flag)),$(dbp_flag)) -uc -us -d; \
526 fi
527 rm -vf *-for-host_*.deb
528 touch $@
529
530 clean:
531 rm -rf bin gcc tmp-*
532 rm -f *.*deb *.changes *.buildinfo debian/files
533 rm -rf libxml2 debian/tmp.*
534 rm -rf $(stamp)
535 mkdir $(stamp)
536 dh_clean
537
538 $(stamp)repack-%:
539 @umask 022; \
540 if [ -z "$(TARGET_ARCH)" ]; then \
541 echo >&2 "repack: macro TARGET_ARCH not set"; \
542 exit 1; \
543 fi; \
544 t_arch=$(TARGET_ARCH); \
545 t_gnu_type=$(call _gnu_type,$(TARGET_ARCH)); \
546 deb=$*; \
547 pkgname=`echo $$deb | cut -d'_' -f1`; \
548 tmp=tmp-$$pkgname; \
549 if [ "$(skip_dbg_packages)" = yes ]; then \
550 case $$deb in *-dbg*) exit 0; esac; \
551 fi; \
552 echo "repack $$pkgname ($$deb) ..."; \
553 rm -rf $$tmp; \
554 mkdir -p $$tmp; \
555 dpkg-deb -x $$deb $$tmp; \
556 dpkg-deb -e $$deb $$tmp/DEBIAN; \
557 sed -i -e's/^Source:.*/Source: $(DEB_NAME_ACT) ($(DEB_SVER_ACT))/' \
558 -e "/^Depends:/s/$(DEB_VER_GCC)/$(DEB_VER_GCC)$(CROSS_EXT)/g" \
559 -e "/^Recommends:/s/$(DEB_VER_GCC)/$(DEB_VER_GCC)$(CROSS_EXT)/g" \
560 -e "/^Suggests:/s/$(DEB_VER_GCC)/$(DEB_VER_GCC)$(CROSS_EXT)/g" \
561 -e "/^Version:/s/$(DEB_VER_GCC)/$(DEB_VER_GCC)$(CROSS_EXT)/" \
562 $$tmp/DEBIAN/control ; \
563 sed -i -e "/^Depends:/s/\(libgnat-[0-9]*\) (>= $(DEB_VER_GCC)$(CROSS_EXT))/\1 (>= $(VER_GCC))/g" \
564 $$tmp/DEBIAN/control ; \
565 sed -i -e "/^Depends:/s/\(libgnat-util[0-9]*\) (>= $(DEB_VER_GCC)$(CROSS_EXT))/\1 (>= $(VER_GCC))/g" \
566 $$tmp/DEBIAN/control ; \
567 case $$pkgname in \
568 gcc-$(GCC_VER)-$${t_gnu_type}) \
569 sed -i -e '/Depends/s/\(libcc1[^,]*\)$(CROSS_EXT)/\1/' \
570 $$tmp/DEBIAN/control;; \
571 *-cross) \
572 sed -i -e '/^Depends:/s/\(-base *( *\)=\([^)]*\)cross[^)]*)/\1>=\2)/' \
573 $$tmp/DEBIAN/control;; \
574 esac; \
575 override=$$tmp/usr/share/lintian/overrides/$$pkgname; \
576 install -d -m 755 $$tmp/usr/share/lintian/overrides; \
577 if [ -e debian/overrides/$$pkgname ]; then \
578 cp debian/overrides/$$pkgname $$tmp/usr/share/lintian/overrides/; \
579 fi; \
580 case "$$pkgname" in \
581 gcc-$(GCC_VER)-cross-base*) \
582 echo "$$pkgname binary: wrong-name-for-changelog-of-native-package" \
583 >> $$override \
584 ;; \
585 gcc-$(GCC_VER)-*-base) \
586 echo "$$pkgname binary: wrong-name-for-changelog-of-native-package" \
587 >> $$override \
588 ;; \
589 gcc-$(GCC_VER)-multilib) \
590 echo "$$pkgname binary: binary-from-other-architecture" \
591 >> $$override \
592 ;; \
593 gccgo-$(GCC_VER)*) \
594 echo "$$pkgname binary: binary-from-other-architecture" \
595 >> $$override; \
596 echo "$$pkgname binary: non-standard-dir-in-usr" \
597 >> $$override; \
598 ;; \
599 *-multilib-*) \
600 ;; \
601 cpp-*|g++-*|gcc-*|gccgo-*|gdc-*|gfortran-*|gobjc*|gm2-*|gccrs-*|gnat-$(GCC_VER)-sjlj-*) \
602 echo "$$pkgname binary: binary-from-other-architecture" \
603 >> $$override \
604 ;; \
605 gnat-$(GCC_VER)-*) \
606 echo "$$pkgname binary: binary-from-other-architecture" \
607 >> $$override; \
608 echo "$$pkgname binary: non-standard-dir-in-usr" \
609 >> $$override; \
610 ;; \
611 *-dev-$${t_arch}-cross) \
612 echo "$$pkgname binary: arch-independent-package-contains-binary-or-object" \
613 >> $$override; \
614 echo "$$pkgname binary: non-standard-dir-in-usr" \
615 >> $$override; \
616 ;; \
617 *-dbg-$${t_arch}-cross) \
618 echo "$$pkgname binary: arch-independent-package-contains-binary-or-object" \
619 >> $$override; \
620 echo "$$pkgname binary: debug-package-should-be-named-dbg" \
621 >> $$override; \
622 echo "$$pkgname binary: non-standard-dir-in-usr" \
623 >> $$override; \
624 ;; \
625 *-pic-$${t_arch}-cross) \
626 echo "$$pkgname binary: arch-independent-package-contains-binary-or-object" \
627 >> $$override; \
628 ;; \
629 *-$${t_arch}-cross) \
630 echo "$$pkgname binary: arch-independent-package-contains-binary-or-object" \
631 >> $$override; \
632 echo "$$pkgname binary: non-standard-dir-in-usr" \
633 >> $$override; \
634 echo "$$pkgname binary: shlibs-declares-dependency-on-other-package" \
635 >> $$override; \
636 case "$$pkgname" in \
637 lib*gphobos*) \
638 echo "$$pkgname binary: embedded-library" \
639 >> $$override;; \
640 *-hppa-cross) \
641 echo "$$pkgname binary: binary-compiled-with-profiling-enabled" \
642 >> $$override;; \
643 esac; \
644 ;; \
645 esac; \
646 case $$pkgname in \
647 lib*san*-cross) \
648 echo "$$pkgname binary: custom-library-search-path" \
649 >> $$override; \
650 esac; \
651 case $$pkgname in \
652 lib*san*-cross) \
653 echo "$$pkgname binary: custom-library-search-path" \
654 >> $$override;; \
655 libstdc++-*-dev-amd64-cross) \
656 sed -i -e "/^Depends:/s/libc6 /libc6-amd64-cross /g" \
657 -e "/^Depends:/s/libgcc-s1 /libgcc-s1-amd64-cross /g" \
658 $$tmp/DEBIAN/control; \
659 echo "$$pkgname binary: missing-dependency-on-libc" \
660 >> $$override;; \
661 lib64stdc++-*-dev-i386-cross) \
662 sed -i -e "/^Depends:/s/libc6 /libc6-amd64-i386-cross /g" \
663 -e "/^Depends:/s/libgcc-s1 /lib64gcc-s1-i386-cross /g" \
664 $$tmp/DEBIAN/control; \
665 echo "$$pkgname binary: missing-dependency-on-libc" \
666 >> $$override;; \
667 lib64stdc++-*-dev-x32-cross) \
668 sed -i -e "/^Depends:/s/libc6 /libc6-amd64-x32-cross /g" \
669 -e "/^Depends:/s/libgcc-s1 /lib64gcc-s1-x32-cross /g" \
670 $$tmp/DEBIAN/control; \
671 echo "$$pkgname binary: missing-dependency-on-libc" \
672 >> $$override;; \
673 lib??*stdc++-*-dev-*-cross) \
674 sed -i -e "/^Depends:/s/\(libc6-[[a-z0-9]*\):\([a-z0-9]*\)/\1-\2-cross/g" \
675 $$tmp/DEBIAN/control; \
676 echo "$$pkgname binary: missing-dependency-on-libc" \
677 >> $$override;; \
678 libstdc++-*-dev-*-cross) \
679 sed -i -e "/^Depends:/s/\(libc6[.1]*\):\([a-z0-9]*\)/\1-\2-cross/g" \
680 $$tmp/DEBIAN/control; \
681 echo "$$pkgname binary: missing-dependency-on-libc" \
682 >> $$override;; \
683 esac; \
684 if [ -e $$override ]; then \
685 awk '!x[$$0]++' $$override > $$override.new; mv $$override.new $$override; \
686 fi; \
687 if [ -e $$tmp/usr/share/doc/gcc-${GCC_VER}-$${t_gnu_type}-base/changelog.Debian.gz ]; then \
688 mv $$tmp/usr/share/doc/gcc-${GCC_VER}-$${t_gnu_type}-base/changelog.Debian.gz \
689 $$tmp/usr/share/doc/gcc-${GCC_VER}-$${t_gnu_type}-base/changelog.Debian.gcc-${GCC_VER}.gz; \
690 gzip -c9n debian/changelog \
691 > $$tmp/usr/share/doc/gcc-${GCC_VER}-$${t_gnu_type}-base/changelog.Debian.gz;\
692 fi ; \
693 rm -f $$tmp/DEBIAN/md5sums; \
694 (cd $$tmp && find usr -type f | LC_ALL=C sort | xargs -r md5sum >>DEBIAN/md5sums); \
695 find $$tmp/DEBIAN -name md5sums -empty | xargs -r rm -f; \
696 newdeb=`echo $$deb|sed -e "s/\(.*\)_\(.*\)_\(.*\)/\1_\2$(CROSS_EXT)_\3/g"`; \
697 NO_PKG_MANGLE=1 dpkg-deb --threads-max=2 -b $$tmp ../$$newdeb; \
698 rm -rf $$tmp
699 touch $@
700
701 $(stamp)repack-debs-arch: $(stamp)build
702 @echo START $@
703 dh_testroot
704 $(MAKE) $(NJOBS) -f debian/rules TARGET_ARCH=$(HOST_ARCH) \
705 $(addprefix $(stamp)repack-,$(wildcard *_$(HOST_ARCH_EXT).deb))
706 $(MAKE) $(NJOBS) -f debian/rules TARGET_ARCH=$(HOST_ARCH) \
707 $(addprefix $(stamp)repack-,$(wildcard *$(DEB_VER_GCC)_$(HOST_ARCH_EXT).ddeb))
708 rm -f *$(DEB_VER_GCC)_$(HOST_ARCH_EXT).ddeb
709 if [ -f ../gcc-$(GCC_VER)-$(call _gnu_type,$(HOST_ARCH))-dbgsym_${DEB_VER_GCC}$(CROSS_EXT)_$(HOST_ARCH).ddeb ]; then mv -f ../*.ddeb . ; fi
710 touch $@
711
712 $(stamp)repack-debs-indep: $(stamp)build
713 @echo START $@
714 dh_testroot
715 set -e; \
716 $(foreach arch,$(CROSS_ARCHS), \
717 $(MAKE) $(NJOBS) -f debian/rules TARGET_ARCH=$(arch) \
718 $(addprefix $(stamp)repack-,$(wildcard *-$(arch)-cross_*_all.deb)); \
719 )
720 $(MAKE) $(NJOBS) -f debian/rules TARGET_ARCH=$(HOST_ARCH) \
721 $(addprefix $(stamp)repack-,$(wildcard gcc-$(GCC_VER)-cross-base$(GCC_PORTS_BUILD)_*_all.deb))
722 touch $@
723
724 build: $(stamp)build
725 $(stamp)build: $(foreach arch,$(CROSS_ARCHS),$(addsuffix .$(arch),$(stamp)build-gcc))
726 @echo START $@
727 touch $@
728
729 build: dbp_flag = -b
730 build-arch: dbp_flag = -B
731 build-indep: dbp_flag = -b
732
733 build-arch: $(stamp)build
734 build-indep: $(stamp)build
735
736 binary: binary-arch binary-indep
737 binary-arch: build-arch $(stamp)build $(stamp)repack-debs-arch $(stamp)mangle-debian-files-arch
738 binary-indep: build-indep $(stamp)build $(stamp)repack-debs-indep $(stamp)mangle-debian-files-indep
739
740 define generate_debian_files
741 touch debian/files
742 for deb in $1; do \
743 [ -f "$$deb" ] || continue; \
744 pkg=`basename $$deb`; \
745 if [ "$(skip_dbg_packages)" = yes ]; then \
746 case $$pkg in *-dbg*) continue; esac; \
747 fi; \
748 if [ "$(skip_common_packages)" = yes ] && grep -q "^$$pkg$$" debian/packages.common; then \
749 continue; \
750 fi; \
751 echo -n "$$pkg " >>debian/files; \
752 dpkg-deb -I $$deb | grep Section | cut -d ' ' -f 3 | tr "\n" ' ' >>debian/files; \
753 dpkg-deb -I $$deb | grep Priority | cut -d ' ' -f 3 | tr "\n" ' ' >>debian/files; \
754 dpkg-deb -I $$deb | awk '/^ Architecture:/ {printf "architecture=%s", $$2}' >>debian/files; \
755 echo "" >>debian/files; \
756 done
757 endef
758
759 $(stamp)mangle-debian-files-arch: build $(stamp)repack-debs-arch $(stamp)debian-files-base
760 @echo START $@
761 $(call generate_debian_files, *_$(HOST_ARCH_EXT).deb)
762 sed -i -e "s/${DEB_VER_GCC}_/${DEB_VER_GCC}$(CROSS_EXT)_/g" debian/files
763 touch $@
764
765 $(stamp)mangle-debian-files-indep: $(stamp)repack-debs-indep $(stamp)debian-files-base
766 @echo START $@
767 $(call generate_debian_files, *_all.deb)
768 sed -i -e "s/${DEB_VER_GCC}_/${DEB_VER_GCC}$(CROSS_EXT)_/g" debian/files
769 touch $@
770
771 $(stamp)debian-files-base:
772 @echo START $@
773 rm -f debian/files
774 touch $@
775
776
777 control:
778 sed -e "s/MIN_VER_GCC/${MIN_VER_GCC}/g" \
779 -e "s/GCC_BUILD_DEPS/$(GCC_BUILD_DEPS)/g" \
780 -e "s/BINUTILS_BUILD_DEPS/$(BINUTILS_BUILD_DEPS)/g" \
781 -e "s/GLIBC_BUILD_DEPS/$(GLIBC_BUILD_DEPS)/g" \
782 -e "s/EXTRA_BUILD_DEPS/${EXTRA_BUILD_DEPS}/g" \
783 -e "s/LINUX_BUILD_DEPS/$(LINUX_BUILD_DEPS)/g" \
784 -e "s/GCC_VER/${GCC_VER}/g" \
785 -e "s/MIN_VER_BINUTILS/${MIN_VER_BINUTILS}/g" \
786 -e "s/VER_BINUTILS/${VER_BINUTILS}/g" \
787 -e "s/VER_ISL/${VER_ISL}/g" \
788 -e "s/GCC_PORTS_BUILD/$(GCC_PORTS_BUILD)/g" \
789 -e "s/COBOL_ARCHS/$(COBOL_ARCHS)/" \
790 $(CURDIR)/debian/control.source.in >$(CURDIR)/debian/control
791
792 $(foreach a,$(CROSS_ARCHS), \
793 sed \
794 -e 's/PHOBOS_DEP/$(if $(filter $(a),$(PHOBOS_ARCHS)),${PHOBOS_DEP})/g' \
795 -e 's/PHOBOS_ML_DEP/$(if $(filter $(a),$(PHOBOS_ARCHS)),${PHOBOS_ML_DEP})/g' \
796 -e 's/CROSS_ARCH/$(a)/g' \
797 -e 's/CROSS_GNU_TYPE/$(call _pkg_gnu_type,$(a))/g' \
798 -e 's/MIN_VER_GCC/${MIN_VER_GCC}/g' \
799 -e 's/GCC_VER/${GCC_VER}/g' \
800 -e 's/MIN_VER_BINUTILS/${MIN_VER_BINUTILS}/g' \
801 -e 's/@host_archs@/$(filter-out $(a),$(HOST_ARCHS_$(a)))/g' \
802 -e 's/@ada_host_archs@/$(filter-out $(a),$(HOST_ARCHS_$(a)))/g' \
803 -e 's/@ada64_host_archs@/$(filter-out $(a),$(filter-out XXXi386,$(HOST_ARCHS_$(a))))/g' \
804 $(CURDIR)/debian/control.arch.in >>$(CURDIR)/debian/control; )
805
806 cp debian/packages.invalid debian/packages.invalid-all
807 ifeq (,$(filter $(distrelease), buster bullseye bookworm trixie trusty xenial bionic focal jammy mantic noble))
808 cat debian/packages.invalid-s390x >> debian/packages.invalid-all
809 endif
810 python3 debian/remove-unbuilt \
811 $(if $(filter yes,$(skip_dbg_packages)), --skip-dbg-packages) \
812 $(if $(filter yes,$(skip_common_packages)), --skip-common-packages) \
813 debian/control debian/packages.invalid-all debian/packages.common \
814 > debian/control.new && mv debian/control.new debian/control
815 rm -f debian/packages.invalid-all
816
817 sort-pkgfiles:
818 for i in packages.common packages.invalid; do \
819 LC_ALL=C sort -u debian/$$i > debian/$$i.tmp; \
820 mv -f debian/$$i.tmp debian/$$i; \
821 done
822
823 .PRECIOUS: $(stamp)init-dirs \
824 $(stamp)init-gcc \
825 $(stamp)build \
826 $(stamp)build-stage0-gcc.% \
827 $(stamp)install-stage0-gcc.% \
828 $(stamp)build-libxml2.% \
829 $(stamp)install-libxml2.% \
830 $(stamp)build-gcc.% \
831 $(stamp)debian-files-base \
832 $(stamp)repack-debs-arch \
833 $(stamp)repack-debs-indep \
834 $(stamp)repack-debs-indep.% \
835 $(stamp)mangle-debian-files-arch
836 $(stamp)mangle-debian-files-indep \
837 build build-arch build-indep binary binary-arch binary-indep