blob: e2e19ba068103a614be4f4fe01943f0ec8cdbd0d [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From 527413ec243564a89ffaad6368d446de44415970 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Tue, 27 Feb 2018 21:42:23 -0800
4Subject: [PATCH] Fix to run efi_cc and efi_ld correctly when cross-compiling
5
6When cross-compiling, efi_cc and efi_ld may take the form of
7'xxx-gcc --sysroot=xxx', and this would cause run_command and
8the alike fail.
9
10Fix to split them to make commands run correctly.
11
12Upstream-Status: Pending
13
14Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
15---
16 src/boot/efi/meson.build | 16 +++++++++++++---
17 1 file changed, 13 insertions(+), 3 deletions(-)
18
19diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
20index 992a3ba4c..9f9ec4911 100644
21--- a/src/boot/efi/meson.build
22+++ b/src/boot/efi/meson.build
23@@ -157,7 +157,7 @@ if have_gnu_efi
24 o_file = custom_target(file + '.o',
25 input : file,
26 output : file + '.o',
27- command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@']
28+ command : efi_cc.split() + ['-c', '@INPUT@', '-o', '@OUTPUT@']
29 + compile_args,
30 depend_files : efi_headers)
31 if (common_sources + systemd_boot_sources).contains(file)
32@@ -168,7 +168,17 @@ if have_gnu_efi
33 endif
34 endforeach
35
36- libgcc_file_name = run_command(efi_cc, '-print-libgcc-file-name').stdout().strip()
37+ find_libgcc_cmd_all = efi_cc + ' -print-libgcc-file-name'
38+ find_libgcc_cmd = find_libgcc_cmd_all.split()[0]
39+ find_libgcc_args = []
40+ cmd_args_all = find_libgcc_cmd_all.split()
41+ foreach arg : cmd_args_all
42+ if arg != find_libgcc_cmd
43+ find_libgcc_args += arg
44+ endif
45+ endforeach
46+
47+ libgcc_file_name = run_command(find_libgcc_cmd, find_libgcc_args).stdout().strip()
48 systemd_boot_efi_name = 'systemd-boot@0@.efi'.format(EFI_MACHINE_TYPE_NAME)
49 stub_efi_name = 'linux@0@.efi.stub'.format(EFI_MACHINE_TYPE_NAME)
50 no_undefined_symbols = find_program('no-undefined-symbols.sh')
51@@ -179,7 +189,7 @@ if have_gnu_efi
52 tuple[0],
53 input : tuple[2],
54 output : tuple[0],
55- command : [efi_ld, '-o', '@OUTPUT@'] +
56+ command : efi_ld.split() + ['-o', '@OUTPUT@'] +
57 efi_ldflags + tuple[2] +
58 ['-lefi', '-lgnuefi', libgcc_file_name])
59
60--
612.13.0
62