build script: add platform support to configure+make target

This commit is contained in:
alexey.lysiuk 2020-12-25 13:04:50 +02:00
parent 23456eaaf7
commit ed46fee736

View file

@ -26,6 +26,7 @@ if sys.hexversion < 0x3070000:
import argparse import argparse
import collections import collections
import copy
import hashlib import hashlib
import os import os
import re import re
@ -273,8 +274,6 @@ class ConfigureMakeTarget(Target):
def initialize(self, builder: 'Builder'): def initialize(self, builder: 'Builder'):
super().initialize(builder) super().initialize(builder)
self.options['--prefix'] = self.prefix
self.make.initialize(builder) self.make.initialize(builder)
def configure(self, builder: 'Builder'): def configure(self, builder: 'Builder'):
@ -284,17 +283,32 @@ class ConfigureMakeTarget(Target):
work_path = builder.build_path + self.src_root work_path = builder.build_path + self.src_root
configure_path = work_path + os.sep + 'configure' configure_path = work_path + os.sep + 'configure'
args = [configure_path] common_args = [
args += self.options.to_list() configure_path,
'--prefix=' + self.prefix,
]
common_args += self.options.to_list()
# Detect dependency tracking support, and disable it disable_dependency_tracking = '--disable-dependency-tracking'
with open(configure_path) as f: host = '--host=' + builder.host()
for line in f.readlines():
if 'dependency_tracking' in line:
args.append('--disable-dependency-tracking')
break
subprocess.check_call(args, cwd=work_path, env=self.environment) args = copy.copy(common_args)
args.append(host)
args.append(disable_dependency_tracking)
try:
# Try with host and disabled dependency tracking first
subprocess.check_call(args, cwd=work_path, env=self.environment)
except subprocess.CalledProcessError:
# If it fails, try with disabled dependency tracking only
args = copy.copy(common_args)
args.append(disable_dependency_tracking)
try:
subprocess.check_call(args, cwd=work_path, env=self.environment)
except subprocess.CalledProcessError:
# Use only common command line arguments
subprocess.check_call(common_args, cwd=work_path, env=self.environment)
def build(self, builder: 'Builder'): def build(self, builder: 'Builder'):
assert not builder.xcode assert not builder.xcode