From cd4300f30f0e836ec2568a84eb7b1831c2163f21 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Mon, 23 Jan 2023 14:41:26 +0100 Subject: [PATCH 1/2] meson: Move bootctl sources defintion to its own file The root meson.build file is already large enough. --- meson.build | 20 ++------------------ src/boot/meson.build | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 src/boot/meson.build diff --git a/meson.build b/meson.build index d37f47d48b..edf4dcc5d9 100644 --- a/meson.build +++ b/meson.build @@ -2173,6 +2173,7 @@ subdir('src/journal') subdir('src/libsystemd-network') subdir('src/analyze') +subdir('src/boot') subdir('src/busctl') subdir('src/coredump') subdir('src/cryptenroll') @@ -2608,24 +2609,7 @@ if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1 exe = executable( 'bootctl', - ['src/boot/bootctl.c', - 'src/boot/bootctl.h', - 'src/boot/bootctl-install.c', - 'src/boot/bootctl-install.h', - 'src/boot/bootctl-random-seed.c', - 'src/boot/bootctl-random-seed.h', - 'src/boot/bootctl-reboot-to-firmware.c', - 'src/boot/bootctl-reboot-to-firmware.h', - 'src/boot/bootctl-set-efivar.c', - 'src/boot/bootctl-set-efivar.h', - 'src/boot/bootctl-status.c', - 'src/boot/bootctl-status.h', - 'src/boot/bootctl-systemd-efi-options.c', - 'src/boot/bootctl-systemd-efi-options.h', - 'src/boot/bootctl-uki.c', - 'src/boot/bootctl-uki.h', - 'src/boot/bootctl-util.c', - 'src/boot/bootctl-util.h'], + bootctl_sources, include_directories : includes, link_with : [boot_link_with], dependencies : [libblkid, diff --git a/src/boot/meson.build b/src/boot/meson.build new file mode 100644 index 0000000000..e4926645f5 --- /dev/null +++ b/src/boot/meson.build @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +bootctl_sources = files( + 'bootctl-install.c', + 'bootctl-install.h', + 'bootctl-random-seed.c', + 'bootctl-random-seed.h', + 'bootctl-reboot-to-firmware.c', + 'bootctl-reboot-to-firmware.h', + 'bootctl-set-efivar.c', + 'bootctl-set-efivar.h', + 'bootctl-status.c', + 'bootctl-status.h', + 'bootctl-systemd-efi-options.c', + 'bootctl-systemd-efi-options.h', + 'bootctl-uki.c', + 'bootctl-uki.h', + 'bootctl-util.c', + 'bootctl-util.h', + 'bootctl.c', + 'bootctl.h', +) From a6cabc90c86e67434cc461afe48d0f097b7a6028 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Mon, 23 Jan 2023 14:54:28 +0100 Subject: [PATCH 2/2] meson: Use python module for detection --- meson.build | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index edf4dcc5d9..8ab8d51b4b 100644 --- a/meson.build +++ b/meson.build @@ -1971,14 +1971,10 @@ jinja2_cmdline = [meson_render_jinja2, config_h, version_h] ############################################################ -python = find_program('python3') -if run_command(python, '-c', 'import jinja2', check : false).returncode() != 0 - error('python3 jinja2 missing') -endif +pymod = import('python') +python = pymod.find_installation('python3', required : true, modules : ['jinja2']) +python_39 = python.language_version().version_compare('>=3.9') -python_39 = run_command(python, '-c', - 'import sys; sys.exit(0 if sys.version_info >= (3,9) else 1)', - check : false).returncode() == 0 if get_option('ukify') == 'auto' want_ukify = python_39 and conf.get('HAVE_GNU_EFI') == 1 elif get_option('ukify') == 'true' and (not python_39 or conf.get('HAVE_GNU_EFI') != 1)