packages: honor build.crosscompile config setting

This commit is contained in:
InsanePrawn 2021-09-12 04:47:39 +02:00
parent b36539af4c
commit b87fdf722b

View file

@ -112,7 +112,7 @@ def check_prebuilts():
cwd=os.path.join('prebuilts', repo), cwd=os.path.join('prebuilts', repo),
) )
if result.returncode != 0: if result.returncode != 0:
logging.fatal('Failed create prebuilt repos') logging.fatal('Failed to create prebuilt repos')
exit(1) exit(1)
@ -297,13 +297,13 @@ def check_package_version_built(package: Package) -> bool:
return built return built
def setup_dependencies_and_sources(package: Package): def setup_dependencies_and_sources(package: Package, enable_crosscompile: bool = True):
logging.info(f'Setting up dependencies and sources for {package.path}') logging.info(f'Setting up dependencies and sources for {package.path}')
""" """
To make cross-compilation work for almost every package, the host needs to have the dependencies installed To make cross-compilation work for almost every package, the host needs to have the dependencies installed
so that the build tools can be used so that the build tools can be used
""" """
if package.mode == 'cross': if package.mode == 'cross' and enable_crosscompile:
for p in package.depends: for p in package.depends:
# Don't check for errors here because there might be packages that are listed as dependencies but are not available on x86_64 # Don't check for errors here because there might be packages that are listed as dependencies but are not available on x86_64
subprocess.run( subprocess.run(
@ -325,7 +325,7 @@ def setup_dependencies_and_sources(package: Package):
exit(1) exit(1)
def build_package(package: Package): def build_package(package: Package, enable_crosscompile: bool = True):
makepkg_compile_opts = [ makepkg_compile_opts = [
'--noextract', '--noextract',
'--skipinteg', '--skipinteg',
@ -333,7 +333,9 @@ def build_package(package: Package):
'--nodeps', '--nodeps',
] ]
if package.mode == 'cross': setup_dependencies_and_sources(package, enable_crosscompile=enable_crosscompile)
if package.mode == 'cross' and enable_crosscompile:
logging.info(f'Cross-compiling {package.path}') logging.info(f'Cross-compiling {package.path}')
def umount(): def umount():
@ -480,11 +482,10 @@ def cmd_build(paths):
logging.info('Everything built already') logging.info('Everything built already')
return return
logging.info('Building %s', ', '.join(map(lambda x: x.path, need_build))) logging.info('Building %s', ', '.join(map(lambda x: x.path, need_build)))
crosscompile = config.file['build']['crosscompile']
for package in need_build: for package in need_build:
setup_chroot() setup_chroot()
setup_dependencies_and_sources(package) build_package(package, enable_crosscompile=crosscompile)
build_package(package)
add_package_to_repo(package) add_package_to_repo(package)