1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026
|
#!/usr/bin/make -f
# prefix for builds - without leading slash
PF ?= usr
include debian/kernelarch.make
vendor := $(shell if dpkg-vendor --derives-from Ubuntu; then echo Ubuntu; else echo Debian; fi)
# Support multiple makes at once based on number of processors
COMMA = ,
# Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
NUMCPUS := $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
NJOBS := -j $(NUMCPUS)
DH_PARALLEL := parallel=$(NUMCPUS)
endif
DEB_NAME_ACT := $(shell dpkg-parsechangelog| sed -n 's/-*//; s/^Source: \(.*\)/\1/p')
DEB_SVER_ACT := $(shell dpkg-parsechangelog| sed -n 's/^Version: \(.*\)/\1/p')
DEB_VER_ACT := $(shell /bin/sh debian/new_cross_version.sh $(if $(filter $(DEB_NAME_ACT), cross-toolchain-base),ppc64el,ppc64))
CROSS_EXT := cross$(DEB_VER_ACT)
HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
BUILD_MULTIARCH := $(shell dpkg-architecture -qDEB_BUILD_MULTIARCH)
stamp := stamp-dir/
ifeq ($(vendor),Debian)
skip_dbg_packages = yes
endif
ifeq ($(DEB_NAME_ACT),cross-toolchain-base)
CROSS_ARCHS ?= s390x ppc64el arm64 armhf armel \
$(if $(filter $(vendor), Ubuntu),, mips mipsel mips64el)
else
CROSS_ARCHS ?= alpha hppa m68k mips64 powerpc ppc64 sh4 sparc64 \
$(if $(filter $(vendor), Ubuntu), mips mipsel mips64el) \
powerpcspe
endif
CROSS_ARCH = $(subst .,,$(suffix $@))
KERNEL_ARCH = $(KERNEL_ARCH_$(CROSS_ARCH))
CROSS_BIARCH = $(CROSS_BIARCH_$(CROSS_ARCH))
_gnu_type = $(shell dpkg-architecture -a$(1) -qDEB_HOST_GNU_TYPE -f)
CROSS_GNU_TYPE = $(call _gnu_type,${CROSS_ARCH})
# ARM32 soft-float/hard-float multilibs. These are not yet built in a
# "proper" multilib location, so only build simple dependency packages
ARM32_MULTILIBS :=
ifeq ($(vendor),Ubuntu)
ARM32_MULTILIBS := yes
ARM32_MULTILIBS := dummy
endif
MIN_VER_GLIBC := 2.24-8~
MIN_VER_LINUX := 4.9
MIN_VER_GCC := 6.3.0-18~
MIN_VER_BINUTILS := 2.28-5~
DEB_VER_LINUX := $(shell apt-cache policy linux-libc-dev | awk '/^ \*\*\*/ {print $$2}')
ifeq ($(vendor),Ubuntu)
VER_LINUX := $(shell echo $(DEB_VER_LINUX) | sed 's/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
else
VER_LINUX := $(shell echo $(DEB_VER_LINUX) | sed 's/^\([0-9]*\.[0-9]*\).*/\1/')
endif
VER_GCC_BASE := 6
VER_GCC := $(shell dpkg-parsechangelog -l/usr/src/gcc-${VER_GCC_BASE}/debian/changelog | egrep '^Version:' | cut -f 2 -d ' '|cut -f 1 -d '-')
DEB_VER_GCC := $(shell dpkg-parsechangelog -l/usr/src/gcc-${VER_GCC_BASE}/debian/changelog | egrep '^Version:' | cut -f 2 -d ' ')
VER_BINUTILS := $(shell dpkg-parsechangelog -l/usr/src/binutils/debian/changelog | egrep '^Version:' | cut -f 2 -d ' '|cut -f 1 -d '-'|cut -d '.' -f1-3)
PKG_VER_BINUTILS := $(shell dpkg-parsechangelog -l/usr/src/binutils/debian/changelog | egrep '^Version:' | cut -f 2 -d ' '|cut -f 1 -d '-')
DEB_VER_BINUTILS := $(shell dpkg-parsechangelog -l/usr/src/binutils/debian/changelog | egrep '^Version:' | cut -f 2 -d ' ')
VER_GLIBC := $(shell dpkg-parsechangelog -l/usr/src/glibc/debian/changelog | egrep '^Version:' | cut -f 2 -d ' '|cut -f 1 -d '-')
DEB_VER_GLIBC := $(shell dpkg-parsechangelog -l/usr/src/glibc/debian/changelog | egrep '^Version:' | cut -f 2 -d ' ')
LINUX_BUILT_USING := linux (= $(DEB_VER_LINUX))
GLIBC_BUILT_USING := binutils (= $(DEB_VER_BINUTILS)), linux (= $(DEB_VER_LINUX)), gcc-$(VER_GCC_BASE) (= $(DEB_VER_GCC)), glibc (= $(DEB_VER_GLIBC))
control_vars = '-Vbu:linux=$(LINUX_BUILT_USING)' '-Vbu:glibc=$(GLIBC_BUILT_USING)'
CTB_LIBC_DEV_DEPENDS = linux-libc-dev (>= $(DEB_VER_LINUX))
BINUTILS_DIR := /usr/src/binutils
GLIBC_DIR := /usr/src/glibc
GCC_DIR := /usr/src/gcc-${VER_GCC_BASE}
GLIBC_PATCHES := $(CURDIR)/debian/patches/glibc/$(shell echo $(vendor) | tr A-Z a-z)
binutils_ldpath = $(shell if dpkg --compare-versions $(VER_BINUTILS) lt 2.25.51; \
then echo $(CURDIR)/debian/tmp.${CROSS_ARCH}/usr/$(BUILD_GNU_TYPE)/${CROSS_GNU_TYPE}/lib; \
else echo $(CURDIR)/debian/tmp.${CROSS_ARCH}/usr/lib/$(BUILD_MULTIARCH); fi)
# taken from gcc packaging
define unpack_tarball
tar -x -f $1
endef
info:
@echo "Binutils version: ${VER_BINUTILS} ${DEB_VER_BINUTILS} ${PKG_VER_BINUTILS}"
@echo "GCC version: ${VER_GCC} ${DEB_VER_GCC} ${VER_GCC_BASE}"
@echo "Glibc version: ${VER_GLIBC} ${DEB_VER_GLIBC}"
@echo "Linux version: ${VER_LINUX} ${DEB_VER_LINUX}"
@echo
@echo "Target architecture: ${CROSS_ARCH}"
@echo "Target GNU type: ${CROSS_GNU_TYPE}"
@echo "Host architecture: ${HOST_ARCH}"
@echo "Host GNU type: ${HOST_GNU_TYPE}"
@echo
@echo "Built using information:"
@echo ' linux: $(LINUX_BUILT_USING)'
@echo ' glibc: $(GLIBC_BUILT_USING)'
$(stamp)init-dirs:
mkdir -p $(foreach arch,$(CROSS_ARCHS),debian/tmp.$(arch))
touch $@
init: $(stamp)init-linux
$(stamp)init-linux:
@echo START $@
$(call unpack_tarball, $(firstword $(wildcard /usr/src/linux-source-$(VER_LINUX).tar.* /usr/src/linux-source-$(VER_LINUX)/linux-source-$(VER_LINUX).tar.*)))
touch $@
$(stamp)build-linux.%: $(stamp)init-linux
@echo START $@
cp debian/builddeb linux-source-$(VER_LINUX)/scripts/package/
sed -i '/$$(MAKE)/d' linux-source-$(VER_LINUX)/scripts/package/Makefile
set -e; \
export DEBMAIL="`dpkg-parsechangelog |grep ^Maintainer | sed -e 's/^Maintainer: //g'`"; \
export DEBEMAIL="`echo $$DEBMAIL | sed -e 's/.*<\(.*\)>/\1/g'`"; \
export DEBFULLNAME="`echo $$DEBMAIL | sed -e 's/\(.*\)<.*>/\1/g'`"; \
export ARCH=${KERNEL_ARCH} ;\
export KBUILD_DEBARCH=${CROSS_ARCH} ;\
export KDEB_PKGVERSION=${DEB_VER_LINUX} ;\
cd linux-source-${VER_LINUX} ;\
make oldnoconfig ;\
make deb-pkg
rm -rf tmp
install -d tmp
dpkg-deb -R linux-libc-dev-${CROSS_ARCH}-cross_${DEB_VER_LINUX}_all.deb debian/tmp.${CROSS_ARCH}
dpkg-deb -R linux-libc-dev-${CROSS_ARCH}-cross_${DEB_VER_LINUX}_all.deb tmp
cd tmp/usr/include ;\
rm -rf drm scsi ;\
rm -f `find . -name .install` ;\
rm -f `find . -name ..install.cmd`
mkdir tmp/usr/${CROSS_GNU_TYPE}
mv tmp/usr/include/ tmp/usr/${CROSS_GNU_TYPE}/include/
rm tmp/DEBIAN/md5sums
install -d -m 755 tmp/usr/share/lintian/overrides
echo "linux-libc-dev-${CROSS_ARCH}-cross binary: non-standard-dir-in-usr" \
>> tmp/usr/share/lintian/overrides/linux-libc-dev-${CROSS_ARCH}-cross
fakeroot dpkg-deb -b tmp linux-libc-dev-${CROSS_ARCH}-cross_${DEB_VER_LINUX}_all.deb
rm -rf tmp
install -d tmp
touch $@
$(stamp)install-linux.%: $(stamp)build-linux.% $(stamp)init-dirs
@echo START $@
dpkg-deb -x linux-libc-dev-${CROSS_ARCH}-cross_${DEB_VER_LINUX}_all.deb debian/linux-libc-dev-${CROSS_ARCH}-cross
gunzip debian/linux-libc-dev-${CROSS_ARCH}-cross/usr/share/doc/linux-libc-dev-${CROSS_ARCH}-cross/changelog.Debian.gz
mv debian/linux-libc-dev-${CROSS_ARCH}-cross/usr/share/doc/linux-libc-dev-${CROSS_ARCH}-cross/changelog.Debian \
debian/linux-libc-dev-${CROSS_ARCH}-cross/usr/share/doc/linux-libc-dev-${CROSS_ARCH}-cross/changelog.Debian.linux
gzip -cn9 debian/linux-libc-dev-${CROSS_ARCH}-cross/usr/share/doc/linux-libc-dev-${CROSS_ARCH}-cross/changelog.Debian.linux \
> debian/linux-libc-dev-${CROSS_ARCH}-cross/usr/share/doc/linux-libc-dev-${CROSS_ARCH}-cross/changelog.Debian.linux.gz
gzip -cn9 debian/changelog \
> debian/linux-libc-dev-${CROSS_ARCH}-cross/usr/share/doc/linux-libc-dev-${CROSS_ARCH}-cross/changelog.Debian.gz
touch $@
define init_binutils
$(call unpack_tarball, ${BINUTILS_DIR}/binutils-${VER_BINUTILS}.tar.xz)
set -e; \
cd binutils-${PKG_VER_BINUTILS} ;\
cp -a ${BINUTILS_DIR}/debian/ . ;\
if [ -n "$$(grep -v '^\#' ${CURDIR}/debian/patches/binutils/series)" ]; then \
QUILT_PATCHES=${CURDIR}/debian/patches/binutils quilt --quiltrc /dev/null push -a; \
fi; \
rm -rf .pc
endef
$(stamp)init-binutils:
@echo START $@
$(call init_binutils)
touch $@
$(stamp)build-binutils.%: $(stamp)init-binutils
@echo START $@
set -e ;\
cd binutils-${PKG_VER_BINUTILS} ;\
echo ${CROSS_ARCH} > debian/target ;\
WITH_SYSROOT=${CURDIR}/debian/tmp.${CROSS_ARCH} \
PATCHED_SOURCES=yes \
PKG_IGNORE_CURRENTLY_BUILDING=1 \
BACKPORT=false \
dpkg-buildpackage -b -uc -us -d
touch $@
$(stamp)install-binutils.%: $(stamp)build-binutils.% $(stamp)init-dirs
@echo START $@
dpkg-deb -x binutils-${CROSS_GNU_TYPE}_${DEB_VER_BINUTILS}_${HOST_ARCH}.deb debian/tmp.${CROSS_ARCH}
rm -f debian/tmp.${CROSS_ARCH}/usr/bin/*.exe
for i in debian/tmp.${CROSS_ARCH}/usr/bin/*; do \
mv $$i $$i.exe; \
( \
echo '#!/bin/sh'; \
echo 'LD_LIBRARY_PATH=$(call binutils_ldpath,$*)$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}'; \
echo 'export LD_LIBRARY_PATH'; \
echo 'exec $$0.exe "$$@"'; \
) > $$i; \
chmod +x $$i; \
done
touch $@
$(stamp)init-gcc:
@echo START $@
set -e; \
mkdir gcc -p ; \
cd gcc ; \
ln -sf ${GCC_DIR}/gcc-${VER_GCC}.tar.xz gcc-${VER_GCC}.tar.xz ;\
cp -a ${GCC_DIR}/debian/ . ; \
if [ -n "$$(grep -v '^\#' ${CURDIR}/debian/patches/gcc/series)" ]; then \
QUILT_PATCHES=${CURDIR}/debian/patches/gcc quilt --quiltrc /dev/null push -a ; \
fi;
# if dpkg --compare-versions $(DEB_VER_GCC) le 6.2.1-4; then \
# cd gcc; \
# patch -p1 < ../debian/patches/gcc/gcc-stage1.diff; \
# fi
touch $@
$(stamp)build-gcc1.%: $(stamp)init-gcc $(stamp)install-binutils.%
@echo START $@
echo ${CROSS_ARCH} >gcc/debian/target
cd gcc && \
PATH=${CURDIR}/debian/tmp.${CROSS_ARCH}/$(PF)/bin/:${PATH} \
LD_LIBRARY_PATH=$(call binutils_ldpath,$*):${CURDIR}/debian/tmp.${CROSS_ARCH}/usr/lib:${CURDIR}/debian/tmp.${CROSS_ARCH}/lib \
DH_VERBOSE=1 \
WITH_SYSROOT=/ \
WITH_BUILD_SYSROOT=${CURDIR}/debian/tmp.${CROSS_ARCH} \
DEB_STAGE=stage1 \
PKG_IGNORE_CURRENTLY_BUILDING=1 \
BACKPORT=false \
WITHOUT_LANG=hppa64 \
dpkg-buildpackage -b -uc -us -d
touch $@
$(stamp)install-gcc1.%: $(stamp)build-gcc1.%
@echo START $@
$(call install_gcc)
cp -r gcc/build/gcc/include \
debian/tmp.${CROSS_ARCH}/$(PF)/lib/gcc-cross/${CROSS_GNU_TYPE}/${VER_GCC_BASE}/
cp -r gcc/build/gcc/include-fixed \
debian/tmp.${CROSS_ARCH}/$(PF)/lib/gcc-cross/${CROSS_GNU_TYPE}/${VER_GCC_BASE}/
ifneq (,$(ARM32_MULTILIBS))
$(if $(filter $(CROSS_ARCH),armhf), \
dpkg-deb -x libsfgcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),armel), \
dpkg-deb -x libhfgcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH} \
)
endif
$(if $(filter $(CROSS_ARCH),ppc64 s390x sparc64), \
dpkg-deb -x lib32gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x lib32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),powerpc), \
dpkg-deb -x lib64gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),mips mipsel), \
dpkg-deb -x lib64gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x libn32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),mips64 mips64el), \
dpkg-deb -x lib32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x libn32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
)
touch $@
define install_gcc
dpkg-deb -x gcc-${VER_GCC_BASE}-${CROSS_GNU_TYPE}_${DEB_VER_GCC}_${HOST_ARCH}.deb debian/tmp.${CROSS_ARCH}
dpkg-deb -x cpp-${VER_GCC_BASE}-${CROSS_GNU_TYPE}_${DEB_VER_GCC}_${HOST_ARCH}.deb debian/tmp.${CROSS_ARCH}
dpkg-deb -x libgcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb debian/tmp.${CROSS_ARCH}
cd debian/tmp.${CROSS_ARCH}/$(PF)/bin/ && \
ln -sf ${CROSS_GNU_TYPE}-gcc-${VER_GCC} ${CROSS_GNU_TYPE}-gcc && \
ln -sf ${CROSS_GNU_TYPE}-cpp-${VER_GCC} ${CROSS_GNU_TYPE}-cpp && \
ln -sf ${CROSS_GNU_TYPE}-gcov-${VER_GCC} ${CROSS_GNU_TYPE}-gcov
endef
$(stamp)build-gcc2.%: $(stamp)init-gcc $(stamp)install-glibc1.%
@echo START $@
cd gcc && \
PATH=${CURDIR}/debian/tmp.${CROSS_ARCH}/$(PF)/bin:${PATH} \
LD_LIBRARY_PATH=$(call binutils_ldpath,$*):${CURDIR}/debian/tmp.${CROSS_ARCH}/usr/lib:${CURDIR}/debian/tmp.${CROSS_ARCH}/lib \
DH_VERBOSE=1 \
WITH_SYSROOT=/ \
WITH_BUILD_SYSROOT=${CURDIR}/debian/tmp.${CROSS_ARCH} \
DEB_STAGE=stage2 \
PKG_IGNORE_CURRENTLY_BUILDING=1 \
BACKPORT=false \
WITHOUT_LANG=hppa64 \
dpkg-buildpackage -b -uc -us -d
touch $@
$(stamp)install-gcc2.%: $(stamp)build-gcc2.%
@echo START $@
$(call install_gcc)
dpkg-deb -x libgcc[124]-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}
ifneq (,$(ARM32_MULTILIBS))
$(if $(filter $(CROSS_ARCH),armhf), \
dpkg-deb -x libsfgcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x libsfgcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),armel), \
dpkg-deb -x libhfgcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x libhfgcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH} \
)
endif
$(if $(filter $(CROSS_ARCH),ppc64 s390x sparc64), \
dpkg-deb -x lib32gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x lib32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),powerpc), \
dpkg-deb -x lib64gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x lib64gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),mips mipsel), \
dpkg-deb -x lib64gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x lib64gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x libn32gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x libn32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),mips64 mips64el), \
dpkg-deb -x lib32gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x lib32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x libn32gcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x libn32gcc-${VER_GCC_BASE}-dev-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
debian/tmp.${CROSS_ARCH} \
)
touch $@
$(stamp)build-gcc3.%: $(stamp)init-gcc $(stamp)install-glibc2.%
@echo START $@
cd gcc && \
PATH=${CURDIR}/debian/tmp.${CROSS_ARCH}/$(PF)/bin/:${PATH} \
LD_LIBRARY_PATH=$(call binutils_ldpath,$*):${CURDIR}/debian/tmp.${CROSS_ARCH}/usr/lib:${CURDIR}/debian/tmp.${CROSS_ARCH}/lib \
WITH_BUILD_SYSROOT=${CURDIR}/debian/tmp.${CROSS_ARCH} \
DEB_STAGE=stage2 \
PKG_IGNORE_CURRENTLY_BUILDING=1 \
BACKPORT=false \
WITHOUT_LANG=hppa64 \
dpkg-buildpackage -b -uc -us -d
touch $@
$(stamp)init-glibc:
@echo START $@
rm -rf glibc-${VER_GLIBC}
$(call unpack_tarball, ${GLIBC_DIR}/glibc-${VER_GLIBC}.tar.xz)
cp -a ${GLIBC_DIR}/debian/ glibc-${VER_GLIBC}
cd glibc-${VER_GLIBC} ; \
QUILT_PATCHES=${GLIBC_PATCHES} quilt --quiltrc /dev/null push -a && \
rm -rf .pc/
# if dpkg --compare-versions $(DEB_VER_GLIBC) le 2.24-5; then \
# cd glibc-${VER_GLIBC}; \
# patch -p1 < ../debian/patches/glibc/glibc-update.diff; \
# fi
touch $@
$(stamp)build-glibc1.%: $(stamp)init-glibc $(stamp)install-linux.% $(stamp)install-gcc1.%
@echo START $@
# FIXME: why debian/libgcc1-armel-cross?
cd glibc-${VER_GLIBC} && \
PATH=${CURDIR}/debian/tmp.${CROSS_ARCH}/$(PF)/bin/:${PATH} \
LD_LIBRARY_PATH=$(call binutils_ldpath,$*):${CURDIR}/gcc/debian/libgcc1-armel-cross/usr/${CROSS_GNU_TYPE}/lib/ \
LINUX_SOURCE=${CURDIR}/debian/tmp.${CROSS_ARCH}/usr \
PATCHED_SOURCES=yes \
WITH_BUILD_SYSROOT=${CURDIR}/debian/tmp.${CROSS_ARCH} \
DEB_BUILD_PROFILES=stage1 \
PKG_IGNORE_CURRENTLY_BUILDING=1 \
BACKPORT=false \
CTB_LIBC_DEV_DEPENDS='$(CTB_LIBC_DEV_DEPENDS)' \
fakeroot dpkg-buildpackage -B -uc -us -a${CROSS_ARCH} -d
: # FIXME: a libc6.1-alphaev67 package is built on alpha
$(if $(filter $(CROSS_ARCH),alpha), rm -f libc6.1-alphaev67*.deb)
touch $@
$(stamp)install-glibc1.%: $(stamp)build-glibc1.%
@echo START $@
$(if $(filter $(CROSS_ARCH),alpha ia64), \
dpkg-deb -x libc6.1-dev_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH}, \
dpkg-deb -x libc6-dev_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
)
ifneq (,$(ARM32_MULTILIBS))
$(if $(filter $(CROSS_ARCH),armhf), \
dpkg-deb -x libc6-dev-armel_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),armel), \
dpkg-deb -x libc6-dev-armhf_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
)
endif
$(if $(filter $(CROSS_ARCH),ppc64), \
dpkg-deb -x libc6-dev-powerpc_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),s390x), \
dpkg-deb -x libc6-dev-s390_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),sparc64), \
dpkg-deb -x libc6-dev-sparc_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),powerpc), \
dpkg-deb -x libc6-dev-ppc64_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),mips mipsel), \
dpkg-deb -x libc6-dev-mips64_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x libc6-dev-mipsn32_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
)
$(if $(filter $(CROSS_ARCH),mips64 mips64el), \
dpkg-deb -x libc6-dev-mips32_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH}; \
dpkg-deb -x libc6-dev-mipsn32_${DEB_VER_GLIBC}_${CROSS_ARCH}.deb debian/tmp.${CROSS_ARCH} \
)
: # FIXME: why is this needed?
cd debian/tmp.${CROSS_ARCH}/usr/lib ;\
for crt in ${CROSS_GNU_TYPE}/crt*; do \
ln -sf $$crt `basename $$crt`; \
done
: # dpkg-shlibdeps for the stage2 gcc needs these
for d in $$(find debian/tmp.${CROSS_ARCH}/usr/lib -name libc.so -printf '%h\n'); do \
ln -sf libc.so $$d/libc.so.6; \
done
touch $@
$(stamp)build-glibc2.%: $(stamp)init-glibc $(stamp)install-gcc2.%
@echo START $@
# FIXME: why debian/libgcc1-armel-cross?
cd glibc-${VER_GLIBC} && \
PATH=${CURDIR}/debian/tmp.${CROSS_ARCH}/$(PF)/bin/:${PATH} \
LD_LIBRARY_PATH=$(call binutils_ldpath,$*):${CURDIR}/gcc/debian/libgcc1-armel-cross/usr/${CROSS_GNU_TYPE}/lib/ \
LINUX_SOURCE=${CURDIR}/debian/tmp.${CROSS_ARCH}/usr \
DEB_BUILD_OPTIONS="nocheck notest notests $(DH_PARALLEL)" \
PATCHED_SOURCES=yes \
WITH_BUILD_SYSROOT=${CURDIR}/debian/tmp.${CROSS_ARCH} \
DEB_BUILD_PROFILES=stage2 \
PKG_IGNORE_CURRENTLY_BUILDING=1 \
BACKPORT=false \
CTB_LIBC_DEV_DEPENDS='$(CTB_LIBC_DEV_DEPENDS)' \
fakeroot dpkg-buildpackage -B -uc -us -a${CROSS_ARCH} -d
: # FIXME: a libc6.1-alphaev67 package is built on alpha
$(if $(filter $(CROSS_ARCH),alpha), rm -f libc6.1-alphaev67*.deb)
touch $@
$(stamp)install-glibc2.%: $(stamp)build-glibc2.%
@echo START $@
for deb in *${DEB_VER_GLIBC}*.deb; \
do \
dpkg-deb -x $$deb debian/tmp.${CROSS_ARCH}; \
done; \
bash debian/fix-links ${CROSS_GNU_TYPE}; \
touch $@
clean:
rm -rf linux-source-*
rm -rf glibc-*
rm -rf gcc
rm -rf binutils-*
rm -rf $(foreach arch,$(CROSS_ARCHS),debian/tmp.$(arch))
rm -f debian/files debian/no-packages
rm -f debian/cross-compile
find debian -name '*~' | xargs -r rm -f
rm -f *.*deb *.changes *.buildinfo
rm -rf repackfiles tmp tmp-* debian/tmp.*
rm -rf $(stamp)
mkdir $(stamp)
dh_clean
# using wildcard for DEB_LIST_ALL gave only problems
DEB_LIST_UNMANGLED = $(foreach a,$(CROSS_ARCHS), \
linux-libc-dev-$(a)-cross_${DEB_VER_LINUX}*_all.deb)
DEB_LIST_MANGLED = $(foreach a,$(CROSS_ARCHS), \
libc$(if $(filter $(a),alpha ia64),6.1,6)-$(a)-cross_${VER_GLIBC}-*_all.deb \
libc$(if $(filter $(a),alpha ia64),6.1,6)-dev-$(a)-cross_${VER_GLIBC}-*_all.deb)
ifneq ($(skip_dbg_packages),yes)
DEB_LIST_MANGLED += $(foreach a,$(CROSS_ARCHS), \
libc$(if $(filter $(a),alpha ia64),6.1,6)-dbg-$(a)-cross_${VER_GLIBC}-*_all.deb)
endif
ifeq ($(ARM32_MULTILIBS),yes)
ifneq (,$(filter armhf, $(CROSS_ARCHS)))
DEB_LIST_MANGLED += \
libc6-armel-armhf-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-armel-armhf-cross_${VER_GLIBC}-*_all.deb
endif
ifneq (,$(filter armel, $(CROSS_ARCHS)))
DEB_LIST_MANGLED += \
libc6-armhf-armel-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-armhf-armel-cross_${VER_GLIBC}-*_all.deb
endif
endif
ifneq (,$(filter ppc64, $(CROSS_ARCHS)))
DEB_LIST_MANGLED += \
libc6-powerpc-ppc64-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-powerpc-ppc64-cross_${VER_GLIBC}-*_all.deb
endif
ifneq (,$(filter s390x, $(CROSS_ARCHS)))
DEB_LIST_MANGLED += \
libc6-s390-s390x-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-s390-s390x-cross_${VER_GLIBC}-*_all.deb
endif
ifneq (,$(filter sparc64, $(CROSS_ARCHS)))
DEB_LIST_MANGLED += \
libc6-sparc-sparc64-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-sparc-sparc64-cross_${VER_GLIBC}-*_all.deb
endif
ifneq (,$(filter powerpc, $(CROSS_ARCHS)))
DEB_LIST_MANGLED += \
libc6-ppc64-powerpc-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-ppc64-powerpc-cross_${VER_GLIBC}-*_all.deb
endif
ifneq (,$(filter mips, $(CROSS_ARCHS)))
DEB_LIST_MANGLED += \
libc6-mips64-mips-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-mips64-mips-cross_${VER_GLIBC}-*_all.deb \
libc6-mipsn32-mips-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-mipsn32-mips-cross_${VER_GLIBC}-*_all.deb
endif
ifneq (,$(filter mipsel, $(CROSS_ARCHS)))
DEB_LIST_MANGLED += \
libc6-mips64-mipsel-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-mips64-mipsel-cross_${VER_GLIBC}-*_all.deb \
libc6-mipsn32-mipsel-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-mipsn32-mipsel-cross_${VER_GLIBC}-*_all.deb
endif
ifneq (,$(filter mips64, $(CROSS_ARCHS)))
DEB_LIST_MANGLED += \
libc6-mips32-mips64-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-mips32-mips64-cross_${VER_GLIBC}-*_all.deb \
libc6-mipsn32-mips64-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-mipsn32-mips64-cross_${VER_GLIBC}-*_all.deb
endif
ifneq (,$(filter mips64el, $(CROSS_ARCHS)))
DEB_LIST_MANGLED += \
libc6-mips32-mips64el-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-mips32-mips64el-cross_${VER_GLIBC}-*_all.deb \
libc6-mipsn32-mips64el-cross_${VER_GLIBC}-*_all.deb \
libc6-dev-mipsn32-mips64el-cross_${VER_GLIBC}-*_all.deb
endif
# libgcc1-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
# libgcc1-dbg-${CROSS_ARCH}-cross_${DEB_VER_GCC}_all.deb \
#
# Repack resulting packages to make some changes;
# - I want libgcc1 to contain changelog etc which normally are in gcc-${VER_GCC_BASE}-*-base package
# - libgcc1(-dbg) should depend on proper version libgcc1 (epoch hardcoded)
# - libgcc1-dbg needs to have doc symlink to libgcc1
# - linux-libc-dev gets copyright and changelog
# - libc6 gets copyright and changelog
# - libc6 gets dependencies removed (no dependency on libgcc1)
# - libc6-dev-armhf-cross ships symlink to /usr/arm-linux-gnueabi/lib/hf for multilib cross compiler
# FIXME: don't remove these here, but find out why these are left in the glibc build
# W: cross-toolchain-base-ports source: binaries-have-file-conflict libc6-mips32-mips64-cross libc6-mips64-cross usr/mips64-linux-gnuabi64/lib/ld.so.1
# W: cross-toolchain-base-ports source: binaries-have-file-conflict libc6-mips32-mips64el-cross libc6-mips64el-cross usr/mips64el-linux-gnuabi64/lib/ld.so.1
# W: cross-toolchain-base-ports source: binaries-have-file-conflict libc6-sparc-sparc64-cross libc6-sparc64-cross usr/sparc64-linux-gnu/lib/ld-linux.so.2
$(stamp)repack-%:
@echo START $@
umask 022; \
deb=$*; \
pkgname=`echo $$deb | cut -d'_' -f1`; \
tmp=tmp-$$pkgname; \
cross_arch=$$(echo $$deb | sed 's/.*-\([^-][^-]*\)-cross_.*/\1/'); \
case $${cross_arch} in alpha|ia64) libc_ver=6.1;; *) libc_ver=6;; esac; \
echo "repack for $$cross_arch: $$pkgname ($$deb) ..."; \
rm -rf $$tmp; \
mkdir -p $$tmp; \
dpkg-deb -x $$deb $$tmp; \
dpkg-deb -e $$deb $$tmp/DEBIAN; \
pkgname=`echo $$deb | cut -d'_' -f1`; \
sed -i \
-e 's/^Source:.*/Source: $(DEB_NAME_ACT) ($(DEB_SVER_ACT))/' \
-e '/^Version:/s/$(DEB_VER_GLIBC)/$(DEB_VER_GLIBC)$(CROSS_EXT)/' \
-e '/^Depends:/s/$(DEB_VER_GLIBC)/$(DEB_VER_GLIBC)$(CROSS_EXT)/g' \
-e 's/^Built-Using:.*/Built-Using: $(GLIBC_BUILT_USING)/' \
-e 's/$(CROSS_EXT)$(CROSS_EXT)/$(CROSS_EXT)/g' \
$$tmp/DEBIAN/control; \
if [ -f $$tmp/DEBIAN/shlibs ]; then \
sed -i 's/\(libc[06][^ ]*\)/\1:'$$cross_arch'/;/^udeb/d' $$tmp/DEBIAN/shlibs; \
fi; \
install -d -m 755 $$tmp/usr/share/lintian/overrides; \
if [ -e debian/overrides/$$pkgname ]; then \
cp debian/overrides/$$pkgname $$tmp/usr/share/lintian/overrides/; \
fi; \
echo "$$pkgname binary: non-standard-dir-in-usr" \
>> $$tmp/usr/share/lintian/overrides/$$pkgname; \
case "$$pkgname" in \
linux*) \
;; \
libc*-dev*) \
echo "$$pkgname binary: arch-independent-package-contains-binary-or-object" \
>> $$tmp/usr/share/lintian/overrides/$$pkgname; \
echo "$$pkgname binary: unstripped-binary-or-object" \
>> $$tmp/usr/share/lintian/overrides/$$pkgname; \
;; \
libc*) \
echo "$$pkgname binary: arch-independent-package-contains-binary-or-object" \
>> $$tmp/usr/share/lintian/overrides/$$pkgname; \
echo "$$pkgname binary: embedded-library" \
>> $$tmp/usr/share/lintian/overrides/$$pkgname; \
echo "$$pkgname binary: missing-depends-line" \
>> $$tmp/usr/share/lintian/overrides/$$pkgname; \
echo "$$pkgname binary: shlibs-declares-dependency-on-other-package" \
>> $$tmp/usr/share/lintian/overrides/$$pkgname; \
echo "$$pkgname binary: shared-lib-without-dependency-information" \
>> $$tmp/usr/share/lintian/overrides/$$pkgname; \
echo "$$pkgname binary: shlib-with-executable-bit" \
>> $$tmp/usr/share/lintian/overrides/$$pkgname; \
echo "$$pkgname binary: unstripped-binary-or-object" \
>> $$tmp/usr/share/lintian/overrides/$$pkgname; \
if [ $$pkgname = libc6-hppa-cross ]; then \
echo "$$pkgname binary: shlib-with-non-pic-code" \
>> $$tmp/usr/share/lintian/overrides/$$pkgname; \
echo "$$pkgname binary: binary-compiled-with-profiling-enabled" \
>> $$tmp/usr/share/lintian/overrides/$$pkgname; \
fi; \
esac; \
case "$$pkgname" in \
libc6-mips32-mips64-cross|libc6-mips32-mips64el-cross) \
rm -f $$tmp/usr/*/lib/ld.so.1;; \
libc6-sparc-sparc64-cross) \
rm -f $$tmp/usr/*/lib/ld-linux.so.2;; \
esac; \
if [ 'libgcc1-dbg-$${cross_arch}-cross' = $$pkgname ]; then \
sed -i -e 's/^Depends.*/Depends: libgcc1-$${cross_arch}-cross (= 1:${DEB_VER_GCC}$(CROSS_EXT))/g' $$tmp/DEBIAN/control; \
ln -sf libgcc1-$${cross_arch}-cross $$tmp/usr/share/doc/libgcc1-dbg-$${cross_arch}-cross; \
fi; \
if [ 'libgcc1-$${cross_arch}-cross' = $$pkgname ]; then \
sed -i -e'/^Depends/d' $$tmp/DEBIAN/control; \
rm $$tmp/usr/share/doc/libgcc1-$${cross_arch}-cross; \
mkdir -p $$tmp/usr/share/doc/libgcc1-$${cross_arch}-cross; \
mv $$tmp/usr/share/doc/libgcc1-$${cross_arch}-cross/changelog.Debian.gz \
$$tmp/usr/share/doc/libgcc1-$${cross_arch}-cross/changelog.Debian.gcc-${VER_GCC_BASE}.gz; \
gzip -cn9 debian/changelog > $$tmp/usr/share/doc/libgcc1-$${cross_arch}-cross/changelog.Debian.gz;\
fi; \
if [ 'linux-libc-dev-$${cross_arch}-cross' = $$pkgname ]; then \
mkdir -p $$tmp/usr/share/doc/$$pkgname; \
cp repackfiles/linux.$${cross_arch}/usr/share/doc/linux-libc-dev/copyright $$tmp/usr/share/doc/$$pkgname; \
cp repackfiles/linux.$${cross_arch}/usr/share/doc/linux-libc-dev/changelog.Debian.gz $$tmp/usr/share/doc/$$pkgname; \
fi; \
if [ 'libc6-armel-cross' = $$pkgname ]; then \
sed -i -e'/^Depends/d' $$tmp/DEBIAN/control; \
fi; \
if [ 'libc6-armhf-cross' = $$pkgname ]; then \
sed -i -e'/^Depends/d' $$tmp/DEBIAN/control; \
fi; \
if [ 'libc6-arm64-cross' = $$pkgname ]; then \
sed -i -e'/^Depends/d' $$tmp/DEBIAN/control; \
fi; \
if [ 'libc6-powerpc-cross' = $$pkgname ]; then \
sed -i -e'/^Depends/d' $$tmp/DEBIAN/control; \
fi; \
if [ 'libc6-ppc64-powerpc-cross' = $$pkgname ]; then \
sed -i -e'/^Depends/d' $$tmp/DEBIAN/control; \
fi; \
if [ 'libc6-dev-armel-cross' = $$pkgname ]; then \
install -d $$tmp/usr/arm-linux-gnueabihf/lib; \
ln -sf ../../arm-linux-gnueabi/lib $$tmp/usr/arm-linux-gnueabihf/lib/sf; \
ln -sf ../arm-linux-gnueabi/lib $$tmp/usr/arm-linux-gnueabihf/libsf; \
cp -p debian/tmp.armhf/usr/include/arm-linux-gnueabihf/gnu/stubs-hard.h $$tmp/usr/arm-linux-gnueabi/include/gnu/; \
fi; \
if [ 'libc6-dev-armhf-cross' = $$pkgname ] && [ "$(ARM32_MULTILIBS)" = dummy ]; then \
install -d $$tmp/usr/arm-linux-gnueabi/lib; \
ln -sf ../../arm-linux-gnueabihf/lib $$tmp/usr/arm-linux-gnueabi/lib/hf; \
ln -sf ../arm-linux-gnueabihf/lib $$tmp/usr/arm-linux-gnueabi/libhf; \
cp -p debian/tmp.armel/usr/include/arm-linux-gnueabi/gnu/stubs-soft.h $$tmp/usr/arm-linux-gnueabihf/include/gnu/; \
fi; \
case `echo $$pkgname | cut -d'-' -f1` in libc6|libc6.1) \
mkdir -p $$tmp/usr/share/doc/$$pkgname; \
cp repackfiles/glibc.$${cross_arch}/usr/share/doc/libc$$libc_ver/copyright $$tmp/usr/share/doc/$$pkgname; \
cp repackfiles/glibc.$${cross_arch}/usr/share/doc/libc$$libc_ver/changelog.Debian.gz $$tmp/usr/share/doc/$$pkgname; \
gzip -c9n debian/changelog > $$tmp/usr/share/doc/$${pkgname}/changelog.gz;\
esac; \
rm -f $$tmp/DEBIAN/md5sums; \
(cd $$tmp && find usr -type f | LC_ALL=C sort | xargs -r md5sum >>DEBIAN/md5sums);\
case "$$pkgname" in \
libc*) \
grep -q '^Built-Using:' $$tmp/DEBIAN/control \
|| echo 'Built-Using: $(GLIBC_BUILT_USING)' >> $$tmp/DEBIAN/control; \
grep -q '^Multi-Arch:' $$tmp/DEBIAN/control \
|| echo 'Multi-Arch: foreign' >> $$tmp/DEBIAN/control; \
esac; \
newdeb=`echo $$deb|sed -e "s/\(.*\)_\(.*\)_\(.*\)/\1_\2$(CROSS_EXT)_\3/g"`; \
NO_PKG_MANGLE=1 PKG_IGNORE_CURRENTLY_BUILDING=1 dpkg-deb -b $$tmp/ ../$$newdeb; \
rm -rf $$tmp
touch $@
$(stamp)repack-debs-indep: $(stamp)dpkg-cross
@echo START $@
# install -d repackfiles/linux
# dpkg-deb -x linux-libc-dev_${DEB_VER_LINUX}_${CROSS_ARCH}.deb repackfiles/linux
$(foreach a,$(CROSS_ARCHS), \
install -d repackfiles/glibc.$(a); \
dpkg-deb -x libc$(if $(filter $(a),alpha ia64),6.1,6)_${DEB_VER_GLIBC}_$(a).deb repackfiles/glibc.$(a);)
$(MAKE) $(NJOBS) -f debian/rules \
$(addprefix $(stamp)repack-,$(wildcard $(foreach a,$(CROSS_ARCHS), \
$(if $(filter $(skip_dbg_packages),yes),,libc$(if $(filter $(a),alpha ia64),6.1,6)-dbg-$(a)-cross_${DEB_VER_GLIBC}_all.deb) \
libc$(if $(filter $(a),alpha ia64),6.1,6)-$(a)-cross_${DEB_VER_GLIBC}_all.deb \
libc$(if $(filter $(a),alpha ia64),6.1,6)-dev-$(a)-cross_${DEB_VER_GLIBC}_all.deb \
$(if $(filter yes,$(ARM32_MULTILIBS)), \
$(if $(filter armhf, $(CROSS_ARCHS)), \
libc6-armel-armhf-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-armel-armhf-cross_${DEB_VER_GLIBC}_all.deb \
) \
$(if $(filter armel, $(CROSS_ARCHS)), \
libc6-armhf-armel-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-armhf-armel-cross_${DEB_VER_GLIBC}_all.deb \
) \
) \
$(if $(filter ppc64, $(CROSS_ARCHS)), \
libc6-powerpc-ppc64-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-powerpc-ppc64-cross_${DEB_VER_GLIBC}_all.deb \
) \
$(if $(filter s390x, $(CROSS_ARCHS)), \
libc6-s390-s390x-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-s390-s390x-cross_${DEB_VER_GLIBC}_all.deb \
) \
$(if $(filter sparc64, $(CROSS_ARCHS)), \
libc6-sparc-sparc64-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-sparc-sparc64-cross_${DEB_VER_GLIBC}_all.deb \
) \
$(if $(filter powerpc, $(CROSS_ARCHS)), \
libc6-ppc64-powerpc-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-ppc64-powerpc-cross_${DEB_VER_GLIBC}_all.deb \
) \
$(if $(filter mips, $(CROSS_ARCHS)), \
libc6-mips64-mips-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-mips64-mips-cross_${DEB_VER_GLIBC}_all.deb \
libc6-mipsn32-mips-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-mipsn32-mips-cross_${DEB_VER_GLIBC}_all.deb \
) \
$(if $(filter mipsel, $(CROSS_ARCHS)), \
libc6-mips64-mipsel-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-mips64-mipsel-cross_${DEB_VER_GLIBC}_all.deb \
libc6-mipsn32-mipsel-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-mipsn32-mipsel-cross_${DEB_VER_GLIBC}_all.deb \
) \
$(if $(filter mips64, $(CROSS_ARCHS)), \
libc6-mips32-mips64-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-mips32-mips64-cross_${DEB_VER_GLIBC}_all.deb \
libc6-mipsn32-mips64-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-mipsn32-mips64-cross_${DEB_VER_GLIBC}_all.deb \
) \
$(if $(filter mips64el, $(CROSS_ARCHS)), \
libc6-mips32-mips64el-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-mips32-mips64el-cross_${DEB_VER_GLIBC}_all.deb \
libc6-mipsn32-mips64el-cross_${DEB_VER_GLIBC}_all.deb \
libc6-dev-mipsn32-mips64el-cross_${DEB_VER_GLIBC}_all.deb \
) \
)))
build: $(stamp)build
build-arch: # nothing to do
build-indep: $(stamp)build
$(stamp)build: $(foreach arch,$(CROSS_ARCHS),$(addsuffix .$(arch),$(stamp)build-glibc2))
: # we do not need those packages
rm -f binutils-*.*deb
rm -f cpp-*.*deb gcc-*.*deb
rm -f linux-headers*.*deb
rm -f *-doc*.*deb
rm -f *-source*.*deb
rm -f linux-tools-common_*.*deb
rm -f nscd*deb
rm -f multiarch-support*.deb
rm -f lib*gcc*deb
rm -f libc-*bin*.deb
rm -f libc*-pic_*.deb
rm -f locales*.deb
rm -f *.udeb
ifeq ($(ARM32_MULTILIBS),dummy)
rm -f libc6*-armel_*armhf.deb libc6*-armhf_*armel.deb
endif
touch $@
linux_debs = $(foreach arch,$(CROSS_ARCHS), -plinux-libc-dev-${arch}-cross)
ifeq ($(ARM32_MULTILIBS),dummy)
dummy_pkgs = libc6-dev-armhf-armel-cross libc6-armhf-armel-cross \
libc6-dev-armel-armhf-cross libc6-armel-armhf-cross
endif
binary: binary-arch binary-indep
binary-arch: build-arch
binary-indep: build $(stamp)dpkg-cross $(stamp)mangle-debian-files-indep \
$(if $(filter dummy, $(ARM32_MULTILIBS)), $(stamp)make-dummies)
@echo START $@
dh_compress $(linux_debs)
dh_fixperms $(linux_debs)
dh_installdeb $(linux_debs)
dh_gencontrol $(linux_debs) -- -v$(DEB_VER_LINUX)$(CROSS_EXT) $(control_vars)
dh_md5sums $(linux_debs)
dh_builddeb $(linux_debs)
# call with cross_arch and dummy_name
define make_dummy_pkg
rm -rf tmp2
install -d tmp2/DEBIAN
install -m 0644 debian/dummies/libc6-dev-$(2)-cross tmp2/DEBIAN/control
sed -i -e 's/VERSION/$(DEB_VER_GLIBC)$(CROSS_EXT)/g' tmp2/DEBIAN/control
sed -i -e 's/SRCNAME/$(DEB_NAME_ACT) ($(DEB_SVER_ACT))/g' tmp2/DEBIAN/control
NO_PKG_MANGLE=1 PKG_IGNORE_CURRENTLY_BUILDING=1 \
dpkg-deb -b tmp2 ../libc6-dev-$(2)-cross_$(DEB_VER_GLIBC)$(CROSS_EXT)_all.deb
$(call generate_debian_files, ../libc6-dev-$(2)-cross_$(DEB_VER_GLIBC)$(CROSS_EXT)_all.deb)
install -m 0644 debian/dummies/libc6-$(2)-cross tmp2/DEBIAN/control
sed -i -e 's/VERSION/$(DEB_VER_GLIBC)$(CROSS_EXT)/g' tmp2/DEBIAN/control
sed -i -e 's/SRCNAME/$(DEB_NAME_ACT) ($(DEB_SVER_ACT))/g' tmp2/DEBIAN/control
NO_PKG_MANGLE=1 PKG_IGNORE_CURRENTLY_BUILDING=1 \
dpkg-deb -b tmp2 ../libc6-$(2)-cross_$(DEB_VER_GLIBC)$(CROSS_EXT)_all.deb
$(call generate_debian_files, ../libc6-$(2)-cross_$(DEB_VER_GLIBC)$(CROSS_EXT)_all.deb)
endef
$(stamp)make-dummies: $(stamp)debian-files-base
@echo START $@
ifeq ($(ARM32_MULTILIBS),dummy)
ifneq (,$(filter armhf, $(CROSS_ARCHS)))
$(call make_dummy_pkg,armhf,armhf-armel)
endif
ifneq (,$(filter armel, $(CROSS_ARCHS)))
$(call make_dummy_pkg,armel,armel-armhf)
endif
endif
touch $@
$(stamp)debian-files-base:
@echo START $@
rm -f debian/files
touch $@
define generate_debian_files
@for deb in $1; \
do \
echo -n "`basename $$deb` " >>debian/files; \
dpkg-deb -I $$deb | grep Section | cut -d ' ' -f 3 | tr "\n" ' ' >>debian/files; \
dpkg-deb -I $$deb | grep Priority | cut -d ' ' -f 3 | tr -d "\n" >>debian/files; \
echo "" >>debian/files; \
done
endef
$(stamp)mangle-debian-files-indep: $(stamp)debian-files-base $(stamp)repack-debs-indep \
$(if $(filter $(ARM32_MULTILIBS), yes), $(stamp)make-dummies)
@echo START $@
$(call generate_debian_files, ${DEB_LIST_MANGLED})
sed -i -e "/^libc/s/_all.deb/$(CROSS_EXT)_all.deb/g" debian/files
$(foreach arch,$(CROSS_ARCHS), \
sed -i -e "/^libc/s/_${arch}.deb/$(CROSS_EXT)_${arch}.deb/g" debian/files;)
sed -i -e "/^libc/s/$(CROSS_EXT)$(CROSS_EXT)/$(CROSS_EXT)/g" debian/files
: # glibc packages only, linux-libc-dev doesn't need dpkg-cross
$(stamp)dc-%: build
@echo START $@
@set -e; \
deb=$*; \
arch=$$(echo $$deb | sed 's/.*_\([^_][^_]*\)\.deb$$/\1/'); \
case $$deb in \
libc6-armel_*_armhf.deb|libc6-dev-armel_*_armhf.deb|libc6-armhf_*_armel.deb|libc6-dev-armhf_*_armel.deb) \
if [ "$(ARM32_MULTILIBS)" = dummy ]; then \
echo "skipping ARM32 multilib package $$deb"; exit 0; \
fi;; \
libc*-dbg*) \
if [ "$(skip_dbg_packages)" = yes ]; then \
echo "skipping debug package package $$deb"; exit 0; \
fi;; \
libc*-loongson2f*) \
echo "skipping package package $$deb"; exit 0; \
esac; \
echo dpkg-cross $$deb ...; \
echo "default_arch = undefined" > debian/cross-compile; \
PKG_IGNORE_CURRENTLY_BUILDING=1 debian/dpkg-cross -M -a $$arch \
-X dpkg -X findutils -X tzdata -X libc-bin -X libc-dev-bin \
-X debconf -X debconf-2.0 \
-b $$deb
touch $@
$(stamp)dpkg-cross: build
@echo START $@
$(MAKE) $(NJOBS) -f debian/rules \
$(addprefix $(stamp)dc-, \
$(wildcard $(foreach a,$(CROSS_ARCHS), \
libc6*_*_$(a).deb libc6*-d*_$(a).deb \
)) \
)
touch $@
control:
@echo START $@
( \
sed -e "s/CROSS_ARCH/${CROSS_ARCH}/g" \
-e "s/CROSS_GNU_TYPE/${CROSS_GNU_TYPE}/g" \
-e "s/MIN_VER_GLIBC/${MIN_VER_GLIBC}/g" \
-e "s/MIN_VER_LINUX/${MIN_VER_LINUX}/g" \
-e "s/VER_LINUX/${VER_LINUX}/g" \
-e "s/MIN_VER_GCC/${MIN_VER_GCC}/g" \
-e "s/MIN_VER_BINUTILS/${MIN_VER_BINUTILS}/g" \
-e "s/VER_GCC_BASE/${VER_GCC_BASE}/g" \
-e "s/@SOURCE@/${DEB_NAME_ACT}/g" \
debian/control.source.in; \
echo 'Build-Conflicts: dpkg-cross, libdebian-dpkgcross-perl,'; \
echo ' $(foreach a,$(CROSS_ARCHS),binutils-$(call _gnu_type,$(a))$(,) libc6-$(a)-cross$(,) linux-libc-dev-$(a)-cross$(,))'; \
echo ' libc6-amd64 [i386 x32], libc6-i386 [amd64 x32], libc6-x32 [amd64 i386]'; \
$(foreach a,$(CROSS_ARCHS),sed -e "s/CROSS_ARCH/$(a)/g" debian/control.linux-libc-dev.in;) \
$(foreach a,$(CROSS_ARCHS),sed -e "s/CROSS_ARCH/$(a)/g; s/LIBC_VER/$(if $(filter $(a),alpha ia64),6.1,6)/" debian/control.libc.in;) \
) > debian/control
ifeq ($(ARM32_MULTILIBS),yes)
ifneq (,$(filter armhf, $(CROSS_ARCHS)))
sed -e "s/CROSS_ARCH/armhf/g;s/CROSS_BIARCH/armel/g" \
debian/control.multilib.in >> debian/control
endif
ifneq (,$(filter armel, $(CROSS_ARCHS)))
sed -e "s/CROSS_ARCH/armel/g;s/CROSS_BIARCH/armhf/g" \
debian/control.multilib.in >> debian/control
endif
else ifeq ($(ARM32_MULTILIBS),dummy)
cat debian/control.armhf.in >> debian/control
cat debian/control.armel.in >> debian/control
endif
ifneq (,$(filter ppc64, $(CROSS_ARCHS)))
sed -e "s/CROSS_ARCH/ppc64/g;s/CROSS_BIARCH/powerpc/g" \
debian/control.multilib.in >> debian/control
endif
ifneq (,$(filter s390x, $(CROSS_ARCHS)))
sed -e "s/CROSS_ARCH/s390x/g;s/CROSS_BIARCH/s390/g" \
debian/control.multilib.in >> debian/control
endif
ifneq (,$(filter sparc64, $(CROSS_ARCHS)))
sed -e "s/CROSS_ARCH/sparc64/g;s/CROSS_BIARCH/sparc/g" \
debian/control.multilib.in >> debian/control
endif
ifneq (,$(filter powerpc, $(CROSS_ARCHS)))
sed -e "s/CROSS_ARCH/powerpc/g;s/CROSS_BIARCH/ppc64/g" \
debian/control.multilib.in >> debian/control
endif
ifneq (,$(filter mips, $(CROSS_ARCHS)))
sed -e "s/CROSS_ARCH/mips/g;s/CROSS_BIARCH/mips64/g" \
debian/control.multilib.in >> debian/control
sed -e "s/CROSS_ARCH/mips/g;s/CROSS_TRIARCH/mipsn32/g" \
debian/control.trilib.in >> debian/control
endif
ifneq (,$(filter mipsel, $(CROSS_ARCHS)))
sed -e "s/CROSS_ARCH/mipsel/g;s/CROSS_BIARCH/mips64/g" \
debian/control.multilib.in >> debian/control
sed -e "s/CROSS_ARCH/mipsel/g;s/CROSS_TRIARCH/mipsn32/g" \
debian/control.trilib.in >> debian/control
endif
ifneq (,$(filter mips64, $(CROSS_ARCHS)))
sed -e "s/CROSS_ARCH/mips64/g;s/CROSS_BIARCH/mips32/g" \
debian/control.multilib.in >> debian/control
sed -e "s/CROSS_ARCH/mips64/g;s/CROSS_TRIARCH/mipsn32/g" \
debian/control.trilib.in >> debian/control
endif
ifneq (,$(filter mips64el, $(CROSS_ARCHS)))
sed -e "s/CROSS_ARCH/mips64el/g;s/CROSS_BIARCH/mips32/g" \
debian/control.multilib.in >> debian/control
sed -e "s/CROSS_ARCH/mips64el/g;s/CROSS_TRIARCH/mipsn32/g" \
debian/control.trilib.in >> debian/control
endif
echo 'foobar' > debian/no-packages
python3 debian/remove-unbuilt \
$(if $(filter yes,$(skip_dbg_packages)), --skip-dbg-packages) \
debian/control debian/no-packages \
> debian/control.new && mv debian/control.new debian/control
.PRECIOUS: $(stamp)init-dirs \
$(stamp)init-linux \
$(stamp)build-linux.% \
$(stamp)install-linux.% \
$(stamp)init-binutils \
$(stamp)build-binutils.% \
$(stamp)install-binutils.% \
$(stamp)init-gcc \
$(stamp)build-gcc1.% \
$(stamp)install-gcc1.% \
$(stamp)build-gcc2.% \
$(stamp)install-gcc2.% \
$(stamp)build-gcc3.% \
$(stamp)init-glibc \
$(stamp)build-glibc1.% \
$(stamp)install-glibc1.% \
$(stamp)build-glibc2.% \
$(stamp)install-glibc2.% \
$(stamp)debian-files-base \
$(stamp)dc-% \
$(stamp)repack-debs-arch \
$(stamp)repack-debs-indep \
$(stamp)repack-debs-indep.% \
$(stamp)mangle-debian-files-arch
$(stamp)mangle-debian-files-indep \
o build build-arch build-indep binary binary-arch binary-indep
|