build/python/autotools: add option per_arch_cflags
This commit is contained in:
parent
485c7805eb
commit
a0892b852e
@ -1,5 +1,6 @@
|
|||||||
import os.path, subprocess, sys
|
import os.path, subprocess, sys
|
||||||
from typing import Collection, Iterable, Optional, Sequence, Union
|
from typing import Collection, Iterable, Optional, Sequence, Union
|
||||||
|
from collections.abc import Mapping
|
||||||
|
|
||||||
from build.makeproject import MakeProject
|
from build.makeproject import MakeProject
|
||||||
from .toolchain import AnyToolchain
|
from .toolchain import AnyToolchain
|
||||||
@ -9,6 +10,7 @@ class AutotoolsProject(MakeProject):
|
|||||||
configure_args: Iterable[str]=[],
|
configure_args: Iterable[str]=[],
|
||||||
autogen: bool=False,
|
autogen: bool=False,
|
||||||
autoreconf: bool=False,
|
autoreconf: bool=False,
|
||||||
|
per_arch_cflags: Optional[Mapping[str, str]]=None,
|
||||||
cppflags: str='',
|
cppflags: str='',
|
||||||
ldflags: str='',
|
ldflags: str='',
|
||||||
libs: str='',
|
libs: str='',
|
||||||
@ -18,6 +20,7 @@ class AutotoolsProject(MakeProject):
|
|||||||
self.configure_args = configure_args
|
self.configure_args = configure_args
|
||||||
self.autogen = autogen
|
self.autogen = autogen
|
||||||
self.autoreconf = autoreconf
|
self.autoreconf = autoreconf
|
||||||
|
self.per_arch_cflags = per_arch_cflags
|
||||||
self.cppflags = cppflags
|
self.cppflags = cppflags
|
||||||
self.ldflags = ldflags
|
self.ldflags = ldflags
|
||||||
self.libs = libs
|
self.libs = libs
|
||||||
@ -38,12 +41,16 @@ class AutotoolsProject(MakeProject):
|
|||||||
|
|
||||||
build = self.make_build_path(toolchain)
|
build = self.make_build_path(toolchain)
|
||||||
|
|
||||||
|
arch_cflags = ''
|
||||||
|
if self.per_arch_cflags is not None and toolchain.host_triplet is not None:
|
||||||
|
arch_cflags = self.per_arch_cflags.get(toolchain.host_triplet, '')
|
||||||
|
|
||||||
configure = [
|
configure = [
|
||||||
os.path.join(src, 'configure'),
|
os.path.join(src, 'configure'),
|
||||||
'CC=' + toolchain.cc,
|
'CC=' + toolchain.cc,
|
||||||
'CXX=' + toolchain.cxx,
|
'CXX=' + toolchain.cxx,
|
||||||
'CFLAGS=' + toolchain.cflags,
|
'CFLAGS=' + toolchain.cflags + ' ' + arch_cflags,
|
||||||
'CXXFLAGS=' + toolchain.cxxflags,
|
'CXXFLAGS=' + toolchain.cxxflags + ' ' + arch_cflags,
|
||||||
'CPPFLAGS=' + toolchain.cppflags + ' ' + self.cppflags,
|
'CPPFLAGS=' + toolchain.cppflags + ' ' + self.cppflags,
|
||||||
'LDFLAGS=' + toolchain.ldflags + ' ' + self.ldflags,
|
'LDFLAGS=' + toolchain.ldflags + ' ' + self.ldflags,
|
||||||
'LIBS=' + toolchain.libs + ' ' + self.libs,
|
'LIBS=' + toolchain.libs + ' ' + self.libs,
|
||||||
|
Loading…
Reference in New Issue
Block a user