native cross: only require native arch depends

Do not try to build and install dependencies for the package's
architecture when compiling in the "native" mode. That mode is
described here in detail:
https://wiki.postmarketos.org/wiki/Build_internals#Cross-compile_types

This makes it possible to cross compile kernels again, which need to
be built with GCC6. We have switched to Alpine's GCC6 package, but it is
not available for armhf/aarch64 on edge yet, because Alpine's build bots
are stuck (right now armhf is not even listed):
http://build.alpinelinux.org/

Huge thanks to ryang2478/Decatf for posting this patch in pmaports#138!
This commit is contained in:
Oliver Smith 2018-11-30 09:31:38 +01:00
parent cce91758a1
commit 977323cf6e
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 7 additions and 8 deletions

View File

@ -176,11 +176,16 @@ def init_buildenv(args, apkbuild, arch, strict=False, force=False, cross=None,
:param src: override source used to build the package with a local folder
:returns: True when the build is necessary (otherwise False)
"""
depends_arch = arch
if cross == "native":
depends_arch = args.arch_native
# Build dependencies (package arch)
depends, built = build_depends(args, apkbuild, arch, strict)
depends, built = build_depends(args, apkbuild, depends_arch, strict)
# Check if build is necessary
if not is_necessary_warn_depends(args, apkbuild, arch, force, built):
if not is_necessary_warn_depends(args, apkbuild, depends_arch, force, built):
return False
# Install and configure abuild, ccache, gcc, dependencies
@ -204,12 +209,6 @@ def init_buildenv(args, apkbuild, arch, strict=False, force=False, cross=None,
if cross == "distcc":
pmb.chroot.distccd.start(args, arch)
# "native" cross-compile: build and install dependencies (#1061)
if cross == "native":
depends, built = build_depends(args, apkbuild, args.arch_native, strict)
if not strict and len(depends):
pmb.chroot.apk.install(args, depends)
return True