Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2
3 , := ,
4 space := $(EMPTY) $(EMPTY)
5
6 export SHELL = /bin/bash
7
8 # prefix for builds - without leading slash
9 PF ?= usr
10
11 include debian/kernelarch.make
12
13 vendor := $(shell if dpkg-vendor --derives-from Ubuntu; then echo Ubuntu; else echo Debian; fi)
14 distrelease := $(shell lsb_release -cs)
15
16 # Support multiple makes at once based on number of processors
17 COMMA = ,
18 # Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
19 ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
20 NUMCPUS := $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
21 NJOBS := -j $(NUMCPUS)
22 DH_PARALLEL := parallel=$(NUMCPUS)
23 endif
24
25 DEB_NAME_ACT := $(shell dpkg-parsechangelog| sed -n 's/-*//; s/^Source: \(.*\)/\1/p')
26 DEB_SVER_ACT := $(shell dpkg-parsechangelog| sed -n 's/^Version: \(.*\)/\1/p')
27 ifeq ($(DEB_NAME_ACT),cross-toolchain-base-mipsen)
28 DEB_VER_ACT := $(shell /bin/sh debian/new_cross_version.sh mipsn32r6el)
29 else
30 DEB_VER_ACT := $(shell /bin/sh debian/new_cross_version.sh $(if $(filter $(DEB_NAME_ACT), cross-toolchain-base),ppc64el,ppc64))
31 endif
32 CROSS_EXT := cross$(DEB_VER_ACT)
33
34 HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
35 HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
36 BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
37 BUILD_MULTIARCH := $(shell dpkg-architecture -qDEB_BUILD_MULTIARCH)
38 stamp := stamp-dir/
39
40 ifeq ($(vendor),Debian)
41 skip_dbg_packages = yes
42 endif
43 ifeq ($(DEB_NAME_ACT),cross-toolchain-base-mipsen)
44 skip_dbg_packages = yes
45 endif
46
47 ifeq ($(DEB_NAME_ACT),cross-toolchain-base)
48 CROSS_ARCHS ?= amd64 i386 s390x ppc64el arm64 armhf riscv64 \
49 $(if $(filter $(vendor), Ubuntu), powerpc)
50 else ifeq ($(DEB_NAME_ACT),cross-toolchain-base-ports)
51 CROSS_ARCHS ?= alpha arc armel hppa loong64 m68k ppc64 sh4 sparc64 x32 \
52 $(if $(filter $(vendor), Ubuntu),, powerpc)
53 else # -mipsen
54 CROSS_ARCHS ?= mips mipsel mips64el mips64 mipsn32 mipsn32el \
55 mipsr6 mipsr6el mipsn32r6 mipsn32r6el mips64r6 mips64r6el
56 endif
57 CROSS_ARCH = $(subst .,,$(suffix $@))
58 KERNEL_ARCH = $(KERNEL_ARCH_$(CROSS_ARCH))
59 CROSS_BIARCH = $(CROSS_BIARCH_$(CROSS_ARCH))
60 _gnu_type = $(shell dpkg-architecture -a$(1) -qDEB_HOST_GNU_TYPE -f)
61 CROSS_GNU_TYPE = $(call _gnu_type,${CROSS_ARCH})
62 CROSS_PKG_GNU_TYPE = $(subst _,-,$(call _gnu_type,${CROSS_ARCH}))
63
64 # package metadata information
65 ifeq (,$(ELF_PACKAGE_METADATA))
66 ELF_PACKAGE_METADATA := $(subst $(space),,{ \
67 "type":"deb", \
68 "os":"$(shell awk -F= '/^ID=/ {print $$2}' /etc/os-release)", \
69 "name":"$(DEB_NAME_ACT)", \
70 "version":"$(DEB_SVER_ACT)", \
71 "architecture":"$(HOST_ARCH)" \
72 $(if $(DEB_BUILD_DEBUG_INFO_URL),$(,)"debugInfoUrl":"$(DEB_BUILD_DEBUG_INFO_URL)") \
73 })
74 export ELF_PACKAGE_METADATA
75 endif
76
77 MIN_VER_GLIBC := 2.42-16~
78 MIN_VER_LINUX := 7.0.4-1~
79 MIN_VER_GCC := 15.2.0-17~
80 MIN_VER_BINUTILS := 2.46-3~
81 VER_GCC_BASE := 15
82 libgcc_base := gcc-s
83
84 DEB_VER_LINUX := $(shell dpkg-query -W -f '$${Version}' linux-libc-dev)
85 ifeq ($(vendor),Ubuntu)
86 MIN_VER_GLIBC := 2.43-16~
87 MIN_VER_LINUX := 7.0.0
88 MIN_VER_GCC := 15.2.0-15~
89 MIN_VER_BINUTILS := 2.46-3~
90 VER_GCC_BASE := 15
91 libgcc_base := gcc-s
92 endif
93 ifeq ($(vendor),Ubuntu)
94 VER_LINUX := $(shell echo $(MIN_VER_LINUX) | sed 's/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
95 with_llc_dev := yes
96 else
97 VER_LINUX := $(shell echo $(MIN_VER_LINUX) | sed 's/^\([0-9]*\.[0-9]*\).*/\1/')
98 endif
99
100 VER_GCC := $(shell dpkg-parsechangelog -SVersion -l/usr/src/gcc-${VER_GCC_BASE}/debian/changelog | cut -f 1 -d '-')
101 DEB_VER_GCC := $(shell dpkg-parsechangelog -SVersion -l/usr/src/gcc-${VER_GCC_BASE}/debian/changelog)
102 VER_BINUTILS := $(shell dpkg-parsechangelog -SVersion -l/usr/src/binutils/debian/changelog | cut -f 1 -d '-'|cut -d '.' -f1-3)
103 PKG_VER_BINUTILS := $(shell dpkg-parsechangelog -SVersion -l/usr/src/binutils/debian/changelog | cut -f 1 -d '-')
104 DEB_VER_BINUTILS := $(shell dpkg-parsechangelog -SVersion -l/usr/src/binutils/debian/changelog)
105 VER_GLIBC := $(shell dpkg-parsechangelog -SVersion -l/usr/src/glibc/debian/changelog | sed 's/-[^-]*$$//')
106 DEB_VER_GLIBC := $(shell dpkg-parsechangelog -SVersion -l/usr/src/glibc/debian/changelog)
107
108 ifeq ($(with_llc_dev),yes)
109 LINUX_BUILT_USING := linux (= $(shell echo $(DEB_VER_LINUX) | sed 's/+.*$$//'))
110 LINUX_BUILD_DEP := linux-source-$(VER_LINUX) (>= $(MIN_VER_LINUX)),
111 GLIBC_LINUX_SOURCE = LINUX_SOURCE=${CURDIR}/debian/tmp.${CROSS_ARCH}/usr
112 else
113 LINUX_BUILD_DEP := $(foreach a,$(sort $(CROSS_ARCHS)),linux-libc-dev-$(a)-cross$(,))
114 GLIBC_LINUX_SOURCE :=
115 endif
116 GLIBC_BUILT_USING := binutils (= $(DEB_VER_BINUTILS)), linux (= $(shell echo $(DEB_VER_LINUX) | sed 's/+.*$$//')), gcc-$(VER_GCC_BASE) (= $(DEB_VER_GCC)), glibc (= $(DEB_VER_GLIBC))
117
118 control_vars = '-Vbu:linux=$(LINUX_BUILT_USING)' '-Vbu:glibc=$(GLIBC_BUILT_USING)'
119
120 CTB_LIBC_DEV_DEPENDS = linux-libc-dev (>= $(DEB_VER_LINUX))
121
122 BINUTILS_DIR := /usr/src/binutils
123 GLIBC_DIR := /usr/src/glibc
124 GCC_DIR := /usr/src/gcc-${VER_GCC_BASE}
125
126 GLIBC_PATCHES := $(CURDIR)/debian/patches/glibc/$(shell echo $(vendor) | tr A-Z a-z)
127
128 binutils_ldpath = $(shell if dpkg --compare-versions $(VER_BINUTILS) lt 2.25.51; \
129 then echo $(CURDIR)/debian/tmp.${CROSS_ARCH}/usr/$(BUILD_GNU_TYPE)/${CROSS_GNU_TYPE}/lib; \
130 else echo $(CURDIR)/debian/tmp.${CROSS_ARCH}/usr/lib/$(BUILD_MULTIARCH)/binutils; fi)
131
132 # FIXME: No conflict for the host == cross case ...
133 BINUTILS_BUILD_CONFLICTS = $(foreach a,$(CROSS_ARCHS),binutils-$(subst _,-,$(call _gnu_type,$(a))) [!$(a)]$(,))
134 GLIBC_BUILD_CONFLICTS = $(foreach a,$(CROSS_ARCHS),libc6-$(a)-cross$(,)$(if $(filter yes,$(with_llc_dev)), linux-libc-dev-$(a)-cross$(,)))
135
136 # taken from gcc packaging
137 define unpack_tarball
138 tar -x -f $1
139 endef
140
141 info:
142 @echo 'Package metadata: $(ELF_PACKAGE_METADATA)'
143 @echo "Binutils version: ${VER_BINUTILS} ${DEB_VER_BINUTILS} ${PKG_VER_BINUTILS}"
144 @echo "GCC version: ${VER_GCC} ${DEB_VER_GCC} ${VER_GCC_BASE}"
145 @echo "Glibc version: ${VER_GLIBC} ${DEB_VER_GLIBC}"
146 @echo "Linux version: ${VER_LINUX} ${DEB_VER_LINUX}"
147 @echo
148 @echo "Target architecture: ${CROSS_ARCH}"
149 @echo "Target GNU type: ${CROSS_GNU_TYPE}"
150 @echo "Host architecture: ${HOST_ARCH}"
151 @echo "Host GNU type: ${HOST_GNU_TYPE}"
152 @echo
153 @echo "Built using information:"
154 @echo ' linux: $(LINUX_BUILT_USING)'
155 @echo ' glibc: $(GLIBC_BUILT_USING)'
156 @echo
157 @echo "New versions: $(DEB_LINUX_GLIBC)$(CROSS_EXT) / $(DEB_VER_GLIBC)$(CROSS_EXT)"
158
159
160 $(stamp)init-dirs:
161 mkdir -p $(foreach arch,$(CROSS_ARCHS),debian/tmp.$(arch))
162 touch $@
163
164 init: $(stamp)init-linux
165
166 $(stamp)init-linux:
167 ifeq ($(with_llc_dev),yes)
168 @echo START $@
169 rm -rf linux-source-[45678].*
170 $(call unpack_tarball, $(firstword $(wildcard /usr/src/linux-source-$(VER_LINUX).tar.* /usr/src/linux-source-$(VER_LINUX)/linux-source-$(VER_LINUX).tar.*)))
171 endif
172 touch $@
173
174 $(stamp)build-linux.%: $(stamp)init-linux
175 @echo START $@
176 ifeq ($(with_llc_dev),yes)
177 $(MAKE) -C linux-source-$(VER_LINUX) headers_install \
178 ARCH=$(KERNEL_ARCH) \
179 INSTALL_HDR_PATH=$(CURDIR)/debian/tmp.$(CROSS_ARCH)/usr
180 endif
181 touch $@
182
183 p_lld = linux-libc-dev-$(CROSS_ARCH)-cross
184
185 $(stamp)install-linux.%: $(stamp)build-linux.% $(stamp)init-dirs
186 @echo START $@
187 ifeq ($(with_llc_dev),yes)
188 rm -rf debian/$(p_lld)
189 dh_installdirs -p$(p_lld) \
190 usr/share/doc/$(p_lld) \
191 usr/share/lintian/overrides \
192 usr/$(CROSS_GNU_TYPE)
193 cp -a debian/tmp.$(CROSS_ARCH)/usr/include \
194 debian/$(p_lld)/usr/$(CROSS_GNU_TYPE)/.
195 rm -rf debian/$(p_lld)/usr/$(CROSS_GNU_TYPE)/{drm,scsi} ;\
196 rm -f `find debian/$(p_lld)/usr/$(CROSS_GNU_TYPE) -name .install`
197 rm -f `find debian/$(p_lld)/usr/$(CROSS_GNU_TYPE) -name ..install.cmd`
198
199 ( \
200 echo "$(p_lld) binary: non-standard-dir-in-usr"; \
201 echo "$(p_lld) binary: wrong-name-for-changelog-of-native-package" \
202 ) >> debian/$(p_lld)/usr/share/lintian/overrides/linux-libc-dev-${CROSS_ARCH}-cross
203
204 cp -p /usr/share/doc/linux-source-$(VER_LINUX)/copyright \
205 debian/$(p_lld)/usr/share/doc/$(p_lld)/.
206 zcat /usr/share/doc/linux-source-$(VER_LINUX)/changelog.Debian.gz \
207 > debian/$(p_lld)/usr/share/doc/$(p_lld)/changelog.Debian.linux
208 gzip -9n debian/$(p_lld)/usr/share/doc/$(p_lld)/changelog.Debian.linux
209 cp debian/changelog debian/$(p_lld)/usr/share/doc/$(p_lld)/changelog.Debian
210 gzip -9n debian/$(p_lld)/usr/share/doc/$(p_lld)/changelog.Debian
211 endif
212 touch $@
213
214 define init_binutils
215 $(call unpack_tarball, ${BINUTILS_DIR}/binutils-${VER_BINUTILS}.tar.xz)
216 set -e; \
217 cd binutils-${VER_BINUTILS} ;\
218 cp -a ${BINUTILS_DIR}/debian/ . ;\
219 if [ -n "$$(grep -v '^\#' ${CURDIR}/debian/patches/binutils/series)" ]; then \
220 QUILT_PATCHES=${CURDIR}/debian/patches/binutils quilt --quiltrc /dev/null push -a; \
221 fi; \
222 rm -rf .pc
223 cd binutils-${VER_BINUTILS} ;\
224 env -i CROSS_ARCHS="$(CROSS_ARCHS)" PATH="$(PATH)" debian/rules stamps/control
225 endef
226
227 $(stamp)init-binutils:
228 @echo START $@
229 $(call init_binutils)
230 touch $@
231
232 $(stamp)build-binutils: $(stamp)init-binutils
233 @echo START $@
234 set -e ;\
235 cd binutils-${VER_BINUTILS} ;\
236 WITH_SYSROOT=${CURDIR}/debian/tmp.${CROSS_ARCH} \
237 PATCHED_SOURCES=yes \
238 PKG_IGNORE_CURRENTLY_BUILDING=1 \
239 BACKPORT=false \
240 DEB_BUILD_PROFILES="$(DEB_BUILD_PROFILES) pkg.binutils.nojava" \
241 DEB_BUILD_OPTIONS="$(DEB_BUILD_OPTIONS) nocheck nomult nohppa nopgo" \
242 CROSS_ARCHS="$(CROSS_ARCHS)" \
243 dpkg-buildpackage -B -uc -us -d
244 touch $@
245
246 $(stamp)install-binutils.%: $(stamp)build-binutils $(stamp)init-dirs
247 @echo START $@
248 dpkg-deb -x binutils-common_${DEB_VER_BINUTILS}_${HOST_ARCH}.deb debian/tmp.${CROSS_ARCH}
249 dpkg-deb -x binutils-${CROSS_PKG_GNU_TYPE}_${DEB_VER_BINUTILS}_${HOST_ARCH}.deb debian/tmp.${CROSS_ARCH}
250 $(if $(filter $(HOST_ARCH),$(CROSS_ARCH)), \
251 dpkg-deb -x libbinutils_${DEB_VER_BINUTILS}_${HOST_ARCH}.deb debian/tmp.${CROSS_ARCH}; \
252 dpkg-deb -x libctf0_${DEB_VER_BINUTILS}_${HOST_ARCH}.deb debian/tmp.${CROSS_ARCH}; \
253 dpkg-deb -x libctf-nobfd0_${DEB_VER_BINUTILS}_${HOST_ARCH}.deb debian/tmp.${CROSS_ARCH}; \
254 )
255 mkdir -p debian/tmp.${CROSS_ARCH}/usr/lib/$(BUILD_MULTIARCH)/binutils;
256 mv debian/tmp.${CROSS_ARCH}/usr/lib/$(BUILD_MULTIARCH)/lib{bfd,opcodes}-*.so \
257 debian/tmp.${CROSS_ARCH}/usr/lib/$(BUILD_MULTIARCH)/binutils;
258 mv debian/tmp.${CROSS_ARCH}/usr/lib/$(BUILD_MULTIARCH)/libctf*.so* \
259 debian/tmp.${CROSS_ARCH}/usr/lib/$(BUILD_MULTIARCH)/binutils;
260 rm -f debian/tmp.${CROSS_ARCH}/usr/bin/*.exe
261 for i in debian/tmp.${CROSS_ARCH}/usr/bin/*; do \
262 mv $$i $$i.exe; \
263 ( \
264 echo '#!/bin/sh'; \
265 echo 'LD_LIBRARY_PATH=$(call binutils_ldpath,$*)$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}'; \
266 echo 'export LD_LIBRARY_PATH'; \
267 echo 'exec '$$(basename $$i)'.exe "$$@"'; \
268 ) > $$i; \
269 chmod +x $$i; \
270 done
271 touch $@
272
273 $(stamp)init-gcc:
274 @echo START $@
275 set -e; \
276 mkdir gcc -p ; \
277 cd gcc ; \
278 ln -sf $(wildcard ${GCC_DIR}/gcc-${VER_GCC_BASE}*.tar.xz) \
279 $$(basename $$(tar tf $(wildcard ${GCC_DIR}/gcc-${VER_GCC_BASE}*.tar.xz) | head -1)).tar.xz ;\
280 cp -a ${GCC_DIR}/debian/ . ; \
281 if [ -n "$$(grep -v '^\#' ${CURDIR}/debian/patches/gcc/series)" ]; then \
282 QUILT_PATCHES=${CURDIR}/debian/patches/gcc quilt --quiltrc /dev/null push -a ; \
283 fi;
284 # set -ex; \
285 # if dpkg --compare-versions $(DEB_VER_GCC) le 9.3.0-6; then \
286 # cd gcc; \
287 # patch -p1 < ../debian/patches/gcc/updates.diff; \
288 # fi
289 touch $@
290
291 $(stamp)build-gcc1.%: $(stamp)init-gcc $(stamp)install-binutils.%
292
293 @echo START $@
294 echo ${CROSS_ARCH} >gcc/debian/target
295 cd gcc && \
296 PATH=${CURDIR}/debian/tmp.${CROSS_ARCH}/$(PF)/bin/:${PATH} \
297 LD_LIBRARY_PATH=$(call binutils_ldpath,$*):${CURDIR}/debian/tmp.${CROSS_ARCH}/usr/lib:${CURDIR}/debian/tmp.${CROSS_ARCH}/lib \
298 DH_VERBOSE=1 \
299 WITH_SYSROOT=/ \
300 WITH_BUILD_SYSROOT=${CURDIR}/debian/tmp.${CROSS_ARCH} \
301 DEB_STAGE=stage1 \
302 PKG_IGNORE_CURRENTLY_BUILDING=1 \
303 BACKPORT=false \
304 DEB_BUILD_OPTIONS="$(DEB_BUILD_OPTIONS) nocheck nopgo nolto nohppa64 nojit nonvptx" \
305 WITHOUT_LANG="hppa64 jit nvptx" \
306 $(if $(filter $(HOST_ARCH),$(CROSS_ARCH)),FORCE_CROSS_LAYOUT=yes WITH_BOOTSTRAP=off) \
307 dpkg-buildpackage -b -uc -us -d
308 touch $@
309
310 $(stamp)install-gcc1.%: $(stamp)build-gcc1.%
311 @echo START $@
312 $(call install_gcc)
313 cp -r gcc/build/gcc/include \
314 debian/tmp.${CROSS_ARCH}/$(PF)/lib/gcc-cross/${CROSS_GNU_TYPE}/${VER_GCC_BASE}/
315 cp -r gcc/build/gcc/include-fixed \
316 debian/tmp.${CROSS_ARCH}/$(PF)/lib/gcc-cross/${CROSS_GNU_TYPE}/${VER_GCC_BASE}/
317 $(if $(filter $(CROSS_ARCH),amd64 ppc64 sparc64 x32), \
318 dpkg-deb -x lib32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
319 debian/tmp.${CROSS_ARCH} \
320 )
321 $(if $(filter $(CROSS_ARCH),i386 powerpc x32), \
322 dpkg-deb -x lib64gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
323 debian/tmp.${CROSS_ARCH} \
324 )
325 $(if $(filter $(CROSS_ARCH),amd64 i386), \
326 dpkg-deb -x libx32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
327 debian/tmp.${CROSS_ARCH} \
328 )
329 $(if $(filter $(CROSS_ARCH),mips mipsel mipsr6 mipsr6el), \
330 dpkg-deb -x lib64gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
331 debian/tmp.${CROSS_ARCH}; \
332 dpkg-deb -x libn32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
333 debian/tmp.${CROSS_ARCH} \
334 )
335 $(if $(filter $(CROSS_ARCH),mipsn32 mipsn32el mipsn32r6 mipsn32r6el), \
336 dpkg-deb -x lib64gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
337 debian/tmp.${CROSS_ARCH}; \
338 dpkg-deb -x lib32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
339 debian/tmp.${CROSS_ARCH} \
340 )
341 $(if $(filter $(CROSS_ARCH),mips64 mips64el mips64r6 mips64r6el), \
342 dpkg-deb -x lib32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
343 debian/tmp.${CROSS_ARCH}; \
344 dpkg-deb -x libn32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
345 debian/tmp.${CROSS_ARCH}; \
346 )
347 touch $@
348
349 define install_gcc
350 dpkg-deb -x gcc-${VER_GCC_BASE}-${CROSS_PKG_GNU_TYPE}_${DEB_VER_GCC}_${HOST_ARCH}.deb debian/tmp.${CROSS_ARCH}
351 dpkg-deb -x cpp-${VER_GCC_BASE}-${CROSS_PKG_GNU_TYPE}_${DEB_VER_GCC}_${HOST_ARCH}.deb debian/tmp.${CROSS_ARCH}
352 dpkg-deb -x libgcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb debian/tmp.${CROSS_ARCH}
353 cd debian/tmp.${CROSS_ARCH}/$(PF)/bin/ && \
354 ln -sf ${CROSS_GNU_TYPE}-gcc-${VER_GCC_BASE} ${CROSS_GNU_TYPE}-gcc && \
355 ln -sf ${CROSS_GNU_TYPE}-cpp-${VER_GCC_BASE} ${CROSS_GNU_TYPE}-cpp && \
356 ln -sf ${CROSS_GNU_TYPE}-gcov-${VER_GCC_BASE} ${CROSS_GNU_TYPE}-gcov
357 endef
358
359 $(stamp)build-gcc2.%: $(stamp)init-gcc $(stamp)install-glibc1.%
360 @echo START $@
361 cd debian/tmp.${CROSS_ARCH}/$(PF)/bin/ && \
362 rm -f ${CROSS_GNU_TYPE}-gcc-${VER_GCC_BASE} ${CROSS_GNU_TYPE}-gcc && \
363 rm -f ${CROSS_GNU_TYPE}-cpp-${VER_GCC_BASE} ${CROSS_GNU_TYPE}-cpp && \
364 rm -f ${CROSS_GNU_TYPE}-gcov-${VER_GCC_BASE} ${CROSS_GNU_TYPE}-gcov
365 cd gcc && \
366 PATH=${CURDIR}/debian/tmp.${CROSS_ARCH}/$(PF)/bin:${PATH} \
367 LD_LIBRARY_PATH=$(call binutils_ldpath,$*):${CURDIR}/debian/tmp.${CROSS_ARCH}/usr/lib:${CURDIR}/debian/tmp.${CROSS_ARCH}/lib \
368 DH_VERBOSE=1 \
369 WITH_SYSROOT=/ \
370 WITH_BUILD_SYSROOT=${CURDIR}/debian/tmp.${CROSS_ARCH} \
371 DEB_STAGE=stage2 \
372 PKG_IGNORE_CURRENTLY_BUILDING=1 \
373 BACKPORT=false \
374 DEB_BUILD_OPTIONS="$(DEB_BUILD_OPTIONS) nocheck nopgo nolto nohppa64 nojit nonvptx" \
375 WITHOUT_LANG="hppa64 jit nvptx" \
376 $(if $(filter $(HOST_ARCH),$(CROSS_ARCH)),FORCE_CROSS_LAYOUT=yes WITH_BOOTSTRAP=off) \
377 dpkg-buildpackage -b -uc -us -d
378 touch $@
379
380 $(stamp)install-gcc2.%: $(stamp)build-gcc2.%
381 @echo START $@
382 $(call install_gcc)
383 dpkg-deb -x lib$(libgcc_base)[124]-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
384 debian/tmp.${CROSS_ARCH}
385 $(if $(filter $(CROSS_ARCH),amd64 ppc64 sparc64 x32), \
386 dpkg-deb -x lib32gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
387 debian/tmp.${CROSS_ARCH}; \
388 dpkg-deb -x lib32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
389 debian/tmp.${CROSS_ARCH} \
390 )
391 $(if $(filter $(CROSS_ARCH),i386 powerpc x32), \
392 dpkg-deb -x lib64gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
393 debian/tmp.${CROSS_ARCH}; \
394 dpkg-deb -x lib64gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
395 debian/tmp.${CROSS_ARCH} \
396 )
397 $(if $(filter $(CROSS_ARCH),amd64 i386), \
398 dpkg-deb -x libx32gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
399 debian/tmp.${CROSS_ARCH}; \
400 dpkg-deb -x libx32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
401 debian/tmp.${CROSS_ARCH} \
402 )
403 $(if $(filter $(CROSS_ARCH),mips mipsel mipsr6 mipsr6el), \
404 dpkg-deb -x lib64gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
405 debian/tmp.${CROSS_ARCH}; \
406 dpkg-deb -x lib64gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
407 debian/tmp.${CROSS_ARCH}; \
408 dpkg-deb -x libn32gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
409 debian/tmp.${CROSS_ARCH}; \
410 dpkg-deb -x libn32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
411 debian/tmp.${CROSS_ARCH} \
412 )
413 $(if $(filter $(CROSS_ARCH),mipsn32 mipsn32el mipsn32r6 mipsn32r6el), \
414 dpkg-deb -x lib64gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
415 debian/tmp.${CROSS_ARCH}; \
416 dpkg-deb -x lib64gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
417 debian/tmp.${CROSS_ARCH}; \
418 dpkg-deb -x lib32gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
419 debian/tmp.${CROSS_ARCH}; \
420 dpkg-deb -x lib32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
421 debian/tmp.${CROSS_ARCH} \
422 )
423 $(if $(filter $(CROSS_ARCH),mips64 mips64el mips64r6 mips64r6el), \
424 dpkg-deb -x lib32gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
425 debian/tmp.${CROSS_ARCH}; \
426 dpkg-deb -x lib32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
427 debian/tmp.${CROSS_ARCH}; \
428 dpkg-deb -x libn32gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
429 debian/tmp.${CROSS_ARCH}; \
430 dpkg-deb -x libn32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
431 debian/tmp.${CROSS_ARCH} \
432 )
433 touch $@
434
435 $(stamp)build-gcc3.%: $(stamp)init-gcc $(stamp)install-glibc2.%
436 @echo START $@
437 cd debian/tmp.${CROSS_ARCH}/$(PF)/bin/ && \
438 rm -f ${CROSS_GNU_TYPE}-gcc-${VER_GCC_BASE} ${CROSS_GNU_TYPE}-gcc && \
439 rm -f ${CROSS_GNU_TYPE}-cpp-${VER_GCC_BASE} ${CROSS_GNU_TYPE}-cpp && \
440 rm -f ${CROSS_GNU_TYPE}-gcov-${VER_GCC_BASE} ${CROSS_GNU_TYPE}-gcov
441 cd gcc && \
442 PATH=${CURDIR}/debian/tmp.${CROSS_ARCH}/$(PF)/bin/:${PATH} \
443 LD_LIBRARY_PATH=$(call binutils_ldpath,$*):${CURDIR}/debian/tmp.${CROSS_ARCH}/usr/lib:${CURDIR}/debian/tmp.${CROSS_ARCH}/lib \
444 WITH_BUILD_SYSROOT=${CURDIR}/debian/tmp.${CROSS_ARCH} \
445 DEB_STAGE=stage2 \
446 PKG_IGNORE_CURRENTLY_BUILDING=1 \
447 BACKPORT=false \
448 DEB_BUILD_OPTIONS="$(DEB_BUILD_OPTIONS) nocheck nopgo nolto nohppa64 nojit nonvptx" \
449 WITHOUT_LANG="hppa64 jit nvptx" \
450 $(if $(filter $(HOST_ARCH),$(CROSS_ARCH)),FORCE_CROSS_LAYOUT=yes WITH_BOOTSTRAP=off) \
451 dpkg-buildpackage -b -uc -us -d
452 touch $@
453
454 $(stamp)init-glibc:
455 @echo START $@
456 rm -rf glibc-${VER_GLIBC}
457 $(call unpack_tarball, ${GLIBC_DIR}/glibc-${VER_GLIBC}.tar.xz)
458 cp -a ${GLIBC_DIR}/debian/ glibc-${VER_GLIBC}
459 cd glibc-${VER_GLIBC} ; \
460 QUILT_PATCHES=${GLIBC_PATCHES} quilt --quiltrc /dev/null push -a && \
461 rm -rf .pc/
462 # set -ex; \
463 # if dpkg --compare-versions $(DEB_VER_GLIBC) le 2.27-3; then \
464 # cd glibc-${VER_GLIBC}; \
465 # patch -p1 < ../debian/patches/glibc/updates.diff; \
466 # debian/rules debian/control || true; \
467 # fi
468 touch $@
469
470 $(stamp)build-glibc1.%: $(stamp)init-glibc $(stamp)install-linux.% $(stamp)install-gcc1.%
471 @echo START $@
472 # FIXME: why debian/libgcc1-armel-cross?
473 cd glibc-${VER_GLIBC} && \
474 PATH=${CURDIR}/debian/tmp.${CROSS_ARCH}/$(PF)/bin/:${PATH} \
475 LD_LIBRARY_PATH=$(call binutils_ldpath,$*):${CURDIR}/gcc/debian/lib$(libgcc_base)1-armel-cross/usr/${CROSS_GNU_TYPE}/lib/ \
476 $(GLIBC_LINUX_SOURCE) \
477 PATCHED_SOURCES=yes \
478 WITH_BUILD_SYSROOT=${CURDIR}/debian/tmp.${CROSS_ARCH} \
479 DEB_BUILD_PROFILES=stage1 \
480 PKG_IGNORE_CURRENTLY_BUILDING=1 \
481 BACKPORT=false \
482 DEB_BUILD_OPTIONS="$(DEB_BUILD_OPTIONS) nocheck" \
483 CTB_LIBC_DEV_DEPENDS='$(CTB_LIBC_DEV_DEPENDS)' \
484 DEB_GCC_VERSION='-$(VER_GCC_BASE)' DEB_CFLAGS_APPEND='-Wno-error' \
485 fakeroot dpkg-buildpackage -B -uc -us -a${CROSS_ARCH} -d -Pstage1
486 touch $@
487
488 $(stamp)install-glibc1.%: $(stamp)build-glibc1.%
489 @echo START $@
490 $(if $(filter $(CROSS_ARCH),alpha ia64), \
491 dpkg-deb -x libc6.1-dev_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH}, \
492 dpkg-deb -x libc6-dev_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
493 )
494
495 $(if $(filter $(CROSS_ARCH),ppc64), \
496 dpkg-deb -x libc6-dev-powerpc_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
497 )
498 $(if $(filter $(CROSS_ARCH),sparc64), \
499 dpkg-deb -x libc6-dev-sparc_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
500 )
501 $(if $(filter $(CROSS_ARCH),powerpc), \
502 dpkg-deb -x libc6-dev-ppc64_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
503 )
504 $(if $(filter $(CROSS_ARCH),mips mipsel mipsr6 mipsr6el), \
505 dpkg-deb -x libc6-dev-mips64_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH}; \
506 dpkg-deb -x libc6-dev-mipsn32_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
507 )
508 $(if $(filter $(CROSS_ARCH),mipsn32 mipsn32el mipsn32r6 mipsn32r6el), \
509 dpkg-deb -x libc6-dev-mips64_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH}; \
510 dpkg-deb -x libc6-dev-mips32_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
511 )
512 $(if $(filter $(CROSS_ARCH),mips64 mips64el mips64r6 mips64r6el), \
513 dpkg-deb -x libc6-dev-mips32_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH}; \
514 dpkg-deb -x libc6-dev-mipsn32_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
515 )
516 $(if $(filter $(CROSS_ARCH),amd64), \
517 dpkg-deb -x libc6-dev-i386_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH}; \
518 dpkg-deb -x libc6-dev-x32_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
519 )
520 $(if $(filter $(CROSS_ARCH),i386), \
521 dpkg-deb -x libc6-dev-amd64_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH}; \
522 dpkg-deb -x libc6-dev-x32_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
523 )
524 $(if $(filter $(CROSS_ARCH),x32), \
525 dpkg-deb -x libc6-dev-amd64_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH}; \
526 dpkg-deb -x libc6-dev-i386_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
527 )
528 : # FIXME: why is this needed?
529 cd debian/tmp.${CROSS_ARCH}/usr/lib ;\
530 for crt in ${CROSS_GNU_TYPE}/crt*; do \
531 ln -sf $$crt `basename $$crt`; \
532 done
533 : # dpkg-shlibdeps for the stage2 gcc needs these
534 for d in $$(find debian/tmp.${CROSS_ARCH}/usr/lib -name libc.so -printf '%h\n'); do \
535 ln -sf libc.so $$d/libc.so.6; \
536 done
537 touch $@
538
539 $(stamp)build-glibc2.%: $(stamp)init-glibc $(stamp)install-gcc2.%
540 @echo START $@
541 # FIXME: why debian/libgcc1-armel-cross?
542 cd glibc-${VER_GLIBC} && \
543 PATH=${CURDIR}/debian/tmp.${CROSS_ARCH}/$(PF)/bin/:${PATH} \
544 LD_LIBRARY_PATH=$(call binutils_ldpath,$*):${CURDIR}/gcc/debian/lib$(libgcc_base)1-armel-cross/usr/${CROSS_GNU_TYPE}/lib/ \
545 $(GLIBC_LINUX_SOURCE) \
546 DEB_BUILD_OPTIONS="nocheck notest notests $(DH_PARALLEL)" \
547 PATCHED_SOURCES=yes \
548 WITH_BUILD_SYSROOT=${CURDIR}/debian/tmp.${CROSS_ARCH} \
549 DEB_BUILD_PROFILES=stage2 \
550 PKG_IGNORE_CURRENTLY_BUILDING=1 \
551 BACKPORT=false \
552 DEB_BUILD_OPTIONS="$(DEB_BUILD_OPTIONS) nocheck" \
553 CTB_LIBC_DEV_DEPENDS='$(CTB_LIBC_DEV_DEPENDS)' \
554 DEB_GCC_VERSION='-$(VER_GCC_BASE)' DEB_CFLAGS_APPEND='-Wno-error' \
555 fakeroot dpkg-buildpackage -B -uc -us -a${CROSS_ARCH} -d -Pstage2
556 touch $@
557
558 $(stamp)install-glibc2.%: $(stamp)build-glibc2.%
559 @echo START $@
560 for deb in *${DEB_VER_GLIBC}*.deb; \
561 do \
562 dpkg-deb -x $$deb debian/tmp.${CROSS_ARCH}; \
563 done; \
564 bash debian/fix-links ${CROSS_GNU_TYPE}; \
565 touch $@
566
567 clean:
568 rm -rf linux-source-*
569 rm -rf linux-[45678]*
570 rm -rf glibc-*
571 rm -rf gcc
572 rm -rf binutils-*
573 rm -rf $(foreach arch,$(CROSS_ARCHS),debian/tmp.$(arch))
574 rm -f debian/files debian/no-packages
575 rm -f debian/cross-compile
576 find debian -name '*~' | xargs -r rm -f
577 rm -f *.*deb *.changes *.buildinfo
578 rm -rf repackfiles tmp tmp-* debian/tmp.*
579 rm -rf $(stamp)
580 mkdir $(stamp)
581 dh_clean
582
583 # using wildcard for DEB_LIST_ALL gave only problems
584 ifeq ($(with_llc_dev),yes)
585 DEB_LIST_UNMANGLED = $(foreach a,$(CROSS_ARCHS), \
586 linux-libc-dev-$(a)-cross_${DEB_VER_LINUX}*_all.deb)
587 endif
588 DEB_LIST_MANGLED = $(foreach a,$(CROSS_ARCHS), \
589 libc$(if $(filter $(a),alpha ia64),6.1,6)-$(a)-cross_${VER_GLIBC}-*_all.deb \
590 libc$(if $(filter $(a),alpha ia64),6.1,6)-dev-$(a)-cross_${VER_GLIBC}-*_all.deb)
591
592 ifneq ($(skip_dbg_packages),yes)
593 DEB_LIST_MANGLED += $(foreach a,$(CROSS_ARCHS), \
594 libc$(if $(filter $(a),alpha ia64),6.1,6)-dbg-$(a)-cross_${VER_GLIBC}-*_all.deb)
595 endif
596
597 ifneq (,$(filter ppc64, $(CROSS_ARCHS)))
598 DEB_LIST_MANGLED += \
599 libc6-powerpc-ppc64-cross_${VER_GLIBC}-*_all.deb \
600 libc6-dev-powerpc-ppc64-cross_${VER_GLIBC}-*_all.deb
601 endif
602 ifneq (,$(filter sparc64, $(CROSS_ARCHS)))
603 DEB_LIST_MANGLED += \
604 libc6-sparc-sparc64-cross_${VER_GLIBC}-*_all.deb \
605 libc6-dev-sparc-sparc64-cross_${VER_GLIBC}-*_all.deb
606 endif
607 ifneq (,$(filter amd64, $(CROSS_ARCHS)))
608 DEB_LIST_MANGLED += \
609 libc6-i386-amd64-cross_${VER_GLIBC}-*_all.deb \
610 libc6-dev-i386-amd64-cross_${VER_GLIBC}-*_all.deb \
611 libc6-x32-amd64-cross_${VER_GLIBC}-*_all.deb \
612 libc6-dev-x32-amd64-cross_${VER_GLIBC}-*_all.deb
613 endif
614 ifneq (,$(filter powerpc, $(CROSS_ARCHS)))
615 DEB_LIST_MANGLED += \
616 libc6-ppc64-powerpc-cross_${VER_GLIBC}-*_all.deb \
617 libc6-dev-ppc64-powerpc-cross_${VER_GLIBC}-*_all.deb
618 endif
619 ifneq (,$(filter i386, $(CROSS_ARCHS)))
620 DEB_LIST_MANGLED += \
621 libc6-amd64-i386-cross_${VER_GLIBC}-*_all.deb \
622 libc6-dev-amd64-i386-cross_${VER_GLIBC}-*_all.deb \
623 libc6-x32-i386-cross_${VER_GLIBC}-*_all.deb \
624 libc6-dev-x32-i386-cross_${VER_GLIBC}-*_all.deb
625 endif
626 ifneq (,$(filter x32, $(CROSS_ARCHS)))
627 DEB_LIST_MANGLED += \
628 libc6-amd64-x32-cross_${VER_GLIBC}-*_all.deb \
629 libc6-dev-amd64-x32-cross_${VER_GLIBC}-*_all.deb \
630 libc6-i386-x32-cross_${VER_GLIBC}-*_all.deb \
631 libc6-dev-i386-x32-cross_${VER_GLIBC}-*_all.deb
632 endif
633 ifneq (,$(filter mips, $(CROSS_ARCHS)))
634 DEB_LIST_MANGLED += \
635 libc6-mips64-mips-cross_${VER_GLIBC}-*_all.deb \
636 libc6-dev-mips64-mips-cross_${VER_GLIBC}-*_all.deb \
637 libc6-mipsn32-mips-cross_${VER_GLIBC}-*_all.deb \
638 libc6-dev-mipsn32-mips-cross_${VER_GLIBC}-*_all.deb
639 endif
640 ifneq (,$(filter mipsel, $(CROSS_ARCHS)))
641 DEB_LIST_MANGLED += \
642 libc6-mips64-mipsel-cross_${VER_GLIBC}-*_all.deb \
643 libc6-dev-mips64-mipsel-cross_${VER_GLIBC}-*_all.deb \
644 libc6-mipsn32-mipsel-cross_${VER_GLIBC}-*_all.deb \
645 libc6-dev-mipsn32-mipsel-cross_${VER_GLIBC}-*_all.deb
646 endif
647 ifneq (,$(filter mipsn32, $(CROSS_ARCHS)))
648 DEB_LIST_MANGLED += \
649 libc6-mips64-mipsn32-cross_${VER_GLIBC}-*_all.deb \
650 libc6-dev-mips64-mipsn32-cross_${VER_GLIBC}-*_all.deb \
651 libc6-mips32-mipsn32-cross_${VER_GLIBC}-*_all.deb \
652 libc6-dev-mips32-mipsn32-cross_${VER_GLIBC}-*_all.deb
653 endif
654 ifneq (,$(filter mipsn32el, $(CROSS_ARCHS)))
655 DEB_LIST_MANGLED += \
656 libc6-mips64-mipsn32el-cross_${VER_GLIBC}-*_all.deb \
657 libc6-dev-mips64-mipsn32el-cross_${VER_GLIBC}-*_all.deb \
658 libc6-mips32-mipsn32el-cross_${VER_GLIBC}-*_all.deb \
659 libc6-dev-mips32-mipsn32el-cross_${VER_GLIBC}-*_all.deb
660 endif
661 ifneq (,$(filter mips64, $(CROSS_ARCHS)))
662 DEB_LIST_MANGLED += \
663 libc6-mips32-mips64-cross_${VER_GLIBC}-*_all.deb \
664 libc6-dev-mips32-mips64-cross_${VER_GLIBC}-*_all.deb \
665 libc6-mipsn32-mips64-cross_${VER_GLIBC}-*_all.deb \
666 libc6-dev-mipsn32-mips64-cross_${VER_GLIBC}-*_all.deb
667 endif
668 ifneq (,$(filter mips64el, $(CROSS_ARCHS)))
669 DEB_LIST_MANGLED += \
670 libc6-mips32-mips64el-cross_${VER_GLIBC}-*_all.deb \
671 libc6-dev-mips32-mips64el-cross_${VER_GLIBC}-*_all.deb \
672 libc6-mipsn32-mips64el-cross_${VER_GLIBC}-*_all.deb \
673 libc6-dev-mipsn32-mips64el-cross_${VER_GLIBC}-*_all.deb
674 endif
675 ifneq (,$(filter mipsr6, $(CROSS_ARCHS)))
676 DEB_LIST_MANGLED += \
677 libc6-mips64-mipsr6-cross_${VER_GLIBC}-*_all.deb \
678 libc6-dev-mips64-mipsr6-cross_${VER_GLIBC}-*_all.deb \
679 libc6-mipsn32-mipsr6-cross_${VER_GLIBC}-*_all.deb \
680 libc6-dev-mipsn32-mipsr6-cross_${VER_GLIBC}-*_all.deb
681 endif
682 ifneq (,$(filter mipsr6el, $(CROSS_ARCHS)))
683 DEB_LIST_MANGLED += \
684 libc6-mips64-mipsr6el-cross_${VER_GLIBC}-*_all.deb \
685 libc6-dev-mips64-mipsr6el-cross_${VER_GLIBC}-*_all.deb \
686 libc6-mipsn32-mipsr6el-cross_${VER_GLIBC}-*_all.deb \
687 libc6-dev-mipsn32-mipsr6el-cross_${VER_GLIBC}-*_all.deb
688 endif
689 ifneq (,$(filter mipsn32r6, $(CROSS_ARCHS)))
690 DEB_LIST_MANGLED += \
691 libc6-mips64-mipsn32r6-cross_${VER_GLIBC}-*_all.deb \
692 libc6-dev-mips64-mipsn32r6-cross_${VER_GLIBC}-*_all.deb \
693 libc6-mips32-mipsn32r6-cross_${VER_GLIBC}-*_all.deb \
694 libc6-dev-mips32-mipsn32r6-cross_${VER_GLIBC}-*_all.deb
695 endif
696 ifneq (,$(filter mipsn32r6el, $(CROSS_ARCHS)))
697 DEB_LIST_MANGLED += \
698 libc6-mips64-mipsn32r6el-cross_${VER_GLIBC}-*_all.deb \
699 libc6-dev-mips64-mipsn32r6el-cross_${VER_GLIBC}-*_all.deb \
700 libc6-mips32-mipsn32r6el-cross_${VER_GLIBC}-*_all.deb \
701 libc6-dev-mips32-mipsn32r6el-cross_${VER_GLIBC}-*_all.deb
702 endif
703 ifneq (,$(filter mips64r6, $(CROSS_ARCHS)))
704 DEB_LIST_MANGLED += \
705 libc6-mips32-mips64r6-cross_${VER_GLIBC}-*_all.deb \
706 libc6-dev-mips32-mips64r6-cross_${VER_GLIBC}-*_all.deb \
707 libc6-mipsn32-mips64r6-cross_${VER_GLIBC}-*_all.deb \
708 libc6-dev-mipsn32-mips64r6-cross_${VER_GLIBC}-*_all.deb
709 endif
710 ifneq (,$(filter mips64r6el, $(CROSS_ARCHS)))
711 DEB_LIST_MANGLED += \
712 libc6-mips32-mips64r6el-cross_${VER_GLIBC}-*_all.deb \
713 libc6-dev-mips32-mips64r6el-cross_${VER_GLIBC}-*_all.deb \
714 libc6-mipsn32-mips64r6el-cross_${VER_GLIBC}-*_all.deb \
715 libc6-dev-mipsn32-mips64r6el-cross_${VER_GLIBC}-*_all.deb
716 endif
717
718 # lib$(libgcc_base)1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
719 # lib$(libgcc_base)1-dbg-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
720
721 #
722 # Repack resulting packages to make some changes;
723 # - I want libgcc1 to contain changelog etc which normally are in gcc-${VER_GCC_BASE}-*-base package
724 # - libgcc1(-dbg) should depend on proper version libgcc1 (epoch hardcoded)
725 # - libgcc1-dbg needs to have doc symlink to libgcc1
726 # - linux-libc-dev gets copyright and changelog
727 # - libc6 gets copyright and changelog
728 # - libc6 gets dependencies removed (no dependency on libgcc1)
729 # - libc6-dev-armhf-cross ships symlink to /usr/arm-linux-gnueabi/lib/hf for multilib cross compiler
730 # - libc6-sparc64-cross: Remove /usr/sparc64-linux-gnu/lib/ld-linux.so.2
731
732 $(stamp)repack-%:
733 @echo START $@
734 umask 022; \
735 deb=$*; \
736 pkgname=`echo $$deb | cut -d'_' -f1`; \
737 tmp=tmp-$$pkgname; \
738 cross_arch=$$(echo $$deb | sed 's/.*-\([^-][^-]*\)-cross_.*/\1/'); \
739 case $${cross_arch} in alpha|ia64) libc_ver=6.1;; *) libc_ver=6;; esac; \
740 echo "repack for $$cross_arch: $$pkgname ($$deb) ..."; \
741 rm -rf $$tmp; \
742 mkdir -p $$tmp; \
743 dpkg-deb -x $$deb $$tmp; \
744 dpkg-deb -e $$deb $$tmp/DEBIAN; \
745 pkgname=`echo $$deb | cut -d'_' -f1`; \
746 sed -i \
747 -e 's/^Source:.*/Source: $(DEB_NAME_ACT) ($(DEB_SVER_ACT))/' \
748 -e '/^Version:/s/$(DEB_VER_GLIBC)/$(DEB_VER_GLIBC)$(CROSS_EXT)/' \
749 -e '/^Depends:/s/$(DEB_VER_GLIBC)/$(DEB_VER_GLIBC)$(CROSS_EXT)/g' \
750 -e 's/^Built-Using:.*/Built-Using: $(GLIBC_BUILT_USING)/' \
751 -e 's/$(CROSS_EXT)$(CROSS_EXT)/$(CROSS_EXT)/g' \
752 $$tmp/DEBIAN/control; \
753 if [ -f $$tmp/DEBIAN/shlibs ]; then \
754 sed -i 's/\(libc[06][^ ]*\)/\1:'$$cross_arch'/;/^udeb/d' $$tmp/DEBIAN/shlibs; \
755 fi; \
756 install -d -m 755 $$tmp/usr/share/lintian/overrides; \
757 if [ -e debian/overrides/$$pkgname ]; then \
758 cp debian/overrides/$$pkgname $$tmp/usr/share/lintian/overrides/; \
759 fi; \
760 echo "$$pkgname binary: non-standard-dir-in-usr" \
761 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
762 case "$$pkgname" in \
763 linux*) \
764 ;; \
765 libc*-dev*) \
766 echo "$$pkgname binary: arch-independent-package-contains-binary-or-object" \
767 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
768 echo "$$pkgname binary: no-code-sections" \
769 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
770 echo "$$pkgname binary: unpack-message-for-deb-data" \
771 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
772 echo "$$pkgname binary: unstripped-binary-or-object" \
773 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
774 ;; \
775 libc*) \
776 echo "$$pkgname binary: arch-independent-package-contains-binary-or-object" \
777 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
778 echo "$$pkgname binary: embedded-library" \
779 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
780 echo "$$pkgname binary: missing-depends-line" \
781 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
782 echo "$$pkgname binary: shlibs-declares-dependency-on-other-package" \
783 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
784 echo "$$pkgname binary: shared-lib-without-dependency-information" \
785 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
786 echo "$$pkgname binary: shlib-with-executable-bit" \
787 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
788 echo "$$pkgname binary: unstripped-binary-or-object" \
789 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
790 if [ $$pkgname = libc6-hppa-cross ]; then \
791 echo "$$pkgname binary: shlib-with-non-pic-code" \
792 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
793 echo "$$pkgname binary: binary-compiled-with-profiling-enabled" \
794 >> $$tmp/usr/share/lintian/overrides/$$pkgname; \
795 fi; \
796 esac; \
797 case "$$pkgname" in \
798 libc6-sparc64-cross) \
799 rm -f $$tmp/usr/sparc64-linux-gnu/lib64/ld-linux.so.2; \
800 mv $$tmp/usr/sparc64-linux-gnu/lib/ld-linux.so.2 $$tmp/usr/sparc64-linux-gnu/lib64/. ;; \
801 esac; \
802 case "$$pkgname" in \
803 libc6-dev-sparc64-cross) \
804 sed -i -e 's,/lib[^/]*/ld-linux.so.2,/lib64/ld-linux.so.2,' \
805 $$tmp/usr/*/lib/libc.so;; \
806 esac; \
807 case "$$pkgname" in \
808 libc6-dev-sparc64-cross) \
809 sed -i -e 's,/lib[^/]*/ld-linux.so.2,/lib64/ld-linux.so.2,' \
810 $$tmp/usr/*/lib/libc.so;; \
811 esac; \
812 case "$$pkgname" in \
813 libc6-dev-powerpc-ppc64-cross|libc6-dev-s390-s390x-cross) \
814 sed -i -e 's,/lib[^/]*/ld.so.1,/lib32/ld.so.1,' \
815 $$tmp/usr/*/lib32/libc.so;; \
816 esac; \
817 case "$$pkgname" in \
818 libc6-dev-sparc-sparc64-cross|libc6-dev-i386-x32-cross|libc6-dev-i386-amd64-cross|libc6-dev-i386-x32-cross) \
819 sed -i -e 's,/lib[^/]*/ld-linux.so.2,/lib32/ld-linux.so.2,' \
820 $$tmp/usr/*/lib32/libc.so;; \
821 esac; \
822 case "$$pkgname" in \
823 libc6-dev-mips32-*-cross) \
824 sed -i \
825 -e 's,/lib[^/]*/ld-linux-mipsn8.so.1,/libo32/ld-linux-mipsn8.so.1,' \
826 -e 's,/lib[^/]*/ld.so.1,/libo32/ld.so.1,' \
827 $$tmp/usr/*/libo32/libc.so;; \
828 esac; \
829 case "$$pkgname" in \
830 libc6-dev-powerpc-ppc64-cross|libc6-dev-sparc-sparc64-cross|libc6-dev-i386-x32-cross|libc6-dev-s390-s390x-cross|libc6-dev-i386-amd64-cross|libc6-dev-i386-x32-cross) \
831 triplet="$$(basename $$(dirname $$(echo $$tmp/usr/*/lib32)))"; \
832 sed -i -e 's,//,/,g' \
833 -e "s, /lib32/libc, /usr/$$triplet/lib32/libc,g" \
834 -e "s, /usr/lib32/libc, /usr/$$triplet/lib32/libc,g" \
835 $$tmp/usr/*/lib32/libc.so;; \
836 esac; \
837 case "$$pkgname" in \
838 libc6-dev-amd64-i386-cross|libc6-dev-ppc64-powerpc-cross|libc6-dev-amd64-x32-cross) \
839 triplet="$$(basename $$(dirname $$(echo $$tmp/usr/*/lib64)))"; \
840 sed -i -e 's,//,/,g' \
841 -e "s, /lib64/libc, /usr/$$triplet/lib64/libc,g" \
842 -e "s, /usr/lib64/libc, /usr/$$triplet/lib64/libc,g" \
843 $$tmp/usr/*/lib64/libc.so; \
844 sed -i -e 's,//,/,g' \
845 -e "s, /lib64/libm, /usr/$$triplet/lib64/libm,g" \
846 -e "s, /usr/lib64/libm, /usr/$$triplet/lib64/libm,g" \
847 $$tmp/usr/*/lib64/libm.so $$tmp/usr/*/lib64/libm.a;; \
848 esac; \
849 case "$$pkgname" in \
850 libc6-dev-x32-amd64-cross|libc6-dev-x32-i386-cross) \
851 triplet="$$(basename $$(dirname $$(echo $$tmp/usr/*/libx32)))"; \
852 sed -i -e 's,//,/,g' \
853 -e "s, /libx32/libc, /usr/$$triplet/libx32/libc,g" \
854 -e "s, /usr/libx32/libc, /usr/$$triplet/libx32/libc,g" \
855 $$tmp/usr/*/libx32/libc.so; \
856 sed -i -e 's,//,/,g' \
857 -e "s, /libx32/libm, /usr/$$triplet/libx32/libm,g" \
858 -e "s, /usr/libx32/libm, /usr/$$triplet/libx32/libm,g" \
859 $$tmp/usr/*/libx32/libm.so $$tmp/usr/*/libx32/libm.a;; \
860 esac; \
861 case "$$pkgname" in \
862 libc6-dev-powerpc-ppc64-cross|libc6-dev-sparc-sparc64-cross|libc6-dev-i386-x32-cross|libc6-dev-s390-s390x-cross|libc6-dev-i386-amd64-cross|libc6-dev-i386-x32-cross|libc6-dev-mipsn32-mips*-cross) \
863 triplet="$$(basename $$(dirname $$(echo $$tmp/usr/*/lib32)))"; \
864 sed -i -e 's,//,/,g' \
865 -e "s, /lib32/libc, /usr/$$triplet/lib32/libc,g" \
866 -e "s, /usr/lib32/libc, /usr/$$triplet/lib32/libc,g" \
867 $$tmp/usr/*/lib32/libc.so;; \
868 esac; \
869 case "$$pkgname" in \
870 libc6-dev-amd64-i386-cross|libc6-dev-ppc64-powerpc-cross|libc6-dev-amd64-x32-cross|libc6-dev-mips64-mips*-cross) \
871 triplet="$$(basename $$(dirname $$(echo $$tmp/usr/*/lib64)))"; \
872 sed -i -e 's,//,/,g' \
873 -e "s, /lib64/libc, /usr/$$triplet/lib64/libc,g" \
874 -e "s, /usr/lib64/libc, /usr/$$triplet/lib64/libc,g" \
875 $$tmp/usr/*/lib64/libc.so; \
876 sed -i -e 's,//,/,g' \
877 -e "s, /lib64/libm, /usr/$$triplet/lib64/libm,g" \
878 -e "s, /usr/lib64/libm, /usr/$$triplet/lib64/libm,g" \
879 $$tmp/usr/*/lib64/libm.so $$tmp/usr/*/lib64/libm.a;; \
880 esac; \
881 case "$$pkgname" in \
882 libc6-dev-x32-amd64-cross|libc6-dev-x32-i386-cross) \
883 triplet="$$(basename $$(dirname $$(echo $$tmp/usr/*/libx32)))"; \
884 sed -i -e 's,//,/,g' \
885 -e "s, /libx32/libc, /usr/$$triplet/libx32/libc,g" \
886 -e "s, /usr/libx32/libc, /usr/$$triplet/libx32/libc,g" \
887 $$tmp/usr/*/libx32/libc.so; \
888 sed -i -e 's,//,/,g' \
889 -e "s, /libx32/libm, /usr/$$triplet/libx32/libm,g" \
890 -e "s, /usr/libx32/libm, /usr/$$triplet/libx32/libm,g" \
891 $$tmp/usr/*/libx32/libm.so $$tmp/usr/*/libx32/libm.a;; \
892 esac; \
893 case "$$pkgname" in \
894 libc6-dev-mips32-mips*-cross) \
895 triplet="$$(basename $$(dirname $$(echo $$tmp/usr/*/libo32)))"; \
896 sed -i -e 's,//,/,g' \
897 -e "s, /libo32/libc, /usr/$$triplet/libo32/libc,g" \
898 -e "s, /usr/libo32/libc, /usr/$$triplet/libo32/libc,g" \
899 $$tmp/usr/*/libo32/libc.so; \
900 sed -i -e 's,//,/,g' \
901 -e "s, /libo32/libm, /usr/$$triplet/libo32/libm,g" \
902 -e "s, /usr/libo32/libm, /usr/$$triplet/libo32/libm,g" \
903 $$tmp/usr/*/libo32/libm.so $$tmp/usr/*/libo32/libm.a;; \
904 esac; \
905 if [ 'lib$(libgcc_base)1-dbg-$${cross_arch}-cross' = $$pkgname ]; then \
906 sed -i -e 's/^Depends.*/Depends: lib$(libgcc_base)1-$${cross_arch}-cross (= 1:${DEB_VER_GCC}$(CROSS_EXT))/g' $$tmp/DEBIAN/control; \
907 ln -sf lib$(libgcc_base)1-$${cross_arch}-cross $$tmp/usr/share/doc/lib$(libgcc_base)1-dbg-$${cross_arch}-cross; \
908 fi; \
909 if [ 'lib$(libgcc_base)1-$${cross_arch}-cross' = $$pkgname ]; then \
910 sed -i -e'/^Depends/d' $$tmp/DEBIAN/control; \
911 rm $$tmp/usr/share/doc/lib$(libgcc_base)1-$${cross_arch}-cross; \
912 mkdir -p $$tmp/usr/share/doc/lib$(libgcc_base)1-$${cross_arch}-cross; \
913 mv $$tmp/usr/share/doc/lib$(libgcc_base)1-$${cross_arch}-cross/changelog.Debian.gz \
914 $$tmp/usr/share/doc/lib$(libgcc_base)1-$${cross_arch}-cross/changelog.Debian.gcc-${VER_GCC_BASE}.gz; \
915 gzip -cn9 debian/changelog > $$tmp/usr/share/doc/lib$(libgcc_base)1-$${cross_arch}-cross/changelog.Debian.gz;\
916 fi; \
917 if [ 'linux-libc-dev-$${cross_arch}-cross' = $$pkgname ]; then \
918 mkdir -p $$tmp/usr/share/doc/$$pkgname; \
919 cp repackfiles/linux.$${cross_arch}/usr/share/doc/linux-libc-dev/copyright $$tmp/usr/share/doc/$$pkgname; \
920 cp repackfiles/linux.$${cross_arch}/usr/share/doc/linux-libc-dev/changelog.Debian.gz $$tmp/usr/share/doc/$$pkgname; \
921 fi; \
922 if [ 'libc6-armel-cross' = $$pkgname ]; then \
923 sed -i -e'/^Depends/d' $$tmp/DEBIAN/control; \
924 fi; \
925 if [ 'libc6-armhf-cross' = $$pkgname ]; then \
926 sed -i -e'/^Depends/d' $$tmp/DEBIAN/control; \
927 fi; \
928 if [ 'libc6-arm64-cross' = $$pkgname ]; then \
929 sed -i -e'/^Depends/d' $$tmp/DEBIAN/control; \
930 fi; \
931 if [ 'libc6-powerpc-cross' = $$pkgname ]; then \
932 sed -i -e'/^Depends/d' $$tmp/DEBIAN/control; \
933 fi; \
934 if [ 'libc6-ppc64-powerpc-cross' = $$pkgname ]; then \
935 sed -i -e'/^Depends/d' $$tmp/DEBIAN/control; \
936 fi; \
937 case `echo $$pkgname | cut -d'-' -f1` in libc6|libc6.1) \
938 mkdir -p $$tmp/usr/share/doc/$$pkgname; \
939 cp repackfiles/glibc.$${cross_arch}/usr/share/doc/libc$$libc_ver/copyright $$tmp/usr/share/doc/$$pkgname; \
940 cp repackfiles/glibc.$${cross_arch}/usr/share/doc/libc$$libc_ver/changelog.Debian.gz $$tmp/usr/share/doc/$$pkgname; \
941 gzip -c9n debian/changelog > $$tmp/usr/share/doc/$${pkgname}/changelog.gz;\
942 esac; \
943 rm -f $$tmp/DEBIAN/md5sums; \
944 (cd $$tmp && find usr -type f | LC_ALL=C sort | xargs -r md5sum >>DEBIAN/md5sums);\
945 case "$$pkgname" in \
946 libc*) \
947 grep -q '^Built-Using:' $$tmp/DEBIAN/control \
948 || echo 'Built-Using: $(GLIBC_BUILT_USING)' >> $$tmp/DEBIAN/control; \
949 grep -q '^Multi-Arch:' $$tmp/DEBIAN/control \
950 || echo 'Multi-Arch: foreign' >> $$tmp/DEBIAN/control; \
951 esac; \
952 case "$$pkgname" in \
953 libc*-cross|libc*-dev*-cross) \
954 sed -i -E '/^Conflicts:/s/ libc[^,]*(,|$$)//g;/^Conflicts: *$$/d' $$tmp/DEBIAN/control; \
955 esac; \
956 newdeb=`echo $$deb|sed -e "s/\(.*\)_\(.*\)_\(.*\)/\1_\2$(CROSS_EXT)_\3/g"`; \
957 NO_PKG_MANGLE=1 PKG_IGNORE_CURRENTLY_BUILDING=1 dpkg-deb -b $$tmp/ ../$$newdeb; \
958 rm -rf $$tmp
959
960 touch $@
961
962 $(stamp)repack-debs-indep: $(stamp)dpkg-cross
963 @echo START $@
964 # install -d repackfiles/linux
965 # dpkg-deb -x linux-libc-dev_${DEB_VER_LINUX}_${CROSS_ARCH}.deb repackfiles/linux
966 $(foreach a,$(CROSS_ARCHS), \
967 install -d repackfiles/glibc.$(a); \
968 dpkg-deb -x libc$(if $(filter $(a),alpha ia64),6.1,6)_${DEB_VER_GLIBC}_$(a).deb repackfiles/glibc.$(a);)
969
970 $(MAKE) $(NJOBS) -f debian/rules \
971 $(addprefix $(stamp)repack-,$(wildcard $(sort $(foreach a,$(CROSS_ARCHS), \
972 $(if $(filter $(skip_dbg_packages),yes),,libc$(if $(filter $(a),alpha ia64),6.1,6)-dbg-$(a)-cross_${DEB_VER_GLIBC}_all.deb) \
973 libc$(if $(filter $(a),alpha ia64),6.1,6)-$(a)-cross_${DEB_VER_GLIBC}_all.deb \
974 libc$(if $(filter $(a),alpha ia64),6.1,6)-dev-$(a)-cross_${DEB_VER_GLIBC}_all.deb \
975 $(if $(filter ppc64, $(CROSS_ARCHS)), \
976 libc6-powerpc-ppc64-cross_${DEB_VER_GLIBC}_all.deb \
977 libc6-dev-powerpc-ppc64-cross_${DEB_VER_GLIBC}_all.deb \
978 ) \
979 $(if $(filter sparc64, $(CROSS_ARCHS)), \
980 libc6-sparc-sparc64-cross_${DEB_VER_GLIBC}_all.deb \
981 libc6-dev-sparc-sparc64-cross_${DEB_VER_GLIBC}_all.deb \
982 ) \
983 $(if $(filter powerpc, $(CROSS_ARCHS)), \
984 libc6-ppc64-powerpc-cross_${DEB_VER_GLIBC}_all.deb \
985 libc6-dev-ppc64-powerpc-cross_${DEB_VER_GLIBC}_all.deb \
986 ) \
987 $(if $(filter amd64, $(CROSS_ARCHS)), \
988 libc6-i386-amd64-cross_${DEB_VER_GLIBC}_all.deb \
989 libc6-dev-i386-amd64-cross_${DEB_VER_GLIBC}_all.deb \
990 libc6-x32-amd64-cross_${DEB_VER_GLIBC}_all.deb \
991 libc6-dev-x32-amd64-cross_${DEB_VER_GLIBC}_all.deb \
992 ) \
993 $(if $(filter i386, $(CROSS_ARCHS)), \
994 libc6-amd64-i386-cross_${DEB_VER_GLIBC}_all.deb \
995 libc6-dev-amd64-i386-cross_${DEB_VER_GLIBC}_all.deb \
996 libc6-x32-i386-cross_${DEB_VER_GLIBC}_all.deb \
997 libc6-dev-x32-i386-cross_${DEB_VER_GLIBC}_all.deb \
998 ) \
999 $(if $(filter x32, $(CROSS_ARCHS)), \
1000 libc6-amd64-x32-cross_${DEB_VER_GLIBC}_all.deb \
1001 libc6-dev-amd64-x32-cross_${DEB_VER_GLIBC}_all.deb \
1002 libc6-i386-x32-cross_${DEB_VER_GLIBC}_all.deb \
1003 libc6-dev-i386-x32-cross_${DEB_VER_GLIBC}_all.deb \
1004 ) \
1005 $(if $(filter mips, $(CROSS_ARCHS)), \
1006 libc6-mips64-mips-cross_${DEB_VER_GLIBC}_all.deb \
1007 libc6-dev-mips64-mips-cross_${DEB_VER_GLIBC}_all.deb \
1008 libc6-mipsn32-mips-cross_${DEB_VER_GLIBC}_all.deb \
1009 libc6-dev-mipsn32-mips-cross_${DEB_VER_GLIBC}_all.deb \
1010 ) \
1011 $(if $(filter mipsel, $(CROSS_ARCHS)), \
1012 libc6-mips64-mipsel-cross_${DEB_VER_GLIBC}_all.deb \
1013 libc6-dev-mips64-mipsel-cross_${DEB_VER_GLIBC}_all.deb \
1014 libc6-mipsn32-mipsel-cross_${DEB_VER_GLIBC}_all.deb \
1015 libc6-dev-mipsn32-mipsel-cross_${DEB_VER_GLIBC}_all.deb \
1016 ) \
1017 $(if $(filter mipsn32, $(CROSS_ARCHS)), \
1018 libc6-mips64-mipsn32-cross_${DEB_VER_GLIBC}_all.deb \
1019 libc6-dev-mips64-mipsn32-cross_${DEB_VER_GLIBC}_all.deb \
1020 libc6-mips32-mipsn32-cross_${DEB_VER_GLIBC}_all.deb \
1021 libc6-dev-mips32-mipsn32-cross_${DEB_VER_GLIBC}_all.deb \
1022 ) \
1023 $(if $(filter mipsn32el, $(CROSS_ARCHS)), \
1024 libc6-mips64-mipsn32el-cross_${DEB_VER_GLIBC}_all.deb \
1025 libc6-dev-mips64-mipsn32el-cross_${DEB_VER_GLIBC}_all.deb \
1026 libc6-mips32-mipsn32el-cross_${DEB_VER_GLIBC}_all.deb \
1027 libc6-dev-mips32-mipsn32el-cross_${DEB_VER_GLIBC}_all.deb \
1028 ) \
1029 $(if $(filter mips64, $(CROSS_ARCHS)), \
1030 libc6-mips32-mips64-cross_${DEB_VER_GLIBC}_all.deb \
1031 libc6-dev-mips32-mips64-cross_${DEB_VER_GLIBC}_all.deb \
1032 libc6-mipsn32-mips64-cross_${DEB_VER_GLIBC}_all.deb \
1033 libc6-dev-mipsn32-mips64-cross_${DEB_VER_GLIBC}_all.deb \
1034 ) \
1035 $(if $(filter mips64el, $(CROSS_ARCHS)), \
1036 libc6-mips32-mips64el-cross_${DEB_VER_GLIBC}_all.deb \
1037 libc6-dev-mips32-mips64el-cross_${DEB_VER_GLIBC}_all.deb \
1038 libc6-mipsn32-mips64el-cross_${DEB_VER_GLIBC}_all.deb \
1039 libc6-dev-mipsn32-mips64el-cross_${DEB_VER_GLIBC}_all.deb \
1040 ) \
1041 $(if $(filter mipsr6, $(CROSS_ARCHS)), \
1042 libc6-mips64-mipsr6-cross_${DEB_VER_GLIBC}_all.deb \
1043 libc6-dev-mips64-mipsr6-cross_${DEB_VER_GLIBC}_all.deb \
1044 libc6-mipsn32-mipsr6-cross_${DEB_VER_GLIBC}_all.deb \
1045 libc6-dev-mipsn32-mipsr6-cross_${DEB_VER_GLIBC}_all.deb \
1046 ) \
1047 $(if $(filter mipsr6el, $(CROSS_ARCHS)), \
1048 libc6-mips64-mipsr6el-cross_${DEB_VER_GLIBC}_all.deb \
1049 libc6-dev-mips64-mipsr6el-cross_${DEB_VER_GLIBC}_all.deb \
1050 libc6-mipsn32-mipsr6el-cross_${DEB_VER_GLIBC}_all.deb \
1051 libc6-dev-mipsn32-mipsr6el-cross_${DEB_VER_GLIBC}_all.deb \
1052 ) \
1053 $(if $(filter mipsn32r6, $(CROSS_ARCHS)), \
1054 libc6-mips64-mipsn32r6-cross_${DEB_VER_GLIBC}_all.deb \
1055 libc6-dev-mips64-mipsn32r6-cross_${DEB_VER_GLIBC}_all.deb \
1056 libc6-mips32-mipsn32r6-cross_${DEB_VER_GLIBC}_all.deb \
1057 libc6-dev-mips32-mipsn32r6-cross_${DEB_VER_GLIBC}_all.deb \
1058 ) \
1059 $(if $(filter mipsn32r6el, $(CROSS_ARCHS)), \
1060 libc6-mips64-mipsn32r6el-cross_${DEB_VER_GLIBC}_all.deb \
1061 libc6-dev-mips64-mipsn32r6el-cross_${DEB_VER_GLIBC}_all.deb \
1062 libc6-mips32-mipsn32r6el-cross_${DEB_VER_GLIBC}_all.deb \
1063 libc6-dev-mips32-mipsn32r6el-cross_${DEB_VER_GLIBC}_all.deb \
1064 ) \
1065 $(if $(filter mips64r6, $(CROSS_ARCHS)), \
1066 libc6-mips32-mips64r6-cross_${DEB_VER_GLIBC}_all.deb \
1067 libc6-dev-mips32-mips64r6-cross_${DEB_VER_GLIBC}_all.deb \
1068 libc6-mipsn32-mips64r6-cross_${DEB_VER_GLIBC}_all.deb \
1069 libc6-dev-mipsn32-mips64r6-cross_${DEB_VER_GLIBC}_all.deb \
1070 ) \
1071 $(if $(filter mips64r6el, $(CROSS_ARCHS)), \
1072 libc6-mips32-mips64r6el-cross_${DEB_VER_GLIBC}_all.deb \
1073 libc6-dev-mips32-mips64r6el-cross_${DEB_VER_GLIBC}_all.deb \
1074 libc6-mipsn32-mips64r6el-cross_${DEB_VER_GLIBC}_all.deb \
1075 libc6-dev-mipsn32-mips64r6el-cross_${DEB_VER_GLIBC}_all.deb \
1076 ) \
1077 ))))
1078
1079 build: $(stamp)build
1080 build-arch: # nothing to do
1081 build-indep: $(stamp)build
1082 $(stamp)build: $(foreach arch,$(CROSS_ARCHS),$(addsuffix .$(arch),$(stamp)build-glibc2))
1083 : # we do not need those packages
1084 rm -f binutils-*.*deb
1085 rm -f cpp-*.*deb gcc-*.*deb
1086 rm -f linux-headers*.*deb
1087 rm -f *-doc*.*deb
1088 rm -f *-source*.*deb
1089 rm -f linux-tools-common_*.*deb
1090 rm -f nscd*deb
1091 rm -f multiarch-support*.deb
1092 rm -f lib*gcc*deb
1093 rm -f libc-*bin*.deb
1094 rm -f libc*-pic_*.deb
1095 rm -f locales*.deb
1096 rm -f *.udeb
1097 touch $@
1098
1099
1100 linux_debs = $(foreach arch,$(CROSS_ARCHS), -plinux-libc-dev-${arch}-cross)
1101
1102 binary: binary-arch binary-indep
1103 binary-arch: build-arch
1104 binary-indep: build $(stamp)dpkg-cross $(stamp)mangle-debian-files-indep
1105 @echo START $@
1106 ifeq ($(with_llc_dev),yes)
1107 dh_compress $(linux_debs)
1108 dh_fixperms $(linux_debs)
1109 dh_installdeb $(linux_debs)
1110 dh_gencontrol $(linux_debs) -- -v$(DEB_VER_LINUX)$(CROSS_EXT) $(control_vars)
1111 dh_md5sums $(linux_debs)
1112 dh_builddeb $(linux_debs)
1113 endif
1114
1115 $(stamp)debian-files-base:
1116 @echo START $@
1117 rm -f debian/files
1118 touch $@
1119
1120 define generate_debian_files
1121 @for deb in $1; \
1122 do \
1123 echo -n "`basename $$deb` " >>debian/files; \
1124 dpkg-deb -I $$deb | grep Section | cut -d ' ' -f 3 | tr "\n" ' ' >>debian/files; \
1125 dpkg-deb -I $$deb | grep Priority | cut -d ' ' -f 3 | tr -d "\n" >>debian/files; \
1126 echo "" >>debian/files; \
1127 done
1128 endef
1129
1130 $(stamp)mangle-debian-files-indep: $(stamp)debian-files-base $(stamp)repack-debs-indep
1131 @echo START $@
1132 $(call generate_debian_files, ${DEB_LIST_MANGLED})
1133 sed -i -e "/^libc/s/_all.deb/$(CROSS_EXT)_all.deb/g" debian/files
1134 $(foreach arch,$(CROSS_ARCHS), \
1135 sed -i -e "/^libc/s/_${arch}.deb/$(CROSS_EXT)_${arch}.deb/g" debian/files;)
1136 sed -i -e "/^libc/s/$(CROSS_EXT)$(CROSS_EXT)/$(CROSS_EXT)/g" debian/files
1137
1138 : # glibc packages only, linux-libc-dev doesn't need dpkg-cross
1139 $(stamp)dc-%: build
1140 @echo START $@
1141 @set -e; \
1142 deb=$*; \
1143 arch=$$(echo $$deb | sed 's/.*_\([^_][^_]*\)\.deb$$/\1/'); \
1144 case $$deb in \
1145 libc*-dbg*) \
1146 if [ "$(skip_dbg_packages)" = yes ]; then \
1147 echo "skipping debug package package $$deb"; exit 0; \
1148 fi;; \
1149 libc*-loongson2f*) \
1150 echo "skipping package package $$deb"; exit 0; \
1151 esac; \
1152 echo dpkg-cross $$deb ...; \
1153 echo "default_arch = undefined" > debian/cross-compile; \
1154 set -x; \
1155 PKG_IGNORE_CURRENTLY_BUILDING=1 debian/dpkg-cross -A -M -a $$arch \
1156 -X dpkg -X findutils -X tzdata -X libc-bin -X libc-dev-bin \
1157 -X debconf -X debconf-2.0 \
1158 -b $$deb
1159 touch $@
1160
1161 $(stamp)dpkg-cross: build
1162 @echo START $@
1163 $(MAKE) $(NJOBS) -f debian/rules \
1164 $(addprefix $(stamp)dc-, \
1165 $(wildcard $(foreach a,$(CROSS_ARCHS), \
1166 libc6*_*_$(a).deb libc6*-d*_$(a).deb \
1167 )) \
1168 )
1169 touch $@
1170
1171 control:
1172 ifeq ($(DEB_NAME_ACT),cross-toolchain-base-mipsen)
1173 rm -rf debian/tests
1174 endif
1175 @echo START $@
1176 ( \
1177 sed \
1178 -e "s/MIN_VER_GLIBC/${MIN_VER_GLIBC}/g" \
1179 -e "s/MIN_VER_LINUX/${MIN_VER_LINUX}/g" \
1180 -e "s/VER_LINUX/${VER_LINUX}/g" \
1181 -e "s/MIN_VER_GCC/${MIN_VER_GCC}/g" \
1182 -e "s/MIN_VER_BINUTILS/${MIN_VER_BINUTILS}/g" \
1183 -e "s/VER_GCC_BASE/${VER_GCC_BASE}/g" \
1184 -e "s/@SOURCE@/${DEB_NAME_ACT}/g" \
1185 -e "s/LINUX_BUILD_DEP/$(LINUX_BUILD_DEP)/g" \
1186 -e "s/BINUTILS_BUILD_CONFLICTS/$(BINUTILS_BUILD_CONFLICTS)/g" \
1187 -e "s/GLIBC_BUILD_CONFLICTS/$(GLIBC_BUILD_CONFLICTS)/g" \
1188 debian/control.source.in; \
1189 $(if $(filter yes, $(with_llc_dev)),$(foreach a,$(sort $(CROSS_ARCHS)),sed -e "s/CROSS_ARCH/$(a)/g" debian/control.linux-libc-dev.in;)) \
1190 $(foreach a,$(sort $(CROSS_ARCHS)),sed -e "s/CROSS_ARCH/$(a)/g; s/LIBC_VER/$(if $(filter $(a),alpha ia64),6.1,6)/" debian/control.libc.in;) \
1191 ) > debian/control
1192
1193 ifneq (,$(filter ppc64, $(CROSS_ARCHS)))
1194 sed -e "s/CROSS_ARCH/ppc64/g;s/CROSS_BIARCH/powerpc/g" \
1195 debian/control.multilib.in >> debian/control
1196 endif
1197 ifneq (,$(filter sparc64, $(CROSS_ARCHS)))
1198 sed -e "s/CROSS_ARCH/sparc64/g;s/CROSS_BIARCH/sparc/g" \
1199 debian/control.multilib.in >> debian/control
1200 endif
1201 ifneq (,$(filter powerpc, $(CROSS_ARCHS)))
1202 sed -e "s/CROSS_ARCH/powerpc/g;s/CROSS_BIARCH/ppc64/g" \
1203 debian/control.multilib.in >> debian/control
1204 endif
1205 ifneq (,$(filter amd64, $(CROSS_ARCHS)))
1206 sed -e "s/CROSS_ARCH/amd64/g;s/CROSS_BIARCH/i386/g" \
1207 debian/control.multilib.in >> debian/control
1208 sed -e "s/CROSS_ARCH/amd64/g;s/CROSS_BIARCH/x32/g" \
1209 debian/control.multilib.in >> debian/control
1210 endif
1211 ifneq (,$(filter i386, $(CROSS_ARCHS)))
1212 sed -e "s/CROSS_ARCH/i386/g;s/CROSS_BIARCH/amd64/g" \
1213 debian/control.multilib.in >> debian/control
1214 sed -e "s/CROSS_ARCH/i386/g;s/CROSS_BIARCH/x32/g" \
1215 debian/control.multilib.in >> debian/control
1216 endif
1217 ifneq (,$(filter x32, $(CROSS_ARCHS)))
1218 sed -e "s/CROSS_ARCH/x32/g;s/CROSS_BIARCH/amd64/g" \
1219 debian/control.multilib.in >> debian/control
1220 sed -e "s/CROSS_ARCH/x32/g;s/CROSS_BIARCH/i386/g" \
1221 debian/control.multilib.in >> debian/control
1222 endif
1223 ifneq (,$(filter mips, $(CROSS_ARCHS)))
1224 sed -e "s/CROSS_ARCH/mips/g;s/CROSS_BIARCH/mips64/g" \
1225 debian/control.multilib.in >> debian/control
1226 sed -e "s/CROSS_ARCH/mips/g;s/CROSS_TRIARCH/mipsn32/g" \
1227 debian/control.trilib.in >> debian/control
1228 endif
1229 ifneq (,$(filter mipsel, $(CROSS_ARCHS)))
1230 sed -e "s/CROSS_ARCH/mipsel/g;s/CROSS_BIARCH/mips64/g" \
1231 debian/control.multilib.in >> debian/control
1232 sed -e "s/CROSS_ARCH/mipsel/g;s/CROSS_TRIARCH/mipsn32/g" \
1233 debian/control.trilib.in >> debian/control
1234 endif
1235 ifneq (,$(filter mipsn32, $(CROSS_ARCHS)))
1236 sed -e "s/CROSS_ARCH/mipsn32/g;s/CROSS_BIARCH/mips64/g" \
1237 debian/control.multilib.in >> debian/control
1238 sed -e "s/CROSS_ARCH/mipsn32/g;s/CROSS_TRIARCH/mips32/g" \
1239 debian/control.trilib.in >> debian/control
1240 endif
1241 ifneq (,$(filter mipsn32el, $(CROSS_ARCHS)))
1242 sed -e "s/CROSS_ARCH/mipsn32el/g;s/CROSS_BIARCH/mips64/g" \
1243 debian/control.multilib.in >> debian/control
1244 sed -e "s/CROSS_ARCH/mipsn32el/g;s/CROSS_TRIARCH/mips32/g" \
1245 debian/control.trilib.in >> debian/control
1246 endif
1247 ifneq (,$(filter mips64, $(CROSS_ARCHS)))
1248 sed -e "s/CROSS_ARCH/mips64/g;s/CROSS_BIARCH/mips32/g" \
1249 debian/control.multilib.in >> debian/control
1250 sed -e "s/CROSS_ARCH/mips64/g;s/CROSS_TRIARCH/mipsn32/g" \
1251 debian/control.trilib.in >> debian/control
1252 endif
1253 ifneq (,$(filter mips64el, $(CROSS_ARCHS)))
1254 sed -e "s/CROSS_ARCH/mips64el/g;s/CROSS_BIARCH/mips32/g" \
1255 debian/control.multilib.in >> debian/control
1256 sed -e "s/CROSS_ARCH/mips64el/g;s/CROSS_TRIARCH/mipsn32/g" \
1257 debian/control.trilib.in >> debian/control
1258 endif
1259 ifneq (,$(filter mipsr6, $(CROSS_ARCHS)))
1260 sed -e "s/CROSS_ARCH/mipsr6/g;s/CROSS_BIARCH/mips64/g" \
1261 debian/control.multilib.in >> debian/control
1262 sed -e "s/CROSS_ARCH/mipsr6/g;s/CROSS_TRIARCH/mipsn32/g" \
1263 debian/control.trilib.in >> debian/control
1264 endif
1265 ifneq (,$(filter mipsr6el, $(CROSS_ARCHS)))
1266 sed -e "s/CROSS_ARCH/mipsr6el/g;s/CROSS_BIARCH/mips64/g" \
1267 debian/control.multilib.in >> debian/control
1268 sed -e "s/CROSS_ARCH/mipsr6el/g;s/CROSS_TRIARCH/mipsn32/g" \
1269 debian/control.trilib.in >> debian/control
1270 endif
1271 ifneq (,$(filter mipsn32r6, $(CROSS_ARCHS)))
1272 sed -e "s/CROSS_ARCH/mipsn32r6/g;s/CROSS_BIARCH/mips64/g" \
1273 debian/control.multilib.in >> debian/control
1274 sed -e "s/CROSS_ARCH/mipsn32r6/g;s/CROSS_TRIARCH/mips32/g" \
1275 debian/control.trilib.in >> debian/control
1276 endif
1277 ifneq (,$(filter mipsn32r6el, $(CROSS_ARCHS)))
1278 sed -e "s/CROSS_ARCH/mipsn32r6el/g;s/CROSS_BIARCH/mips64/g" \
1279 debian/control.multilib.in >> debian/control
1280 sed -e "s/CROSS_ARCH/mipsn32r6el/g;s/CROSS_TRIARCH/mips32/g" \
1281 debian/control.trilib.in >> debian/control
1282 endif
1283 ifneq (,$(filter mips64r6, $(CROSS_ARCHS)))
1284 sed -e "s/CROSS_ARCH/mips64r6/g;s/CROSS_BIARCH/mips32/g" \
1285 debian/control.multilib.in >> debian/control
1286 sed -e "s/CROSS_ARCH/mips64r6/g;s/CROSS_TRIARCH/mipsn32/g" \
1287 debian/control.trilib.in >> debian/control
1288 endif
1289 ifneq (,$(filter mips64r6el, $(CROSS_ARCHS)))
1290 sed -e "s/CROSS_ARCH/mips64r6el/g;s/CROSS_BIARCH/mips32/g" \
1291 debian/control.multilib.in >> debian/control
1292 sed -e "s/CROSS_ARCH/mips64r6el/g;s/CROSS_TRIARCH/mipsn32/g" \
1293 debian/control.trilib.in >> debian/control
1294 endif
1295 echo 'foobar' > debian/no-packages
1296 python3 debian/remove-unbuilt \
1297 $(if $(filter yes,$(skip_dbg_packages)), --skip-dbg-packages) \
1298 debian/control debian/no-packages \
1299 > debian/control.new && mv debian/control.new debian/control
1300
1301
1302 .PRECIOUS: $(stamp)init-dirs \
1303 $(stamp)init-linux \
1304 $(stamp)build-linux.% \
1305 $(stamp)install-linux.% \
1306 $(stamp)init-binutils \
1307 $(stamp)build-binutils.% \
1308 $(stamp)install-binutils.% \
1309 $(stamp)init-gcc \
1310 $(stamp)build-gcc1.% \
1311 $(stamp)install-gcc1.% \
1312 $(stamp)build-gcc2.% \
1313 $(stamp)install-gcc2.% \
1314 $(stamp)build-gcc3.% \
1315 $(stamp)init-glibc \
1316 $(stamp)build-glibc1.% \
1317 $(stamp)install-glibc1.% \
1318 $(stamp)build-glibc2.% \
1319 $(stamp)install-glibc2.% \
1320 $(stamp)debian-files-base \
1321 $(stamp)dc-% \
1322 $(stamp)repack-debs-arch \
1323 $(stamp)repack-debs-indep \
1324 $(stamp)repack-debs-indep.% \
1325 $(stamp)mangle-debian-files-arch \
1326 $(stamp)mangle-debian-files-indep
1327
1328 .PHONY: build build-arch build-indep binary binary-arch binary-indep