23
23
efi_ldsdir = get_option (' efi-ldsdir' )
24
24
efi_incdir = get_option (' efi-includedir' )
25
25
26
+ if efi_incdir == ''
27
+ efi_incdir = join_paths (gnuefi.get_variable (pkgconfig : ' includedir' ), ' efi' )
28
+ endif
29
+
26
30
gnu_efi_path_arch = ''
27
31
foreach name : [gnu_efi_arch, EFI_MACHINE_TYPE_NAME]
28
32
if (gnu_efi_path_arch == '' and name != '' and
37
41
38
42
efi_libdir = get_option (' efi-libdir' )
39
43
if efi_libdir == ''
40
- fs = import (' fs' )
41
- multi = run_command (cc.cmd_array(), ' -print-multi-os-directory' , check : true ).stdout().strip()
42
- efi_libdir = join_paths (' /usr/lib/' , multi)
43
- if not fs.is_dir(join_paths (efi_libdir, ' gnuefi' ))
44
- efi_libdir = ' /usr/lib'
45
- endif
44
+ efi_libdir = gnuefi.get_variable (pkgconfig : ' libdir' )
46
45
endif
47
46
48
47
# The name we need to look for on this arch and OS: elf_x86_64_fbsd_efi.lds
@@ -51,34 +50,15 @@ if host_cpu == 'x86_64' and host_machine.system() == 'freebsd'
51
50
lds_os = ' _fbsd'
52
51
endif
53
52
54
- arch_lds = ' efi.lds'
55
- arch_crt = ' crt0.o'
53
+
56
54
if efi_ldsdir == ''
57
- efi_ldsdir = join_paths (efi_libdir, ' gnuefi' , gnu_efi_path_arch)
58
- cmd = run_command (' test' , ' -f' , join_paths (efi_ldsdir, arch_lds), check : false )
59
- if cmd.returncode() != 0
60
- arch_lds = ' elf_@0@@1@_efi.lds' .format(gnu_efi_path_arch, lds_os)
61
- arch_crt
= ' crt0-efi-@[email protected] ' .format(gnu_efi_path_arch)
62
- efi_ldsdir = join_paths (efi_libdir, ' gnuefi' )
63
- cmd = run_command (' test' , ' -f' , join_paths (efi_ldsdir, arch_lds), check : false )
64
- endif
65
- if cmd.returncode() != 0
66
55
efi_ldsdir = efi_libdir
67
- cmd = run_command (' test' , ' -f' , join_paths (efi_ldsdir, arch_lds), check : false )
68
- if cmd.returncode() != 0
69
- error (' Cannot find @0@' .format(arch_lds))
70
- endif
71
- endif
72
- else
73
- cmd = run_command (' test' , ' -f' , join_paths (efi_ldsdir, arch_lds), check : false )
74
- if cmd.returncode() != 0
75
- arch_lds = ' elf_@0@@1@_efi.lds' .format(gnu_efi_path_arch, lds_os)
76
- arch_crt
= ' crt0-efi-@[email protected] ' .format(gnu_efi_path_arch)
77
- cmd = run_command (' test' , ' -f' , join_paths (efi_ldsdir, arch_lds), check : false )
78
- endif
79
- if cmd.returncode() != 0
80
- error (' Cannot find @0@' .format(arch_lds))
81
- endif
56
+ endif
57
+ arch_lds = ' elf_@0@@1@_efi.lds' .format(gnu_efi_path_arch, lds_os)
58
+ arch_crt
= ' crt0-efi-@[email protected] ' .format(gnu_efi_path_arch)
59
+ cmd = run_command (' test' , ' -f' , join_paths (efi_ldsdir, arch_lds), check : false )
60
+ if cmd.returncode() != 0
61
+ error (' Cannot find @0@' .format(arch_lds))
82
62
endif
83
63
efi_crtdir = efi_ldsdir
84
64
0 commit comments