1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-08 21:17:47 +03:00

Merge pull request #21537 from medhefgo/boot-sbat

meson: Default to sbat-distro=auto
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-11-29 11:30:25 +01:00 committed by GitHub
commit 1e135e9780
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 11 deletions

View File

@ -417,7 +417,7 @@ option('efi-libdir', type : 'string',
description : 'path to the EFI lib directory')
option('efi-includedir', type : 'string', value : '/usr/include/efi',
description : 'path to the EFI header directory')
option('sbat-distro', type : 'string',
option('sbat-distro', type : 'string', value : 'auto',
description : 'SBAT distribution ID, e.g. fedora, or auto for autodetection')
option('sbat-distro-generation', type : 'integer', value : 1,
description : 'SBAT distribution generation')

View File

@ -162,7 +162,9 @@ foreach ctype : ['color-normal', 'color-entry', 'color-highlight', 'color-edit']
'EFI_' + c[1].strip().underscorify().to_upper()))
endforeach
if get_option('sbat-distro') != ''
if meson.is_cross_build() and get_option('sbat-distro') == 'auto'
warning('Auto detection of SBAT information not supported when cross-building, disabling SBAT.')
elif get_option('sbat-distro') != ''
efi_conf.set_quoted('SBAT_PROJECT', meson.project_name())
efi_conf.set_quoted('PROJECT_VERSION', meson.project_version())
efi_conf.set('PROJECT_URL', conf.get('PROJECT_URL'))
@ -174,7 +176,7 @@ if get_option('sbat-distro') != ''
['sbat-distro-summary', 'NAME'],
['sbat-distro-url', 'BUG_REPORT_URL']]
value = get_option(sbatvar[0])
if (value == '' and not meson.is_cross_build()) or value == 'auto'
if (value == '' or value == 'auto') and not meson.is_cross_build()
cmd = 'if [ -e /etc/os-release ]; then . /etc/os-release; else . /usr/lib/os-release; fi; echo $@0@'.format(sbatvar[1])
value = run_command(sh, '-c', cmd).stdout().strip()
message('@0@ (from @1@): @2@'.format(sbatvar[0], sbatvar[1], value))
@ -203,7 +205,7 @@ efi_config_h = configure_file(
output : 'efi_config.h',
configuration : efi_conf)
compile_args = cc.get_supported_arguments(
efi_cflags = cc.get_supported_arguments(
basic_disabled_warnings +
possible_common_cc_flags + [
'-fno-stack-protector',
@ -228,7 +230,7 @@ compile_args = cc.get_supported_arguments(
'-include', version_h,
]
compile_args += cc.get_supported_arguments({
efi_cflags += cc.get_supported_arguments({
'ia32': ['-mno-sse', '-mno-mmx'],
'x86_64': ['-mno-red-zone', '-mno-sse', '-mno-mmx'],
'arm': ['-mgeneral-regs-only', '-mfpu=none'],
@ -238,23 +240,23 @@ compile_args += cc.get_supported_arguments({
# relevant compiler flags from meson/CFLAGS as povided by the user or distro.
if get_option('werror')
compile_args += ['-Werror']
efi_cflags += ['-Werror']
endif
if get_option('debug')
compile_args += ['-ggdb', '-DEFI_DEBUG']
efi_cflags += ['-ggdb', '-DEFI_DEBUG']
endif
if get_option('optimization') != '0'
compile_args += ['-O' + get_option('optimization')]
efi_cflags += ['-O' + get_option('optimization')]
endif
if get_option('b_ndebug') == 'true' or (
get_option('b_ndebug') == 'if-release' and get_option('buildtype') in ['plain', 'release'])
compile_args += ['-DNDEBUG']
efi_cflags += ['-DNDEBUG']
endif
foreach arg : get_option('c_args')
if arg in ['-Werror', '-g', '-ggdb', '-O1', '-O2', '-O3', '-Og', '-Os', '-DNDEBUG']
message('Using "@0@" from c_args for EFI compiler'.format(arg))
compile_args += arg
efi_cflags += arg
endif
endforeach
@ -284,7 +286,7 @@ foreach file : fundamental_source_paths + common_sources + systemd_boot_sources
o_file = custom_target(file.split('/')[-1] + '.o',
input : file,
output : file.split('/')[-1] + '.o',
command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@', compile_args],
command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@', efi_cflags],
depend_files : efi_headers + fundamental_headers)
if (fundamental_source_paths + common_sources + systemd_boot_sources).contains(file)
systemd_boot_objects += o_file