allow paths to be set in the cross file
Just like the previous patch, but for cross files Fixes #1433
This commit is contained in:
parent
5b896ed70b
commit
b5d847e38c
|
@ -150,7 +150,7 @@ binaries are not actually compatible. In such cases you may use the
|
|||
needs_exe_wrapper = true
|
||||
```
|
||||
|
||||
The last bit is the definition of host and target machines. Every
|
||||
The next bit is the definition of host and target machines. Every
|
||||
cross build definition must have one or both of them. If it had
|
||||
neither, the build would not be a cross build but a native build. You
|
||||
do not need to define the build machine, as all necessary information
|
||||
|
@ -186,6 +186,20 @@ If you do not define your host machine, it is assumed to be the build
|
|||
machine. Similarly if you do not specify target machine, it is assumed
|
||||
to be the host machine.
|
||||
|
||||
Additionally, you can define the paths that you want to install to in your
|
||||
cross file. This may be especially useful when cross compiling an entire
|
||||
operating system, or for operating systems to use internally for consistency.
|
||||
|
||||
```ini
|
||||
[paths]
|
||||
prefix = '/my/prefix'
|
||||
libdir = 'lib/i386-linux-gnu'
|
||||
bindir = 'bin'
|
||||
```
|
||||
|
||||
This will be overwritten by any options passed on the command line.
|
||||
|
||||
|
||||
## Starting a cross build
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Native File Paths and Directories
|
||||
## Native and Cross File Paths and Directories
|
||||
|
||||
A new `[paths]` section has been added to the native file. This can be used to
|
||||
set paths such a prefix and libdir in a persistent way.
|
||||
A new `[paths]` section has been added to native and cross files. This
|
||||
can be used to set paths such a prefix and libdir in a persistent way.
|
||||
|
|
|
@ -399,6 +399,7 @@ class Environment:
|
|||
self.machines.host = MachineInfo.from_literal(config['host_machine'])
|
||||
if 'target_machine' in config:
|
||||
self.machines.target = MachineInfo.from_literal(config['target_machine'])
|
||||
self.paths.host = Directories(**config.get('paths', {}))
|
||||
|
||||
self.machines.default_missing()
|
||||
self.binaries.default_missing()
|
||||
|
|
|
@ -5450,6 +5450,51 @@ class NativeFileTests(BasePlatformTests):
|
|||
'-Ddef_libdir=liblib', '-Dlibdir=liblib'])
|
||||
|
||||
|
||||
class CrossFileTests(BasePlatformTests):
|
||||
|
||||
"""Tests for cross file functioality not directly related to
|
||||
cross compiling.
|
||||
|
||||
This is mainly aimed to testing overrides from cross files.
|
||||
"""
|
||||
|
||||
def test_cross_file_dirs(self):
|
||||
testcase = os.path.join(self.unit_test_dir, '54 native file override')
|
||||
self.init(testcase, default_args=False,
|
||||
extra_args=['--native-file', os.path.join(testcase, 'nativefile'),
|
||||
'--cross-file', os.path.join(testcase, 'crossfile'),
|
||||
'-Ddef_bindir=binbar',
|
||||
'-Ddef_datadir=databar',
|
||||
'-Ddef_includedir=includebar',
|
||||
'-Ddef_infodir=infobar',
|
||||
'-Ddef_libdir=libbar',
|
||||
'-Ddef_libexecdir=libexecbar',
|
||||
'-Ddef_localedir=localebar',
|
||||
'-Ddef_localstatedir=localstatebar',
|
||||
'-Ddef_mandir=manbar',
|
||||
'-Ddef_sbindir=sbinbar',
|
||||
'-Ddef_sharedstatedir=sharedstatebar',
|
||||
'-Ddef_sysconfdir=sysconfbar'])
|
||||
|
||||
def test_cross_file_dirs_overriden(self):
|
||||
testcase = os.path.join(self.unit_test_dir, '54 native file override')
|
||||
self.init(testcase, default_args=False,
|
||||
extra_args=['--native-file', os.path.join(testcase, 'nativefile'),
|
||||
'--cross-file', os.path.join(testcase, 'crossfile'),
|
||||
'-Ddef_libdir=liblib', '-Dlibdir=liblib',
|
||||
'-Ddef_bindir=binbar',
|
||||
'-Ddef_datadir=databar',
|
||||
'-Ddef_includedir=includebar',
|
||||
'-Ddef_infodir=infobar',
|
||||
'-Ddef_libexecdir=libexecbar',
|
||||
'-Ddef_localedir=localebar',
|
||||
'-Ddef_localstatedir=localstatebar',
|
||||
'-Ddef_mandir=manbar',
|
||||
'-Ddef_sbindir=sbinbar',
|
||||
'-Ddef_sharedstatedir=sharedstatebar',
|
||||
'-Ddef_sysconfdir=sysconfbar'])
|
||||
|
||||
|
||||
def unset_envs():
|
||||
# For unit tests we must fully control all command lines
|
||||
# so that there are no unexpected changes coming from the
|
||||
|
@ -5468,7 +5513,7 @@ def should_run_cross_mingw_tests():
|
|||
def main():
|
||||
unset_envs()
|
||||
cases = ['InternalTests', 'DataTests', 'AllPlatformTests', 'FailureTests',
|
||||
'PythonTests', 'NativeFileTests', 'RewriterTests']
|
||||
'PythonTests', 'NativeFileTests', 'RewriterTests', 'CrossFileTests']
|
||||
if not is_windows():
|
||||
cases += ['LinuxlikeTests']
|
||||
if should_run_cross_arm_tests():
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
[paths]
|
||||
bindir = 'binbar'
|
||||
datadir = 'databar'
|
||||
includedir = 'includebar'
|
||||
infodir = 'infobar'
|
||||
libdir = 'libbar'
|
||||
libexecdir = 'libexecbar'
|
||||
localedir = 'localebar'
|
||||
localstatedir = 'localstatebar'
|
||||
mandir = 'manbar'
|
||||
prefix = '/prefix'
|
||||
sbindir = 'sbinbar'
|
||||
sharedstatedir = 'sharedstatebar'
|
||||
sysconfdir = 'sysconfbar'
|
||||
|
||||
; vim: ft=dosini
|
Loading…
Reference in New Issue