|
|
8d419f |
From 3088f292855f4a525271906a5652985f01c5d7b2 Mon Sep 17 00:00:00 2001
|
|
|
8d419f |
From: Jan Janssen <medhefgo@web.de>
|
|
|
8d419f |
Date: Fri, 7 Jan 2022 21:55:50 +0100
|
|
|
8d419f |
Subject: [PATCH] meson: Use files() for source lists for boot and fundamental
|
|
|
8d419f |
|
|
|
8d419f |
This fixes build reproducibility as otherwise the full path
|
|
|
8d419f |
of the source files ends up in the output binary.
|
|
|
8d419f |
|
|
|
8d419f |
(cherry picked from commit b3c5a7074cd434bc02c4b560afe933d3df24759e)
|
|
|
8d419f |
|
|
|
8d419f |
Related: #2017035
|
|
|
8d419f |
---
|
|
|
8d419f |
src/boot/efi/meson.build | 29 +++++++++++++++++------------
|
|
|
8d419f |
src/fundamental/meson.build | 22 +++++++++-------------
|
|
|
8d419f |
2 files changed, 26 insertions(+), 25 deletions(-)
|
|
|
8d419f |
|
|
|
8d419f |
diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
|
|
|
8d419f |
index 144fbb0f43..4cc43dc00c 100644
|
|
|
8d419f |
--- a/src/boot/efi/meson.build
|
|
|
8d419f |
+++ b/src/boot/efi/meson.build
|
|
|
8d419f |
@@ -312,9 +312,10 @@ efi_headers = files(
|
|
|
8d419f |
'shim.h',
|
|
|
8d419f |
'splash.h',
|
|
|
8d419f |
'util.h',
|
|
|
8d419f |
- 'xbootldr.h')
|
|
|
8d419f |
+ 'xbootldr.h',
|
|
|
8d419f |
+)
|
|
|
8d419f |
|
|
|
8d419f |
-common_sources = [
|
|
|
8d419f |
+common_sources = files(
|
|
|
8d419f |
'assert.c',
|
|
|
8d419f |
'devicetree.c',
|
|
|
8d419f |
'disk.c',
|
|
|
8d419f |
@@ -322,31 +323,34 @@ common_sources = [
|
|
|
8d419f |
'measure.c',
|
|
|
8d419f |
'pe.c',
|
|
|
8d419f |
'secure-boot.c',
|
|
|
8d419f |
- 'util.c']
|
|
|
8d419f |
+ 'util.c',
|
|
|
8d419f |
+)
|
|
|
8d419f |
|
|
|
8d419f |
-systemd_boot_sources = [
|
|
|
8d419f |
+systemd_boot_sources = files(
|
|
|
8d419f |
'boot.c',
|
|
|
8d419f |
'console.c',
|
|
|
8d419f |
'drivers.c',
|
|
|
8d419f |
'random-seed.c',
|
|
|
8d419f |
'shim.c',
|
|
|
8d419f |
- 'xbootldr.c']
|
|
|
8d419f |
+ 'xbootldr.c',
|
|
|
8d419f |
+)
|
|
|
8d419f |
|
|
|
8d419f |
-stub_sources = [
|
|
|
8d419f |
+stub_sources = files(
|
|
|
8d419f |
'cpio.c',
|
|
|
8d419f |
'initrd.c',
|
|
|
8d419f |
'splash.c',
|
|
|
8d419f |
- 'stub.c']
|
|
|
8d419f |
+ 'stub.c',
|
|
|
8d419f |
+)
|
|
|
8d419f |
|
|
|
8d419f |
if efi_arch[1] in ['ia32', 'x86_64']
|
|
|
8d419f |
- stub_sources += 'linux_x86.c'
|
|
|
8d419f |
+ stub_sources += files('linux_x86.c')
|
|
|
8d419f |
else
|
|
|
8d419f |
- stub_sources += 'linux.c'
|
|
|
8d419f |
+ stub_sources += files('linux.c')
|
|
|
8d419f |
endif
|
|
|
8d419f |
|
|
|
8d419f |
# BCD parser only makes sense on arches that Windows supports.
|
|
|
8d419f |
if efi_arch[1] in ['ia32', 'x86_64', 'arm', 'aarch64']
|
|
|
8d419f |
- systemd_boot_sources += 'bcd.c'
|
|
|
8d419f |
+ systemd_boot_sources += files('bcd.c')
|
|
|
8d419f |
tests += [
|
|
|
8d419f |
[['src/boot/efi/test-bcd.c'],
|
|
|
8d419f |
[],
|
|
|
8d419f |
@@ -359,9 +363,10 @@ endif
|
|
|
8d419f |
systemd_boot_objects = []
|
|
|
8d419f |
stub_objects = []
|
|
|
8d419f |
foreach file : fundamental_source_paths + common_sources + systemd_boot_sources + stub_sources
|
|
|
8d419f |
- o_file = custom_target(file.split('/')[-1] + '.o',
|
|
|
8d419f |
+ # FIXME: replace ''.format(file) with fs.name(file) when meson_version requirement is >= 0.59.0
|
|
|
8d419f |
+ o_file = custom_target('@0@.o'.format(file).split('/')[-1],
|
|
|
8d419f |
input : file,
|
|
|
8d419f |
- output : file.split('/')[-1] + '.o',
|
|
|
8d419f |
+ output : '@0@.o'.format(file).split('/')[-1],
|
|
|
8d419f |
command : [cc.cmd_array(), '-c', '@INPUT@', '-o', '@OUTPUT@', efi_cflags],
|
|
|
8d419f |
depend_files : efi_headers + fundamental_headers)
|
|
|
8d419f |
if (fundamental_source_paths + common_sources + systemd_boot_sources).contains(file)
|
|
|
8d419f |
diff --git a/src/fundamental/meson.build b/src/fundamental/meson.build
|
|
|
8d419f |
index 287f0fe36a..f927788c3a 100644
|
|
|
8d419f |
--- a/src/fundamental/meson.build
|
|
|
8d419f |
+++ b/src/fundamental/meson.build
|
|
|
8d419f |
@@ -8,20 +8,16 @@ fundamental_headers = files(
|
|
|
8d419f |
'macro-fundamental.h',
|
|
|
8d419f |
'sha256.h',
|
|
|
8d419f |
'string-util-fundamental.h',
|
|
|
8d419f |
- 'types-fundamental.h')
|
|
|
8d419f |
-
|
|
|
8d419f |
-sources = '''
|
|
|
8d419f |
- bootspec-fundamental.c
|
|
|
8d419f |
- efivars-fundamental.c
|
|
|
8d419f |
- string-util-fundamental.c
|
|
|
8d419f |
- sha256.c
|
|
|
8d419f |
-'''.split()
|
|
|
8d419f |
+ 'types-fundamental.h',
|
|
|
8d419f |
+)
|
|
|
8d419f |
|
|
|
8d419f |
# for sd-boot
|
|
|
8d419f |
-fundamental_source_paths = []
|
|
|
8d419f |
-foreach source : sources
|
|
|
8d419f |
- fundamental_source_paths += meson.current_source_dir() / source
|
|
|
8d419f |
-endforeach
|
|
|
8d419f |
+fundamental_source_paths = files(
|
|
|
8d419f |
+ 'bootspec-fundamental.c',
|
|
|
8d419f |
+ 'efivars-fundamental.c',
|
|
|
8d419f |
+ 'sha256.c',
|
|
|
8d419f |
+ 'string-util-fundamental.c',
|
|
|
8d419f |
+)
|
|
|
8d419f |
|
|
|
8d419f |
# for libbasic
|
|
|
8d419f |
-fundamental_sources = files(sources) + fundamental_headers
|
|
|
8d419f |
+fundamental_sources = fundamental_source_paths + fundamental_headers
|