diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-08-30 23:07:26 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-08-30 23:07:26 +0300 |
commit | 1571bfc6a9462fc4f5f0e8f13c470de2ec3ae1a3 (patch) | |
tree | 05fa7f49505c8ac74b916001e82e47d93398fb2b | |
parent | 29174b669faf684e789e3fe817787e48a7621dd3 (diff) | |
download | meson-1571bfc6a9462fc4f5f0e8f13c470de2ec3ae1a3.zip meson-1571bfc6a9462fc4f5f0e8f13c470de2ec3ae1a3.tar.gz meson-1571bfc6a9462fc4f5f0e8f13c470de2ec3ae1a3.tar.bz2 |
Static cross linking works again.
-rw-r--r-- | backends.py | 15 | ||||
-rw-r--r-- | build.py | 5 | ||||
-rw-r--r-- | environment.py | 15 |
3 files changed, 23 insertions, 12 deletions
diff --git a/backends.py b/backends.py index 69b46e2..b0d3dad 100644 --- a/backends.py +++ b/backends.py @@ -486,7 +486,9 @@ class NinjaBackend(Backend): outfile.write('# Rules for compiling.\n\n') self.generate_compile_rules(outfile) outfile.write('# Rules for linking.\n\n') - self.generate_static_link_rules(outfile) + if self.environment.is_cross_build(): + self.generate_static_link_rules(True, outfile) + self.generate_static_link_rules(False, outfile) self.generate_dynamic_link_rules(outfile) self.generate_dep_gen_rules(outfile) outfile.write('# Other rules\n\n') @@ -503,9 +505,14 @@ class NinjaBackend(Backend): outfile.write(' description = Regenerating build files\n') outfile.write(' generator = 1\n\n') - def generate_static_link_rules(self, outfile): - static_linker = self.build.static_linker - rule = 'rule STATIC_LINKER\n' + def generate_static_link_rules(self, is_cross, outfile): + if is_cross: + static_linker = self.build.static_cross_linker + crstr = '_CROSS' + else: + static_linker = self.build.static_linker + crstr = '' + rule = 'rule STATIC%s_LINKER\n' % crstr command = ' command = %s $LINK_FLAGS %s $in\n' % \ (' '.join(static_linker.get_exelist()), ' '.join(static_linker.get_output_flags('$out'))) @@ -29,6 +29,7 @@ class Build: self.man = [] self.data = [] self.static_linker = None + self.static_cross_linker = None self.configure_files = [] def add_compiler(self, compiler): @@ -37,8 +38,8 @@ class Build: self.compilers.append(compiler) def add_cross_compiler(self, compiler): - #if len(self.cross_compilers) == 0: - # self.static_linker = self.environment.detect_static_linker(compiler) + if len(self.cross_compilers) == 0: + self.static_cross_linker = self.environment.detect_static_linker(compiler) self.cross_compilers.append(compiler) def get_project(self): diff --git a/environment.py b/environment.py index a29e9e4..8c1e0b4 100644 --- a/environment.py +++ b/environment.py @@ -953,13 +953,16 @@ class Environment(): raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"') def detect_static_linker(self, compiler): - evar = 'AR' - if evar in os.environ: - linker = os.environ[evar].strip() - if isinstance(compiler, VisualStudioCCompiler): - linker= self.vs_static_linker + if compiler.is_cross: + linker = self.cross_info['ar'] else: - linker = self.default_static_linker + evar = 'AR' + if evar in os.environ: + linker = os.environ[evar].strip() + if isinstance(compiler, VisualStudioCCompiler): + linker= self.vs_static_linker + else: + linker = self.default_static_linker basename = os.path.basename(linker).lower() if basename == 'lib' or basename == 'lib.exe': arg = '/?' |