i think crossdirect works for real now?

This commit is contained in:
InsanePrawn 2021-10-05 20:31:11 +02:00
parent f90bf1006a
commit eb67c34f9b
2 changed files with 18 additions and 6 deletions

View file

@ -162,7 +162,9 @@ def mount_crossdirect(native_chroot: str, target_chroot: str, target_arch: str,
""" """
if host_arch is None: if host_arch is None:
host_arch = config.runtime['arch'] host_arch = config.runtime['arch']
gcc = f'{GCC_HOSTSPECS[host_arch][target_arch]}-gcc' hostspec = GCC_HOSTSPECS[host_arch][target_arch]
cc = f'{hostspec}-cc'
gcc = f'{hostspec}-gcc'
native_mount = os.path.join(target_chroot, 'native') native_mount = os.path.join(target_chroot, 'native')
logging.debug(f'Activating crossdirect in {native_mount}') logging.debug(f'Activating crossdirect in {native_mount}')
@ -172,11 +174,21 @@ def mount_crossdirect(native_chroot: str, target_chroot: str, target_arch: str,
if results['crossdirect'].returncode != 0: if results['crossdirect'].returncode != 0:
raise Exception('Failed to install crossdirect') raise Exception('Failed to install crossdirect')
cc_path = os.path.join(native_chroot, 'usr', 'bin', cc)
target_lib_dir = os.path.join(target_chroot, 'lib64')
for target, source in {cc_path: gcc, target_lib_dir: 'lib'}.items():
if not os.path.exists(target):
logging.debug(f'Symlinking {source} at {target}')
os.symlink(source, target)
ld_so = os.path.basename(glob(f"{os.path.join(native_chroot, 'usr', 'lib', 'ld-linux-')}*")[0])
ld_so_target = os.path.join(target_lib_dir, ld_so)
if not os.path.islink(ld_so_target):
os.symlink(os.path.join('/native', 'usr', 'lib', ld_so), ld_so_target)
else:
logging.debug('ld-linux.so symlink already exists, skipping for {target_chroot}')
os.makedirs(native_mount, exist_ok=True) os.makedirs(native_mount, exist_ok=True)
ld_so = glob(f"{os.path.join(native_chroot, 'usr', 'lib', 'ld-linux-')}*")[0]
copy(ld_so, os.path.join(target_chroot, 'usr', 'lib'))
logging.debug(f'Mounting {native_chroot} to {native_mount}') logging.debug(f'Mounting {native_chroot} to {native_mount}')
result = mount(native_chroot, native_mount) result = mount(native_chroot, native_mount)
if result.returncode != 0: if result.returncode != 0:

View file

@ -358,7 +358,7 @@ def setup_build_chroot(arch: str, extra_packages=[]) -> str:
chroot_path = create_chroot( chroot_path = create_chroot(
chroot_name, chroot_name,
arch=arch, arch=arch,
packages=list(set(['base-devel', 'git', 'ccache'] + extra_packages)), packages=list(set(['base-devel', 'git'] + extra_packages)),
extra_repos=get_kupfer_local(arch).repos, extra_repos=get_kupfer_local(arch).repos,
) )
pacman_cache = mount_pacman_cache(chroot_path, arch) pacman_cache = mount_pacman_cache(chroot_path, arch)