From 0030dcbac1a9177ef7a28af209ac67149b899f5f Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Tue, 26 Feb 2019 14:17:25 +0800
Subject: [PATCH] Revert "meson: use an array option for efi-cc"

This reverts commit 595343fb4c99c2679d347ef7c19debfbfed6342e.

This patch is here because we haven't figured out how to pass
parameter to efi-cc if it's an array in systemd-boot recipe.

Upstream-Status: Inappropriate [OE specific]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meson_options.txt        |  2 +-
 src/boot/efi/meson.build | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index 044bb79..3d28bfd 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -292,7 +292,7 @@ option('dbus', type : 'combo', choices : ['auto', 'true', 'false'],
 
 option('gnu-efi', type : 'combo', choices : ['auto', 'true', 'false'],
        description : 'gnu-efi support for sd-boot')
-option('efi-cc', type : 'array',
+option('efi-cc', type : 'string',
        description : 'the compiler to use for EFI modules')
 option('efi-ld', type : 'string',
        description : 'the linker to use for EFI modules')
diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
index 2140151..d8db3a1 100644
--- a/src/boot/efi/meson.build
+++ b/src/boot/efi/meson.build
@@ -34,8 +34,8 @@ stub_sources = '''
 
 if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false'
         efi_cc = get_option('efi-cc')
-        if efi_cc.length() == 0
-                efi_cc = cc.cmd_array()
+        if efi_cc == ''
+                efi_cc = ' '.join(cc.cmd_array())
         endif
         efi_ld = get_option('efi-ld')
         if efi_ld == ''
@@ -57,7 +57,8 @@ if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false'
 
         efi_libdir = get_option('efi-libdir')
         if efi_libdir == ''
-                ret = run_command(efi_cc + ['-print-multi-os-directory'])
+                cmd = 'cd /usr/lib/$(@0@ -print-multi-os-directory) && pwd'.format(efi_cc)
+                ret = run_command('sh', '-c', cmd)
                 if ret.returncode() == 0
                         path = join_paths('/usr/lib', ret.stdout().strip())
                         ret = run_command('realpath', '-e', path)
@@ -152,7 +153,7 @@ if have_gnu_efi
                 o_file = custom_target(file + '.o',
                                        input : file,
                                        output : file + '.o',
-                                       command : efi_cc + ['-c', '@INPUT@', '-o', '@OUTPUT@']
+                                       command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@']
                                                  + compile_args,
                                        depend_files : efi_headers)
                 if (common_sources + systemd_boot_sources).contains(file)
@@ -163,7 +164,7 @@ if have_gnu_efi
                 endif
         endforeach
 
-        libgcc_file_name = run_command(efi_cc + ['-print-libgcc-file-name']).stdout().strip()
+        libgcc_file_name = run_command(efi_cc, '-print-libgcc-file-name').stdout().strip()
         systemd_boot_efi_name = 'systemd-boot@0@.efi'.format(EFI_MACHINE_TYPE_NAME)
         stub_efi_name = 'linux@0@.efi.stub'.format(EFI_MACHINE_TYPE_NAME)
         no_undefined_symbols = find_program('no-undefined-symbols.sh')
-- 
2.7.4

