diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-04-19 22:57:52 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-04-24 19:24:36 -0400 |
commit | 6800fe7f0678c2a3875005bdef147e10eac67428 (patch) | |
tree | ede35e6acaebd24f356e7373845370ac4e24a572 /src | |
parent | 4984c8be739dffe4cf9ff3ab905eb3b2ee3ca826 (diff) |
meson: define gnu_efi_arch for the arch efi name, fix ldsdir detection
This fixes ldsdir detection under Debian.
v2:
- define gnu_efi_arch for the arch efi include directory name
In the autotools naming convention, efi_arch and this directory always had
the same name. But meson.cpu_family() uses a slightly different convention,
so those two don't always match.
Diffstat (limited to 'src')
-rw-r--r-- | src/boot/efi/meson.build | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index bdf54654de..6c5c856d8c 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -33,8 +33,8 @@ if conf.get('ENABLE_EFI', 0) == 1 and get_option('gnu-efi') != 'false' efi_ld = get_option('efi-ld') efi_incdir = get_option('efi-includedir') - efibind_h = '@0@/@1@/efibind.h'.format(efi_incdir, efi_arch) - have_header = cc.has_header(efibind_h) + have_header = (gnu_efi_arch != '' and + cc.has_header('@0@/@1@/efibind.h'.format(efi_incdir, gnu_efi_arch))) if have_header and EFI_MACHINE_TYPE_NAME == '' error('gnu-efi is available, but EFI_MACHINE_TYPE_NAME is unknown') @@ -70,8 +70,17 @@ if have_gnu_efi objcopy = find_program('objcopy') efi_ldsdir = get_option('efi-ldsdir') + arch_lds = 'elf_@0@_efi.lds'.format(gnu_efi_arch) if efi_ldsdir == '' efi_ldsdir = join_paths(efi_libdir, 'gnuefi') + cmd = run_command('test', '-f', join_paths(efi_ldsdir, arch_lds)) + if cmd.returncode() != 0 + efi_ldsdir = efi_libdir + cmd = run_command('test', '-f', join_paths(efi_ldsdir, arch_lds)) + if cmd.returncode() != 0 + error('Cannot find @0@'.format(arch_lds)) + endif + endif endif message('efi-libdir: "@0@"'.format(efi_libdir)) @@ -91,7 +100,7 @@ if have_gnu_efi '-Wsign-compare', '-Wno-missing-field-initializers', '-isystem', efi_incdir, - '-isystem', join_paths(efi_incdir, efi_arch), + '-isystem', join_paths(efi_incdir, gnu_efi_arch), '-include', efi_config_h] if efi_arch == 'x86_64' compile_args += ['-mno-red-zone', @@ -105,20 +114,20 @@ if have_gnu_efi endif efi_ldflags = ['-T', - '@0@/elf_@1@_efi.lds'.format(efi_ldsdir, efi_arch), + join_paths(efi_ldsdir, arch_lds), '-shared', '-Bsymbolic', '-nostdlib', '-znocombreloc', '-L', efi_libdir, - '@0@/crt0-efi-@1@.o'.format(efi_ldsdir, efi_arch)] + join_paths(efi_ldsdir, 'crt0-efi-@0@.o'.format(gnu_efi_arch))] if efi_arch == 'aarch64' or efi_arch == 'arm' # Aarch64 and ARM32 don't have an EFI capable objcopy. Use 'binary' # instead, and add required symbols manually. efi_ldflags += ['--defsym=EFI_SUBSYSTEM=0xa'] efi_format = ['-O', 'binary'] else - efi_format = ['--target=efi-app-@0@'.format(efi_arch)] + efi_format = ['--target=efi-app-@0@'.format(gnu_efi_arch)] endif systemd_boot_objects = [] |