diff --git a/pmb/build/_package.py b/pmb/build/_package.py index 8cc0a5b7..6750ba05 100644 --- a/pmb/build/_package.py +++ b/pmb/build/_package.py @@ -414,7 +414,7 @@ def process_package( if context.no_depends: pmb.helpers.repo.update(arch) cross = pmb.build.autodetect.crosscompile(apkbuild, arch) - _dep_arch = Arch.native() if cross == "native" else arch + _dep_arch = Arch.native() if cross == "cross-native2" else arch if not pmb.parse.apkindex.package(dep, _dep_arch, False): raise RuntimeError( "Missing binary package for dependency '" + dep + "' of '" + parent + "', but" @@ -652,7 +652,7 @@ def packages( # (re)-initialize the cross compiler stuff when cross method changes prev_cross = cross cross = pmb.build.autodetect.crosscompile(pkg["apkbuild"], pkg_arch) - if cross == "native" or cross == "kernel": + if cross == "cross-native2" or cross == "cross-native": chroot = Chroot.native() # One time chroot initialization diff --git a/pmb/build/autodetect.py b/pmb/build/autodetect.py index c3c9fed9..dc871847 100644 --- a/pmb/build/autodetect.py +++ b/pmb/build/autodetect.py @@ -100,9 +100,9 @@ def crosscompile(apkbuild: Apkbuild, arch: Arch) -> CrossCompileType: return None # deprecated cross-native environment for building kernels if "pmb:cross-native" in apkbuild["options"]: - return "kernel" + return "cross-native" if arch.is_native() or "pmb:cross-native2" in apkbuild["options"]: - return "native" + return "cross-native2" if "!pmb:crossdirect" in apkbuild["options"]: return None return "crossdirect" diff --git a/pmb/build/backend.py b/pmb/build/backend.py index 47809d05..716d1fb1 100644 --- a/pmb/build/backend.py +++ b/pmb/build/backend.py @@ -202,7 +202,7 @@ def run_abuild( depending on the cross-compiler method and target architecture), copy the aport to the chroot and execute abuild. - :param cross: None, "native", or "crossdirect" + :param cross: None, "cross-native", "cross-native2" or "crossdirect" :param src: override source used to build the package with a local folder :param bootstrap_stage: pass a BOOTSTRAP= env var with the value to abuild :returns: (output, cmd, env), output is the destination apk path relative @@ -211,7 +211,7 @@ def run_abuild( the environment variables dict generated in this function. """ # Sanity check - if cross == "kernel" and "!tracedeps" not in apkbuild["options"]: + if cross == "cross-native" and "!tracedeps" not in apkbuild["options"]: logging.warning( "WARNING: Option !tracedeps is not set, but cross compiling with" " cross-native (version 1). This will probably fail!" @@ -219,10 +219,10 @@ def run_abuild( # For cross-native2 compilation, bindmount the "host" rootfs to /mnt/sysroot # it will be used as the "sysroot" - if cross == "native": + if cross == "cross-native2": pmb.mount.bind(hostchroot.path, Chroot.native() / "/mnt/sysroot", umount=True) - chroot = Chroot.native() if cross == "native" else hostchroot + chroot = Chroot.native() if cross == "cross-native2" else hostchroot pkgdir = context.config.work / "packages" / channel if not pkgdir.exists(): @@ -247,11 +247,11 @@ def run_abuild( # Environment variables env: Env = {"SUDO_APK": "abuild-apk --no-progress"} - if cross == "kernel": + if cross == "cross-native": hostspec = arch.alpine_triple() env["CROSS_COMPILE"] = hostspec + "-" env["CC"] = hostspec + "-gcc" - if cross == "native": + if cross == "cross-native2": env["CHOST"] = str(arch) env["CBUILDROOT"] = "/mnt/sysroot" env["CFLAGS"] = "-Wl,-rpath-link=/mnt/sysroot/usr/lib" diff --git a/pmb/types.py b/pmb/types.py index fdc0e1b5..59eacaf6 100644 --- a/pmb/types.py +++ b/pmb/types.py @@ -8,7 +8,7 @@ from typing import Any, Literal, TypedDict from pmb.core.arch import Arch -CrossCompileType = Literal["native", "crossdirect", "kernel"] | None +CrossCompileType = Literal["crossdirect", "cross-native", "cross-native2"] | None RunOutputTypeDefault = Literal["log", "stdout", "interactive", "tui", "null"] RunOutputTypePopen = Literal["background", "pipe"] RunOutputType = RunOutputTypeDefault | RunOutputTypePopen